Commit 7a436d1c authored by 季圣华's avatar 季圣华
Browse files

!14 格式化代码,看着有点别扭

Merge pull request !14 from SmkfGao/master
parents 8f304964 6bc92ec9
...@@ -4,20 +4,17 @@ import com.jsh.base.BaseService; ...@@ -4,20 +4,17 @@ import com.jsh.base.BaseService;
import com.jsh.dao.basic.CategoryIDAO; import com.jsh.dao.basic.CategoryIDAO;
import com.jsh.model.po.Category; import com.jsh.model.po.Category;
public class CategoryService extends BaseService<Category> implements CategoryIService public class CategoryService extends BaseService<Category> implements CategoryIService {
{ @SuppressWarnings("unused")
@SuppressWarnings("unused") private CategoryIDAO categoryDao;
private CategoryIDAO categoryDao;
public void setCategoryDao(CategoryIDAO categoryDao) public void setCategoryDao(CategoryIDAO categoryDao) {
{
this.categoryDao = categoryDao; this.categoryDao = categoryDao;
} }
@Override @Override
protected Class<Category> getEntityClass() protected Class<Category> getEntityClass() {
{ return Category.class;
return Category.class; }
}
} }
...@@ -3,7 +3,6 @@ package com.jsh.service.basic; ...@@ -3,7 +3,6 @@ package com.jsh.service.basic;
import com.jsh.base.BaseIService; import com.jsh.base.BaseIService;
import com.jsh.model.po.Depot; import com.jsh.model.po.Depot;
public interface DepotIService extends BaseIService<Depot> public interface DepotIService extends BaseIService<Depot> {
{
} }
...@@ -5,28 +5,25 @@ import com.jsh.dao.basic.DepotIDAO; ...@@ -5,28 +5,25 @@ import com.jsh.dao.basic.DepotIDAO;
import com.jsh.dao.basic.UserBusinessIDAO; import com.jsh.dao.basic.UserBusinessIDAO;
import com.jsh.model.po.Depot; import com.jsh.model.po.Depot;
public class DepotService extends BaseService<Depot> implements DepotIService public class DepotService extends BaseService<Depot> implements DepotIService {
{ @SuppressWarnings("unused")
@SuppressWarnings("unused") private DepotIDAO depotDao;
private DepotIDAO depotDao; @SuppressWarnings("unused")
@SuppressWarnings("unused") private UserBusinessIDAO userBusinessDao;
private UserBusinessIDAO userBusinessDao;
public void setDepotDao(DepotIDAO depotDao) {
public void setDepotDao(DepotIDAO depotDao) this.depotDao = depotDao;
{ }
this.depotDao = depotDao;
} public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) {
this.userBusinessDao = userBusinessDao;
public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { }
this.userBusinessDao = userBusinessDao;
}
@Override
protected Class<Depot> getEntityClass() {
@Override return Depot.class;
protected Class<Depot> getEntityClass() }
{
return Depot.class;
}
} }
...@@ -3,7 +3,6 @@ package com.jsh.service.basic; ...@@ -3,7 +3,6 @@ package com.jsh.service.basic;
import com.jsh.base.BaseIService; import com.jsh.base.BaseIService;
import com.jsh.model.po.Functions; import com.jsh.model.po.Functions;
public interface FunctionsIService extends BaseIService<Functions> public interface FunctionsIService extends BaseIService<Functions> {
{
} }
...@@ -5,27 +5,24 @@ import com.jsh.dao.basic.FunctionsIDAO; ...@@ -5,27 +5,24 @@ import com.jsh.dao.basic.FunctionsIDAO;
import com.jsh.dao.basic.UserBusinessIDAO; import com.jsh.dao.basic.UserBusinessIDAO;
import com.jsh.model.po.Functions; import com.jsh.model.po.Functions;
public class FunctionsService extends BaseService<Functions> implements FunctionsIService public class FunctionsService extends BaseService<Functions> implements FunctionsIService {
{ @SuppressWarnings("unused")
@SuppressWarnings("unused") private FunctionsIDAO functionsDao;
private FunctionsIDAO functionsDao; @SuppressWarnings("unused")
@SuppressWarnings("unused") private UserBusinessIDAO userBusinessDao;
private UserBusinessIDAO userBusinessDao;
public void setFunctionsDao(FunctionsIDAO functionsDao) public void setFunctionsDao(FunctionsIDAO functionsDao) {
{ this.functionsDao = functionsDao;
this.functionsDao = functionsDao; }
}
public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) {
public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { this.userBusinessDao = userBusinessDao;
this.userBusinessDao = userBusinessDao; }
}
@Override
@Override protected Class<Functions> getEntityClass() {
protected Class<Functions> getEntityClass() return Functions.class;
{ }
return Functions.class;
}
} }
...@@ -3,7 +3,6 @@ package com.jsh.service.basic; ...@@ -3,7 +3,6 @@ package com.jsh.service.basic;
import com.jsh.base.BaseIService; import com.jsh.base.BaseIService;
import com.jsh.model.po.InOutItem; import com.jsh.model.po.InOutItem;
public interface InOutItemIService extends BaseIService<InOutItem> public interface InOutItemIService extends BaseIService<InOutItem> {
{
} }
...@@ -4,19 +4,16 @@ import com.jsh.base.BaseService; ...@@ -4,19 +4,16 @@ import com.jsh.base.BaseService;
import com.jsh.dao.basic.InOutItemIDAO; import com.jsh.dao.basic.InOutItemIDAO;
import com.jsh.model.po.InOutItem; import com.jsh.model.po.InOutItem;
public class InOutItemService extends BaseService<InOutItem> implements InOutItemIService public class InOutItemService extends BaseService<InOutItem> implements InOutItemIService {
{
@SuppressWarnings("unused") @SuppressWarnings("unused")
private InOutItemIDAO inOutItemDao; private InOutItemIDAO inOutItemDao;
public void setInOutItemDao(InOutItemIDAO inOutItemDao) public void setInOutItemDao(InOutItemIDAO inOutItemDao) {
{
this.inOutItemDao = inOutItemDao; this.inOutItemDao = inOutItemDao;
} }
@Override @Override
protected Class<InOutItem> getEntityClass() protected Class<InOutItem> getEntityClass() {
{
return InOutItem.class; return InOutItem.class;
} }
......
package com.jsh.service.basic; package com.jsh.service.basic;
import com.jsh.base.BaseIService; import com.jsh.base.BaseIService;
import com.jsh.util.JshException;
import com.jsh.model.po.Logdetails; import com.jsh.model.po.Logdetails;
import com.jsh.util.JshException;
public interface LogIService extends BaseIService<Logdetails> public interface LogIService extends BaseIService<Logdetails> {
{ /**
/** * 增加
* 增加 *
* @param t 对象 * @param t 对象
* @throws JshException * @throws JshException
*/ */
@Override @Override
void save(Logdetails t); void save(Logdetails t);
} }
...@@ -5,32 +5,25 @@ import com.jsh.base.Log; ...@@ -5,32 +5,25 @@ import com.jsh.base.Log;
import com.jsh.dao.basic.LogIDAO; import com.jsh.dao.basic.LogIDAO;
import com.jsh.model.po.Logdetails; import com.jsh.model.po.Logdetails;
public class LogService extends BaseService<Logdetails> implements LogIService public class LogService extends BaseService<Logdetails> implements LogIService {
{
@SuppressWarnings("unused") @SuppressWarnings("unused")
private LogIDAO logDao; private LogIDAO logDao;
public void setLogDao(LogIDAO logDao) public void setLogDao(LogIDAO logDao) {
{
this.logDao = logDao; this.logDao = logDao;
} }
@Override @Override
protected Class<Logdetails> getEntityClass() protected Class<Logdetails> getEntityClass() {
{ return Logdetails.class;
return Logdetails.class; }
}
@Override
@Override public void save(Logdetails t) {
public void save(Logdetails t) try {
{ super.save(t);
try } catch (Exception e) {
{ Log.errorFileSync(">>>>>>>>>>>>>>>>创建操作日志异常", e);
super.save(t); }
} }
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>创建操作日志异常", e);
}
}
} }
\ No newline at end of file
...@@ -3,7 +3,6 @@ package com.jsh.service.basic; ...@@ -3,7 +3,6 @@ package com.jsh.service.basic;
import com.jsh.base.BaseIService; import com.jsh.base.BaseIService;
import com.jsh.model.po.Role; import com.jsh.model.po.Role;
public interface RoleIService extends BaseIService<Role> public interface RoleIService extends BaseIService<Role> {
{
} }
...@@ -5,26 +5,23 @@ import com.jsh.dao.basic.RoleIDAO; ...@@ -5,26 +5,23 @@ import com.jsh.dao.basic.RoleIDAO;
import com.jsh.dao.basic.UserBusinessIDAO; import com.jsh.dao.basic.UserBusinessIDAO;
import com.jsh.model.po.Role; import com.jsh.model.po.Role;
public class RoleService extends BaseService<Role> implements RoleIService public class RoleService extends BaseService<Role> implements RoleIService {
{ @SuppressWarnings("unused")
@SuppressWarnings("unused") private RoleIDAO roleDao;
private RoleIDAO roleDao; @SuppressWarnings("unused")
@SuppressWarnings("unused") private UserBusinessIDAO userBusinessDao;
private UserBusinessIDAO userBusinessDao;
public void setRoleDao(RoleIDAO roleDao) {
this.roleDao = roleDao;
}
public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) {
this.userBusinessDao = userBusinessDao;
}
@Override
protected Class<Role> getEntityClass() {
return Role.class;
}
public void setRoleDao(RoleIDAO roleDao)
{
this.roleDao = roleDao;
}
public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) {
this.userBusinessDao = userBusinessDao;
}
@Override
protected Class<Role> getEntityClass()
{
return Role.class;
}
} }
...@@ -8,11 +8,10 @@ import com.jsh.util.PageUtil; ...@@ -8,11 +8,10 @@ import com.jsh.util.PageUtil;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
public interface SupplierIService extends BaseIService<Supplier> public interface SupplierIService extends BaseIService<Supplier> {
{ public void batchSetEnable(Boolean enable, String supplierIDs);
public void batchSetEnable(Boolean enable,String supplierIDs);
public InputStream exmportExcel(String isAllPage,PageUtil<Supplier> pageUtil)throws JshException; public InputStream exmportExcel(String isAllPage, PageUtil<Supplier> pageUtil) throws JshException;
public InputStream importExcel(File assetFile)throws JshException; public InputStream importExcel(File assetFile) throws JshException;
} }
...@@ -5,7 +5,10 @@ import com.jsh.base.Log; ...@@ -5,7 +5,10 @@ import com.jsh.base.Log;
import com.jsh.dao.basic.SupplierIDAO; import com.jsh.dao.basic.SupplierIDAO;
import com.jsh.dao.basic.UserBusinessIDAO; import com.jsh.dao.basic.UserBusinessIDAO;
import com.jsh.model.po.Supplier; import com.jsh.model.po.Supplier;
import com.jsh.util.*; import com.jsh.util.JshException;
import com.jsh.util.PageUtil;
import com.jsh.util.SupplierConstants;
import com.jsh.util.Tools;
import jxl.Workbook; import jxl.Workbook;
import jxl.format.Colour; import jxl.format.Colour;
import jxl.write.*; import jxl.write.*;
...@@ -18,442 +21,417 @@ import java.io.*; ...@@ -18,442 +21,417 @@ import java.io.*;
import java.lang.Boolean; import java.lang.Boolean;
import java.util.*; import java.util.*;
public class SupplierService extends BaseService<Supplier> implements SupplierIService public class SupplierService extends BaseService<Supplier> implements SupplierIService {
{ /**
@SuppressWarnings("unused") * 初始化加载所有系统基础数据
private SupplierIDAO supplierDao; */
@SuppressWarnings("unused") @SuppressWarnings({"rawtypes"})
private UserBusinessIDAO userBusinessDao; private static Map<String, List> mapData = new HashMap<String, List>();
/**
* 错误的表格数据
*/
private static List<Supplier> wrongData = new ArrayList<Supplier>();
@SuppressWarnings("unused")
private SupplierIDAO supplierDao;
@SuppressWarnings("unused")
private UserBusinessIDAO userBusinessDao;
/** /**
* 设置映射基类 * 设置映射基类
* @return *
*/ * @return
@Override */
protected Class<Supplier> getEntityClass() @Override
{ protected Class<Supplier> getEntityClass() {
return Supplier.class; return Supplier.class;
} }
public void setSupplierDao(SupplierIDAO supplierDao)
{
this.supplierDao = supplierDao;
}
public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { public void setSupplierDao(SupplierIDAO supplierDao) {
this.userBusinessDao = userBusinessDao; this.supplierDao = supplierDao;
} }
public void batchSetEnable(Boolean enable,String supplierIDs){ public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) {
supplierDao.batchSetEnable(enable, supplierIDs); this.userBusinessDao = userBusinessDao;
} }
/** public void batchSetEnable(Boolean enable, String supplierIDs) {
* 初始化加载所有系统基础数据 supplierDao.batchSetEnable(enable, supplierIDs);
*/ }
@SuppressWarnings({"rawtypes"})
private static Map<String,List> mapData = new HashMap<String, List>();
/** /**
* 错误的表格数据 * 导出Excel表格
*/ */
private static List<Supplier> wrongData = new ArrayList<Supplier>(); @Override
/** public InputStream exmportExcel(String isAllPage, PageUtil<Supplier> pageUtil) throws JshException {
* 导出Excel表格 try {
*/ //将OutputStream转化为InputStream
@Override ByteArrayOutputStream out = new ByteArrayOutputStream();
public InputStream exmportExcel(String isAllPage, PageUtil<Supplier> pageUtil)throws JshException putDataOnOutputStream(out, pageUtil.getPageList());
{ return new ByteArrayInputStream(out.toByteArray());
try } catch (Exception e) {
{ Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e);
//将OutputStream转化为InputStream throw new JshException("导出信息为excel表格异常", e);
ByteArrayOutputStream out = new ByteArrayOutputStream(); }
putDataOnOutputStream(out, pageUtil.getPageList()); }
return new ByteArrayInputStream(out.toByteArray());
}
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e);
throw new JshException("导出信息为excel表格异常",e);
}
}
/** /**
* 生成excel表格 * 生成excel表格
* @param os *
*/ * @param os
@SuppressWarnings("deprecation") */
private void putDataOnOutputStream(OutputStream os, List<Supplier> dataList) { @SuppressWarnings("deprecation")
WritableWorkbook workbook = null; private void putDataOnOutputStream(OutputStream os, List<Supplier> dataList) {
try { WritableWorkbook workbook = null;
workbook = Workbook.createWorkbook(os); try {
WritableSheet sheet = workbook.createSheet("信息报表", 0); workbook = Workbook.createWorkbook(os);
//增加列头 WritableSheet sheet = workbook.createSheet("信息报表", 0);
String[] colunmName = {"名称","类型","联系人","电话","电子邮箱","预收款","期初应收","期初应付","备注","传真","手机","地址","纳税人识别号","开户行","账号","税率","状态"}; //增加列头
for(int i = 0 ;i < colunmName.length;i ++) { String[] colunmName = {"名称", "类型", "联系人", "电话", "电子邮箱", "预收款", "期初应收", "期初应付", "备注", "传真", "手机", "地址", "纳税人识别号", "开户行", "账号", "税率", "状态"};
sheet.setColumnView(i, 10); for (int i = 0; i < colunmName.length; i++) {
sheet.addCell(new Label(i, 0, colunmName[i])); sheet.setColumnView(i, 10);
} sheet.addCell(new Label(i, 0, colunmName[i]));
if (null != dataList && dataList.size() > 0) { }
int i = 1; if (null != dataList && dataList.size() > 0) {
for (Supplier supplier: dataList){ int i = 1;
int j = 0; for (Supplier supplier : dataList) {
Map<Integer,String> cellInfo = supplier.getCellInfo(); int j = 0;
sheet.addCell(new Label(j++,i, supplier.getSupplier())); Map<Integer, String> cellInfo = supplier.getCellInfo();
sheet.addCell(new Label(j++,i, supplier.getType())); sheet.addCell(new Label(j++, i, supplier.getSupplier()));
sheet.addCell(new Label(j++,i, supplier.getContacts() == null ?"": supplier.getContacts())); sheet.addCell(new Label(j++, i, supplier.getType()));
sheet.addCell(new Label(j++,i, supplier.getPhonenum() == null ?"": supplier.getPhonenum())); sheet.addCell(new Label(j++, i, supplier.getContacts() == null ? "" : supplier.getContacts()));
sheet.addCell(new Label(j++,i, supplier.getEmail() == null ?"": supplier.getEmail())); sheet.addCell(new Label(j++, i, supplier.getPhonenum() == null ? "" : supplier.getPhonenum()));
sheet.addCell(getLabelInfo(cellInfo,j++,i, supplier.getAdvanceIn() == null ?"": supplier.getAdvanceIn().toString(),supplier)); sheet.addCell(new Label(j++, i, supplier.getEmail() == null ? "" : supplier.getEmail()));
sheet.addCell(getLabelInfo(cellInfo,j++,i, supplier.getBeginNeedGet() == null ?"": supplier.getBeginNeedGet().toString(),supplier)); sheet.addCell(getLabelInfo(cellInfo, j++, i, supplier.getAdvanceIn() == null ? "" : supplier.getAdvanceIn().toString(), supplier));
sheet.addCell(getLabelInfo(cellInfo,j++,i, supplier.getBeginNeedPay() == null ?"": supplier.getBeginNeedPay().toString(),supplier)); sheet.addCell(getLabelInfo(cellInfo, j++, i, supplier.getBeginNeedGet() == null ? "" : supplier.getBeginNeedGet().toString(), supplier));
sheet.addCell(new Label(j++,i, supplier.getDescription() == null ?"": supplier.getDescription())); sheet.addCell(getLabelInfo(cellInfo, j++, i, supplier.getBeginNeedPay() == null ? "" : supplier.getBeginNeedPay().toString(), supplier));
sheet.addCell(new Label(j++,i, supplier.getFax() == null ?"": supplier.getFax())); sheet.addCell(new Label(j++, i, supplier.getDescription() == null ? "" : supplier.getDescription()));
sheet.addCell(new Label(j++,i, supplier.getTelephone() == null ?"": supplier.getTelephone())); sheet.addCell(new Label(j++, i, supplier.getFax() == null ? "" : supplier.getFax()));
sheet.addCell(new Label(j++,i, supplier.getAddress() == null ?"": supplier.getAddress())); sheet.addCell(new Label(j++, i, supplier.getTelephone() == null ? "" : supplier.getTelephone()));
sheet.addCell(new Label(j++,i, supplier.getTaxNum() == null ?"": supplier.getTaxNum())); sheet.addCell(new Label(j++, i, supplier.getAddress() == null ? "" : supplier.getAddress()));
sheet.addCell(new Label(j++,i, supplier.getBankName() == null ?"": supplier.getBankName())); sheet.addCell(new Label(j++, i, supplier.getTaxNum() == null ? "" : supplier.getTaxNum()));
sheet.addCell(new Label(j++,i, supplier.getAccountNumber() == null ?"": supplier.getAccountNumber())); sheet.addCell(new Label(j++, i, supplier.getBankName() == null ? "" : supplier.getBankName()));
sheet.addCell(getLabelInfo(cellInfo,j++,i, supplier.getTaxRate() == null ?"": supplier.getTaxRate().toString(),supplier)); sheet.addCell(new Label(j++, i, supplier.getAccountNumber() == null ? "" : supplier.getAccountNumber()));
sheet.addCell(new Label(j++,i, supplier.getEnabled()?"启用":"禁用")); sheet.addCell(getLabelInfo(cellInfo, j++, i, supplier.getTaxRate() == null ? "" : supplier.getTaxRate().toString(), supplier));
i++; sheet.addCell(new Label(j++, i, supplier.getEnabled() ? "启用" : "禁用"));
} i++;
} }
workbook.write(); }
workbook.close(); workbook.write();
} workbook.close();
catch (Exception e) { } catch (Exception e) {
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e); Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e);
} }
} }
/** /**
* 根据错误信息进行提示--excel表格背景设置为红色,表示导入信息有误 * 根据错误信息进行提示--excel表格背景设置为红色,表示导入信息有误
* @param cellInfo *
* @param cellNum * @param cellInfo
* @param columnNum * @param cellNum
* @param value * @param columnNum
* @return * @param value
*/ * @return
private Label getLabelInfo(Map<Integer,String> cellInfo,int cellNum,int columnNum,String value,Supplier supplier) */
{ private Label getLabelInfo(Map<Integer, String> cellInfo, int cellNum, int columnNum, String value, Supplier supplier) {
Label label = null; Label label = null;
//设置背景颜色 //设置背景颜色
WritableCellFormat cellFormat = new WritableCellFormat(); WritableCellFormat cellFormat = new WritableCellFormat();
try try {
{ cellFormat.setBackground(Colour.RED);
cellFormat.setBackground(Colour.RED); } catch (WriteException e) {
} Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误", e);
catch (WriteException e) }
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误", e);
}
if(null == cellInfo || cellInfo.size() == 0) { if (null == cellInfo || cellInfo.size() == 0) {
label = new Label(cellNum, columnNum, value); label = new Label(cellNum, columnNum, value);
} } else {
else { //表示此单元格有错误
//表示此单元格有错误 if (cellInfo.containsKey(cellNum)) {
if(cellInfo.containsKey(cellNum)) { if (cellNum == SupplierConstants.BusinessForExcel.EXCEL_ADVANCE_IN) {
if(cellNum == SupplierConstants.BusinessForExcel.EXCEL_ADVANCE_IN) { label = new Label(cellNum, columnNum, supplier.getAdvanceInStr(), cellFormat);
label = new Label(cellNum, columnNum, supplier.getAdvanceInStr(), cellFormat); } else if (cellNum == SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_GET) {
} label = new Label(cellNum, columnNum, supplier.getBeginNeedGetStr(), cellFormat);
else if(cellNum == SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_GET) { } else if (cellNum == SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_PAY) {
label = new Label(cellNum, columnNum, supplier.getBeginNeedGetStr(), cellFormat); label = new Label(cellNum, columnNum, supplier.getBeginNeedPayStr(), cellFormat);
} } else if (cellNum == SupplierConstants.BusinessForExcel.EXCEL_TAX_RATE) {
else if(cellNum == SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_PAY) { label = new Label(cellNum, columnNum, supplier.getTaxRateStr(), cellFormat);
label = new Label(cellNum, columnNum, supplier.getBeginNeedPayStr(), cellFormat); }
} } else {
else if(cellNum == SupplierConstants.BusinessForExcel.EXCEL_TAX_RATE) { label = new Label(cellNum, columnNum, value);
label = new Label(cellNum, columnNum, supplier.getTaxRateStr(), cellFormat); }
} }
} return label;
else{ }
label = new Label(cellNum, columnNum, value);
}
}
return label;
}
@Override @Override
public InputStream importExcel(File assetFile) throws JshException { public InputStream importExcel(File assetFile) throws JshException {
//全局变量--每次调用前需要清空数据 //全局变量--每次调用前需要清空数据
mapData.clear(); mapData.clear();
//2、解析文件成资产数据 //2、解析文件成资产数据
parseFile(assetFile); parseFile(assetFile);
if(null != wrongData && wrongData.size()>0) { if (null != wrongData && wrongData.size() > 0) {
//将OutputStream转化为InputStream //将OutputStream转化为InputStream
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
putDataOnOutputStream(out,wrongData); putDataOnOutputStream(out, wrongData);
return new ByteArrayInputStream(out.toByteArray()); return new ByteArrayInputStream(out.toByteArray());
} } else {
else{ return null;
return null; }
} }
}
/** /**
* 解析excel表格 * 解析excel表格
* @param assetFile *
*/ * @param assetFile
@SuppressWarnings("unchecked") */
private void parseFile(File assetFile) { @SuppressWarnings("unchecked")
//每次调用前清空 private void parseFile(File assetFile) {
wrongData.clear(); //每次调用前清空
int totalRow = 0; wrongData.clear();
try { int totalRow = 0;
//创建对Excel工作簿文件的引用 try {
HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(assetFile)); //创建对Excel工作簿文件的引用
//创建对工作表的引用,获取第一个工作表的内容 HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(assetFile));
HSSFSheet sheet = workbook.getSheetAt(0); //创建对工作表的引用,获取第一个工作表的内容
/** HSSFSheet sheet = workbook.getSheetAt(0);
* ===================================== /**
* 1、此处要增加文件的验证,如果不是资产文件需要进行特殊的处理,13列 * =====================================
* 2、文件内容为空处理 * 1、此处要增加文件的验证,如果不是资产文件需要进行特殊的处理,13列
* 3、如果是修改过的文件内容 * 2、文件内容为空处理
*/ * 3、如果是修改过的文件内容
Iterator<Row> itsheet = sheet.rowIterator(); */
while(itsheet.hasNext()) { Iterator<Row> itsheet = sheet.rowIterator();
//获取当前行数据 while (itsheet.hasNext()) {
Row row = itsheet.next(); //获取当前行数据
//获取一行有多少单元格 Row row = itsheet.next();
//获取一行有多少单元格
// System.out.println(row.getLastCellNum()); // System.out.println(row.getLastCellNum());
//excel表格第几行数据 从1开始 0 是表头 //excel表格第几行数据 从1开始 0 是表头
int rowNum = row.getRowNum(); int rowNum = row.getRowNum();
/** /**
* 表头跳过不读 * 表头跳过不读
*/ */
if(SupplierConstants.BusinessForExcel.EXCEL_TABLE_HEAD == rowNum) if (SupplierConstants.BusinessForExcel.EXCEL_TABLE_HEAD == rowNum)
continue; continue;
//开始处理excel表格内容 --每行数据读取,同时统计总共行数 //开始处理excel表格内容 --每行数据读取,同时统计总共行数
totalRow ++; totalRow++;
//获取excel表格的每格数据内容 //获取excel表格的每格数据内容
Iterator<Cell> it = row.cellIterator(); Iterator<Cell> it = row.cellIterator();
//资产子类型--添加了一些excel表格数据 //资产子类型--添加了一些excel表格数据
Supplier supplier = new Supplier(); Supplier supplier = new Supplier();
//保存每个单元格错误类型 //保存每个单元格错误类型
Map<Integer,String> cellType = new HashMap<Integer,String>(); Map<Integer, String> cellType = new HashMap<Integer, String>();
Boolean hasBeginNeedGet = false; //是否存在期初应付 Boolean hasBeginNeedGet = false; //是否存在期初应付
//设置列号 //设置列号
supplier.setRowLineNum(rowNum); supplier.setRowLineNum(rowNum);
Cell cell = null; Cell cell = null;
//判断列号--从零开始 //判断列号--从零开始
int cellIndex = 0; int cellIndex = 0;
while(it.hasNext()) { while (it.hasNext()) {
//获取每个单元格对象 //获取每个单元格对象
cell = it.next(); cell = it.next();
//获取列号 //获取列号
cellIndex = cell.getColumnIndex(); cellIndex = cell.getColumnIndex();
//设置此单元格为字符串类型 //设置此单元格为字符串类型
cell.setCellType(Cell.CELL_TYPE_STRING); cell.setCellType(Cell.CELL_TYPE_STRING);
Log.infoFileSync("==================excel表格中第" + totalRow + "行的第 " + cellIndex + "列的值为" + cell.getStringCellValue()); Log.infoFileSync("==================excel表格中第" + totalRow + "行的第 " + cellIndex + "列的值为" + cell.getStringCellValue());
//每行中数据顺序 "名称","类型","联系人","电话","电子邮箱","预收款","期初应收","期初应付","备注","传真","手机","地址","纳税人识别号","开户行","账号","税率" //每行中数据顺序 "名称","类型","联系人","电话","电子邮箱","预收款","期初应收","期初应付","备注","传真","手机","地址","纳税人识别号","开户行","账号","税率"
switch(cellIndex) { switch (cellIndex) {
case SupplierConstants.BusinessForExcel.EXCEL_SUPPLIER : case SupplierConstants.BusinessForExcel.EXCEL_SUPPLIER:
String supplierName = cell.getStringCellValue(); String supplierName = cell.getStringCellValue();
if(null == supplierName || "".equals(supplierName)) { if (null == supplierName || "".equals(supplierName)) {
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(名称)信息"); Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(名称)信息");
break; break;
} }
supplier.setSupplier(supplierName); supplier.setSupplier(supplierName);
break; break;
case SupplierConstants.BusinessForExcel.EXCEL_TYPE : case SupplierConstants.BusinessForExcel.EXCEL_TYPE:
String type = cell.getStringCellValue(); String type = cell.getStringCellValue();
if(null == type || "".equals(type)) { if (null == type || "".equals(type)) {
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(类型)信息"); Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(类型)信息");
break; break;
} }
supplier.setType(type); supplier.setType(type);
break; break;
case SupplierConstants.BusinessForExcel.EXCEL_CONTACTS: case SupplierConstants.BusinessForExcel.EXCEL_CONTACTS:
String contacts = cell.getStringCellValue(); String contacts = cell.getStringCellValue();
if(null == contacts || "".equals(contacts)) { if (null == contacts || "".equals(contacts)) {
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(联系人)信息"); Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(联系人)信息");
break; break;
} }
supplier.setContacts(contacts); supplier.setContacts(contacts);
break; break;
case SupplierConstants.BusinessForExcel.EXCEL_PHONE_NUM : case SupplierConstants.BusinessForExcel.EXCEL_PHONE_NUM:
String phoneNum = cell.getStringCellValue(); String phoneNum = cell.getStringCellValue();
if(null == phoneNum || "".equals(phoneNum)) { if (null == phoneNum || "".equals(phoneNum)) {
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(电话)信息"); Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(电话)信息");
break; break;
} }
supplier.setPhonenum(phoneNum); supplier.setPhonenum(phoneNum);
break; break;
case SupplierConstants.BusinessForExcel.EXCEL_EMAIL : case SupplierConstants.BusinessForExcel.EXCEL_EMAIL:
String email = cell.getStringCellValue(); String email = cell.getStringCellValue();
if(null == email || "".equals(email)) { if (null == email || "".equals(email)) {
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(电子邮箱)信息"); Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(电子邮箱)信息");
break; break;
} }
supplier.setEmail(email); supplier.setEmail(email);
break; break;
case SupplierConstants.BusinessForExcel.EXCEL_ADVANCE_IN : case SupplierConstants.BusinessForExcel.EXCEL_ADVANCE_IN:
String advanceIn = cell.getStringCellValue(); String advanceIn = cell.getStringCellValue();
if(null == advanceIn || "".equals(advanceIn)) { if (null == advanceIn || "".equals(advanceIn)) {
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(预收款)信息"); Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(预收款)信息");
break; break;
} }
if(Tools.checkStrIsNum(advanceIn)) { if (Tools.checkStrIsNum(advanceIn)) {
supplier.setAdvanceIn(Double.parseDouble(advanceIn)); supplier.setAdvanceIn(Double.parseDouble(advanceIn));
} } else {
else{ Log.errorFileSync(">>>>>>>>>>>>>>>>>(预收款)不是数字格式");
Log.errorFileSync(">>>>>>>>>>>>>>>>>(预收款)不是数字格式"); cellType.put(cellIndex, "wrong");
cellType.put(cellIndex, "wrong"); supplier.setAdvanceIn(0.00d);
supplier.setAdvanceIn(0.00d); supplier.setAdvanceInStr(advanceIn);
supplier.setAdvanceInStr(advanceIn); }
} break;
break; case SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_GET:
case SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_GET : String beginNeedGet = cell.getStringCellValue();
String beginNeedGet = cell.getStringCellValue(); if (null == beginNeedGet || "".equals(beginNeedGet)) {
if(null == beginNeedGet || "".equals(beginNeedGet)) { Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(期初应收)信息");
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(期初应收)信息"); break;
break; }
} if (Tools.checkStrIsNum(beginNeedGet) && Double.parseDouble(beginNeedGet) >= 0) {
if(Tools.checkStrIsNum(beginNeedGet) && Double.parseDouble(beginNeedGet)>=0) { if (Double.parseDouble(beginNeedGet) > 0) {
if(Double.parseDouble(beginNeedGet)>0) { hasBeginNeedGet = true; //存在期初应付信息
hasBeginNeedGet = true; //存在期初应付信息 }
} supplier.setBeginNeedGet(Double.parseDouble(beginNeedGet));
supplier.setBeginNeedGet(Double.parseDouble(beginNeedGet)); } else {
} Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应收)不是数字格式");
else{ cellType.put(cellIndex, "wrong");
Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应收)不是数字格式"); supplier.setBeginNeedGet(0.00d);
cellType.put(cellIndex, "wrong"); supplier.setBeginNeedGetStr(beginNeedGet);
supplier.setBeginNeedGet(0.00d); }
supplier.setBeginNeedGetStr(beginNeedGet); break;
} case SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_PAY:
break; String beginNeedPay = cell.getStringCellValue();
case SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_PAY : if (null == beginNeedPay || "".equals(beginNeedPay)) {
String beginNeedPay = cell.getStringCellValue(); Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(期初应付)信息");
if(null == beginNeedPay || "".equals(beginNeedPay)) { break;
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(期初应付)信息"); }
break; if (Tools.checkStrIsNum(beginNeedPay) && Double.parseDouble(beginNeedPay) >= 0) {
} if (hasBeginNeedGet) { //同时存在不允许
if(Tools.checkStrIsNum(beginNeedPay) && Double.parseDouble(beginNeedPay)>=0) { Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应付)和期初应收不能同时存在");
if(hasBeginNeedGet){ //同时存在不允许 cellType.put(cellIndex, "wrong");
Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应付)和期初应收不能同时存在"); supplier.setBeginNeedPay(0.00d);
cellType.put(cellIndex, "wrong"); supplier.setBeginNeedPayStr(beginNeedPay);
supplier.setBeginNeedPay(0.00d); } else {
supplier.setBeginNeedPayStr(beginNeedPay); supplier.setBeginNeedPay(Double.parseDouble(beginNeedPay));
} }
else { } else {
supplier.setBeginNeedPay(Double.parseDouble(beginNeedPay)); Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应付)不是数字格式");
} cellType.put(cellIndex, "wrong");
} supplier.setBeginNeedPay(0.00d);
else{ supplier.setBeginNeedPayStr(beginNeedPay);
Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应付)不是数字格式"); }
cellType.put(cellIndex, "wrong"); break;
supplier.setBeginNeedPay(0.00d); case SupplierConstants.BusinessForExcel.EXCEL_DESCRIPTION:
supplier.setBeginNeedPayStr(beginNeedPay); String description = cell.getStringCellValue();
} if (null == description || "".equals(description)) {
break; Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(备注)信息");
case SupplierConstants.BusinessForExcel.EXCEL_DESCRIPTION : break;
String description = cell.getStringCellValue(); }
if(null == description || "".equals(description)) { supplier.setDescription(description);
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(备注)信息"); break;
break; case SupplierConstants.BusinessForExcel.EXCEL_FAX:
} String fax = cell.getStringCellValue();
supplier.setDescription(description); if (null == fax || "".equals(fax)) {
break; Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(传真)信息");
case SupplierConstants.BusinessForExcel.EXCEL_FAX : break;
String fax = cell.getStringCellValue(); }
if(null == fax || "".equals(fax)) { supplier.setFax(fax);
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(传真)信息"); break;
break; case SupplierConstants.BusinessForExcel.EXCEL_TELEPHONE:
} String telephone = cell.getStringCellValue();
supplier.setFax(fax); if (null == telephone || "".equals(telephone)) {
break; Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(手机)信息");
case SupplierConstants.BusinessForExcel.EXCEL_TELEPHONE : break;
String telephone = cell.getStringCellValue(); }
if(null == telephone || "".equals(telephone)) { supplier.setTelephone(telephone);
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(手机)信息"); break;
break; case SupplierConstants.BusinessForExcel.EXCEL_ADDRESS:
} String address = cell.getStringCellValue();
supplier.setTelephone(telephone); if (null == address || "".equals(address)) {
break; Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(地址)信息");
case SupplierConstants.BusinessForExcel.EXCEL_ADDRESS : break;
String address = cell.getStringCellValue(); }
if(null == address || "".equals(address)) { supplier.setAddress(address);
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(地址)信息"); break;
break; case SupplierConstants.BusinessForExcel.EXCEL_TAX_NUM:
} String taxNum = cell.getStringCellValue();
supplier.setAddress(address); if (null == taxNum || "".equals(taxNum)) {
break; Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(纳税人识别号)信息");
case SupplierConstants.BusinessForExcel.EXCEL_TAX_NUM : break;
String taxNum = cell.getStringCellValue(); }
if(null == taxNum || "".equals(taxNum)) { supplier.setTaxNum(taxNum);
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(纳税人识别号)信息"); break;
break; case SupplierConstants.BusinessForExcel.EXCEL_BANK_NAME:
} String bankName = cell.getStringCellValue();
supplier.setTaxNum(taxNum); if (null == bankName || "".equals(bankName)) {
break; Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(开户行)信息");
case SupplierConstants.BusinessForExcel.EXCEL_BANK_NAME : break;
String bankName = cell.getStringCellValue(); }
if(null == bankName || "".equals(bankName)) { supplier.setBankName(bankName);
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(开户行)信息"); break;
break; case SupplierConstants.BusinessForExcel.EXCEL_ACCOUNT_NUMBER:
} String accountNumber = cell.getStringCellValue();
supplier.setBankName(bankName); if (null == accountNumber || "".equals(accountNumber)) {
break; Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(账号)信息");
case SupplierConstants.BusinessForExcel.EXCEL_ACCOUNT_NUMBER : break;
String accountNumber = cell.getStringCellValue(); }
if(null == accountNumber || "".equals(accountNumber)) { supplier.setAccountNumber(accountNumber);
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(账号)信息"); break;
break; case SupplierConstants.BusinessForExcel.EXCEL_TAX_RATE:
} String taxRate = cell.getStringCellValue();
supplier.setAccountNumber(accountNumber); if (null == taxRate || "".equals(taxRate)) {
break; Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(税率)信息");
case SupplierConstants.BusinessForExcel.EXCEL_TAX_RATE : break;
String taxRate = cell.getStringCellValue(); }
if(null == taxRate || "".equals(taxRate)) { if (Tools.checkStrIsNum(taxRate)) {
Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(税率)信息"); supplier.setTaxRate(Double.parseDouble(taxRate));
break; } else {
} Log.errorFileSync(">>>>>>>>>>>>>>>>>(税率)不是数字格式");
if(Tools.checkStrIsNum(taxRate)) { cellType.put(cellIndex, "wrong");
supplier.setTaxRate(Double.parseDouble(taxRate)); supplier.setTaxRate(0.00d);
} supplier.setTaxRateStr(taxRate);
else{ }
Log.errorFileSync(">>>>>>>>>>>>>>>>>(税率)不是数字格式"); break;
cellType.put(cellIndex, "wrong"); }
supplier.setTaxRate(0.00d); }
supplier.setTaxRateStr(taxRate); supplier.setCellInfo(cellType);
}
break;
}
}
supplier.setCellInfo(cellType);
Log.infoFileSync(totalRow + "行总共有" + cellIndex + "列"); Log.infoFileSync(totalRow + "行总共有" + cellIndex + "列");
//判断完成后增加数据 //判断完成后增加数据
if((null!=cellType && cellType.size() >0) || supplier.getSupplier() == null) { if ((null != cellType && cellType.size() > 0) || supplier.getSupplier() == null) {
wrongData.add(supplier); wrongData.add(supplier);
} } else {
else { supplier.setEnabled(true);
supplier.setEnabled(true); supplier.setIsystem((short) 1);
supplier.setIsystem((short)1); supplierDao.save(supplier);
supplierDao.save(supplier); }
} }
} } catch (FileNotFoundException e) {
} Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!", e);
catch (FileNotFoundException e) } catch (IOException e) {
{ Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !", e);
Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!",e); }
} Log.infoFileSync("===================excel表格总共有 " + totalRow + " 条记录!");
catch (IOException e) }
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !",e);
}
Log.infoFileSync("===================excel表格总共有 " + totalRow + " 条记录!");
}
} }
...@@ -3,7 +3,6 @@ package com.jsh.service.basic; ...@@ -3,7 +3,6 @@ package com.jsh.service.basic;
import com.jsh.base.BaseIService; import com.jsh.base.BaseIService;
import com.jsh.model.po.SystemConfig; import com.jsh.model.po.SystemConfig;
public interface SystemConfigIService extends BaseIService<SystemConfig> public interface SystemConfigIService extends BaseIService<SystemConfig> {
{
} }
...@@ -4,20 +4,17 @@ import com.jsh.base.BaseService; ...@@ -4,20 +4,17 @@ import com.jsh.base.BaseService;
import com.jsh.dao.basic.SystemConfigIDAO; import com.jsh.dao.basic.SystemConfigIDAO;
import com.jsh.model.po.SystemConfig; import com.jsh.model.po.SystemConfig;
public class SystemConfigService extends BaseService<SystemConfig> implements SystemConfigIService public class SystemConfigService extends BaseService<SystemConfig> implements SystemConfigIService {
{ @SuppressWarnings("unused")
@SuppressWarnings("unused") private SystemConfigIDAO systemConfigDao;
private SystemConfigIDAO systemConfigDao;
public void setSystemConfigDao(SystemConfigIDAO systemConfigDao) public void setSystemConfigDao(SystemConfigIDAO systemConfigDao) {
{ this.systemConfigDao = systemConfigDao;
this.systemConfigDao = systemConfigDao; }
}
@Override
protected Class<SystemConfig> getEntityClass() {
return SystemConfig.class;
}
@Override
protected Class<SystemConfig> getEntityClass()
{
return SystemConfig.class;
}
} }
...@@ -3,7 +3,6 @@ package com.jsh.service.basic; ...@@ -3,7 +3,6 @@ package com.jsh.service.basic;
import com.jsh.base.BaseIService; import com.jsh.base.BaseIService;
import com.jsh.model.po.Unit; import com.jsh.model.po.Unit;
public interface UnitIService extends BaseIService<Unit> public interface UnitIService extends BaseIService<Unit> {
{
} }
...@@ -4,21 +4,18 @@ import com.jsh.base.BaseService; ...@@ -4,21 +4,18 @@ import com.jsh.base.BaseService;
import com.jsh.dao.basic.UnitIDAO; import com.jsh.dao.basic.UnitIDAO;
import com.jsh.model.po.Unit; import com.jsh.model.po.Unit;
public class UnitService extends BaseService<Unit> implements UnitIService public class UnitService extends BaseService<Unit> implements UnitIService {
{ @SuppressWarnings("unused")
@SuppressWarnings("unused") private UnitIDAO unitDao;
private UnitIDAO unitDao;
public void setUnitDao(UnitIDAO unitDao) public void setUnitDao(UnitIDAO unitDao) {
{ this.unitDao = unitDao;
this.unitDao = unitDao; }
}
@Override
protected Class<Unit> getEntityClass() {
return Unit.class;
}
@Override
protected Class<Unit> getEntityClass()
{
return Unit.class;
}
} }
package com.jsh.service.basic; package com.jsh.service.basic;
import com.jsh.base.BaseIService; import com.jsh.base.BaseIService;
import com.jsh.util.JshException;
import com.jsh.model.po.UserBusiness; import com.jsh.model.po.UserBusiness;
import com.jsh.util.JshException;
import com.jsh.util.PageUtil; import com.jsh.util.PageUtil;
public interface UserBusinessIService extends BaseIService<UserBusiness> public interface UserBusinessIService extends BaseIService<UserBusiness> {
{ /*
/* * 测试一下自定义hql语句
* 测试一下自定义hql语句 */
*/ void find(PageUtil<UserBusiness> userBusiness, String ceshi) throws JshException;
void find(PageUtil<UserBusiness> userBusiness,String ceshi)throws JshException;
} }
...@@ -2,31 +2,27 @@ package com.jsh.service.basic; ...@@ -2,31 +2,27 @@ package com.jsh.service.basic;
import com.jsh.base.BaseService; import com.jsh.base.BaseService;
import com.jsh.dao.basic.UserBusinessIDAO; import com.jsh.dao.basic.UserBusinessIDAO;
import com.jsh.util.JshException;
import com.jsh.model.po.UserBusiness; import com.jsh.model.po.UserBusiness;
import com.jsh.util.JshException;
import com.jsh.util.PageUtil; import com.jsh.util.PageUtil;
public class UserBusinessService extends BaseService<UserBusiness> implements UserBusinessIService public class UserBusinessService extends BaseService<UserBusiness> implements UserBusinessIService {
{ @SuppressWarnings("unused")
@SuppressWarnings("unused") private UserBusinessIDAO userBusinessDao;
private UserBusinessIDAO userBusinessDao;
public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) {
{ this.userBusinessDao = userBusinessDao;
this.userBusinessDao = userBusinessDao; }
}
@Override @Override
protected Class<UserBusiness> getEntityClass() protected Class<UserBusiness> getEntityClass() {
{ return UserBusiness.class;
return UserBusiness.class; }
}
@Override @Override
public void find(PageUtil<UserBusiness> pageUtil, String ceshi) throws JshException public void find(PageUtil<UserBusiness> pageUtil, String ceshi) throws JshException {
{ userBusinessDao.find(pageUtil, ceshi);
userBusinessDao.find(pageUtil, ceshi);
} }
} }
package com.jsh.service.basic; package com.jsh.service.basic;
import com.jsh.base.BaseIService; import com.jsh.base.BaseIService;
import com.jsh.util.JshException;
import com.jsh.model.po.Basicuser; import com.jsh.model.po.Basicuser;
import com.jsh.util.JshException;
public interface UserIService extends BaseIService<Basicuser> {
/**
* 判断用户名是否符合登录条件
*
* @param username 用户名 String password
* @return int 1、用户名不存在 2、密码不正确 3、黑名单用户 4、符合条件 5、访问后台异常
*/
int validateUser(String username, String password) throws JshException;
public interface UserIService extends BaseIService<Basicuser> /**
{ * 获取用户信息
/** *
* 判断用户名是否符合登录条件 * @param username
* @param username 用户名 String password * @return 用户信息
* @return int 1、用户名不存在 2、密码不正确 3、黑名单用户 4、符合条件 5、访问后台异常 * @throws JshException
*/ */
int validateUser(String username,String password)throws JshException; public Basicuser getUser(String username) throws JshException;
/** /**
* 获取用户信息 * 检查用户名称是否存在
* @param username *
* @return 用户信息 * @param field 用户属性
* @throws JshException * @param username 用户名称
*/ * @param userID 供应商ID
public Basicuser getUser(String username) throws JshException; * @return true==存在重名 false==不存在
* @throws JshException
/** */
* 检查用户名称是否存在 Boolean checkIsNameExist(String field, String username, Long userID) throws JshException;
* @param field 用户属性
* @param username 用户名称
* @param userID 供应商ID
* @return true==存在重名 false==不存在
* @throws JshException
*/
Boolean checkIsNameExist(String field,String username,Long userID)throws JshException;
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment