From 072599953eb1c7dd04b8a8b232473353e0ce04c1 Mon Sep 17 00:00:00 2001 From: AlanGao Date: Sat, 7 Apr 2018 13:11:17 +0800 Subject: [PATCH] update --- .../com/jsh/action/asset/AssetAction.java | 5 +- .../com/jsh/action/basic/AccountAction.java | 470 ++--- .../java/com/jsh/action/basic/AppAction.java | 674 +++---- .../com/jsh/action/basic/AssetNameAction.java | 189 +- .../com/jsh/action/basic/CategoryAction.java | 341 ++-- .../com/jsh/action/basic/DepotAction.java | 848 ++++----- .../com/jsh/action/basic/FunctionsAction.java | 978 +++++----- .../com/jsh/action/basic/InOutItemAction.java | 207 +-- .../java/com/jsh/action/basic/LogAction.java | 199 +- .../java/com/jsh/action/basic/RoleAction.java | 464 +++-- .../com/jsh/action/basic/SupplierAction.java | 640 +++---- .../jsh/action/basic/SystemConfigAction.java | 131 +- .../java/com/jsh/action/basic/UnitAction.java | 475 +++-- .../java/com/jsh/action/basic/UserAction.java | 725 ++++---- .../jsh/action/basic/UserBusinessAction.java | 297 ++- .../action/materials/AccountHeadAction.java | 373 ++-- .../action/materials/AccountItemAction.java | 169 +- .../jsh/action/materials/DepotHeadAction.java | 1636 ++++++++--------- .../jsh/action/materials/DepotItemAction.java | 855 +++++---- .../jsh/action/materials/MaterialAction.java | 667 ++++--- .../materials/MaterialCategoryAction.java | 359 ++-- .../materials/MaterialPropertyAction.java | 97 +- .../jsh/action/materials/PersonAction.java | 396 ++-- src/main/java/com/jsh/base/BaseAction.java | 135 +- src/main/java/com/jsh/base/BaseDAO.java | 182 +- src/main/java/com/jsh/base/BaseIDAO.java | 223 +-- src/main/java/com/jsh/base/BaseIService.java | 202 +- src/main/java/com/jsh/base/BaseService.java | 171 +- src/main/java/com/jsh/base/Log.java | 301 ++- src/main/java/com/jsh/dao/asset/AssetDAO.java | 11 +- .../java/com/jsh/dao/asset/AssetIDAO.java | 5 +- .../java/com/jsh/dao/asset/ReportDAO.java | 17 +- .../java/com/jsh/dao/asset/ReportIDAO.java | 10 +- .../java/com/jsh/dao/basic/AccountDAO.java | 31 +- src/main/java/com/jsh/dao/basic/AppDAO.java | 11 +- src/main/java/com/jsh/dao/basic/AppIDAO.java | 5 +- .../java/com/jsh/dao/basic/AssetNameDAO.java | 11 +- .../java/com/jsh/dao/basic/AssetNameIDAO.java | 5 +- .../java/com/jsh/dao/basic/CategoryDAO.java | 11 +- .../java/com/jsh/dao/basic/CategoryIDAO.java | 5 +- src/main/java/com/jsh/dao/basic/DepotDAO.java | 11 +- .../java/com/jsh/dao/basic/DepotIDAO.java | 5 +- .../java/com/jsh/dao/basic/FunctionsDAO.java | 11 +- .../java/com/jsh/dao/basic/FunctionsIDAO.java | 5 +- .../java/com/jsh/dao/basic/InOutItemDAO.java | 7 +- .../java/com/jsh/dao/basic/InOutItemIDAO.java | 3 +- src/main/java/com/jsh/dao/basic/LogDAO.java | 15 +- src/main/java/com/jsh/dao/basic/LogIDAO.java | 6 +- src/main/java/com/jsh/dao/basic/RoleDAO.java | 11 +- src/main/java/com/jsh/dao/basic/RoleIDAO.java | 5 +- .../java/com/jsh/dao/basic/SupplierDAO.java | 31 +- .../java/com/jsh/dao/basic/SupplierIDAO.java | 5 +- .../com/jsh/dao/basic/SystemConfigDAO.java | 11 +- .../com/jsh/dao/basic/SystemConfigIDAO.java | 5 +- src/main/java/com/jsh/dao/basic/UnitDAO.java | 11 +- src/main/java/com/jsh/dao/basic/UnitIDAO.java | 5 +- .../com/jsh/dao/basic/UserBusinessDAO.java | 22 +- .../com/jsh/dao/basic/UserBusinessIDAO.java | 13 +- src/main/java/com/jsh/dao/basic/UserDAO.java | 19 +- src/main/java/com/jsh/dao/basic/UserIDAO.java | 5 +- .../com/jsh/dao/materials/AccountHeadDAO.java | 35 +- .../jsh/dao/materials/AccountHeadIDAO.java | 11 +- .../com/jsh/dao/materials/AccountItemDAO.java | 12 +- .../jsh/dao/materials/AccountItemIDAO.java | 7 +- .../com/jsh/dao/materials/DepotHeadDAO.java | 130 +- .../com/jsh/dao/materials/DepotItemDAO.java | 12 +- .../com/jsh/dao/materials/DepotItemIDAO.java | 18 +- .../dao/materials/MaterialCategoryDAO.java | 11 +- .../dao/materials/MaterialCategoryIDAO.java | 5 +- .../com/jsh/dao/materials/MaterialDAO.java | 19 +- .../com/jsh/dao/materials/MaterialIDAO.java | 7 +- .../dao/materials/MaterialPropertyDAO.java | 11 +- .../dao/materials/MaterialPropertyIDAO.java | 5 +- .../java/com/jsh/dao/materials/PersonDAO.java | 11 +- .../com/jsh/dao/materials/PersonIDAO.java | 5 +- src/main/java/com/jsh/model/po/Account.java | 65 +- .../java/com/jsh/model/po/AccountHead.java | 116 +- .../java/com/jsh/model/po/AccountItem.java | 66 +- src/main/java/com/jsh/model/po/App.java | 270 ++- src/main/java/com/jsh/model/po/Asset.java | 515 +++--- src/main/java/com/jsh/model/po/Assetname.java | 126 +- src/main/java/com/jsh/model/po/Basicuser.java | 260 ++- src/main/java/com/jsh/model/po/Category.java | 94 +- src/main/java/com/jsh/model/po/Depot.java | 146 +- src/main/java/com/jsh/model/po/DepotHead.java | 475 +++-- src/main/java/com/jsh/model/po/DepotItem.java | 381 ++-- src/main/java/com/jsh/model/po/Functions.java | 150 +- src/main/java/com/jsh/model/po/InOutItem.java | 45 +- .../java/com/jsh/model/po/Logdetails.java | 158 +- src/main/java/com/jsh/model/po/Material.java | 461 +++-- .../com/jsh/model/po/MaterialCategory.java | 91 +- .../com/jsh/model/po/MaterialProperty.java | 93 +- src/main/java/com/jsh/model/po/Person.java | 71 +- src/main/java/com/jsh/model/po/Role.java | 40 +- src/main/java/com/jsh/model/po/Supplier.java | 476 +++-- .../java/com/jsh/model/po/SystemConfig.java | 73 +- src/main/java/com/jsh/model/po/Unit.java | 49 +- .../java/com/jsh/model/po/UserBusiness.java | 80 +- .../com/jsh/model/vo/asset/AssetModel.java | 351 ++-- .../jsh/model/vo/asset/AssetShowModel.java | 21 +- .../com/jsh/model/vo/asset/ReportModel.java | 179 +- .../jsh/model/vo/asset/ReportShowModel.java | 27 +- .../com/jsh/model/vo/basic/AccountModel.java | 103 +- .../jsh/model/vo/basic/AccountShowModel.java | 11 +- .../java/com/jsh/model/vo/basic/AppModel.java | 333 ++-- .../com/jsh/model/vo/basic/AppShowModel.java | 9 +- .../jsh/model/vo/basic/AssetNameModel.java | 77 +- .../model/vo/basic/AssetNameShowModel.java | 9 +- .../com/jsh/model/vo/basic/CategoryModel.java | 61 +- .../jsh/model/vo/basic/CategoryShowModel.java | 9 +- .../com/jsh/model/vo/basic/DepotModel.java | 281 ++- .../jsh/model/vo/basic/DepotShowModel.java | 33 +- .../jsh/model/vo/basic/FunctionsModel.java | 241 ++- .../model/vo/basic/FunctionsShowModel.java | 9 +- .../jsh/model/vo/basic/InOutItemModel.java | 81 +- .../model/vo/basic/InOutItemShowModel.java | 11 +- .../java/com/jsh/model/vo/basic/LogModel.java | 308 ++-- .../com/jsh/model/vo/basic/LogShowModel.java | 17 +- .../com/jsh/model/vo/basic/RoleModel.java | 127 +- .../com/jsh/model/vo/basic/RoleShowModel.java | 9 +- .../com/jsh/model/vo/basic/SupplierModel.java | 555 +++--- .../jsh/model/vo/basic/SupplierShowModel.java | 31 +- .../jsh/model/vo/basic/SystemConfigModel.java | 99 +- .../model/vo/basic/SystemConfigShowModel.java | 9 +- .../com/jsh/model/vo/basic/UnitModel.java | 139 +- .../com/jsh/model/vo/basic/UnitShowModel.java | 33 +- .../jsh/model/vo/basic/UserBusinessModel.java | 139 +- .../model/vo/basic/UserBusinessShowModel.java | 33 +- .../com/jsh/model/vo/basic/UserModel.java | 411 ++--- .../com/jsh/model/vo/basic/UserShowModel.java | 25 +- .../model/vo/materials/AccountHeadModel.java | 184 +- .../vo/materials/AccountHeadShowModel.java | 11 +- .../model/vo/materials/AccountItemModel.java | 177 +- .../vo/materials/AccountItemShowModel.java | 9 +- .../vo/materials/DepotHeadShowModel.java | 31 +- .../model/vo/materials/DepotItemModel.java | 549 +++--- .../vo/materials/DepotItemShowModel.java | 9 +- .../vo/materials/MaterialCategoryModel.java | 127 +- .../materials/MaterialCategoryShowModel.java | 33 +- .../jsh/model/vo/materials/MaterialModel.java | 507 +++-- .../vo/materials/MaterialPropertyModel.java | 137 +- .../materials/MaterialPropertyShowModel.java | 33 +- .../model/vo/materials/MaterialShowModel.java | 33 +- .../jsh/model/vo/materials/PersonModel.java | 111 +- .../model/vo/materials/PersonShowModel.java | 31 +- .../com/jsh/service/asset/AssetIService.java | 46 +- .../com/jsh/service/asset/AssetService.java | 801 ++++---- .../com/jsh/service/asset/ReportIService.java | 8 +- .../com/jsh/service/asset/ReportService.java | 15 +- .../jsh/service/basic/AccountIService.java | 5 +- .../com/jsh/service/basic/AccountService.java | 12 +- .../com/jsh/service/basic/AppIService.java | 5 +- .../com/jsh/service/basic/AppService.java | 35 +- .../jsh/service/basic/AssetNameIService.java | 5 +- .../jsh/service/basic/AssetNameService.java | 19 +- .../jsh/service/basic/CategoryIService.java | 5 +- .../jsh/service/basic/CategoryService.java | 21 +- .../com/jsh/service/basic/DepotIService.java | 5 +- .../com/jsh/service/basic/DepotService.java | 37 +- .../jsh/service/basic/FunctionsIService.java | 5 +- .../jsh/service/basic/FunctionsService.java | 39 +- .../jsh/service/basic/InOutItemIService.java | 3 +- .../jsh/service/basic/InOutItemService.java | 9 +- .../com/jsh/service/basic/LogIService.java | 20 +- .../com/jsh/service/basic/LogService.java | 39 +- .../com/jsh/service/basic/RoleIService.java | 5 +- .../com/jsh/service/basic/RoleService.java | 39 +- .../jsh/service/basic/SupplierIService.java | 9 +- .../jsh/service/basic/SupplierService.java | 812 ++++---- .../service/basic/SystemConfigIService.java | 5 +- .../service/basic/SystemConfigService.java | 25 +- .../com/jsh/service/basic/UnitIService.java | 5 +- .../com/jsh/service/basic/UnitService.java | 25 +- .../service/basic/UserBusinessIService.java | 13 +- .../service/basic/UserBusinessService.java | 38 +- .../com/jsh/service/basic/UserIService.java | 54 +- .../com/jsh/service/basic/UserService.java | 170 +- .../materials/AccountHeadIService.java | 13 +- .../service/materials/AccountHeadService.java | 20 +- .../materials/AccountItemIService.java | 14 +- .../service/materials/AccountItemService.java | 19 +- .../service/materials/DepotHeadIService.java | 30 +- .../service/materials/DepotItemIService.java | 42 +- .../service/materials/DepotItemService.java | 242 ++- .../materials/MaterialCategoryIService.java | 5 +- .../materials/MaterialCategoryService.java | 28 +- .../service/materials/MaterialIService.java | 11 +- .../materials/MaterialPropertyIService.java | 5 +- .../materials/MaterialPropertyService.java | 28 +- .../service/materials/MaterialService.java | 557 +++--- .../jsh/service/materials/PersonIService.java | 5 +- .../jsh/service/materials/PersonService.java | 28 +- .../java/com/jsh/util/AssetConstants.java | 22 +- .../java/com/jsh/util/BeanFactoryUtil.java | 94 +- .../com/jsh/util/ExceptionCodeConstants.java | 6 +- src/main/java/com/jsh/util/JshConstants.java | 13 +- src/main/java/com/jsh/util/JshException.java | 39 +- .../java/com/jsh/util/MaterialConstants.java | 12 +- .../util/OpenSessionInViewFilterExtend.java | 28 +- src/main/java/com/jsh/util/PageUtil.java | 363 ++-- src/main/java/com/jsh/util/PathTool.java | 61 +- .../com/jsh/util/SearchConditionUtil.java | 110 +- src/main/java/com/jsh/util/SessionFilter.java | 52 +- .../java/com/jsh/util/SupplierConstants.java | 12 +- src/main/java/com/jsh/util/Tools.java | 926 +++++----- 205 files changed, 13055 insertions(+), 15164 deletions(-) diff --git a/src/main/java/com/jsh/action/asset/AssetAction.java b/src/main/java/com/jsh/action/asset/AssetAction.java index 61bf92c0..d543081c 100644 --- a/src/main/java/com/jsh/action/asset/AssetAction.java +++ b/src/main/java/com/jsh/action/asset/AssetAction.java @@ -21,7 +21,10 @@ import java.io.IOException; import java.io.InputStream; import java.sql.Timestamp; import java.text.ParseException; -import java.util.*; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @SuppressWarnings("serial") public class AssetAction extends BaseAction { diff --git a/src/main/java/com/jsh/action/basic/AccountAction.java b/src/main/java/com/jsh/action/basic/AccountAction.java index dbd3ac77..cc7636b7 100644 --- a/src/main/java/com/jsh/action/basic/AccountAction.java +++ b/src/main/java/com/jsh/action/basic/AccountAction.java @@ -1,79 +1,71 @@ package com.jsh.action.basic; -import java.io.IOException; -import java.sql.Timestamp; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.text.*; - -import com.jsh.model.po.AccountHead; -import com.jsh.model.po.AccountItem; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.*; +import com.jsh.model.vo.basic.AccountModel; +import com.jsh.service.basic.AccountIService; +import com.jsh.service.materials.AccountHeadIService; +import com.jsh.service.materials.AccountItemIService; +import com.jsh.service.materials.DepotHeadIService; import com.jsh.util.JshException; +import com.jsh.util.PageUtil; +import com.jsh.util.Tools; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.springframework.dao.DataAccessException; -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.model.po.DepotHead; -import com.jsh.model.po.Logdetails; -import com.jsh.model.po.Account; -import com.jsh.model.vo.basic.AccountModel; -import com.jsh.service.basic.AccountIService; -import com.jsh.service.materials.DepotHeadIService; -import com.jsh.service.materials.AccountHeadIService; -import com.jsh.service.materials.AccountItemIService; -import com.jsh.util.PageUtil; -import com.jsh.util.Tools; + +import java.io.IOException; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 结算账户 + * * @author ji sheng hua qq7527-18920 */ @SuppressWarnings("serial") -public class AccountAction extends BaseAction -{ +public class AccountAction extends BaseAction { private AccountIService accountService; private DepotHeadIService depotHeadService; private AccountHeadIService accountHeadService; private AccountItemIService accountItemService; - private AccountModel model = new AccountModel(); + private AccountModel model = new AccountModel(); - @SuppressWarnings({ "rawtypes", "unchecked" }) - public String getAccount() - { - Map mapData = model.getShowModel().getMap(); - PageUtil pageUtil = new PageUtil(); + @SuppressWarnings({"rawtypes", "unchecked"}) + public String getAccount() { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - try - { - Map condition = pageUtil.getAdvSearch(); + try { + Map condition = pageUtil.getAdvSearch(); condition.put("Id_s_order", "asc"); accountService.find(pageUtil); mapData.put("accountList", pageUtil.getPageList()); - } - catch (Exception e) - { + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>查找账户信息异常", e); model.getShowModel().setMsgTip("exception"); } return SUCCESS; } - + /** * 增加结算账户 + * * @return */ - public void create() - { + public void create() { Log.infoFileSync("==================开始调用增加结算账户方法==================="); Boolean flag = false; - try - { + try { Account Account = new Account(); Account.setName(model.getName()); Account.setSerialNo(model.getSerialNo()); - Account.setInitialAmount(model.getInitialAmount()!=null ? model.getInitialAmount() : 0); + Account.setInitialAmount(model.getInitialAmount() != null ? model.getInitialAmount() : 0); Account.setCurrentAmount(model.getCurrentAmount()); Account.setRemark(model.getRemark()); accountService.create(Account); @@ -83,72 +75,61 @@ public class AccountAction extends BaseAction //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加结算账户异常", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>增加结算账户回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "增加结算账户", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加结算账户名称为 "+ model.getName() + " " + tipMsg + "!", "增加结算账户" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "增加结算账户名称为 " + model.getName() + " " + tipMsg + "!", "增加结算账户" + tipMsg)); Log.infoFileSync("==================结束调用增加结算账户方法==================="); } /** * 删除结算账户 + * * @return */ - public String delete() - { + public String delete() { Log.infoFileSync("====================开始调用删除结算账户信息方法delete()================"); - try - { + try { accountService.delete(model.getAccountID()); tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAccountID() + " 的结算账户异常", e); tipMsg = "失败"; tipType = 1; } model.getShowModel().setMsgTip(tipMsg); logService.create(new Logdetails(getUser(), "删除结算账户", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除结算账户ID为 "+ model.getAccountID() + ",名称为 " + model.getName() + tipMsg + "!", "删除结算账户" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "删除结算账户ID为 " + model.getAccountID() + ",名称为 " + model.getName() + tipMsg + "!", "删除结算账户" + tipMsg)); Log.infoFileSync("====================结束调用删除结算账户信息方法delete()================"); return SUCCESS; } /** * 更新结算账户 + * * @return */ - public void update() - { + public void update() { Boolean flag = false; - try - { + try { Account Account = accountService.get(model.getAccountID()); Account.setName(model.getName()); Account.setSerialNo(model.getSerialNo()); - Account.setInitialAmount(model.getInitialAmount()!=null ? model.getInitialAmount() : 0); + Account.setInitialAmount(model.getInitialAmount() != null ? model.getInitialAmount() : 0); Account.setCurrentAmount(model.getCurrentAmount()); Account.setRemark(model.getRemark()); accountService.update(Account); @@ -156,39 +137,31 @@ public class AccountAction extends BaseAction flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改结算账户ID为 : " + model.getAccountID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改结算账户回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新结算账户", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "更新结算账户ID为 "+ model.getAccountID() + " " + tipMsg + "!", "更新结算账户" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "更新结算账户ID为 " + model.getAccountID() + " " + tipMsg + "!", "更新结算账户" + tipMsg)); } - + /** * 更新结算账户金额 + * * @return */ - public void updateAmount() - { + public void updateAmount() { Boolean flag = false; - try - { + try { Account Account = accountService.get(model.getAccountID()); Account.setCurrentAmount(model.getCurrentAmount()); accountService.update(Account); @@ -196,32 +169,26 @@ public class AccountAction extends BaseAction flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改结算账户ID为 : " + model.getAccountID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改结算账户回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新结算账户", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "更新结算账户ID为 "+ model.getAccountID() + " " + tipMsg + "!", "更新结算账户" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "更新结算账户ID为 " + model.getAccountID() + " " + tipMsg + "!", "更新结算账户" + tipMsg)); } /** * 更新结算账户-设置是否默认 + * * @return */ public void updateAmountIsDefault() { @@ -233,91 +200,75 @@ public class AccountAction extends BaseAction flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改结算账户ID为 : " + model.getAccountID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally { + } finally { try { toClient(flag.toString()); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改结算账户回写客户端结果异常", e); } } //如果改为默认账户时记录日志 - if(model.getIsDefault()) { + if (model.getIsDefault()) { logService.create(new Logdetails(getUser(), "更新默认账户", model.getClientIp(), new Timestamp(System.currentTimeMillis()), - tipType, "更新账户ID"+ model.getAccountID() + "为默认账户" + tipMsg + "!", "更新默认账户" + tipMsg)); + tipType, "更新账户ID" + model.getAccountID() + "为默认账户" + tipMsg + "!", "更新默认账户" + tipMsg)); } } /** * 批量删除指定ID结算账户 + * * @return */ - public String batchDelete() - { - try - { + public String batchDelete() { + try { accountService.batchDelete(model.getAccountIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>批量删除结算账户ID为:" + model.getAccountIDs() + "信息异常", e); tipMsg = "失败"; tipType = 1; } logService.create(new Logdetails(getUser(), "批量删除结算账户", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除结算账户ID为 "+ model.getAccountIDs() + " " + tipMsg + "!", "批量删除结算账户" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除结算账户ID为 " + model.getAccountIDs() + " " + tipMsg + "!", "批量删除结算账户" + tipMsg)); return SUCCESS; } /** * 检查输入名称是否存在 */ - public void checkIsNameExist() - { + public void checkIsNameExist() { Boolean flag = false; - try - { + try { flag = accountService.checkIsNameExist("name", model.getName(), "id", model.getAccountID()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>检查结算账户名称为:" + model.getName() + " ID为: " + model.getAccountID() + " 是否存在异常!"); - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查结算账户名称为:" + model.getName() + " ID为: " + model.getAccountID() + " 是否存在异常!",e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查结算账户名称为:" + model.getName() + " ID为: " + model.getAccountID() + " 是否存在异常!", e); } } } /** * 查找结算账户信息 + * * @return */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); @@ -328,11 +279,9 @@ public class AccountAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Account account:dataList) - { - DecimalFormat df =new DecimalFormat(".##"); + if (null != dataList) { + for (Account account : dataList) { + DecimalFormat df = new DecimalFormat(".##"); JSONObject item = new JSONObject(); item.put("id", account.getId()); //结算账户名称 @@ -340,14 +289,14 @@ public class AccountAction extends BaseAction item.put("serialNo", account.getSerialNo()); item.put("initialAmount", account.getInitialAmount()); String timeStr = Tools.getCurrentMonth(); - Double thisMonthAmount = getAccountSum(account.getId(), timeStr, "month") + getAccountSumByHead(account.getId(), timeStr, "month") +getAccountSumByDetail(account.getId(), timeStr, "month") + getManyAccountSum(account.getId(), timeStr, "month"); + Double thisMonthAmount = getAccountSum(account.getId(), timeStr, "month") + getAccountSumByHead(account.getId(), timeStr, "month") + getAccountSumByDetail(account.getId(), timeStr, "month") + getManyAccountSum(account.getId(), timeStr, "month"); String thisMonthAmountFmt = "0"; - if(thisMonthAmount!=0){ + if (thisMonthAmount != 0) { thisMonthAmountFmt = df.format(thisMonthAmount); } item.put("thisMonthAmount", thisMonthAmountFmt); //本月发生额 - Double currentAmount = getAccountSum(account.getId(),"", "month") + getAccountSumByHead(account.getId(), "", "month") + getAccountSumByDetail(account.getId(), "", "month") + getManyAccountSum(account.getId(), "", "month") + account.getInitialAmount(); - String currentAmountFmt=df.format(currentAmount); + Double currentAmount = getAccountSum(account.getId(), "", "month") + getAccountSumByHead(account.getId(), "", "month") + getAccountSumByDetail(account.getId(), "", "month") + getManyAccountSum(account.getId(), "", "month") + account.getInitialAmount(); + String currentAmountFmt = df.format(currentAmount); item.put("currentAmount", currentAmountFmt); //当前余额 item.put("isDefault", account.getIsDefault()); //是否默认 item.put("remark", account.getRemark()); @@ -358,37 +307,34 @@ public class AccountAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找结算账户信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询结算账户信息结果异常", e); } } + /** * 单个账户的金额求和-入库和出库 + * * @param id * @return */ - public Double getAccountSum(Long id,String timeStr,String type){ - Double accountSum = 0.0; - try{ - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - pageUtil.setAdvSearch(getCondition_getSum(id,timeStr,type)); - depotHeadService.find(pageUtil); - List dataList = pageUtil.getPageList(); - if(dataList!= null){ - for(DepotHead depotHead:dataList){ - accountSum = accountSum + depotHead.getChangeAmount(); - } - } - } - catch (DataAccessException e){ + public Double getAccountSum(Long id, String timeStr, String type) { + Double accountSum = 0.0; + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getCondition_getSum(id, timeStr, type)); + depotHeadService.find(pageUtil); + List dataList = pageUtil.getPageList(); + if (dataList != null) { + for (DepotHead depotHead : dataList) { + accountSum = accountSum + depotHead.getChangeAmount(); + } + } + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找进销存信息异常", e); } return accountSum; @@ -396,25 +342,25 @@ public class AccountAction extends BaseAction /** * 单个账户的金额求和-收入、支出、转账的单据表头的合计 + * * @param id * @return */ - public Double getAccountSumByHead(Long id,String timeStr,String type){ + public Double getAccountSumByHead(Long id, String timeStr, String type) { Double accountSum = 0.0; - try{ + try { PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition_getSumByHead(id, timeStr, type)); accountHeadService.find(pageUtil); List dataList = pageUtil.getPageList(); - if(dataList!= null){ - for(AccountHead accountHead:dataList){ + if (dataList != null) { + for (AccountHead accountHead : dataList) { accountSum = accountSum + accountHead.getChangeAmount(); } } - } - catch (DataAccessException e){ + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找进销存信息异常", e); } return accountSum; @@ -422,25 +368,26 @@ public class AccountAction extends BaseAction /** * 单个账户的金额求和-收款、付款、转账、收预付款的单据明细的合计 + * * @param id * @return */ - public Double getAccountSumByDetail(Long id,String timeStr, String type){ + public Double getAccountSumByDetail(Long id, String timeStr, String type) { Double accountSum = 0.0; - try{ + try { PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition_getSumByHead(timeStr, type)); accountHeadService.find(pageUtil); List dataList = pageUtil.getPageList(); - if(dataList!= null){ + if (dataList != null) { String ids = ""; - for(AccountHead accountHead:dataList){ - ids = ids + accountHead.getId() +","; + for (AccountHead accountHead : dataList) { + ids = ids + accountHead.getId() + ","; } - if(!ids.equals("")) { - ids = ids.substring(0,ids.length() -1); + if (!ids.equals("")) { + ids = ids.substring(0, ids.length() - 1); } PageUtil pageUtilOne = new PageUtil(); pageUtilOne.setPageSize(0); @@ -448,17 +395,15 @@ public class AccountAction extends BaseAction pageUtilOne.setAdvSearch(getCondition_getSumByDetail(id, ids)); accountItemService.find(pageUtilOne); List dataListOne = pageUtilOne.getPageList(); - if(dataListOne!= null){ - for(AccountItem accountItem:dataListOne){ + if (dataListOne != null) { + for (AccountItem accountItem : dataListOne) { accountSum = accountSum + accountItem.getEachAmount(); } } } - } - catch (DataAccessException e){ + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找进销存信息异常", e); - } - catch (Exception e){ + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>异常信息:", e); } return accountSum; @@ -466,35 +411,35 @@ public class AccountAction extends BaseAction /** * 单个账户的金额求和-多账户的明细合计 + * * @param id * @return */ - public Double getManyAccountSum(Long id,String timeStr, String type){ + public Double getManyAccountSum(Long id, String timeStr, String type) { Double accountSum = 0.0; - try{ + try { PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - pageUtil.setAdvSearch(getCondition_getManyAccountSum(id,timeStr,type)); + pageUtil.setAdvSearch(getCondition_getManyAccountSum(id, timeStr, type)); depotHeadService.find(pageUtil); List dataList = pageUtil.getPageList(); - if(dataList!= null){ - for(DepotHead depotHead:dataList){ + if (dataList != null) { + for (DepotHead depotHead : dataList) { String accountIdList = depotHead.getAccountIdList(); String accountMoneyList = depotHead.getAccountMoneyList(); - accountIdList = accountIdList.replace("[","").replace("]", "").replace("\"",""); - accountMoneyList = accountMoneyList.replace("[","").replace("]", "").replace("\"",""); + accountIdList = accountIdList.replace("[", "").replace("]", "").replace("\"", ""); + accountMoneyList = accountMoneyList.replace("[", "").replace("]", "").replace("\"", ""); String[] aList = accountIdList.split(","); String[] amList = accountMoneyList.split(","); - for(int i=0; i>>>>>>>>查找信息异常", e); } return accountSum; @@ -502,13 +447,12 @@ public class AccountAction extends BaseAction /** * 查找结算账户信息-下拉框 + * * @return */ - public void findBySelect() - { - try - { - PageUtil pageUtil = new PageUtil(); + public void findBySelect() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition_select()); @@ -516,10 +460,8 @@ public class AccountAction extends BaseAction List dataList = pageUtil.getPageList(); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Account account:dataList) - { + if (null != dataList) { + for (Account account : dataList) { JSONObject item = new JSONObject(); item.put("Id", account.getId()); //结算账户名称 @@ -529,13 +471,9 @@ public class AccountAction extends BaseAction } //回写查询结果 toClient(dataArray.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找结算账户信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询结算账户信息结果异常", e); } } @@ -543,21 +481,21 @@ public class AccountAction extends BaseAction /** * 账户流水信息 */ - public void findAccountInOutList(){ - PageUtil pageUtil = new PageUtil(); + public void findAccountInOutList() { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); Long accountId = model.getAccountID(); Double initialAmount = model.getInitialAmount(); - try{ + try { accountService.findAccountInOutList(pageUtil, accountId); List dataList = pageUtil.getPageList(); JSONObject outer = new JSONObject(); outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(dataList!=null){ - for(Integer i=0; i outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (JshException e) { + } catch (JshException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); } } /** * 拼接搜索条件 + * * @return */ - private Map getCondition() - { + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("name_s_like", model.getName()); condition.put("serialNo_s_like", model.getSerialNo()); condition.put("remark_s_like", model.getRemark()); @@ -606,59 +542,57 @@ public class AccountAction extends BaseAction /** * 拼接搜索条件-下拉框-结算账户 + * * @return */ - private Map getCondition_select() - { + private Map getCondition_select() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("id_s_order", "desc"); return condition; } - + /** * 拼接搜索条件 + * * @return */ - private Map getCondition_getSum(Long id,String timeStr,String type) - { + private Map getCondition_getSum(Long id, String timeStr, String type) { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("AccountId_n_eq", id); condition.put("PayType_s_neq", "预付款"); - if(!timeStr.equals("")){ - if(type.equals("month")){ + if (!timeStr.equals("")) { + if (type.equals("month")) { condition.put("OperTime_s_gteq", timeStr + "-01 00:00:00"); condition.put("OperTime_s_lteq", timeStr + "-31 00:00:00"); - } - else if(type.equals("date")){ + } else if (type.equals("date")) { condition.put("OperTime_s_lteq", timeStr); } - } + } return condition; } /** * 拼接搜索条件 + * * @return */ - private Map getCondition_getManyAccountSum(Long id,String timeStr,String type) - { + private Map getCondition_getManyAccountSum(Long id, String timeStr, String type) { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("AccountIdList_s_like", "\"" + id.toString() + "\""); - if(!timeStr.equals("")){ - if(type.equals("month")){ + if (!timeStr.equals("")) { + if (type.equals("month")) { condition.put("OperTime_s_gteq", timeStr + "-01 00:00:00"); condition.put("OperTime_s_lteq", timeStr + "-31 00:00:00"); - } - else if(type.equals("date")){ + } else if (type.equals("date")) { condition.put("OperTime_s_lteq", timeStr); } } @@ -667,21 +601,20 @@ public class AccountAction extends BaseAction /** * 拼接搜索条件 + * * @return */ - private Map getCondition_getSumByHead(Long id,String timeStr, String type) - { + private Map getCondition_getSumByHead(Long id, String timeStr, String type) { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("AccountId_n_eq", id); - if(!timeStr.equals("")){ - if(type.equals("month")) { + if (!timeStr.equals("")) { + if (type.equals("month")) { condition.put("BillTime_s_gteq", timeStr + "-01 00:00:00"); condition.put("BillTime_s_lteq", timeStr + "-31 00:00:00"); - } - else if(type.equals("date")) { + } else if (type.equals("date")) { condition.put("BillTime_s_lteq", timeStr); } } @@ -690,20 +623,19 @@ public class AccountAction extends BaseAction /** * 拼接搜索条件 + * * @return */ - private Map getCondition_getSumByHead(String timeStr, String type) - { + private Map getCondition_getSumByHead(String timeStr, String type) { /** * 拼接搜索条件 */ - Map condition = new HashMap(); - if(!timeStr.equals("")){ - if(type.equals("month")) { + Map condition = new HashMap(); + if (!timeStr.equals("")) { + if (type.equals("month")) { condition.put("BillTime_s_gteq", timeStr + "-01 00:00:00"); condition.put("BillTime_s_lteq", timeStr + "-31 00:00:00"); - } - else if(type.equals("date")) { + } else if (type.equals("date")) { condition.put("BillTime_s_lteq", timeStr); } } @@ -712,16 +644,16 @@ public class AccountAction extends BaseAction /** * 拼接搜索条件 + * * @return */ - private Map getCondition_getSumByDetail(Long id, String ids) - { + private Map getCondition_getSumByDetail(Long id, String ids) { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("AccountId_n_eq", id); - if(!ids.equals("")){ + if (!ids.equals("")) { condition.put("HeaderId_s_in", ids); } return condition; @@ -729,20 +661,22 @@ public class AccountAction extends BaseAction //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== @Override - public AccountModel getModel() - { + public AccountModel getModel() { return model; } - public void setAccountService(AccountIService accountService) - { + + public void setAccountService(AccountIService accountService) { this.accountService = accountService; } + public void setDepotHeadService(DepotHeadIService depotHeadService) { - this.depotHeadService = depotHeadService; - } + this.depotHeadService = depotHeadService; + } + public void setAccountHeadService(AccountHeadIService accountHeadService) { this.accountHeadService = accountHeadService; } + public void setAccountItemService(AccountItemIService accountItemService) { this.accountItemService = accountItemService; } diff --git a/src/main/java/com/jsh/action/basic/AppAction.java b/src/main/java/com/jsh/action/basic/AppAction.java index 7924e7ca..71d623bf 100644 --- a/src/main/java/com/jsh/action/basic/AppAction.java +++ b/src/main/java/com/jsh/action/basic/AppAction.java @@ -1,281 +1,241 @@ package com.jsh.action.basic; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Timestamp; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.apache.struts2.ServletActionContext; -import org.springframework.dao.DataAccessException; import com.jsh.base.BaseAction; import com.jsh.base.Log; -import com.jsh.util.JshException; import com.jsh.model.po.App; import com.jsh.model.po.Logdetails; import com.jsh.model.vo.basic.AppModel; import com.jsh.service.basic.AppIService; import com.jsh.service.basic.UserBusinessIService; import com.jsh.util.PageUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.apache.struts2.ServletActionContext; +import org.springframework.dao.DataAccessException; + +import java.io.*; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 应用 + * * @author ji_sheng_hua qq752 718 920 */ @SuppressWarnings("serial") -public class AppAction extends BaseAction -{ +public class AppAction extends BaseAction { private AppIService appService; private UserBusinessIService userBusinessService; private AppModel model = new AppModel(); - /** - * 上传图片 - */ - public void uploadImg() - { - Log.infoFileSync("==================开始调用上传图片方法uploadImg()==================="); - File fileInfo = model.getFileInfo(); - String fileName = model.getFileInfoName(); //获取文件名 - try { - if(fileInfo != null ){ - String path = ServletActionContext.getServletContext().getRealPath("/upload/images/deskIcon"); - InputStream is = new FileInputStream(fileInfo); - File file = new File(path, fileName); - OutputStream os = new FileOutputStream(file); - byte[] b = new byte[1024]; - int bs = 0; - while ((bs = is.read(b)) > 0) { - os.write(b, 0, bs); - } - is.close(); - os.close(); - } - } - catch (FileNotFoundException e) { - // TODO Auto-generated catch block - // e.printStackTrace(); - } - catch (IOException e) { - // TODO Auto-generated catch block - // e.printStackTrace(); - } - Log.infoFileSync("==================结束调用上传图片方法uploadImg()==================="); - } - - /** - * 增加应用 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加应用方法create()==================="); - Boolean flag = false; - try - { - App app = new App(); - app.setNumber(model.getNumber()); - app.setName(model.getName()); - app.setType(model.getType()); - app.setIcon(model.getIcon()); //设置图片Icon - app.setURL(model.getURL()); - app.setWidth(model.getWidth()); - app.setHeight(model.getHeight()); - app.setReSize(model.getReSize()); - app.setOpenMax(model.getOpenMax()); - app.setFlash(model.getFlash()); - app.setZL(model.getZL()); - app.setSort(model.getSort()); - app.setRemark(model.getRemark()); - app.setEnabled(model.getEnabled()); - appService.create(app); - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加应用异常", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>增加应用回写客户端结果异常", e); + /** + * 上传图片 + */ + public void uploadImg() { + Log.infoFileSync("==================开始调用上传图片方法uploadImg()==================="); + File fileInfo = model.getFileInfo(); + String fileName = model.getFileInfoName(); //获取文件名 + try { + if (fileInfo != null) { + String path = ServletActionContext.getServletContext().getRealPath("/upload/images/deskIcon"); + InputStream is = new FileInputStream(fileInfo); + File file = new File(path, fileName); + OutputStream os = new FileOutputStream(file); + byte[] b = new byte[1024]; + int bs = 0; + while ((bs = is.read(b)) > 0) { + os.write(b, 0, bs); + } + is.close(); + os.close(); } - } - - logService.create(new Logdetails(getUser(), "增加应用", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加应用名称为 "+ model.getName() + " " + tipMsg + "!", "增加应用" + tipMsg)); - Log.infoFileSync("==================结束调用增加应用方法create()==================="); - } - - /** - * 删除应用 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除应用方法delete()================"); - try - { - appService.delete(model.getAppID()); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + // e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + // e.printStackTrace(); + } + Log.infoFileSync("==================结束调用上传图片方法uploadImg()==================="); + } + + /** + * 增加应用 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加应用方法create()==================="); + Boolean flag = false; + try { + App app = new App(); + app.setNumber(model.getNumber()); + app.setName(model.getName()); + app.setType(model.getType()); + app.setIcon(model.getIcon()); //设置图片Icon + app.setURL(model.getURL()); + app.setWidth(model.getWidth()); + app.setHeight(model.getHeight()); + app.setReSize(model.getReSize()); + app.setOpenMax(model.getOpenMax()); + app.setFlash(model.getFlash()); + app.setZL(model.getZL()); + app.setSort(model.getSort()); + app.setRemark(model.getRemark()); + app.setEnabled(model.getEnabled()); + appService.create(app); + + //========标识位=========== + flag = true; + //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAppID() + " 的应用异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加应用异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>增加应用回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加应用", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加应用名称为 " + model.getName() + " " + tipMsg + "!", "增加应用" + tipMsg)); + Log.infoFileSync("==================结束调用增加应用方法create()==================="); + } + + /** + * 删除应用 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除应用方法delete()================"); + try { + appService.delete(model.getAppID()); + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAppID() + " 的应用异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除应用", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除应用ID为 "+ model.getAppID() + " " + tipMsg + "!", "删除应用" + tipMsg)); - Log.infoFileSync("====================结束调用删除应用方法delete()================"); - return SUCCESS; - } - - /** - * 更新仓库 - * @return - */ - public void update() - { - Boolean flag = false; - try - { - App app = appService.get(model.getAppID()); - app.setNumber(model.getNumber()); - app.setName(model.getName()); - app.setType(model.getType()); - //app.setIcon(model.getIcon()); - app.setURL(model.getURL()); - app.setWidth(model.getWidth()); - app.setHeight(model.getHeight()); - app.setReSize(model.getReSize()); - app.setOpenMax(model.getOpenMax()); - app.setFlash(model.getFlash()); - app.setZL(model.getZL()); - app.setSort(model.getSort()); - app.setRemark(model.getRemark()); - app.setEnabled(model.getEnabled()); - appService.update(app); - + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除应用", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除应用ID为 " + model.getAppID() + " " + tipMsg + "!", "删除应用" + tipMsg)); + Log.infoFileSync("====================结束调用删除应用方法delete()================"); + return SUCCESS; + } + + /** + * 更新仓库 + * + * @return + */ + public void update() { + Boolean flag = false; + try { + App app = appService.get(model.getAppID()); + app.setNumber(model.getNumber()); + app.setName(model.getName()); + app.setType(model.getType()); + //app.setIcon(model.getIcon()); + app.setURL(model.getURL()); + app.setWidth(model.getWidth()); + app.setHeight(model.getHeight()); + app.setReSize(model.getReSize()); + app.setOpenMax(model.getOpenMax()); + app.setFlash(model.getFlash()); + app.setZL(model.getZL()); + app.setSort(model.getSort()); + app.setRemark(model.getRemark()); + app.setEnabled(model.getEnabled()); + appService.update(app); + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改应用ID为 : " + model.getAppID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改应用回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新应用", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新应用ID为 "+ model.getAppID() + " " + tipMsg + "!", "更新应用" + tipMsg)); - } - - /** - * 批量删除指定ID应用 - * @return - */ - public String batchDelete() - { - try - { - appService.batchDelete(model.getAppIDs()); + , tipType, "更新应用ID为 " + model.getAppID() + " " + tipMsg + "!", "更新应用" + tipMsg)); + } + + /** + * 批量删除指定ID应用 + * + * @return + */ + public String batchDelete() { + try { + appService.batchDelete(model.getAppIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除应用ID为:" + model.getAppIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除应用ID为:" + model.getAppIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除应用", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除应用", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除应用ID为 "+ model.getAppIDs() + " " + tipMsg + "!", "批量删除应用" + tipMsg)); - return SUCCESS; - } - - /** - * 检查输入名称是否存在 - */ - public void checkIsNameExist() - { - Boolean flag = false; - try - { - flag = appService.checkIsNameExist("name",model.getName(),"Id", model.getAppID()); - } - catch (DataAccessException e) - { + , tipType, "批量删除应用ID为 " + model.getAppIDs() + " " + tipMsg + "!", "批量删除应用" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() { + Boolean flag = false; + try { + flag = appService.checkIsNameExist("name", model.getName(), "Id", model.getAppID()); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!"); - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!", e); } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查应用名称为:" + model.getName() + " ID为: " + model.getAppID() + " 是否存在异常!",e); - } - } - } - - /** - * 查找应用信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + } + } + + /** + * 查找应用信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); appService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 // {"total":28,"rows":[ // {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} @@ -284,10 +244,8 @@ public class AppAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(App app:dataList) - { + if (null != dataList) { + for (App app : dataList) { JSONObject item = new JSONObject(); item.put("Id", app.getId()); //应用名称 @@ -304,7 +262,7 @@ public class AppAction extends BaseAction item.put("ZL", app.getZL()); item.put("Sort", app.getSort()); item.put("Remark", app.getRemark()); - item.put("Enabled", app.getEnabled()); + item.put("Enabled", app.getEnabled()); item.put("op", 1); dataArray.add(item); } @@ -312,48 +270,41 @@ public class AppAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); } - } - - /** - * 桌面应用显示 - * @return - */ - public void findDesk() - { - try - { - PageUtil pageUtil = new PageUtil(); + } + + /** + * 桌面应用显示 + * + * @return + */ + public void findDesk() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(100); //pageUtil.setCurPage(model.getPageNo()); - + JSONObject outer = new JSONObject(); - + //下面是dock pageUtil.setAdvSearch(getCondition_dock()); appService.find(pageUtil); List dataList1 = pageUtil.getPageList(); - + //开始拼接json数据 //存放数据json数组 JSONArray dataArray1 = new JSONArray(); - if(null != dataList1) - { - for(App app:dataList1) - { + if (null != dataList1) { + for (App app : dataList1) { JSONObject item = new JSONObject(); item.put("id", app.getId()); item.put("title", app.getName()); item.put("type", app.getType()); - item.put("icon", "../../upload/images/deskIcon/"+app.getIcon()); + item.put("icon", "../../upload/images/deskIcon/" + app.getIcon()); item.put("url", app.getURL()); item.put("width", app.getWidth()); item.put("height", app.getHeight()); @@ -364,25 +315,23 @@ public class AppAction extends BaseAction } } outer.put("dock", dataArray1); - + //下面是desk pageUtil.setAdvSearch(getCondition_desk()); appService.find(pageUtil); List dataList2 = pageUtil.getPageList(); - + //开始拼接json数据 //存放数据json数组 JSONArray dataArray2 = new JSONArray(); - if(null != dataList2) - { - for(App app:dataList2) - { + if (null != dataList2) { + for (App app : dataList2) { JSONObject item = new JSONObject(); item.put("id", app.getId()); item.put("title", app.getName()); item.put("type", app.getType()); - item.put("icon", "../../upload/images/deskIcon/"+app.getIcon()); - item.put("url", "../../pages/common/menu.jsp?appID="+app.getNumber()+"&id="+app.getId()); + item.put("icon", "../../upload/images/deskIcon/" + app.getIcon()); + item.put("url", "../../pages/common/menu.jsp?appID=" + app.getNumber() + "&id=" + app.getId()); item.put("width", app.getWidth()); item.put("height", app.getHeight()); item.put("isresize", app.getReSize()); @@ -394,153 +343,140 @@ public class AppAction extends BaseAction outer.put("desk", dataArray2); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); } - } - - - /** - * 角色对应应用显示 - * @return - */ - public void findRoleAPP() - { - try - { - PageUtil pageUtil = new PageUtil(); + } + + + /** + * 角色对应应用显示 + * + * @return + */ + public void findRoleAPP() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(100); //pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition_RoleAPP()); appService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 - JSONObject outer = new JSONObject(); - outer.put("id", 1); - outer.put("text", "应用列表"); - outer.put("state", "open"); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(App app:dataList) - { - JSONObject item = new JSONObject(); - item.put("id", app.getId()); - item.put("text", app.getName()); - //勾选判断1 - Boolean flag = false; - try - { - flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+app.getId().toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的应用:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); - } - if (flag==true){item.put("checked", true);} - //结束 - dataArray.add(item); - } - } - outer.put("children", dataArray); - //回写查询结果 - toClient("["+outer.toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); - } - catch (IOException e) - { + JSONObject outer = new JSONObject(); + outer.put("id", 1); + outer.put("text", "应用列表"); + outer.put("state", "open"); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (App app : dataList) { + JSONObject item = new JSONObject(); + item.put("id", app.getId()); + item.put("text", app.getName()); + //勾选判断1 + Boolean flag = false; + try { + flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + app.getId().toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的应用:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag == true) { + item.put("checked", true); + } + //结束 + dataArray.add(item); + } + } + outer.put("children", dataArray); + //回写查询结果 + toClient("[" + outer.toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); } - } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + } + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Name_s_like", model.getName()); condition.put("Type_s_like", model.getType()); condition.put("Sort_s_order", "asc"); return condition; } - - /** - * 拼接搜索条件-桌面dock - * @return - */ - private Map getCondition_dock() - { + + /** + * 拼接搜索条件-桌面dock + * + * @return + */ + private Map getCondition_dock() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("ZL_s_eq", "dock"); condition.put("Enabled_n_eq", 1); condition.put("Sort_s_order", "asc"); return condition; } - - /** - * 拼接搜索条件-桌面desk - * @return - */ - private Map getCondition_desk() - { + + /** + * 拼接搜索条件-桌面desk + * + * @return + */ + private Map getCondition_desk() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("ZL_s_eq", "desk"); condition.put("Enabled_n_eq", 1); condition.put("Sort_s_order", "asc"); return condition; } - - /** - * 拼接搜索条件-角色对应应用 - * @return - */ - private Map getCondition_RoleAPP() - { + + /** + * 拼接搜索条件-角色对应应用 + * + * @return + */ + private Map getCondition_RoleAPP() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Enabled_n_eq", 1); condition.put("Sort_s_order", "asc"); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public AppModel getModel() - { - return model; - } - public void setAppService(AppIService appService) - { + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public AppModel getModel() { + return model; + } + + public void setAppService(AppIService appService) { this.appService = appService; } - public void setUserBusinessService(UserBusinessIService userBusinessService) { - this.userBusinessService = userBusinessService; - } - + public void setUserBusinessService(UserBusinessIService userBusinessService) { + this.userBusinessService = userBusinessService; + } + } diff --git a/src/main/java/com/jsh/action/basic/AssetNameAction.java b/src/main/java/com/jsh/action/basic/AssetNameAction.java index e31dc973..30ba0b58 100644 --- a/src/main/java/com/jsh/action/basic/AssetNameAction.java +++ b/src/main/java/com/jsh/action/basic/AssetNameAction.java @@ -1,13 +1,5 @@ package com.jsh.action.basic; -import java.io.IOException; -import java.sql.Timestamp; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; import com.jsh.base.BaseAction; import com.jsh.base.Log; import com.jsh.model.po.Assetname; @@ -16,79 +8,77 @@ import com.jsh.model.po.Logdetails; import com.jsh.model.vo.basic.AssetNameModel; import com.jsh.service.basic.AssetNameIService; import com.jsh.util.PageUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @SuppressWarnings("serial") -public class AssetNameAction extends BaseAction -{ +public class AssetNameAction extends BaseAction { private AssetNameModel model = new AssetNameModel(); - + private AssetNameIService assetnameService; + /** * 增加资产名称 + * * @return */ - public void create() - { + public void create() { Log.infoFileSync("==================开始调用增加资产名称方法create()==================="); Boolean flag = false; - try - { + try { Assetname assetname = new Assetname(); assetname.setAssetname(model.getAssetName()); //增加资产类型 assetname.setCategory(new Category(model.getCategoryID())); - - assetname.setIsystem((short)1); + + assetname.setIsystem((short) 1); assetname.setIsconsumables(model.getConsumable()); assetname.setDescription(model.getDescription()); assetnameService.create(assetname); - + //========标识位=========== flag = true; //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产名称异常", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>增加资产名称回写客户端结果异常", e); } } - + logService.create(new Logdetails(getUser(), "增加资产名称", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "增加资产名称名称为 "+ model.getAssetName() + " " + tipMsg + "!", "增加资产名称" + tipMsg)); + , tipType, "增加资产名称名称为 " + model.getAssetName() + " " + tipMsg + "!", "增加资产名称" + tipMsg)); Log.infoFileSync("==================结束调用增加资产名称方法create()==================="); } - + /** * 删除资产名称 + * * @return */ - public String delete() - { + public String delete() { Log.infoFileSync("====================开始调用删除资产名称信息方法delete()================"); - try - { + try { assetnameService.delete(model.getAssetNameID()); tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetNameID() + " 的资产名称异常", e); tipMsg = "失败"; tipType = 1; @@ -96,20 +86,19 @@ public class AssetNameAction extends BaseAction model.getShowModel().setMsgTip(tipMsg); logService.create(new Logdetails(getUser(), "删除资产名称", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "删除资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg)); + , tipType, "删除资产名称ID为 " + model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg)); Log.infoFileSync("====================结束调用删除资产名称信息方法delete()================"); return SUCCESS; } - + /** * 更新资产名称 + * * @return */ - public void update() - { + public void update() { Boolean flag = false; - try - { + try { Assetname assetname = assetnameService.get(model.getAssetNameID()); //增加资产类型 assetname.setCategory(new Category(model.getCategoryID())); @@ -117,103 +106,83 @@ public class AssetNameAction extends BaseAction assetname.setIsconsumables(model.getConsumable()); assetname.setDescription(model.getDescription()); assetnameService.update(assetname); - + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改资产名称ID为 : " + model.getAssetNameID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改资产名称回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新资产名称", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "更新资产名称" + tipMsg)); + , tipType, "更新资产名称ID为 " + model.getAssetNameID() + " " + tipMsg + "!", "更新资产名称" + tipMsg)); } - + /** * 批量删除指定ID资产名称 + * * @return */ - public String batchDelete() - { - try - { + public String batchDelete() { + try { assetnameService.batchDelete(model.getAssetNameIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>批量删除资产名称ID为:" + model.getAssetNameIDs() + "信息异常", e); tipMsg = "失败"; tipType = 1; } - + logService.create(new Logdetails(getUser(), "批量删除资产名称", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除资产名称ID为 "+ model.getAssetNameIDs() + " " + tipMsg + "!", "批量删除资产名称" + tipMsg)); + , tipType, "批量删除资产名称ID为 " + model.getAssetNameIDs() + " " + tipMsg + "!", "批量删除资产名称" + tipMsg)); return SUCCESS; } - + /** * 检查输入名称是否存在 */ - public void checkIsNameExist() - { + public void checkIsNameExist() { Boolean flag = false; - try - { - flag = assetnameService.checkIsNameExist("assetname",model.getAssetName(),"id", model.getAssetNameID()); - } - catch (DataAccessException e) - { + try { + flag = assetnameService.checkIsNameExist("assetname", model.getAssetName(), "id", model.getAssetNameID()); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!"); - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!",e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查资产名称名称为:" + model.getAssetName() + " ID为: " + model.getAssetNameID() + " 是否存在异常!", e); } } } - + /** * 查找供应商信息 + * * @return */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); assetnameService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 // {"total":28,"rows":[ // {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} @@ -222,16 +191,14 @@ public class AssetNameAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Assetname assetname:dataList) - { + if (null != dataList) { + for (Assetname assetname : dataList) { JSONObject item = new JSONObject(); item.put("id", assetname.getId()); //供应商名称 item.put("assetname", assetname.getAssetname()); - item.put("isystem", assetname.getIsystem() == (short)0?"是":"否"); - item.put("consumable", assetname.getIsconsumables() == (short)0?"是":"否"); + item.put("isystem", assetname.getIsystem() == (short) 0 ? "是" : "否"); + item.put("consumable", assetname.getIsconsumables() == (short) 0 ? "是" : "否"); item.put("consumableStatus", assetname.getIsconsumables()); item.put("description", assetname.getDescription()); item.put("categoryID", assetname.getCategory().getId()); @@ -243,27 +210,23 @@ public class AssetNameAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产名称信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产名称信息结果异常", e); } } - + /** * 拼接搜索条件 + * * @return */ - private Map getCondition() - { + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("assetname_s_like", model.getAssetName()); condition.put("isconsumables_n_eq", model.getConsumable()); condition.put("description_s_like", model.getDescription()); @@ -271,16 +234,14 @@ public class AssetNameAction extends BaseAction condition.put("id_s_order", "desc"); return condition; } - + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== @Override - public AssetNameModel getModel() - { + public AssetNameModel getModel() { return model; } - public void setAssetnameService(AssetNameIService assetnameService) - { + public void setAssetnameService(AssetNameIService assetnameService) { this.assetnameService = assetnameService; } } diff --git a/src/main/java/com/jsh/action/basic/CategoryAction.java b/src/main/java/com/jsh/action/basic/CategoryAction.java index 1dd59931..b1dd5c5e 100644 --- a/src/main/java/com/jsh/action/basic/CategoryAction.java +++ b/src/main/java/com/jsh/action/basic/CategoryAction.java @@ -1,13 +1,5 @@ package com.jsh.action.basic; -import java.io.IOException; -import java.sql.Timestamp; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; import com.jsh.base.BaseAction; import com.jsh.base.Log; import com.jsh.model.po.Category; @@ -15,198 +7,176 @@ import com.jsh.model.po.Logdetails; import com.jsh.model.vo.basic.CategoryModel; import com.jsh.service.basic.CategoryIService; import com.jsh.util.PageUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /* * @author jishenghua qq:7-5-2-7-1-8-9-2-0 -*/ + */ @SuppressWarnings("serial") -public class CategoryAction extends BaseAction -{ +public class CategoryAction extends BaseAction { private CategoryIService categoryService; private CategoryModel model = new CategoryModel(); - /** - * 增加资产类型 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加资产类型方法create()==================="); - Boolean flag = false; - try - { - Category category = new Category(); - category.setAssetname(model.getCategoryName()); - category.setIsystem((short)1); - category.setDescription(model.getDescription()); - categoryService.create(category); - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产类型异常", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>增加资产类型回写客户端结果异常", e); - } - } - - logService.create(new Logdetails(getUser(), "增加资产类型", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加资产类型名称为 "+ model.getCategoryName() + " " + tipMsg + "!", "增加资产类型" + tipMsg)); - Log.infoFileSync("==================结束调用增加资产类型方法create()==================="); - } - - /** - * 删除资产类型 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除资产类型信息方法delete()================"); - try - { - categoryService.delete(model.getCategoryID()); + + /** + * 增加资产类型 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加资产类型方法create()==================="); + Boolean flag = false; + try { + Category category = new Category(); + category.setAssetname(model.getCategoryName()); + category.setIsystem((short) 1); + category.setDescription(model.getDescription()); + categoryService.create(category); + + //========标识位=========== + flag = true; + //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getCategoryID() + " 的资产类型异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加资产类型异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>增加资产类型回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加资产类型", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加资产类型名称为 " + model.getCategoryName() + " " + tipMsg + "!", "增加资产类型" + tipMsg)); + Log.infoFileSync("==================结束调用增加资产类型方法create()==================="); + } + + /** + * 删除资产类型 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除资产类型信息方法delete()================"); + try { + categoryService.delete(model.getCategoryID()); + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getCategoryID() + " 的资产类型异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除资产类型", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除资产类型ID为 "+ model.getCategoryID() + " " + tipMsg + "!", "删除资产类型" + tipMsg)); - Log.infoFileSync("====================结束调用删除资产类型信息方法delete()================"); - return SUCCESS; - } - - /** - * 更新资产类型 - * @return - */ - public void update() - { - Boolean flag = false; - try - { + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除资产类型", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除资产类型ID为 " + model.getCategoryID() + " " + tipMsg + "!", "删除资产类型" + tipMsg)); + Log.infoFileSync("====================结束调用删除资产类型信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新资产类型 + * + * @return + */ + public void update() { + Boolean flag = false; + try { Category category = categoryService.get(model.getCategoryID()); category.setAssetname(model.getCategoryName()); category.setDescription(model.getDescription()); categoryService.update(category); - + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改资产类型ID为 : " + model.getCategoryID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改资产类型回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新资产类型", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新资产类型ID为 "+ model.getCategoryID() + " " + tipMsg + "!", "更新资产类型" + tipMsg)); - } - - /** - * 批量删除指定ID资产类型 - * @return - */ - public String batchDelete() - { - try - { - categoryService.batchDelete(model.getCategoryIDs()); + , tipType, "更新资产类型ID为 " + model.getCategoryID() + " " + tipMsg + "!", "更新资产类型" + tipMsg)); + } + + /** + * 批量删除指定ID资产类型 + * + * @return + */ + public String batchDelete() { + try { + categoryService.batchDelete(model.getCategoryIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除资产类型ID为:" + model.getCategoryIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除资产类型ID为:" + model.getCategoryIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除资产类型", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除资产类型", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除资产类型ID为 "+ model.getCategoryIDs() + " " + tipMsg + "!", "批量删除资产类型" + tipMsg)); - return SUCCESS; - } - - /** - * 检查输入名称是否存在 - */ - public void checkIsNameExist() - { - Boolean flag = false; - try - { - flag = categoryService.checkIsNameExist("assetname",model.getCategoryName(),"id", model.getCategoryID()); - } - catch (DataAccessException e) - { + , tipType, "批量删除资产类型ID为 " + model.getCategoryIDs() + " " + tipMsg + "!", "批量删除资产类型" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() { + Boolean flag = false; + try { + flag = categoryService.checkIsNameExist("assetname", model.getCategoryName(), "id", model.getCategoryID()); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!"); - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!", e); } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查资产类型名称为:" + model.getCategoryName() + " ID为: " + model.getCategoryID() + " 是否存在异常!",e); - } - } - } - - /** - * 查找供应商信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + } + } + + /** + * 查找供应商信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); categoryService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 // {"total":28,"rows":[ // {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} @@ -215,15 +185,13 @@ public class CategoryAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Category category:dataList) - { + if (null != dataList) { + for (Category category : dataList) { JSONObject item = new JSONObject(); item.put("id", category.getId()); //供应商名称 item.put("categoryname", category.getAssetname()); - item.put("isystem", category.getIsystem() == (short)0?"是":"否"); + item.put("isystem", category.getIsystem() == (short) 0 ? "是" : "否"); item.put("description", category.getDescription()); item.put("op", category.getIsystem()); dataArray.add(item); @@ -232,41 +200,36 @@ public class CategoryAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产类型信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找资产类型信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询资产类型信息结果异常", e); } - } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + } + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("assetname_s_like", model.getCategoryName()); condition.put("description_s_like", model.getDescription()); condition.put("id_s_order", "desc"); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public CategoryModel getModel() - { - return model; - } - public void setCategoryService(CategoryIService categoryService) - { + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public CategoryModel getModel() { + return model; + } + + public void setCategoryService(CategoryIService categoryService) { this.categoryService = categoryService; } } diff --git a/src/main/java/com/jsh/action/basic/DepotAction.java b/src/main/java/com/jsh/action/basic/DepotAction.java index fbe3e292..fcb636f9 100644 --- a/src/main/java/com/jsh/action/basic/DepotAction.java +++ b/src/main/java/com/jsh/action/basic/DepotAction.java @@ -1,495 +1,429 @@ package com.jsh.action.basic; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Depot; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.DepotModel; +import com.jsh.service.basic.DepotIService; +import com.jsh.service.basic.UserBusinessIService; +import com.jsh.util.PageUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + import java.io.IOException; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.util.JshException; -import com.jsh.model.po.Depot; -import com.jsh.model.po.Logdetails; -import com.jsh.model.po.Role; -import com.jsh.model.vo.basic.DepotModel; -import com.jsh.service.basic.DepotIService; -import com.jsh.service.basic.UserBusinessIService; -import com.jsh.util.PageUtil; + /** * 仓库管理 + * * @author jishenghua qq:7-5-2-7-1-8-9-2-0 */ @SuppressWarnings("serial") -public class DepotAction extends BaseAction -{ - private DepotIService depotService; - private UserBusinessIService userBusinessService; - private DepotModel model = new DepotModel(); +public class DepotAction extends BaseAction { + private DepotIService depotService; + private UserBusinessIService userBusinessService; + private DepotModel model = new DepotModel(); - @SuppressWarnings({ "rawtypes", "unchecked" }) - public String getBasicData() - { - Map mapData = model.getShowModel().getMap(); - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - try - { - Map condition = pageUtil.getAdvSearch(); - condition.put("sort_s_order", "asc"); - depotService.find(pageUtil); - mapData.put("depotList", pageUtil.getPageList()); - } - catch (Exception e) - { - Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); - model.getShowModel().setMsgTip("exceptoin"); - } - return SUCCESS; - } + @SuppressWarnings({"rawtypes", "unchecked"}) + public String getBasicData() { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try { + Map condition = pageUtil.getAdvSearch(); + condition.put("sort_s_order", "asc"); + depotService.find(pageUtil); + mapData.put("depotList", pageUtil.getPageList()); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); + model.getShowModel().setMsgTip("exceptoin"); + } + return SUCCESS; + } - /** - * 增加仓库 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加仓库信息方法create()==================="); - Boolean flag = false; - try - { - Depot depot = new Depot(); - depot.setName(model.getName()); - depot.setAddress(model.getAddress()); - depot.setWarehousing(model.getWarehousing()); - depot.setTruckage(model.getTruckage()); - depot.setType(model.getType()); - depot.setSort(model.getSort()); - depot.setRemark(model.getRemark()); - depotService.create(depot); + /** + * 增加仓库 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加仓库信息方法create()==================="); + Boolean flag = false; + try { + Depot depot = new Depot(); + depot.setName(model.getName()); + depot.setAddress(model.getAddress()); + depot.setWarehousing(model.getWarehousing()); + depot.setTruckage(model.getTruckage()); + depot.setType(model.getType()); + depot.setSort(model.getSort()); + depot.setRemark(model.getRemark()); + depotService.create(depot); - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加仓库信息异常", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>增加仓库信息回写客户端结果异常", e); - } - } + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加仓库信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>增加仓库信息回写客户端结果异常", e); + } + } - logService.create(new Logdetails(getUser(), "增加仓库", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加仓库名称为 "+ model.getName() + " " + tipMsg + "!", "增加仓库" + tipMsg)); - Log.infoFileSync("==================结束调用增加仓库方法create()==================="); - } + logService.create(new Logdetails(getUser(), "增加仓库", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加仓库名称为 " + model.getName() + " " + tipMsg + "!", "增加仓库" + tipMsg)); + Log.infoFileSync("==================结束调用增加仓库方法create()==================="); + } - /** - * 删除仓库 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除仓库信息方法delete()================"); - try - { - depotService.delete(model.getDepotID()); - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotID() + " 的仓库异常", e); - tipMsg = "失败"; - tipType = 1; - } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除仓库", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "删除仓库" + tipMsg)); - Log.infoFileSync("====================结束调用删除仓库信息方法delete()================"); - return SUCCESS; - } + /** + * 删除仓库 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除仓库信息方法delete()================"); + try { + depotService.delete(model.getDepotID()); + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotID() + " 的仓库异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除仓库", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除仓库ID为 " + model.getDepotID() + " " + tipMsg + "!", "删除仓库" + tipMsg)); + Log.infoFileSync("====================结束调用删除仓库信息方法delete()================"); + return SUCCESS; + } - /** - * 更新仓库 - * @return - */ - public void update() - { - Boolean flag = false; - try - { - Depot depot = depotService.get(model.getDepotID()); - depot.setName(model.getName()); - depot.setAddress(model.getAddress()); - depot.setWarehousing(model.getWarehousing()); - depot.setTruckage(model.getTruckage()); - depot.setType(model.getType()); - depot.setSort(model.getSort()); - depot.setRemark(model.getRemark()); - depotService.update(depot); + /** + * 更新仓库 + * + * @return + */ + public void update() { + Boolean flag = false; + try { + Depot depot = depotService.get(model.getDepotID()); + depot.setName(model.getName()); + depot.setAddress(model.getAddress()); + depot.setWarehousing(model.getWarehousing()); + depot.setTruckage(model.getTruckage()); + depot.setType(model.getType()); + depot.setSort(model.getSort()); + depot.setRemark(model.getRemark()); + depotService.update(depot); - flag = true; - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>修改仓库ID为 : " + model.getDepotID() + "信息失败", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>修改仓库回写客户端结果异常", e); - } - } - logService.create(new Logdetails(getUser(), "更新仓库", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "更新仓库ID为 "+ model.getDepotID() + " " + tipMsg + "!", "更新仓库" + tipMsg)); - } + flag = true; + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>修改仓库ID为 : " + model.getDepotID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>修改仓库回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新仓库", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新仓库ID为 " + model.getDepotID() + " " + tipMsg + "!", "更新仓库" + tipMsg)); + } - /** - * 批量删除指定ID仓库 - * @return - */ - public String batchDelete() - { - try - { - depotService.batchDelete(model.getDepotIDs()); - model.getShowModel().setMsgTip("成功"); - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除仓库ID为:" + model.getDepotIDs() + "信息异常", e); - tipMsg = "失败"; - tipType = 1; - } + /** + * 批量删除指定ID仓库 + * + * @return + */ + public String batchDelete() { + try { + depotService.batchDelete(model.getDepotIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除仓库ID为:" + model.getDepotIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } - logService.create(new Logdetails(getUser(), "批量删除仓库", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除仓库ID为 "+ model.getDepotIDs() + " " + tipMsg + "!", "批量删除仓库" + tipMsg)); - return SUCCESS; - } + logService.create(new Logdetails(getUser(), "批量删除仓库", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除仓库ID为 " + model.getDepotIDs() + " " + tipMsg + "!", "批量删除仓库" + tipMsg)); + return SUCCESS; + } - /** - * 检查输入名称是否存在 - */ - public void checkIsNameExist() - { - Boolean flag = false; - try - { - flag = depotService.checkIsNameExist("name",model.getName(),"id", model.getDepotID()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!"); - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!",e); - } - } - } + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() { + Boolean flag = false; + try { + flag = depotService.checkIsNameExist("name", model.getName(), "id", model.getDepotID()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!"); + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查仓库名称为:" + model.getName() + " ID为: " + model.getDepotID() + " 是否存在异常!", e); + } + } + } - /** - * 查找仓库信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(model.getPageSize()); - pageUtil.setCurPage(model.getPageNo()); - pageUtil.setAdvSearch(getCondition()); - depotService.find(pageUtil); - List dataList = pageUtil.getPageList(); + /** + * 查找仓库信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + depotService.find(pageUtil); + List dataList = pageUtil.getPageList(); - JSONObject outer = new JSONObject(); - outer.put("total", pageUtil.getTotalCount()); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Depot depot:dataList) - { - JSONObject item = new JSONObject(); - item.put("id", depot.getId()); - //供应商名称 - item.put("name", depot.getName()); - item.put("address", depot.getAddress()); - item.put("warehousing", depot.getWarehousing()); - item.put("truckage", depot.getTruckage()); - item.put("type", depot.getType()); - item.put("sort", depot.getSort()); - item.put("remark", depot.getRemark()); - item.put("op", 1); - dataArray.add(item); - } - } - outer.put("rows", dataArray); - //回写查询结果 - toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库信息异常", e); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库信息结果异常", e); - } - } + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (Depot depot : dataList) { + JSONObject item = new JSONObject(); + item.put("id", depot.getId()); + //供应商名称 + item.put("name", depot.getName()); + item.put("address", depot.getAddress()); + item.put("warehousing", depot.getWarehousing()); + item.put("truckage", depot.getTruckage()); + item.put("type", depot.getType()); + item.put("sort", depot.getSort()); + item.put("remark", depot.getRemark()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库信息异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库信息结果异常", e); + } + } - /** - * 查找礼品卡-虚拟仓库 - * @return - */ - public void findGiftByType() - { - try - { - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - pageUtil.setAdvSearch(getConditionByType()); - depotService.find(pageUtil); - List dataList = pageUtil.getPageList(); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Depot depot:dataList) - { - JSONObject item = new JSONObject(); - item.put("id", depot.getId()); - //仓库名称 - item.put("name", depot.getName()); - dataArray.add(item); - } - } - //回写查询结果 - toClient(dataArray.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>查找仓库信息异常", e); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>回写查询仓库信息结果异常", e); - } - } + /** + * 查找礼品卡-虚拟仓库 + * + * @return + */ + public void findGiftByType() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getConditionByType()); + depotService.find(pageUtil); + List dataList = pageUtil.getPageList(); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (Depot depot : dataList) { + JSONObject item = new JSONObject(); + item.put("id", depot.getId()); + //仓库名称 + item.put("name", depot.getName()); + dataArray.add(item); + } + } + //回写查询结果 + toClient(dataArray.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>查找仓库信息异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>回写查询仓库信息结果异常", e); + } + } - /** - * 用户对应仓库显示 - * @return - */ - public void findUserDepot() - { - try - { - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(100); - //pageUtil.setCurPage(model.getPageNo()); + /** + * 用户对应仓库显示 + * + * @return + */ + public void findUserDepot() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(100); + //pageUtil.setCurPage(model.getPageNo()); - pageUtil.setAdvSearch(getCondition_UserDepot()); - depotService.find(pageUtil); - List dataList = pageUtil.getPageList(); + pageUtil.setAdvSearch(getCondition_UserDepot()); + depotService.find(pageUtil); + List dataList = pageUtil.getPageList(); - //开始拼接json数据 - JSONObject outer = new JSONObject(); - outer.put("id", 1); - outer.put("text", "仓库列表"); - outer.put("state", "open"); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Depot depot:dataList) - { - JSONObject item = new JSONObject(); - item.put("id", depot.getId()); - item.put("text", depot.getName()); - //勾选判断1 - Boolean flag = false; - try - { - flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+depot.getId().toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的仓库:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); - } - if (flag==true){item.put("checked", true);} - //结束 - dataArray.add(item); - } - } - outer.put("children", dataArray); - //回写查询结果 - toClient("["+outer.toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库异常", e); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库结果异常", e); - } - } + //开始拼接json数据 + JSONObject outer = new JSONObject(); + outer.put("id", 1); + outer.put("text", "仓库列表"); + outer.put("state", "open"); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (Depot depot : dataList) { + JSONObject item = new JSONObject(); + item.put("id", depot.getId()); + item.put("text", depot.getName()); + //勾选判断1 + Boolean flag = false; + try { + flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + depot.getId().toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的仓库:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag == true) { + item.put("checked", true); + } + //结束 + dataArray.add(item); + } + } + outer.put("children", dataArray); + //回写查询结果 + toClient("[" + outer.toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库结果异常", e); + } + } - /** - * 根据用户查找对应仓库列表-仅显示有权限的 - * @return - */ - public void findDepotByUserId(){ - try{ - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - pageUtil.setAdvSearch(getCondition_UserDepot()); - depotService.find(pageUtil); - List dataList = pageUtil.getPageList(); + /** + * 根据用户查找对应仓库列表-仅显示有权限的 + * + * @return + */ + public void findDepotByUserId() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getCondition_UserDepot()); + depotService.find(pageUtil); + List dataList = pageUtil.getPageList(); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Depot depot:dataList) - { - JSONObject item = new JSONObject(); - //勾选判断1 - Boolean flag = false; - try - { - flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+depot.getId().toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); - } - if (flag==true){ - item.put("id", depot.getId()); - item.put("depotName", depot.getName()); - dataArray.add(item); - } - } - } - //回写查询结果 - toClient(dataArray.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库异常", e); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库结果异常", e); - } - } + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (Depot depot : dataList) { + JSONObject item = new JSONObject(); + //勾选判断1 + Boolean flag = false; + try { + flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + depot.getId().toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag == true) { + item.put("id", depot.getId()); + item.put("depotName", depot.getName()); + dataArray.add(item); + } + } + } + //回写查询结果 + toClient(dataArray.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓库异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓库结果异常", e); + } + } - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { - /** - * 拼接搜索条件 - */ - Map condition = new HashMap(); - condition.put("name_s_like", model.getName()); - condition.put("remark_s_like", model.getRemark()); - condition.put("type_n_eq", model.getType()); //0-仓库,1-礼品卡 - condition.put("sort_s_order", "asc"); - return condition; - } + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("name_s_like", model.getName()); + condition.put("remark_s_like", model.getRemark()); + condition.put("type_n_eq", model.getType()); //0-仓库,1-礼品卡 + condition.put("sort_s_order", "asc"); + return condition; + } - /** - * 拼接搜索条件 - * @return - */ - private Map getConditionByType() - { - /** - * 拼接搜索条件 - */ - Map condition = new HashMap(); - condition.put("type_n_eq", model.getType()); //0-仓库,1-礼品卡 - condition.put("sort_s_order", "asc"); - return condition; - } + /** + * 拼接搜索条件 + * + * @return + */ + private Map getConditionByType() { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("type_n_eq", model.getType()); //0-仓库,1-礼品卡 + condition.put("sort_s_order", "asc"); + return condition; + } - /** - * 拼接搜索条件-用户对应仓库 - * @return - */ - private Map getCondition_UserDepot() - { - /** - * 拼接搜索条件 - */ - Map condition = new HashMap(); - condition.put("type_n_eq", 0); - condition.put("sort_s_order", "asc"); - return condition; - } + /** + * 拼接搜索条件-用户对应仓库 + * + * @return + */ + private Map getCondition_UserDepot() { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("type_n_eq", 0); + condition.put("sort_s_order", "asc"); + return condition; + } - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public DepotModel getModel() - { - return model; - } - public void setDepotService(DepotIService depotService) - { - this.depotService = depotService; - } + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public DepotModel getModel() { + return model; + } - public void setUserBusinessService(UserBusinessIService userBusinessService) { - this.userBusinessService = userBusinessService; - } + public void setDepotService(DepotIService depotService) { + this.depotService = depotService; + } + + public void setUserBusinessService(UserBusinessIService userBusinessService) { + this.userBusinessService = userBusinessService; + } } diff --git a/src/main/java/com/jsh/action/basic/FunctionsAction.java b/src/main/java/com/jsh/action/basic/FunctionsAction.java index 01344593..e5909c8c 100644 --- a/src/main/java/com/jsh/action/basic/FunctionsAction.java +++ b/src/main/java/com/jsh/action/basic/FunctionsAction.java @@ -1,230 +1,198 @@ package com.jsh.action.basic; -import java.io.IOException; -import java.sql.Timestamp; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; import com.jsh.base.BaseAction; import com.jsh.base.Log; -import com.jsh.util.JshException; -import com.jsh.model.po.App; import com.jsh.model.po.Functions; import com.jsh.model.po.Logdetails; import com.jsh.model.vo.basic.FunctionsModel; import com.jsh.service.basic.FunctionsIService; import com.jsh.service.basic.UserBusinessIService; import com.jsh.util.PageUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /* -* 功能管理 -* @author jishenghua qq:7-5-2-7-1-8-9-2-0 -*/ + * 功能管理 + * @author jishenghua qq:7-5-2-7-1-8-9-2-0 + */ @SuppressWarnings("serial") -public class FunctionsAction extends BaseAction -{ +public class FunctionsAction extends BaseAction { private FunctionsIService functionsService; private UserBusinessIService userBusinessService; private FunctionsModel model = new FunctionsModel(); - /** - * 增加功能 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加功能信息方法create()==================="); - Boolean flag = false; - try - { - Functions functions = new Functions(); - functions.setNumber(model.getNumber()); - functions.setName(model.getName()); - functions.setPNumber(model.getPNumber()); - functions.setURL(model.getURL()); - functions.setState(model.getState()); - functions.setSort(model.getSort()); - functions.setEnabled(model.getEnabled()); - functions.setType(model.getType()); - functions.setPushBtn(model.getPushBtn()); - functionsService.create(functions); - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加功能信息异常", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>增加功能信息回写客户端结果异常", e); - } - } - - logService.create(new Logdetails(getUser(), "增加功能", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加功能名称为 "+ model.getName() + " " + tipMsg + "!", "增加功能" + tipMsg)); - Log.infoFileSync("==================结束调用增加功能方法create()==================="); - } - - /** - * 删除功能 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除功能信息方法delete()================"); - try - { - functionsService.delete(model.getFunctionsID()); + + /** + * 增加功能 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加功能信息方法create()==================="); + Boolean flag = false; + try { + Functions functions = new Functions(); + functions.setNumber(model.getNumber()); + functions.setName(model.getName()); + functions.setPNumber(model.getPNumber()); + functions.setURL(model.getURL()); + functions.setState(model.getState()); + functions.setSort(model.getSort()); + functions.setEnabled(model.getEnabled()); + functions.setType(model.getType()); + functions.setPushBtn(model.getPushBtn()); + functionsService.create(functions); + + //========标识位=========== + flag = true; + //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getFunctionsID() + " 的功能异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加功能信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>增加功能信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加功能", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加功能名称为 " + model.getName() + " " + tipMsg + "!", "增加功能" + tipMsg)); + Log.infoFileSync("==================结束调用增加功能方法create()==================="); + } + + /** + * 删除功能 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除功能信息方法delete()================"); + try { + functionsService.delete(model.getFunctionsID()); + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getFunctionsID() + " 的功能异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除功能", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除功能ID为 "+ model.getFunctionsID() + " " + tipMsg + "!", "删除功能" + tipMsg)); - Log.infoFileSync("====================结束调用删除功能信息方法delete()================"); - return SUCCESS; - } - - /** - * 更新功能 - * @return - */ - public void update() - { - Boolean flag = false; - try - { - Functions functions = functionsService.get(model.getFunctionsID()); - functions.setNumber(model.getNumber()); - functions.setName(model.getName()); - functions.setPNumber(model.getPNumber()); - functions.setURL(model.getURL()); - functions.setState(model.getState()); - functions.setSort(model.getSort()); - functions.setEnabled(model.getEnabled()); - functions.setType(model.getType()); - functions.setPushBtn(model.getPushBtn()); - functionsService.update(functions); - + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除功能", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除功能ID为 " + model.getFunctionsID() + " " + tipMsg + "!", "删除功能" + tipMsg)); + Log.infoFileSync("====================结束调用删除功能信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新功能 + * + * @return + */ + public void update() { + Boolean flag = false; + try { + Functions functions = functionsService.get(model.getFunctionsID()); + functions.setNumber(model.getNumber()); + functions.setName(model.getName()); + functions.setPNumber(model.getPNumber()); + functions.setURL(model.getURL()); + functions.setState(model.getState()); + functions.setSort(model.getSort()); + functions.setEnabled(model.getEnabled()); + functions.setType(model.getType()); + functions.setPushBtn(model.getPushBtn()); + functionsService.update(functions); + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改功能ID为 : " + model.getFunctionsID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改功能回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新功能", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新功能ID为 "+ model.getFunctionsID() + " " + tipMsg + "!", "更新功能" + tipMsg)); - } - - /** - * 批量删除指定ID功能 - * @return - */ - public String batchDelete() - { - try - { - functionsService.batchDelete(model.getFunctionsIDs()); + , tipType, "更新功能ID为 " + model.getFunctionsID() + " " + tipMsg + "!", "更新功能" + tipMsg)); + } + + /** + * 批量删除指定ID功能 + * + * @return + */ + public String batchDelete() { + try { + functionsService.batchDelete(model.getFunctionsIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除功能ID为:" + model.getFunctionsIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除功能ID为:" + model.getFunctionsIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除功能", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除功能", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除功能ID为 "+ model.getFunctionsIDs() + " " + tipMsg + "!", "批量删除功能" + tipMsg)); - return SUCCESS; - } - - /** - * 检查输入名称是否存在 - */ - public void checkIsNameExist() - { - Boolean flag = false; - try - { - flag = functionsService.checkIsNameExist("Name",model.getName(),"Id", model.getFunctionsID()); - } - catch (DataAccessException e) - { + , tipType, "批量删除功能ID为 " + model.getFunctionsIDs() + " " + tipMsg + "!", "批量删除功能" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() { + Boolean flag = false; + try { + flag = functionsService.checkIsNameExist("Name", model.getName(), "Id", model.getFunctionsID()); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>检查功能名称为:" + model.getName() + " ID为: " + model.getFunctionsID() + " 是否存在异常!"); - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查功能名称为:" + model.getName() + " ID为: " + model.getFunctionsID() + " 是否存在异常!", e); } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查功能名称为:" + model.getName() + " ID为: " + model.getFunctionsID() + " 是否存在异常!",e); - } - } - } - - /** - * 查找功能信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + } + } + + /** + * 查找功能信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); functionsService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 // {"total":28,"rows":[ // {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} @@ -233,10 +201,8 @@ public class FunctionsAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Functions functions:dataList) - { + if (null != dataList) { + for (Functions functions : dataList) { JSONObject item = new JSONObject(); item.put("Id", functions.getId()); item.put("Number", functions.getNumber()); @@ -247,7 +213,7 @@ public class FunctionsAction extends BaseAction item.put("Sort", functions.getSort()); item.put("Enabled", functions.getEnabled()); item.put("Type", functions.getType()); - item.put("PushBtn", functions.getPushBtn()); + item.put("PushBtn", functions.getPushBtn()); item.put("op", 1); dataArray.add(item); } @@ -255,372 +221,346 @@ public class FunctionsAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找功能信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找功能信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询功能信息结果异常", e); } - } + } - /** - * 根据id列表查找功能信息 - * @return - */ - public void findByIds() - { - try { - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - pageUtil.setAdvSearch(getConditionByIds()); - functionsService.find(pageUtil); - List dataList = pageUtil.getPageList(); - JSONObject outer = new JSONObject(); - outer.put("total", pageUtil.getTotalCount()); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Functions functions:dataList) - { - JSONObject item = new JSONObject(); - item.put("Id", functions.getId()); - item.put("Name", functions.getName()); - item.put("PushBtn", functions.getPushBtn()); - item.put("op", 1); - dataArray.add(item); - } - } - outer.put("rows", dataArray); - //回写查询结果 - toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找功能信息异常", e); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询功能信息结果异常", e); - } - } - - - /** - * 角色对应功能显示 - * @return - */ - public void findRoleFunctions() - { - try - { - PageUtil pageUtil = new PageUtil(); + /** + * 根据id列表查找功能信息 + * + * @return + */ + public void findByIds() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getConditionByIds()); + functionsService.find(pageUtil); + List dataList = pageUtil.getPageList(); + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (Functions functions : dataList) { + JSONObject item = new JSONObject(); + item.put("Id", functions.getId()); + item.put("Name", functions.getName()); + item.put("PushBtn", functions.getPushBtn()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找功能信息异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询功能信息结果异常", e); + } + } + + + /** + * 角色对应功能显示 + * + * @return + */ + public void findRoleFunctions() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(200); pageUtil.setAdvSearch(getCondition_RoleFunctions("0")); functionsService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 - JSONObject outer = new JSONObject(); - outer.put("id", 1); - outer.put("text", "功能列表"); - outer.put("state", "open"); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Functions functions:dataList) - { - JSONObject item = new JSONObject(); - item.put("id", functions.getId()); - item.put("text", functions.getName()); - - //勾选判断1 - Boolean flag = false; - try - { - flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions.getId().toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); - } - if (flag==true){item.put("checked", true);} - //结束 - - pageUtil.setAdvSearch(getCondition_RoleFunctions(functions.getNumber())); - functionsService.find(pageUtil); - List dataList1 = pageUtil.getPageList(); - JSONArray dataArray1 = new JSONArray(); - if(null != dataList1) - { - - for(Functions functions1:dataList1) - { - item.put("state", "open"); //如果不为空,节点不展开 - JSONObject item1 = new JSONObject(); - item1.put("id", functions1.getId()); - item1.put("text", functions1.getName()); - - //勾选判断2 - //Boolean flag = false; - try - { - flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions1.getId().toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); - } - if (flag==true){item1.put("checked", true);} - //结束 - - pageUtil.setAdvSearch(getCondition_RoleFunctions(functions1.getNumber())); - functionsService.find(pageUtil); - List dataList2 = pageUtil.getPageList(); - JSONArray dataArray2 = new JSONArray(); - if(null != dataList2) - { - - for(Functions functions2:dataList2) - { - item1.put("state", "closed"); //如果不为空,节点不展开 - JSONObject item2 = new JSONObject(); - item2.put("id", functions2.getId()); - item2.put("text", functions2.getName()); - - //勾选判断3 - //Boolean flag = false; - try - { - flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions2.getId().toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); - } - if (flag==true){item2.put("checked", true);} - //结束 - - pageUtil.setAdvSearch(getCondition_RoleFunctions(functions2.getNumber())); - functionsService.find(pageUtil); - List dataList3 = pageUtil.getPageList(); - JSONArray dataArray3 = new JSONArray(); - if(null != dataList3) - { - - for(Functions functions3:dataList3) - { - item2.put("state", "closed"); //如果不为空,节点不展开 - JSONObject item3 = new JSONObject(); - item3.put("id", functions3.getId()); - item3.put("text", functions3.getName()); - - //勾选判断4 - //Boolean flag = false; - try - { - flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+functions3.getId().toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); - } - if (flag==true){item3.put("checked", true);} - //结束 - - dataArray3.add(item3); - item2.put("children", dataArray3); - } - } - - dataArray2.add(item2); - item1.put("children", dataArray2); - } - } - - dataArray1.add(item1); - item.put("children", dataArray1); - } - - } - - dataArray.add(item); - } - outer.put("children", dataArray); - } - //回写查询结果 - toClient("["+outer.toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); - } - catch (IOException e) - { + JSONObject outer = new JSONObject(); + outer.put("id", 1); + outer.put("text", "功能列表"); + outer.put("state", "open"); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (Functions functions : dataList) { + JSONObject item = new JSONObject(); + item.put("id", functions.getId()); + item.put("text", functions.getName()); + + //勾选判断1 + Boolean flag = false; + try { + flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + functions.getId().toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag == true) { + item.put("checked", true); + } + //结束 + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions.getNumber())); + functionsService.find(pageUtil); + List dataList1 = pageUtil.getPageList(); + JSONArray dataArray1 = new JSONArray(); + if (null != dataList1) { + + for (Functions functions1 : dataList1) { + item.put("state", "open"); //如果不为空,节点不展开 + JSONObject item1 = new JSONObject(); + item1.put("id", functions1.getId()); + item1.put("text", functions1.getName()); + + //勾选判断2 + //Boolean flag = false; + try { + flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + functions1.getId().toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag == true) { + item1.put("checked", true); + } + //结束 + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions1.getNumber())); + functionsService.find(pageUtil); + List dataList2 = pageUtil.getPageList(); + JSONArray dataArray2 = new JSONArray(); + if (null != dataList2) { + + for (Functions functions2 : dataList2) { + item1.put("state", "closed"); //如果不为空,节点不展开 + JSONObject item2 = new JSONObject(); + item2.put("id", functions2.getId()); + item2.put("text", functions2.getName()); + + //勾选判断3 + //Boolean flag = false; + try { + flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + functions2.getId().toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag == true) { + item2.put("checked", true); + } + //结束 + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions2.getNumber())); + functionsService.find(pageUtil); + List dataList3 = pageUtil.getPageList(); + JSONArray dataArray3 = new JSONArray(); + if (null != dataList3) { + + for (Functions functions3 : dataList3) { + item2.put("state", "closed"); //如果不为空,节点不展开 + JSONObject item3 = new JSONObject(); + item3.put("id", functions3.getId()); + item3.put("text", functions3.getName()); + + //勾选判断4 + //Boolean flag = false; + try { + flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + functions3.getId().toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag == true) { + item3.put("checked", true); + } + //结束 + + dataArray3.add(item3); + item2.put("children", dataArray3); + } + } + + dataArray2.add(item2); + item1.put("children", dataArray2); + } + } + + dataArray1.add(item1); + item.put("children", dataArray1); + } + + } + + dataArray.add(item); + } + outer.put("children", dataArray); + } + //回写查询结果 + toClient("[" + outer.toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); } - } - - - /** - * 页面显示菜单 - * @return - */ - public void findMenu() { - try { - String fc = model.getHasFunctions(); //当前用户所拥有的功能列表,格式如:[1][2][5] - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(200); - pageUtil.setAdvSearch(getCondition_RoleFunctions(model.getPNumber())); - functionsService.find(pageUtil); - List dataList = pageUtil.getPageList(); + } - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if (null != dataList) { - for (Functions functions : dataList) { - JSONObject item = new JSONObject(); - item.put("id", functions.getId()); - pageUtil.setAdvSearch(getCondition_RoleFunctions(functions.getNumber())); - functionsService.find(pageUtil); - List dataList1 = pageUtil.getPageList(); - JSONArray dataArray1 = new JSONArray(); - if (dataList1.size() != 0) { - item.put("text", functions.getName()); //是目录就没链接 - for (Functions functions1 : dataList1) { - item.put("state", "open"); //如果不为空,节点展开 - JSONObject item1 = new JSONObject(); + /** + * 页面显示菜单 + * + * @return + */ + public void findMenu() { + try { + String fc = model.getHasFunctions(); //当前用户所拥有的功能列表,格式如:[1][2][5] + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(200); + pageUtil.setAdvSearch(getCondition_RoleFunctions(model.getPNumber())); + functionsService.find(pageUtil); + List dataList = pageUtil.getPageList(); - pageUtil.setAdvSearch(getCondition_RoleFunctions(functions1.getNumber())); - functionsService.find(pageUtil); - List dataList2 = pageUtil.getPageList(); - if (fc.indexOf("[" + functions1.getId().toString() + "]") != -1 || dataList2.size() != 0) { - item1.put("id", functions1.getId()); - JSONArray dataArray2 = new JSONArray(); - if (dataList2.size() != 0) { - item1.put("text", functions1.getName());//是目录就没链接 - for (Functions functions2 : dataList2) { - item1.put("state", "closed"); //如果不为空,节点不展开 - JSONObject item2 = new JSONObject(); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (Functions functions : dataList) { + JSONObject item = new JSONObject(); - pageUtil.setAdvSearch(getCondition_RoleFunctions(functions2.getNumber())); - functionsService.find(pageUtil); - List dataList3 = pageUtil.getPageList(); - if (fc.indexOf("[" + functions2.getId().toString() + "]") != -1 || dataList3.size() != 0) { - item2.put("id", functions2.getId()); - JSONArray dataArray3 = new JSONArray(); - if (dataList3.size() != 0) { - item2.put("text", functions2.getName());//是目录就没链接 - for (Functions functions3 : dataList3) { - item2.put("state", "closed"); //如果不为空,节点不展开 - JSONObject item3 = new JSONObject(); - item3.put("id", functions3.getId()); - item3.put("text", functions3.getName()); - // - dataArray3.add(item3); - item2.put("children", dataArray3); - } - } else { - //不是目录,有链接 - item2.put("text", "" + functions2.getName() + ""); - } - } else { - //不是目录,有链接 - item2.put("text", "" + functions2.getName() + ""); - } - dataArray2.add(item2); - item1.put("children", dataArray2); - } - } else { - //不是目录,有链接 - item1.put("text", "" + functions1.getName() + ""); - } - } else { - //不是目录,有链接 - item1.put("text", "" + functions1.getName() + ""); - } - dataArray1.add(item1); - item.put("children", dataArray1); - } - } else { - //不是目录,有链接 - item.put("text", "" + functions.getName() + ""); - } - dataArray.add(item); - } - } - //回写查询结果 - toClient(dataArray.toString()); - } catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); - } catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); - } - } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + item.put("id", functions.getId()); + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions.getNumber())); + functionsService.find(pageUtil); + List dataList1 = pageUtil.getPageList(); + JSONArray dataArray1 = new JSONArray(); + if (dataList1.size() != 0) { + item.put("text", functions.getName()); //是目录就没链接 + for (Functions functions1 : dataList1) { + item.put("state", "open"); //如果不为空,节点展开 + JSONObject item1 = new JSONObject(); + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions1.getNumber())); + functionsService.find(pageUtil); + List dataList2 = pageUtil.getPageList(); + if (fc.indexOf("[" + functions1.getId().toString() + "]") != -1 || dataList2.size() != 0) { + item1.put("id", functions1.getId()); + JSONArray dataArray2 = new JSONArray(); + if (dataList2.size() != 0) { + item1.put("text", functions1.getName());//是目录就没链接 + for (Functions functions2 : dataList2) { + item1.put("state", "closed"); //如果不为空,节点不展开 + JSONObject item2 = new JSONObject(); + + pageUtil.setAdvSearch(getCondition_RoleFunctions(functions2.getNumber())); + functionsService.find(pageUtil); + List dataList3 = pageUtil.getPageList(); + if (fc.indexOf("[" + functions2.getId().toString() + "]") != -1 || dataList3.size() != 0) { + item2.put("id", functions2.getId()); + JSONArray dataArray3 = new JSONArray(); + if (dataList3.size() != 0) { + item2.put("text", functions2.getName());//是目录就没链接 + for (Functions functions3 : dataList3) { + item2.put("state", "closed"); //如果不为空,节点不展开 + JSONObject item3 = new JSONObject(); + item3.put("id", functions3.getId()); + item3.put("text", functions3.getName()); + // + dataArray3.add(item3); + item2.put("children", dataArray3); + } + } else { + //不是目录,有链接 + item2.put("text", "" + functions2.getName() + ""); + } + } else { + //不是目录,有链接 + item2.put("text", "" + functions2.getName() + ""); + } + dataArray2.add(item2); + item1.put("children", dataArray2); + } + } else { + //不是目录,有链接 + item1.put("text", "" + functions1.getName() + ""); + } + } else { + //不是目录,有链接 + item1.put("text", "" + functions1.getName() + ""); + } + dataArray1.add(item1); + item.put("children", dataArray1); + } + } else { + //不是目录,有链接 + item.put("text", "" + functions.getName() + ""); + } + dataArray.add(item); + } + } + //回写查询结果 + toClient(dataArray.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找应用异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询应用结果异常", e); + } + } + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Name_s_like", model.getName()); condition.put("Type_s_eq", model.getType()); condition.put("Sort_s_order", "asc"); return condition; } - - /** - * 拼接搜索条件-角色对应功能 - * @return - */ - private Map getCondition_RoleFunctions(String num) - { + + /** + * 拼接搜索条件-角色对应功能 + * + * @return + */ + private Map getCondition_RoleFunctions(String num) { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Enabled_n_eq", 1); condition.put("PNumber_s_eq", num); condition.put("Sort_s_order", "asc"); return condition; } - /** - * 拼接搜索条件-角色对应功能 - * @return - */ - private Map getConditionByIds() { - Map condition = new HashMap(); - condition.put("Enabled_n_eq", 1); - condition.put("Id_s_in", model.getFunctionsIDs()); - condition.put("Sort_s_order", "asc"); - return condition; - } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public FunctionsModel getModel() - { - return model; - } - public void setFunctionsService(FunctionsIService functionsService) - { + /** + * 拼接搜索条件-角色对应功能 + * + * @return + */ + private Map getConditionByIds() { + Map condition = new HashMap(); + condition.put("Enabled_n_eq", 1); + condition.put("Id_s_in", model.getFunctionsIDs()); + condition.put("Sort_s_order", "asc"); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public FunctionsModel getModel() { + return model; + } + + public void setFunctionsService(FunctionsIService functionsService) { this.functionsService = functionsService; } - public void setUserBusinessService(UserBusinessIService userBusinessService) { - this.userBusinessService = userBusinessService; - } - + public void setUserBusinessService(UserBusinessIService userBusinessService) { + this.userBusinessService = userBusinessService; + } + } diff --git a/src/main/java/com/jsh/action/basic/InOutItemAction.java b/src/main/java/com/jsh/action/basic/InOutItemAction.java index f6f40a91..f1f98d7f 100644 --- a/src/main/java/com/jsh/action/basic/InOutItemAction.java +++ b/src/main/java/com/jsh/action/basic/InOutItemAction.java @@ -1,40 +1,41 @@ package com.jsh.action.basic; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.InOutItem; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.InOutItemModel; +import com.jsh.service.basic.InOutItemIService; +import com.jsh.util.PageUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + import java.io.IOException; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.model.po.Logdetails; -import com.jsh.model.po.InOutItem; -import com.jsh.model.vo.basic.InOutItemModel; -import com.jsh.service.basic.InOutItemIService; -import com.jsh.util.PageUtil; + /** * 收支项目 + * * @author ji*sheng*hua qq 7.5.2.7.1.8.9.2.0 */ @SuppressWarnings("serial") -public class InOutItemAction extends BaseAction -{ +public class InOutItemAction extends BaseAction { private InOutItemIService inOutItemService; private InOutItemModel model = new InOutItemModel(); /** * 增加收支项目 + * * @return */ - public void create() - { + public void create() { Log.infoFileSync("==================开始调用增加收支项目方法==================="); Boolean flag = false; - try - { + try { InOutItem inOutItem = new InOutItem(); inOutItem.setName(model.getName()); inOutItem.setType(model.getType()); @@ -46,68 +47,57 @@ public class InOutItemAction extends BaseAction //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加收支项目异常", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>增加收支项目回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "增加收支项目", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加收支项目名称为 "+ model.getName() + " " + tipMsg + "!", "增加收支项目" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "增加收支项目名称为 " + model.getName() + " " + tipMsg + "!", "增加收支项目" + tipMsg)); Log.infoFileSync("==================结束调用增加收支项目方法==================="); } /** * 删除收支项目 + * * @return */ - public String delete() - { + public String delete() { Log.infoFileSync("====================开始调用删除收支项目信息方法delete()================"); - try - { + try { inOutItemService.delete(model.getInOutItemID()); tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getInOutItemID() + " 的收支项目异常", e); tipMsg = "失败"; tipType = 1; } model.getShowModel().setMsgTip(tipMsg); logService.create(new Logdetails(getUser(), "删除收支项目", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除收支项目ID为 "+ model.getInOutItemID() + ",名称为 " + model.getName() + tipMsg + "!", "删除收支项目" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "删除收支项目ID为 " + model.getInOutItemID() + ",名称为 " + model.getName() + tipMsg + "!", "删除收支项目" + tipMsg)); Log.infoFileSync("====================结束调用删除收支项目信息方法delete()================"); return SUCCESS; } /** * 更新收支项目 + * * @return */ - public void update() - { + public void update() { Boolean flag = false; - try - { + try { InOutItem inOutItem = inOutItemService.get(model.getInOutItemID()); inOutItem.setName(model.getName()); inOutItem.setType(model.getType()); @@ -117,93 +107,73 @@ public class InOutItemAction extends BaseAction flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改收支项目ID为 : " + model.getInOutItemID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改收支项目回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新收支项目", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "更新收支项目ID为 "+ model.getInOutItemID() + " " + tipMsg + "!", "更新收支项目" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "更新收支项目ID为 " + model.getInOutItemID() + " " + tipMsg + "!", "更新收支项目" + tipMsg)); } /** * 批量删除指定ID收支项目 + * * @return */ - public String batchDelete() - { - try - { + public String batchDelete() { + try { inOutItemService.batchDelete(model.getInOutItemIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>批量删除收支项目ID为:" + model.getInOutItemIDs() + "信息异常", e); tipMsg = "失败"; tipType = 1; } logService.create(new Logdetails(getUser(), "批量删除收支项目", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除收支项目ID为 "+ model.getInOutItemIDs() + " " + tipMsg + "!", "批量删除收支项目" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除收支项目ID为 " + model.getInOutItemIDs() + " " + tipMsg + "!", "批量删除收支项目" + tipMsg)); return SUCCESS; } /** * 检查输入名称是否存在 */ - public void checkIsNameExist() - { + public void checkIsNameExist() { Boolean flag = false; - try - { - flag = inOutItemService.checkIsNameExist("name",model.getName(),"id", model.getInOutItemID()); - } - catch (DataAccessException e) - { + try { + flag = inOutItemService.checkIsNameExist("name", model.getName(), "id", model.getInOutItemID()); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!"); - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!",e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查收支项目名称为:" + model.getName() + " ID为: " + model.getInOutItemID() + " 是否存在异常!", e); } } } /** * 查找收支项目信息 + * * @return */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); @@ -214,10 +184,8 @@ public class InOutItemAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(InOutItem inOutItem:dataList) - { + if (null != dataList) { + for (InOutItem inOutItem : dataList) { JSONObject item = new JSONObject(); item.put("id", inOutItem.getId()); //收支项目名称 @@ -231,26 +199,21 @@ public class InOutItemAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e); } } /** * 查找收支项目信息-下拉框 + * * @return */ - public void findBySelect() - { - try - { - PageUtil pageUtil = new PageUtil(); + public void findBySelect() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition_select()); @@ -258,10 +221,8 @@ public class InOutItemAction extends BaseAction List dataList = pageUtil.getPageList(); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(InOutItem inOutItem:dataList) - { + if (null != dataList) { + for (InOutItem inOutItem : dataList) { JSONObject item = new JSONObject(); item.put("Id", inOutItem.getId()); //收支项目名称 @@ -271,27 +232,23 @@ public class InOutItemAction extends BaseAction } //回写查询结果 toClient(dataArray.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找收支项目信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询收支项目信息结果异常", e); } } /** * 拼接搜索条件 + * * @return */ - private Map getCondition() - { + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("name_s_like", model.getName()); condition.put("remark_s_like", model.getRemark()); condition.put("id_s_order", "desc"); @@ -300,32 +257,30 @@ public class InOutItemAction extends BaseAction /** * 拼接搜索条件-下拉框-收支项目 + * * @return */ - private Map getCondition_select() - { + private Map getCondition_select() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); - if(model.getType().equals("in")) { - condition.put("type_s_eq", "收入"); + Map condition = new HashMap(); + if (model.getType().equals("in")) { + condition.put("type_s_eq", "收入"); + } else if (model.getType().equals("out")) { + condition.put("type_s_eq", "支出"); } - else if(model.getType().equals("out")) { - condition.put("type_s_eq", "支出"); - } condition.put("id_s_order", "desc"); return condition; } //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== @Override - public InOutItemModel getModel() - { + public InOutItemModel getModel() { return model; } - public void setInOutItemService(InOutItemIService inOutItemService) - { + + public void setInOutItemService(InOutItemIService inOutItemService) { this.inOutItemService = inOutItemService; } } diff --git a/src/main/java/com/jsh/action/basic/LogAction.java b/src/main/java/com/jsh/action/basic/LogAction.java index e4a22d30..805f396f 100644 --- a/src/main/java/com/jsh/action/basic/LogAction.java +++ b/src/main/java/com/jsh/action/basic/LogAction.java @@ -1,13 +1,5 @@ package com.jsh.action.basic; -import java.io.IOException; -import java.sql.Timestamp; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; import com.jsh.base.BaseAction; import com.jsh.base.Log; import com.jsh.model.po.Logdetails; @@ -15,109 +7,106 @@ import com.jsh.model.vo.basic.LogModel; import com.jsh.service.basic.UserIService; import com.jsh.util.PageUtil; import com.jsh.util.Tools; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + +import java.io.IOException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /* *日志管理 * @author jishenghua qq:7-5-2-7-1-8-9-2-0 -*/ + */ @SuppressWarnings("serial") -public class LogAction extends BaseAction -{ - private LogModel model = new LogModel(); - private UserIService userService; - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public String getBasicData() - { - Map mapData = model.getShowModel().getMap(); - PageUtil pageUtil = new PageUtil(); +public class LogAction extends BaseAction { + private LogModel model = new LogModel(); + private UserIService userService; + + @SuppressWarnings({"rawtypes", "unchecked"}) + public String getBasicData() { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - try - { - Map condition = pageUtil.getAdvSearch(); - condition.clear(); + try { + Map condition = pageUtil.getAdvSearch(); + condition.clear(); condition.put("ismanager_n_eq", 0); userService.find(pageUtil); mapData.put("userList", pageUtil.getPageList()); - } - catch (Exception e) - { + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); model.getShowModel().setMsgTip("exceptoin"); } return SUCCESS; } - - /** - * 删除日志 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除日志信息方法delete()================"); - try - { + + /** + * 删除日志 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除日志信息方法delete()================"); + try { logService.delete(model.getLogID()); tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getLogID() + " 的日志异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getLogID() + " 的日志异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除日志", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除日志ID为 "+ model.getLogID() + " " + tipMsg + "!", "删除日志" + tipMsg)); - Log.infoFileSync("====================结束调用删除日志信息方法delete()================"); - return SUCCESS; - } - - /** - * 批量删除指定ID日志 - * @return - */ - public String batchDelete() - { - try - { + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除日志", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除日志ID为 " + model.getLogID() + " " + tipMsg + "!", "删除日志" + tipMsg)); + Log.infoFileSync("====================结束调用删除日志信息方法delete()================"); + return SUCCESS; + } + + /** + * 批量删除指定ID日志 + * + * @return + */ + public String batchDelete() { + try { logService.batchDelete(model.getLogIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除日志ID为:" + model.getLogIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除日志ID为:" + model.getLogIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除日志", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除日志", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除日志ID为 "+ model.getLogIDs() + " " + tipMsg + "!", "批量删除日志" + tipMsg)); - return SUCCESS; - } - - /** - * 查找日志信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + , tipType, "批量删除日志ID为 " + model.getLogIDs() + " " + tipMsg + "!", "批量删除日志" + tipMsg)); + return SUCCESS; + } + + /** + * 查找日志信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); logService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 // {"total":28,"rows":[ // {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} @@ -126,10 +115,8 @@ public class LogAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Logdetails log:dataList) - { + if (null != dataList) { + for (Logdetails log : dataList) { JSONObject item = new JSONObject(); item.put("id", log.getId()); item.put("clientIP", log.getClientIp()); @@ -137,36 +124,32 @@ public class LogAction extends BaseAction item.put("createTime", Tools.getCenternTime(log.getCreatetime())); item.put("operation", log.getOperation()); item.put("remark", log.getRemark()); - item.put("status", log.getStatus() == 0 ?"成功":"失败"); + item.put("status", log.getStatus() == 0 ? "成功" : "失败"); item.put("statusShort", log.getStatus()); - item.put("username", log.getUser()==null?"":log.getUser().getUsername()); + item.put("username", log.getUser() == null ? "" : log.getUser().getUsername()); dataArray.add(item); } } outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>查找日志信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>查找日志信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询日志信息结果异常", e); } - } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + } + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("user.id_n_eq", model.getUsernameID()); condition.put("createtime_s_gteq", model.getBeginTime()); condition.put("createtime_s_lteq", model.getEndTime()); @@ -178,16 +161,14 @@ public class LogAction extends BaseAction condition.put("createtime_s_order", "desc"); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - public void setUserService(UserIService userService) - { + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + public void setUserService(UserIService userService) { this.userService = userService; } - @Override - public LogModel getModel() - { - return model; - } + @Override + public LogModel getModel() { + return model; + } } diff --git a/src/main/java/com/jsh/action/basic/RoleAction.java b/src/main/java/com/jsh/action/basic/RoleAction.java index 65c2d781..b74b75b6 100644 --- a/src/main/java/com/jsh/action/basic/RoleAction.java +++ b/src/main/java/com/jsh/action/basic/RoleAction.java @@ -1,214 +1,182 @@ package com.jsh.action.basic; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.Role; +import com.jsh.model.vo.basic.RoleModel; +import com.jsh.service.basic.RoleIService; +import com.jsh.service.basic.UserBusinessIService; +import com.jsh.util.PageUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + import java.io.IOException; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.util.JshException; -import com.jsh.model.po.App; -import com.jsh.model.po.Role; -import com.jsh.model.po.Logdetails; -import com.jsh.model.vo.basic.RoleModel; -import com.jsh.service.basic.RoleIService; -import com.jsh.service.basic.UserBusinessIService; -import com.jsh.util.PageUtil; + /* * 角色管理 * @author jishenghua qq:7-5-2-7-1-8-9-2-0 -*/ + */ @SuppressWarnings("serial") -public class RoleAction extends BaseAction -{ +public class RoleAction extends BaseAction { private RoleIService roleService; private UserBusinessIService userBusinessService; private RoleModel model = new RoleModel(); - /** - * 增加角色 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加角色信息方法create()==================="); - Boolean flag = false; - try - { - Role role = new Role(); - role.setName(model.getName()); - roleService.create(role); - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加角色信息异常", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>增加角色信息回写客户端结果异常", e); - } - } - - logService.create(new Logdetails(getUser(), "增加角色", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加角色名称为 "+ model.getName() + " " + tipMsg + "!", "增加角色" + tipMsg)); - Log.infoFileSync("==================结束调用增加角色方法create()==================="); - } - - /** - * 删除角色 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除角色信息方法delete()================"); - try - { - roleService.delete(model.getRoleID()); + + /** + * 增加角色 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加角色信息方法create()==================="); + Boolean flag = false; + try { + Role role = new Role(); + role.setName(model.getName()); + roleService.create(role); + + //========标识位=========== + flag = true; + //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getRoleID() + " 的角色异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加角色信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>增加角色信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加角色", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加角色名称为 " + model.getName() + " " + tipMsg + "!", "增加角色" + tipMsg)); + Log.infoFileSync("==================结束调用增加角色方法create()==================="); + } + + /** + * 删除角色 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除角色信息方法delete()================"); + try { + roleService.delete(model.getRoleID()); + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getRoleID() + " 的角色异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除角色", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "删除角色" + tipMsg)); - Log.infoFileSync("====================结束调用删除角色信息方法delete()================"); - return SUCCESS; - } - - /** - * 更新角色 - * @return - */ - public void update() - { - Boolean flag = false; - try - { - Role role = roleService.get(model.getRoleID()); - role.setName(model.getName()); - roleService.update(role); - + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除角色", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除角色ID为 " + model.getRoleID() + " " + tipMsg + "!", "删除角色" + tipMsg)); + Log.infoFileSync("====================结束调用删除角色信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新角色 + * + * @return + */ + public void update() { + Boolean flag = false; + try { + Role role = roleService.get(model.getRoleID()); + role.setName(model.getName()); + roleService.update(role); + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改角色ID为 : " + model.getRoleID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改角色回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新角色", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新角色ID为 "+ model.getRoleID() + " " + tipMsg + "!", "更新角色" + tipMsg)); - } - - /** - * 批量删除指定ID角色 - * @return - */ - public String batchDelete() - { - try - { - roleService.batchDelete(model.getRoleIDs()); + , tipType, "更新角色ID为 " + model.getRoleID() + " " + tipMsg + "!", "更新角色" + tipMsg)); + } + + /** + * 批量删除指定ID角色 + * + * @return + */ + public String batchDelete() { + try { + roleService.batchDelete(model.getRoleIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除角色ID为:" + model.getRoleIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除角色ID为:" + model.getRoleIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除角色", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除角色", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除角色ID为 "+ model.getRoleIDs() + " " + tipMsg + "!", "批量删除角色" + tipMsg)); - return SUCCESS; - } - - /** - * 检查输入名称是否存在 - */ - public void checkIsNameExist() - { - Boolean flag = false; - try - { - flag = roleService.checkIsNameExist("name",model.getName(),"Id", model.getRoleID()); - } - catch (DataAccessException e) - { + , tipType, "批量删除角色ID为 " + model.getRoleIDs() + " " + tipMsg + "!", "批量删除角色" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() { + Boolean flag = false; + try { + flag = roleService.checkIsNameExist("name", model.getName(), "Id", model.getRoleID()); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!"); - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!", e); } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查角色名称为:" + model.getName() + " ID为: " + model.getRoleID() + " 是否存在异常!",e); - } - } - } - - /** - * 查找角色信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + } + } + + /** + * 查找角色信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); roleService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 // {"total":28,"rows":[ // {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} @@ -217,10 +185,8 @@ public class RoleAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Role role:dataList) - { + if (null != dataList) { + for (Role role : dataList) { JSONObject item = new JSONObject(); item.put("Id", role.getId()); //供应商名称 @@ -232,116 +198,104 @@ public class RoleAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色信息结果异常", e); } - } - - /** - * 用户对应角色显示 - * @return - */ - public void findUserRole() - { - try - { - PageUtil pageUtil = new PageUtil(); + } + + /** + * 用户对应角色显示 + * + * @return + */ + public void findUserRole() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(100); //pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition_UserRole()); roleService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 - JSONObject outer = new JSONObject(); - outer.put("id", 1); - outer.put("text", "角色列表"); - outer.put("state", "open"); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Role role:dataList) - { - JSONObject item = new JSONObject(); - item.put("id", role.getId()); - item.put("text", role.getName()); - //勾选判断1 - Boolean flag = false; - try - { - flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+role.getId().toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的角色:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); - } - if (flag==true){item.put("checked", true);} - //结束 - dataArray.add(item); - } - } - outer.put("children", dataArray); - //回写查询结果 - toClient("["+outer.toString()+"]"); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色异常", e); - } - catch (IOException e) - { + JSONObject outer = new JSONObject(); + outer.put("id", 1); + outer.put("text", "角色列表"); + outer.put("state", "open"); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (Role role : dataList) { + JSONObject item = new JSONObject(); + item.put("id", role.getId()); + item.put("text", role.getName()); + //勾选判断1 + Boolean flag = false; + try { + flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + role.getId().toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的角色:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); + } + if (flag == true) { + item.put("checked", true); + } + //结束 + dataArray.add(item); + } + } + outer.put("children", dataArray); + //回写查询结果 + toClient("[" + outer.toString() + "]"); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找角色异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询角色结果异常", e); } - } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + } + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Name_s_like", model.getName()); condition.put("Id_s_order", "asc"); return condition; } - - /** - * 拼接搜索条件-用户对应角色 - * @return - */ - private Map getCondition_UserRole() - { + + /** + * 拼接搜索条件-用户对应角色 + * + * @return + */ + private Map getCondition_UserRole() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Id_s_order", "asc"); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public RoleModel getModel() - { - return model; - } - public void setRoleService(RoleIService roleService) - { + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public RoleModel getModel() { + return model; + } + + public void setRoleService(RoleIService roleService) { this.roleService = roleService; } - public void setUserBusinessService(UserBusinessIService userBusinessService) { - this.userBusinessService = userBusinessService; - } + + public void setUserBusinessService(UserBusinessIService userBusinessService) { + this.userBusinessService = userBusinessService; + } } diff --git a/src/main/java/com/jsh/action/basic/SupplierAction.java b/src/main/java/com/jsh/action/basic/SupplierAction.java index 429711e2..61f1b63a 100644 --- a/src/main/java/com/jsh/action/basic/SupplierAction.java +++ b/src/main/java/com/jsh/action/basic/SupplierAction.java @@ -26,37 +26,36 @@ import java.util.Map; /* * 单位管理 * @author ji-sheng-hua qq:7 5 2 7 1 8 9 2 0 -*/ + */ @SuppressWarnings("serial") -public class SupplierAction extends BaseAction -{ - private SupplierIService supplierService; - private UserBusinessIService userBusinessService; - private SupplierModel model = new SupplierModel(); - private final static Integer ISYSTEM = 1; +public class SupplierAction extends BaseAction { public static final String EXCEL = "excel"; //action返回excel结果 - /** - * 增加供应商 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加供应商方法==================="); - Boolean flag = false; - try - { - Supplier supplier = new Supplier(); - supplier.setContacts(model.getContacts()); - supplier.setType(model.getType()); - supplier.setDescription(model.getDescription()); - supplier.setEmail(model.getEmail()); + private final static Integer ISYSTEM = 1; + private SupplierIService supplierService; + private UserBusinessIService userBusinessService; + private SupplierModel model = new SupplierModel(); + + /** + * 增加供应商 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加供应商方法==================="); + Boolean flag = false; + try { + Supplier supplier = new Supplier(); + supplier.setContacts(model.getContacts()); + supplier.setType(model.getType()); + supplier.setDescription(model.getDescription()); + supplier.setEmail(model.getEmail()); supplier.setAdvanceIn(0.0); supplier.setBeginNeedGet(model.getBeginNeedGet()); supplier.setBeginNeedPay(model.getBeginNeedPay()); - supplier.setIsystem((short)1); + supplier.setIsystem((short) 1); supplier.setEnabled(true); - supplier.setPhonenum(model.getPhonenum()); - supplier.setSupplier(model.getSupplier()); + supplier.setPhonenum(model.getPhonenum()); + supplier.setSupplier(model.getSupplier()); supplier.setFax(model.getFax()); supplier.setTelephone(model.getTelephone()); @@ -66,75 +65,64 @@ public class SupplierAction extends BaseAction supplier.setAccountNumber(model.getAccountNumber()); supplier.setTaxRate(model.getTaxRate()); - supplierService.create(supplier); - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; + supplierService.create(supplier); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加供应商异常", e); - flag = false; - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加供应商异常", e); + flag = false; + tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>增加供应商回写客户端结果异常", e); } - } - - logService.create(new Logdetails(getUser(), "增加供应商", model.getClientIp(), + } + + logService.create(new Logdetails(getUser(), "增加供应商", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "增加供应商名称为 "+ model.getSupplier() + " " + tipMsg + "!", "增加供应商" + tipMsg)); - Log.infoFileSync("==================结束调用增加供应商方法==================="); - } - - /** - * 删除供应商 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除供应商信息方法delete()================"); - try - { + , tipType, "增加供应商名称为 " + model.getSupplier() + " " + tipMsg + "!", "增加供应商" + tipMsg)); + Log.infoFileSync("==================结束调用增加供应商方法==================="); + } + + /** + * 删除供应商 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除供应商信息方法delete()================"); + try { supplierService.delete(model.getSupplierID()); tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getSupplierID() + " 的供应商异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getSupplierID() + " 的供应商异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除供应商", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除供应商ID为 "+ model.getSupplierID() + ",名称为 " + model.getSupplier() + tipMsg + "!", "删除供应商" + tipMsg)); - Log.infoFileSync("====================结束调用删除供应商信息方法delete()================"); - return SUCCESS; - } - - /** - * 更新供应商 - * @return - */ - public void update() - { - Boolean flag = false; - try - { + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除供应商", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除供应商ID为 " + model.getSupplierID() + ",名称为 " + model.getSupplier() + tipMsg + "!", "删除供应商" + tipMsg)); + Log.infoFileSync("====================结束调用删除供应商信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新供应商 + * + * @return + */ + public void update() { + Boolean flag = false; + try { Supplier supplier = supplierService.get(model.getSupplierID()); supplier.setContacts(model.getContacts()); supplier.setType(model.getType()); @@ -143,7 +131,7 @@ public class SupplierAction extends BaseAction supplier.setAdvanceIn(supplier.getAdvanceIn()); supplier.setBeginNeedGet(model.getBeginNeedGet()); supplier.setBeginNeedPay(model.getBeginNeedPay()); - supplier.setIsystem((short)1); + supplier.setIsystem((short) 1); supplier.setPhonenum(model.getPhonenum()); supplier.setSupplier(model.getSupplier()); @@ -157,43 +145,35 @@ public class SupplierAction extends BaseAction supplier.setEnabled(supplier.getEnabled()); supplierService.update(supplier); - + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改供应商ID为 : " + model.getSupplierID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改供应商回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新供应商", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新供应商ID为 "+ model.getSupplierID() + " " + tipMsg + "!", "更新供应商" + tipMsg)); - } + , tipType, "更新供应商ID为 " + model.getSupplierID() + " " + tipMsg + "!", "更新供应商" + tipMsg)); + } /** * 更新供应商-只更新预付款,其余用原来的值 + * * @return */ - public void updateAdvanceIn() - { + public void updateAdvanceIn() { Boolean flag = false; - try - { + try { Supplier supplier = supplierService.get(model.getSupplierID()); supplier.setContacts(supplier.getContacts()); supplier.setType(supplier.getType()); @@ -202,7 +182,7 @@ public class SupplierAction extends BaseAction supplier.setAdvanceIn(supplier.getAdvanceIn() + model.getAdvanceIn()); //增加预收款的金额,可能增加的是负值 supplier.setBeginNeedGet(supplier.getBeginNeedGet()); supplier.setBeginNeedPay(supplier.getBeginNeedPay()); - supplier.setIsystem((short)1); + supplier.setIsystem((short) 1); supplier.setPhonenum(supplier.getPhonenum()); supplier.setSupplier(supplier.getSupplier()); @@ -220,73 +200,60 @@ public class SupplierAction extends BaseAction flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改供应商ID为 : " + model.getSupplierID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改供应商回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新供应商预付款", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新供应商ID为 "+ model.getSupplierID() + " " + tipMsg + "!", "更新供应商" + tipMsg)); + , tipType, "更新供应商ID为 " + model.getSupplierID() + " " + tipMsg + "!", "更新供应商" + tipMsg)); } - - /** - * 批量删除指定ID供应商 - * @return - */ - public String batchDelete() - { - try - { + + /** + * 批量删除指定ID供应商 + * + * @return + */ + public String batchDelete() { + try { supplierService.batchDelete(model.getSupplierIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除供应商ID为:" + model.getSupplierIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除供应商ID为:" + model.getSupplierIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除供应商", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除供应商", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除供应商ID为 "+ model.getSupplierIDs() + " " + tipMsg + "!", "批量删除供应商" + tipMsg)); - return SUCCESS; - } + , tipType, "批量删除供应商ID为 " + model.getSupplierIDs() + " " + tipMsg + "!", "批量删除供应商" + tipMsg)); + return SUCCESS; + } /** * 批量设置状态-启用或者禁用 + * * @return */ - public String batchSetEnable() - { - try - { - supplierService.batchSetEnable(model.getEnabled(),model.getSupplierIDs()); + public String batchSetEnable() { + try { + supplierService.batchSetEnable(model.getEnabled(), model.getSupplierIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>批量修改状态,单位ID为:" + model.getSupplierIDs() + "信息异常", e); tipMsg = "失败"; tipType = 1; @@ -294,83 +261,69 @@ public class SupplierAction extends BaseAction logService.create(new Logdetails(getUser(), "批量修改单位状态", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量修改状态,单位ID为 "+ model.getSupplierIDs() + " " + tipMsg + "!", "批量修改单位状态" + tipMsg)); + , tipType, "批量修改状态,单位ID为 " + model.getSupplierIDs() + " " + tipMsg + "!", "批量修改单位状态" + tipMsg)); return SUCCESS; } - - /** - * 检查输入名称是否存在 - */ - public void checkIsNameExist() - { - Boolean flag = false; - try - { - flag = supplierService.checkIsNameExist("supplier",model.getSupplier(),"id", model.getSupplierID()); - } - catch (DataAccessException e) - { + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() { + Boolean flag = false; + try { + flag = supplierService.checkIsNameExist("supplier", model.getSupplier(), "id", model.getSupplierID()); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>检查供应商名称为:" + model.getSupplier() + " ID为: " + model.getSupplierID() + " 是否存在异常!"); - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查供应商名称为:" + model.getSupplier() + " ID为: " + model.getSupplierID() + " 是否存在异常!", e); } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查供应商名称为:" + model.getSupplier() + " ID为: " + model.getSupplierID() + " 是否存在异常!",e); - } - } - } - - /** - * 查找供应商信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + } + } + + /** + * 查找供应商信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); supplierService.find(pageUtil); String sName = ""; - if((model.getType()).equals("供应商")){ + if ((model.getType()).equals("供应商")) { sName = "pageUtilVendor"; - } - else if((model.getType()).equals("客户")){ + } else if ((model.getType()).equals("客户")) { sName = "pageUtilCustomer"; - } - else if((model.getType()).equals("会员")){ + } else if ((model.getType()).equals("会员")) { sName = "pageUtilMember"; } getSession().put(sName, pageUtil); List dataList = pageUtil.getPageList(); - + JSONObject outer = new JSONObject(); outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Supplier supplier:dataList) - { + if (null != dataList) { + for (Supplier supplier : dataList) { JSONObject item = new JSONObject(); item.put("id", supplier.getId()); //供应商名称 item.put("supplier", supplier.getSupplier()); item.put("type", supplier.getType()); - item.put("contacts",supplier.getContacts()); + item.put("contacts", supplier.getContacts()); item.put("phonenum", supplier.getPhonenum()); item.put("email", supplier.getEmail()); - item.put("AdvanceIn",supplier.getAdvanceIn()); - item.put("BeginNeedGet",supplier.getBeginNeedGet()); - item.put("BeginNeedPay",supplier.getBeginNeedPay()); - item.put("isystem", supplier.getIsystem() == (short)0?"是":"否"); + item.put("AdvanceIn", supplier.getAdvanceIn()); + item.put("BeginNeedGet", supplier.getBeginNeedGet()); + item.put("BeginNeedPay", supplier.getBeginNeedPay()); + item.put("isystem", supplier.getIsystem() == (short) 0 ? "是" : "否"); item.put("description", supplier.getDescription()); item.put("fax", supplier.getFax()); @@ -389,24 +342,21 @@ public class SupplierAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e); } - } + } /** * 根据id查找信息 + * * @return */ public void findById() { try { - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getConditionById()); @@ -416,22 +366,20 @@ public class SupplierAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Supplier supplier:dataList) - { + if (null != dataList) { + for (Supplier supplier : dataList) { JSONObject item = new JSONObject(); item.put("id", supplier.getId()); //名称 item.put("supplier", supplier.getSupplier()); item.put("type", supplier.getType()); - item.put("contacts",supplier.getContacts()); + item.put("contacts", supplier.getContacts()); item.put("phonenum", supplier.getPhonenum()); item.put("email", supplier.getEmail()); - item.put("AdvanceIn",supplier.getAdvanceIn()); - item.put("BeginNeedGet",supplier.getBeginNeedGet()); - item.put("BeginNeedPay",supplier.getBeginNeedPay()); - item.put("isystem", supplier.getIsystem() == (short)0?"是":"否"); + item.put("AdvanceIn", supplier.getAdvanceIn()); + item.put("BeginNeedGet", supplier.getBeginNeedGet()); + item.put("BeginNeedPay", supplier.getBeginNeedPay()); + item.put("isystem", supplier.getIsystem() == (short) 0 ? "是" : "否"); item.put("description", supplier.getDescription()); item.put("fax", supplier.getFax()); @@ -450,24 +398,21 @@ public class SupplierAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找信息异常", e); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询信息结果异常", e); } } - - /** - * 查找供应商信息-下拉框 - * @return - */ - public void findBySelect_sup() - { - try - { - PageUtil pageUtil = new PageUtil(); + + /** + * 查找供应商信息-下拉框 + * + * @return + */ + public void findBySelect_sup() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition_Select_sup()); @@ -475,10 +420,8 @@ public class SupplierAction extends BaseAction List dataList = pageUtil.getPageList(); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Supplier supplier:dataList) - { + if (null != dataList) { + for (Supplier supplier : dataList) { JSONObject item = new JSONObject(); item.put("id", supplier.getId()); //供应商名称 @@ -488,23 +431,21 @@ public class SupplierAction extends BaseAction } //回写查询结果 toClient(dataArray.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e); } - } - /** - * 查找客户信息-下拉框 - * @return - */ + } + + /** + * 查找客户信息-下拉框 + * + * @return + */ public void findBySelect_cus() { - try { - PageUtil pageUtil = new PageUtil(); + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition_Select_cus()); @@ -512,18 +453,17 @@ public class SupplierAction extends BaseAction List dataList = pageUtil.getPageList(); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(Supplier supplier:dataList) { + if (null != dataList) { + for (Supplier supplier : dataList) { JSONObject item = new JSONObject(); //勾选判断1 Boolean flag = false; - try{ - flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+supplier.getId().toString()+"]"); - } - catch (DataAccessException e){ + try { + flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + supplier.getId().toString() + "]"); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>查询用户对应的客户:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); } - if (flag==true){ + if (flag == true) { item.put("id", supplier.getId()); item.put("supplier", supplier.getSupplier()); //客户名称 dataArray.add(item); @@ -532,24 +472,21 @@ public class SupplierAction extends BaseAction } //回写查询结果 toClient(dataArray.toString()); - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>查找客户信息异常", e); - } - catch (IOException e) { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>查找客户信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询客户信息结果异常", e); } - } + } /** * 查找会员信息-下拉框 + * * @return */ - public void findBySelect_retail() - { - try - { - PageUtil pageUtil = new PageUtil(); + public void findBySelect_retail() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition_Select_retail()); @@ -557,10 +494,8 @@ public class SupplierAction extends BaseAction List dataList = pageUtil.getPageList(); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Supplier supplier:dataList) - { + if (null != dataList) { + for (Supplier supplier : dataList) { JSONObject item = new JSONObject(); item.put("id", supplier.getId()); //客户名称 @@ -571,13 +506,9 @@ public class SupplierAction extends BaseAction } //回写查询结果 toClient(dataArray.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找客户信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询客户信息结果异常", e); } } @@ -585,11 +516,9 @@ public class SupplierAction extends BaseAction /** * 查找非会员的id */ - public void findBySelectRetailNoPeople() - { - try - { - PageUtil pageUtil = new PageUtil(); + public void findBySelectRetailNoPeople() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition_Select_retail_no_people()); @@ -597,10 +526,8 @@ public class SupplierAction extends BaseAction List dataList = pageUtil.getPageList(); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Supplier supplier:dataList) - { + if (null != dataList) { + for (Supplier supplier : dataList) { JSONObject item = new JSONObject(); item.put("id", supplier.getId()); //客户名称 @@ -611,27 +538,24 @@ public class SupplierAction extends BaseAction } //回写查询结果 toClient(dataArray.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找客户信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询客户信息结果异常", e); } } /** * 用户对应客户显示 + * * @return */ public void findUserCustomer() { try { - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(500); - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("type_s_eq", "客户"); condition.put("id_s_order", "desc"); @@ -646,50 +570,47 @@ public class SupplierAction extends BaseAction outer.put("state", "open"); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList){ - for(Supplier supplier:dataList){ + if (null != dataList) { + for (Supplier supplier : dataList) { JSONObject item = new JSONObject(); item.put("id", supplier.getId()); item.put("text", supplier.getSupplier()); //勾选判断1 Boolean flag = false; - try{ - flag = userBusinessService.checkIsUserBusinessExist("Type",model.getUBType(),"KeyId",model.getUBKeyId(),"Value","["+supplier.getId().toString()+"]"); - } - catch (DataAccessException e){ + try { + flag = userBusinessService.checkIsUserBusinessExist("Type", model.getUBType(), "KeyId", model.getUBKeyId(), "Value", "[" + supplier.getId().toString() + "]"); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>设置用户对应的客户:类型" + model.getUBType() + " KeyId为: " + model.getUBKeyId() + " 存在异常!"); } - if (flag==true){item.put("checked", true);} + if (flag == true) { + item.put("checked", true); + } //结束 dataArray.add(item); } } outer.put("children", dataArray); //回写查询结果 - toClient("["+outer.toString()+"]"); - } - catch (DataAccessException e){ + toClient("[" + outer.toString() + "]"); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找客户异常", e); - } - catch (IOException e){ + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询客户结果异常", e); } } - public String importFun(){ + public String importFun() { //excel表格file Boolean result = false; String returnStr = ""; try { InputStream in = supplierService.importExcel(model.getSupplierFile()); - if(null != in) - { + if (null != in) { model.setFileName(Tools.getRandomChar() + Tools.getNow2(Calendar.getInstance().getTime()) + "_wrong.xls"); model.setExcelStream(in); returnStr = SupplierConstants.BusinessForExcel.EXCEL; - } - else { + } else { result = true; try { toClient(result.toString()); @@ -700,9 +621,7 @@ public class SupplierAction extends BaseAction returnStr = SUCCESS; } - } - catch (JshException e) - { + } catch (JshException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>导入excel表格信息异常", e); } return returnStr; @@ -710,6 +629,7 @@ public class SupplierAction extends BaseAction /** * 导入excel表格-供应商 + * * @return */ @SuppressWarnings("unchecked") @@ -719,6 +639,7 @@ public class SupplierAction extends BaseAction /** * 导入excel表格-客户 + * * @return */ @SuppressWarnings("unchecked") @@ -728,6 +649,7 @@ public class SupplierAction extends BaseAction /** * 导入excel表格-会员 + * * @return */ @SuppressWarnings("unchecked") @@ -738,6 +660,7 @@ public class SupplierAction extends BaseAction /** * 导出excel表格 + * * @return */ @SuppressWarnings("unchecked") @@ -745,34 +668,34 @@ public class SupplierAction extends BaseAction Log.infoFileSync("===================调用导出信息action方法exportExcel开始======================="); try { String sName = "pageUtil" + model.getType(); - PageUtil pageUtil = (PageUtil)getSession().get(sName); + PageUtil pageUtil = (PageUtil) getSession().get(sName); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); String isCurrentPage = "allPage"; - model.setFileName(Tools.changeUnicode("report" + System.currentTimeMillis() + ".xls",model.getBrowserType())); - model.setExcelStream(supplierService.exmportExcel(isCurrentPage,pageUtil)); - } - catch (Exception e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常",e); + model.setFileName(Tools.changeUnicode("report" + System.currentTimeMillis() + ".xls", model.getBrowserType())); + model.setExcelStream(supplierService.exmportExcel(isCurrentPage, pageUtil)); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常", e); model.getShowModel().setMsgTip("export excel exception"); } Log.infoFileSync("===================调用导出信息action方法exportExcel结束=================="); return EXCEL; } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() { + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("supplier_s_like", model.getSupplier()); condition.put("type_s_like", model.getType()); - condition.put("phonenum_s_like",model.getPhonenum()); + condition.put("phonenum_s_like", model.getPhonenum()); condition.put("telephone_s_like", model.getTelephone()); condition.put("description_s_like", model.getDescription()); condition.put("isystem_n_eq", ISYSTEM); @@ -781,91 +704,90 @@ public class SupplierAction extends BaseAction } /** - *搜索条件 + * 搜索条件 */ - private Map getConditionById() { + private Map getConditionById() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Id_n_eq", model.getSupplierID()); return condition; } - - /** - * 拼接搜索条件-下拉框-供应商 - * @return - */ - private Map getCondition_Select_sup() - { + + /** + * 拼接搜索条件-下拉框-供应商 + * + * @return + */ + private Map getCondition_Select_sup() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("type_s_like", "供应商"); - condition.put("enabled_s_eq",1); + condition.put("enabled_s_eq", 1); condition.put("id_s_order", "desc"); return condition; } - /** - * 拼接搜索条件-下拉框-客户 - * @return - */ - private Map getCondition_Select_cus() - { + /** + * 拼接搜索条件-下拉框-客户 + * + * @return + */ + private Map getCondition_Select_cus() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("type_s_like", "客户"); - condition.put("enabled_s_eq",1); + condition.put("enabled_s_eq", 1); condition.put("id_s_order", "desc"); return condition; } /** * 拼接搜索条件-下拉框-会员 + * * @return */ - private Map getCondition_Select_retail() - { + private Map getCondition_Select_retail() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("type_s_like", "会员"); - condition.put("enabled_s_eq",1); + condition.put("enabled_s_eq", 1); condition.put("id_s_order", "desc"); return condition; } /** * 拼接搜索条件-非会员 + * * @return */ - private Map getCondition_Select_retail_no_people() - { + private Map getCondition_Select_retail_no_people() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("type_s_like", "会员"); condition.put("isystem_n_eq", 0); condition.put("id_s_order", "desc"); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public SupplierModel getModel() - { - return model; - } - public void setSupplierService(SupplierIService supplierService) - { - this.supplierService = supplierService; - } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public SupplierModel getModel() { + return model; + } + + public void setSupplierService(SupplierIService supplierService) { + this.supplierService = supplierService; + } public void setUserBusinessService(UserBusinessIService userBusinessService) { this.userBusinessService = userBusinessService; diff --git a/src/main/java/com/jsh/action/basic/SystemConfigAction.java b/src/main/java/com/jsh/action/basic/SystemConfigAction.java index 9114d050..7aaeb456 100644 --- a/src/main/java/com/jsh/action/basic/SystemConfigAction.java +++ b/src/main/java/com/jsh/action/basic/SystemConfigAction.java @@ -20,65 +20,55 @@ import java.util.Map; /* * 系统配置 * @author jishenghua qq:7-5-2-7 1-8-9-2-0 -*/ + */ @SuppressWarnings("serial") -public class SystemConfigAction extends BaseAction -{ +public class SystemConfigAction extends BaseAction { private SystemConfigIService systemConfigService; private SystemConfigModel model = new SystemConfigModel(); - - /** - * 更新系统配置 - * @return - */ - public void update() - { - Boolean flag = false; - try - { - SystemConfig sysConfig = systemConfigService.get(model.getId()); - sysConfig.setType(sysConfig.getType()); - sysConfig.setName(sysConfig.getName()); - sysConfig.setValue(model.getValue()); - sysConfig.setDescription(sysConfig.getDescription()); - systemConfigService.update(sysConfig); - + + /** + * 更新系统配置 + * + * @return + */ + public void update() { + Boolean flag = false; + try { + SystemConfig sysConfig = systemConfigService.get(model.getId()); + sysConfig.setType(sysConfig.getType()); + sysConfig.setName(sysConfig.getName()); + sysConfig.setValue(model.getValue()); + sysConfig.setDescription(sysConfig.getDescription()); + systemConfigService.update(sysConfig); + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改系统配置ID为 : " + model.getId() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改系统配置回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新系统配置", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新系统配置ID为 "+ model.getId() + " " + tipMsg + "!", "更新系统配置" + tipMsg)); - } - - /** - * 查找系统配置信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + , tipType, "更新系统配置ID为 " + model.getId() + " " + tipMsg + "!", "更新系统配置" + tipMsg)); + } + + /** + * 查找系统配置信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition()); @@ -87,16 +77,14 @@ public class SystemConfigAction extends BaseAction JSONObject outer = new JSONObject(); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(SystemConfig sysConfig:dataList) - { + if (null != dataList) { + for (SystemConfig sysConfig : dataList) { JSONObject item = new JSONObject(); item.put("id", sysConfig.getId()); item.put("type", sysConfig.getType()); - item.put("name", sysConfig.getName()); - item.put("value", sysConfig.getValue()); - item.put("description", sysConfig.getDescription()); + item.put("name", sysConfig.getName()); + item.put("value", sysConfig.getValue()); + item.put("description", sysConfig.getDescription()); item.put("op", 1); dataArray.add(item); } @@ -104,40 +92,35 @@ public class SystemConfigAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找系统配置信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找系统配置信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询系统配置信息结果异常", e); } - } + } - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("id_s_order", "asc"); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public SystemConfigModel getModel() - { - return model; - } - public void setSystemConfigService(SystemConfigIService systemConfigService) - { + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public SystemConfigModel getModel() { + return model; + } + + public void setSystemConfigService(SystemConfigIService systemConfigService) { this.systemConfigService = systemConfigService; } } diff --git a/src/main/java/com/jsh/action/basic/UnitAction.java b/src/main/java/com/jsh/action/basic/UnitAction.java index 2c29832a..931482d1 100644 --- a/src/main/java/com/jsh/action/basic/UnitAction.java +++ b/src/main/java/com/jsh/action/basic/UnitAction.java @@ -2,8 +2,8 @@ package com.jsh.action.basic; import com.jsh.base.BaseAction; import com.jsh.base.Log; -import com.jsh.model.po.Unit; import com.jsh.model.po.Logdetails; +import com.jsh.model.po.Unit; import com.jsh.model.vo.basic.UnitModel; import com.jsh.service.basic.UnitIService; import com.jsh.util.PageUtil; @@ -19,277 +19,244 @@ import java.util.Map; /** * 计量单位 + * * @author ji shenghua qq:752 718 920 */ @SuppressWarnings("serial") -public class UnitAction extends BaseAction -{ - private UnitIService unitService; - private UnitModel model = new UnitModel(); +public class UnitAction extends BaseAction { + private UnitIService unitService; + private UnitModel model = new UnitModel(); - /** - * 增加计量单位 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加计量单位方法create()==================="); - Boolean flag = false; - try - { - Unit unit = new Unit(); - unit.setUName(model.getUName()); - unitService.create(unit); + /** + * 增加计量单位 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加计量单位方法create()==================="); + Boolean flag = false; + try { + Unit unit = new Unit(); + unit.setUName(model.getUName()); + unitService.create(unit); - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加计量单位异常", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>增加计量单位回写客户端结果异常", e); - } - } + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加计量单位异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>增加计量单位回写客户端结果异常", e); + } + } - logService.create(new Logdetails(getUser(), "增加计量单位", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加计量单位名称为 "+ model.getUName() + " " + tipMsg + "!", "增加计量单位" + tipMsg)); - Log.infoFileSync("==================结束调用增加计量单位方法create()==================="); - } + logService.create(new Logdetails(getUser(), "增加计量单位", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加计量单位名称为 " + model.getUName() + " " + tipMsg + "!", "增加计量单位" + tipMsg)); + Log.infoFileSync("==================结束调用增加计量单位方法create()==================="); + } - /** - * 删除计量单位 - * @return - */ - public String delete() { - Log.infoFileSync("====================开始调用删除计量单位方法delete()================"); - try { - unitService.delete(model.getUnitID()); - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getUnitID() + " 的计量单位异常", e); - tipMsg = "失败"; - tipType = 1; - } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除计量单位", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除计量单位ID为 "+ model.getUnitID() + " " + tipMsg + "!", "删除计量单位" + tipMsg)); - Log.infoFileSync("====================结束调用删除计量单位方法delete()================"); - return SUCCESS; - } + /** + * 删除计量单位 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除计量单位方法delete()================"); + try { + unitService.delete(model.getUnitID()); + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getUnitID() + " 的计量单位异常", e); + tipMsg = "失败"; + tipType = 1; + } + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除计量单位", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除计量单位ID为 " + model.getUnitID() + " " + tipMsg + "!", "删除计量单位" + tipMsg)); + Log.infoFileSync("====================结束调用删除计量单位方法delete()================"); + return SUCCESS; + } - /** - * 更新计量单位 - * @return - */ - public void update() { - Boolean flag = false; - try { - Unit unit = unitService.get(model.getUnitID()); - unit.setUName(model.getUName()); - unitService.update(unit); + /** + * 更新计量单位 + * + * @return + */ + public void update() { + Boolean flag = false; + try { + Unit unit = unitService.get(model.getUnitID()); + unit.setUName(model.getUName()); + unitService.update(unit); - flag = true; - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>>>修改计量单位ID为 : " + model.getUnitID() + "信息失败", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally { - try { - toClient(flag.toString()); - } - catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>修改计量单位回写客户端结果异常", e); - } - } - logService.create(new Logdetails(getUser(), "更新计量单位", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "更新计量单位ID为 "+ model.getUnitID() + " " + tipMsg + "!", "更新计量单位" + tipMsg)); - } + flag = true; + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>修改计量单位ID为 : " + model.getUnitID() + "信息失败", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>修改计量单位回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "更新计量单位", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "更新计量单位ID为 " + model.getUnitID() + " " + tipMsg + "!", "更新计量单位" + tipMsg)); + } - /** - * 批量删除指定ID计量单位 - * @return - */ - public String batchDelete() - { - try - { - unitService.batchDelete(model.getUnitIDs()); - model.getShowModel().setMsgTip("成功"); - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除计量单位ID为:" + model.getUnitIDs() + "信息异常", e); - tipMsg = "失败"; - tipType = 1; - } + /** + * 批量删除指定ID计量单位 + * + * @return + */ + public String batchDelete() { + try { + unitService.batchDelete(model.getUnitIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除计量单位ID为:" + model.getUnitIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } - logService.create(new Logdetails(getUser(), "批量删除计量单位", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除计量单位ID为 "+ model.getUnitIDs() + " " + tipMsg + "!", "批量删除计量单位" + tipMsg)); - return SUCCESS; - } + logService.create(new Logdetails(getUser(), "批量删除计量单位", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除计量单位ID为 " + model.getUnitIDs() + " " + tipMsg + "!", "批量删除计量单位" + tipMsg)); + return SUCCESS; + } - /** - * 检查输入名称是否存在 - */ - public void checkIsNameExist() - { - Boolean flag = false; - try - { - flag = unitService.checkIsNameExist("UName",model.getUName(),"id", model.getUnitID()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>检查计量单位名称为:" + model.getUName() + " ID为: " + model.getUnitID() + " 是否存在异常!"); - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查计量单位名称为:" + model.getUName() + " ID为: " + model.getUnitID() + " 是否存在异常!",e); - } - } - } + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() { + Boolean flag = false; + try { + flag = unitService.checkIsNameExist("UName", model.getUName(), "id", model.getUnitID()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查计量单位名称为:" + model.getUName() + " ID为: " + model.getUnitID() + " 是否存在异常!"); + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查计量单位名称为:" + model.getUName() + " ID为: " + model.getUnitID() + " 是否存在异常!", e); + } + } + } - /** - * 查找计量单位信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(model.getPageSize()); - pageUtil.setCurPage(model.getPageNo()); - pageUtil.setAdvSearch(getCondition()); - unitService.find(pageUtil); - List dataList = pageUtil.getPageList(); + /** + * 查找计量单位信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + pageUtil.setAdvSearch(getCondition()); + unitService.find(pageUtil); + List dataList = pageUtil.getPageList(); - JSONObject outer = new JSONObject(); - outer.put("total", pageUtil.getTotalCount()); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Unit unit:dataList) - { - JSONObject item = new JSONObject(); - item.put("id", unit.getId()); - //名称 - item.put("UName", unit.getUName()); - item.put("op", 1); - dataArray.add(item); - } - } - outer.put("rows", dataArray); - //回写查询结果 - toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找计量单位异常", e); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询计量单位结果异常", e); - } - } + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (Unit unit : dataList) { + JSONObject item = new JSONObject(); + item.put("id", unit.getId()); + //名称 + item.put("UName", unit.getUName()); + item.put("op", 1); + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找计量单位异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询计量单位结果异常", e); + } + } - /** - * 查找计量单位信息-下拉框 - * @return - */ - public void findUnitDownList() { - try { - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - pageUtil.setAdvSearch(getCondition()); - unitService.find(pageUtil); - List dataList = pageUtil.getPageList(); + /** + * 查找计量单位信息-下拉框 + * + * @return + */ + public void findUnitDownList() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getCondition()); + unitService.find(pageUtil); + List dataList = pageUtil.getPageList(); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(Unit unit:dataList) { - JSONObject item = new JSONObject(); - item.put("id", unit.getId()); - //名称 - item.put("UName", unit.getUName()); - dataArray.add(item); - } - } - //回写查询结果 - toClient(dataArray.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找计量单位异常", e); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询计量单位结果异常", e); - } - } + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (Unit unit : dataList) { + JSONObject item = new JSONObject(); + item.put("id", unit.getId()); + //名称 + item.put("UName", unit.getUName()); + dataArray.add(item); + } + } + //回写查询结果 + toClient(dataArray.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找计量单位异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询计量单位结果异常", e); + } + } - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { - /** - * 拼接搜索条件 - */ - Map condition = new HashMap(); - condition.put("UName_s_like", model.getUName()); - condition.put("id_s_order", "asc"); - return condition; - } + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); + condition.put("UName_s_like", model.getUName()); + condition.put("id_s_order", "asc"); + return condition; + } - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public UnitModel getModel() - { - return model; - } + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public UnitModel getModel() { + return model; + } - public void setUnitService(UnitIService unitService) { - this.unitService = unitService; - } + public void setUnitService(UnitIService unitService) { + this.unitService = unitService; + } } diff --git a/src/main/java/com/jsh/action/basic/UserAction.java b/src/main/java/com/jsh/action/basic/UserAction.java index 068efa0d..bb67b01c 100644 --- a/src/main/java/com/jsh/action/basic/UserAction.java +++ b/src/main/java/com/jsh/action/basic/UserAction.java @@ -1,445 +1,381 @@ package com.jsh.action.basic; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Basicuser; +import com.jsh.model.po.Logdetails; +import com.jsh.model.vo.basic.UserModel; +import com.jsh.service.basic.UserIService; +import com.jsh.util.ExceptionCodeConstants; +import com.jsh.util.PageUtil; +import com.jsh.util.Tools; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.util.ExceptionCodeConstants; -import com.jsh.model.po.Basicuser; -import com.jsh.model.po.Logdetails; -import com.jsh.model.vo.basic.UserModel; -import com.jsh.service.basic.UserIService; -import com.jsh.util.PageUtil; -import com.jsh.util.Tools; + /* * 用户管理 * @author jishenghua qq:752718920 -*/ + */ @SuppressWarnings("serial") -public class UserAction extends BaseAction -{ - private UserModel model = new UserModel(); - private UserIService userService; - - /** - * 需要判断用户状态,用户名密码错误不能登录 ,黑名单用户不能登录,如果已经登录过,不再进行处理,直接进入管理页面 - * @return - */ - public String login() - { - Log.infoFileSync("============用户登录 login 方法调用开始=============="); - String username = model.getLoginame().trim(); - String password = model.getPassword().trim(); - //因密码用MD5加密,需要对密码进行转化 - try - { - password = Tools.md5Encryp(password); - System.out.println(password); - } - catch (NoSuchAlgorithmException e) - { - e.printStackTrace(); - Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e); - } - - //判断用户是否已经登录过,登录过不再处理 - Basicuser sessionUser = (Basicuser)getSession().get("user"); - if(null != sessionUser && username.equalsIgnoreCase(sessionUser.getLoginame()) - && sessionUser.getPassword().equals(password)) - { - Log.infoFileSync("====用户 "+ username + "已经登录过, login 方法调用结束===="); - model.getShowModel().setMsgTip("user already login"); - /*return "login";*/ - } - - //获取用户状态 - int userStatus = -1; - try - { - userStatus = userService.validateUser(username, password); - } - catch (Exception e) - { - Log.errorFileSync(">>>>>>>>>>>>>用户 " + username + " 登录 login 方法 访问服务层异常====",e); - model.getShowModel().setMsgTip("access service exception"); - } - switch (userStatus) - { - case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST: - model.getShowModel().setMsgTip("user is not exist"); - break; - case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR: - model.getShowModel().setMsgTip("user password error"); - break; - case ExceptionCodeConstants.UserExceptionCode.BLACK_USER: - model.getShowModel().setMsgTip("user is black"); - break; - case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION: - model.getShowModel().setMsgTip("access service error"); - break; - default: - try - { - //验证通过 ,可以登录,放入session,记录登录日志 - Basicuser user = userService.getUser(username); - logService.create(new Logdetails(user, "登录系统", model.getClientIp(), - new Timestamp(System.currentTimeMillis()), (short)0,"管理用户:" + username + " 登录系统",username + " 登录系统")); - model.getShowModel().setMsgTip("user can login"); - getSession().put("user", user); - } - catch (Exception e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>查询用户名为:" + username + " ,用户信息异常", e); - } - break; - } +public class UserAction extends BaseAction { + private UserModel model = new UserModel(); + private UserIService userService; + + /** + * 需要判断用户状态,用户名密码错误不能登录 ,黑名单用户不能登录,如果已经登录过,不再进行处理,直接进入管理页面 + * + * @return + */ + public String login() { + Log.infoFileSync("============用户登录 login 方法调用开始=============="); + String username = model.getLoginame().trim(); + String password = model.getPassword().trim(); + //因密码用MD5加密,需要对密码进行转化 + try { + password = Tools.md5Encryp(password); + System.out.println(password); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e); + } + + //判断用户是否已经登录过,登录过不再处理 + Basicuser sessionUser = (Basicuser) getSession().get("user"); + if (null != sessionUser && username.equalsIgnoreCase(sessionUser.getLoginame()) + && sessionUser.getPassword().equals(password)) { + Log.infoFileSync("====用户 " + username + "已经登录过, login 方法调用结束===="); + model.getShowModel().setMsgTip("user already login"); + /*return "login";*/ + } + + //获取用户状态 + int userStatus = -1; + try { + userStatus = userService.validateUser(username, password); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>用户 " + username + " 登录 login 方法 访问服务层异常====", e); + model.getShowModel().setMsgTip("access service exception"); + } + switch (userStatus) { + case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST: + model.getShowModel().setMsgTip("user is not exist"); + break; + case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR: + model.getShowModel().setMsgTip("user password error"); + break; + case ExceptionCodeConstants.UserExceptionCode.BLACK_USER: + model.getShowModel().setMsgTip("user is black"); + break; + case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION: + model.getShowModel().setMsgTip("access service error"); + break; + default: + try { + //验证通过 ,可以登录,放入session,记录登录日志 + Basicuser user = userService.getUser(username); + logService.create(new Logdetails(user, "登录系统", model.getClientIp(), + new Timestamp(System.currentTimeMillis()), (short) 0, "管理用户:" + username + " 登录系统", username + " 登录系统")); + model.getShowModel().setMsgTip("user can login"); + getSession().put("user", user); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>查询用户名为:" + username + " ,用户信息异常", e); + } + break; + } /*if(ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT == userStatus) return "login";*/ - Log.infoFileSync("===============用户登录 login 方法调用结束==============="); - return SUCCESS; - } - - /** - * 用户退出登录 - * @return - */ - public String logout() - { - logService.create(new Logdetails(getUser(), "退出系统", model.getClientIp(), - new Timestamp(System.currentTimeMillis()), (short)0, - "管理用户:" + getUser().getLoginame() + " 退出系统",getUser().getLoginame() + " 退出系统")); - getSession().remove("user"); - return SUCCESS; - } - - /** - * 增加用户 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加用户方法==================="); - Boolean flag = false; - try - { - Basicuser user = new Basicuser(); - user.setDepartment(model.getDepartment()); - user.setDescription(model.getDescription()); - user.setEmail(model.getEmail()); + Log.infoFileSync("===============用户登录 login 方法调用结束==============="); + return SUCCESS; + } + + /** + * 用户退出登录 + * + * @return + */ + public String logout() { + logService.create(new Logdetails(getUser(), "退出系统", model.getClientIp(), + new Timestamp(System.currentTimeMillis()), (short) 0, + "管理用户:" + getUser().getLoginame() + " 退出系统", getUser().getLoginame() + " 退出系统")); + getSession().remove("user"); + return SUCCESS; + } + + /** + * 增加用户 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加用户方法==================="); + Boolean flag = false; + try { + Basicuser user = new Basicuser(); + user.setDepartment(model.getDepartment()); + user.setDescription(model.getDescription()); + user.setEmail(model.getEmail()); // user.setIsmanager(model.getIsmanager()); - user.setIsystem((short)1); - user.setIsmanager((short)1); - user.setLoginame(model.getLoginame()); - String password ="123456"; - //因密码用MD5加密,需要对密码进行转化 - try - { - password=Tools.md5Encryp(password); - } - catch (NoSuchAlgorithmException e) - { - e.printStackTrace(); - Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e); - } - user.setPassword(password); - - user.setPhonenum(model.getPhonenum()); - user.setPosition(model.getPosition()); - user.setUsername(model.getUsername()); - - userService.create(user); - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; + user.setIsystem((short) 1); + user.setIsmanager((short) 1); + user.setLoginame(model.getLoginame()); + String password = "123456"; + //因密码用MD5加密,需要对密码进行转化 + try { + password = Tools.md5Encryp(password); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + Log.errorFileSync(">>>>>>>>>>>>>>转化MD5字符串错误 :" + e.getMessage(), e); + } + user.setPassword(password); + + user.setPhonenum(model.getPhonenum()); + user.setPosition(model.getPosition()); + user.setUsername(model.getUsername()); + + userService.create(user); + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加用户异常", e); - flag = false; - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加用户异常", e); + flag = false; + tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>增加用户回写客户端结果异常", e); } - } - - logService.create(new Logdetails(getUser(), "增加用户", model.getClientIp(), + } + + logService.create(new Logdetails(getUser(), "增加用户", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "增加用户名称为 "+ model.getUsername() + " " + tipMsg + "!", "增加用户" + tipMsg)); - Log.infoFileSync("==================结束调用增加用户方法==================="); - } - - /** - * 删除用户 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除用户信息方法delete()================"); - try - { + , tipType, "增加用户名称为 " + model.getUsername() + " " + tipMsg + "!", "增加用户" + tipMsg)); + Log.infoFileSync("==================结束调用增加用户方法==================="); + } + + /** + * 删除用户 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除用户信息方法delete()================"); + try { userService.delete(model.getUserID()); tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getUserID() + " 的用户异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getUserID() + " 的用户异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除用户", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除用户ID为 "+ model.getUserID() + " " + tipMsg + "!", "删除用户" + tipMsg)); - Log.infoFileSync("====================结束调用删除用户信息方法delete()================"); - return SUCCESS; - } - - /** - * 更新用户 - * @return - */ - public void update() - { - Boolean flag = false; - try - { + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除用户", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除用户ID为 " + model.getUserID() + " " + tipMsg + "!", "删除用户" + tipMsg)); + Log.infoFileSync("====================结束调用删除用户信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新用户 + * + * @return + */ + public void update() { + Boolean flag = false; + try { Basicuser user = userService.get(model.getUserID()); user.setDepartment(model.getDepartment()); - user.setDescription(model.getDescription()); - user.setEmail(model.getEmail()); - //user.setIsmanager(model.getIsmanager()); - user.setLoginame(model.getLoginame()); - //user.setPassword(model.getPassword()); - user.setPhonenum(model.getPhonenum()); - user.setPosition(model.getPosition()); - user.setUsername(model.getUsername()); - userService.update(user); - - //看是否需要更新seesion中user - if(getUser().getId() == model.getUserID()) - { - getSession().put("user", user); - } - + user.setDescription(model.getDescription()); + user.setEmail(model.getEmail()); + //user.setIsmanager(model.getIsmanager()); + user.setLoginame(model.getLoginame()); + //user.setPassword(model.getPassword()); + user.setPhonenum(model.getPhonenum()); + user.setPosition(model.getPosition()); + user.setUsername(model.getUsername()); + userService.update(user); + + //看是否需要更新seesion中user + if (getUser().getId() == model.getUserID()) { + getSession().put("user", user); + } + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改用户回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新用户", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新用户ID为 "+ model.getUserID() + " " + tipMsg + "!", "更新用户" + tipMsg)); - } - - /** - * 修改密码 - */ - public void updatePwd() - { - Integer flag = 0; - try - { - Basicuser user = getUser(); - String orgPassword = Tools.md5Encryp(model.getOrgpwd()); - String md5Pwd = Tools.md5Encryp(model.getPassword()); - //必须和原始密码一致才可以更新密码 - if(orgPassword.equalsIgnoreCase(user.getPassword())) - { - + , tipType, "更新用户ID为 " + model.getUserID() + " " + tipMsg + "!", "更新用户" + tipMsg)); + } + + /** + * 修改密码 + */ + public void updatePwd() { + Integer flag = 0; + try { + Basicuser user = getUser(); + String orgPassword = Tools.md5Encryp(model.getOrgpwd()); + String md5Pwd = Tools.md5Encryp(model.getPassword()); + //必须和原始密码一致才可以更新密码 + if (orgPassword.equalsIgnoreCase(user.getPassword())) { + user.setPassword(md5Pwd); userService.update(user); - + //看是否需要更新seesion中user // if(getUser().getId() == model.getUserID()) // { // getSession().put("user", user); // } - + flag = 1; tipMsg = "成功"; tipType = 0; - } - else - { - flag = 2; - tipMsg = "失败"; - tipType = 1; - } - - } - catch (Exception e) - { + } else { + flag = 2; + tipMsg = "失败"; + tipType = 1; + } + + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "密码信息失败", e); flag = 3; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改用户密码回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新用户", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新用户ID为 "+ model.getUserID() + "密码信息 " + tipMsg + "!", "更新用户" + tipMsg)); - } + , tipType, "更新用户ID为 " + model.getUserID() + "密码信息 " + tipMsg + "!", "更新用户" + tipMsg)); + } - /** - * 重置用户的密码 - */ - public void resetPwd() { - Integer flag = 0; - try { - Basicuser user = userService.get(model.getUserID()); - String password = "123456"; - String md5Pwd = Tools.md5Encryp(password); - user.setPassword(md5Pwd); - userService.update(user); - flag = 1; - tipMsg = "成功"; - tipType = 0; - } - catch (Exception e) { - Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "密码信息失败", e); - flag = 0; - tipMsg = "失败"; - tipType = 1; - } - finally { - try { - toClient(flag.toString()); - } - catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>修改用户密码回写客户端结果异常", e); - } - } - logService.create(new Logdetails(getUser(), "重置用户密码", model.getClientIp(), - new Timestamp(System.currentTimeMillis()), tipType, "重置用户ID为 "+ model.getUserID() + "密码信息 " + tipMsg + "!", "重置用户密码" + tipMsg)); - } + /** + * 重置用户的密码 + */ + public void resetPwd() { + Integer flag = 0; + try { + Basicuser user = userService.get(model.getUserID()); + String password = "123456"; + String md5Pwd = Tools.md5Encryp(password); + user.setPassword(md5Pwd); + userService.update(user); + flag = 1; + tipMsg = "成功"; + tipType = 0; + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>修改用户ID为 : " + model.getUserID() + "密码信息失败", e); + flag = 0; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>修改用户密码回写客户端结果异常", e); + } + } + logService.create(new Logdetails(getUser(), "重置用户密码", model.getClientIp(), + new Timestamp(System.currentTimeMillis()), tipType, "重置用户ID为 " + model.getUserID() + "密码信息 " + tipMsg + "!", "重置用户密码" + tipMsg)); + } - /** - * 批量删除指定ID用户 - * @return - */ - public String batchDelete() - { - try - { + /** + * 批量删除指定ID用户 + * + * @return + */ + public String batchDelete() { + try { userService.batchDelete(model.getUserIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除用户ID为:" + model.getUserIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除用户ID为:" + model.getUserIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除用户", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除用户", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除用户ID为 "+ model.getUserIDs() + " " + tipMsg + "!", "批量删除用户" + tipMsg)); - return SUCCESS; - } - - /** - * 检查输入名称是否存在 - */ - public void checkIsNameExist() - { - Boolean flag = false; - String fieldName = ""; - String fieldValue = ""; - try - { - if(0 == model.getCheckFlag()) - { - fieldName = "username"; - fieldValue = model.getUsername(); - } - else - { - fieldName = "loginame"; - fieldValue = model.getLoginame(); - } - flag = userService.checkIsNameExist(fieldName,fieldValue, model.getUserID()); - } - catch (Exception e) - { + , tipType, "批量删除用户ID为 " + model.getUserIDs() + " " + tipMsg + "!", "批量删除用户" + tipMsg)); + return SUCCESS; + } + + /** + * 检查输入名称是否存在 + */ + public void checkIsNameExist() { + Boolean flag = false; + String fieldName = ""; + String fieldValue = ""; + try { + if (0 == model.getCheckFlag()) { + fieldName = "username"; + fieldValue = model.getUsername(); + } else { + fieldName = "loginame"; + fieldValue = model.getLoginame(); + } + flag = userService.checkIsNameExist(fieldName, fieldValue, model.getUserID()); + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!"); - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!", e); } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查用户名称为:" + fieldValue + " ID为: " + model.getUserID() + " 是否存在异常!",e); - } - } - } - - /** - * 查找用户信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + } + } + + /** + * 查找用户信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); userService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 // {"total":28,"rows":[ // {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} @@ -448,11 +384,9 @@ public class UserAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Basicuser user:dataList) - { - + if (null != dataList) { + for (Basicuser user : dataList) { + JSONObject item = new JSONObject(); item.put("id", user.getId()); item.put("username", user.getUsername()); @@ -462,11 +396,11 @@ public class UserAction extends BaseAction item.put("department", Tools.dealNullStr(user.getDepartment())); item.put("email", Tools.dealNullStr(user.getEmail())); item.put("phonenum", Tools.dealNullStr(user.getPhonenum())); - item.put("ismanager", user.getIsmanager()== (short)0?"是":"否"); - item.put("isystem",user.getIsystem() == (short)0?"是":"否"); + item.put("ismanager", user.getIsmanager() == (short) 0 ? "是" : "否"); + item.put("isystem", user.getIsystem() == (short) 0 ? "是" : "否"); item.put("status", user.getStatus()); item.put("description", Tools.dealNullStr(user.getDescription())); - item.put("remark",user.getRemark()); + item.put("remark", user.getRemark()); item.put("op", user.getIsystem()); dataArray.add(item); } @@ -474,41 +408,36 @@ public class UserAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>查找用户信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>查找用户信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询用户信息结果异常", e); } - } - - /** - * 拼接搜索条件 - * @return 拼接后的条件 - */ - private Map getCondition() - { + } + + /** + * 拼接搜索条件 + * + * @return 拼接后的条件 + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("username_s_like", model.getUsername()); condition.put("loginame_s_like", model.getLoginame()); condition.put("id_s_order", "asc"); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public UserModel getModel() - { - return model; - } - public void setUserService(UserIService userService) - { - this.userService = userService; - } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public UserModel getModel() { + return model; + } + + public void setUserService(UserIService userService) { + this.userService = userService; + } } diff --git a/src/main/java/com/jsh/action/basic/UserBusinessAction.java b/src/main/java/com/jsh/action/basic/UserBusinessAction.java index 90efa725..2acc7a69 100644 --- a/src/main/java/com/jsh/action/basic/UserBusinessAction.java +++ b/src/main/java/com/jsh/action/basic/UserBusinessAction.java @@ -1,183 +1,157 @@ package com.jsh.action.basic; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.UserBusiness; +import com.jsh.model.vo.basic.UserBusinessModel; +import com.jsh.service.basic.UserBusinessIService; +import com.jsh.util.PageUtil; +import org.springframework.dao.DataAccessException; + import java.io.IOException; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.Map; -import com.jsh.model.po.Functions; -import org.springframework.dao.DataAccessException; -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.model.po.UserBusiness; -import com.jsh.model.po.Logdetails; -import com.jsh.model.vo.basic.UserBusinessModel; -import com.jsh.service.basic.UserBusinessIService; -import com.jsh.util.PageUtil; /* * 权限关系管理 * @author jishenghua qq:752718920 -*/ + */ @SuppressWarnings("serial") -public class UserBusinessAction extends BaseAction -{ +public class UserBusinessAction extends BaseAction { private UserBusinessIService userBusinessService; private UserBusinessModel model = new UserBusinessModel(); - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public String getBasicData() - { - Map mapData = model.getShowModel().getMap(); - PageUtil pageUtil = new PageUtil(); + + @SuppressWarnings({"rawtypes", "unchecked"}) + public String getBasicData() { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - try - { - Map condition = pageUtil.getAdvSearch(); + try { + Map condition = pageUtil.getAdvSearch(); condition.put("KeyId_s_eq", model.getKeyId()); condition.put("Type_s_eq", model.getType()); userBusinessService.find(pageUtil); mapData.put("userBusinessList", pageUtil.getPageList()); - } - catch (Exception e) - { + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>查找UserBusiness信息异常", e); model.getShowModel().setMsgTip("exceptoin"); } return SUCCESS; } - - /* - * 测试hql语句的写法 - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - public String getceshi() - { - Map mapData = model.getShowModel().getMap(); - PageUtil pageUtil = new PageUtil(); + + /* + * 测试hql语句的写法 + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + public String getceshi() { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - try - { - Map condition = pageUtil.getAdvSearch(); + try { + Map condition = pageUtil.getAdvSearch(); condition.put("Type_s_eq", model.getType()); - userBusinessService.find(pageUtil,"ceshi"); + userBusinessService.find(pageUtil, "ceshi"); mapData.put("userBusinessList", pageUtil.getPageList()); - } - catch (Exception e) - { + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>查找UserBusiness信息异常", e); model.getShowModel().setMsgTip("exceptoin"); } return SUCCESS; } - - /** - * 增加UserBusiness - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加UserBusiness信息方法create()==================="); - Boolean flag = false; - try - { - UserBusiness userBusiness = new UserBusiness(); - userBusiness.setType(model.getType()); - userBusiness.setKeyId(model.getKeyId()); - userBusiness.setValue(model.getValue()); - userBusinessService.create(userBusiness); - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; + + /** + * 增加UserBusiness + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加UserBusiness信息方法create()==================="); + Boolean flag = false; + try { + UserBusiness userBusiness = new UserBusiness(); + userBusiness.setType(model.getType()); + userBusiness.setKeyId(model.getKeyId()); + userBusiness.setValue(model.getValue()); + userBusinessService.create(userBusiness); + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加UserBusiness信息异常", e); - flag = false; - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加UserBusiness信息异常", e); + flag = false; + tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>增加UserBusiness信息回写客户端结果异常", e); } - } - - logService.create(new Logdetails(getUser(), "增加UserBusiness", model.getClientIp(), + } + + logService.create(new Logdetails(getUser(), "增加UserBusiness", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "增加UserBusiness为 "+ model.getType() + " " + tipMsg + "!", "增加UserBusiness" + tipMsg)); - Log.infoFileSync("==================结束调用增加UserBusiness方法create()==================="); - } - - /** - * 更新UserBusiness - * @return - */ - public void update() - { - Boolean flag = false; - Long id=0l; - try - { - PageUtil pageUtil = new PageUtil(); + , tipType, "增加UserBusiness为 " + model.getType() + " " + tipMsg + "!", "增加UserBusiness" + tipMsg)); + Log.infoFileSync("==================结束调用增加UserBusiness方法create()==================="); + } + + /** + * 更新UserBusiness + * + * @return + */ + public void update() { + Boolean flag = false; + Long id = 0l; + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition_RoleAPP()); userBusinessService.find(pageUtil); List dataList = pageUtil.getPageList(); - if(null != dataList) - { - for(UserBusiness userBusiness:dataList) - { - id=userBusiness.getId(); - } - UserBusiness userBusiness = userBusinessService.get(id); - userBusiness.setType(model.getType()); - userBusiness.setKeyId(model.getKeyId()); - userBusiness.setValue(model.getValue()); - userBusinessService.update(userBusiness); - } - + if (null != dataList) { + for (UserBusiness userBusiness : dataList) { + id = userBusiness.getId(); + } + UserBusiness userBusiness = userBusinessService.get(id); + userBusiness.setType(model.getType()); + userBusiness.setKeyId(model.getKeyId()); + userBusiness.setValue(model.getValue()); + userBusinessService.update(userBusiness); + } + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改UserBusiness的ID为 : " + id + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改UserBusiness回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新UserBusiness", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新UserBusiness的ID为 "+ id + " " + tipMsg + "!", "更新UserBusiness" + tipMsg)); - } + , tipType, "更新UserBusiness的ID为 " + id + " " + tipMsg + "!", "更新UserBusiness" + tipMsg)); + } /** * 更新角色的按钮权限 + * * @return */ public void updateBtnStr() { @@ -192,76 +166,63 @@ public class UserBusinessAction extends BaseAction flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改角色按钮权限的ID为 : " + model.getUserBusinessID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally { + } finally { try { toClient(flag.toString()); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改功能回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新角色按钮权限", model.getClientIp(), - new Timestamp(System.currentTimeMillis()), tipType, - "角色按钮权限的ID为 "+ model.getUserBusinessID() + " " + tipMsg + "!", "更新角色按钮权限" + tipMsg)); + new Timestamp(System.currentTimeMillis()), tipType, + "角色按钮权限的ID为 " + model.getUserBusinessID() + " " + tipMsg + "!", "更新角色按钮权限" + tipMsg)); } - - /** - * 拼接搜索条件-RoleAPP - * @return - */ - private Map getCondition_RoleAPP() - { + + /** + * 拼接搜索条件-RoleAPP + * + * @return + */ + private Map getCondition_RoleAPP() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Type_s_eq", model.getType()); condition.put("KeyId_s_eq", model.getKeyId()); return condition; } - - /** - * 检查角色对应应用/功能是否存在 - */ - public void checkIsValueExist() - { - Boolean flag = false; - try - { - flag = userBusinessService.checkIsValueExist("Type",model.getType(),"KeyId", model.getKeyId()); - } - catch (DataAccessException e) - { + + /** + * 检查角色对应应用/功能是否存在 + */ + public void checkIsValueExist() { + Boolean flag = false; + try { + flag = userBusinessService.checkIsValueExist("Type", model.getType(), "KeyId", model.getKeyId()); + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>检查角色对应应用/功能的类型为:" + model.getType() + " KeyId为: " + model.getKeyId() + " 是否存在异常!"); - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查角色对应应用/功能的类型为:" + model.getType() + " KeyId为: " + model.getKeyId() + " 是否存在异常!", e); } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查角色对应应用/功能的类型为:" + model.getType() + " KeyId为: " + model.getKeyId() + " 是否存在异常!",e); - } - } - } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public UserBusinessModel getModel() - { - return model; - } - public void setUserBusinessService(UserBusinessIService userBusinessService) - { + } + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public UserBusinessModel getModel() { + return model; + } + + public void setUserBusinessService(UserBusinessIService userBusinessService) { this.userBusinessService = userBusinessService; } } diff --git a/src/main/java/com/jsh/action/materials/AccountHeadAction.java b/src/main/java/com/jsh/action/materials/AccountHeadAction.java index 333da532..5a3096bb 100644 --- a/src/main/java/com/jsh/action/materials/AccountHeadAction.java +++ b/src/main/java/com/jsh/action/materials/AccountHeadAction.java @@ -1,58 +1,46 @@ package com.jsh.action.materials; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.*; +import com.jsh.model.vo.materials.AccountHeadModel; +import com.jsh.service.materials.AccountHeadIService; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; +import com.jsh.util.Tools; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + import java.io.IOException; import java.sql.Timestamp; import java.text.ParseException; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; - -import org.springframework.dao.DataAccessException; - -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.model.po.Account; -import com.jsh.model.po.AccountHead; -import com.jsh.model.po.Logdetails; -import com.jsh.model.po.Person; -import com.jsh.model.po.Supplier; -import com.jsh.model.vo.materials.AccountHeadModel; -import com.jsh.service.materials.AccountHeadIService; -import com.jsh.service.materials.DepotHeadIService; -import com.jsh.util.JshException; -import com.jsh.util.PageUtil; -import com.jsh.util.Tools; /* * 财务表头管理 * @author jishenghua qq:752718920 */ @SuppressWarnings("serial") -public class AccountHeadAction extends BaseAction -{ +public class AccountHeadAction extends BaseAction { private AccountHeadIService accountHeadService; private AccountHeadModel model = new AccountHeadModel(); /* * 获取MaxId */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - public String getMaxId() - { - Map mapData = model.getShowModel().getMap(); - PageUtil pageUtil = new PageUtil(); + @SuppressWarnings({"rawtypes", "unchecked"}) + public String getMaxId() { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - try - { - accountHeadService.find(pageUtil,"maxId"); + try { + accountHeadService.find(pageUtil, "maxId"); mapData.put("accountHeadMax", pageUtil.getPageList()); - } - catch (Exception e) - { + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>查找最大的Id信息异常", e); model.getShowModel().setMsgTip("exceptoin"); } @@ -61,30 +49,32 @@ public class AccountHeadAction extends BaseAction /** * 增加财务 + * * @return */ - public void create() - { + public void create() { Log.infoFileSync("==================开始调用增加财务信息方法create()==================="); Boolean flag = false; - try - { + try { AccountHead accountHead = new AccountHead(); accountHead.setType(model.getType()); - if(model.getOrganId()!=null){accountHead.setOrganId(new Supplier(model.getOrganId()));} - if(model.getHandsPersonId()!=null){accountHead.setHandsPersonId(new Person(model.getHandsPersonId()));} - accountHead.setChangeAmount(model.getChangeAmount()==null ? 0:model.getChangeAmount()); - accountHead.setTotalPrice(model.getTotalPrice()); - if(model.getAccountId()!=null){accountHead.setAccountId(new Account(model.getAccountId()));} - accountHead.setBillNo(model.getBillNo()); - try - { - accountHead.setBillTime(new Timestamp(Tools.parse(model.getBillTime(), "yyyy-MM-dd HH:mm:ss").getTime())); + if (model.getOrganId() != null) { + accountHead.setOrganId(new Supplier(model.getOrganId())); } - catch (ParseException e) - { + if (model.getHandsPersonId() != null) { + accountHead.setHandsPersonId(new Person(model.getHandsPersonId())); + } + accountHead.setChangeAmount(model.getChangeAmount() == null ? 0 : model.getChangeAmount()); + accountHead.setTotalPrice(model.getTotalPrice()); + if (model.getAccountId() != null) { + accountHead.setAccountId(new Account(model.getAccountId())); + } + accountHead.setBillNo(model.getBillNo()); + try { + accountHead.setBillTime(new Timestamp(Tools.parse(model.getBillTime(), "yyyy-MM-dd HH:mm:ss").getTime())); + } catch (ParseException e) { Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e); - } + } accountHead.setRemark(model.getRemark()); accountHeadService.create(accountHead); @@ -93,150 +83,131 @@ public class AccountHeadAction extends BaseAction //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加财务信息异常", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>增加财务信息回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "增加财务", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加财务编号为 "+ model.getBillNo() + " " + tipMsg + "!", "增加财务" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "增加财务编号为 " + model.getBillNo() + " " + tipMsg + "!", "增加财务" + tipMsg)); Log.infoFileSync("==================结束调用增加财务方法create()==================="); } /** * 删除财务 + * * @return */ - public String delete() - { + public String delete() { Log.infoFileSync("====================开始调用删除财务信息方法delete()================"); - try - { + try { accountHeadService.delete(model.getAccountHeadID()); tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAccountHeadID() + " 的财务异常", e); tipMsg = "失败"; tipType = 1; } model.getShowModel().setMsgTip(tipMsg); logService.create(new Logdetails(getUser(), "删除财务", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除财务ID为 "+ model.getAccountHeadID() + " " + tipMsg + "!", "删除财务" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "删除财务ID为 " + model.getAccountHeadID() + " " + tipMsg + "!", "删除财务" + tipMsg)); Log.infoFileSync("====================结束调用删除财务信息方法delete()================"); return SUCCESS; } /** * 更新财务 + * * @return */ - public void update() - { + public void update() { Boolean flag = false; - try - { + try { AccountHead accountHead = accountHeadService.get(model.getAccountHeadID()); accountHead.setType(model.getType()); - if(model.getOrganId()!=null){accountHead.setOrganId(new Supplier(model.getOrganId()));} - if(model.getHandsPersonId()!=null){accountHead.setHandsPersonId(new Person(model.getHandsPersonId()));} - accountHead.setChangeAmount(model.getChangeAmount()==null ? 0:model.getChangeAmount()); - accountHead.setTotalPrice(model.getTotalPrice()); - if(model.getAccountId()!=null){accountHead.setAccountId(new Account(model.getAccountId()));} - accountHead.setBillNo(model.getBillNo()); - try - { - accountHead.setBillTime(new Timestamp(Tools.parse(model.getBillTime(), "yyyy-MM-dd HH:mm:ss").getTime())); + if (model.getOrganId() != null) { + accountHead.setOrganId(new Supplier(model.getOrganId())); } - catch (ParseException e) - { + if (model.getHandsPersonId() != null) { + accountHead.setHandsPersonId(new Person(model.getHandsPersonId())); + } + accountHead.setChangeAmount(model.getChangeAmount() == null ? 0 : model.getChangeAmount()); + accountHead.setTotalPrice(model.getTotalPrice()); + if (model.getAccountId() != null) { + accountHead.setAccountId(new Account(model.getAccountId())); + } + accountHead.setBillNo(model.getBillNo()); + try { + accountHead.setBillTime(new Timestamp(Tools.parse(model.getBillTime(), "yyyy-MM-dd HH:mm:ss").getTime())); + } catch (ParseException e) { Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e); - } + } accountHead.setRemark(model.getRemark()); accountHeadService.update(accountHead); flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改财务ID为 : " + model.getAccountHeadID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改财务回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新财务", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "更新财务ID为 "+ model.getAccountHeadID() + " " + tipMsg + "!", "更新财务" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "更新财务ID为 " + model.getAccountHeadID() + " " + tipMsg + "!", "更新财务" + tipMsg)); } /** * 批量删除指定ID财务 + * * @return */ - public String batchDelete() - { - try - { + public String batchDelete() { + try { accountHeadService.batchDelete(model.getAccountHeadIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>批量删除财务ID为:" + model.getAccountHeadIDs() + "信息异常", e); tipMsg = "失败"; tipType = 1; } logService.create(new Logdetails(getUser(), "批量删除财务", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除财务ID为 "+ model.getAccountHeadIDs() + " " + tipMsg + "!", "批量删除财务" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "批量删除财务ID为 " + model.getAccountHeadIDs() + " " + tipMsg + "!", "批量删除财务" + tipMsg)); return SUCCESS; } /** * 查找财务信息 + * * @return */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); @@ -247,22 +218,20 @@ public class AccountHeadAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(AccountHead accountHead:dataList) - { + if (null != dataList) { + for (AccountHead accountHead : dataList) { JSONObject item = new JSONObject(); item.put("Id", accountHead.getId()); - item.put("OrganId", accountHead.getOrganId()==null?"":accountHead.getOrganId().getId()); - item.put("OrganName", accountHead.getOrganId()==null?"":accountHead.getOrganId().getSupplier()); - item.put("HandsPersonId", accountHead.getHandsPersonId()==null?"":accountHead.getHandsPersonId().getId()); - item.put("HandsPersonName", accountHead.getHandsPersonId()==null?"":accountHead.getHandsPersonId().getName()); - item.put("AccountId", accountHead.getAccountId()==null?"":accountHead.getAccountId().getId()); - item.put("AccountName", accountHead.getAccountId()==null?"":accountHead.getAccountId().getName()); + item.put("OrganId", accountHead.getOrganId() == null ? "" : accountHead.getOrganId().getId()); + item.put("OrganName", accountHead.getOrganId() == null ? "" : accountHead.getOrganId().getSupplier()); + item.put("HandsPersonId", accountHead.getHandsPersonId() == null ? "" : accountHead.getHandsPersonId().getId()); + item.put("HandsPersonName", accountHead.getHandsPersonId() == null ? "" : accountHead.getHandsPersonId().getName()); + item.put("AccountId", accountHead.getAccountId() == null ? "" : accountHead.getAccountId().getId()); + item.put("AccountName", accountHead.getAccountId() == null ? "" : accountHead.getAccountId().getName()); item.put("BillNo", accountHead.getBillNo()); item.put("BillTime", Tools.getCenternTime(accountHead.getBillTime())); - item.put("ChangeAmount", accountHead.getChangeAmount()==null?"":Math.abs(accountHead.getChangeAmount())); - item.put("TotalPrice", accountHead.getTotalPrice()==null?"":Math.abs(accountHead.getTotalPrice())); + item.put("ChangeAmount", accountHead.getChangeAmount() == null ? "" : Math.abs(accountHead.getChangeAmount())); + item.put("TotalPrice", accountHead.getTotalPrice() == null ? "" : Math.abs(accountHead.getTotalPrice())); item.put("Remark", accountHead.getRemark()); item.put("op", 1); dataArray.add(item); @@ -271,13 +240,9 @@ public class AccountHeadAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找财务信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询财务信息结果异常", e); } } @@ -285,150 +250,144 @@ public class AccountHeadAction extends BaseAction /** * 根据编号查询单据信息 */ - public void getDetailByNumber(){ + public void getDetailByNumber() { try { - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getConditionByNumber()); accountHeadService.find(pageUtil); List dataList = pageUtil.getPageList(); JSONObject item = new JSONObject(); - if(dataList!=null && dataList.get(0)!=null) { + if (dataList != null && dataList.get(0) != null) { AccountHead accountHead = dataList.get(0); item.put("Id", accountHead.getId()); - item.put("OrganId", accountHead.getOrganId()==null?"":accountHead.getOrganId().getId()); - item.put("OrganName", accountHead.getOrganId()==null?"":accountHead.getOrganId().getSupplier()); - item.put("HandsPersonId", accountHead.getHandsPersonId()==null?"":accountHead.getHandsPersonId().getId()); - item.put("HandsPersonName", accountHead.getHandsPersonId()==null?"":accountHead.getHandsPersonId().getName()); - item.put("AccountId", accountHead.getAccountId()==null?"":accountHead.getAccountId().getId()); - item.put("AccountName", accountHead.getAccountId()==null?"":accountHead.getAccountId().getName()); + item.put("OrganId", accountHead.getOrganId() == null ? "" : accountHead.getOrganId().getId()); + item.put("OrganName", accountHead.getOrganId() == null ? "" : accountHead.getOrganId().getSupplier()); + item.put("HandsPersonId", accountHead.getHandsPersonId() == null ? "" : accountHead.getHandsPersonId().getId()); + item.put("HandsPersonName", accountHead.getHandsPersonId() == null ? "" : accountHead.getHandsPersonId().getName()); + item.put("AccountId", accountHead.getAccountId() == null ? "" : accountHead.getAccountId().getId()); + item.put("AccountName", accountHead.getAccountId() == null ? "" : accountHead.getAccountId().getName()); item.put("BillNo", accountHead.getBillNo()); item.put("BillTime", Tools.getCenternTime(accountHead.getBillTime())); - item.put("ChangeAmount", accountHead.getChangeAmount()==null?"":Math.abs(accountHead.getChangeAmount())); - item.put("TotalPrice", accountHead.getTotalPrice()==null?"":Math.abs(accountHead.getTotalPrice())); + item.put("ChangeAmount", accountHead.getChangeAmount() == null ? "" : Math.abs(accountHead.getChangeAmount())); + item.put("TotalPrice", accountHead.getTotalPrice() == null ? "" : Math.abs(accountHead.getTotalPrice())); item.put("Remark", accountHead.getRemark()); } //回写查询结果 toClient(item.toString()); - } - catch (DataAccessException e) { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单据信息异常", e); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e); } } - + /** * 查询单位的累计应收和累计应付,收预付款不计入此处 + * * @return */ public void findTotalPay() { - try - { - JSONObject outer = new JSONObject(); - Double sum = 0.0; - String getS = model.getSupplierId(); + try { + JSONObject outer = new JSONObject(); + Double sum = 0.0; + String getS = model.getSupplierId(); String supType = model.getSupType(); //单位类型:客户、供应商 int i = 1; - if(supType.equals("customer")){ //客户 + if (supType.equals("customer")) { //客户 i = 1; - } - else if(supType.equals("vendor")){ //供应商 + } else if (supType.equals("vendor")) { //供应商 i = -1; } //收付款部分 - sum = sum + (allMoney(getS, "付款", "合计") + allMoney(getS, "付款", "实际"))*i; - sum = sum - (allMoney(getS, "收款", "合计") + allMoney(getS, "收款", "实际"))*i; - sum = sum + (allMoney(getS, "收入", "合计") - allMoney(getS, "收入", "实际"))*i; - sum = sum - (allMoney(getS, "支出", "合计") - allMoney(getS, "支出", "实际"))*i; - outer.put("getAllMoney", sum); + sum = sum + (allMoney(getS, "付款", "合计") + allMoney(getS, "付款", "实际")) * i; + sum = sum - (allMoney(getS, "收款", "合计") + allMoney(getS, "收款", "实际")) * i; + sum = sum + (allMoney(getS, "收入", "合计") - allMoney(getS, "收入", "实际")) * i; + sum = sum - (allMoney(getS, "支出", "合计") - allMoney(getS, "支出", "实际")) * i; + outer.put("getAllMoney", sum); toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询结果异常", e); } - } - + } + /** * 统计总金额 + * * @param type * @param mode 合计或者金额 * @return */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public Double allMoney(String getS, String type, String mode) { - Log.infoFileSync("getS:" + getS); - Double allMoney = 0.0; - String allReturn = ""; + @SuppressWarnings({"unchecked", "rawtypes"}) + public Double allMoney(String getS, String type, String mode) { + Log.infoFileSync("getS:" + getS); + Double allMoney = 0.0; + String allReturn = ""; PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getConditionHead_byEndTime()); - try { - Integer supplierId = Integer.valueOf(getS); - accountHeadService.findAllMoney(pageUtil, supplierId, type, mode); - allReturn = pageUtil.getPageList().toString(); - allReturn = allReturn.substring(1,allReturn.length()-1); - if(allReturn.equals("null")){ - allReturn = "0"; - } - } catch (JshException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + Integer supplierId = Integer.valueOf(getS); + accountHeadService.findAllMoney(pageUtil, supplierId, type, mode); + allReturn = pageUtil.getPageList().toString(); + allReturn = allReturn.substring(1, allReturn.length() - 1); + if (allReturn.equals("null")) { + allReturn = "0"; + } + } catch (JshException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } allMoney = Double.parseDouble(allReturn); //返回正数,如果负数也转为正数 - if(allMoney<0){ - allMoney = -allMoney; + if (allMoney < 0) { + allMoney = -allMoney; } - return allMoney; + return allMoney; } - private Map getConditionByNumber() { - Map condition = new HashMap(); - condition.put("BillNo_s_eq",model.getBillNo()); + private Map getConditionByNumber() { + Map condition = new HashMap(); + condition.put("BillNo_s_eq", model.getBillNo()); return condition; } /** * 拼接搜索条件 + * * @return */ - private Map getCondition() - { + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); - {condition.put("BillNo_s_like", model.getBillNo());} - condition.put("Type_s_eq",model.getType()); - condition.put("BillTime_s_gteq",model.getBeginTime()); - condition.put("BillTime_s_lteq",model.getEndTime()); - condition.put("Id_s_order","desc"); + Map condition = new HashMap(); + { + condition.put("BillNo_s_like", model.getBillNo()); + } + condition.put("Type_s_eq", model.getType()); + condition.put("BillTime_s_gteq", model.getBeginTime()); + condition.put("BillTime_s_lteq", model.getEndTime()); + condition.put("Id_s_order", "desc"); return condition; } - private Map getConditionHead_byEndTime() - { - Map condition = new HashMap(); + private Map getConditionHead_byEndTime() { + Map condition = new HashMap(); condition.put("BillTime_s_lteq", model.getEndTime()); return condition; } //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - public AccountHeadModel getModel() - { + public AccountHeadModel getModel() { return model; } - public void setAccountHeadService(AccountHeadIService accountHeadService) - { + + public void setAccountHeadService(AccountHeadIService accountHeadService) { this.accountHeadService = accountHeadService; } } diff --git a/src/main/java/com/jsh/action/materials/AccountItemAction.java b/src/main/java/com/jsh/action/materials/AccountItemAction.java index 74317bf2..549cc572 100644 --- a/src/main/java/com/jsh/action/materials/AccountItemAction.java +++ b/src/main/java/com/jsh/action/materials/AccountItemAction.java @@ -1,103 +1,99 @@ package com.jsh.action.materials; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.*; +import com.jsh.model.vo.materials.AccountItemModel; +import com.jsh.service.materials.AccountItemIService; +import com.jsh.util.PageUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + import java.io.IOException; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.model.po.AccountHead; -import com.jsh.model.po.AccountItem; -import com.jsh.model.po.Logdetails; -import com.jsh.model.po.Account; -import com.jsh.model.po.InOutItem; -import com.jsh.model.vo.materials.AccountItemModel; -import com.jsh.service.materials.AccountItemIService; -import com.jsh.util.PageUtil; + /* * 财务明细管理(收支|收付款|转账) * @author jishenghua qq:752718920 */ @SuppressWarnings("serial") -public class AccountItemAction extends BaseAction -{ +public class AccountItemAction extends BaseAction { private AccountItemIService accountItemService; private AccountItemModel model = new AccountItemModel(); /** * 保存明细 + * * @return */ - public void saveDetials() - { + public void saveDetials() { Log.infoFileSync("==================开始调用保存财务明细信息方法saveDetials()==================="); Boolean flag = false; - try - { - Long headerId=model.getHeaderId(); + try { + Long headerId = model.getHeaderId(); String listType = model.getListType(); //单据类型 - String inserted=model.getInserted(); - String deleted=model.getDeleted(); - String updated=model.getUpdated(); + String inserted = model.getInserted(); + String deleted = model.getDeleted(); + String updated = model.getUpdated(); //转为json JSONArray insertedJson = JSONArray.fromObject(inserted); JSONArray deletedJson = JSONArray.fromObject(deleted); JSONArray updatedJson = JSONArray.fromObject(updated); - if(null != insertedJson) - { - for(int i = 0;i < insertedJson.size(); i++) - { + if (null != insertedJson) { + for (int i = 0; i < insertedJson.size(); i++) { AccountItem accountItem = new AccountItem(); JSONObject tempInsertedJson = JSONObject.fromObject(insertedJson.get(i)); accountItem.setHeaderId(new AccountHead(headerId)); - if(tempInsertedJson.get("AccountId")!=null&&!tempInsertedJson.get("AccountId").equals("")){accountItem.setAccountId(new Account(tempInsertedJson.getLong("AccountId")));} - if(tempInsertedJson.get("InOutItemId")!=null&&!tempInsertedJson.get("InOutItemId").equals("")){accountItem.setInOutItemId(new InOutItem(tempInsertedJson.getLong("InOutItemId")));} - if(tempInsertedJson.get("EachAmount")!=null&&!tempInsertedJson.get("EachAmount").equals("")){ + if (tempInsertedJson.get("AccountId") != null && !tempInsertedJson.get("AccountId").equals("")) { + accountItem.setAccountId(new Account(tempInsertedJson.getLong("AccountId"))); + } + if (tempInsertedJson.get("InOutItemId") != null && !tempInsertedJson.get("InOutItemId").equals("")) { + accountItem.setInOutItemId(new InOutItem(tempInsertedJson.getLong("InOutItemId"))); + } + if (tempInsertedJson.get("EachAmount") != null && !tempInsertedJson.get("EachAmount").equals("")) { Double eachAmount = tempInsertedJson.getDouble("EachAmount"); - if(listType.equals("付款")) { + if (listType.equals("付款")) { eachAmount = 0 - eachAmount; } accountItem.setEachAmount(eachAmount); - } - else { + } else { accountItem.setEachAmount(0.0); } - accountItem.setRemark(tempInsertedJson.getString("Remark")); + accountItem.setRemark(tempInsertedJson.getString("Remark")); accountItemService.create(accountItem); } } - if(null != deletedJson) - { - for(int i = 0;i < deletedJson.size(); i++) - { + if (null != deletedJson) { + for (int i = 0; i < deletedJson.size(); i++) { JSONObject tempDeletedJson = JSONObject.fromObject(deletedJson.get(i)); accountItemService.delete(tempDeletedJson.getLong("Id")); } } - if(null != updatedJson) - { - for(int i = 0;i < updatedJson.size(); i++) - { - JSONObject tempUpdatedJson = JSONObject.fromObject(updatedJson.get(i)); - AccountItem accountItem = accountItemService.get(tempUpdatedJson.getLong("Id")); - accountItem.setHeaderId(new AccountHead(headerId)); - if(tempUpdatedJson.get("AccountId")!=null&&!tempUpdatedJson.get("AccountId").equals("")){accountItem.setAccountId(new Account(tempUpdatedJson.getLong("AccountId")));} - if(tempUpdatedJson.get("InOutItemId")!=null&&!tempUpdatedJson.get("InOutItemId").equals("")){accountItem.setInOutItemId(new InOutItem(tempUpdatedJson.getLong("InOutItemId")));} - if(tempUpdatedJson.get("EachAmount")!=null&&!tempUpdatedJson.get("EachAmount").equals("")){ + if (null != updatedJson) { + for (int i = 0; i < updatedJson.size(); i++) { + JSONObject tempUpdatedJson = JSONObject.fromObject(updatedJson.get(i)); + AccountItem accountItem = accountItemService.get(tempUpdatedJson.getLong("Id")); + accountItem.setHeaderId(new AccountHead(headerId)); + if (tempUpdatedJson.get("AccountId") != null && !tempUpdatedJson.get("AccountId").equals("")) { + accountItem.setAccountId(new Account(tempUpdatedJson.getLong("AccountId"))); + } + if (tempUpdatedJson.get("InOutItemId") != null && !tempUpdatedJson.get("InOutItemId").equals("")) { + accountItem.setInOutItemId(new InOutItem(tempUpdatedJson.getLong("InOutItemId"))); + } + if (tempUpdatedJson.get("EachAmount") != null && !tempUpdatedJson.get("EachAmount").equals("")) { Double eachAmount = tempUpdatedJson.getDouble("EachAmount"); - if(listType.equals("付款")) { + if (listType.equals("付款")) { eachAmount = 0 - eachAmount; } accountItem.setEachAmount(eachAmount); - } - else { + } else { accountItem.setEachAmount(0.0); } - accountItem.setRemark(tempUpdatedJson.getString("Remark")); + accountItem.setRemark(tempUpdatedJson.getString("Remark")); accountItemService.create(accountItem); } } @@ -107,42 +103,34 @@ public class AccountItemAction extends BaseAction //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>保存财务明细信息异常", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>保存财务明细信息回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "保存财务明细", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "保存财务明细对应主表编号为 "+ model.getHeaderId() + " " + tipMsg + "!", "保存财务明细" + tipMsg)); + new Timestamp(System.currentTimeMillis()) + , tipType, "保存财务明细对应主表编号为 " + model.getHeaderId() + " " + tipMsg + "!", "保存财务明细" + tipMsg)); Log.infoFileSync("==================结束调用保存财务明细方法saveDetials()==================="); } - /** + /** * 查找财务信息 + * * @return */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); @@ -153,18 +141,16 @@ public class AccountItemAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(AccountItem accountItem:dataList) - { + if (null != dataList) { + for (AccountItem accountItem : dataList) { JSONObject item = new JSONObject(); item.put("Id", accountItem.getId()); - item.put("AccountId", accountItem.getAccountId()==null?"":accountItem.getAccountId().getId()); - item.put("AccountName", accountItem.getAccountId()==null?"":accountItem.getAccountId().getName()); - item.put("InOutItemId", accountItem.getInOutItemId()==null?"":accountItem.getInOutItemId().getId()); - item.put("InOutItemName", accountItem.getInOutItemId()==null?"":accountItem.getInOutItemId().getName()); + item.put("AccountId", accountItem.getAccountId() == null ? "" : accountItem.getAccountId().getId()); + item.put("AccountName", accountItem.getAccountId() == null ? "" : accountItem.getAccountId().getName()); + item.put("InOutItemId", accountItem.getInOutItemId() == null ? "" : accountItem.getInOutItemId().getId()); + item.put("InOutItemName", accountItem.getInOutItemId() == null ? "" : accountItem.getInOutItemId().getName()); Double eachAmount = accountItem.getEachAmount(); - item.put("EachAmount", eachAmount < 0 ? 0-eachAmount : eachAmount); + item.put("EachAmount", eachAmount < 0 ? 0 - eachAmount : eachAmount); item.put("Remark", accountItem.getRemark()); item.put("op", 1); dataArray.add(item); @@ -173,40 +159,35 @@ public class AccountItemAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找财务信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询财务信息结果异常", e); } } /** * 拼接搜索条件 + * * @return */ - private Map getCondition() - { + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("HeaderId_n_eq", model.getHeaderId()); - condition.put("Id_s_order","asc"); + condition.put("Id_s_order", "asc"); return condition; } //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== @Override - public AccountItemModel getModel() - { + public AccountItemModel getModel() { return model; } - public void setAccountItemService(AccountItemIService accountItemService) - { + + public void setAccountItemService(AccountItemIService accountItemService) { this.accountItemService = accountItemService; } } diff --git a/src/main/java/com/jsh/action/materials/DepotHeadAction.java b/src/main/java/com/jsh/action/materials/DepotHeadAction.java index d9cfcf63..3c2b4029 100644 --- a/src/main/java/com/jsh/action/materials/DepotHeadAction.java +++ b/src/main/java/com/jsh/action/materials/DepotHeadAction.java @@ -1,421 +1,404 @@ package com.jsh.action.materials; -import java.io.IOException; -import java.sql.Timestamp; -import java.text.ParseException; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; - -import org.apache.commons.lang.StringUtils; -import org.springframework.dao.DataAccessException; - import com.jsh.base.BaseAction; import com.jsh.base.Log; -import com.jsh.model.po.Account; -import com.jsh.model.po.Depot; -import com.jsh.model.po.DepotHead; -import com.jsh.model.po.Logdetails; -import com.jsh.model.po.Person; -import com.jsh.model.po.Supplier; +import com.jsh.model.po.*; import com.jsh.model.vo.materials.DepotHeadModel; import com.jsh.service.materials.DepotHeadIService; import com.jsh.util.JshException; import com.jsh.util.PageUtil; import com.jsh.util.Tools; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + +import java.io.IOException; +import java.sql.Timestamp; +import java.text.ParseException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /* * 单据表头管理 * @author jishenghua qq:752718920 -*/ + */ @SuppressWarnings("serial") -public class DepotHeadAction extends BaseAction -{ +public class DepotHeadAction extends BaseAction { private DepotHeadIService depotHeadService; private DepotHeadModel model = new DepotHeadModel(); - - /* - * 获取MaxId - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - public String getMaxId() - { - Map mapData = model.getShowModel().getMap(); - PageUtil pageUtil = new PageUtil(); + + /* + * 获取MaxId + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + public String getMaxId() { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - try - { - depotHeadService.find(pageUtil,"maxId"); + try { + depotHeadService.find(pageUtil, "maxId"); mapData.put("depotHeadMax", pageUtil.getPageList()); - } - catch (Exception e) - { + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>查找最大的Id信息异常", e); model.getShowModel().setMsgTip("exceptoin"); } return SUCCESS; - } - - /** - * 增加单据 - * @return - */ - public void create(){ - Log.infoFileSync("==================开始调用增加单据信息信息方法create()==================="); - Boolean flag = false; - try - { - DepotHead depotHead = new DepotHead(); - depotHead.setType(model.getType()); - depotHead.setSubType(model.getSubType()); - if(model.getProjectId()!=null){depotHead.setProjectId(new Depot(model.getProjectId()));} - //构造新的编号 - String dNumber = model.getDefaultNumber(); - String number = dNumber.substring(0,12); //截取前缀 - String beginTime = Tools.getNow() + " 00:00:00"; - String endTime = Tools.getNow() + " 23:59:59"; - String newNumber = buildNumberFun(model.getType(), model.getSubType(), beginTime, endTime); //从数据库查询最新的编号+1,这样能防止重复 - String allNewNumber = number + newNumber; - depotHead.setNumber(model.getNumber()); //一直从前端文本框里面获取 - depotHead.setDefaultNumber(allNewNumber); //初始编号,一直都从后台取值 + } - depotHead.setOperPersonName(getUser().getUsername()); - depotHead.setCreateTime(new Timestamp(System.currentTimeMillis())); - try{ - depotHead.setOperTime(new Timestamp(Tools.parse(model.getOperTime(), "yyyy-MM-dd HH:mm:ss").getTime())); + /** + * 增加单据 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加单据信息信息方法create()==================="); + Boolean flag = false; + try { + DepotHead depotHead = new DepotHead(); + depotHead.setType(model.getType()); + depotHead.setSubType(model.getSubType()); + if (model.getProjectId() != null) { + depotHead.setProjectId(new Depot(model.getProjectId())); } - catch (ParseException e){ + //构造新的编号 + String dNumber = model.getDefaultNumber(); + String number = dNumber.substring(0, 12); //截取前缀 + String beginTime = Tools.getNow() + " 00:00:00"; + String endTime = Tools.getNow() + " 23:59:59"; + String newNumber = buildNumberFun(model.getType(), model.getSubType(), beginTime, endTime); //从数据库查询最新的编号+1,这样能防止重复 + String allNewNumber = number + newNumber; + depotHead.setNumber(model.getNumber()); //一直从前端文本框里面获取 + depotHead.setDefaultNumber(allNewNumber); //初始编号,一直都从后台取值 + + depotHead.setOperPersonName(getUser().getUsername()); + depotHead.setCreateTime(new Timestamp(System.currentTimeMillis())); + try { + depotHead.setOperTime(new Timestamp(Tools.parse(model.getOperTime(), "yyyy-MM-dd HH:mm:ss").getTime())); + } catch (ParseException e) { Log.errorFileSync(">>>>>>>>>>>>>>>解析购买日期格式异常", e); } - if(model.getOrganId()!=null){depotHead.setOrganId(new Supplier(model.getOrganId()));} - if(model.getHandsPersonId()!=null){depotHead.setHandsPersonId(new Person(model.getHandsPersonId()));} - if(model.getSalesman()!=null){ - depotHead.setSalesman(model.getSalesman().toString()); - } - if(model.getAccountId()!=null){depotHead.setAccountId(new Account(model.getAccountId()));} - depotHead.setChangeAmount(model.getChangeAmount()); - depotHead.setAccountIdList(model.getAccountIdList()); - depotHead.setAccountMoneyList(model.getAccountMoneyList()); - depotHead.setDiscount(model.getDiscount()); - depotHead.setDiscountMoney(model.getDiscountMoney()); - depotHead.setDiscountLastMoney(model.getDiscountLastMoney()); - depotHead.setOtherMoney(model.getOtherMoney()); - depotHead.setOtherMoneyList(model.getOtherMoneyList()); - depotHead.setOtherMoneyItem(model.getOtherMoneyItem()); - depotHead.setAccountDay(model.getAccountDay()); - if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));} - depotHead.setTotalPrice(model.getTotalPrice()); - depotHead.setPayType(model.getPayType()); - depotHead.setStatus(false); - depotHead.setRemark(model.getRemark()); - depotHeadService.create(depotHead); - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加单据信息异常", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally { - try { - toClient(flag.toString()); - } - catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>增加单据信息回写客户端结果异常", e); + if (model.getOrganId() != null) { + depotHead.setOrganId(new Supplier(model.getOrganId())); } - } - - logService.create(new Logdetails(getUser(), "增加单据", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加单据编号为 "+ model.getNumber() + " " + tipMsg + "!", "增加单据" + tipMsg)); - Log.infoFileSync("==================结束调用增加单据方法create()==================="); - } - - /** - * 删除单据 - * @return - */ - public String delete() { - Log.infoFileSync("====================开始调用删除单据信息方法delete()================"); - try { - depotHeadService.delete(model.getDepotHeadID()); + if (model.getHandsPersonId() != null) { + depotHead.setHandsPersonId(new Person(model.getHandsPersonId())); + } + if (model.getSalesman() != null) { + depotHead.setSalesman(model.getSalesman().toString()); + } + if (model.getAccountId() != null) { + depotHead.setAccountId(new Account(model.getAccountId())); + } + depotHead.setChangeAmount(model.getChangeAmount()); + depotHead.setAccountIdList(model.getAccountIdList()); + depotHead.setAccountMoneyList(model.getAccountMoneyList()); + depotHead.setDiscount(model.getDiscount()); + depotHead.setDiscountMoney(model.getDiscountMoney()); + depotHead.setDiscountLastMoney(model.getDiscountLastMoney()); + depotHead.setOtherMoney(model.getOtherMoney()); + depotHead.setOtherMoneyList(model.getOtherMoneyList()); + depotHead.setOtherMoneyItem(model.getOtherMoneyItem()); + depotHead.setAccountDay(model.getAccountDay()); + if (model.getAllocationProjectId() != null) { + depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId())); + } + depotHead.setTotalPrice(model.getTotalPrice()); + depotHead.setPayType(model.getPayType()); + depotHead.setStatus(false); + depotHead.setRemark(model.getRemark()); + depotHeadService.create(depotHead); + + //========标识位=========== + flag = true; + //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotHeadID() + " 的单据异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加单据信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>增加单据信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加单据", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加单据编号为 " + model.getNumber() + " " + tipMsg + "!", "增加单据" + tipMsg)); + Log.infoFileSync("==================结束调用增加单据方法create()==================="); + } + + /** + * 删除单据 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除单据信息方法delete()================"); + try { + depotHeadService.delete(model.getDepotHeadID()); + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotHeadID() + " 的单据异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除单据", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除单据ID为 "+ model.getDepotHeadID() + " " + tipMsg + "!", "删除单据" + tipMsg)); - Log.infoFileSync("====================结束调用删除单据信息方法delete()================"); - return SUCCESS; - } - - /** - * 更新单据 - * @return - */ - public void update() { - Boolean flag = false; + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除单据", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除单据ID为 " + model.getDepotHeadID() + " " + tipMsg + "!", "删除单据" + tipMsg)); + Log.infoFileSync("====================结束调用删除单据信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新单据 + * + * @return + */ + public void update() { + Boolean flag = false; try { - DepotHead depotHead = depotHeadService.get(model.getDepotHeadID()); - depotHead.setType(model.getType()); - depotHead.setSubType(model.getSubType()); - if(model.getProjectId()!=null){depotHead.setProjectId(new Depot(model.getProjectId()));} - depotHead.setNumber(model.getNumber()); - depotHead.setOperPersonName(getUser().getUsername()); - try{ - depotHead.setOperTime(new Timestamp(Tools.parse(model.getOperTime(), "yyyy-MM-dd HH:mm:ss").getTime())); + DepotHead depotHead = depotHeadService.get(model.getDepotHeadID()); + depotHead.setType(model.getType()); + depotHead.setSubType(model.getSubType()); + if (model.getProjectId() != null) { + depotHead.setProjectId(new Depot(model.getProjectId())); } - catch (ParseException e) { + depotHead.setNumber(model.getNumber()); + depotHead.setOperPersonName(getUser().getUsername()); + try { + depotHead.setOperTime(new Timestamp(Tools.parse(model.getOperTime(), "yyyy-MM-dd HH:mm:ss").getTime())); + } catch (ParseException e) { Log.errorFileSync(">>>>>>>>>>>>>>>解析入库时间格式异常", e); } - if(model.getOrganId()!=null){depotHead.setOrganId(new Supplier(model.getOrganId()));} - if(model.getHandsPersonId()!=null){depotHead.setHandsPersonId(new Person(model.getHandsPersonId()));} - depotHead.setSalesman(model.getSalesman()); - if(model.getAccountId()!=null){ - depotHead.setAccountId(new Account(model.getAccountId())); - } - else { - depotHead.setAccountId(null); - } - depotHead.setChangeAmount(model.getChangeAmount()); - depotHead.setAccountIdList(model.getAccountIdList()); - depotHead.setAccountMoneyList(model.getAccountMoneyList()); - depotHead.setDiscount(model.getDiscount()); - depotHead.setDiscountMoney(model.getDiscountMoney()); - depotHead.setDiscountLastMoney(model.getDiscountLastMoney()); - depotHead.setOtherMoney(model.getOtherMoney()); - depotHead.setOtherMoneyList(model.getOtherMoneyList()); - depotHead.setOtherMoneyItem(model.getOtherMoneyItem()); - depotHead.setAccountDay(model.getAccountDay()); - if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));} - depotHead.setTotalPrice(model.getTotalPrice()); - depotHead.setPayType(model.getPayType()); - depotHead.setStatus(false); - depotHead.setRemark(model.getRemark()); - depotHeadService.update(depotHead); - + if (model.getOrganId() != null) { + depotHead.setOrganId(new Supplier(model.getOrganId())); + } + if (model.getHandsPersonId() != null) { + depotHead.setHandsPersonId(new Person(model.getHandsPersonId())); + } + depotHead.setSalesman(model.getSalesman()); + if (model.getAccountId() != null) { + depotHead.setAccountId(new Account(model.getAccountId())); + } else { + depotHead.setAccountId(null); + } + depotHead.setChangeAmount(model.getChangeAmount()); + depotHead.setAccountIdList(model.getAccountIdList()); + depotHead.setAccountMoneyList(model.getAccountMoneyList()); + depotHead.setDiscount(model.getDiscount()); + depotHead.setDiscountMoney(model.getDiscountMoney()); + depotHead.setDiscountLastMoney(model.getDiscountLastMoney()); + depotHead.setOtherMoney(model.getOtherMoney()); + depotHead.setOtherMoneyList(model.getOtherMoneyList()); + depotHead.setOtherMoneyItem(model.getOtherMoneyItem()); + depotHead.setAccountDay(model.getAccountDay()); + if (model.getAllocationProjectId() != null) { + depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId())); + } + depotHead.setTotalPrice(model.getTotalPrice()); + depotHead.setPayType(model.getPayType()); + depotHead.setStatus(false); + depotHead.setRemark(model.getRemark()); + depotHeadService.update(depotHead); + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改单据ID为 : " + model.getDepotHeadID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally { + } finally { try { toClient(flag.toString()); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改单据回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新单据", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新单据ID为 "+ model.getDepotHeadID() + " " + tipMsg + "!", "更新单据" + tipMsg)); - } - - /** - * 批量删除指定ID单据 - * @return - */ - public String batchDelete() - { - try - { - depotHeadService.batchDelete(model.getDepotHeadIDs()); + , tipType, "更新单据ID为 " + model.getDepotHeadID() + " " + tipMsg + "!", "更新单据" + tipMsg)); + } + + /** + * 批量删除指定ID单据 + * + * @return + */ + public String batchDelete() { + try { + depotHeadService.batchDelete(model.getDepotHeadIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除单据ID为:" + model.getDepotHeadIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除单据ID为:" + model.getDepotHeadIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除单据", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除单据", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除单据ID为 "+ model.getDepotHeadIDs() + " " + tipMsg + "!", "批量删除单据" + tipMsg)); - return SUCCESS; - } + , tipType, "批量删除单据ID为 " + model.getDepotHeadIDs() + " " + tipMsg + "!", "批量删除单据" + tipMsg)); + return SUCCESS; + } - /** - * 批量设置状态-审核或者反审核 - * @return - */ - public String batchSetStatus() { - try { - depotHeadService.batchSetStatus(model.getStatus(), model.getDepotHeadIDs()); - model.getShowModel().setMsgTip("成功"); - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>批量修改状态,单据ID为:" + model.getDepotHeadIDs() + "信息异常", e); - tipMsg = "失败"; - tipType = 1; - } + /** + * 批量设置状态-审核或者反审核 + * + * @return + */ + public String batchSetStatus() { + try { + depotHeadService.batchSetStatus(model.getStatus(), model.getDepotHeadIDs()); + model.getShowModel().setMsgTip("成功"); + //记录操作日志使用 + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量修改状态,单据ID为:" + model.getDepotHeadIDs() + "信息异常", e); + tipMsg = "失败"; + tipType = 1; + } - logService.create(new Logdetails(getUser(), "批量修改单据状态", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "批量修改状态,单据ID为 "+ model.getDepotHeadIDs() + " " + tipMsg + "!", "批量修改单据状态" + tipMsg)); - return SUCCESS; - } + logService.create(new Logdetails(getUser(), "批量修改单据状态", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "批量修改状态,单据ID为 " + model.getDepotHeadIDs() + " " + tipMsg + "!", "批量修改单据状态" + tipMsg)); + return SUCCESS; + } - /** - * 检查单据编号是否存在 - */ - public void checkIsNumberExist() { - Boolean flag = false; - try { - flag = depotHeadService.checkIsNameExist("Number", model.getNumber(), "Id", model.getDepotHeadID()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>检查单据编号为:" + model.getNumber() + " ID为: " + model.getDepotHeadID() + " 是否存在出现异常!"); - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>回写检查单据编号为:" + model.getNumber() + " ID为: " + model.getDepotHeadID() + " 是否存在出现异常!",e); - } - } - } + /** + * 检查单据编号是否存在 + */ + public void checkIsNumberExist() { + Boolean flag = false; + try { + flag = depotHeadService.checkIsNameExist("Number", model.getNumber(), "Id", model.getDepotHeadID()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>检查单据编号为:" + model.getNumber() + " ID为: " + model.getDepotHeadID() + " 是否存在出现异常!"); + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>回写检查单据编号为:" + model.getNumber() + " ID为: " + model.getDepotHeadID() + " 是否存在出现异常!", e); + } + } + } - /** - * 单据编号生成接口,规则:查找当前类型单据下的当天最大的单据号,并加1 - */ - public void buildNumber(){ - try { - String beginTime = model.getBeginTime(); - String endTime = model.getEndTime(); - String newNumber = buildNumberFun(model.getType(), model.getSubType(), beginTime, endTime); - JSONObject outer = new JSONObject(); - outer.put("DefaultNumber", newNumber); - //回写查询结果 - toClient(outer.toString()); - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>单据编号生成异常", e); - } - catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写单据编号生成接口异常", e); - } - } + /** + * 单据编号生成接口,规则:查找当前类型单据下的当天最大的单据号,并加1 + */ + public void buildNumber() { + try { + String beginTime = model.getBeginTime(); + String endTime = model.getEndTime(); + String newNumber = buildNumberFun(model.getType(), model.getSubType(), beginTime, endTime); + JSONObject outer = new JSONObject(); + outer.put("DefaultNumber", newNumber); + //回写查询结果 + toClient(outer.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>单据编号生成异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写单据编号生成接口异常", e); + } + } - /** - * 查找单据编号 - * @return - */ - public String buildNumberFun(String type,String subType,String beginTime,String endTime){ - String newNumber = "0001"; //新编号 - try { - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - pageUtil.setAdvSearch(buildNumberCondition(type, subType, beginTime, endTime)); - depotHeadService.find(pageUtil); - List dataList = pageUtil.getPageList(); - //存放数据json数组 - if (null != dataList && dataList.size() > 0) { - DepotHead depotHead = dataList.get(0); - if (depotHead != null) { - String number = depotHead.getDefaultNumber(); //最大的单据编号 - if (number != null) { - Integer lastNumber = Integer.parseInt(number.substring(12, 16)); //末四尾 - lastNumber = lastNumber + 1; - Integer nLen = lastNumber.toString().length(); - if (nLen == 1) { - newNumber = "000" + lastNumber.toString(); - } else if (nLen == 2) { - newNumber = "00" + lastNumber.toString(); - } else if (nLen == 3) { - newNumber = "0" + lastNumber.toString(); - } else if (nLen == 4) { - newNumber = lastNumber.toString(); - } - } - } - } - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>单据编号生成异常", e); - } - return newNumber; - } + /** + * 查找单据编号 + * + * @return + */ + public String buildNumberFun(String type, String subType, String beginTime, String endTime) { + String newNumber = "0001"; //新编号 + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(buildNumberCondition(type, subType, beginTime, endTime)); + depotHeadService.find(pageUtil); + List dataList = pageUtil.getPageList(); + //存放数据json数组 + if (null != dataList && dataList.size() > 0) { + DepotHead depotHead = dataList.get(0); + if (depotHead != null) { + String number = depotHead.getDefaultNumber(); //最大的单据编号 + if (number != null) { + Integer lastNumber = Integer.parseInt(number.substring(12, 16)); //末四尾 + lastNumber = lastNumber + 1; + Integer nLen = lastNumber.toString().length(); + if (nLen == 1) { + newNumber = "000" + lastNumber.toString(); + } else if (nLen == 2) { + newNumber = "00" + lastNumber.toString(); + } else if (nLen == 3) { + newNumber = "0" + lastNumber.toString(); + } else if (nLen == 4) { + newNumber = lastNumber.toString(); + } + } + } + } + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>单据编号生成异常", e); + } + return newNumber; + } - /** - * 根据材料信息获取 - */ - public void getHeaderIdByMaterial(){ - try { - String materialParam = model.getMaterialParam(); //商品参数 - String depotIds = model.getDepotIds(); //拥有的仓库信息 - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - depotHeadService.getHeaderIdByMaterial(pageUtil, materialParam, depotIds); - JSONObject outer = new JSONObject(); - String allReturn = ""; - List dataList = pageUtil.getPageList(); - if(dataList!=null) { - for (Integer i = 0; i < dataList.size(); i++) { - Object dl = dataList.get(i); //获取对象 - allReturn = allReturn + dl.toString() + ","; - } - } - allReturn = allReturn.substring(0,allReturn.length()-1); - if(allReturn.equals("null")){ - allReturn = ""; - } - outer.put("ret", allReturn); - //回写查询结果 - toClient(outer.toString()); - } - catch (JshException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e); - } - } + /** + * 根据材料信息获取 + */ + public void getHeaderIdByMaterial() { + try { + String materialParam = model.getMaterialParam(); //商品参数 + String depotIds = model.getDepotIds(); //拥有的仓库信息 + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + depotHeadService.getHeaderIdByMaterial(pageUtil, materialParam, depotIds); + JSONObject outer = new JSONObject(); + String allReturn = ""; + List dataList = pageUtil.getPageList(); + if (dataList != null) { + for (Integer i = 0; i < dataList.size(); i++) { + Object dl = dataList.get(i); //获取对象 + allReturn = allReturn + dl.toString() + ","; + } + } + allReturn = allReturn.substring(0, allReturn.length() - 1); + if (allReturn.equals("null")) { + allReturn = ""; + } + outer.put("ret", allReturn); + //回写查询结果 + toClient(outer.toString()); + } catch (JshException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e); + } + } - /** - * 查找单据信息 - * @return - */ + /** + * 查找单据信息 + * + * @return + */ public void findBy() { - try { - PageUtil pageUtil = new PageUtil(); + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); @@ -426,40 +409,40 @@ public class DepotHeadAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(DepotHead depotHead:dataList) { + if (null != dataList) { + for (DepotHead depotHead : dataList) { JSONObject item = new JSONObject(); item.put("Id", depotHead.getId()); - item.put("ProjectId", depotHead.getProjectId()==null?"":depotHead.getProjectId().getId()); - item.put("ProjectName", depotHead.getProjectId()==null?"":depotHead.getProjectId().getName()); + item.put("ProjectId", depotHead.getProjectId() == null ? "" : depotHead.getProjectId().getId()); + item.put("ProjectName", depotHead.getProjectId() == null ? "" : depotHead.getProjectId().getName()); item.put("Number", depotHead.getNumber()); item.put("OperPersonName", depotHead.getOperPersonName()); item.put("CreateTime", Tools.getCenternTime(depotHead.getCreateTime())); item.put("OperTime", Tools.getCenternTime(depotHead.getOperTime())); - item.put("OrganId", depotHead.getOrganId()==null?"":depotHead.getOrganId().getId()); - item.put("OrganName", depotHead.getOrganId()==null?"":depotHead.getOrganId().getSupplier()); - item.put("HandsPersonId", depotHead.getHandsPersonId()==null?"":depotHead.getHandsPersonId().getId()); - item.put("Salesman", depotHead.getSalesman().toString()); - item.put("HandsPersonName", depotHead.getHandsPersonId()==null?"":depotHead.getHandsPersonId().getName()); - item.put("AccountId", depotHead.getAccountId()==null?"":depotHead.getAccountId().getId()); - item.put("AccountName", depotHead.getAccountId()==null?"":depotHead.getAccountId().getName()); - item.put("ChangeAmount", depotHead.getChangeAmount()==null?"":Math.abs(depotHead.getChangeAmount())); - item.put("AccountIdList", depotHead.getAccountIdList()); - item.put("AccountMoneyList", depotHead.getAccountMoneyList()); - item.put("Discount", depotHead.getDiscount()); - item.put("DiscountMoney", depotHead.getDiscountMoney()); - item.put("DiscountLastMoney", depotHead.getDiscountLastMoney()); - item.put("OtherMoney", depotHead.getOtherMoney()); - item.put("OtherMoneyList", depotHead.getOtherMoneyList()); //id列表 - item.put("OtherMoneyItem", depotHead.getOtherMoneyItem()); //money列表 - item.put("AccountDay", depotHead.getAccountDay()); //结算天数 - item.put("AllocationProjectId", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getId()); - item.put("AllocationProjectName", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getName()); - item.put("TotalPrice", depotHead.getTotalPrice()==null?"":Math.abs(depotHead.getTotalPrice())); - item.put("payType", depotHead.getPayType()==null?"":depotHead.getPayType()); - item.put("Status", depotHead.getStatus()); + item.put("OrganId", depotHead.getOrganId() == null ? "" : depotHead.getOrganId().getId()); + item.put("OrganName", depotHead.getOrganId() == null ? "" : depotHead.getOrganId().getSupplier()); + item.put("HandsPersonId", depotHead.getHandsPersonId() == null ? "" : depotHead.getHandsPersonId().getId()); + item.put("Salesman", depotHead.getSalesman().toString()); + item.put("HandsPersonName", depotHead.getHandsPersonId() == null ? "" : depotHead.getHandsPersonId().getName()); + item.put("AccountId", depotHead.getAccountId() == null ? "" : depotHead.getAccountId().getId()); + item.put("AccountName", depotHead.getAccountId() == null ? "" : depotHead.getAccountId().getName()); + item.put("ChangeAmount", depotHead.getChangeAmount() == null ? "" : Math.abs(depotHead.getChangeAmount())); + item.put("AccountIdList", depotHead.getAccountIdList()); + item.put("AccountMoneyList", depotHead.getAccountMoneyList()); + item.put("Discount", depotHead.getDiscount()); + item.put("DiscountMoney", depotHead.getDiscountMoney()); + item.put("DiscountLastMoney", depotHead.getDiscountLastMoney()); + item.put("OtherMoney", depotHead.getOtherMoney()); + item.put("OtherMoneyList", depotHead.getOtherMoneyList()); //id列表 + item.put("OtherMoneyItem", depotHead.getOtherMoneyItem()); //money列表 + item.put("AccountDay", depotHead.getAccountDay()); //结算天数 + item.put("AllocationProjectId", depotHead.getAllocationProjectId() == null ? "" : depotHead.getAllocationProjectId().getId()); + item.put("AllocationProjectName", depotHead.getAllocationProjectId() == null ? "" : depotHead.getAllocationProjectId().getName()); + item.put("TotalPrice", depotHead.getTotalPrice() == null ? "" : Math.abs(depotHead.getTotalPrice())); + item.put("payType", depotHead.getPayType() == null ? "" : depotHead.getPayType()); + item.put("Status", depotHead.getStatus()); item.put("Remark", depotHead.getRemark()); - item.put("MaterialsList", findMaterialsListByHeaderId(depotHead.getId())); + item.put("MaterialsList", findMaterialsListByHeaderId(depotHead.getId())); item.put("op", 1); dataArray.add(item); } @@ -467,504 +450,471 @@ public class DepotHeadAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单据信息异常", e); - } - catch (IOException e) { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单据信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e); } - } + } - /** - * 根据编号查询单据信息 - */ - public void getDetailByNumber(){ - try { - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - pageUtil.setAdvSearch(getConditionByNumber()); - depotHeadService.find(pageUtil); - List dataList = pageUtil.getPageList(); - JSONObject item = new JSONObject(); - if(dataList!=null && dataList.get(0)!=null) { - DepotHead depotHead = dataList.get(0); - item.put("Id", depotHead.getId()); - item.put("ProjectId", depotHead.getProjectId()==null?"":depotHead.getProjectId().getId()); - item.put("ProjectName", depotHead.getProjectId()==null?"":depotHead.getProjectId().getName()); - item.put("Number", depotHead.getNumber()); - item.put("OperPersonName", depotHead.getOperPersonName()); - item.put("CreateTime", Tools.getCenternTime(depotHead.getCreateTime())); - item.put("OperTime", Tools.getCenternTime(depotHead.getOperTime())); - item.put("OrganId", depotHead.getOrganId()==null?"":depotHead.getOrganId().getId()); - item.put("OrganName", depotHead.getOrganId()==null?"":depotHead.getOrganId().getSupplier()); - item.put("HandsPersonId", depotHead.getHandsPersonId()==null?"":depotHead.getHandsPersonId().getId()); - item.put("Salesman", depotHead.getSalesman().toString()); - item.put("HandsPersonName", depotHead.getHandsPersonId()==null?"":depotHead.getHandsPersonId().getName()); - item.put("AccountId", depotHead.getAccountId()==null?"":depotHead.getAccountId().getId()); - item.put("AccountName", depotHead.getAccountId()==null?"":depotHead.getAccountId().getName()); - item.put("ChangeAmount", depotHead.getChangeAmount()==null?"":Math.abs(depotHead.getChangeAmount())); - item.put("AccountIdList", depotHead.getAccountIdList()); - item.put("AccountMoneyList", depotHead.getAccountMoneyList()); - item.put("Discount", depotHead.getDiscount()); - item.put("DiscountMoney", depotHead.getDiscountMoney()); - item.put("DiscountLastMoney", depotHead.getDiscountLastMoney()); - item.put("OtherMoney", depotHead.getOtherMoney()); - item.put("OtherMoneyList", depotHead.getOtherMoneyList()); //id列表 - item.put("OtherMoneyItem", depotHead.getOtherMoneyItem()); //money列表 - item.put("AccountDay", depotHead.getAccountDay()); //结算天数 - item.put("AllocationProjectId", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getId()); - item.put("AllocationProjectName", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getName()); - item.put("TotalPrice", depotHead.getTotalPrice()==null?"":Math.abs(depotHead.getTotalPrice())); - item.put("payType", depotHead.getPayType()==null?"":depotHead.getPayType()); - item.put("Status", depotHead.getStatus()); - item.put("Remark", depotHead.getRemark()); - item.put("MaterialsList", findMaterialsListByHeaderId(depotHead.getId())); - } - //回写查询结果 - toClient(item.toString()); - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单据信息异常", e); - } - catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e); - } - } - - /** - * 查找单据_根据月份(报表) - * @return - */ - public void findByMonth() { - try - { - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(1000); - pageUtil.setCurPage(1); - pageUtil.setAdvSearch(getConditionHead()); + /** + * 根据编号查询单据信息 + */ + public void getDetailByNumber() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getConditionByNumber()); depotHeadService.find(pageUtil); List dataList = pageUtil.getPageList(); - JSONObject outer = new JSONObject(); - String headId = ""; - if(null != dataList) - { - for(DepotHead depotHead:dataList) - { - headId = headId + depotHead.getId() + ","; - } + JSONObject item = new JSONObject(); + if (dataList != null && dataList.get(0) != null) { + DepotHead depotHead = dataList.get(0); + item.put("Id", depotHead.getId()); + item.put("ProjectId", depotHead.getProjectId() == null ? "" : depotHead.getProjectId().getId()); + item.put("ProjectName", depotHead.getProjectId() == null ? "" : depotHead.getProjectId().getName()); + item.put("Number", depotHead.getNumber()); + item.put("OperPersonName", depotHead.getOperPersonName()); + item.put("CreateTime", Tools.getCenternTime(depotHead.getCreateTime())); + item.put("OperTime", Tools.getCenternTime(depotHead.getOperTime())); + item.put("OrganId", depotHead.getOrganId() == null ? "" : depotHead.getOrganId().getId()); + item.put("OrganName", depotHead.getOrganId() == null ? "" : depotHead.getOrganId().getSupplier()); + item.put("HandsPersonId", depotHead.getHandsPersonId() == null ? "" : depotHead.getHandsPersonId().getId()); + item.put("Salesman", depotHead.getSalesman().toString()); + item.put("HandsPersonName", depotHead.getHandsPersonId() == null ? "" : depotHead.getHandsPersonId().getName()); + item.put("AccountId", depotHead.getAccountId() == null ? "" : depotHead.getAccountId().getId()); + item.put("AccountName", depotHead.getAccountId() == null ? "" : depotHead.getAccountId().getName()); + item.put("ChangeAmount", depotHead.getChangeAmount() == null ? "" : Math.abs(depotHead.getChangeAmount())); + item.put("AccountIdList", depotHead.getAccountIdList()); + item.put("AccountMoneyList", depotHead.getAccountMoneyList()); + item.put("Discount", depotHead.getDiscount()); + item.put("DiscountMoney", depotHead.getDiscountMoney()); + item.put("DiscountLastMoney", depotHead.getDiscountLastMoney()); + item.put("OtherMoney", depotHead.getOtherMoney()); + item.put("OtherMoneyList", depotHead.getOtherMoneyList()); //id列表 + item.put("OtherMoneyItem", depotHead.getOtherMoneyItem()); //money列表 + item.put("AccountDay", depotHead.getAccountDay()); //结算天数 + item.put("AllocationProjectId", depotHead.getAllocationProjectId() == null ? "" : depotHead.getAllocationProjectId().getId()); + item.put("AllocationProjectName", depotHead.getAllocationProjectId() == null ? "" : depotHead.getAllocationProjectId().getName()); + item.put("TotalPrice", depotHead.getTotalPrice() == null ? "" : Math.abs(depotHead.getTotalPrice())); + item.put("payType", depotHead.getPayType() == null ? "" : depotHead.getPayType()); + item.put("Status", depotHead.getStatus()); + item.put("Remark", depotHead.getRemark()); + item.put("MaterialsList", findMaterialsListByHeaderId(depotHead.getId())); } - if(headId!="") { - headId = headId.substring(0, headId.lastIndexOf(",")); - } - outer.put("HeadIds", headId); - toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单据信息异常", e); - } - catch (IOException e) - { + //回写查询结果 + toClient(item.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单据信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e); } - } + } + + /** + * 查找单据_根据月份(报表) + * + * @return + */ + public void findByMonth() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(1000); + pageUtil.setCurPage(1); + pageUtil.setAdvSearch(getConditionHead()); + depotHeadService.find(pageUtil); + List dataList = pageUtil.getPageList(); + JSONObject outer = new JSONObject(); + String headId = ""; + if (null != dataList) { + for (DepotHead depotHead : dataList) { + headId = headId + depotHead.getId() + ","; + } + } + if (headId != "") { + headId = headId.substring(0, headId.lastIndexOf(",")); + } + outer.put("HeadIds", headId); + toClient(outer.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单据信息异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e); + } + } + + /** + * 查找统计信息_根据礼品卡(报表) + * + * @return + */ + public void findGiftReport() { + try { + PageUtil pageUtil_in = new PageUtil(); + pageUtil_in.setPageSize(0); + pageUtil_in.setCurPage(0); + pageUtil_in.setAdvSearch(getConditionHead_Gift_In()); + depotHeadService.find(pageUtil_in); + List dataList_in = pageUtil_in.getPageList(); + JSONObject outer = new JSONObject(); + String headId = ""; + if (null != dataList_in) { + for (DepotHead depotHead : dataList_in) { + headId = headId + depotHead.getId() + ","; + } + PageUtil pageUtil_out = new PageUtil(); + pageUtil_out.setPageSize(0); + pageUtil_out.setCurPage(0); + pageUtil_out.setAdvSearch(getConditionHead_Gift_Out()); + depotHeadService.find(pageUtil_out); + List dataList_out = pageUtil_out.getPageList(); + if (null != dataList_out) { + for (DepotHead depotHead : dataList_out) { + headId = headId + depotHead.getId() + ","; + } + } + } + if (headId != "") { + headId = headId.substring(0, headId.lastIndexOf(",")); + } + outer.put("HeadIds", headId); + toClient(outer.toString()); + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单据信息异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e); + } + } - /** - * 查找统计信息_根据礼品卡(报表) - * @return - */ - public void findGiftReport() { - try { - PageUtil pageUtil_in = new PageUtil(); - pageUtil_in.setPageSize(0); - pageUtil_in.setCurPage(0); - pageUtil_in.setAdvSearch(getConditionHead_Gift_In()); - depotHeadService.find(pageUtil_in); - List dataList_in = pageUtil_in.getPageList(); - JSONObject outer = new JSONObject(); - String headId = ""; - if(null != dataList_in) { - for(DepotHead depotHead:dataList_in) { - headId = headId + depotHead.getId() + ","; - } - PageUtil pageUtil_out = new PageUtil(); - pageUtil_out.setPageSize(0); - pageUtil_out.setCurPage(0); - pageUtil_out.setAdvSearch(getConditionHead_Gift_Out()); - depotHeadService.find(pageUtil_out); - List dataList_out = pageUtil_out.getPageList(); - if(null != dataList_out) { - for(DepotHead depotHead:dataList_out) { - headId = headId + depotHead.getId() + ","; - } - } - } - if(headId!="") { - headId = headId.substring(0, headId.lastIndexOf(",")); - } - outer.put("HeadIds", headId); - toClient(outer.toString()); - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找单据信息异常", e); - } - catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询单据信息结果异常", e); - } - } - /** * 查询单位的累计应收和累计应付,零售不能计入 + * * @return */ public void findTotalPay() { - try - { - JSONObject outer = new JSONObject(); - Double sum = 0.0; - String getS = model.getSupplierId(); - String supType = model.getSupType(); //单位类型:客户、供应商 - int i = 1; - if(supType.equals("customer")){ //客户 - i = 1; - } - else if(supType.equals("vendor")){ //供应商 - i = -1; - } - //进销部分 - sum = sum - (allMoney(getS, "入库", "采购", "合计") - allMoney(getS, "入库", "采购", "实际"))*i; - sum = sum - (allMoney(getS, "入库", "销售退货", "合计") - allMoney(getS, "入库", "销售退货", "实际"))*i; - sum = sum + (allMoney(getS, "出库", "销售", "合计") - allMoney(getS, "出库", "销售", "实际"))*i; - sum = sum + (allMoney(getS, "出库", "采购退货", "合计") - allMoney(getS, "出库", "采购退货", "实际"))*i; - outer.put("getAllMoney", sum); + try { + JSONObject outer = new JSONObject(); + Double sum = 0.0; + String getS = model.getSupplierId(); + String supType = model.getSupType(); //单位类型:客户、供应商 + int i = 1; + if (supType.equals("customer")) { //客户 + i = 1; + } else if (supType.equals("vendor")) { //供应商 + i = -1; + } + //进销部分 + sum = sum - (allMoney(getS, "入库", "采购", "合计") - allMoney(getS, "入库", "采购", "实际")) * i; + sum = sum - (allMoney(getS, "入库", "销售退货", "合计") - allMoney(getS, "入库", "销售退货", "实际")) * i; + sum = sum + (allMoney(getS, "出库", "销售", "合计") - allMoney(getS, "出库", "销售", "实际")) * i; + sum = sum + (allMoney(getS, "出库", "采购退货", "合计") - allMoney(getS, "出库", "采购退货", "实际")) * i; + outer.put("getAllMoney", sum); toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询结果异常", e); } - } - - - /** - * 统计总金额 - * @param type - * @param subType - * @param mode 合计或者金额 - * @return - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public Double allMoney(String getS, String type, String subType, String mode) { - Log.infoFileSync("getS:" + getS); - Double allMoney = 0.0; - String allReturn = ""; - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - pageUtil.setAdvSearch(getConditionHead_byEndTime()); - try { - Integer supplierId = Integer.valueOf(getS); - depotHeadService.findAllMoney(pageUtil, supplierId, type, subType, mode); - allReturn = pageUtil.getPageList().toString(); - allReturn = allReturn.substring(1,allReturn.length()-1); - if(allReturn.equals("null")){ - allReturn = "0"; - } - } catch (JshException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - allMoney = Double.parseDouble(allReturn); - //返回正数,如果负数也转为正数 - if(allMoney<0){ - allMoney = -allMoney; - } - return allMoney; } - /** - *入库出库明细接口 - */ - public void findInDetail(){ - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(model.getPageSize()); - pageUtil.setCurPage(model.getPageNo()); - Long pid =model.getProjectId(); - String dids =model.getDepotIds(); - Long oId = model.getOrganId(); - String beginTime = model.getBeginTime(); - String endTime = model.getEndTime(); - String type = model.getType(); - try{ - depotHeadService.findInDetail(pageUtil,beginTime,endTime,type,pid,dids,oId); - List dataList = pageUtil.getPageList(); - JSONObject outer = new JSONObject(); - outer.put("total", pageUtil.getTotalCount()); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(dataList!=null){ - for(Integer i=0; i>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); - } - } - /** - *入库出库统计接口 - */ - public void findInOutMaterialCount(){ - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(model.getPageSize()); - pageUtil.setCurPage(model.getPageNo()); - Long pid =model.getProjectId(); - String dids =model.getDepotIds(); - Long oId = model.getOrganId(); - String beginTime = model.getBeginTime(); - String endTime = model.getEndTime(); - String type = model.getType(); - try{ - depotHeadService.findInOutMaterialCount(pageUtil, beginTime, endTime, type, pid, dids, oId); - List dataList = pageUtil.getPageList(); - JSONObject outer = new JSONObject(); - outer.put("total", pageUtil.getTotalCount()); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(dataList!=null){ - for(Integer i=0; i>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); - } - } + /** + * 统计总金额 + * + * @param type + * @param subType + * @param mode 合计或者金额 + * @return + */ + @SuppressWarnings({"unchecked", "rawtypes"}) + public Double allMoney(String getS, String type, String subType, String mode) { + Log.infoFileSync("getS:" + getS); + Double allMoney = 0.0; + String allReturn = ""; + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + pageUtil.setAdvSearch(getConditionHead_byEndTime()); + try { + Integer supplierId = Integer.valueOf(getS); + depotHeadService.findAllMoney(pageUtil, supplierId, type, subType, mode); + allReturn = pageUtil.getPageList().toString(); + allReturn = allReturn.substring(1, allReturn.length() - 1); + if (allReturn.equals("null")) { + allReturn = "0"; + } + } catch (JshException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + allMoney = Double.parseDouble(allReturn); + //返回正数,如果负数也转为正数 + if (allMoney < 0) { + allMoney = -allMoney; + } + return allMoney; + } - public String findMaterialsListByHeaderId(Long headerId){ - String allReturn = ""; - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); - try { - depotHeadService.findMaterialsListByHeaderId(pageUtil, headerId); - allReturn = pageUtil.getPageList().toString(); - allReturn = allReturn.substring(1,allReturn.length()-1); - if(allReturn.equals("null")){ - allReturn = ""; - } - } - catch (JshException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - return allReturn; - } + /** + * 入库出库明细接口 + */ + public void findInDetail() { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + Long pid = model.getProjectId(); + String dids = model.getDepotIds(); + Long oId = model.getOrganId(); + String beginTime = model.getBeginTime(); + String endTime = model.getEndTime(); + String type = model.getType(); + try { + depotHeadService.findInDetail(pageUtil, beginTime, endTime, type, pid, dids, oId); + List dataList = pageUtil.getPageList(); + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (dataList != null) { + for (Integer i = 0; i < dataList.size(); i++) { + JSONObject item = new JSONObject(); + Object dl = dataList.get(i); //获取对象 + Object[] arr = (Object[]) dl; //转为数组 + item.put("number", arr[0]); //单据编号 + item.put("materialName", arr[1]); //商品名称 + item.put("materialModel", arr[2]); //商品型号 + item.put("unitPrice", arr[3]); //单价 + item.put("operNumber", arr[4]); //入库出库数量 + item.put("allPrice", arr[5]); //金额 + item.put("supplierName", arr[6]); //供应商 + item.put("depotName", arr[7]); //仓库 + item.put("operTime", arr[8]); //入库出库日期 + item.put("type", arr[9]); //入库出库日期 + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } catch (JshException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); + } + } - /** - *对账单接口 - */ - public void findStatementAccount(){ - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(model.getPageSize()); - pageUtil.setCurPage(model.getPageNo()); - String beginTime = model.getBeginTime(); - String endTime = model.getEndTime(); - Long organId = model.getOrganId(); - String supType = model.getSupType(); //单位类型:客户、供应商 - int j = 1; - if(supType.equals("客户")){ //客户 - j = 1; - } - else if(supType.equals("供应商")){ //供应商 - j = -1; - } - try{ - depotHeadService.findStatementAccount(pageUtil, beginTime, endTime, organId, supType); - List dataList = pageUtil.getPageList(); - JSONObject outer = new JSONObject(); - outer.put("total", pageUtil.getTotalCount()); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if(dataList!=null){ - for(Integer i=0; i>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); - } - } + /** + * 入库出库统计接口 + */ + public void findInOutMaterialCount() { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + Long pid = model.getProjectId(); + String dids = model.getDepotIds(); + Long oId = model.getOrganId(); + String beginTime = model.getBeginTime(); + String endTime = model.getEndTime(); + String type = model.getType(); + try { + depotHeadService.findInOutMaterialCount(pageUtil, beginTime, endTime, type, pid, dids, oId); + List dataList = pageUtil.getPageList(); + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (dataList != null) { + for (Integer i = 0; i < dataList.size(); i++) { + JSONObject item = new JSONObject(); + Object dl = dataList.get(i); //获取对象 + Object[] arr = (Object[]) dl; //转为数组 + item.put("MaterialId", arr[0]); //商品Id + item.put("mName", arr[1]); //商品名称 + item.put("Model", arr[2]); //商品型号 + item.put("categoryName", arr[3]); //商品类型 + item.put("numSum", arr[4]); //数量 + item.put("priceSum", arr[5]); //金额 + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } catch (JshException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); + } + } - private Map getConditionByNumber() { - Map condition = new HashMap(); - condition.put("Number_s_eq",model.getNumber()); - return condition; - } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + public String findMaterialsListByHeaderId(Long headerId) { + String allReturn = ""; + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); + try { + depotHeadService.findMaterialsListByHeaderId(pageUtil, headerId); + allReturn = pageUtil.getPageList().toString(); + allReturn = allReturn.substring(1, allReturn.length() - 1); + if (allReturn.equals("null")) { + allReturn = ""; + } + } catch (JshException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } + return allReturn; + } + + /** + * 对账单接口 + */ + public void findStatementAccount() { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(model.getPageSize()); + pageUtil.setCurPage(model.getPageNo()); + String beginTime = model.getBeginTime(); + String endTime = model.getEndTime(); + Long organId = model.getOrganId(); + String supType = model.getSupType(); //单位类型:客户、供应商 + int j = 1; + if (supType.equals("客户")) { //客户 + j = 1; + } else if (supType.equals("供应商")) { //供应商 + j = -1; + } + try { + depotHeadService.findStatementAccount(pageUtil, beginTime, endTime, organId, supType); + List dataList = pageUtil.getPageList(); + JSONObject outer = new JSONObject(); + outer.put("total", pageUtil.getTotalCount()); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (dataList != null) { + for (Integer i = 0; i < dataList.size(); i++) { + JSONObject item = new JSONObject(); + Object dl = dataList.get(i); //获取对象 + Object[] arr = (Object[]) dl; //转为数组 + item.put("number", arr[0]); //单据编号 + item.put("type", arr[1]); //类型 + String type = arr[1].toString(); + Double p1 = 0.0; + Double p2 = 0.0; + if (arr[2] != null) { + p1 = Double.parseDouble(arr[2].toString()); + } + if (arr[3] != null) { + p2 = Double.parseDouble(arr[3].toString()); + } + Double allPrice = 0.0; + if (p1 < 0) { + p1 = -p1; + } + if (p2 < 0) { + p2 = -p2; + } + if (type.equals("采购入库")) { + allPrice = -(p1 - p2); + } else if (type.equals("销售退货入库")) { + allPrice = -(p1 - p2); + } else if (type.equals("销售出库")) { + allPrice = p1 - p2; + } else if (type.equals("采购退货出库")) { + allPrice = p1 - p2; + } else if (type.equals("付款")) { + allPrice = p1 + p2; + } else if (type.equals("收款")) { + allPrice = -(p1 + p2); + } else if (type.equals("收入")) { + allPrice = p1 - p2; + } else if (type.equals("支出")) { + allPrice = -(p1 - p2); + } + item.put("discountLastMoney", p1); //金额 + item.put("changeAmount", p2); //金额 + item.put("allPrice", String.format("%.2f", allPrice * j)); //计算后的金额 + item.put("supplierName", arr[4]); //供应商 + item.put("operTime", arr[5]); //入库出库日期 + dataArray.add(item); + } + } + outer.put("rows", dataArray); + //回写查询结果 + toClient(outer.toString()); + } catch (JshException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); + } + } + + private Map getConditionByNumber() { + Map condition = new HashMap(); + condition.put("Number_s_eq", model.getNumber()); + return condition; + } + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); - condition.put("Type_s_eq",model.getType()); - condition.put("SubType_s_eq",model.getSubType()); - condition.put("Number_s_like",model.getNumber()); - condition.put("Id_s_in",model.getDhIds()); - condition.put("OperTime_s_gteq",model.getBeginTime()); - condition.put("OperTime_s_lteq",model.getEndTime()); - condition.put("Id_s_order","desc"); + Map condition = new HashMap(); + condition.put("Type_s_eq", model.getType()); + condition.put("SubType_s_eq", model.getSubType()); + condition.put("Number_s_like", model.getNumber()); + condition.put("Id_s_in", model.getDhIds()); + condition.put("OperTime_s_gteq", model.getBeginTime()); + condition.put("OperTime_s_lteq", model.getEndTime()); + condition.put("Id_s_order", "desc"); return condition; } - private Map buildNumberCondition(String type,String subType,String beginTime,String endTime) { - Map condition = new HashMap(); - condition.put("Type_s_eq", type); - condition.put("SubType_s_eq", subType); - condition.put("OperTime_s_gteq",beginTime); - condition.put("OperTime_s_lteq",endTime); - condition.put("Id_s_order","desc"); - return condition; - } - - private Map getConditionHead() - { - Map condition = new HashMap(); - condition.put("OperTime_s_lteq",model.getMonthTime() + "-31 00:00:00"); + private Map buildNumberCondition(String type, String subType, String beginTime, String endTime) { + Map condition = new HashMap(); + condition.put("Type_s_eq", type); + condition.put("SubType_s_eq", subType); + condition.put("OperTime_s_gteq", beginTime); + condition.put("OperTime_s_lteq", endTime); + condition.put("Id_s_order", "desc"); return condition; } - private Map getConditionHead_Gift_In() { - Map condition = new HashMap(); - return condition; - } + private Map getConditionHead() { + Map condition = new HashMap(); + condition.put("OperTime_s_lteq", model.getMonthTime() + "-31 00:00:00"); + return condition; + } - private Map getConditionHead_Gift_Out() { - Map condition = new HashMap(); - if(model.getProjectId()!=null) { - condition.put("ProjectId_n_eq", model.getProjectId()); - } - return condition; - } + private Map getConditionHead_Gift_In() { + Map condition = new HashMap(); + return condition; + } - private Map getConditionHead_byEndTime() - { - Map condition = new HashMap(); - condition.put("OperTime_s_lteq", model.getEndTime()); - return condition; - } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - public DepotHeadModel getModel() - { - return model; - } - public void setDepotHeadService(DepotHeadIService depotHeadService) - { + private Map getConditionHead_Gift_Out() { + Map condition = new HashMap(); + if (model.getProjectId() != null) { + condition.put("ProjectId_n_eq", model.getProjectId()); + } + return condition; + } + + private Map getConditionHead_byEndTime() { + Map condition = new HashMap(); + condition.put("OperTime_s_lteq", model.getEndTime()); + return condition; + } + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + public DepotHeadModel getModel() { + return model; + } + + public void setDepotHeadService(DepotHeadIService depotHeadService) { this.depotHeadService = depotHeadService; } } diff --git a/src/main/java/com/jsh/action/materials/DepotItemAction.java b/src/main/java/com/jsh/action/materials/DepotItemAction.java index b0969e38..d790d5c4 100644 --- a/src/main/java/com/jsh/action/materials/DepotItemAction.java +++ b/src/main/java/com/jsh/action/materials/DepotItemAction.java @@ -19,45 +19,46 @@ import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.Map; + /* * 单据明细管理 * @author jishenghua qq:752718920 -*/ + */ @SuppressWarnings("serial") -public class DepotItemAction extends BaseAction -{ +public class DepotItemAction extends BaseAction { + /** + * action返回excel结果 + */ + public static final String EXCEL = "excel"; private MaterialIService materialService; private DepotItemIService depotItemService; private DepotItemModel model = new DepotItemModel(); - /** - * action返回excel结果 - */ - public static final String EXCEL = "excel"; - - /** - * 保存明细 - * @return - */ - public void saveDetials() { - Log.infoFileSync("==================开始调用保存仓管通明细信息方法saveDetials()==================="); - Boolean flag = false; - try { - Long headerId=model.getHeaderId(); - String inserted=model.getInserted(); - String deleted=model.getDeleted(); - String updated=model.getUpdated(); - //转为json - JSONArray insertedJson = JSONArray.fromObject(inserted); - JSONArray deletedJson = JSONArray.fromObject(deleted); - JSONArray updatedJson = JSONArray.fromObject(updated); - if(null != insertedJson) { - for(int i = 0;i < insertedJson.size(); i++) { - DepotItem depotItem = new DepotItem(); - JSONObject tempInsertedJson = JSONObject.fromObject(insertedJson.get(i)); - depotItem.setHeaderId(new DepotHead(headerId)); - depotItem.setMaterialId(new Material(tempInsertedJson.getLong("MaterialId"))); + + /** + * 保存明细 + * + * @return + */ + public void saveDetials() { + Log.infoFileSync("==================开始调用保存仓管通明细信息方法saveDetials()==================="); + Boolean flag = false; + try { + Long headerId = model.getHeaderId(); + String inserted = model.getInserted(); + String deleted = model.getDeleted(); + String updated = model.getUpdated(); + //转为json + JSONArray insertedJson = JSONArray.fromObject(inserted); + JSONArray deletedJson = JSONArray.fromObject(deleted); + JSONArray updatedJson = JSONArray.fromObject(updated); + if (null != insertedJson) { + for (int i = 0; i < insertedJson.size(); i++) { + DepotItem depotItem = new DepotItem(); + JSONObject tempInsertedJson = JSONObject.fromObject(insertedJson.get(i)); + depotItem.setHeaderId(new DepotHead(headerId)); + depotItem.setMaterialId(new Material(tempInsertedJson.getLong("MaterialId"))); depotItem.setMUnit(tempInsertedJson.getString("Unit")); - if(!StringUtils.isEmpty(tempInsertedJson.get("OperNumber").toString())){ + if (!StringUtils.isEmpty(tempInsertedJson.get("OperNumber").toString())) { depotItem.setOperNumber(tempInsertedJson.getDouble("OperNumber")); try { String Unit = tempInsertedJson.get("Unit").toString(); @@ -65,74 +66,83 @@ public class DepotItemAction extends BaseAction Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString()); //以下进行单位换算 String UnitName = findUnitName(mId); //查询计量单位名称 - if(!UnitName.equals("")) { + if (!UnitName.equals("")) { String UnitList = UnitName.substring(0, UnitName.indexOf("(")); String RatioList = UnitName.substring(UnitName.indexOf("(")); String basicUnit = UnitList.substring(0, UnitList.indexOf(",")); //基本单位 - String otherUnit = UnitList.substring(UnitList.indexOf(",")+1); //副单位 - Integer ratio = Integer.parseInt(RatioList.substring(RatioList.indexOf(":") + 1).replace(")","")); //比例 - if(Unit.equals(basicUnit)){ //如果等于基础单位 + String otherUnit = UnitList.substring(UnitList.indexOf(",") + 1); //副单位 + Integer ratio = Integer.parseInt(RatioList.substring(RatioList.indexOf(":") + 1).replace(")", "")); //比例 + if (Unit.equals(basicUnit)) { //如果等于基础单位 depotItem.setBasicNumber(oNumber); //数量一致 + } else if (Unit.equals(otherUnit)) { //如果等于副单位 + depotItem.setBasicNumber(oNumber * ratio); //数量乘以比例 } - else if(Unit.equals(otherUnit)){ //如果等于副单位 - depotItem.setBasicNumber(oNumber*ratio); //数量乘以比例 - } - } - else { + } else { depotItem.setBasicNumber(oNumber); //其他情况 } - } - catch(Exception e){ + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e); } } - if(!StringUtils.isEmpty(tempInsertedJson.get("UnitPrice").toString())){ + if (!StringUtils.isEmpty(tempInsertedJson.get("UnitPrice").toString())) { depotItem.setUnitPrice(tempInsertedJson.getDouble("UnitPrice")); } - if(!StringUtils.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())){ + if (!StringUtils.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) { depotItem.setTaxUnitPrice(tempInsertedJson.getDouble("TaxUnitPrice")); } - if(!StringUtils.isEmpty(tempInsertedJson.get("AllPrice").toString())){ + if (!StringUtils.isEmpty(tempInsertedJson.get("AllPrice").toString())) { depotItem.setAllPrice(tempInsertedJson.getDouble("AllPrice")); } - depotItem.setRemark(tempInsertedJson.getString("Remark")); - if(tempInsertedJson.get("DepotId")!=null && !StringUtils.isEmpty(tempInsertedJson.get("DepotId").toString())){ + depotItem.setRemark(tempInsertedJson.getString("Remark")); + if (tempInsertedJson.get("DepotId") != null && !StringUtils.isEmpty(tempInsertedJson.get("DepotId").toString())) { depotItem.setDepotId(new Depot(tempInsertedJson.getLong("DepotId"))); } - if(tempInsertedJson.get("AnotherDepotId")!=null && !StringUtils.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())){ + if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtils.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) { depotItem.setAnotherDepotId(new Depot(tempInsertedJson.getLong("AnotherDepotId"))); } - if(!StringUtils.isEmpty(tempInsertedJson.get("TaxRate").toString())){ + if (!StringUtils.isEmpty(tempInsertedJson.get("TaxRate").toString())) { depotItem.setTaxRate(tempInsertedJson.getDouble("TaxRate")); } - if(!StringUtils.isEmpty(tempInsertedJson.get("TaxMoney").toString())){ + if (!StringUtils.isEmpty(tempInsertedJson.get("TaxMoney").toString())) { depotItem.setTaxMoney(tempInsertedJson.getDouble("TaxMoney")); } - if(!StringUtils.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())){ + if (!StringUtils.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) { depotItem.setTaxLastMoney(tempInsertedJson.getDouble("TaxLastMoney")); } - if(tempInsertedJson.get("OtherField1")!=null){depotItem.setOtherField1(tempInsertedJson.getString("OtherField1"));} - if(tempInsertedJson.get("OtherField2")!=null){depotItem.setOtherField2(tempInsertedJson.getString("OtherField2"));} - if(tempInsertedJson.get("OtherField3")!=null){depotItem.setOtherField3(tempInsertedJson.getString("OtherField3"));} - if(tempInsertedJson.get("OtherField4")!=null){depotItem.setOtherField4(tempInsertedJson.getString("OtherField4"));} - if(tempInsertedJson.get("OtherField5")!=null){depotItem.setOtherField5(tempInsertedJson.getString("OtherField5"));} - if(tempInsertedJson.get("MType")!=null){depotItem.setMType(tempInsertedJson.getString("MType"));} - depotItemService.create(depotItem); - } - } - if(null != deletedJson) { - for(int i = 0;i < deletedJson.size(); i++) { - JSONObject tempDeletedJson = JSONObject.fromObject(deletedJson.get(i)); - depotItemService.delete(tempDeletedJson.getLong("Id")); - } - } - if(null != updatedJson) { - for(int i = 0;i < updatedJson.size(); i++) { - JSONObject tempUpdatedJson = JSONObject.fromObject(updatedJson.get(i)); - DepotItem depotItem = depotItemService.get(tempUpdatedJson.getLong("Id")); - depotItem.setMaterialId(new Material(tempUpdatedJson.getLong("MaterialId"))); + if (tempInsertedJson.get("OtherField1") != null) { + depotItem.setOtherField1(tempInsertedJson.getString("OtherField1")); + } + if (tempInsertedJson.get("OtherField2") != null) { + depotItem.setOtherField2(tempInsertedJson.getString("OtherField2")); + } + if (tempInsertedJson.get("OtherField3") != null) { + depotItem.setOtherField3(tempInsertedJson.getString("OtherField3")); + } + if (tempInsertedJson.get("OtherField4") != null) { + depotItem.setOtherField4(tempInsertedJson.getString("OtherField4")); + } + if (tempInsertedJson.get("OtherField5") != null) { + depotItem.setOtherField5(tempInsertedJson.getString("OtherField5")); + } + if (tempInsertedJson.get("MType") != null) { + depotItem.setMType(tempInsertedJson.getString("MType")); + } + depotItemService.create(depotItem); + } + } + if (null != deletedJson) { + for (int i = 0; i < deletedJson.size(); i++) { + JSONObject tempDeletedJson = JSONObject.fromObject(deletedJson.get(i)); + depotItemService.delete(tempDeletedJson.getLong("Id")); + } + } + if (null != updatedJson) { + for (int i = 0; i < updatedJson.size(); i++) { + JSONObject tempUpdatedJson = JSONObject.fromObject(updatedJson.get(i)); + DepotItem depotItem = depotItemService.get(tempUpdatedJson.getLong("Id")); + depotItem.setMaterialId(new Material(tempUpdatedJson.getLong("MaterialId"))); depotItem.setMUnit(tempUpdatedJson.getString("Unit")); - if(!StringUtils.isEmpty(tempUpdatedJson.get("OperNumber").toString())){ + if (!StringUtils.isEmpty(tempUpdatedJson.get("OperNumber").toString())) { depotItem.setOperNumber(tempUpdatedJson.getDouble("OperNumber")); try { String Unit = tempUpdatedJson.get("Unit").toString(); @@ -140,50 +150,47 @@ public class DepotItemAction extends BaseAction Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString()); //以下进行单位换算 String UnitName = findUnitName(mId); //查询计量单位名称 - if(!UnitName.equals("")) { + if (!UnitName.equals("")) { String UnitList = UnitName.substring(0, UnitName.indexOf("(")); String RatioList = UnitName.substring(UnitName.indexOf("(")); String basicUnit = UnitList.substring(0, UnitList.indexOf(",")); //基本单位 - String otherUnit = UnitList.substring(UnitList.indexOf(",")+1); //副单位 - Integer ratio = Integer.parseInt(RatioList.substring(RatioList.indexOf(":") + 1).replace(")","")); //比例 - if(Unit.equals(basicUnit)){ //如果等于基础单位 + String otherUnit = UnitList.substring(UnitList.indexOf(",") + 1); //副单位 + Integer ratio = Integer.parseInt(RatioList.substring(RatioList.indexOf(":") + 1).replace(")", "")); //比例 + if (Unit.equals(basicUnit)) { //如果等于基础单位 depotItem.setBasicNumber(oNumber); //数量一致 + } else if (Unit.equals(otherUnit)) { //如果等于副单位 + depotItem.setBasicNumber(oNumber * ratio); //数量乘以比例 } - else if(Unit.equals(otherUnit)){ //如果等于副单位 - depotItem.setBasicNumber(oNumber*ratio); //数量乘以比例 - } - } - else { + } else { depotItem.setBasicNumber(oNumber); //其他情况 } - } - catch(Exception e){ + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e); } } - if(!StringUtils.isEmpty(tempUpdatedJson.get("UnitPrice").toString())){ + if (!StringUtils.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) { depotItem.setUnitPrice(tempUpdatedJson.getDouble("UnitPrice")); } - if(!StringUtils.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())){ + if (!StringUtils.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) { depotItem.setTaxUnitPrice(tempUpdatedJson.getDouble("TaxUnitPrice")); } - if(!StringUtils.isEmpty(tempUpdatedJson.get("AllPrice").toString())){ + if (!StringUtils.isEmpty(tempUpdatedJson.get("AllPrice").toString())) { depotItem.setAllPrice(tempUpdatedJson.getDouble("AllPrice")); } - depotItem.setRemark(tempUpdatedJson.getString("Remark")); - if(tempUpdatedJson.get("DepotId")!=null && !StringUtils.isEmpty(tempUpdatedJson.get("DepotId").toString())){ + depotItem.setRemark(tempUpdatedJson.getString("Remark")); + if (tempUpdatedJson.get("DepotId") != null && !StringUtils.isEmpty(tempUpdatedJson.get("DepotId").toString())) { depotItem.setDepotId(new Depot(tempUpdatedJson.getLong("DepotId"))); } - if(tempUpdatedJson.get("AnotherDepotId")!=null && !StringUtils.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())){ + if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtils.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) { depotItem.setAnotherDepotId(new Depot(tempUpdatedJson.getLong("AnotherDepotId"))); } - if(!StringUtils.isEmpty(tempUpdatedJson.get("TaxRate").toString())){ + if (!StringUtils.isEmpty(tempUpdatedJson.get("TaxRate").toString())) { depotItem.setTaxRate(tempUpdatedJson.getDouble("TaxRate")); } - if(!StringUtils.isEmpty(tempUpdatedJson.get("TaxMoney").toString())){ + if (!StringUtils.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) { depotItem.setTaxMoney(tempUpdatedJson.getDouble("TaxMoney")); } - if(!StringUtils.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())){ + if (!StringUtils.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) { depotItem.setTaxLastMoney(tempUpdatedJson.getDouble("TaxLastMoney")); } depotItem.setOtherField1(tempUpdatedJson.getString("OtherField1")); @@ -192,71 +199,69 @@ public class DepotItemAction extends BaseAction depotItem.setOtherField4(tempUpdatedJson.getString("OtherField4")); depotItem.setOtherField5(tempUpdatedJson.getString("OtherField5")); depotItem.setMType(tempUpdatedJson.getString("MType")); - depotItemService.create(depotItem); - } - } - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; + depotItemService.create(depotItem); + } + } + + //========标识位=========== + flag = true; + //记录操作日志使用 + tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>保存仓管通明细信息异常", e); - flag = false; - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>保存仓管通明细信息异常", e); + flag = false; + tipMsg = "失败"; tipType = 1; - } - finally { - try { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>保存仓管通明细信息回写客户端结果异常", e); } - } - - logService.create(new Logdetails(getUser(), "保存仓管通明细", model.getClientIp(), + } + + logService.create(new Logdetails(getUser(), "保存仓管通明细", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "保存仓管通明细对应主表编号为 "+ model.getHeaderId() + " " + tipMsg + "!", "保存仓管通明细" + tipMsg)); - Log.infoFileSync("==================结束调用保存仓管通明细方法saveDetials()==================="); - } + , tipType, "保存仓管通明细对应主表编号为 " + model.getHeaderId() + " " + tipMsg + "!", "保存仓管通明细" + tipMsg)); + Log.infoFileSync("==================结束调用保存仓管通明细方法saveDetials()==================="); + } /** * 查询计量单位信息 + * * @return */ - public String findUnitName(Long mId){ - String unitName =""; - PageUtil pageUtil = new PageUtil(); + public String findUnitName(Long mId) { + String unitName = ""; + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); try { materialService.findUnitName(pageUtil, mId); unitName = pageUtil.getPageList().toString(); - if(unitName!=null){ - unitName = unitName.substring(1,unitName.length()-1); - if(unitName.equals("null")){ + if (unitName != null) { + unitName = unitName.substring(1, unitName.length() - 1); + if (unitName.equals("null")) { unitName = ""; } } - } - catch (JshException e) { + } catch (JshException e) { // TODO Auto-generated catch block e.printStackTrace(); } return unitName; } - - /** - * 查找明细信息 - * @return - */ + + /** + * 查找明细信息 + * + * @return + */ public void findBy() { - try { - PageUtil pageUtil = new PageUtil(); + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); @@ -268,23 +273,22 @@ public class DepotItemAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(DepotItem depotItem:dataList) { + if (null != dataList) { + for (DepotItem depotItem : dataList) { JSONObject item = new JSONObject(); item.put("Id", depotItem.getId()); - item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialId", depotItem.getMaterialId() == null ? "" : depotItem.getMaterialId().getId()); String ratio; //比例 - if(depotItem.getMaterialId().getUnitId() == null || depotItem.getMaterialId().getUnitId().equals("")){ + if (depotItem.getMaterialId().getUnitId() == null || depotItem.getMaterialId().getUnitId().equals("")) { ratio = ""; - } - else { + } else { ratio = depotItem.getMaterialId().getUnitId().getUName(); ratio = ratio.substring(ratio.indexOf("(")); } //品名/型号/扩展信息/包装 - String MaterialName = depotItem.getMaterialId().getName() + ((depotItem.getMaterialId().getModel() == null || depotItem.getMaterialId().getModel().equals(""))?"":"("+depotItem.getMaterialId().getModel() + ")"); + String MaterialName = depotItem.getMaterialId().getName() + ((depotItem.getMaterialId().getModel() == null || depotItem.getMaterialId().getModel().equals("")) ? "" : "(" + depotItem.getMaterialId().getModel() + ")"); String materialOther = getOtherInfo(mpArr, depotItem); - MaterialName = MaterialName + materialOther + ((depotItem.getMaterialId().getUnit() == null || depotItem.getMaterialId().getUnit().equals(""))?"":"("+depotItem.getMaterialId().getUnit() + ")") + ratio; + MaterialName = MaterialName + materialOther + ((depotItem.getMaterialId().getUnit() == null || depotItem.getMaterialId().getUnit().equals("")) ? "" : "(" + depotItem.getMaterialId().getUnit() + ")") + ratio; item.put("MaterialName", MaterialName); item.put("Unit", depotItem.getMUnit()); item.put("OperNumber", depotItem.getOperNumber()); @@ -294,10 +298,10 @@ public class DepotItemAction extends BaseAction item.put("AllPrice", depotItem.getAllPrice()); item.put("Remark", depotItem.getRemark()); item.put("Img", depotItem.getImg()); - item.put("DepotId", depotItem.getDepotId()==null?"":depotItem.getDepotId().getId()); - item.put("DepotName", depotItem.getDepotId()==null?"":depotItem.getDepotId().getName()); - item.put("AnotherDepotId", depotItem.getAnotherDepotId()==null?"":depotItem.getAnotherDepotId().getId()); - item.put("AnotherDepotName", depotItem.getAnotherDepotId()==null?"":depotItem.getAnotherDepotId().getName()); + item.put("DepotId", depotItem.getDepotId() == null ? "" : depotItem.getDepotId().getId()); + item.put("DepotName", depotItem.getDepotId() == null ? "" : depotItem.getDepotId().getName()); + item.put("AnotherDepotId", depotItem.getAnotherDepotId() == null ? "" : depotItem.getAnotherDepotId().getId()); + item.put("AnotherDepotName", depotItem.getAnotherDepotId() == null ? "" : depotItem.getAnotherDepotId().getName()); item.put("TaxRate", depotItem.getTaxRate()); item.put("TaxMoney", depotItem.getTaxMoney()); item.put("TaxLastMoney", depotItem.getTaxLastMoney()); @@ -314,22 +318,21 @@ public class DepotItemAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e); - } - catch (IOException e) { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找仓管通信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询仓管通信息结果异常", e); } - } - - /** - * 查找所有的明细 - * @return - */ + } + + /** + * 查找所有的明细 + * + * @return + */ public void findByAll() { - try { - PageUtil pageUtil = new PageUtil(); + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getConditionALL()); @@ -342,17 +345,17 @@ public class DepotItemAction extends BaseAction //存放数据json数组 Integer pid = model.getProjectId(); JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(DepotItem depotItem:dataList) { + if (null != dataList) { + for (DepotItem depotItem : dataList) { JSONObject item = new JSONObject(); - Integer prevSum = sumNumber("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true); - Integer InSum = sumNumber("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false); - Integer OutSum = sumNumber("出库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false); - Double prevPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库",pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true); - Double InPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false); - Double OutPrice = sumPrice("出库",pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + Integer prevSum = sumNumber("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true) - sumNumber("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true); + Integer InSum = sumNumber("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + Integer OutSum = sumNumber("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + Double prevPrice = sumPrice("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true) - sumPrice("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true); + Double InPrice = sumPrice("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + Double OutPrice = sumPrice("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); item.put("Id", depotItem.getId()); - item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialId", depotItem.getMaterialId() == null ? "" : depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); //扩展信息 @@ -361,8 +364,8 @@ public class DepotItemAction extends BaseAction item.put("MaterialColor", depotItem.getMaterialId().getColor()); item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); Double unitPrice = 0.0; - if(prevSum + InSum - OutSum != 0.0){ - unitPrice = (prevPrice + InPrice - OutPrice)/(prevSum + InSum - OutSum); + if (prevSum + InSum - OutSum != 0.0) { + unitPrice = (prevPrice + InPrice - OutPrice) / (prevSum + InSum - OutSum); } item.put("UnitPrice", unitPrice); item.put("prevSum", prevSum); @@ -376,24 +379,21 @@ public class DepotItemAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); } - } + } /** * 根据商品id和仓库id查询库存数量 + * * @return */ public void findStockNumById() { try { - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getConditionById()); @@ -404,13 +404,13 @@ public class DepotItemAction extends BaseAction //存放数据json数组 Integer pid = model.getProjectId(); JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(DepotItem depotItem:dataList) { + if (null != dataList) { + for (DepotItem depotItem : dataList) { JSONObject item = new JSONObject(); - Integer prevSum = sumNumber("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true); - Integer InSum = sumNumber("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false); - Integer OutSum = sumNumber("出库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false); - item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + Integer prevSum = sumNumber("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true) - sumNumber("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true); + Integer InSum = sumNumber("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + Integer OutSum = sumNumber("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + item.put("MaterialId", depotItem.getMaterialId() == null ? "" : depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); item.put("thisSum", prevSum + InSum - OutSum); @@ -420,24 +420,21 @@ public class DepotItemAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); } } /** * 只根据商品id查询库存数量 + * * @return */ public void findStockNumByMaterialId() { try { - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getConditionById()); @@ -447,12 +444,12 @@ public class DepotItemAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(DepotItem depotItem:dataList) { + if (null != dataList) { + for (DepotItem depotItem : dataList) { JSONObject item = new JSONObject(); Integer InSum = sumNumberByMaterialId("入库", depotItem.getMaterialId().getId()); Integer OutSum = sumNumberByMaterialId("出库", depotItem.getMaterialId().getId()); - item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialId", depotItem.getMaterialId() == null ? "" : depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); item.put("thisSum", InSum - OutSum); @@ -462,24 +459,21 @@ public class DepotItemAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); } } /** * 只根据商品id查询单据列表 + * * @return */ public void findDetailByTypeAndMaterialId() { try { - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); Long mId = model.getMaterialId(); @@ -489,8 +483,8 @@ public class DepotItemAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(dataList!=null){ - for(Integer i=0; i outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); - } - catch (JshException e) { + } catch (JshException e) { e.printStackTrace(); } } /** * 查找礼品卡信息 + * * @return */ public void findGiftByAll() { try { - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getConditionALL()); @@ -532,13 +525,13 @@ public class DepotItemAction extends BaseAction //存放数据json数组 Integer pid = model.getProjectId(); JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(DepotItem depotItem:dataList){ + if (null != dataList) { + for (DepotItem depotItem : dataList) { JSONObject item = new JSONObject(); Integer InSum = sumNumberGift("礼品充值", pid, depotItem.getMaterialId().getId(), "in"); Integer OutSum = sumNumberGift("礼品销售", pid, depotItem.getMaterialId().getId(), "out"); item.put("Id", depotItem.getId()); - item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialId", depotItem.getMaterialId() == null ? "" : depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); //扩展信息 @@ -546,31 +539,28 @@ public class DepotItemAction extends BaseAction item.put("MaterialOther", materialOther); item.put("MaterialColor", depotItem.getMaterialId().getColor()); item.put("MaterialUnit", depotItem.getMaterialId().getUnit()); - item.put("thisSum", InSum - OutSum); + item.put("thisSum", InSum - OutSum); dataArray.add(item); } } outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); } } - /** - * 进货统计 - * @return - */ - public void buyIn() - { - try - { - PageUtil pageUtil = new PageUtil(); + /** + * 进货统计 + * + * @return + */ + public void buyIn() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getConditionALL()); @@ -582,17 +572,15 @@ public class DepotItemAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(DepotItem depotItem:dataList) - { + if (null != dataList) { + for (DepotItem depotItem : dataList) { JSONObject item = new JSONObject(); - Integer InSum = sumNumberBuyOrSale("入库","采购",depotItem.getMaterialId().getId(),model.getMonthTime()); - Integer OutSum = sumNumberBuyOrSale("出库","采购退货",depotItem.getMaterialId().getId(),model.getMonthTime()); - Double InSumPrice = sumPriceBuyOrSale("入库","采购",depotItem.getMaterialId().getId(),model.getMonthTime()); - Double OutSumPrice = sumPriceBuyOrSale("出库","采购退货",depotItem.getMaterialId().getId(),model.getMonthTime()); + Integer InSum = sumNumberBuyOrSale("入库", "采购", depotItem.getMaterialId().getId(), model.getMonthTime()); + Integer OutSum = sumNumberBuyOrSale("出库", "采购退货", depotItem.getMaterialId().getId(), model.getMonthTime()); + Double InSumPrice = sumPriceBuyOrSale("入库", "采购", depotItem.getMaterialId().getId(), model.getMonthTime()); + Double OutSumPrice = sumPriceBuyOrSale("出库", "采购退货", depotItem.getMaterialId().getId(), model.getMonthTime()); item.put("Id", depotItem.getId()); - item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialId", depotItem.getMaterialId() == null ? "" : depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); //扩展信息 @@ -610,25 +598,21 @@ public class DepotItemAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); } - } - /** - * 销售统计 - * @return - */ - public void saleOut() - { - try - { - PageUtil pageUtil = new PageUtil(); + } + + /** + * 销售统计 + * + * @return + */ + public void saleOut() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getConditionALL()); @@ -640,21 +624,19 @@ public class DepotItemAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(DepotItem depotItem:dataList) - { + if (null != dataList) { + for (DepotItem depotItem : dataList) { JSONObject item = new JSONObject(); - Integer OutSumRetail = sumNumberBuyOrSale("出库","零售",depotItem.getMaterialId().getId(),model.getMonthTime()); - Integer OutSum = sumNumberBuyOrSale("出库","销售",depotItem.getMaterialId().getId(),model.getMonthTime()); - Integer InSumRetail = sumNumberBuyOrSale("入库","零售退货",depotItem.getMaterialId().getId(),model.getMonthTime()); - Integer InSum = sumNumberBuyOrSale("入库","销售退货",depotItem.getMaterialId().getId(),model.getMonthTime()); - Double OutSumRetailPrice = sumPriceBuyOrSale("出库","零售",depotItem.getMaterialId().getId(),model.getMonthTime()); - Double OutSumPrice = sumPriceBuyOrSale("出库","销售",depotItem.getMaterialId().getId(),model.getMonthTime()); - Double InSumRetailPrice = sumPriceBuyOrSale("入库","零售退货",depotItem.getMaterialId().getId(),model.getMonthTime()); - Double InSumPrice = sumPriceBuyOrSale("入库","销售退货",depotItem.getMaterialId().getId(),model.getMonthTime()); + Integer OutSumRetail = sumNumberBuyOrSale("出库", "零售", depotItem.getMaterialId().getId(), model.getMonthTime()); + Integer OutSum = sumNumberBuyOrSale("出库", "销售", depotItem.getMaterialId().getId(), model.getMonthTime()); + Integer InSumRetail = sumNumberBuyOrSale("入库", "零售退货", depotItem.getMaterialId().getId(), model.getMonthTime()); + Integer InSum = sumNumberBuyOrSale("入库", "销售退货", depotItem.getMaterialId().getId(), model.getMonthTime()); + Double OutSumRetailPrice = sumPriceBuyOrSale("出库", "零售", depotItem.getMaterialId().getId(), model.getMonthTime()); + Double OutSumPrice = sumPriceBuyOrSale("出库", "销售", depotItem.getMaterialId().getId(), model.getMonthTime()); + Double InSumRetailPrice = sumPriceBuyOrSale("入库", "零售退货", depotItem.getMaterialId().getId(), model.getMonthTime()); + Double InSumPrice = sumPriceBuyOrSale("入库", "销售退货", depotItem.getMaterialId().getId(), model.getMonthTime()); item.put("Id", depotItem.getId()); - item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialId", depotItem.getMaterialId() == null ? "" : depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); //扩展信息 @@ -672,27 +654,23 @@ public class DepotItemAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); } - } - /** - * 统计总计金额 - * @return - */ - public void totalCountMoney() - { - try - { - PageUtil pageUtil = new PageUtil(); - pageUtil.setPageSize(0); - pageUtil.setCurPage(0); + } + + /** + * 统计总计金额 + * + * @return + */ + public void totalCountMoney() { + try { + PageUtil pageUtil = new PageUtil(); + pageUtil.setPageSize(0); + pageUtil.setCurPage(0); pageUtil.setAdvSearch(getConditionALL()); depotItemService.find(pageUtil); List dataList = pageUtil.getPageList(); @@ -700,63 +678,58 @@ public class DepotItemAction extends BaseAction JSONObject outer = new JSONObject(); Integer pid = model.getProjectId(); Double thisAllPrice = 0.0; - if(null != dataList) - { - for(DepotItem depotItem:dataList) - { - Double prevPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库",pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true); - Double InPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false); - Double OutPrice = sumPrice("出库",pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + if (null != dataList) { + for (DepotItem depotItem : dataList) { + Double prevPrice = sumPrice("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true) - sumPrice("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true); + Double InPrice = sumPrice("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + Double OutPrice = sumPrice("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); thisAllPrice = thisAllPrice + (prevPrice + InPrice - OutPrice); } } outer.put("totalCount", thisAllPrice); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e); } - } - + } + /** - * 导出excel表格 - * @return - */ - @SuppressWarnings("unchecked") + * 导出excel表格 + * + * @return + */ + @SuppressWarnings("unchecked") public String exportExcel() { - Log.infoFileSync("===================调用导出信息action方法exportExcel开始======================="); - try { - PageUtil pageUtil = new PageUtil(); + Log.infoFileSync("===================调用导出信息action方法exportExcel开始======================="); + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getConditionALL()); depotItemService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //存放数据json数组 Integer pid = model.getProjectId(); JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(DepotItem depotItem:dataList) { + if (null != dataList) { + for (DepotItem depotItem : dataList) { JSONObject item = new JSONObject(); - Integer prevSum = sumNumber("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumNumber("出库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true); - Integer InSum = sumNumber("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false); - Integer OutSum = sumNumber("出库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false); - Double prevPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),true) - sumPrice("出库", pid,depotItem.getMaterialId().getId(), model.getMonthTime(), true); - Double InPrice = sumPrice("入库",pid,depotItem.getMaterialId().getId(),model.getMonthTime(),false); - Double OutPrice = sumPrice("出库",pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + Integer prevSum = sumNumber("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true) - sumNumber("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true); + Integer InSum = sumNumber("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + Integer OutSum = sumNumber("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + Double prevPrice = sumPrice("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true) - sumPrice("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), true); + Double InPrice = sumPrice("入库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); + Double OutPrice = sumPrice("出库", pid, depotItem.getMaterialId().getId(), model.getMonthTime(), false); Double unitPrice = 0.0; - if(prevSum + InSum - OutSum != 0) { - unitPrice = (prevPrice + InPrice - OutPrice)/(prevSum + InSum - OutSum); + if (prevSum + InSum - OutSum != 0) { + unitPrice = (prevPrice + InPrice - OutPrice) / (prevSum + InSum - OutSum); } item.put("Id", depotItem.getId()); - item.put("MaterialId", depotItem.getMaterialId()==null?"":depotItem.getMaterialId().getId()); + item.put("MaterialId", depotItem.getMaterialId() == null ? "" : depotItem.getMaterialId().getId()); item.put("MaterialName", depotItem.getMaterialId().getName()); item.put("MaterialModel", depotItem.getMaterialId().getModel()); item.put("MaterialStandard", depotItem.getMaterialId().getStandard()); @@ -771,20 +744,20 @@ public class DepotItemAction extends BaseAction dataArray.add(item); } } - String isCurrentPage = "allPage"; - model.setFileName(Tools.changeUnicode("report.xls",model.getBrowserType())); - model.setExcelStream(depotItemService.exmportExcel(isCurrentPage,dataArray)); - } - catch (Exception e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常",e); - model.getShowModel().setMsgTip("export excel exception"); - } - Log.infoFileSync("===================调用导出信息action方法exportExcel结束=================="); - return EXCEL; - } + String isCurrentPage = "allPage"; + model.setFileName(Tools.changeUnicode("report.xls", model.getBrowserType())); + model.setExcelStream(depotItemService.exmportExcel(isCurrentPage, dataArray)); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常", e); + model.getShowModel().setMsgTip("export excel exception"); + } + Log.infoFileSync("===================调用导出信息action方法exportExcel结束=================="); + return EXCEL; + } /** * 数量合计 + * * @param type * @param MId * @param MonthTime @@ -792,46 +765,47 @@ public class DepotItemAction extends BaseAction * @return */ @SuppressWarnings("unchecked") - public Integer sumNumber(String type,Integer ProjectId,Long MId,String MonthTime, Boolean isPrev) { - Integer sumNumber = 0; - String allNumber = ""; - PageUtil pageUtil = new PageUtil(); + public Integer sumNumber(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) { + Integer sumNumber = 0; + String allNumber = ""; + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); try { - depotItemService.findByType(pageUtil, type, ProjectId, MId, MonthTime, isPrev); - allNumber = pageUtil.getPageList().toString(); - allNumber = allNumber.substring(1,allNumber.length()-1); - if(allNumber.equals("null")){ - allNumber = "0"; - } - allNumber = allNumber.replace(".0", ""); - } catch (JshException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - sumNumber = Integer.parseInt(allNumber); - return sumNumber; + depotItemService.findByType(pageUtil, type, ProjectId, MId, MonthTime, isPrev); + allNumber = pageUtil.getPageList().toString(); + allNumber = allNumber.substring(1, allNumber.length() - 1); + if (allNumber.equals("null")) { + allNumber = "0"; + } + allNumber = allNumber.replace(".0", ""); + } catch (JshException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + sumNumber = Integer.parseInt(allNumber); + return sumNumber; } /** * 仅根据商品Id进行数量合计 + * * @param type * @param MId * @return */ @SuppressWarnings("unchecked") - public Integer sumNumberByMaterialId(String type,Long MId) { + public Integer sumNumberByMaterialId(String type, Long MId) { Integer sumNumber = 0; String allNumber = ""; - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); try { depotItemService.findByTypeAndMaterialId(pageUtil, type, MId); allNumber = pageUtil.getPageList().toString(); - allNumber = allNumber.substring(1,allNumber.length()-1); - if(allNumber.equals("null")){ + allNumber = allNumber.substring(1, allNumber.length() - 1); + if (allNumber.equals("null")) { allNumber = "0"; } allNumber = allNumber.replace(".0", ""); @@ -845,6 +819,7 @@ public class DepotItemAction extends BaseAction /** * 数量合计-礼品卡 + * * @param type * @param MId * @param MonthTime @@ -852,17 +827,17 @@ public class DepotItemAction extends BaseAction * @return */ @SuppressWarnings("unchecked") - public Integer sumNumberGift(String subType,Integer ProjectId,Long MId,String type) { + public Integer sumNumberGift(String subType, Integer ProjectId, Long MId, String type) { Integer sumNumber = 0; String allNumber = ""; - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); try { - depotItemService.findGiftByType(pageUtil, subType, ProjectId, MId,type); + depotItemService.findGiftByType(pageUtil, subType, ProjectId, MId, type); allNumber = pageUtil.getPageList().toString(); - allNumber = allNumber.substring(1,allNumber.length()-1); - if(allNumber.equals("null")){ + allNumber = allNumber.substring(1, allNumber.length() - 1); + if (allNumber.equals("null")) { allNumber = "0"; } allNumber = allNumber.replace(".0", ""); @@ -876,6 +851,7 @@ public class DepotItemAction extends BaseAction /** * 价格合计 + * * @param type * @param MId * @param MonthTime @@ -883,17 +859,17 @@ public class DepotItemAction extends BaseAction * @return */ @SuppressWarnings("unchecked") - public Double sumPrice(String type,Integer ProjectId,Long MId,String MonthTime, Boolean isPrev) { + public Double sumPrice(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) { Double sumPrice = 0.0; String allPrice = ""; - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); try { depotItemService.findPriceByType(pageUtil, type, ProjectId, MId, MonthTime, isPrev); allPrice = pageUtil.getPageList().toString(); - allPrice = allPrice.substring(1,allPrice.length()-1); - if(allPrice.equals("null")){ + allPrice = allPrice.substring(1, allPrice.length() - 1); + if (allPrice.equals("null")) { allPrice = "0"; } allPrice = allPrice.replace(".0", ""); @@ -906,124 +882,125 @@ public class DepotItemAction extends BaseAction } @SuppressWarnings("unchecked") - public Integer sumNumberBuyOrSale(String type,String subType,Long MId,String MonthTime) { - Integer sumNumber = 0; - String allNumber = ""; - String sumType = "Number"; - PageUtil pageUtil = new PageUtil(); + public Integer sumNumberBuyOrSale(String type, String subType, Long MId, String MonthTime) { + Integer sumNumber = 0; + String allNumber = ""; + String sumType = "Number"; + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); try { - depotItemService.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType); - allNumber = pageUtil.getPageList().toString(); - allNumber = allNumber.substring(1,allNumber.length()-1); - if(allNumber.equals("null")){ - allNumber = "0"; - } - allNumber = allNumber.replace(".0", ""); - } catch (JshException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - sumNumber = Integer.parseInt(allNumber); - return sumNumber; + depotItemService.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType); + allNumber = pageUtil.getPageList().toString(); + allNumber = allNumber.substring(1, allNumber.length() - 1); + if (allNumber.equals("null")) { + allNumber = "0"; + } + allNumber = allNumber.replace(".0", ""); + } catch (JshException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + sumNumber = Integer.parseInt(allNumber); + return sumNumber; } + @SuppressWarnings("unchecked") - public Double sumPriceBuyOrSale(String type,String subType,Long MId,String MonthTime) { - Double sumPrice = 0.0; - String allPrice = ""; - String sumType = "Price"; - PageUtil pageUtil = new PageUtil(); + public Double sumPriceBuyOrSale(String type, String subType, Long MId, String MonthTime) { + Double sumPrice = 0.0; + String allPrice = ""; + String sumType = "Price"; + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); try { - depotItemService.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType); - allPrice = pageUtil.getPageList().toString(); - allPrice = allPrice.substring(1,allPrice.length()-1); - if(allPrice.equals("null")){ - allPrice = "0"; - } - allPrice = allPrice.replace(".0", ""); - } catch (JshException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - sumPrice = Double.parseDouble(allPrice); - return sumPrice; + depotItemService.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType); + allPrice = pageUtil.getPageList().toString(); + allPrice = allPrice.substring(1, allPrice.length() - 1); + if (allPrice.equals("null")) { + allPrice = "0"; + } + allPrice = allPrice.replace(".0", ""); + } catch (JshException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + sumPrice = Double.parseDouble(allPrice); + return sumPrice; } /** * 获取扩展信息 + * * @return */ - public String getOtherInfo(String[] mpArr, DepotItem depotItem){ + public String getOtherInfo(String[] mpArr, DepotItem depotItem) { String materialOther = ""; - for(int i=0; i< mpArr.length; i++) { - if(mpArr[i].equals("颜色")) { - materialOther = materialOther + ((depotItem.getMaterialId().getColor() == null || depotItem.getMaterialId().getColor().equals(""))?"":"("+depotItem.getMaterialId().getColor() + ")"); + for (int i = 0; i < mpArr.length; i++) { + if (mpArr[i].equals("颜色")) { + materialOther = materialOther + ((depotItem.getMaterialId().getColor() == null || depotItem.getMaterialId().getColor().equals("")) ? "" : "(" + depotItem.getMaterialId().getColor() + ")"); } - if(mpArr[i].equals("规格")) { - materialOther = materialOther + ((depotItem.getMaterialId().getStandard() == null || depotItem.getMaterialId().getStandard().equals(""))?"":"("+depotItem.getMaterialId().getStandard() + ")"); + if (mpArr[i].equals("规格")) { + materialOther = materialOther + ((depotItem.getMaterialId().getStandard() == null || depotItem.getMaterialId().getStandard().equals("")) ? "" : "(" + depotItem.getMaterialId().getStandard() + ")"); } - if(mpArr[i].equals("制造商")) { - materialOther = materialOther + ((depotItem.getMaterialId().getMfrs() == null || depotItem.getMaterialId().getMfrs().equals(""))?"":"("+depotItem.getMaterialId().getMfrs() + ")"); + if (mpArr[i].equals("制造商")) { + materialOther = materialOther + ((depotItem.getMaterialId().getMfrs() == null || depotItem.getMaterialId().getMfrs().equals("")) ? "" : "(" + depotItem.getMaterialId().getMfrs() + ")"); } - if(mpArr[i].equals("自定义1")) { - materialOther = materialOther + ((depotItem.getMaterialId().getOtherField1() == null || depotItem.getMaterialId().getOtherField1().equals(""))?"":"("+depotItem.getMaterialId().getOtherField1() + ")"); + if (mpArr[i].equals("自定义1")) { + materialOther = materialOther + ((depotItem.getMaterialId().getOtherField1() == null || depotItem.getMaterialId().getOtherField1().equals("")) ? "" : "(" + depotItem.getMaterialId().getOtherField1() + ")"); } - if(mpArr[i].equals("自定义2")) { - materialOther = materialOther + ((depotItem.getMaterialId().getOtherField2() == null || depotItem.getMaterialId().getOtherField2().equals(""))?"":"("+depotItem.getMaterialId().getOtherField2() + ")"); + if (mpArr[i].equals("自定义2")) { + materialOther = materialOther + ((depotItem.getMaterialId().getOtherField2() == null || depotItem.getMaterialId().getOtherField2().equals("")) ? "" : "(" + depotItem.getMaterialId().getOtherField2() + ")"); } - if(mpArr[i].equals("自定义3")) { - materialOther = materialOther + ((depotItem.getMaterialId().getOtherField3() == null || depotItem.getMaterialId().getOtherField3().equals(""))?"":"("+depotItem.getMaterialId().getOtherField3() + ")"); + if (mpArr[i].equals("自定义3")) { + materialOther = materialOther + ((depotItem.getMaterialId().getOtherField3() == null || depotItem.getMaterialId().getOtherField3().equals("")) ? "" : "(" + depotItem.getMaterialId().getOtherField3() + ")"); } } - return materialOther; + return materialOther; } - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("HeaderId_n_eq", model.getHeaderId()); - condition.put("Id_s_order","asc"); - return condition; - } - - private Map getConditionALL() - { - /** - * 拼接搜索条件 - */ - Map condition = new HashMap(); - condition.put("HeaderId_s_in", model.getHeadIds()); - condition.put("MaterialId_s_in", model.getMaterialIds()); - condition.put("MaterialId_s_gb","aaa"); + condition.put("Id_s_order", "asc"); return condition; } - private Map getConditionById() { + private Map getConditionALL() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); + condition.put("HeaderId_s_in", model.getHeadIds()); + condition.put("MaterialId_s_in", model.getMaterialIds()); + condition.put("MaterialId_s_gb", "aaa"); + return condition; + } + + private Map getConditionById() { + /** + * 拼接搜索条件 + */ + Map condition = new HashMap(); condition.put("MaterialId_n_eq", model.getMaterialId()); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public DepotItemModel getModel() - { - return model; - } - public void setDepotItemService(DepotItemIService depotItemService) - { + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public DepotItemModel getModel() { + return model; + } + + public void setDepotItemService(DepotItemIService depotItemService) { this.depotItemService = depotItemService; } diff --git a/src/main/java/com/jsh/action/materials/MaterialAction.java b/src/main/java/com/jsh/action/materials/MaterialAction.java index ba70e161..cea03a7d 100644 --- a/src/main/java/com/jsh/action/materials/MaterialAction.java +++ b/src/main/java/com/jsh/action/materials/MaterialAction.java @@ -1,5 +1,21 @@ package com.jsh.action.materials; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.Material; +import com.jsh.model.po.MaterialCategory; +import com.jsh.model.po.Unit; +import com.jsh.model.vo.materials.MaterialModel; +import com.jsh.service.materials.MaterialIService; +import com.jsh.util.JshException; +import com.jsh.util.MaterialConstants; +import com.jsh.util.PageUtil; +import com.jsh.util.Tools; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + import java.io.IOException; import java.io.InputStream; import java.sql.Timestamp; @@ -8,237 +24,197 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.jsh.model.po.*; -import com.jsh.util.JshException; -import com.jsh.util.MaterialConstants; -import com.jsh.util.Tools; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.model.vo.materials.MaterialModel; -import com.jsh.service.materials.MaterialIService; -import com.jsh.util.PageUtil; /* * 商品管理 - * @author jishenghua qq:752718920 -*/ + * @author jishenghua qq:752718920 + */ @SuppressWarnings("serial") -public class MaterialAction extends BaseAction -{ +public class MaterialAction extends BaseAction { + public static final String EXCEL = "excel"; //action返回excel结果 private MaterialIService materialService; private MaterialModel model = new MaterialModel(); - public static final String EXCEL = "excel"; //action返回excel结果 - - /** - * 增加商品 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加商品信息方法create()==================="); - Boolean flag = false; - try - { - Material material = new Material(); - material.setMaterialCategory(new MaterialCategory(model.getCategoryId())); - - material.setName(model.getName()); + + /** + * 增加商品 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加商品信息方法create()==================="); + Boolean flag = false; + try { + Material material = new Material(); + material.setMaterialCategory(new MaterialCategory(model.getCategoryId())); + + material.setName(model.getName()); material.setMfrs(model.getMfrs()); material.setPacking(model.getPacking()); material.setSafetyStock(model.getSafetyStock()); - material.setModel(model.getModel()); + material.setModel(model.getModel()); material.setStandard(model.getStandard()); - material.setColor(model.getColor()); - material.setUnit(model.getUnit()); + material.setColor(model.getColor()); + material.setUnit(model.getUnit()); material.setRetailPrice(model.getRetailPrice()); material.setLowPrice(model.getLowPrice()); material.setPresetPriceOne(model.getPresetPriceOne()); material.setPresetPriceTwo(model.getPresetPriceTwo()); - if(model.getUnitId()!=null){ + if (model.getUnitId() != null) { material.setUnitId(new Unit(model.getUnitId())); - } - else { + } else { material.setUnitId(null); } material.setFirstOutUnit(model.getFirstOutUnit()); material.setFirstInUnit(model.getFirstInUnit()); material.setPriceStrategy(model.getPriceStrategy()); - material.setRemark(model.getRemark()); + material.setRemark(model.getRemark()); material.setEnabled(model.getEnabled()); material.setOtherField1(model.getOtherField1()); material.setOtherField2(model.getOtherField2()); material.setOtherField3(model.getOtherField3()); - materialService.create(material); - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加商品信息异常", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>增加商品信息回写客户端结果异常", e); - } - } - - logService.create(new Logdetails(getUser(), "增加商品", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加商品名称为 "+ model.getName() + " " + tipMsg + "!", "增加商品" + tipMsg)); - Log.infoFileSync("==================结束调用增加商品方法create()==================="); - } - - /** - * 删除商品 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除商品信息方法delete()================"); - try - { - materialService.delete(model.getMaterialID()); + materialService.create(material); + + //========标识位=========== + flag = true; + //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialID() + " 的商品异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加商品信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>增加商品信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加商品", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加商品名称为 " + model.getName() + " " + tipMsg + "!", "增加商品" + tipMsg)); + Log.infoFileSync("==================结束调用增加商品方法create()==================="); + } + + /** + * 删除商品 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除商品信息方法delete()================"); + try { + materialService.delete(model.getMaterialID()); + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialID() + " 的商品异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除商品", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除商品ID为 "+ model.getMaterialID() + " " + tipMsg + "!", "删除商品" + tipMsg)); - Log.infoFileSync("====================结束调用删除商品信息方法delete()================"); - return SUCCESS; - } - - /** - * 更新商品 - * @return - */ - public void update() - { - Boolean flag = false; - try - { - Material material = materialService.get(model.getMaterialID()); - material.setMaterialCategory(new MaterialCategory(model.getCategoryId())); - - material.setName(model.getName()); + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除商品", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除商品ID为 " + model.getMaterialID() + " " + tipMsg + "!", "删除商品" + tipMsg)); + Log.infoFileSync("====================结束调用删除商品信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新商品 + * + * @return + */ + public void update() { + Boolean flag = false; + try { + Material material = materialService.get(model.getMaterialID()); + material.setMaterialCategory(new MaterialCategory(model.getCategoryId())); + + material.setName(model.getName()); material.setMfrs(model.getMfrs()); material.setPacking(model.getPacking()); material.setSafetyStock(model.getSafetyStock()); - material.setModel(model.getModel()); + material.setModel(model.getModel()); material.setStandard(model.getStandard()); - material.setColor(model.getColor()); - material.setUnit(model.getUnit()); + material.setColor(model.getColor()); + material.setUnit(model.getUnit()); material.setRetailPrice(model.getRetailPrice()); material.setLowPrice(model.getLowPrice()); material.setPresetPriceOne(model.getPresetPriceOne()); material.setPresetPriceTwo(model.getPresetPriceTwo()); - if(model.getUnitId()!=null){ + if (model.getUnitId() != null) { material.setUnitId(new Unit(model.getUnitId())); - } - else { + } else { material.setUnitId(null); } material.setFirstOutUnit(model.getFirstOutUnit()); material.setFirstInUnit(model.getFirstInUnit()); material.setPriceStrategy(model.getPriceStrategy()); - material.setRemark(model.getRemark()); + material.setRemark(model.getRemark()); material.setOtherField1(model.getOtherField1()); material.setOtherField2(model.getOtherField2()); material.setOtherField3(model.getOtherField3()); - materialService.update(material); - + materialService.update(material); + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改商品ID为 : " + model.getMaterialID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改商品回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新商品", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新商品ID为 "+ model.getMaterialID() + " " + tipMsg + "!", "更新商品" + tipMsg)); - } - - /** - * 批量删除指定ID商品 - * @return - */ - public String batchDelete() - { - try - { - materialService.batchDelete(model.getMaterialIDs()); + , tipType, "更新商品ID为 " + model.getMaterialID() + " " + tipMsg + "!", "更新商品" + tipMsg)); + } + + /** + * 批量删除指定ID商品 + * + * @return + */ + public String batchDelete() { + try { + materialService.batchDelete(model.getMaterialIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除商品ID为:" + model.getMaterialIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除商品ID为:" + model.getMaterialIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除商品", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除商品", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除商品ID为 "+ model.getMaterialIDs() + " " + tipMsg + "!", "批量删除商品" + tipMsg)); - return SUCCESS; - } + , tipType, "批量删除商品ID为 " + model.getMaterialIDs() + " " + tipMsg + "!", "批量删除商品" + tipMsg)); + return SUCCESS; + } /** * 批量设置状态-启用或者禁用 + * * @return */ - public String batchSetEnable() - { - try - { - materialService.batchSetEnable(model.getEnabled(),model.getMaterialIDs()); + public String batchSetEnable() { + try { + materialService.batchSetEnable(model.getEnabled(), model.getMaterialIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>批量修改状态,商品ID为:" + model.getMaterialIDs() + "信息异常", e); tipMsg = "失败"; tipType = 1; @@ -246,58 +222,53 @@ public class MaterialAction extends BaseAction logService.create(new Logdetails(getUser(), "批量修改商品状态", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量修改状态,商品ID为 "+ model.getMaterialIDs() + " " + tipMsg + "!", "批量修改商品状态" + tipMsg)); + , tipType, "批量修改状态,商品ID为 " + model.getMaterialIDs() + " " + tipMsg + "!", "批量修改商品状态" + tipMsg)); return SUCCESS; } /** * 查找该商品是否存在 + * * @return */ public void checkIsExist() { try { Boolean flag = false; - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getConditionCheckIsExist()); materialService.find(pageUtil); List dataList = pageUtil.getPageList(); - if(null != dataList && dataList.size() > 0){ + if (null != dataList && dataList.size() > 0) { flag = true; - } - else{ + } else { flag = false; } //回写查询结果 toClient(flag.toString()); - } - catch (DataAccessException e) { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品信息异常", e); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品信息结果异常", e); } } - - /** - * 查找商品信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + + /** + * 查找商品信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); - Long lei=model.getCategoryId(); - if(1==lei) //判断值还真不能用String类型的判断 - { - pageUtil.setAdvSearch(getCondition_all()); - } - else if(1!=lei) + Long lei = model.getCategoryId(); + if (1 == lei) //判断值还真不能用String类型的判断 { + pageUtil.setAdvSearch(getCondition_all()); + } else if (1 != lei) { pageUtil.setAdvSearch(getCondition()); } materialService.find(pageUtil); @@ -309,59 +280,57 @@ public class MaterialAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Material material:dataList) - { + if (null != dataList) { + for (Material material : dataList) { JSONObject item = new JSONObject(); item.put("Id", material.getId()); item.put("Name", material.getName()); item.put("CategoryId", material.getMaterialCategory().getId()); //类型Id item.put("CategoryName", material.getMaterialCategory().getName()); //类型名称 - item.put("Packing", material.getPacking()==null?"" : material.getPacking()); - item.put("SafetyStock", material.getSafetyStock()==null?"" : material.getSafetyStock()); - item.put("Model", material.getModel()==null?"" : material.getModel()); + item.put("Packing", material.getPacking() == null ? "" : material.getPacking()); + item.put("SafetyStock", material.getSafetyStock() == null ? "" : material.getSafetyStock()); + item.put("Model", material.getModel() == null ? "" : material.getModel()); //扩展信息 String materialOther = ""; - for(int i=0; i< mpArr.length; i++) { - if(mpArr[i].equals("颜色")) { - materialOther = materialOther + ((material.getColor() == null || material.getColor().equals(""))?"":"("+material.getColor() + ")"); + for (int i = 0; i < mpArr.length; i++) { + if (mpArr[i].equals("颜色")) { + materialOther = materialOther + ((material.getColor() == null || material.getColor().equals("")) ? "" : "(" + material.getColor() + ")"); } - if(mpArr[i].equals("规格")) { - materialOther = materialOther + ((material.getStandard() == null || material.getStandard().equals(""))?"":"("+material.getStandard() + ")"); + if (mpArr[i].equals("规格")) { + materialOther = materialOther + ((material.getStandard() == null || material.getStandard().equals("")) ? "" : "(" + material.getStandard() + ")"); } - if(mpArr[i].equals("制造商")) { - materialOther = materialOther + ((material.getMfrs() == null || material.getMfrs().equals(""))?"":"("+material.getMfrs() + ")"); + if (mpArr[i].equals("制造商")) { + materialOther = materialOther + ((material.getMfrs() == null || material.getMfrs().equals("")) ? "" : "(" + material.getMfrs() + ")"); } - if(mpArr[i].equals("自定义1")) { - materialOther = materialOther + ((material.getOtherField1() == null || material.getOtherField1().equals(""))?"":"("+material.getOtherField1() + ")"); + if (mpArr[i].equals("自定义1")) { + materialOther = materialOther + ((material.getOtherField1() == null || material.getOtherField1().equals("")) ? "" : "(" + material.getOtherField1() + ")"); } - if(mpArr[i].equals("自定义2")) { - materialOther = materialOther + ((material.getOtherField2() == null || material.getOtherField2().equals(""))?"":"("+material.getOtherField2() + ")"); + if (mpArr[i].equals("自定义2")) { + materialOther = materialOther + ((material.getOtherField2() == null || material.getOtherField2().equals("")) ? "" : "(" + material.getOtherField2() + ")"); } - if(mpArr[i].equals("自定义3")) { - materialOther = materialOther + ((material.getOtherField3() == null || material.getOtherField3().equals(""))?"":"("+material.getOtherField3() + ")"); + if (mpArr[i].equals("自定义3")) { + materialOther = materialOther + ((material.getOtherField3() == null || material.getOtherField3().equals("")) ? "" : "(" + material.getOtherField3() + ")"); } } item.put("MaterialOther", materialOther); - item.put("Unit", material.getUnit()==null?"": material.getUnit()); + item.put("Unit", material.getUnit() == null ? "" : material.getUnit()); item.put("RetailPrice", material.getRetailPrice()); item.put("LowPrice", material.getLowPrice()); - item.put("PresetPriceOne", material.getPresetPriceOne()==null? "":material.getPresetPriceOne()); - item.put("PresetPriceTwo", material.getPresetPriceTwo()==null? "":material.getPresetPriceTwo()); - item.put("UnitId",material.getUnitId()==null? "": material.getUnitId().getId()); //计量单位Id - item.put("UnitName", material.getUnitId()==null? "": material.getUnitId().getUName()); //计量单位名称 + item.put("PresetPriceOne", material.getPresetPriceOne() == null ? "" : material.getPresetPriceOne()); + item.put("PresetPriceTwo", material.getPresetPriceTwo() == null ? "" : material.getPresetPriceTwo()); + item.put("UnitId", material.getUnitId() == null ? "" : material.getUnitId().getId()); //计量单位Id + item.put("UnitName", material.getUnitId() == null ? "" : material.getUnitId().getUName()); //计量单位名称 item.put("FirstOutUnit", material.getFirstOutUnit()); item.put("FirstInUnit", material.getFirstInUnit()); item.put("PriceStrategy", material.getPriceStrategy()); item.put("Enabled", material.getEnabled()); item.put("Remark", material.getRemark()); - item.put("Color", material.getColor()==null?"" : material.getColor()); - item.put("Standard", material.getStandard()==null?"" : material.getStandard()); - item.put("Mfrs", material.getMfrs()==null?"" : material.getMfrs()); - item.put("OtherField1", material.getOtherField1()==null?"" : material.getOtherField1()); - item.put("OtherField2", material.getOtherField2()==null?"" : material.getOtherField2()); - item.put("OtherField3", material.getOtherField3()==null?"" : material.getOtherField3()); + item.put("Color", material.getColor() == null ? "" : material.getColor()); + item.put("Standard", material.getStandard() == null ? "" : material.getStandard()); + item.put("Mfrs", material.getMfrs() == null ? "" : material.getMfrs()); + item.put("OtherField1", material.getOtherField1() == null ? "" : material.getOtherField1()); + item.put("OtherField2", material.getOtherField2() == null ? "" : material.getOtherField2()); + item.put("OtherField3", material.getOtherField3() == null ? "" : material.getOtherField3()); item.put("op", 1); dataArray.add(item); } @@ -369,25 +338,21 @@ public class MaterialAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品信息结果异常", e); } - } + } /** * 根据id来查询商品名称 + * * @return */ public void findById() { - try - { - PageUtil pageUtil = new PageUtil(); + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setAdvSearch(getConditionById()); materialService.find(pageUtil); List dataList = pageUtil.getPageList(); @@ -395,26 +360,24 @@ public class MaterialAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Material material:dataList) - { + if (null != dataList) { + for (Material material : dataList) { JSONObject item = new JSONObject(); item.put("Id", material.getId()); item.put("Name", material.getName()); - item.put("Mfrs", material.getMfrs()==null?"" : material.getMfrs()); - item.put("Packing", material.getPacking()==null?"" : material.getPacking()); - item.put("SafetyStock", material.getSafetyStock()==null?"" : material.getSafetyStock()); + item.put("Mfrs", material.getMfrs() == null ? "" : material.getMfrs()); + item.put("Packing", material.getPacking() == null ? "" : material.getPacking()); + item.put("SafetyStock", material.getSafetyStock() == null ? "" : material.getSafetyStock()); item.put("Model", material.getModel()); item.put("Standard", material.getStandard()); - item.put("Color", material.getColor()==null?"": material.getColor()); + item.put("Color", material.getColor() == null ? "" : material.getColor()); item.put("Unit", material.getUnit()); item.put("RetailPrice", material.getRetailPrice()); item.put("LowPrice", material.getLowPrice()); item.put("PresetPriceOne", material.getPresetPriceOne()); item.put("PresetPriceTwo", material.getPresetPriceTwo()); - item.put("UnitId",material.getUnitId()==null? "": material.getUnitId().getId()); //计量单位Id - item.put("UnitName", material.getUnitId()==null? "": material.getUnitId().getUName()); //计量单位名称 + item.put("UnitId", material.getUnitId() == null ? "" : material.getUnitId().getId()); //计量单位Id + item.put("UnitName", material.getUnitId() == null ? "" : material.getUnitId().getUName()); //计量单位名称 item.put("FirstOutUnit", material.getFirstOutUnit()); item.put("FirstInUnit", material.getFirstInUnit()); item.put("PriceStrategy", material.getPriceStrategy()); @@ -426,24 +389,21 @@ public class MaterialAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品信息结果异常", e); } } /** - * 查找商品信息-下拉框 - * @return - */ + * 查找商品信息-下拉框 + * + * @return + */ public void findBySelect() { - try { - PageUtil pageUtil = new PageUtil(); + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition_Select()); @@ -453,101 +413,92 @@ public class MaterialAction extends BaseAction String[] mpArr = mpList.split(","); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(Material material:dataList) { + if (null != dataList) { + for (Material material : dataList) { JSONObject item = new JSONObject(); item.put("Id", material.getId()); String ratio; //比例 - if(material.getUnitId() == null || material.getUnitId().equals("")){ + if (material.getUnitId() == null || material.getUnitId().equals("")) { ratio = ""; - } - else { + } else { ratio = material.getUnitId().getUName(); ratio = ratio.substring(ratio.indexOf("(")); } //品名/型号/扩展信息/包装 - String MaterialName = material.getName() + ((material.getModel() == null || material.getModel().equals(""))?"":"("+material.getModel() + ")"); - for(int i=0; i< mpArr.length; i++) { - if(mpArr[i].equals("颜色")) { - MaterialName = MaterialName + ((material.getColor() == null || material.getColor().equals(""))?"":"("+material.getColor() + ")"); + String MaterialName = material.getName() + ((material.getModel() == null || material.getModel().equals("")) ? "" : "(" + material.getModel() + ")"); + for (int i = 0; i < mpArr.length; i++) { + if (mpArr[i].equals("颜色")) { + MaterialName = MaterialName + ((material.getColor() == null || material.getColor().equals("")) ? "" : "(" + material.getColor() + ")"); } - if(mpArr[i].equals("规格")) { - MaterialName = MaterialName + ((material.getStandard() == null || material.getStandard().equals(""))?"":"("+material.getStandard() + ")"); + if (mpArr[i].equals("规格")) { + MaterialName = MaterialName + ((material.getStandard() == null || material.getStandard().equals("")) ? "" : "(" + material.getStandard() + ")"); } - if(mpArr[i].equals("制造商")) { - MaterialName = MaterialName + ((material.getMfrs() == null || material.getMfrs().equals(""))?"":"("+material.getMfrs() + ")"); + if (mpArr[i].equals("制造商")) { + MaterialName = MaterialName + ((material.getMfrs() == null || material.getMfrs().equals("")) ? "" : "(" + material.getMfrs() + ")"); } - if(mpArr[i].equals("自定义1")) { - MaterialName = MaterialName + ((material.getOtherField1() == null || material.getOtherField1().equals(""))?"":"("+material.getOtherField1() + ")"); + if (mpArr[i].equals("自定义1")) { + MaterialName = MaterialName + ((material.getOtherField1() == null || material.getOtherField1().equals("")) ? "" : "(" + material.getOtherField1() + ")"); } - if(mpArr[i].equals("自定义2")) { - MaterialName = MaterialName + ((material.getOtherField2() == null || material.getOtherField2().equals(""))?"":"("+material.getOtherField2() + ")"); + if (mpArr[i].equals("自定义2")) { + MaterialName = MaterialName + ((material.getOtherField2() == null || material.getOtherField2().equals("")) ? "" : "(" + material.getOtherField2() + ")"); } - if(mpArr[i].equals("自定义3")) { - MaterialName = MaterialName + ((material.getOtherField3() == null || material.getOtherField3().equals(""))?"":"("+material.getOtherField3() + ")"); + if (mpArr[i].equals("自定义3")) { + MaterialName = MaterialName + ((material.getOtherField3() == null || material.getOtherField3().equals("")) ? "" : "(" + material.getOtherField3() + ")"); } } - MaterialName = MaterialName + ((material.getUnit() == null || material.getUnit().equals(""))?"":"("+material.getUnit() + ")") + ratio; + MaterialName = MaterialName + ((material.getUnit() == null || material.getUnit().equals("")) ? "" : "(" + material.getUnit() + ")") + ratio; item.put("MaterialName", MaterialName); dataArray.add(item); } } //回写查询结果 toClient(dataArray.toString()); - } - catch (DataAccessException e) { - Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); - } - catch (IOException e) { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e); } catch (Exception e) { e.printStackTrace(); } } - - /** - * 查找商品信息-统计排序 - * @return - */ - public void findByOrder() - { - try - { - PageUtil pageUtil = new PageUtil(); + + /** + * 查找商品信息-统计排序 + * + * @return + */ + public void findByOrder() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition_Order()); materialService.find(pageUtil); List dataList = pageUtil.getPageList(); //存放数据json数组 - JSONObject outer = new JSONObject(); + JSONObject outer = new JSONObject(); String mId = ""; - if(null != dataList) - { - for(Material material:dataList) - { - mId = mId + material.getId() + ","; + if (null != dataList) { + for (Material material : dataList) { + mId = mId + material.getId() + ","; } } - if(mId!="") { - mId = mId.substring(0, mId.lastIndexOf(",")); - } - outer.put("mIds", mId); + if (mId != "") { + mId = mId.substring(0, mId.lastIndexOf(",")); + } + outer.put("mIds", mId); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>查找供应商信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询供应商信息结果异常", e); } - } + } /** * 导入excel表格-供应商 + * * @return */ @SuppressWarnings("unchecked") @@ -558,13 +509,11 @@ public class MaterialAction extends BaseAction try { InputStream in = materialService.importExcel(model.getMaterialFile()); - if(null != in) - { + if (null != in) { model.setFileName(Tools.getRandomChar() + Tools.getNow2(Calendar.getInstance().getTime()) + "_wrong.xls"); model.setExcelStream(in); returnStr = MaterialConstants.BusinessForExcel.EXCEL; - } - else { + } else { result = true; try { toClient(result.toString()); @@ -575,9 +524,7 @@ public class MaterialAction extends BaseAction returnStr = SUCCESS; } - } - catch (JshException e) - { + } catch (JshException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>导入excel表格信息异常", e); } return returnStr; @@ -585,6 +532,7 @@ public class MaterialAction extends BaseAction /** * 导出excel表格 + * * @return */ @SuppressWarnings("unchecked") @@ -592,47 +540,47 @@ public class MaterialAction extends BaseAction Log.infoFileSync("===================调用导出信息action方法exportExcel开始======================="); try { String sName = "pageUtilMaterial"; - PageUtil pageUtil = (PageUtil)getSession().get(sName); + PageUtil pageUtil = (PageUtil) getSession().get(sName); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); String isCurrentPage = "allPage"; model.setFileName(Tools.changeUnicode("goods" + System.currentTimeMillis() + ".xls", model.getBrowserType())); - model.setExcelStream(materialService.exmportExcel(isCurrentPage,pageUtil)); - } - catch (Exception e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常",e); + model.setExcelStream(materialService.exmportExcel(isCurrentPage, pageUtil)); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>调用导出信息action方法exportExcel异常", e); model.getShowModel().setMsgTip("export excel exception"); } Log.infoFileSync("===================调用导出信息action方法exportExcel结束=================="); return EXCEL; } - - /** - * 拼接搜索条件(查全部) - * @return - */ - private Map getCondition_all() - { + + /** + * 拼接搜索条件(查全部) + * + * @return + */ + private Map getCondition_all() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Name_s_like", model.getName()); condition.put("Model_s_like", model.getModel()); condition.put("Color_s_like", model.getColor()); condition.put("Id_s_order", "asc"); return condition; } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() { + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Name_s_like", model.getName()); condition.put("Model_s_like", model.getModel()); condition.put("Color_s_like", model.getColor()); @@ -641,9 +589,9 @@ public class MaterialAction extends BaseAction return condition; } - private Map getConditionCheckIsExist() { - Map condition = new HashMap(); - if(model.getMaterialID()>0){ + private Map getConditionCheckIsExist() { + Map condition = new HashMap(); + if (model.getMaterialID() > 0) { condition.put("ID_n_neq", model.getMaterialID()); } condition.put("Name_s_eq", model.getName()); @@ -654,10 +602,10 @@ public class MaterialAction extends BaseAction condition.put("OtherField1_s_eq", model.getOtherField1()); condition.put("OtherField2_s_eq", model.getOtherField2()); condition.put("OtherField3_s_eq", model.getOtherField3()); - if(model.getUnit()!=null){ + if (model.getUnit() != null) { condition.put("Unit_s_eq", model.getUnit()); } - if(model.getUnitId()!=null){ + if (model.getUnitId() != null) { condition.put("UnitId_n_eq", model.getUnitId()); } return condition; @@ -665,55 +613,54 @@ public class MaterialAction extends BaseAction /** * 拼接搜索条件 + * * @return */ - private Map getConditionById() - { + private Map getConditionById() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Id_n_eq", model.getMaterialID()); return condition; } - - /** - * 拼接搜索条件-下拉框 - * @return - */ - private Map getCondition_Select() - { + + /** + * 拼接搜索条件-下拉框 + * + * @return + */ + private Map getCondition_Select() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); - condition.put("enabled_s_eq",1); + Map condition = new HashMap(); + condition.put("enabled_s_eq", 1); condition.put("Id_s_order", "asc"); return condition; } - - /** - * 拼接搜索条件-下拉框 - * @return - */ - private Map getCondition_Order() - { + + /** + * 拼接搜索条件-下拉框 + * + * @return + */ + private Map getCondition_Order() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Name,Model_s_order", "asc"); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public MaterialModel getModel() - { - return model; - } - public void setMaterialService(MaterialIService materialService) - { + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public MaterialModel getModel() { + return model; + } + + public void setMaterialService(MaterialIService materialService) { this.materialService = materialService; } } diff --git a/src/main/java/com/jsh/action/materials/MaterialCategoryAction.java b/src/main/java/com/jsh/action/materials/MaterialCategoryAction.java index accacc3e..55497855 100644 --- a/src/main/java/com/jsh/action/materials/MaterialCategoryAction.java +++ b/src/main/java/com/jsh/action/materials/MaterialCategoryAction.java @@ -1,215 +1,189 @@ package com.jsh.action.materials; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.MaterialCategory; +import com.jsh.model.vo.materials.MaterialCategoryModel; +import com.jsh.service.materials.MaterialCategoryIService; +import com.jsh.util.PageUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + import java.io.IOException; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.model.po.MaterialCategory; -import com.jsh.model.po.Logdetails; -import com.jsh.model.vo.materials.MaterialCategoryModel; -import com.jsh.service.materials.MaterialCategoryIService; -import com.jsh.util.PageUtil; + /* * 商品类型管理 * @author jishenghua qq:752718920 -*/ + */ @SuppressWarnings("serial") -public class MaterialCategoryAction extends BaseAction -{ +public class MaterialCategoryAction extends BaseAction { private MaterialCategoryIService materialCategoryService; private MaterialCategoryModel model = new MaterialCategoryModel(); - - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public String getBasicData() - { - Map mapData = model.getShowModel().getMap(); - PageUtil pageUtil = new PageUtil(); + + + @SuppressWarnings({"rawtypes", "unchecked"}) + public String getBasicData() { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - try - { - Map condition = pageUtil.getAdvSearch(); + try { + Map condition = pageUtil.getAdvSearch(); condition.put("ParentId_n_eq", model.getParentId()); condition.put("Id_n_neq", 1); condition.put("Id_s_order", "asc"); materialCategoryService.find(pageUtil); mapData.put("materialCategoryList", pageUtil.getPageList()); - } - catch (Exception e) - { + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>查找商品类别信息异常", e); model.getShowModel().setMsgTip("exceptoin"); } return SUCCESS; } - - /** - * 增加商品类别 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加商品类别信息方法create()==================="); - Boolean flag = false; - try - { - MaterialCategory materialCategory = new MaterialCategory(); - materialCategory.setMaterialCategory(new MaterialCategory(model.getParentId())); - - materialCategory.setCategoryLevel(model.getCategoryLevel()); - materialCategory.setName(model.getName()); - materialCategoryService.create(materialCategory); - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加商品类别信息异常", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>增加商品类别信息回写客户端结果异常", e); - } - } - - logService.create(new Logdetails(getUser(), "增加商品类别", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加商品类别名称为 "+ model.getName() + " " + tipMsg + "!", "增加商品类别" + tipMsg)); - Log.infoFileSync("==================结束调用增加商品类别方法create()==================="); - } - - /** - * 删除商品类别 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除商品类别信息方法delete()================"); - try - { - materialCategoryService.delete(model.getMaterialCategoryID()); + + /** + * 增加商品类别 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加商品类别信息方法create()==================="); + Boolean flag = false; + try { + MaterialCategory materialCategory = new MaterialCategory(); + materialCategory.setMaterialCategory(new MaterialCategory(model.getParentId())); + + materialCategory.setCategoryLevel(model.getCategoryLevel()); + materialCategory.setName(model.getName()); + materialCategoryService.create(materialCategory); + + //========标识位=========== + flag = true; + //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialCategoryID() + " 的商品类别异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加商品类别信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>增加商品类别信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加商品类别", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加商品类别名称为 " + model.getName() + " " + tipMsg + "!", "增加商品类别" + tipMsg)); + Log.infoFileSync("==================结束调用增加商品类别方法create()==================="); + } + + /** + * 删除商品类别 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除商品类别信息方法delete()================"); + try { + materialCategoryService.delete(model.getMaterialCategoryID()); + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getMaterialCategoryID() + " 的商品类别异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除商品类别", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除商品类别ID为 "+ model.getMaterialCategoryID() + " " + tipMsg + "!", "删除商品类别" + tipMsg)); - Log.infoFileSync("====================结束调用删除商品类别信息方法delete()================"); - return SUCCESS; - } - - /** - * 更新商品类别 - * @return - */ - public void update() - { - Boolean flag = false; - try - { - MaterialCategory materialCategory = materialCategoryService.get(model.getMaterialCategoryID()); - materialCategory.setMaterialCategory(new MaterialCategory(model.getParentId())); - - materialCategory.setCategoryLevel(model.getCategoryLevel()); - materialCategory.setName(model.getName()); - materialCategoryService.update(materialCategory); - + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除商品类别", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除商品类别ID为 " + model.getMaterialCategoryID() + " " + tipMsg + "!", "删除商品类别" + tipMsg)); + Log.infoFileSync("====================结束调用删除商品类别信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新商品类别 + * + * @return + */ + public void update() { + Boolean flag = false; + try { + MaterialCategory materialCategory = materialCategoryService.get(model.getMaterialCategoryID()); + materialCategory.setMaterialCategory(new MaterialCategory(model.getParentId())); + + materialCategory.setCategoryLevel(model.getCategoryLevel()); + materialCategory.setName(model.getName()); + materialCategoryService.update(materialCategory); + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改商品类别ID为 : " + model.getMaterialCategoryID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改商品类别回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新商品类别", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新商品类别ID为 "+ model.getMaterialCategoryID() + " " + tipMsg + "!", "更新商品类别" + tipMsg)); - } - - /** - * 批量删除指定ID商品类别 - * @return - */ - public String batchDelete() - { - try - { - materialCategoryService.batchDelete(model.getMaterialCategoryIDs()); + , tipType, "更新商品类别ID为 " + model.getMaterialCategoryID() + " " + tipMsg + "!", "更新商品类别" + tipMsg)); + } + + /** + * 批量删除指定ID商品类别 + * + * @return + */ + public String batchDelete() { + try { + materialCategoryService.batchDelete(model.getMaterialCategoryIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除商品类别ID为:" + model.getMaterialCategoryIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除商品类别ID为:" + model.getMaterialCategoryIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除商品类别", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除商品类别", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除商品类别ID为 "+ model.getMaterialCategoryIDs() + " " + tipMsg + "!", "批量删除商品类别" + tipMsg)); - return SUCCESS; - } - - /** - * 查找商品类别信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + , tipType, "批量删除商品类别ID为 " + model.getMaterialCategoryIDs() + " " + tipMsg + "!", "批量删除商品类别" + tipMsg)); + return SUCCESS; + } + + /** + * 查找商品类别信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); materialCategoryService.find(pageUtil); List dataList = pageUtil.getPageList(); - + //开始拼接json数据 // {"total":28,"rows":[ // {"productid":"AV-CB-01","attr1":"Adult Male","itemid":"EST-18"} @@ -218,10 +192,8 @@ public class MaterialCategoryAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(MaterialCategory materialCategory:dataList) - { + if (null != dataList) { + for (MaterialCategory materialCategory : dataList) { JSONObject item = new JSONObject(); item.put("Id", materialCategory.getId()); item.put("ParentId", materialCategory.getMaterialCategory().getId()); @@ -235,19 +207,16 @@ public class MaterialCategoryAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品类别信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品类别信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品类别信息结果异常", e); } - } + } /** * 根据id来查询商品名称 + * * @return */ public void findById() { @@ -257,35 +226,31 @@ public class MaterialCategoryAction extends BaseAction materialCategoryService.find(pageUtil); List dataList = pageUtil.getPageList(); JSONObject outer = new JSONObject(); - if(null != dataList) { - for(MaterialCategory materialCategory : dataList) { + if (null != dataList) { + for (MaterialCategory materialCategory : dataList) { outer.put("name", materialCategory.getName()); outer.put("parentId", materialCategory.getMaterialCategory().getId()); } } //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品类别信息异常", e); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品类别信息结果异常", e); } } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Name_s_like", model.getName()); condition.put("ParentId_n_eq", model.getParentId()); condition.put("Id_n_neq", 1); @@ -295,25 +260,25 @@ public class MaterialCategoryAction extends BaseAction /** * 拼接搜索条件 + * * @return */ - private Map getConditionById(){ + private Map getConditionById() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Id_n_eq", model.getMaterialCategoryID()); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public MaterialCategoryModel getModel() - { - return model; - } - public void setMaterialCategoryService(MaterialCategoryIService materialCategoryService) - { + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public MaterialCategoryModel getModel() { + return model; + } + + public void setMaterialCategoryService(MaterialCategoryIService materialCategoryService) { this.materialCategoryService = materialCategoryService; } } diff --git a/src/main/java/com/jsh/action/materials/MaterialPropertyAction.java b/src/main/java/com/jsh/action/materials/MaterialPropertyAction.java index 9487f024..fa8eeaf1 100644 --- a/src/main/java/com/jsh/action/materials/MaterialPropertyAction.java +++ b/src/main/java/com/jsh/action/materials/MaterialPropertyAction.java @@ -20,19 +20,19 @@ import java.util.Map; /* * 商品属性 * @author ji s h e n g hua qq:75 27 18 920 -*/ + */ @SuppressWarnings("serial") -public class MaterialPropertyAction extends BaseAction -{ +public class MaterialPropertyAction extends BaseAction { private MaterialPropertyIService materialPropertyService; private MaterialPropertyModel model = new MaterialPropertyModel(); - - /** - * 更新商品属性 - * @return - */ - public void update() { - Boolean flag = false; + + /** + * 更新商品属性 + * + * @return + */ + public void update() { + Boolean flag = false; try { MaterialProperty materialProperty = materialPropertyService.get(model.getId()); materialProperty.setNativeName(model.getNativeName()); @@ -40,37 +40,35 @@ public class MaterialPropertyAction extends BaseAction materialProperty.setSort(model.getSort()); materialProperty.setAnotherName(model.getAnotherName()); materialPropertyService.update(materialProperty); - + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改商品属性ID为 : " + model.getId() + "失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally { + } finally { try { toClient(flag.toString()); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改商品属性回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新商品属性", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新商品属性ID为 "+ model.getId() + " " + tipMsg + "!", "更新商品属性" + tipMsg)); - } - - /** - * 查找商品属性 - * @return - */ + , tipType, "更新商品属性ID为 " + model.getId() + " " + tipMsg + "!", "更新商品属性" + tipMsg)); + } + + /** + * 查找商品属性 + * + * @return + */ public void findBy() { - try { - PageUtil pageUtil = new PageUtil(); + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); pageUtil.setAdvSearch(getCondition()); @@ -81,8 +79,8 @@ public class MaterialPropertyAction extends BaseAction outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(MaterialProperty materialProperty:dataList) { + if (null != dataList) { + for (MaterialProperty materialProperty : dataList) { JSONObject item = new JSONObject(); item.put("id", materialProperty.getId()); item.put("nativeName", materialProperty.getNativeName()); @@ -95,38 +93,35 @@ public class MaterialPropertyAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品属性异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找商品属性异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询商品属性结果异常", e); } - } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + } + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("nativeName_s_like", model.getNativeName()); condition.put("sort_s_order", "asc"); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public MaterialPropertyModel getModel() { - return model; - } - public void setMaterialPropertyService(MaterialPropertyIService materialPropertyService) { + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public MaterialPropertyModel getModel() { + return model; + } + + public void setMaterialPropertyService(MaterialPropertyIService materialPropertyService) { this.materialPropertyService = materialPropertyService; } } diff --git a/src/main/java/com/jsh/action/materials/PersonAction.java b/src/main/java/com/jsh/action/materials/PersonAction.java index 0e673bdc..c16bfee1 100644 --- a/src/main/java/com/jsh/action/materials/PersonAction.java +++ b/src/main/java/com/jsh/action/materials/PersonAction.java @@ -1,70 +1,62 @@ package com.jsh.action.materials; +import com.jsh.base.BaseAction; +import com.jsh.base.Log; +import com.jsh.model.po.Logdetails; +import com.jsh.model.po.Person; +import com.jsh.model.vo.materials.PersonModel; +import com.jsh.service.materials.PersonIService; +import com.jsh.util.PageUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.springframework.dao.DataAccessException; + import java.io.IOException; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import org.springframework.dao.DataAccessException; -import com.jsh.base.BaseAction; -import com.jsh.base.Log; -import com.jsh.model.po.Depot; -import com.jsh.model.po.Person; -import com.jsh.model.po.Logdetails; -import com.jsh.model.vo.materials.PersonModel; -import com.jsh.service.materials.PersonIService; -import com.jsh.util.PageUtil; + /* * 经手人管理 * @author jishenghua qq:752718920 -*/ + */ @SuppressWarnings("serial") -public class PersonAction extends BaseAction -{ +public class PersonAction extends BaseAction { private PersonIService personService; private PersonModel model = new PersonModel(); - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public String getBasicData() - { - Map mapData = model.getShowModel().getMap(); - PageUtil pageUtil = new PageUtil(); + + @SuppressWarnings({"rawtypes", "unchecked"}) + public String getBasicData() { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - try - { - Map condition = pageUtil.getAdvSearch(); + try { + Map condition = pageUtil.getAdvSearch(); condition.put("Id_s_order", "asc"); personService.find(pageUtil); mapData.put("personList", pageUtil.getPageList()); - } - catch (Exception e) - { + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); model.getShowModel().setMsgTip("exceptoin"); } return SUCCESS; } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public String getPersonByType() - { - Map mapData = model.getShowModel().getMap(); - PageUtil pageUtil = new PageUtil(); + + @SuppressWarnings({"rawtypes", "unchecked"}) + public String getPersonByType() { + Map mapData = model.getShowModel().getMap(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - try - { - Map condition = pageUtil.getAdvSearch(); + try { + Map condition = pageUtil.getAdvSearch(); condition.put("Type_s_eq", model.getType()); condition.put("Id_s_order", "asc"); personService.find(pageUtil); mapData.put("personList", pageUtil.getPageList()); - } - catch (Exception e) - { + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); model.getShowModel().setMsgTip("exceptoin"); } @@ -73,31 +65,30 @@ public class PersonAction extends BaseAction /** * 根据类型获取经手人信息 1-业务员,2-仓管员,3-财务员 + * * @return */ public void getPersonByNumType() { try { - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - Map condition = pageUtil.getAdvSearch(); + Map condition = pageUtil.getAdvSearch(); String type = ""; - if(model.getType().equals("1")){ + if (model.getType().equals("1")) { type = "业务员"; - } - else if(model.getType().equals("2")){ + } else if (model.getType().equals("2")) { type = "仓管员"; - } - else if(model.getType().equals("3")){ + } else if (model.getType().equals("3")) { type = "财务员"; } - condition.put("Type_s_eq",type); + condition.put("Type_s_eq", type); condition.put("Id_s_order", "asc"); personService.find(pageUtil); List dataList = pageUtil.getPageList(); JSONArray dataArray = new JSONArray(); - if(null != dataList) { - for(Person person:dataList){ + if (null != dataList) { + for (Person person : dataList) { JSONObject item = new JSONObject(); item.put("id", person.getId()); item.put("name", person.getName()); @@ -106,212 +97,184 @@ public class PersonAction extends BaseAction } //回写查询结果 toClient(dataArray.toString()); - } - catch (DataAccessException e) { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找信息异常", e); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询信息结果异常", e); } } /** * 根据Id获取经手人信息 + * * @return */ public void getPersonByIds() { try { - PageUtil pageUtil = new PageUtil(); + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - Map condition = pageUtil.getAdvSearch(); + Map condition = pageUtil.getAdvSearch(); condition.put("Id_s_in", model.getPersonIDs()); condition.put("Id_s_order", "asc"); personService.find(pageUtil); List dataList = pageUtil.getPageList(); StringBuffer sb = new StringBuffer(); - if(null != dataList) { - for(Person person:dataList){ + if (null != dataList) { + for (Person person : dataList) { sb.append(person.getName() + " "); } } //回写查询结果 toClient(sb.toString()); - } - catch (DataAccessException e) { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>查找信息异常", e); - } - catch (IOException e) { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>回写查询信息结果异常", e); } } - - /** - * 增加经手人 - * @return - */ - public void create() - { - Log.infoFileSync("==================开始调用增加经手人信息方法create()==================="); - Boolean flag = false; - try - { - Person person = new Person(); - - person.setType(model.getType()); - person.setName(model.getName()); - personService.create(person); - - //========标识位=========== - flag = true; - //记录操作日志使用 - tipMsg = "成功"; - tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加经手人信息异常", e); - flag = false; - tipMsg = "失败"; - tipType = 1; - } - finally - { - try - { - toClient(flag.toString()); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>增加经手人信息回写客户端结果异常", e); - } - } - - logService.create(new Logdetails(getUser(), "增加经手人", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "增加经手人名称为 "+ model.getName() + " " + tipMsg + "!", "增加经手人" + tipMsg)); - Log.infoFileSync("==================结束调用增加经手人方法create()==================="); - } - - /** - * 删除经手人 - * @return - */ - public String delete() - { - Log.infoFileSync("====================开始调用删除经手人信息方法delete()================"); - try - { - personService.delete(model.getPersonID()); + + /** + * 增加经手人 + * + * @return + */ + public void create() { + Log.infoFileSync("==================开始调用增加经手人信息方法create()==================="); + Boolean flag = false; + try { + Person person = new Person(); + + person.setType(model.getType()); + person.setName(model.getName()); + personService.create(person); + + //========标识位=========== + flag = true; + //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getPersonID() + " 的经手人异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>增加经手人信息异常", e); + flag = false; + tipMsg = "失败"; + tipType = 1; + } finally { + try { + toClient(flag.toString()); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>增加经手人信息回写客户端结果异常", e); + } + } + + logService.create(new Logdetails(getUser(), "增加经手人", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "增加经手人名称为 " + model.getName() + " " + tipMsg + "!", "增加经手人" + tipMsg)); + Log.infoFileSync("==================结束调用增加经手人方法create()==================="); + } + + /** + * 删除经手人 + * + * @return + */ + public String delete() { + Log.infoFileSync("====================开始调用删除经手人信息方法delete()================"); + try { + personService.delete(model.getPersonID()); + tipMsg = "成功"; + tipType = 0; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getPersonID() + " 的经手人异常", e); + tipMsg = "失败"; tipType = 1; } - model.getShowModel().setMsgTip(tipMsg); - logService.create(new Logdetails(getUser(), "删除经手人", model.getClientIp(), - new Timestamp(System.currentTimeMillis()) - , tipType, "删除经手人ID为 "+ model.getPersonID() + " " + tipMsg + "!", "删除经手人" + tipMsg)); - Log.infoFileSync("====================结束调用删除经手人信息方法delete()================"); - return SUCCESS; - } - - /** - * 更新经手人 - * @return - */ - public void update() - { - Boolean flag = false; - try - { - Person person = personService.get(model.getPersonID()); - - person.setType(model.getType()); - person.setName(model.getName()); - personService.update(person); - + model.getShowModel().setMsgTip(tipMsg); + logService.create(new Logdetails(getUser(), "删除经手人", model.getClientIp(), + new Timestamp(System.currentTimeMillis()) + , tipType, "删除经手人ID为 " + model.getPersonID() + " " + tipMsg + "!", "删除经手人" + tipMsg)); + Log.infoFileSync("====================结束调用删除经手人信息方法delete()================"); + return SUCCESS; + } + + /** + * 更新经手人 + * + * @return + */ + public void update() { + Boolean flag = false; + try { + Person person = personService.get(model.getPersonID()); + + person.setType(model.getType()); + person.setName(model.getName()); + personService.update(person); + flag = true; tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { + } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>>>修改经手人ID为 : " + model.getPersonID() + "信息失败", e); flag = false; tipMsg = "失败"; tipType = 1; - } - finally - { - try - { + } finally { + try { toClient(flag.toString()); - } - catch (IOException e) - { + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>修改经手人回写客户端结果异常", e); } } logService.create(new Logdetails(getUser(), "更新经手人", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "更新经手人ID为 "+ model.getPersonID() + " " + tipMsg + "!", "更新经手人" + tipMsg)); - } - - /** - * 批量删除指定ID经手人 - * @return - */ - public String batchDelete() - { - try - { - personService.batchDelete(model.getPersonIDs()); + , tipType, "更新经手人ID为 " + model.getPersonID() + " " + tipMsg + "!", "更新经手人" + tipMsg)); + } + + /** + * 批量删除指定ID经手人 + * + * @return + */ + public String batchDelete() { + try { + personService.batchDelete(model.getPersonIDs()); model.getShowModel().setMsgTip("成功"); //记录操作日志使用 tipMsg = "成功"; tipType = 0; - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>批量删除经手人ID为:" + model.getPersonIDs() + "信息异常", e); - tipMsg = "失败"; + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>批量删除经手人ID为:" + model.getPersonIDs() + "信息异常", e); + tipMsg = "失败"; tipType = 1; } - - logService.create(new Logdetails(getUser(), "批量删除经手人", model.getClientIp(), + + logService.create(new Logdetails(getUser(), "批量删除经手人", model.getClientIp(), new Timestamp(System.currentTimeMillis()) - , tipType, "批量删除经手人ID为 "+ model.getPersonIDs() + " " + tipMsg + "!", "批量删除经手人" + tipMsg)); - return SUCCESS; - } - - /** - * 查找经手人信息 - * @return - */ - public void findBy() - { - try - { - PageUtil pageUtil = new PageUtil(); + , tipType, "批量删除经手人ID为 " + model.getPersonIDs() + " " + tipMsg + "!", "批量删除经手人" + tipMsg)); + return SUCCESS; + } + + /** + * 查找经手人信息 + * + * @return + */ + public void findBy() { + try { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(model.getPageSize()); pageUtil.setCurPage(model.getPageNo()); pageUtil.setAdvSearch(getCondition()); personService.find(pageUtil); List dataList = pageUtil.getPageList(); - + JSONObject outer = new JSONObject(); outer.put("total", pageUtil.getTotalCount()); //存放数据json数组 JSONArray dataArray = new JSONArray(); - if(null != dataList) - { - for(Person person:dataList) - { + if (null != dataList) { + for (Person person : dataList) { JSONObject item = new JSONObject(); item.put("Id", person.getId()); item.put("Type", person.getType()); @@ -323,40 +286,35 @@ public class PersonAction extends BaseAction outer.put("rows", dataArray); //回写查询结果 toClient(outer.toString()); - } - catch (DataAccessException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找经手人信息异常", e); - } - catch (IOException e) - { + } catch (DataAccessException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找经手人信息异常", e); + } catch (IOException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询经手人信息结果异常", e); } - } - - /** - * 拼接搜索条件 - * @return - */ - private Map getCondition() - { + } + + /** + * 拼接搜索条件 + * + * @return + */ + private Map getCondition() { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("Name_s_like", model.getName()); condition.put("Type_s_eq", model.getType()); return condition; } - - //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== - @Override - public PersonModel getModel() - { - return model; - } - public void setPersonService(PersonIService personService) - { + + //=============以下spring注入以及Model驱动公共方法,与Action处理无关================== + @Override + public PersonModel getModel() { + return model; + } + + public void setPersonService(PersonIService personService) { this.personService = personService; } } diff --git a/src/main/java/com/jsh/base/BaseAction.java b/src/main/java/com/jsh/base/BaseAction.java index d8af6b1e..1130da72 100644 --- a/src/main/java/com/jsh/base/BaseAction.java +++ b/src/main/java/com/jsh/base/BaseAction.java @@ -1,114 +1,113 @@ package com.jsh.base; -import java.io.IOException; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.ServletActionContext; - +import com.jsh.model.po.Basicuser; +import com.jsh.service.basic.LogIService; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; -import com.jsh.model.po.Basicuser; -import com.jsh.service.basic.LogIService; +import org.apache.struts2.ServletActionContext; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Map; + /** * struts2工具类 + * * @author jishenghua qq752718920 * struts2 base action 一些常用方法获取 */ @SuppressWarnings("serial") -public abstract class BaseAction extends ActionSupport implements ModelDriven -{ - public LogIService logService; - - /** - * 操作日志使用 是否成功表示 - */ +public abstract class BaseAction extends ActionSupport implements ModelDriven { + public LogIService logService; + + /** + * 操作日志使用 是否成功表示 + */ public String tipMsg = "成功"; - + /** * 操作日志使用 是否成功表示 0 ==成功 1==失败 */ public short tipType = 0; - - public void setLogService(LogIService logService) - { - this.logService = logService; - } - - /** - * 获取session - * @return - */ - public static Map getSession() - { - return ActionContext.getContext().getSession(); - } - - /** - * 获取request - * @return - */ - public static HttpServletRequest getRequest() - { - return ServletActionContext.getRequest(); - } - /** - * 获取response - * @return response - */ - public static HttpServletResponse getResponse() - { - return ServletActionContext.getResponse(); - } - - /** + + /** + * 获取session + * + * @return + */ + public static Map getSession() { + return ActionContext.getContext().getSession(); + } + + /** + * 获取request + * + * @return + */ + public static HttpServletRequest getRequest() { + return ServletActionContext.getRequest(); + } + + /** + * 获取response + * + * @return response + */ + public static HttpServletResponse getResponse() { + return ServletActionContext.getResponse(); + } + + public void setLogService(LogIService logService) { + this.logService = logService; + } + + /** * 添加错误信息 + * * @param anErrorMessage */ - public void addActionError(String anErrorMessage) - { + public void addActionError(String anErrorMessage) { super.addActionError(anErrorMessage); } - + /** * 添加消息 + * * @param aMessage */ - public void addActionMessage(String aMessage) - { + public void addActionMessage(String aMessage) { clearErrorsAndMessages(); super.addActionMessage(aMessage); } - + /** * 添加字段错误 + * * @param fieldName * @param errorMessage */ - public void addFieldError(String fieldName, String errorMessage) - { + public void addFieldError(String fieldName, String errorMessage) { clearErrorsAndMessages(); super.addFieldError(fieldName, errorMessage); } - + /** - * 登录用户信息 + * 登录用户信息 + * * @return 登录用户对象 */ - public Basicuser getUser() - { - return (Basicuser)getSession().get("user"); + public Basicuser getUser() { + return (Basicuser) getSession().get("user"); } - + /** * 回写客户端数据 - * @throws IOException + * + * @throws IOException */ - public void toClient(String jsonData) throws IOException - { + public void toClient(String jsonData) throws IOException { HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("text/html;charset=utf-8"); response.getWriter().print(jsonData); diff --git a/src/main/java/com/jsh/base/BaseDAO.java b/src/main/java/com/jsh/base/BaseDAO.java index da1fd279..673ac810 100644 --- a/src/main/java/com/jsh/base/BaseDAO.java +++ b/src/main/java/com/jsh/base/BaseDAO.java @@ -1,82 +1,73 @@ package com.jsh.base; +import com.jsh.util.PageUtil; +import com.jsh.util.SearchConditionUtil; +import org.hibernate.Query; +import org.springframework.dao.DataAccessException; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + import java.io.Serializable; import java.util.List; import java.util.Map; -import org.hibernate.Query; -import org.springframework.dao.DataAccessException; -import org.springframework.orm.hibernate3.support.HibernateDaoSupport; - -import com.jsh.util.PageUtil; -import com.jsh.util.SearchConditionUtil; /** * 基础dao + * * @author ji_sheng_hua qq:752718920 */ -public class BaseDAO extends HibernateDaoSupport implements BaseIDAO -{ - protected Class entityClass; +public class BaseDAO extends HibernateDaoSupport implements BaseIDAO { + protected Class entityClass; - public void setPoJoClass(Class c) - { - this.entityClass = c; - } + public void setPoJoClass(Class c) { + this.entityClass = c; + } - protected Class getEntityClass() - { - return this.entityClass; - } + protected Class getEntityClass() { + return this.entityClass; + } - @Override - public Serializable create(T t) throws DataAccessException - { - return this.getHibernateTemplate().save(t); - } + @Override + public Serializable create(T t) throws DataAccessException { + return this.getHibernateTemplate().save(t); + } - @Override - public void delete(T t) throws DataAccessException - { - this.getHibernateTemplate().delete(t); - } + @Override + public void delete(T t) throws DataAccessException { + this.getHibernateTemplate().delete(t); + } - @Override - public T get(Long objID) throws DataAccessException - { - return (T) this.getHibernateTemplate().get(getEntityClass(), objID); - } + @Override + public T get(Long objID) throws DataAccessException { + return (T) this.getHibernateTemplate().get(getEntityClass(), objID); + } - @Override - public void update(T t) throws DataAccessException - { - this.getHibernateTemplate().update(t); - } + @Override + public void update(T t) throws DataAccessException { + this.getHibernateTemplate().update(t); + } - @Override - public void batchDelete(String objIDs) throws DataAccessException - { - this.getHibernateTemplate().bulkUpdate("delete from " + getEntityClass().getName() + " where id in ("+ objIDs + ")"); - } + @Override + public void batchDelete(String objIDs) throws DataAccessException { + this.getHibernateTemplate().bulkUpdate("delete from " + getEntityClass().getName() + " where id in (" + objIDs + ")"); + } - @SuppressWarnings("unchecked") - @Override - public void find(PageUtil pageUtil) throws DataAccessException - { - Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession() - .createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ - SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); - pageUtil.setTotalCount(query.list().size()); + @SuppressWarnings("unchecked") + @Override + public void find(PageUtil pageUtil) throws DataAccessException { + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession() + .createQuery(" from " + getEntityClass().getName() + " where 1=1 " + + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + pageUtil.setTotalCount(query.list().size()); - // 分页查询 - int pageNo = pageUtil.getCurPage(); - int pageSize = pageUtil.getPageSize(); - if (0 != pageNo && 0 != pageSize) - { - query.setFirstResult((pageNo - 1) * pageSize); - query.setMaxResults(pageSize); - } - pageUtil.setPageList(query.list()); - } + // 分页查询 + int pageNo = pageUtil.getCurPage(); + int pageSize = pageUtil.getPageSize(); + if (0 != pageNo && 0 != pageSize) { + query.setFirstResult((pageNo - 1) * pageSize); + query.setMaxResults(pageSize); + } + pageUtil.setPageList(query.list()); + } // @SuppressWarnings("unchecked") // @Override @@ -92,49 +83,44 @@ public class BaseDAO extends HibernateDaoSupport implements BaseIDAO // return this.getHibernateTemplate().find(" from " + getEntityClass().getName() + " where 1=1 "+ hql); // } - @SuppressWarnings("unchecked") - @Override - public List find(Map conditon, int pageSize, int pageNo)throws DataAccessException - { - Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession() - .createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon)); - query.setFirstResult((pageNo - 1) * pageSize); - query.setMaxResults(pageSize); - return query.list(); - } + @SuppressWarnings("unchecked") + @Override + public List find(Map conditon, int pageSize, int pageNo) throws DataAccessException { + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession() + .createQuery(" from " + getEntityClass().getName() + " where 1=1 " + SearchConditionUtil.getCondition(conditon)); + query.setFirstResult((pageNo - 1) * pageSize); + query.setMaxResults(pageSize); + return query.list(); + } - @SuppressWarnings("unchecked") - @Override - public List find(String hql, int pageSize, int pageNo)throws DataAccessException - { - Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession() - .createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ hql); - query.setFirstResult((pageNo - 1) * pageSize); - query.setMaxResults(pageSize); - return query.list(); - } + @SuppressWarnings("unchecked") + @Override + public List find(String hql, int pageSize, int pageNo) throws DataAccessException { + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession() + .createQuery(" from " + getEntityClass().getName() + " where 1=1 " + hql); + query.setFirstResult((pageNo - 1) * pageSize); + query.setMaxResults(pageSize); + return query.list(); + } - @SuppressWarnings("unchecked") - @Override - public Integer countSum(Map conditon)throws DataAccessException - { - List dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession() - .createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ SearchConditionUtil.getCondition(conditon)).list(); - return dataList ==null?0:dataList.size(); - } + @SuppressWarnings("unchecked") + @Override + public Integer countSum(Map conditon) throws DataAccessException { + List dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession() + .createQuery(" from " + getEntityClass().getName() + " where 1=1 " + SearchConditionUtil.getCondition(conditon)).list(); + return dataList == null ? 0 : dataList.size(); + } - @SuppressWarnings("unchecked") - @Override - public Integer countSum(String hql) throws DataAccessException - { - List dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession() - .createQuery(" from " + getEntityClass().getName() + " where 1=1 "+ hql).list(); - return dataList ==null?0:dataList.size(); - } + @SuppressWarnings("unchecked") + @Override + public Integer countSum(String hql) throws DataAccessException { + List dataList = this.getHibernateTemplate().getSessionFactory().getCurrentSession() + .createQuery(" from " + getEntityClass().getName() + " where 1=1 " + hql).list(); + return dataList == null ? 0 : dataList.size(); + } @Override - public void save(T t) throws DataAccessException - { + public void save(T t) throws DataAccessException { this.getHibernateTemplate().save(t); } } diff --git a/src/main/java/com/jsh/base/BaseIDAO.java b/src/main/java/com/jsh/base/BaseIDAO.java index 148d378a..333a57c9 100644 --- a/src/main/java/com/jsh/base/BaseIDAO.java +++ b/src/main/java/com/jsh/base/BaseIDAO.java @@ -1,124 +1,135 @@ package com.jsh.base; +import com.jsh.util.PageUtil; +import org.springframework.dao.DataAccessException; + import java.io.Serializable; import java.util.List; import java.util.Map; -import org.springframework.dao.DataAccessException; - -import com.jsh.util.PageUtil; - /** * 常用增删改查操作 - * @author ji-sheng-hua qq752718920 + * * @param + * @author ji-sheng-hua qq752718920 */ -public interface BaseIDAO -{ +public interface BaseIDAO { - /** - * 设置操作类对象 - * @param paramClass - */ - void setPoJoClass(Class paramClass); - - /** - * 增加 - * @param t 对象 - * @throws DataAccessException - */ - Serializable create(T t)throws DataAccessException; - - /** + /** + * 设置操作类对象 + * + * @param paramClass + */ + void setPoJoClass(Class paramClass); + + /** * 增加 + * * @param t 对象 * @throws DataAccessException */ - void save(T t)throws DataAccessException; - - /** - * 删除 - * @param t 对象 - * @throws DataAccessException - */ - void delete(T t)throws DataAccessException; - - /** - * 获取 - * @param objID ID - * @return 对象 - * @throws DataAccessException - */ - T get(Long objID)throws DataAccessException; - - /** - * 修改信息 - * @param t 要修改的对象 - * @throws DataAccessException - */ - void update(T t)throws DataAccessException; - - /** - * 批量删除信息 - * @param 以逗号分割的ID - * @throws DataAccessException - */ - void batchDelete(String objIDs)throws DataAccessException; - - /** - * 查找列表 - * @param pageUtil 分页工具类 - * @throws DataAccessException - */ - void find(PageUtil pageUtil)throws DataAccessException; - - /** - * 根据条件查询列表--没有分页信息 - * @param conditon 查询条件 - * @return 查询列表数据 - */ + Serializable create(T t) throws DataAccessException; + + /** + * 增加 + * + * @param t 对象 + * @throws DataAccessException + */ + void save(T t) throws DataAccessException; + + /** + * 删除 + * + * @param t 对象 + * @throws DataAccessException + */ + void delete(T t) throws DataAccessException; + + /** + * 获取 + * + * @param objID ID + * @return 对象 + * @throws DataAccessException + */ + T get(Long objID) throws DataAccessException; + + /** + * 修改信息 + * + * @param t 要修改的对象 + * @throws DataAccessException + */ + void update(T t) throws DataAccessException; + + /** + * 批量删除信息 + * + * @param 以逗号分割的ID + * @throws DataAccessException + */ + void batchDelete(String objIDs) throws DataAccessException; + + /** + * 查找列表 + * + * @param pageUtil 分页工具类 + * @throws DataAccessException + */ + void find(PageUtil pageUtil) throws DataAccessException; + + /** + * 根据条件查询列表--没有分页信息 + * @param conditon 查询条件 + * @return 查询列表数据 + */ // List find(Map conditon)throws DataAccessException; - - /** - * 根据hql查询 --没有分页信息 - * @param hql hibernate查询 - * @return 查询列表数据 - */ + + /** + * 根据hql查询 --没有分页信息 + * @param hql hibernate查询 + * @return 查询列表数据 + */ // List find(String hql)throws DataAccessException; - - /** - * 根据搜索条件查询--分页 - * @param conditon 查询条件 - * @param pageSize 每页个数 - * @param pageNo 页码 - * @return 查询列表数据 - * @throws DataAccessException - */ - List find(Map conditon,int pageSize,int pageNo)throws DataAccessException; - - /** - * 根据hql查询--分页 - * @param hql hibernate查询语句 - * @param pageSize 每页个数 - * @param pageNo 页码 - * @return 查询列表数据 - * @throws DataAccessException - */ - List find(String hql,int pageSize,int pageNo)throws DataAccessException; - - /** - * 查找符合条件的总数 - * @param conditon - * @return - * @throws DataAccessException - */ - Integer countSum(Map conditon)throws DataAccessException; - - /** - * 查找符合条件的总数 - * @param hql - * @return - * @throws DataAccessException - */ - Integer countSum(String hql)throws DataAccessException; + + /** + * 根据搜索条件查询--分页 + * + * @param conditon 查询条件 + * @param pageSize 每页个数 + * @param pageNo 页码 + * @return 查询列表数据 + * @throws DataAccessException + */ + List find(Map conditon, int pageSize, int pageNo) throws DataAccessException; + + /** + * 根据hql查询--分页 + * + * @param hql hibernate查询语句 + * @param pageSize 每页个数 + * @param pageNo 页码 + * @return 查询列表数据 + * @throws DataAccessException + */ + List find(String hql, int pageSize, int pageNo) throws DataAccessException; + + /** + * 查找符合条件的总数 + * + * @param conditon + * @return + * @throws DataAccessException + */ + Integer countSum(Map conditon) throws DataAccessException; + + /** + * 查找符合条件的总数 + * + * @param hql + * @return + * @throws DataAccessException + */ + Integer countSum(String hql) throws DataAccessException; } diff --git a/src/main/java/com/jsh/base/BaseIService.java b/src/main/java/com/jsh/base/BaseIService.java index 703e6dc4..08d43f51 100644 --- a/src/main/java/com/jsh/base/BaseIService.java +++ b/src/main/java/com/jsh/base/BaseIService.java @@ -1,109 +1,119 @@ package com.jsh.base; +import com.jsh.util.PageUtil; +import org.springframework.dao.DataAccessException; + import java.io.Serializable; -import org.springframework.dao.DataAccessException; - -import com.jsh.util.PageUtil; /** * 服务层底层接口 - * @author ji-sheng-hua qq752718920 + * * @param + * @author ji-sheng-hua qq752718920 */ -public interface BaseIService -{ - /** - * 增加 - * @param t 对象 - * @throws DataAccessException - */ - Serializable create(T t)throws DataAccessException; - - /** +public interface BaseIService { + /** * 增加 + * * @param t 对象 * @throws DataAccessException */ - void save(T t)throws DataAccessException; - - /** - * 删除 - * @param t 对象 - * @throws DataAccessException - */ - void delete(T t)throws DataAccessException; - - /** - * 删除 - * @param id 对象ID - * @throws DataAccessException - */ - void delete(Long id)throws DataAccessException; - - /** - * 获取 - * @param objID ID - * @return 对象 - * @throws DataAccessException - */ - T get(Long objID)throws DataAccessException; - - /** - * 修改信息 - * @param t 要修改的对象 - * @throws DataAccessException - */ - void update(T t)throws DataAccessException; - - /** - * 批量删除信息 - * @param 以逗号分割的ID - * @throws DataAccessException - */ - void batchDelete(String objIDs)throws DataAccessException; - - /** - * 查找列表 - * @param pageUtil 分页工具类 - * @throws DataAccessException - */ - void find(PageUtil pageUtil) throws DataAccessException; - - /** - * 检查名称是否存在,页面唯一性效验使用 - * @param filedName 效验的字段名称 - * @param filedVale 校验值 - * @param idFiled ID字段名称 - * @param objectID 修改时对象ID - * @return true==存在 false==不存在 - * @throws DataAccessException - */ - Boolean checkIsNameExist(String filedName,String filedVale,String idFiled,Long objectID) throws DataAccessException; - - /** - * 检查UserBusiness是否存在,页面唯一性效验使用 - * @param TypeName 类型名称 - * @param TypeVale 类型值 - * @param KeyIdName 关键id - * @param KeyIdValue 关键值 - * @param UBName 关系名称 - * @param UBValue 关系值 - * @return true==存在 false==不存在 - * @throws DataAccessException - */ - Boolean checkIsUserBusinessExist(String TypeName,String TypeVale,String KeyIdName,String KeyIdValue,String UBName,String UBValue) throws DataAccessException; - - /** - * 检查UserBusiness是否存在,页面唯一性效验使用 - * @param TypeName 类型名称 - * @param TypeVale 类型值 - * @param KeyIdName 关键id - * @param KeyIdValue 关键值 - * @return true==存在 false==不存在 - * @throws DataAccessException - */ - Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException; - - - + Serializable create(T t) throws DataAccessException; + + /** + * 增加 + * + * @param t 对象 + * @throws DataAccessException + */ + void save(T t) throws DataAccessException; + + /** + * 删除 + * + * @param t 对象 + * @throws DataAccessException + */ + void delete(T t) throws DataAccessException; + + /** + * 删除 + * + * @param id 对象ID + * @throws DataAccessException + */ + void delete(Long id) throws DataAccessException; + + /** + * 获取 + * + * @param objID ID + * @return 对象 + * @throws DataAccessException + */ + T get(Long objID) throws DataAccessException; + + /** + * 修改信息 + * + * @param t 要修改的对象 + * @throws DataAccessException + */ + void update(T t) throws DataAccessException; + + /** + * 批量删除信息 + * + * @param 以逗号分割的ID + * @throws DataAccessException + */ + void batchDelete(String objIDs) throws DataAccessException; + + /** + * 查找列表 + * + * @param pageUtil 分页工具类 + * @throws DataAccessException + */ + void find(PageUtil pageUtil) throws DataAccessException; + + /** + * 检查名称是否存在,页面唯一性效验使用 + * + * @param filedName 效验的字段名称 + * @param filedVale 校验值 + * @param idFiled ID字段名称 + * @param objectID 修改时对象ID + * @return true==存在 false==不存在 + * @throws DataAccessException + */ + Boolean checkIsNameExist(String filedName, String filedVale, String idFiled, Long objectID) throws DataAccessException; + + /** + * 检查UserBusiness是否存在,页面唯一性效验使用 + * + * @param TypeName 类型名称 + * @param TypeVale 类型值 + * @param KeyIdName 关键id + * @param KeyIdValue 关键值 + * @param UBName 关系名称 + * @param UBValue 关系值 + * @return true==存在 false==不存在 + * @throws DataAccessException + */ + Boolean checkIsUserBusinessExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue, String UBName, String UBValue) throws DataAccessException; + + /** + * 检查UserBusiness是否存在,页面唯一性效验使用 + * + * @param TypeName 类型名称 + * @param TypeVale 类型值 + * @param KeyIdName 关键id + * @param KeyIdValue 关键值 + * @return true==存在 false==不存在 + * @throws DataAccessException + */ + Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException; + + } diff --git a/src/main/java/com/jsh/base/BaseService.java b/src/main/java/com/jsh/base/BaseService.java index 01b54480..2070fba6 100644 --- a/src/main/java/com/jsh/base/BaseService.java +++ b/src/main/java/com/jsh/base/BaseService.java @@ -1,141 +1,124 @@ package com.jsh.base; +import com.jsh.util.PageUtil; +import org.springframework.dao.DataAccessException; + import java.io.Serializable; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.springframework.dao.DataAccessException; - -import com.jsh.util.JshException; -import com.jsh.model.po.Basicuser; -import com.jsh.util.PageUtil; /** * 底层服务层 - * @author ji-sheng-hua qq752718920 + * * @param + * @author ji-sheng-hua qq752718920 */ -public abstract class BaseService implements BaseIService -{ - /** - * Dao对象 - */ - private BaseIDAO baseDao; - - protected Class entityClass; +public abstract class BaseService implements BaseIService { + protected Class entityClass; + /** + * Dao对象 + */ + private BaseIDAO baseDao; - public void setBaseDao(BaseIDAO baseDao) - { - this.baseDao = baseDao; - setPoJoClass(getEntityClass()); - } + protected BaseIDAO getBaseDao() { + return this.baseDao; + } - protected BaseIDAO getBaseDao() - { - return this.baseDao; - } + public void setBaseDao(BaseIDAO baseDao) { + this.baseDao = baseDao; + setPoJoClass(getEntityClass()); + } - private void setPoJoClass(Class c) - { - this.baseDao.setPoJoClass(c); - } + private void setPoJoClass(Class c) { + this.baseDao.setPoJoClass(c); + } - protected abstract Class getEntityClass(); + protected abstract Class getEntityClass(); - @Override - public Serializable create(T t) throws DataAccessException - { - return baseDao.create(t); - } - - @Override - public void save(T t) throws DataAccessException - { + @Override + public Serializable create(T t) throws DataAccessException { + return baseDao.create(t); + } + + @Override + public void save(T t) throws DataAccessException { baseDao.save(t); } - @Override - public void delete(T t) throws DataAccessException - { - baseDao.delete(t); - } + @Override + public void delete(T t) throws DataAccessException { + baseDao.delete(t); + } - @Override - public void delete(Long id) throws DataAccessException - { - baseDao.batchDelete(id.toString()); - } + @Override + public void delete(Long id) throws DataAccessException { + baseDao.batchDelete(id.toString()); + } - @Override - public T get(Long objID) throws DataAccessException - { - return baseDao.get(objID); - } + @Override + public T get(Long objID) throws DataAccessException { + return baseDao.get(objID); + } - @Override - public void update(T t) throws DataAccessException - { - baseDao.update(t); - } + @Override + public void update(T t) throws DataAccessException { + baseDao.update(t); + } - @Override - public void batchDelete(String objIDs) throws DataAccessException - { - baseDao.batchDelete(objIDs); - } + @Override + public void batchDelete(String objIDs) throws DataAccessException { + baseDao.batchDelete(objIDs); + } - @Override - public void find(PageUtil pageUtil) throws DataAccessException - { - baseDao.find(pageUtil); - } - - @Override - public Boolean checkIsNameExist(String filedName, String filedVale,String idFiled,Long objectID) throws DataAccessException - { - PageUtil pageUtil = new PageUtil(); - Map condition = new HashMap(); + @Override + public void find(PageUtil pageUtil) throws DataAccessException { + baseDao.find(pageUtil); + } + + @Override + public Boolean checkIsNameExist(String filedName, String filedVale, String idFiled, Long objectID) throws DataAccessException { + PageUtil pageUtil = new PageUtil(); + Map condition = new HashMap(); condition.put(filedName + "_s_eq", filedVale); condition.put(idFiled + "_n_neq", objectID); pageUtil.setAdvSearch(condition); baseDao.find(pageUtil); - + List dataList = pageUtil.getPageList(); - if(null != dataList && dataList.size() > 0) + if (null != dataList && dataList.size() > 0) return true; return false; - } - - @Override - public Boolean checkIsUserBusinessExist(String TypeName,String TypeVale,String KeyIdName,String KeyIdValue,String UBName,String UBValue) throws DataAccessException - { - PageUtil pageUtil = new PageUtil(); - Map condition = new HashMap(); + } + + @Override + public Boolean checkIsUserBusinessExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue, String UBName, String UBValue) throws DataAccessException { + PageUtil pageUtil = new PageUtil(); + Map condition = new HashMap(); condition.put(TypeName + "_s_eq", TypeVale); condition.put(KeyIdName + "_s_eq", KeyIdValue); condition.put(UBName + "_s_like", UBValue); pageUtil.setAdvSearch(condition); baseDao.find(pageUtil); - + List dataList = pageUtil.getPageList(); - if(null != dataList && dataList.size() > 0) + if (null != dataList && dataList.size() > 0) return true; return false; - } - - @Override - public Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException - { - PageUtil pageUtil = new PageUtil(); - Map condition = new HashMap(); + } + + @Override + public Boolean checkIsValueExist(String TypeName, String TypeVale, String KeyIdName, String KeyIdValue) throws DataAccessException { + PageUtil pageUtil = new PageUtil(); + Map condition = new HashMap(); condition.put(TypeName + "_s_eq", TypeVale); condition.put(KeyIdName + "_s_eq", KeyIdValue); pageUtil.setAdvSearch(condition); baseDao.find(pageUtil); - + List dataList = pageUtil.getPageList(); - if(null != dataList && dataList.size() > 0) + if (null != dataList && dataList.size() > 0) return true; return false; - } + } } diff --git a/src/main/java/com/jsh/base/Log.java b/src/main/java/com/jsh/base/Log.java index 1a665d30..6e822880 100644 --- a/src/main/java/com/jsh/base/Log.java +++ b/src/main/java/com/jsh/base/Log.java @@ -4,171 +4,162 @@ import org.apache.log4j.Logger; /** * 封装log4j日志信息,打印日志信息类 + * * @author ji/sheng/hua qq_7527.18920 * @since 2014-01-22 */ -public class Log -{ - /** - * 根据异常信息获取调用类的信息 - */ - private static final Exception ex = new Exception(); - - /** - * 获取Log4j实例 - */ - private static final Logger log = Logger.getLogger("jsh"); - - /** - * Info级别日志前缀 - */ - public static final String LOG_INFO_PREFIX = "=========="; - - /** - * error级别日志前缀 - */ - public static final String LOG_ERROR_PREFIX = ">>>>>>>>>>"; - - /** - * debug级别日志前缀 - */ - public static final String LOG_DEBUG_PREFIX = "-----------"; - - /** - * fatal级别日志前缀 - */ - public static final String LOG_FATAL_PREFIX = "$$$$$$$$$$"; - - /** - * warn级别日志前缀 - */ - public static final String LOG_WARN_PREFIX = "##########"; - - /** - * 打印deug日期信息 - * @param msg 日志信息 - */ - public static void debugFileSync(Object msg) - { - log.debug(getLogDetail(msg)); - } +public class Log { + /** + * Info级别日志前缀 + */ + public static final String LOG_INFO_PREFIX = "=========="; + /** + * error级别日志前缀 + */ + public static final String LOG_ERROR_PREFIX = ">>>>>>>>>>"; + /** + * debug级别日志前缀 + */ + public static final String LOG_DEBUG_PREFIX = "-----------"; + /** + * fatal级别日志前缀 + */ + public static final String LOG_FATAL_PREFIX = "$$$$$$$$$$"; + /** + * warn级别日志前缀 + */ + public static final String LOG_WARN_PREFIX = "##########"; + /** + * 根据异常信息获取调用类的信息 + */ + private static final Exception ex = new Exception(); + /** + * 获取Log4j实例 + */ + private static final Logger log = Logger.getLogger("jsh"); - /** - * 打印debug异常信息 - * @param msg 日志信息 - * @param e 异常堆栈 - */ - public static void debugFileSync(Object msg, Throwable e) - { - log.debug(getLogDetail(msg), e); - } + /** + * 打印deug日期信息 + * + * @param msg 日志信息 + */ + public static void debugFileSync(Object msg) { + log.debug(getLogDetail(msg)); + } - /** - * 打印info日志信息 - * @param msg 日志信息 - */ - public static void infoFileSync(Object msg) - { - log.info(getLogDetail(msg)); - } + /** + * 打印debug异常信息 + * + * @param msg 日志信息 + * @param e 异常堆栈 + */ + public static void debugFileSync(Object msg, Throwable e) { + log.debug(getLogDetail(msg), e); + } - /** - * 打印 info日志带异常信息 - * @param msg 日志信息 - * @param e 异常堆栈 - */ - public static void infoFileSync(Object msg, Throwable e) - { - log.info(getLogDetail(msg), e); - } + /** + * 打印info日志信息 + * + * @param msg 日志信息 + */ + public static void infoFileSync(Object msg) { + log.info(getLogDetail(msg)); + } - /** - * 打印warn日期信息 - * @param msg 日志信息 - */ - public static void warnFileSync(Object msg) - { - log.warn(getLogDetail(msg)); - } + /** + * 打印 info日志带异常信息 + * + * @param msg 日志信息 + * @param e 异常堆栈 + */ + public static void infoFileSync(Object msg, Throwable e) { + log.info(getLogDetail(msg), e); + } - /** - * 打印warn日志信息带异常 - * @param msg日志信息 - * @param e 异常堆栈 - */ - public static void warnFileSync(Object msg, Throwable e) - { - log.warn(getLogDetail(msg), e); - } + /** + * 打印warn日期信息 + * + * @param msg 日志信息 + */ + public static void warnFileSync(Object msg) { + log.warn(getLogDetail(msg)); + } - /** - * 打印error日志信息 - * @param msg 日志信息 - */ - public static void errorFileSync(Object msg) - { - log.error(getLogDetail(msg)); - } + /** + * 打印warn日志信息带异常 + * + * @param msg日志信息 + * @param e 异常堆栈 + */ + public static void warnFileSync(Object msg, Throwable e) { + log.warn(getLogDetail(msg), e); + } - /** - * 打印error日志信息带异常 - * @param msg 日志信息 - * @param e 异常堆栈 - */ - public static void errorFileSync(Object msg, Throwable e) - { - log.error(getLogDetail(msg), e); - } + /** + * 打印error日志信息 + * + * @param msg 日志信息 + */ + public static void errorFileSync(Object msg) { + log.error(getLogDetail(msg)); + } - /** - * 打印fatal日志信息 - * @param msg 日志信息 - */ - public static void fatalFileSync(Object msg) - { - log.fatal(getLogDetail(msg)); - } + /** + * 打印error日志信息带异常 + * + * @param msg 日志信息 + * @param e 异常堆栈 + */ + public static void errorFileSync(Object msg, Throwable e) { + log.error(getLogDetail(msg), e); + } - /** - * 打印fatal日志信息带异常 - * @param msg 日志信息 - * @param e 异常堆栈 - */ - public static void fatalFileSync(Object msg, Throwable e) - { - log.fatal(getLogDetail(msg), e); - } - - /** - * 拼装日志详细信息 - * @param message 要打印的日志信息 - * @return 封装后的日志详细信息 - */ - private static synchronized String getLogDetail(Object message) - { - String msg = ""; - if (null != message) - msg = message.toString(); - StringBuffer bf = new StringBuffer(); - try - { - ex.fillInStackTrace(); - throw ex; - } - catch (Exception ex) - { - StackTraceElement[] trace = ex.getStackTrace(); - //获取异常堆栈中的调用类信息 - final int pos = 2; - bf.append(msg); - bf.append(" [class:"); - bf.append(trace[pos].getClassName()); - bf.append(" method:"); - bf.append(trace[pos].getMethodName()); - bf.append(" line:"); - bf.append(trace[pos].getLineNumber()); - bf.append("]"); - } - return bf.toString(); - } + /** + * 打印fatal日志信息 + * + * @param msg 日志信息 + */ + public static void fatalFileSync(Object msg) { + log.fatal(getLogDetail(msg)); + } + + /** + * 打印fatal日志信息带异常 + * + * @param msg 日志信息 + * @param e 异常堆栈 + */ + public static void fatalFileSync(Object msg, Throwable e) { + log.fatal(getLogDetail(msg), e); + } + + /** + * 拼装日志详细信息 + * + * @param message 要打印的日志信息 + * @return 封装后的日志详细信息 + */ + private static synchronized String getLogDetail(Object message) { + String msg = ""; + if (null != message) + msg = message.toString(); + StringBuffer bf = new StringBuffer(); + try { + ex.fillInStackTrace(); + throw ex; + } catch (Exception ex) { + StackTraceElement[] trace = ex.getStackTrace(); + //获取异常堆栈中的调用类信息 + final int pos = 2; + bf.append(msg); + bf.append(" [class:"); + bf.append(trace[pos].getClassName()); + bf.append(" method:"); + bf.append(trace[pos].getMethodName()); + bf.append(" line:"); + bf.append(trace[pos].getLineNumber()); + bf.append("]"); + } + return bf.toString(); + } } diff --git a/src/main/java/com/jsh/dao/asset/AssetDAO.java b/src/main/java/com/jsh/dao/asset/AssetDAO.java index 7df4bdcb..cb747475 100644 --- a/src/main/java/com/jsh/dao/asset/AssetDAO.java +++ b/src/main/java/com/jsh/dao/asset/AssetDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.asset; import com.jsh.base.BaseDAO; import com.jsh.model.po.Asset; -public class AssetDAO extends BaseDAO implements AssetIDAO -{ - /** +public class AssetDAO extends BaseDAO implements AssetIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return Asset.class; } } diff --git a/src/main/java/com/jsh/dao/asset/AssetIDAO.java b/src/main/java/com/jsh/dao/asset/AssetIDAO.java index 8bd454fe..76c302b2 100644 --- a/src/main/java/com/jsh/dao/asset/AssetIDAO.java +++ b/src/main/java/com/jsh/dao/asset/AssetIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.asset; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Asset; -public interface AssetIDAO extends BaseIDAO -{ - +public interface AssetIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/asset/ReportDAO.java b/src/main/java/com/jsh/dao/asset/ReportDAO.java index 7cdb034e..51cd1888 100644 --- a/src/main/java/com/jsh/dao/asset/ReportDAO.java +++ b/src/main/java/com/jsh/dao/asset/ReportDAO.java @@ -1,20 +1,17 @@ package com.jsh.dao.asset; +import com.jsh.model.po.Asset; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; +import com.jsh.util.SearchConditionUtil; import org.hibernate.Query; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; -import com.jsh.util.JshException; -import com.jsh.model.po.Asset; -import com.jsh.util.PageUtil; -import com.jsh.util.SearchConditionUtil; - -public class ReportDAO extends HibernateDaoSupport implements ReportIDAO -{ +public class ReportDAO extends HibernateDaoSupport implements ReportIDAO { @SuppressWarnings("unchecked") @Override - public void find(PageUtil pageUtil,String reportType,String reportName) throws JshException - { - Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(" + reportType +") as dataSum, " + reportName + " from Asset asset where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + public void find(PageUtil pageUtil, String reportType, String reportName) throws JshException { + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(" + reportType + ") as dataSum, " + reportName + " from Asset asset where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); pageUtil.setTotalCount(query.list().size()); pageUtil.setPageList(query.list()); } diff --git a/src/main/java/com/jsh/dao/asset/ReportIDAO.java b/src/main/java/com/jsh/dao/asset/ReportIDAO.java index 1281c90c..18adba81 100644 --- a/src/main/java/com/jsh/dao/asset/ReportIDAO.java +++ b/src/main/java/com/jsh/dao/asset/ReportIDAO.java @@ -1,16 +1,16 @@ package com.jsh.dao.asset; -import com.jsh.util.JshException; import com.jsh.model.po.Asset; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public interface ReportIDAO -{ +public interface ReportIDAO { /** * 查找资产列表 - * @param pageUtil 分页工具类 + * + * @param pageUtil 分页工具类 * @param reportType 报表统计字段 * @throws JshException */ - void find(PageUtil pageUtil,String reportType,String reportName) throws JshException; + void find(PageUtil pageUtil, String reportType, String reportName) throws JshException; } diff --git a/src/main/java/com/jsh/dao/basic/AccountDAO.java b/src/main/java/com/jsh/dao/basic/AccountDAO.java index c1974fcf..399b3943 100644 --- a/src/main/java/com/jsh/dao/basic/AccountDAO.java +++ b/src/main/java/com/jsh/dao/basic/AccountDAO.java @@ -7,15 +7,14 @@ import com.jsh.util.PageUtil; import com.jsh.util.SearchConditionUtil; import org.hibernate.Query; -public class AccountDAO extends BaseDAO implements AccountIDAO -{ +public class AccountDAO extends BaseDAO implements AccountIDAO { /** * 设置dao映射基类 + * * @return */ @Override - public Class getEntityClass() - { + public Class getEntityClass() { return Account.class; } @@ -25,15 +24,15 @@ public class AccountDAO extends BaseDAO implements AccountIDAO //主表出入库涉及的账户 queryString.append("select dh.Number,concat(dh.SubType,dh.Type) as newType,s.supplier,dh.ChangeAmount,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime,'' as AList,'' as AMList " + " from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id where 1=1 "); - if(accountId!=null && !accountId.equals("")) { - queryString.append(" and dh.AccountId='"+ accountId +"' "); + if (accountId != null && !accountId.equals("")) { + queryString.append(" and dh.AccountId='" + accountId + "' "); } //主表收入和支出涉及的账户 queryString.append("UNION ALL " + "select ah.BillNo,ah.Type as newType,s.supplier,ah.ChangeAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime,'' as AList,'' as AMList " + " from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id where 1=1 "); - if(accountId!=null && !accountId.equals("")) { - queryString.append(" and ah.AccountId='"+ accountId +"' "); + if (accountId != null && !accountId.equals("")) { + queryString.append(" and ah.AccountId='" + accountId + "' "); } //明细中涉及的账户(收款,付款,收预付款) queryString.append("UNION ALL " + @@ -41,31 +40,31 @@ public class AccountDAO extends BaseDAO implements AccountIDAO " from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id " + " inner join jsh_accountitem ai on ai.HeaderId=ah.Id " + " where ah.Type in ('收款','付款','收预付款') "); - if(accountId!=null && !accountId.equals("")) { - queryString.append(" and ai.AccountId='"+ accountId +"' "); + if (accountId != null && !accountId.equals("")) { + queryString.append(" and ai.AccountId='" + accountId + "' "); } //主表中转出的账户 queryString.append("UNION ALL " + "select ah.BillNo,ah.Type as newType, '' as sName,ah.ChangeAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime,'' as AList,'' as AMList " + " from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id " + " where ah.Type='转账' "); - if(accountId!=null && !accountId.equals("")) { - queryString.append(" and ah.AccountId='"+ accountId +"' "); + if (accountId != null && !accountId.equals("")) { + queryString.append(" and ah.AccountId='" + accountId + "' "); } //明细中被转入的账户 queryString.append("UNION ALL " + "select ah.BillNo,ah.Type as newType, '' as sName,ai.EachAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime,'' as AList,'' as AMList " + " from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id " + " where ah.Type='转账' "); - if(accountId!=null && !accountId.equals("")) { - queryString.append(" and ai.AccountId='"+ accountId +"' "); + if (accountId != null && !accountId.equals("")) { + queryString.append(" and ai.AccountId='" + accountId + "' "); } //多账户的情况 queryString.append("UNION ALL " + "select dh.Number,concat(dh.SubType,dh.Type) as newType,s.supplier,dh.ChangeAmount,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime,dh.AccountIdList,dh.AccountMoneyList" + " from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id where 1=1 "); - if(accountId!=null && !accountId.equals("")) { - queryString.append(" and dh.AccountIdList like '%\""+ accountId +"\"%' "); + if (accountId != null && !accountId.equals("")) { + queryString.append(" and dh.AccountIdList like '%\"" + accountId + "\"%' "); } queryString.append(" ORDER BY oTime desc"); Query query; diff --git a/src/main/java/com/jsh/dao/basic/AppDAO.java b/src/main/java/com/jsh/dao/basic/AppDAO.java index 82bf34ee..134c3be2 100644 --- a/src/main/java/com/jsh/dao/basic/AppDAO.java +++ b/src/main/java/com/jsh/dao/basic/AppDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.App; -public class AppDAO extends BaseDAO implements AppIDAO -{ - /** +public class AppDAO extends BaseDAO implements AppIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return App.class; } } diff --git a/src/main/java/com/jsh/dao/basic/AppIDAO.java b/src/main/java/com/jsh/dao/basic/AppIDAO.java index 954c447b..e0a99dbf 100644 --- a/src/main/java/com/jsh/dao/basic/AppIDAO.java +++ b/src/main/java/com/jsh/dao/basic/AppIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.App; -public interface AppIDAO extends BaseIDAO -{ - +public interface AppIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/basic/AssetNameDAO.java b/src/main/java/com/jsh/dao/basic/AssetNameDAO.java index acf3b783..6d4f2173 100644 --- a/src/main/java/com/jsh/dao/basic/AssetNameDAO.java +++ b/src/main/java/com/jsh/dao/basic/AssetNameDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Assetname; -public class AssetNameDAO extends BaseDAO implements AssetNameIDAO -{ - /** +public class AssetNameDAO extends BaseDAO implements AssetNameIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return Assetname.class; } } diff --git a/src/main/java/com/jsh/dao/basic/AssetNameIDAO.java b/src/main/java/com/jsh/dao/basic/AssetNameIDAO.java index 7942aae8..919b0df9 100644 --- a/src/main/java/com/jsh/dao/basic/AssetNameIDAO.java +++ b/src/main/java/com/jsh/dao/basic/AssetNameIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Assetname; -public interface AssetNameIDAO extends BaseIDAO -{ - +public interface AssetNameIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/basic/CategoryDAO.java b/src/main/java/com/jsh/dao/basic/CategoryDAO.java index b63ce3ec..31045c0c 100644 --- a/src/main/java/com/jsh/dao/basic/CategoryDAO.java +++ b/src/main/java/com/jsh/dao/basic/CategoryDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Category; -public class CategoryDAO extends BaseDAO implements CategoryIDAO -{ - /** +public class CategoryDAO extends BaseDAO implements CategoryIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return Category.class; } } diff --git a/src/main/java/com/jsh/dao/basic/CategoryIDAO.java b/src/main/java/com/jsh/dao/basic/CategoryIDAO.java index 75869021..d46bb3aa 100644 --- a/src/main/java/com/jsh/dao/basic/CategoryIDAO.java +++ b/src/main/java/com/jsh/dao/basic/CategoryIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Category; -public interface CategoryIDAO extends BaseIDAO -{ - +public interface CategoryIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/basic/DepotDAO.java b/src/main/java/com/jsh/dao/basic/DepotDAO.java index 5cba5386..ce138a6c 100644 --- a/src/main/java/com/jsh/dao/basic/DepotDAO.java +++ b/src/main/java/com/jsh/dao/basic/DepotDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Depot; -public class DepotDAO extends BaseDAO implements DepotIDAO -{ - /** +public class DepotDAO extends BaseDAO implements DepotIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return Depot.class; } } diff --git a/src/main/java/com/jsh/dao/basic/DepotIDAO.java b/src/main/java/com/jsh/dao/basic/DepotIDAO.java index fbf407b7..803c4ad8 100644 --- a/src/main/java/com/jsh/dao/basic/DepotIDAO.java +++ b/src/main/java/com/jsh/dao/basic/DepotIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Depot; -public interface DepotIDAO extends BaseIDAO -{ - +public interface DepotIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/basic/FunctionsDAO.java b/src/main/java/com/jsh/dao/basic/FunctionsDAO.java index f163b695..62b9d9b1 100644 --- a/src/main/java/com/jsh/dao/basic/FunctionsDAO.java +++ b/src/main/java/com/jsh/dao/basic/FunctionsDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Functions; -public class FunctionsDAO extends BaseDAO implements FunctionsIDAO -{ - /** +public class FunctionsDAO extends BaseDAO implements FunctionsIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return Functions.class; } } diff --git a/src/main/java/com/jsh/dao/basic/FunctionsIDAO.java b/src/main/java/com/jsh/dao/basic/FunctionsIDAO.java index 53d4cd0c..c2fc936a 100644 --- a/src/main/java/com/jsh/dao/basic/FunctionsIDAO.java +++ b/src/main/java/com/jsh/dao/basic/FunctionsIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Functions; -public interface FunctionsIDAO extends BaseIDAO -{ - +public interface FunctionsIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/basic/InOutItemDAO.java b/src/main/java/com/jsh/dao/basic/InOutItemDAO.java index 669fcdde..20022605 100644 --- a/src/main/java/com/jsh/dao/basic/InOutItemDAO.java +++ b/src/main/java/com/jsh/dao/basic/InOutItemDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.InOutItem; -public class InOutItemDAO extends BaseDAO implements InOutItemIDAO -{ +public class InOutItemDAO extends BaseDAO implements InOutItemIDAO { /** * 设置dao映射基类 + * * @return */ @Override - public Class getEntityClass() - { + public Class getEntityClass() { return InOutItem.class; } } diff --git a/src/main/java/com/jsh/dao/basic/InOutItemIDAO.java b/src/main/java/com/jsh/dao/basic/InOutItemIDAO.java index c9c96d41..00949f26 100644 --- a/src/main/java/com/jsh/dao/basic/InOutItemIDAO.java +++ b/src/main/java/com/jsh/dao/basic/InOutItemIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.InOutItem; -public interface InOutItemIDAO extends BaseIDAO -{ +public interface InOutItemIDAO extends BaseIDAO { } diff --git a/src/main/java/com/jsh/dao/basic/LogDAO.java b/src/main/java/com/jsh/dao/basic/LogDAO.java index 4d065409..bf204aac 100644 --- a/src/main/java/com/jsh/dao/basic/LogDAO.java +++ b/src/main/java/com/jsh/dao/basic/LogDAO.java @@ -3,16 +3,15 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Logdetails; -public class LogDAO extends BaseDAO implements LogIDAO -{ - /** +public class LogDAO extends BaseDAO implements LogIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { - return Logdetails.class; - } + @Override + public Class getEntityClass() { + return Logdetails.class; + } } diff --git a/src/main/java/com/jsh/dao/basic/LogIDAO.java b/src/main/java/com/jsh/dao/basic/LogIDAO.java index 9a86c2c6..52586322 100644 --- a/src/main/java/com/jsh/dao/basic/LogIDAO.java +++ b/src/main/java/com/jsh/dao/basic/LogIDAO.java @@ -5,9 +5,9 @@ import com.jsh.model.po.Logdetails; /** * 日志相关处理接口 + * * @author angel */ -public interface LogIDAO extends BaseIDAO -{ - +public interface LogIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/basic/RoleDAO.java b/src/main/java/com/jsh/dao/basic/RoleDAO.java index bdc6c384..2695eb78 100644 --- a/src/main/java/com/jsh/dao/basic/RoleDAO.java +++ b/src/main/java/com/jsh/dao/basic/RoleDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Role; -public class RoleDAO extends BaseDAO implements RoleIDAO -{ - /** +public class RoleDAO extends BaseDAO implements RoleIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return Role.class; } } diff --git a/src/main/java/com/jsh/dao/basic/RoleIDAO.java b/src/main/java/com/jsh/dao/basic/RoleIDAO.java index c11ee2aa..10f246bd 100644 --- a/src/main/java/com/jsh/dao/basic/RoleIDAO.java +++ b/src/main/java/com/jsh/dao/basic/RoleIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Role; -public interface RoleIDAO extends BaseIDAO -{ - +public interface RoleIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/basic/SupplierDAO.java b/src/main/java/com/jsh/dao/basic/SupplierDAO.java index 617f26fa..1300715d 100644 --- a/src/main/java/com/jsh/dao/basic/SupplierDAO.java +++ b/src/main/java/com/jsh/dao/basic/SupplierDAO.java @@ -2,27 +2,24 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Supplier; -import com.jsh.util.JshException; -import com.jsh.util.SearchConditionUtil; import org.hibernate.Query; -public class SupplierDAO extends BaseDAO implements SupplierIDAO -{ - /** +public class SupplierDAO extends BaseDAO implements SupplierIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { - return Supplier.class; - } + @Override + public Class getEntityClass() { + return Supplier.class; + } - @SuppressWarnings("unchecked") - @Override - public void batchSetEnable(Boolean enable,String supplierIDs) { - String sql="update jsh_supplier s set s.enabled=" + enable + " where s.id in (" + supplierIDs + ")"; - Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(sql); - query.executeUpdate(); - } + @SuppressWarnings("unchecked") + @Override + public void batchSetEnable(Boolean enable, String supplierIDs) { + String sql = "update jsh_supplier s set s.enabled=" + enable + " where s.id in (" + supplierIDs + ")"; + Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(sql); + query.executeUpdate(); + } } diff --git a/src/main/java/com/jsh/dao/basic/SupplierIDAO.java b/src/main/java/com/jsh/dao/basic/SupplierIDAO.java index dbdf12f2..50dd50c7 100644 --- a/src/main/java/com/jsh/dao/basic/SupplierIDAO.java +++ b/src/main/java/com/jsh/dao/basic/SupplierIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Supplier; -public interface SupplierIDAO extends BaseIDAO -{ - public void batchSetEnable(Boolean enable,String supplierIDs); +public interface SupplierIDAO extends BaseIDAO { + public void batchSetEnable(Boolean enable, String supplierIDs); } diff --git a/src/main/java/com/jsh/dao/basic/SystemConfigDAO.java b/src/main/java/com/jsh/dao/basic/SystemConfigDAO.java index 141bf76d..79754f2d 100644 --- a/src/main/java/com/jsh/dao/basic/SystemConfigDAO.java +++ b/src/main/java/com/jsh/dao/basic/SystemConfigDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.SystemConfig; -public class SystemConfigDAO extends BaseDAO implements SystemConfigIDAO -{ - /** +public class SystemConfigDAO extends BaseDAO implements SystemConfigIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return SystemConfig.class; } } diff --git a/src/main/java/com/jsh/dao/basic/SystemConfigIDAO.java b/src/main/java/com/jsh/dao/basic/SystemConfigIDAO.java index 5adf9196..01b1b735 100644 --- a/src/main/java/com/jsh/dao/basic/SystemConfigIDAO.java +++ b/src/main/java/com/jsh/dao/basic/SystemConfigIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.SystemConfig; -public interface SystemConfigIDAO extends BaseIDAO -{ - +public interface SystemConfigIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/basic/UnitDAO.java b/src/main/java/com/jsh/dao/basic/UnitDAO.java index a083eb94..674f7fce 100644 --- a/src/main/java/com/jsh/dao/basic/UnitDAO.java +++ b/src/main/java/com/jsh/dao/basic/UnitDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Unit; -public class UnitDAO extends BaseDAO implements UnitIDAO -{ - /** +public class UnitDAO extends BaseDAO implements UnitIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return Unit.class; } } diff --git a/src/main/java/com/jsh/dao/basic/UnitIDAO.java b/src/main/java/com/jsh/dao/basic/UnitIDAO.java index aa6d389c..19e1ca65 100644 --- a/src/main/java/com/jsh/dao/basic/UnitIDAO.java +++ b/src/main/java/com/jsh/dao/basic/UnitIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Unit; -public interface UnitIDAO extends BaseIDAO -{ - +public interface UnitIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/basic/UserBusinessDAO.java b/src/main/java/com/jsh/dao/basic/UserBusinessDAO.java index 41c0260b..da66f5b4 100644 --- a/src/main/java/com/jsh/dao/basic/UserBusinessDAO.java +++ b/src/main/java/com/jsh/dao/basic/UserBusinessDAO.java @@ -1,30 +1,26 @@ package com.jsh.dao.basic; -import org.hibernate.Query; - import com.jsh.base.BaseDAO; -import com.jsh.util.JshException; -import com.jsh.model.po.Asset; import com.jsh.model.po.UserBusiness; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; import com.jsh.util.SearchConditionUtil; +import org.hibernate.Query; -public class UserBusinessDAO extends BaseDAO implements UserBusinessIDAO -{ - /** +public class UserBusinessDAO extends BaseDAO implements UserBusinessIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return UserBusiness.class; } - + @SuppressWarnings("unchecked") @Override - public void find(PageUtil pageUtil,String ceshi) throws JshException - { + public void find(PageUtil pageUtil, String ceshi) throws JshException { Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select count(id),sum(id) from UserBusiness userBusiness where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); pageUtil.setTotalCount(query.list().size()); pageUtil.setPageList(query.list()); diff --git a/src/main/java/com/jsh/dao/basic/UserBusinessIDAO.java b/src/main/java/com/jsh/dao/basic/UserBusinessIDAO.java index e50ffc8d..2b36142b 100644 --- a/src/main/java/com/jsh/dao/basic/UserBusinessIDAO.java +++ b/src/main/java/com/jsh/dao/basic/UserBusinessIDAO.java @@ -1,14 +1,13 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; -import com.jsh.util.JshException; import com.jsh.model.po.UserBusiness; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public interface UserBusinessIDAO extends BaseIDAO -{ - /* - * 测试hql语句 - */ - void find(PageUtil pageUtil,String ceshi) throws JshException; +public interface UserBusinessIDAO extends BaseIDAO { + /* + * 测试hql语句 + */ + void find(PageUtil pageUtil, String ceshi) throws JshException; } diff --git a/src/main/java/com/jsh/dao/basic/UserDAO.java b/src/main/java/com/jsh/dao/basic/UserDAO.java index 1f6dcc47..9cb5a6b0 100644 --- a/src/main/java/com/jsh/dao/basic/UserDAO.java +++ b/src/main/java/com/jsh/dao/basic/UserDAO.java @@ -3,17 +3,16 @@ package com.jsh.dao.basic; import com.jsh.base.BaseDAO; import com.jsh.model.po.Basicuser; -public class UserDAO extends BaseDAO implements UserIDAO -{ - /** +public class UserDAO extends BaseDAO implements UserIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { - return Basicuser.class; - } - - + @Override + public Class getEntityClass() { + return Basicuser.class; + } + + } diff --git a/src/main/java/com/jsh/dao/basic/UserIDAO.java b/src/main/java/com/jsh/dao/basic/UserIDAO.java index 1910baa6..ef53ae63 100644 --- a/src/main/java/com/jsh/dao/basic/UserIDAO.java +++ b/src/main/java/com/jsh/dao/basic/UserIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.basic; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Basicuser; -public interface UserIDAO extends BaseIDAO -{ - +public interface UserIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/materials/AccountHeadDAO.java b/src/main/java/com/jsh/dao/materials/AccountHeadDAO.java index cbd2f0c1..00fb2b50 100644 --- a/src/main/java/com/jsh/dao/materials/AccountHeadDAO.java +++ b/src/main/java/com/jsh/dao/materials/AccountHeadDAO.java @@ -1,52 +1,45 @@ package com.jsh.dao.materials; -import org.hibernate.Query; - import com.jsh.base.BaseDAO; -import com.jsh.util.JshException; import com.jsh.model.po.AccountHead; -import com.jsh.model.po.DepotHead; -import com.jsh.model.po.UserBusiness; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; import com.jsh.util.SearchConditionUtil; +import org.hibernate.Query; /** * @author alan */ -public class AccountHeadDAO extends BaseDAO implements AccountHeadIDAO -{ +public class AccountHeadDAO extends BaseDAO implements AccountHeadIDAO { /** * 设置dao映射基类 + * * @return */ @Override - public Class getEntityClass() - { + public Class getEntityClass() { return AccountHead.class; } - + @SuppressWarnings("unchecked") @Override - public void find(PageUtil pageUtil,String maxid) throws JshException - { + public void find(PageUtil pageUtil, String maxid) throws JshException { Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from AccountHead accountHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); pageUtil.setTotalCount(query.list().size()); pageUtil.setPageList(query.list()); } - + @SuppressWarnings("unchecked") @Override - public void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String mode) throws JshException - { + public void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String mode) throws JshException { Query query; String modeName = ""; - if(mode.equals("实际")){ - modeName = "ChangeAmount"; + if (mode.equals("实际")) { + modeName = "ChangeAmount"; + } else if (mode.equals("合计")) { + modeName = "TotalPrice"; } - else if(mode.equals("合计")){ - modeName = "TotalPrice"; - } - query= this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select sum(" + modeName + ") as allMoney from AccountHead accountHead where Type='" + type + "' and OrganId =" + supplierId + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select sum(" + modeName + ") as allMoney from AccountHead accountHead where Type='" + type + "' and OrganId =" + supplierId + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); pageUtil.setTotalCount(query.list().size()); pageUtil.setPageList(query.list()); } diff --git a/src/main/java/com/jsh/dao/materials/AccountHeadIDAO.java b/src/main/java/com/jsh/dao/materials/AccountHeadIDAO.java index a96b7eaa..a84c5cda 100644 --- a/src/main/java/com/jsh/dao/materials/AccountHeadIDAO.java +++ b/src/main/java/com/jsh/dao/materials/AccountHeadIDAO.java @@ -1,18 +1,15 @@ package com.jsh.dao.materials; import com.jsh.base.BaseIDAO; -import com.jsh.util.JshException; import com.jsh.model.po.AccountHead; -import com.jsh.model.po.DepotHead; -import com.jsh.model.po.UserBusiness; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public interface AccountHeadIDAO extends BaseIDAO -{ +public interface AccountHeadIDAO extends BaseIDAO { /* * 获取MaxId */ - void find(PageUtil pageUtil,String maxid) throws JshException; - + void find(PageUtil pageUtil, String maxid) throws JshException; + void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String mode) throws JshException; } diff --git a/src/main/java/com/jsh/dao/materials/AccountItemDAO.java b/src/main/java/com/jsh/dao/materials/AccountItemDAO.java index 31472f9c..60714f56 100644 --- a/src/main/java/com/jsh/dao/materials/AccountItemDAO.java +++ b/src/main/java/com/jsh/dao/materials/AccountItemDAO.java @@ -1,22 +1,16 @@ package com.jsh.dao.materials; -import org.hibernate.Query; - import com.jsh.base.BaseDAO; -import com.jsh.util.JshException; import com.jsh.model.po.AccountItem; -import com.jsh.util.PageUtil; -import com.jsh.util.SearchConditionUtil; -public class AccountItemDAO extends BaseDAO implements AccountItemIDAO -{ +public class AccountItemDAO extends BaseDAO implements AccountItemIDAO { /** * 设置dao映射基类 + * * @return */ @Override - public Class getEntityClass() - { + public Class getEntityClass() { return AccountItem.class; } } diff --git a/src/main/java/com/jsh/dao/materials/AccountItemIDAO.java b/src/main/java/com/jsh/dao/materials/AccountItemIDAO.java index 56ff921c..4982d386 100644 --- a/src/main/java/com/jsh/dao/materials/AccountItemIDAO.java +++ b/src/main/java/com/jsh/dao/materials/AccountItemIDAO.java @@ -1,12 +1,9 @@ package com.jsh.dao.materials; import com.jsh.base.BaseIDAO; -import com.jsh.util.JshException; import com.jsh.model.po.AccountItem; -import com.jsh.util.PageUtil; -public interface AccountItemIDAO extends BaseIDAO -{ - +public interface AccountItemIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java b/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java index 146d7bed..a951e532 100644 --- a/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java +++ b/src/main/java/com/jsh/dao/materials/DepotHeadDAO.java @@ -1,61 +1,57 @@ package com.jsh.dao.materials; -import org.hibernate.Query; - import com.jsh.base.BaseDAO; -import com.jsh.util.JshException; import com.jsh.model.po.DepotHead; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; import com.jsh.util.SearchConditionUtil; +import org.hibernate.Query; public class DepotHeadDAO extends BaseDAO implements DepotHeadIDAO { - /** + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return DepotHead.class; } - + @SuppressWarnings("unchecked") @Override - public void find(PageUtil pageUtil,String maxid) throws JshException - { + public void find(PageUtil pageUtil, String maxid) throws JshException { Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select max(Id) as Id from DepotHead depotHead where 1=1 " + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); pageUtil.setTotalCount(query.list().size()); pageUtil.setPageList(query.list()); } - + @SuppressWarnings("unchecked") @Override - public void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException - { + public void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String subType, String mode) throws JshException { Query query; String modeName = ""; - if(mode.equals("实际")){ - modeName = "ChangeAmount"; + if (mode.equals("实际")) { + modeName = "ChangeAmount"; + } else if (mode.equals("合计")) { + modeName = "DiscountLastMoney"; } - else if(mode.equals("合计")){ - modeName = "DiscountLastMoney"; - } - query= this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select sum(" + modeName + ") as allMoney from DepotHead depotHead where Type='" + type + "' and SubType = '" + subType + "' and OrganId =" + supplierId + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); + query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("select sum(" + modeName + ") as allMoney from DepotHead depotHead where Type='" + type + "' and SubType = '" + subType + "' and OrganId =" + supplierId + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); pageUtil.setTotalCount(query.list().size()); pageUtil.setPageList(query.list()); } @SuppressWarnings("unchecked") @Override - public void batchSetStatus(Boolean status,String depotHeadIDs) { - String sql="update jsh_depothead d set d.Status=" + status + " where d.id in (" + depotHeadIDs + ")"; + public void batchSetStatus(Boolean status, String depotHeadIDs) { + String sql = "update jsh_depothead d set d.Status=" + status + " where d.id in (" + depotHeadIDs + ")"; Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(sql); query.executeUpdate(); } @Override @SuppressWarnings("unchecked") - public void findInDetail(PageUtil pageUtil,String beginTime,String endTime,String type,Long pid,String dids,Long oId) throws JshException { + public void findInDetail(PageUtil pageUtil, String beginTime, String endTime, String type, Long pid, String dids, Long oId) throws JshException { StringBuffer queryString = new StringBuffer(); queryString.append("select dh.Number,m.`name`,m.Model,di.UnitPrice,di.OperNumber,di.AllPrice,s.supplier,d.dName," + "date_format(dh.OperTime, '%Y-%m-%d'), concat(dh.SubType,dh.Type) as newType " + @@ -63,18 +59,17 @@ public class DepotHeadDAO extends BaseDAO implements DepotHeadIDAO { "inner join jsh_material m on m.id=di.MaterialId " + "inner join jsh_supplier s on s.id=dh.OrganId " + "inner join (select id,name as dName from jsh_depot) d on d.id=di.DepotId " + - "where dh.OperTime >='"+ beginTime +"' and dh.OperTime <='"+ endTime +"' "); - if(oId!=null){ - queryString.append(" and dh.OrganId = "+ oId ); + "where dh.OperTime >='" + beginTime + "' and dh.OperTime <='" + endTime + "' "); + if (oId != null) { + queryString.append(" and dh.OrganId = " + oId); } - if(pid!=null){ - queryString.append(" and di.DepotId=" + pid ); + if (pid != null) { + queryString.append(" and di.DepotId=" + pid); + } else { + queryString.append(" and di.DepotId in (" + dids + ")"); } - else { - queryString.append(" and di.DepotId in (" + dids + ")" ); - } - if(type!=null && !type.equals("")) { - queryString.append(" and dh.Type='"+ type +"'"); + if (type != null && !type.equals("")) { + queryString.append(" and dh.Type='" + type + "'"); } queryString.append(" ORDER BY OperTime DESC,Number desc"); Query query; @@ -92,49 +87,46 @@ public class DepotHeadDAO extends BaseDAO implements DepotHeadIDAO { @Override @SuppressWarnings("unchecked") - public void findInOutMaterialCount(PageUtil pageUtil,String beginTime,String endTime,String type,Long pid,String dids,Long oId) throws JshException { + public void findInOutMaterialCount(PageUtil pageUtil, String beginTime, String endTime, String type, Long pid, String dids, Long oId) throws JshException { StringBuffer queryString = new StringBuffer(); queryString.append("select di.MaterialId, m.mName,m.Model,m.categoryName, "); //数量汇总 queryString.append(" (select sum(jdi.BasicNumber) numSum from jsh_depothead jdh INNER JOIN jsh_depotitem jdi " + "on jdh.id=jdi.HeaderId where jdi.MaterialId=di.MaterialId " + - " and jdh.type='"+ type +"' and jdh.OperTime >='"+ beginTime +"' and jdh.OperTime <='"+ endTime +"'"); - if(oId!=null){ - queryString.append(" and jdh.OrganId = "+ oId ); + " and jdh.type='" + type + "' and jdh.OperTime >='" + beginTime + "' and jdh.OperTime <='" + endTime + "'"); + if (oId != null) { + queryString.append(" and jdh.OrganId = " + oId); } - if(pid!=null){ - queryString.append(" and jdi.DepotId=" + pid ); - } - else { - queryString.append(" and jdi.DepotId in (" + dids + ")" ); + if (pid != null) { + queryString.append(" and jdi.DepotId=" + pid); + } else { + queryString.append(" and jdi.DepotId in (" + dids + ")"); } queryString.append(" ) numSum, "); //金额汇总 queryString.append(" (select sum(jdi.AllPrice) priceSum from jsh_depothead jdh INNER JOIN jsh_depotitem jdi " + "on jdh.id=jdi.HeaderId where jdi.MaterialId=di.MaterialId " + - " and jdh.type='"+ type +"' and jdh.OperTime >='"+ beginTime +"' and jdh.OperTime <='"+ endTime +"'"); - if(oId!=null){ - queryString.append(" and jdh.OrganId = "+ oId ); + " and jdh.type='" + type + "' and jdh.OperTime >='" + beginTime + "' and jdh.OperTime <='" + endTime + "'"); + if (oId != null) { + queryString.append(" and jdh.OrganId = " + oId); } - if(pid!=null){ - queryString.append(" and jdi.DepotId=" + pid ); - } - else { - queryString.append(" and jdi.DepotId in (" + dids + ")" ); + if (pid != null) { + queryString.append(" and jdi.DepotId=" + pid); + } else { + queryString.append(" and jdi.DepotId in (" + dids + ")"); } queryString.append(" ) priceSum "); queryString.append(" from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId " + " INNER JOIN (SELECT jsh_material.id,jsh_material.name mName, Model,jsh_materialcategory.`Name` categoryName from jsh_material INNER JOIN jsh_materialcategory on jsh_material.CategoryId=jsh_materialcategory.Id) m " + - " on m.Id=di.MaterialId where dh.type='"+ type +"' and dh.OperTime >='"+ beginTime +"' and dh.OperTime <='"+ endTime +"' "); - if(oId!=null){ - queryString.append(" and dh.OrganId = "+ oId ); + " on m.Id=di.MaterialId where dh.type='" + type + "' and dh.OperTime >='" + beginTime + "' and dh.OperTime <='" + endTime + "' "); + if (oId != null) { + queryString.append(" and dh.OrganId = " + oId); } - if(pid!=null){ - queryString.append(" and di.DepotId=" + pid ); - } - else { - queryString.append(" and di.DepotId in (" + dids + ")" ); + if (pid != null) { + queryString.append(" and di.DepotId=" + pid); + } else { + queryString.append(" and di.DepotId in (" + dids + ")"); } queryString.append(" GROUP BY di.MaterialId,m.mName,m.Model,m.categoryName "); Query query; @@ -151,29 +143,29 @@ public class DepotHeadDAO extends BaseDAO implements DepotHeadIDAO { } @SuppressWarnings("unchecked") - public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId) throws JshException { + public void findMaterialsListByHeaderId(PageUtil pageUtil, Long headerId) throws JshException { StringBuffer queryString = new StringBuffer(); queryString.append("select group_concat(concat(jsh_material.`Name`,' ',jsh_material.Model)) as mName from jsh_depotitem inner join jsh_material " + - " on jsh_depotitem.MaterialId = jsh_material.Id where jsh_depotitem.HeaderId ="+ headerId); + " on jsh_depotitem.MaterialId = jsh_material.Id where jsh_depotitem.HeaderId =" + headerId); Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); pageUtil.setPageList(query.list()); } @SuppressWarnings("unchecked") - public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId,String supType) throws JshException { + public void findStatementAccount(PageUtil pageUtil, String beginTime, String endTime, Long organId, String supType) throws JshException { StringBuffer queryString = new StringBuffer(); queryString.append("select dh.Number,concat(dh.SubType,dh.Type) as newType,dh.DiscountLastMoney,dh.ChangeAmount,s.supplier,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_depothead dh " + "inner join jsh_supplier s on s.id=dh.OrganId where s.type='" + supType + "' and dh.SubType!='其它' " + - "and dh.OperTime >='"+ beginTime +"' and dh.OperTime<='"+ endTime +"' "); - if(organId!=null && !organId.equals("")) { - queryString.append(" and dh.OrganId='"+ organId +"' "); + "and dh.OperTime >='" + beginTime + "' and dh.OperTime<='" + endTime + "' "); + if (organId != null && !organId.equals("")) { + queryString.append(" and dh.OrganId='" + organId + "' "); } queryString.append("UNION ALL " + "select ah.BillNo,ah.Type as newType,ah.TotalPrice,ah.ChangeAmount,s.supplier,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_accounthead ah " + "inner join jsh_supplier s on s.id=ah.OrganId where s.type='" + supType + "' " + - "and ah.BillTime >='"+ beginTime +"' and ah.BillTime<='"+ endTime +"' "); - if(organId!=null && !organId.equals("")) { - queryString.append(" and ah.OrganId='"+ organId +"' "); + "and ah.BillTime >='" + beginTime + "' and ah.BillTime<='" + endTime + "' "); + if (organId != null && !organId.equals("")) { + queryString.append(" and ah.OrganId='" + organId + "' "); } queryString.append(" ORDER BY oTime"); Query query; @@ -191,11 +183,11 @@ public class DepotHeadDAO extends BaseDAO implements DepotHeadIDAO { @Override @SuppressWarnings("unchecked") - public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam,String depotIds) throws JshException { + public void getHeaderIdByMaterial(PageUtil pageUtil, String materialParam, String depotIds) throws JshException { StringBuffer queryString = new StringBuffer(); - queryString.append("select dt.HeaderId from jsh_depotitem dt INNER JOIN jsh_material m on dt.MaterialId = m.Id where ( m.`Name` "+ + queryString.append("select dt.HeaderId from jsh_depotitem dt INNER JOIN jsh_material m on dt.MaterialId = m.Id where ( m.`Name` " + " like '%" + materialParam + "%' or m.Model like '%" + materialParam + "%') "); - if(!depotIds.equals("")){ + if (!depotIds.equals("")) { queryString.append(" and dt.DepotId in (" + depotIds + ") "); } Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); diff --git a/src/main/java/com/jsh/dao/materials/DepotItemDAO.java b/src/main/java/com/jsh/dao/materials/DepotItemDAO.java index 8c29b634..a942fa85 100644 --- a/src/main/java/com/jsh/dao/materials/DepotItemDAO.java +++ b/src/main/java/com/jsh/dao/materials/DepotItemDAO.java @@ -8,6 +8,11 @@ import com.jsh.util.SearchConditionUtil; import org.hibernate.Query; public class DepotItemDAO extends BaseDAO implements DepotItemIDAO { + private final static String TYPE = "入库"; + private final static String SUM_TYPE = "Number"; + private final static String IN = "in"; + private final static String OUT = "out"; + /** * 设置dao映射基类 * @@ -18,8 +23,6 @@ public class DepotItemDAO extends BaseDAO implements DepotItemIDAO { return DepotItem.class; } - private final static String TYPE = "入库"; - @SuppressWarnings("unchecked") @Override public void findByType(PageUtil pageUtil, String type, Integer dId, Long MId, String MonthTime, Boolean isPrev) throws JshException { @@ -133,8 +136,6 @@ public class DepotItemDAO extends BaseDAO implements DepotItemIDAO { pageUtil.setPageList(query.list()); } - private final static String SUM_TYPE = "Number"; - @SuppressWarnings("unchecked") @Override public void buyOrSale(PageUtil pageUtil, String type, String subType, Long MId, String MonthTime, String sumType) throws JshException { @@ -149,9 +150,6 @@ public class DepotItemDAO extends BaseDAO implements DepotItemIDAO { pageUtil.setPageList(query.list()); } - private final static String IN = "in"; - private final static String OUT = "out"; - @SuppressWarnings("unchecked") @Override public void findGiftByType(PageUtil pageUtil, String subType, Integer ProjectId, Long MId, String type) throws JshException { diff --git a/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java b/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java index 47725e32..3cb22f5a 100644 --- a/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java +++ b/src/main/java/com/jsh/dao/materials/DepotItemIDAO.java @@ -1,22 +1,20 @@ package com.jsh.dao.materials; import com.jsh.base.BaseIDAO; -import com.jsh.util.JshException; -import com.jsh.model.po.DepotHead; import com.jsh.model.po.DepotItem; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public interface DepotItemIDAO extends BaseIDAO -{ - public void findByType(PageUtil pageUtil,String type,Integer ProjectId,Long MId, String MonthTime,Boolean isPrev) throws JshException; +public interface DepotItemIDAO extends BaseIDAO { + public void findByType(PageUtil pageUtil, String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) throws JshException; - public void findByTypeAndMaterialId(PageUtil pageUtil,String type,Long MId) throws JshException; + public void findByTypeAndMaterialId(PageUtil pageUtil, String type, Long MId) throws JshException; - public void findDetailByTypeAndMaterialId(PageUtil pageUtil,Long MId) throws JshException; + public void findDetailByTypeAndMaterialId(PageUtil pageUtil, Long MId) throws JshException; - public void findPriceByType(PageUtil pageUtil,String type,Integer ProjectId,Long MId, String MonthTime,Boolean isPrev) throws JshException; + public void findPriceByType(PageUtil pageUtil, String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) throws JshException; - public void buyOrSale(PageUtil pageUtil,String type, String subType,Long MId, String MonthTime, String sumType) throws JshException; + public void buyOrSale(PageUtil pageUtil, String type, String subType, Long MId, String MonthTime, String sumType) throws JshException; - public void findGiftByType(PageUtil pageUtil,String subType,Integer ProjectId,Long MId, String type) throws JshException; + public void findGiftByType(PageUtil pageUtil, String subType, Integer ProjectId, Long MId, String type) throws JshException; } diff --git a/src/main/java/com/jsh/dao/materials/MaterialCategoryDAO.java b/src/main/java/com/jsh/dao/materials/MaterialCategoryDAO.java index 121ecbb1..60d2e15f 100644 --- a/src/main/java/com/jsh/dao/materials/MaterialCategoryDAO.java +++ b/src/main/java/com/jsh/dao/materials/MaterialCategoryDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.materials; import com.jsh.base.BaseDAO; import com.jsh.model.po.MaterialCategory; -public class MaterialCategoryDAO extends BaseDAO implements MaterialCategoryIDAO -{ - /** +public class MaterialCategoryDAO extends BaseDAO implements MaterialCategoryIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return MaterialCategory.class; } } diff --git a/src/main/java/com/jsh/dao/materials/MaterialCategoryIDAO.java b/src/main/java/com/jsh/dao/materials/MaterialCategoryIDAO.java index 39058cea..e2927851 100644 --- a/src/main/java/com/jsh/dao/materials/MaterialCategoryIDAO.java +++ b/src/main/java/com/jsh/dao/materials/MaterialCategoryIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.materials; import com.jsh.base.BaseIDAO; import com.jsh.model.po.MaterialCategory; -public interface MaterialCategoryIDAO extends BaseIDAO -{ - +public interface MaterialCategoryIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/materials/MaterialDAO.java b/src/main/java/com/jsh/dao/materials/MaterialDAO.java index 6ed55173..a2541d3f 100644 --- a/src/main/java/com/jsh/dao/materials/MaterialDAO.java +++ b/src/main/java/com/jsh/dao/materials/MaterialDAO.java @@ -7,32 +7,31 @@ import com.jsh.util.PageUtil; import com.jsh.util.SearchConditionUtil; import org.hibernate.Query; -public class MaterialDAO extends BaseDAO implements MaterialIDAO -{ - /** +public class MaterialDAO extends BaseDAO implements MaterialIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return Material.class; } @SuppressWarnings("unchecked") @Override - public void batchSetEnable(Boolean enable,String supplierIDs) { - String sql="update jsh_material m set m.enabled=" + enable + " where m.id in (" + supplierIDs + ")"; + public void batchSetEnable(Boolean enable, String supplierIDs) { + String sql = "update jsh_material m set m.enabled=" + enable + " where m.id in (" + supplierIDs + ")"; Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(sql); query.executeUpdate(); } @SuppressWarnings("unchecked") @Override - public void findUnitName(PageUtil pageUtil,Long mId) throws JshException { + public void findUnitName(PageUtil pageUtil, Long mId) throws JshException { //多表联查,多表连查,此处用到了createSQLQuery,可以随便写sql语句,很方便, StringBuffer queryString = new StringBuffer(); - queryString.append("select jsh_unit.UName from jsh_unit inner join jsh_material on UnitId=jsh_unit.id where jsh_material.id="+mId); + queryString.append("select jsh_unit.UName from jsh_unit inner join jsh_material on UnitId=jsh_unit.id where jsh_material.id=" + mId); Query query; query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch())); pageUtil.setTotalCount(query.list().size()); diff --git a/src/main/java/com/jsh/dao/materials/MaterialIDAO.java b/src/main/java/com/jsh/dao/materials/MaterialIDAO.java index 677be348..641bf3ac 100644 --- a/src/main/java/com/jsh/dao/materials/MaterialIDAO.java +++ b/src/main/java/com/jsh/dao/materials/MaterialIDAO.java @@ -5,9 +5,8 @@ import com.jsh.model.po.Material; import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public interface MaterialIDAO extends BaseIDAO -{ - public void batchSetEnable(Boolean enable,String supplierIDs); +public interface MaterialIDAO extends BaseIDAO { + public void batchSetEnable(Boolean enable, String supplierIDs); - public void findUnitName(PageUtil pageUtil,Long mId) throws JshException; + public void findUnitName(PageUtil pageUtil, Long mId) throws JshException; } diff --git a/src/main/java/com/jsh/dao/materials/MaterialPropertyDAO.java b/src/main/java/com/jsh/dao/materials/MaterialPropertyDAO.java index ba8b8bb9..b7e33060 100644 --- a/src/main/java/com/jsh/dao/materials/MaterialPropertyDAO.java +++ b/src/main/java/com/jsh/dao/materials/MaterialPropertyDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.materials; import com.jsh.base.BaseDAO; import com.jsh.model.po.MaterialProperty; -public class MaterialPropertyDAO extends BaseDAO implements MaterialPropertyIDAO -{ - /** +public class MaterialPropertyDAO extends BaseDAO implements MaterialPropertyIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return MaterialProperty.class; } } diff --git a/src/main/java/com/jsh/dao/materials/MaterialPropertyIDAO.java b/src/main/java/com/jsh/dao/materials/MaterialPropertyIDAO.java index da144b83..754160c4 100644 --- a/src/main/java/com/jsh/dao/materials/MaterialPropertyIDAO.java +++ b/src/main/java/com/jsh/dao/materials/MaterialPropertyIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.materials; import com.jsh.base.BaseIDAO; import com.jsh.model.po.MaterialProperty; -public interface MaterialPropertyIDAO extends BaseIDAO -{ - +public interface MaterialPropertyIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/dao/materials/PersonDAO.java b/src/main/java/com/jsh/dao/materials/PersonDAO.java index d397673e..6a5d65dc 100644 --- a/src/main/java/com/jsh/dao/materials/PersonDAO.java +++ b/src/main/java/com/jsh/dao/materials/PersonDAO.java @@ -3,15 +3,14 @@ package com.jsh.dao.materials; import com.jsh.base.BaseDAO; import com.jsh.model.po.Person; -public class PersonDAO extends BaseDAO implements PersonIDAO -{ - /** +public class PersonDAO extends BaseDAO implements PersonIDAO { + /** * 设置dao映射基类 + * * @return */ - @Override - public Class getEntityClass() - { + @Override + public Class getEntityClass() { return Person.class; } } diff --git a/src/main/java/com/jsh/dao/materials/PersonIDAO.java b/src/main/java/com/jsh/dao/materials/PersonIDAO.java index 1a5c121b..d97e31f7 100644 --- a/src/main/java/com/jsh/dao/materials/PersonIDAO.java +++ b/src/main/java/com/jsh/dao/materials/PersonIDAO.java @@ -3,7 +3,6 @@ package com.jsh.dao.materials; import com.jsh.base.BaseIDAO; import com.jsh.model.po.Person; -public interface PersonIDAO extends BaseIDAO -{ - +public interface PersonIDAO extends BaseIDAO { + } diff --git a/src/main/java/com/jsh/model/po/Account.java b/src/main/java/com/jsh/model/po/Account.java index 5974a106..69e11d93 100644 --- a/src/main/java/com/jsh/model/po/Account.java +++ b/src/main/java/com/jsh/model/po/Account.java @@ -1,8 +1,7 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class Account implements java.io.Serializable -{ +public class Account implements java.io.Serializable { private Long Id; private String Name; private String SerialNo; @@ -11,13 +10,11 @@ public class Account implements java.io.Serializable private Boolean IsDefault; private String Remark; - public Account() - { + public Account() { } - public Account(Long Id) - { + public Account(Long Id) { this.Id = Id; } @@ -30,56 +27,46 @@ public class Account implements java.io.Serializable Remark = remark; } - public void setId(Long id) - { - Id = id; - } - - public Long getId() - { + public Long getId() { return Id; } - public void setName(String name) - { - Name = name; + public void setId(Long id) { + Id = id; } - public String getName() - { + public String getName() { return Name; } - public void setSerialNo(String serialNo) - { - SerialNo = serialNo; + public void setName(String name) { + Name = name; } - public String getSerialNo() - { + public String getSerialNo() { return SerialNo; } - public void setInitialAmount(Double initialAmount) - { - InitialAmount = initialAmount; + public void setSerialNo(String serialNo) { + SerialNo = serialNo; } - public Double getInitialAmount() - { + public Double getInitialAmount() { return InitialAmount; } - public void setCurrentAmount(Double currentAmount) - { - CurrentAmount = currentAmount; + public void setInitialAmount(Double initialAmount) { + InitialAmount = initialAmount; } - public Double getCurrentAmount() - { + public Double getCurrentAmount() { return CurrentAmount; } + public void setCurrentAmount(Double currentAmount) { + CurrentAmount = currentAmount; + } + public Boolean getIsDefault() { return IsDefault; } @@ -88,13 +75,11 @@ public class Account implements java.io.Serializable IsDefault = isDefault; } - public void setRemark(String remark) - { - Remark = remark; + public String getRemark() { + return Remark; } - public String getRemark() - { - return Remark; - } + public void setRemark(String remark) { + Remark = remark; + } } diff --git a/src/main/java/com/jsh/model/po/AccountHead.java b/src/main/java/com/jsh/model/po/AccountHead.java index ac4b5de9..99f12789 100644 --- a/src/main/java/com/jsh/model/po/AccountHead.java +++ b/src/main/java/com/jsh/model/po/AccountHead.java @@ -3,33 +3,29 @@ package com.jsh.model.po; import java.sql.Timestamp; @SuppressWarnings("serial") -public class AccountHead implements java.io.Serializable -{ +public class AccountHead implements java.io.Serializable { private Long Id; private String Type; private Supplier OrganId; - private Person HandsPersonId; + private Person HandsPersonId; private Double ChangeAmount; private Double TotalPrice; private Account AccountId; private String BillNo; - private Timestamp BillTime; + private Timestamp BillTime; private String Remark; - public AccountHead() - { + public AccountHead() { } - public AccountHead(Long Id) - { - this.Id = Id ; + public AccountHead(Long Id) { + this.Id = Id; } public AccountHead(String type, Supplier organId, - Person handsPersonId, Double changeAmount, Double totalPrice, - Account accountId, String billNo, Timestamp billTime, String remark) - { + Person handsPersonId, Double changeAmount, Double totalPrice, + Account accountId, String billNo, Timestamp billTime, String remark) { super(); Type = type; OrganId = organId; @@ -42,102 +38,84 @@ public class AccountHead implements java.io.Serializable Remark = remark; } - public void setId(Long id) - { - Id = id; - } - - public Long getId() - { + public Long getId() { return Id; } - public void setType(String type) - { - Type = type; + public void setId(Long id) { + Id = id; } - public String getType() - { + public String getType() { return Type; } - public void setOrganId(Supplier organId) - { - OrganId = organId; + public void setType(String type) { + Type = type; } - public Supplier getOrganId() - { + public Supplier getOrganId() { return OrganId; } - public void setHandsPersonId(Person handsPersonId) - { - HandsPersonId = handsPersonId; + public void setOrganId(Supplier organId) { + OrganId = organId; } - public Person getHandsPersonId() - { + public Person getHandsPersonId() { return HandsPersonId; } - public void setChangeAmount(Double changeAmount) - { + public void setHandsPersonId(Person handsPersonId) { + HandsPersonId = handsPersonId; + } + + public Double getChangeAmount() { + return ChangeAmount; + } + + public void setChangeAmount(Double changeAmount) { ChangeAmount = changeAmount; } - public Double getChangeAmount() - { - return ChangeAmount; - } - - public void setTotalPrice(Double totalPrice) { - TotalPrice = totalPrice; - } - - public Double getTotalPrice() { - return TotalPrice; - } - - public void setAccountId(Account accountId) - { - AccountId = accountId; + public Double getTotalPrice() { + return TotalPrice; } - public Account getAccountId() - { + public void setTotalPrice(Double totalPrice) { + TotalPrice = totalPrice; + } + + public Account getAccountId() { return AccountId; } - public void setBillNo(String billNo) - { - BillNo = billNo; + public void setAccountId(Account accountId) { + AccountId = accountId; } - public String getBillNo() - { + public String getBillNo() { return BillNo; } - public void setBillTime(Timestamp billTime) - { - BillTime = billTime; + public void setBillNo(String billNo) { + BillNo = billNo; } - public Timestamp getBillTime() - { + public Timestamp getBillTime() { return BillTime; } - public void setRemark(String remark) - { - Remark = remark; + public void setBillTime(Timestamp billTime) { + BillTime = billTime; } - public String getRemark() - { + public String getRemark() { return Remark; } + public void setRemark(String remark) { + Remark = remark; + } + } diff --git a/src/main/java/com/jsh/model/po/AccountItem.java b/src/main/java/com/jsh/model/po/AccountItem.java index ab5f1f0f..e08bd23c 100644 --- a/src/main/java/com/jsh/model/po/AccountItem.java +++ b/src/main/java/com/jsh/model/po/AccountItem.java @@ -1,8 +1,7 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class AccountItem implements java.io.Serializable -{ +public class AccountItem implements java.io.Serializable { private Long Id; private AccountHead HeaderId; private Account AccountId; @@ -10,19 +9,16 @@ public class AccountItem implements java.io.Serializable private Double EachAmount; private String Remark; - public AccountItem() - { + public AccountItem() { } - public AccountItem(Long Id) - { - this.Id = Id ; + public AccountItem(Long Id) { + this.Id = Id; } public AccountItem(AccountHead headerId, Account accountId, - InOutItem inOutItemId, Double eachAmount, String remark) - { + InOutItem inOutItemId, Double eachAmount, String remark) { super(); HeaderId = headerId; AccountId = accountId; @@ -31,64 +27,52 @@ public class AccountItem implements java.io.Serializable Remark = remark; } - public void setId(Long id) - { - Id = id; - } - - public Long getId() - { + public Long getId() { return Id; } - public void setHeaderId(AccountHead headerId) - { - HeaderId = headerId; + public void setId(Long id) { + Id = id; } - public AccountHead getHeaderId() - { + public AccountHead getHeaderId() { return HeaderId; } - public void setAccountId(Account accountId) - { - AccountId = accountId; + public void setHeaderId(AccountHead headerId) { + HeaderId = headerId; } - public Account getAccountId() - { + public Account getAccountId() { return AccountId; } - public void setInOutItemId(InOutItem inOutItemId) - { - InOutItemId = inOutItemId; + public void setAccountId(Account accountId) { + AccountId = accountId; } - public InOutItem getInOutItemId() - { + public InOutItem getInOutItemId() { return InOutItemId; } - public void setEachAmount(Double eachAmount) - { - EachAmount = eachAmount; + public void setInOutItemId(InOutItem inOutItemId) { + InOutItemId = inOutItemId; } - public Double getEachAmount() - { + public Double getEachAmount() { return EachAmount; } - public void setRemark(String remark) - { - Remark = remark; + public void setEachAmount(Double eachAmount) { + EachAmount = eachAmount; } - public String getRemark() - { + public String getRemark() { return Remark; } + public void setRemark(String remark) { + Remark = remark; + } + } diff --git a/src/main/java/com/jsh/model/po/App.java b/src/main/java/com/jsh/model/po/App.java index 80e3ee34..a6af765d 100644 --- a/src/main/java/com/jsh/model/po/App.java +++ b/src/main/java/com/jsh/model/po/App.java @@ -1,174 +1,170 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class App implements java.io.Serializable -{ - private Long Id; - private String Number; - private String Name; - private String Type; - private String Icon; - private String URL; - private String Width; - private String Height; - private Boolean ReSize; - private Boolean OpenMax; - private Boolean Flash; - private String ZL; - private String Sort; - private String Remark; - private Boolean Enabled; - - - public App() - { - - } - - public App(Long Id) - { - this.Id = Id ; - } +public class App implements java.io.Serializable { + private Long Id; + private String Number; + private String Name; + private String Type; + private String Icon; + private String URL; + private String Width; + private String Height; + private Boolean ReSize; + private Boolean OpenMax; + private Boolean Flash; + private String ZL; + private String Sort; + private String Remark; + private Boolean Enabled; - public App(String Number, String Name, String Type, String Icon, String URL, String Width, - String Height, Boolean ReSize, Boolean OpenMax, Boolean Flash, String ZL, String Sort, - String Remark, Boolean Enabled) - { - this.Number = Number; - this.Name = Name; - this.Type = Type; - this.Icon = Icon; - this.URL = URL; - this.Width = Width; - this.Height = Height; - this.ReSize = ReSize; - this.OpenMax = OpenMax; - this.Flash = Flash; - this.ZL = ZL; - this.Sort = Sort; - this.Remark = Remark; - this.Enabled = Enabled; - } - public Long getId() { - return Id; - } + public App() { - public void setId(Long id) { - Id = id; - } + } - public String getNumber() { - return Number; - } + public App(Long Id) { + this.Id = Id; + } - public void setNumber(String number) { - Number = number; - } + public App(String Number, String Name, String Type, String Icon, String URL, String Width, + String Height, Boolean ReSize, Boolean OpenMax, Boolean Flash, String ZL, String Sort, + String Remark, Boolean Enabled) { + this.Number = Number; + this.Name = Name; + this.Type = Type; + this.Icon = Icon; + this.URL = URL; + this.Width = Width; + this.Height = Height; + this.ReSize = ReSize; + this.OpenMax = OpenMax; + this.Flash = Flash; + this.ZL = ZL; + this.Sort = Sort; + this.Remark = Remark; + this.Enabled = Enabled; + } - public String getName() { - return Name; - } + public Long getId() { + return Id; + } - public void setName(String name) { - Name = name; - } + public void setId(Long id) { + Id = id; + } - public String getType() { - return Type; - } + public String getNumber() { + return Number; + } - public void setType(String type) { - Type = type; - } + public void setNumber(String number) { + Number = number; + } - public String getIcon() { - return Icon; - } + public String getName() { + return Name; + } - public void setIcon(String icon) { - Icon = icon; - } + public void setName(String name) { + Name = name; + } - public String getURL() { - return URL; - } + public String getType() { + return Type; + } - public void setURL(String uRL) { - URL = uRL; - } + public void setType(String type) { + Type = type; + } - public String getWidth() { - return Width; - } + public String getIcon() { + return Icon; + } - public void setWidth(String width) { - Width = width; - } + public void setIcon(String icon) { + Icon = icon; + } - public String getHeight() { - return Height; - } + public String getURL() { + return URL; + } - public void setHeight(String height) { - Height = height; - } + public void setURL(String uRL) { + URL = uRL; + } - public Boolean getReSize() { - return ReSize; - } + public String getWidth() { + return Width; + } - public void setReSize(Boolean reSize) { - ReSize = reSize; - } + public void setWidth(String width) { + Width = width; + } - public Boolean getOpenMax() { - return OpenMax; - } + public String getHeight() { + return Height; + } - public void setOpenMax(Boolean openMax) { - OpenMax = openMax; - } + public void setHeight(String height) { + Height = height; + } - public Boolean getFlash() { - return Flash; - } + public Boolean getReSize() { + return ReSize; + } - public void setFlash(Boolean flash) { - Flash = flash; - } + public void setReSize(Boolean reSize) { + ReSize = reSize; + } - public String getZL() { - return ZL; - } + public Boolean getOpenMax() { + return OpenMax; + } - public void setZL(String zL) { - ZL = zL; - } + public void setOpenMax(Boolean openMax) { + OpenMax = openMax; + } - public String getSort() { - return Sort; - } + public Boolean getFlash() { + return Flash; + } - public void setSort(String sort) { - Sort = sort; - } + public void setFlash(Boolean flash) { + Flash = flash; + } - public String getRemark() { - return Remark; - } + public String getZL() { + return ZL; + } - public void setRemark(String remark) { - Remark = remark; - } + public void setZL(String zL) { + ZL = zL; + } - public Boolean getEnabled() { - return Enabled; - } + public String getSort() { + return Sort; + } - public void setEnabled(Boolean enabled) { - Enabled = enabled; - } + public void setSort(String sort) { + Sort = sort; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } + + public Boolean getEnabled() { + return Enabled; + } + + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/Asset.java b/src/main/java/com/jsh/model/po/Asset.java index d4b448ac..1f19cdf3 100644 --- a/src/main/java/com/jsh/model/po/Asset.java +++ b/src/main/java/com/jsh/model/po/Asset.java @@ -4,376 +4,317 @@ import java.sql.Timestamp; import java.util.Map; @SuppressWarnings("serial") -public class Asset implements java.io.Serializable -{ - private Long id; - private Assetname assetname; - private String location; - private Short status; - private Basicuser user; - private Double price; - private Timestamp purchasedate; - private Timestamp periodofvalidity; - private Timestamp warrantydate; - private String assetnum; - private String serialnum; - private Supplier supplier; - private String labels; - private String description; - private String addMonth; - private Timestamp createtime; - private Basicuser creator; - private Timestamp updatetime; - private Basicuser updator; - - //----------以下属性导入exel表格使用-------------------- - /** +public class Asset implements java.io.Serializable { + private Long id; + private Assetname assetname; + private String location; + private Short status; + private Basicuser user; + private Double price; + private Timestamp purchasedate; + private Timestamp periodofvalidity; + private Timestamp warrantydate; + private String assetnum; + private String serialnum; + private Supplier supplier; + private String labels; + private String description; + private String addMonth; + private Timestamp createtime; + private Basicuser creator; + private Timestamp updatetime; + private Basicuser updator; + + //----------以下属性导入exel表格使用-------------------- + /** * 类型 right--正确 warn--警告 wrong--错误 */ - private Map cellInfo; - + private Map cellInfo; + /** * 行号 */ private Integer rowLineNum; - + /** * 保存价格 */ private String priceStr; - + /** * 资产名称 */ private String assetnameStr; - + /** * 资产类型 */ private String category; - + /** * 购买日期 */ private String purchasedateStr; - + /** * 有效日期 */ private String periodofvalidityStr; - + /** * 保修日期 */ private String warrantydateStr; - - public Asset() - { - - } - - public Asset(Long id) - { - this.id = id; - } - - public Asset(Assetname assetname, String location, - Short status, Basicuser user, Double price, Timestamp purchasedate, - Timestamp periodofvalidity, Timestamp warrantydate, - String assetnum, String serialnum, Supplier supplier, - String description, Timestamp createtime, Basicuser creator, - Timestamp updatetime,String labels, Basicuser updator,String addMonth) - { - super(); - this.assetname = assetname; - this.location = location; - this.status = status; - this.user = user; - this.price = price; - this.purchasedate = purchasedate; - this.periodofvalidity = periodofvalidity; - this.warrantydate = warrantydate; - this.assetnum = assetnum; - this.serialnum = serialnum; - this.supplier = supplier; - this.description = description; - this.createtime = createtime; - this.creator = creator; - this.updatetime = updatetime; - this.updator = updator; - this.labels = labels; - this.addMonth = addMonth; - } + public Asset() { - - public Long getId() - { - return id; - } - - public void setId(Long id) - { - this.id = id; - } - - public Assetname getAssetname() - { - return assetname; - } - - public void setAssetname(Assetname assetname) - { - this.assetname = assetname; - } - - public String getLocation() - { - return location; - } - - public void setLocation(String location) - { - this.location = location; - } - - public Short getStatus() - { - return status; - } - - public void setStatus(Short status) - { - this.status = status; - } - - public Basicuser getUser() - { - return user; - } - - public void setUser(Basicuser user) - { - this.user = user; - } - - public Double getPrice() - { - return price; - } - - public void setPrice(Double price) - { - this.price = price; - } - - public Timestamp getPurchasedate() - { - return purchasedate; - } - - public void setPurchasedate(Timestamp purchasedate) - { - this.purchasedate = purchasedate; - } - - public Timestamp getPeriodofvalidity() - { - return periodofvalidity; - } - - public void setPeriodofvalidity(Timestamp periodofvalidity) - { - this.periodofvalidity = periodofvalidity; - } - - public Timestamp getWarrantydate() - { - return warrantydate; - } - - public void setWarrantydate(Timestamp warrantydate) - { - this.warrantydate = warrantydate; - } - - public String getAssetnum() - { - return assetnum; - } - - public void setAssetnum(String assetnum) - { - this.assetnum = assetnum; - } - - public String getSerialnum() - { - return serialnum; - } - - public void setSerialnum(String serialnum) - { - this.serialnum = serialnum; - } - - public Supplier getSupplier() - { - return supplier; - } - - public void setSupplier(Supplier supplier) - { - this.supplier = supplier; - } - - public String getDescription() - { - return description; - } - - public void setDescription(String description) - { - this.description = description; - } - - public Timestamp getCreatetime() - { - return createtime; - } - - public void setCreatetime(Timestamp createtime) - { - this.createtime = createtime; - } - - public Basicuser getCreator() - { - return creator; - } - - public void setCreator(Basicuser creator) - { - this.creator = creator; - } - - public Timestamp getUpdatetime() - { - return updatetime; - } - - public void setUpdatetime(Timestamp updatetime) - { - this.updatetime = updatetime; - } - - public Basicuser getUpdator() - { - return updator; - } - - public void setUpdator(Basicuser updator) - { - this.updator = updator; - } - - public String getLabels() - { - return labels; } - public void setLabels(String labels) - { + public Asset(Long id) { + this.id = id; + } + + public Asset(Assetname assetname, String location, + Short status, Basicuser user, Double price, Timestamp purchasedate, + Timestamp periodofvalidity, Timestamp warrantydate, + String assetnum, String serialnum, Supplier supplier, + String description, Timestamp createtime, Basicuser creator, + Timestamp updatetime, String labels, Basicuser updator, String addMonth) { + super(); + this.assetname = assetname; + this.location = location; + this.status = status; + this.user = user; + this.price = price; + this.purchasedate = purchasedate; + this.periodofvalidity = periodofvalidity; + this.warrantydate = warrantydate; + this.assetnum = assetnum; + this.serialnum = serialnum; + this.supplier = supplier; + this.description = description; + this.createtime = createtime; + this.creator = creator; + this.updatetime = updatetime; + this.updator = updator; this.labels = labels; - } - - public String getAddMonth() - { - return addMonth; - } - - public void setAddMonth(String addMonth) - { this.addMonth = addMonth; } - public Integer getRowLineNum() - { + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Assetname getAssetname() { + return assetname; + } + + public void setAssetname(Assetname assetname) { + this.assetname = assetname; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public Short getStatus() { + return status; + } + + public void setStatus(Short status) { + this.status = status; + } + + public Basicuser getUser() { + return user; + } + + public void setUser(Basicuser user) { + this.user = user; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public Timestamp getPurchasedate() { + return purchasedate; + } + + public void setPurchasedate(Timestamp purchasedate) { + this.purchasedate = purchasedate; + } + + public Timestamp getPeriodofvalidity() { + return periodofvalidity; + } + + public void setPeriodofvalidity(Timestamp periodofvalidity) { + this.periodofvalidity = periodofvalidity; + } + + public Timestamp getWarrantydate() { + return warrantydate; + } + + public void setWarrantydate(Timestamp warrantydate) { + this.warrantydate = warrantydate; + } + + public String getAssetnum() { + return assetnum; + } + + public void setAssetnum(String assetnum) { + this.assetnum = assetnum; + } + + public String getSerialnum() { + return serialnum; + } + + public void setSerialnum(String serialnum) { + this.serialnum = serialnum; + } + + public Supplier getSupplier() { + return supplier; + } + + public void setSupplier(Supplier supplier) { + this.supplier = supplier; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Timestamp getCreatetime() { + return createtime; + } + + public void setCreatetime(Timestamp createtime) { + this.createtime = createtime; + } + + public Basicuser getCreator() { + return creator; + } + + public void setCreator(Basicuser creator) { + this.creator = creator; + } + + public Timestamp getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Timestamp updatetime) { + this.updatetime = updatetime; + } + + public Basicuser getUpdator() { + return updator; + } + + public void setUpdator(Basicuser updator) { + this.updator = updator; + } + + public String getLabels() { + return labels; + } + + public void setLabels(String labels) { + this.labels = labels; + } + + public String getAddMonth() { + return addMonth; + } + + public void setAddMonth(String addMonth) { + this.addMonth = addMonth; + } + + public Integer getRowLineNum() { return rowLineNum; } - public void setRowLineNum(Integer rowLineNum) - { + public void setRowLineNum(Integer rowLineNum) { this.rowLineNum = rowLineNum; } - public Map getCellInfo() - { + public Map getCellInfo() { return cellInfo; } - public void setCellInfo(Map cellInfo) - { + public void setCellInfo(Map cellInfo) { this.cellInfo = cellInfo; } - public String getPriceStr() - { + public String getPriceStr() { return priceStr; } - public void setPriceStr(String priceStr) - { + public void setPriceStr(String priceStr) { this.priceStr = priceStr; } - public String getAssetnameStr() - { + public String getAssetnameStr() { return assetnameStr; } - public void setAssetnameStr(String assetnameStr) - { + public void setAssetnameStr(String assetnameStr) { this.assetnameStr = assetnameStr; } - public String getCategory() - { + public String getCategory() { return category; } - public void setCategory(String category) - { + public void setCategory(String category) { this.category = category; } - public String getPurchasedateStr() - { + public String getPurchasedateStr() { return purchasedateStr; } - public void setPurchasedateStr(String purchasedateStr) - { + public void setPurchasedateStr(String purchasedateStr) { this.purchasedateStr = purchasedateStr; } - public String getPeriodofvalidityStr() - { + public String getPeriodofvalidityStr() { return periodofvalidityStr; } - public void setPeriodofvalidityStr(String periodofvalidityStr) - { + public void setPeriodofvalidityStr(String periodofvalidityStr) { this.periodofvalidityStr = periodofvalidityStr; } - public String getWarrantydateStr() - { + public String getWarrantydateStr() { return warrantydateStr; } - public void setWarrantydateStr(String warrantydateStr) - { + public void setWarrantydateStr(String warrantydateStr) { this.warrantydateStr = warrantydateStr; } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/Assetname.java b/src/main/java/com/jsh/model/po/Assetname.java index 28b84039..7ea410f0 100644 --- a/src/main/java/com/jsh/model/po/Assetname.java +++ b/src/main/java/com/jsh/model/po/Assetname.java @@ -1,93 +1,77 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class Assetname implements java.io.Serializable -{ - private Long id; - private String assetname; - private Short isystem; - private Category category; - private String description; - private Short isconsumables; +public class Assetname implements java.io.Serializable { + private Long id; + private String assetname; + private Short isystem; + private Category category; + private String description; + private Short isconsumables; - public Assetname() - { - - } - - public Assetname(Long id) - { - this.id = id; - } + public Assetname() { - public Assetname(String assetname, Short isystem, String description, - Short isconsumables,Category category) - { - this.assetname = assetname; - this.isystem = isystem; - this.description = description; - this.isconsumables = isconsumables; - this.category = category; - } + } - public Long getId() - { - return this.id; - } + public Assetname(Long id) { + this.id = id; + } - public void setId(Long id) - { - this.id = id; - } + public Assetname(String assetname, Short isystem, String description, + Short isconsumables, Category category) { + this.assetname = assetname; + this.isystem = isystem; + this.description = description; + this.isconsumables = isconsumables; + this.category = category; + } - public String getAssetname() - { - return this.assetname; - } + public Long getId() { + return this.id; + } - public void setAssetname(String assetname) - { - this.assetname = assetname; - } + public void setId(Long id) { + this.id = id; + } - public Short getIsystem() - { - return this.isystem; - } + public String getAssetname() { + return this.assetname; + } - public void setIsystem(Short isystem) - { - this.isystem = isystem; - } + public void setAssetname(String assetname) { + this.assetname = assetname; + } - public String getDescription() - { - return this.description; - } + public Short getIsystem() { + return this.isystem; + } - public void setDescription(String description) - { - this.description = description; - } + public void setIsystem(Short isystem) { + this.isystem = isystem; + } - public Short getIsconsumables() - { - return this.isconsumables; - } + public String getDescription() { + return this.description; + } - public void setIsconsumables(Short isconsumables) - { - this.isconsumables = isconsumables; - } + public void setDescription(String description) { + this.description = description; + } - public Category getCategory() - { + public Short getIsconsumables() { + return this.isconsumables; + } + + public void setIsconsumables(Short isconsumables) { + this.isconsumables = isconsumables; + } + + public Category getCategory() { return category; } - public void setCategory(Category category) - { + public void setCategory(Category category) { this.category = category; } - + } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/Basicuser.java b/src/main/java/com/jsh/model/po/Basicuser.java index 97f85be2..02136d01 100644 --- a/src/main/java/com/jsh/model/po/Basicuser.java +++ b/src/main/java/com/jsh/model/po/Basicuser.java @@ -1,177 +1,147 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class Basicuser implements java.io.Serializable -{ - private Long id; - private String username; - private String loginame; - private String password; - private String position; - private String department; - private String email; - private String phonenum; - private Short ismanager; - private Short isystem; - private Short status; - private String description; - private String remark; +public class Basicuser implements java.io.Serializable { + private Long id; + private String username; + private String loginame; + private String password; + private String position; + private String department; + private String email; + private String phonenum; + private Short ismanager; + private Short isystem; + private Short status; + private String description; + private String remark; - public Basicuser() - { - } + public Basicuser() { + } - public Basicuser(Long id) - { - this.id = id; - } - - public Basicuser(String username, String loginame, String password, - String position, String department, String email, String phonenum, - Short ismanager, Short isystem, Short status, String description, - String remark) - { - this.username = username; - this.loginame = loginame; - this.password = password; - this.position = position; - this.department = department; - this.email = email; - this.phonenum = phonenum; - this.ismanager = ismanager; - this.isystem = isystem; - this.status = status; - this.description = description; - this.remark = remark; - } + public Basicuser(Long id) { + this.id = id; + } - public Long getId() - { - return this.id; - } + public Basicuser(String username, String loginame, String password, + String position, String department, String email, String phonenum, + Short ismanager, Short isystem, Short status, String description, + String remark) { + this.username = username; + this.loginame = loginame; + this.password = password; + this.position = position; + this.department = department; + this.email = email; + this.phonenum = phonenum; + this.ismanager = ismanager; + this.isystem = isystem; + this.status = status; + this.description = description; + this.remark = remark; + } - public void setId(Long id) - { - this.id = id; - } + public Long getId() { + return this.id; + } - public String getUsername() - { - return this.username; - } + public void setId(Long id) { + this.id = id; + } - public void setUsername(String username) - { - this.username = username; - } + public String getUsername() { + return this.username; + } - public String getLoginame() - { - return this.loginame; - } + public void setUsername(String username) { + this.username = username; + } - public void setLoginame(String loginame) - { - this.loginame = loginame; - } + public String getLoginame() { + return this.loginame; + } - public String getPassword() - { - return this.password; - } + public void setLoginame(String loginame) { + this.loginame = loginame; + } - public void setPassword(String password) - { - this.password = password; - } + public String getPassword() { + return this.password; + } - public String getPosition() - { - return this.position; - } + public void setPassword(String password) { + this.password = password; + } - public void setPosition(String position) - { - this.position = position; - } + public String getPosition() { + return this.position; + } - public String getDepartment() - { - return this.department; - } + public void setPosition(String position) { + this.position = position; + } - public void setDepartment(String department) - { - this.department = department; - } + public String getDepartment() { + return this.department; + } - public String getEmail() - { - return this.email; - } + public void setDepartment(String department) { + this.department = department; + } - public void setEmail(String email) - { - this.email = email; - } + public String getEmail() { + return this.email; + } - public String getPhonenum() - { - return this.phonenum; - } + public void setEmail(String email) { + this.email = email; + } - public void setPhonenum(String phonenum) - { - this.phonenum = phonenum; - } + public String getPhonenum() { + return this.phonenum; + } - public Short getIsmanager() - { - return this.ismanager; - } + public void setPhonenum(String phonenum) { + this.phonenum = phonenum; + } - public void setIsmanager(Short ismanager) - { - this.ismanager = ismanager; - } + public Short getIsmanager() { + return this.ismanager; + } - public Short getIsystem() - { - return this.isystem; - } + public void setIsmanager(Short ismanager) { + this.ismanager = ismanager; + } - public void setIsystem(Short isystem) - { - this.isystem = isystem; - } + public Short getIsystem() { + return this.isystem; + } - public Short getStatus() - { - return this.status; - } + public void setIsystem(Short isystem) { + this.isystem = isystem; + } - public void setStatus(Short status) - { - this.status = status; - } + public Short getStatus() { + return this.status; + } - public String getDescription() - { - return this.description; - } + public void setStatus(Short status) { + this.status = status; + } - public void setDescription(String description) - { - this.description = description; - } + public String getDescription() { + return this.description; + } - public String getRemark() - { - return this.remark; - } + public void setDescription(String description) { + this.description = description; + } - public void setRemark(String remark) - { - this.remark = remark; - } + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/Category.java b/src/main/java/com/jsh/model/po/Category.java index 09a41f08..4a10fd8e 100644 --- a/src/main/java/com/jsh/model/po/Category.java +++ b/src/main/java/com/jsh/model/po/Category.java @@ -1,67 +1,55 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class Category implements java.io.Serializable -{ - private Long id; - private String assetname; - private Short isystem; - private String description; +public class Category implements java.io.Serializable { + private Long id; + private String assetname; + private Short isystem; + private String description; - public Category() - { - - } - - public Category(Long id) - { - this.id = id ; - } + public Category() { - public Category(String assetname, Short isystem, String description) - { - this.assetname = assetname; - this.isystem = isystem; - this.description = description; - } + } - public Long getId() - { - return this.id; - } + public Category(Long id) { + this.id = id; + } - public void setId(Long id) - { - this.id = id; - } + public Category(String assetname, Short isystem, String description) { + this.assetname = assetname; + this.isystem = isystem; + this.description = description; + } - public String getAssetname() - { - return this.assetname; - } + public Long getId() { + return this.id; + } - public void setAssetname(String assetname) - { - this.assetname = assetname; - } + public void setId(Long id) { + this.id = id; + } - public Short getIsystem() - { - return this.isystem; - } + public String getAssetname() { + return this.assetname; + } - public void setIsystem(Short isystem) - { - this.isystem = isystem; - } + public void setAssetname(String assetname) { + this.assetname = assetname; + } - public String getDescription() - { - return this.description; - } + public Short getIsystem() { + return this.isystem; + } - public void setDescription(String description) - { - this.description = description; - } + public void setIsystem(Short isystem) { + this.isystem = isystem; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/Depot.java b/src/main/java/com/jsh/model/po/Depot.java index 4989bdff..69638081 100644 --- a/src/main/java/com/jsh/model/po/Depot.java +++ b/src/main/java/com/jsh/model/po/Depot.java @@ -1,100 +1,96 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class Depot implements java.io.Serializable -{ - private Long id; - private String name; - private String address; - private Double warehousing; - private Double truckage; - private Integer type; - private String sort; - private String remark; +public class Depot implements java.io.Serializable { + private Long id; + private String name; + private String address; + private Double warehousing; + private Double truckage; + private Integer type; + private String sort; + private String remark; - public Depot() - { + public Depot() { - } + } - public Depot(Long id) - { - this.id = id ; - } + public Depot(Long id) { + this.id = id; + } - public Depot(String name, String address, Double warehousing, Double truckage, Integer type, String sort, String remark) - { - this.name = name; - this.address = address; - this.warehousing = warehousing; - this.truckage = truckage; - this.type = type; - this.sort = sort; - this.remark = remark; - } + public Depot(String name, String address, Double warehousing, Double truckage, Integer type, String sort, String remark) { + this.name = name; + this.address = address; + this.warehousing = warehousing; + this.truckage = truckage; + this.type = type; + this.sort = sort; + this.remark = remark; + } - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getAddress() { - return address; - } + public String getAddress() { + return address; + } - public void setAddress(String address) { - this.address = address; - } + public void setAddress(String address) { + this.address = address; + } - public Double getWarehousing() { - return warehousing; - } + public Double getWarehousing() { + return warehousing; + } - public void setWarehousing(Double warehousing) { - this.warehousing = warehousing; - } + public void setWarehousing(Double warehousing) { + this.warehousing = warehousing; + } - public Double getTruckage() { - return truckage; - } + public Double getTruckage() { + return truckage; + } - public void setTruckage(Double truckage) { - this.truckage = truckage; - } + public void setTruckage(Double truckage) { + this.truckage = truckage; + } - public Integer getType() { - return type; - } + public Integer getType() { + return type; + } - public void setType(Integer type) { - this.type = type; - } + public void setType(Integer type) { + this.type = type; + } - public String getSort() { - return sort; - } + public String getSort() { + return sort; + } - public void setSort(String sort) { - this.sort = sort; - } + public void setSort(String sort) { + this.sort = sort; + } - public String getRemark() { - return remark; - } + public String getRemark() { + return remark; + } - public void setRemark(String remark) { - this.remark = remark; - } + public void setRemark(String remark) { + this.remark = remark; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/DepotHead.java b/src/main/java/com/jsh/model/po/DepotHead.java index 13b00f5c..1f551b90 100644 --- a/src/main/java/com/jsh/model/po/DepotHead.java +++ b/src/main/java/com/jsh/model/po/DepotHead.java @@ -3,301 +3,298 @@ package com.jsh.model.po; import java.sql.Timestamp; @SuppressWarnings("serial") -public class DepotHead implements java.io.Serializable -{ - private Long Id; - private String Type; - private String SubType; - private Depot ProjectId; - private String DefaultNumber; - private String Number; - private String OperPersonName; - private Timestamp CreateTime; - private Timestamp OperTime; - private Supplier OrganId; - private Person HandsPersonId; - private String Salesman; //业务员(可以多个)[2][3] - private Account AccountId; - private Double ChangeAmount; - private String AccountIdList; //多账户ID列表 [2][3] - private String AccountMoneyList; //多账户金额列表 [{"[2]",22},{"[3]",33}] - private Double Discount; //优惠率 0.10 - private Double DiscountMoney; //优惠金额 10 - private Double DiscountLastMoney; //优惠后金额 90 - private Double OtherMoney; //销售或采购费用 100 - private String OtherMoneyList; //销售或采购费用涉及项目Id数组(包括快递、招待等)[2][3] - private String OtherMoneyItem; //销售费用涉及项目(包括快递、招待等) [{"[2]",22},{"[3]",33}] - private Integer AccountDay; //结算天数 - private Depot AllocationProjectId; - private Double TotalPrice; - private String PayType; - private Boolean Status = false; //单据状态 - private String Remark; +public class DepotHead implements java.io.Serializable { + private Long Id; + private String Type; + private String SubType; + private Depot ProjectId; + private String DefaultNumber; + private String Number; + private String OperPersonName; + private Timestamp CreateTime; + private Timestamp OperTime; + private Supplier OrganId; + private Person HandsPersonId; + private String Salesman; //业务员(可以多个)[2][3] + private Account AccountId; + private Double ChangeAmount; + private String AccountIdList; //多账户ID列表 [2][3] + private String AccountMoneyList; //多账户金额列表 [{"[2]",22},{"[3]",33}] + private Double Discount; //优惠率 0.10 + private Double DiscountMoney; //优惠金额 10 + private Double DiscountLastMoney; //优惠后金额 90 + private Double OtherMoney; //销售或采购费用 100 + private String OtherMoneyList; //销售或采购费用涉及项目Id数组(包括快递、招待等)[2][3] + private String OtherMoneyItem; //销售费用涉及项目(包括快递、招待等) [{"[2]",22},{"[3]",33}] + private Integer AccountDay; //结算天数 + private Depot AllocationProjectId; + private Double TotalPrice; + private String PayType; + private Boolean Status = false; //单据状态 + private String Remark; - public DepotHead() - { - - } + public DepotHead() { - public DepotHead(Long Id) - { - this.Id = Id ; - } + } - public DepotHead(String type, String subType, Depot projectId, String defaultNumber, String number, String operPersonName, Timestamp createTime, - Timestamp operTime, Supplier organId, Person handsPersonId, String salesman, String accountIdList,String accountMoneyList, - Double discount, Double discountMoney,Double discountLastMoney, Double otherMoney, String otherMoneyItem,Integer accountDay, - Account accountId, Double changeAmount, Depot allocationProjectId, Double totalPrice,String payType, Boolean status, String remark) { - super(); - Type = type; - SubType = subType; - ProjectId = projectId; - DefaultNumber = defaultNumber; - Number = number; - OperPersonName = operPersonName; - CreateTime = createTime; - OperTime = operTime; - OrganId = organId; - HandsPersonId = handsPersonId; - Salesman= salesman; - AccountIdList= accountIdList; - AccountMoneyList= accountMoneyList; - Discount= discount; - DiscountMoney = discountMoney; - DiscountLastMoney = discountLastMoney; - OtherMoney = otherMoney; - OtherMoneyItem = otherMoneyItem; - AccountDay = accountDay; - AccountId = accountId; - ChangeAmount = changeAmount; - AllocationProjectId = allocationProjectId; - TotalPrice = totalPrice; - PayType = payType; - Status = status; - Remark = remark; - } + public DepotHead(Long Id) { + this.Id = Id; + } - public Long getId() { - return Id; - } + public DepotHead(String type, String subType, Depot projectId, String defaultNumber, String number, String operPersonName, Timestamp createTime, + Timestamp operTime, Supplier organId, Person handsPersonId, String salesman, String accountIdList, String accountMoneyList, + Double discount, Double discountMoney, Double discountLastMoney, Double otherMoney, String otherMoneyItem, Integer accountDay, + Account accountId, Double changeAmount, Depot allocationProjectId, Double totalPrice, String payType, Boolean status, String remark) { + super(); + Type = type; + SubType = subType; + ProjectId = projectId; + DefaultNumber = defaultNumber; + Number = number; + OperPersonName = operPersonName; + CreateTime = createTime; + OperTime = operTime; + OrganId = organId; + HandsPersonId = handsPersonId; + Salesman = salesman; + AccountIdList = accountIdList; + AccountMoneyList = accountMoneyList; + Discount = discount; + DiscountMoney = discountMoney; + DiscountLastMoney = discountLastMoney; + OtherMoney = otherMoney; + OtherMoneyItem = otherMoneyItem; + AccountDay = accountDay; + AccountId = accountId; + ChangeAmount = changeAmount; + AllocationProjectId = allocationProjectId; + TotalPrice = totalPrice; + PayType = payType; + Status = status; + Remark = remark; + } - public void setId(Long id) { - Id = id; - } + public Long getId() { + return Id; + } - public String getType() { - return Type; - } + public void setId(Long id) { + Id = id; + } - public void setType(String type) { - Type = type; - } + public String getType() { + return Type; + } - public String getSubType() { - return SubType; - } + public void setType(String type) { + Type = type; + } - public void setSubType(String subType) { - SubType = subType; - } + public String getSubType() { + return SubType; + } - public Depot getProjectId() { - return ProjectId; - } + public void setSubType(String subType) { + SubType = subType; + } - public void setProjectId(Depot projectId) { - ProjectId = projectId; - } + public Depot getProjectId() { + return ProjectId; + } - public String getDefaultNumber() { - return DefaultNumber; - } + public void setProjectId(Depot projectId) { + ProjectId = projectId; + } - public void setDefaultNumber(String defaultNumber) { - DefaultNumber = defaultNumber; - } + public String getDefaultNumber() { + return DefaultNumber; + } - public String getNumber() { - return Number; - } + public void setDefaultNumber(String defaultNumber) { + DefaultNumber = defaultNumber; + } - public void setNumber(String number) { - Number = number; - } + public String getNumber() { + return Number; + } - public String getOperPersonName() { - return OperPersonName; - } + public void setNumber(String number) { + Number = number; + } - public void setOperPersonName(String operPersonName) { - OperPersonName = operPersonName; - } + public String getOperPersonName() { + return OperPersonName; + } - public Timestamp getCreateTime() { - return CreateTime; - } + public void setOperPersonName(String operPersonName) { + OperPersonName = operPersonName; + } - public void setCreateTime(Timestamp createTime) { - CreateTime = createTime; - } + public Timestamp getCreateTime() { + return CreateTime; + } - public Timestamp getOperTime() { - return OperTime; - } + public void setCreateTime(Timestamp createTime) { + CreateTime = createTime; + } - public void setOperTime(Timestamp operTime) { - OperTime = operTime; - } + public Timestamp getOperTime() { + return OperTime; + } - public Supplier getOrganId() { - return OrganId; - } + public void setOperTime(Timestamp operTime) { + OperTime = operTime; + } - public void setOrganId(Supplier organId) { - OrganId = organId; - } + public Supplier getOrganId() { + return OrganId; + } - public Person getHandsPersonId() { - return HandsPersonId; - } + public void setOrganId(Supplier organId) { + OrganId = organId; + } - public void setHandsPersonId(Person handsPersonId) { - HandsPersonId = handsPersonId; - } - - public Account getAccountId() { - return AccountId; - } + public Person getHandsPersonId() { + return HandsPersonId; + } - public void setAccountId(Account accountId) { - AccountId = accountId; - } + public void setHandsPersonId(Person handsPersonId) { + HandsPersonId = handsPersonId; + } - public Double getChangeAmount() { - return ChangeAmount; - } + public Account getAccountId() { + return AccountId; + } - public void setChangeAmount(Double changeAmount) { - ChangeAmount = changeAmount; - } + public void setAccountId(Account accountId) { + AccountId = accountId; + } - public Depot getAllocationProjectId() { - return AllocationProjectId; - } + public Double getChangeAmount() { + return ChangeAmount; + } - public void setAllocationProjectId(Depot allocationProjectId) { - AllocationProjectId = allocationProjectId; - } + public void setChangeAmount(Double changeAmount) { + ChangeAmount = changeAmount; + } - public Double getTotalPrice() { - return TotalPrice; - } + public Depot getAllocationProjectId() { + return AllocationProjectId; + } - public void setTotalPrice(Double totalPrice) { - TotalPrice = totalPrice; - } + public void setAllocationProjectId(Depot allocationProjectId) { + AllocationProjectId = allocationProjectId; + } - public String getPayType() { - return PayType; - } + public Double getTotalPrice() { + return TotalPrice; + } - public void setPayType(String payType) { - PayType = payType; - } + public void setTotalPrice(Double totalPrice) { + TotalPrice = totalPrice; + } - public String getRemark() { - return Remark; - } + public String getPayType() { + return PayType; + } - public void setRemark(String remark) { - Remark = remark; - } + public void setPayType(String payType) { + PayType = payType; + } - public String getSalesman() { - return Salesman; - } + public String getRemark() { + return Remark; + } - public void setSalesman(String salesman) { - Salesman = salesman; - } + public void setRemark(String remark) { + Remark = remark; + } - public String getAccountIdList() { - return AccountIdList; - } + public String getSalesman() { + return Salesman; + } - public void setAccountIdList(String accountIdList) { - AccountIdList = accountIdList; - } + public void setSalesman(String salesman) { + Salesman = salesman; + } - public String getAccountMoneyList() { - return AccountMoneyList; - } + public String getAccountIdList() { + return AccountIdList; + } - public void setAccountMoneyList(String accountMoneyList) { - AccountMoneyList = accountMoneyList; - } + public void setAccountIdList(String accountIdList) { + AccountIdList = accountIdList; + } - public Double getDiscount() { - return Discount; - } + public String getAccountMoneyList() { + return AccountMoneyList; + } - public void setDiscount(Double discount) { - Discount = discount; - } + public void setAccountMoneyList(String accountMoneyList) { + AccountMoneyList = accountMoneyList; + } - public Double getDiscountMoney() { - return DiscountMoney; - } + public Double getDiscount() { + return Discount; + } - public void setDiscountMoney(Double discountMoney) { - DiscountMoney = discountMoney; - } + public void setDiscount(Double discount) { + Discount = discount; + } - public Double getDiscountLastMoney() { - return DiscountLastMoney; - } + public Double getDiscountMoney() { + return DiscountMoney; + } - public void setDiscountLastMoney(Double discountLastMoney) { - DiscountLastMoney = discountLastMoney; - } + public void setDiscountMoney(Double discountMoney) { + DiscountMoney = discountMoney; + } - public Double getOtherMoney() { - return OtherMoney; - } + public Double getDiscountLastMoney() { + return DiscountLastMoney; + } - public void setOtherMoney(Double otherMoney) { - OtherMoney = otherMoney; - } + public void setDiscountLastMoney(Double discountLastMoney) { + DiscountLastMoney = discountLastMoney; + } - public String getOtherMoneyList() { - return OtherMoneyList; - } + public Double getOtherMoney() { + return OtherMoney; + } - public void setOtherMoneyList(String otherMoneyList) { - OtherMoneyList = otherMoneyList; - } + public void setOtherMoney(Double otherMoney) { + OtherMoney = otherMoney; + } - public String getOtherMoneyItem() { - return OtherMoneyItem; - } + public String getOtherMoneyList() { + return OtherMoneyList; + } - public void setOtherMoneyItem(String otherMoneyItem) { - OtherMoneyItem = otherMoneyItem; - } + public void setOtherMoneyList(String otherMoneyList) { + OtherMoneyList = otherMoneyList; + } - public Integer getAccountDay() { - return AccountDay; - } + public String getOtherMoneyItem() { + return OtherMoneyItem; + } - public void setAccountDay(Integer accountDay) { - AccountDay = accountDay; - } + public void setOtherMoneyItem(String otherMoneyItem) { + OtherMoneyItem = otherMoneyItem; + } - public Boolean getStatus() { - return Status; - } + public Integer getAccountDay() { + return AccountDay; + } - public void setStatus(Boolean status) { - Status = status; - } + public void setAccountDay(Integer accountDay) { + AccountDay = accountDay; + } + + public Boolean getStatus() { + return Status; + } + + public void setStatus(Boolean status) { + Status = status; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/DepotItem.java b/src/main/java/com/jsh/model/po/DepotItem.java index 930c2d7d..db1357d3 100644 --- a/src/main/java/com/jsh/model/po/DepotItem.java +++ b/src/main/java/com/jsh/model/po/DepotItem.java @@ -1,243 +1,240 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class DepotItem implements java.io.Serializable -{ - private Long Id; - private DepotHead HeaderId; - private Material MaterialId; - private String MUnit; //计量单位 - private Double OperNumber; - private Double BasicNumber; - private Double UnitPrice; - private Double TaxUnitPrice; //含税单价 - private Double AllPrice; - private String Remark; - private String Img; - private Depot DepotId; //仓库ID - private Depot AnotherDepotId; //对方仓库Id - private Double TaxRate; //税率 - private Double TaxMoney; //税额 - private Double TaxLastMoney; //价税合计 - private String OtherField1; //自定义字段1-品名 - private String OtherField2; //自定义字段2-型号 - private String OtherField3; //自定义字段3-制造商 - private String OtherField4; //自定义字段4 - private String OtherField5; //自定义字段5 - private String MType; //商品类型 +public class DepotItem implements java.io.Serializable { + private Long Id; + private DepotHead HeaderId; + private Material MaterialId; + private String MUnit; //计量单位 + private Double OperNumber; + private Double BasicNumber; + private Double UnitPrice; + private Double TaxUnitPrice; //含税单价 + private Double AllPrice; + private String Remark; + private String Img; + private Depot DepotId; //仓库ID + private Depot AnotherDepotId; //对方仓库Id + private Double TaxRate; //税率 + private Double TaxMoney; //税额 + private Double TaxLastMoney; //价税合计 + private String OtherField1; //自定义字段1-品名 + private String OtherField2; //自定义字段2-型号 + private String OtherField3; //自定义字段3-制造商 + private String OtherField4; //自定义字段4 + private String OtherField5; //自定义字段5 + private String MType; //商品类型 - public DepotItem() - { - - } - - public DepotItem(Long Id) - { - this.Id = Id ; - } + public DepotItem() { - public DepotItem(DepotHead headerId, Material materialId, String mUnit, - Double operNumber, Double basicNumber, Double unitPrice, Double taxUnitPrice, Double allPrice, String remark, String img, - Depot depotId, Depot anotherDepotId, Double taxRate, Double taxMoney, Double taxLastMoney, - String otherField1, String otherField2, String otherField3, String otherField4, String otherField5, String mType) { - super(); - HeaderId = headerId; - MaterialId = materialId; - MUnit = mUnit; - OperNumber = operNumber; - BasicNumber = basicNumber; - UnitPrice = unitPrice; - TaxUnitPrice = taxUnitPrice; - AllPrice = allPrice; - Remark = remark; - Img = img; - DepotId = depotId; - AnotherDepotId = anotherDepotId; - TaxRate = taxRate; - TaxMoney = taxMoney; - TaxLastMoney = taxLastMoney; - OtherField1 = otherField1; - OtherField2 = otherField2; - OtherField3 = otherField3; - OtherField4 = otherField4; - OtherField5 = otherField5; - MType = mType; - } + } - public Long getId() { - return Id; - } + public DepotItem(Long Id) { + this.Id = Id; + } - public void setId(Long id) { - Id = id; - } + public DepotItem(DepotHead headerId, Material materialId, String mUnit, + Double operNumber, Double basicNumber, Double unitPrice, Double taxUnitPrice, Double allPrice, String remark, String img, + Depot depotId, Depot anotherDepotId, Double taxRate, Double taxMoney, Double taxLastMoney, + String otherField1, String otherField2, String otherField3, String otherField4, String otherField5, String mType) { + super(); + HeaderId = headerId; + MaterialId = materialId; + MUnit = mUnit; + OperNumber = operNumber; + BasicNumber = basicNumber; + UnitPrice = unitPrice; + TaxUnitPrice = taxUnitPrice; + AllPrice = allPrice; + Remark = remark; + Img = img; + DepotId = depotId; + AnotherDepotId = anotherDepotId; + TaxRate = taxRate; + TaxMoney = taxMoney; + TaxLastMoney = taxLastMoney; + OtherField1 = otherField1; + OtherField2 = otherField2; + OtherField3 = otherField3; + OtherField4 = otherField4; + OtherField5 = otherField5; + MType = mType; + } - public DepotHead getHeaderId() { - return HeaderId; - } + public Long getId() { + return Id; + } - public void setHeaderId(DepotHead headerId) { - HeaderId = headerId; - } + public void setId(Long id) { + Id = id; + } - public Material getMaterialId() { - return MaterialId; - } + public DepotHead getHeaderId() { + return HeaderId; + } - public void setMaterialId(Material materialId) { - MaterialId = materialId; - } + public void setHeaderId(DepotHead headerId) { + HeaderId = headerId; + } - public String getMUnit() { - return MUnit; - } + public Material getMaterialId() { + return MaterialId; + } - public void setMUnit(String MUnit) { - this.MUnit = MUnit; - } + public void setMaterialId(Material materialId) { + MaterialId = materialId; + } - public Double getTaxUnitPrice() { - return TaxUnitPrice; - } + public String getMUnit() { + return MUnit; + } - public void setTaxUnitPrice(Double taxUnitPrice) { - TaxUnitPrice = taxUnitPrice; - } + public void setMUnit(String MUnit) { + this.MUnit = MUnit; + } - public Double getOperNumber() { - return OperNumber; - } + public Double getTaxUnitPrice() { + return TaxUnitPrice; + } - public void setOperNumber(Double operNumber) { - OperNumber = operNumber; - } + public void setTaxUnitPrice(Double taxUnitPrice) { + TaxUnitPrice = taxUnitPrice; + } - public Double getBasicNumber() { - return BasicNumber; - } + public Double getOperNumber() { + return OperNumber; + } - public void setBasicNumber(Double basicNumber) { - BasicNumber = basicNumber; - } + public void setOperNumber(Double operNumber) { + OperNumber = operNumber; + } - public Double getUnitPrice() { - return UnitPrice; - } + public Double getBasicNumber() { + return BasicNumber; + } - public void setUnitPrice(Double unitPrice) { - UnitPrice = unitPrice; - } + public void setBasicNumber(Double basicNumber) { + BasicNumber = basicNumber; + } - public Double getAllPrice() { - return AllPrice; - } + public Double getUnitPrice() { + return UnitPrice; + } - public void setAllPrice(Double allPrice) { - AllPrice = allPrice; - } + public void setUnitPrice(Double unitPrice) { + UnitPrice = unitPrice; + } - public String getRemark() { - return Remark; - } + public Double getAllPrice() { + return AllPrice; + } - public void setRemark(String remark) { - Remark = remark; - } + public void setAllPrice(Double allPrice) { + AllPrice = allPrice; + } - public String getImg() { - return Img; - } + public String getRemark() { + return Remark; + } - public void setImg(String img) { - Img = img; - } + public void setRemark(String remark) { + Remark = remark; + } - public Depot getDepotId() { - return DepotId; - } + public String getImg() { + return Img; + } - public void setDepotId(Depot depotId) { - DepotId = depotId; - } + public void setImg(String img) { + Img = img; + } - public Depot getAnotherDepotId() { - return AnotherDepotId; - } + public Depot getDepotId() { + return DepotId; + } - public void setAnotherDepotId(Depot anotherDepotId) { - AnotherDepotId = anotherDepotId; - } + public void setDepotId(Depot depotId) { + DepotId = depotId; + } - public Double getTaxRate() { - return TaxRate; - } + public Depot getAnotherDepotId() { + return AnotherDepotId; + } - public void setTaxRate(Double taxRate) { - TaxRate = taxRate; - } + public void setAnotherDepotId(Depot anotherDepotId) { + AnotherDepotId = anotherDepotId; + } - public Double getTaxMoney() { - return TaxMoney; - } + public Double getTaxRate() { + return TaxRate; + } - public void setTaxMoney(Double taxMoney) { - TaxMoney = taxMoney; - } + public void setTaxRate(Double taxRate) { + TaxRate = taxRate; + } - public Double getTaxLastMoney() { - return TaxLastMoney; - } + public Double getTaxMoney() { + return TaxMoney; + } - public void setTaxLastMoney(Double taxLastMoney) { - TaxLastMoney = taxLastMoney; - } + public void setTaxMoney(Double taxMoney) { + TaxMoney = taxMoney; + } - public String getOtherField1() { - return OtherField1; - } + public Double getTaxLastMoney() { + return TaxLastMoney; + } - public void setOtherField1(String otherField1) { - OtherField1 = otherField1; - } + public void setTaxLastMoney(Double taxLastMoney) { + TaxLastMoney = taxLastMoney; + } - public String getOtherField2() { - return OtherField2; - } + public String getOtherField1() { + return OtherField1; + } - public void setOtherField2(String otherField2) { - OtherField2 = otherField2; - } + public void setOtherField1(String otherField1) { + OtherField1 = otherField1; + } - public String getOtherField3() { - return OtherField3; - } + public String getOtherField2() { + return OtherField2; + } - public void setOtherField3(String otherField3) { - OtherField3 = otherField3; - } + public void setOtherField2(String otherField2) { + OtherField2 = otherField2; + } - public String getOtherField4() { - return OtherField4; - } + public String getOtherField3() { + return OtherField3; + } - public void setOtherField4(String otherField4) { - OtherField4 = otherField4; - } + public void setOtherField3(String otherField3) { + OtherField3 = otherField3; + } - public String getOtherField5() { - return OtherField5; - } + public String getOtherField4() { + return OtherField4; + } - public void setOtherField5(String otherField5) { - OtherField5 = otherField5; - } + public void setOtherField4(String otherField4) { + OtherField4 = otherField4; + } - public String getMType() { - return MType; - } + public String getOtherField5() { + return OtherField5; + } - public void setMType(String MType) { - this.MType = MType; - } + public void setOtherField5(String otherField5) { + OtherField5 = otherField5; + } + + public String getMType() { + return MType; + } + + public void setMType(String MType) { + this.MType = MType; + } } diff --git a/src/main/java/com/jsh/model/po/Functions.java b/src/main/java/com/jsh/model/po/Functions.java index f416c65e..27872e5a 100644 --- a/src/main/java/com/jsh/model/po/Functions.java +++ b/src/main/java/com/jsh/model/po/Functions.java @@ -1,101 +1,99 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class Functions implements java.io.Serializable -{ - private Long Id; - private String Number; - private String Name; - private String PNumber; - private String URL; - private Boolean State; - private String Sort; - private Boolean Enabled; - private String Type; - private String PushBtn; +public class Functions implements java.io.Serializable { + private Long Id; + private String Number; + private String Name; + private String PNumber; + private String URL; + private Boolean State; + private String Sort; + private Boolean Enabled; + private String Type; + private String PushBtn; - public Functions() - { - - } + public Functions() { - public Long getId() { - return Id; - } + } - public void setId(Long id) { - Id = id; - } + public Long getId() { + return Id; + } - public String getNumber() { - return Number; - } + public void setId(Long id) { + Id = id; + } - public void setNumber(String number) { - Number = number; - } + public String getNumber() { + return Number; + } - public String getName() { - return Name; - } + public void setNumber(String number) { + Number = number; + } - public void setName(String name) { - Name = name; - } + public String getName() { + return Name; + } - public String getPNumber() { - return PNumber; - } + public void setName(String name) { + Name = name; + } - public void setPNumber(String pNumber) { - PNumber = pNumber; - } + public String getPNumber() { + return PNumber; + } - public String getURL() { - return URL; - } + public void setPNumber(String pNumber) { + PNumber = pNumber; + } - public void setURL(String uRL) { - URL = uRL; - } + public String getURL() { + return URL; + } - public Boolean getState() { - return State; - } + public void setURL(String uRL) { + URL = uRL; + } - public void setState(Boolean state) { - State = state; - } + public Boolean getState() { + return State; + } - public String getSort() { - return Sort; - } + public void setState(Boolean state) { + State = state; + } - public void setSort(String sort) { - Sort = sort; - } + public String getSort() { + return Sort; + } - public Boolean getEnabled() { - return Enabled; - } + public void setSort(String sort) { + Sort = sort; + } - public void setEnabled(Boolean enabled) { - Enabled = enabled; - } + public Boolean getEnabled() { + return Enabled; + } - public String getType() { - return Type; - } + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } - public void setType(String type) { - Type = type; - } + public String getType() { + return Type; + } - public String getPushBtn() { - return PushBtn; - } + public void setType(String type) { + Type = type; + } - public void setPushBtn(String pushBtn) { - PushBtn = pushBtn; - } + public String getPushBtn() { + return PushBtn; + } + + public void setPushBtn(String pushBtn) { + PushBtn = pushBtn; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/InOutItem.java b/src/main/java/com/jsh/model/po/InOutItem.java index 09ca1373..5aea6aa7 100644 --- a/src/main/java/com/jsh/model/po/InOutItem.java +++ b/src/main/java/com/jsh/model/po/InOutItem.java @@ -1,20 +1,17 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class InOutItem implements java.io.Serializable -{ +public class InOutItem implements java.io.Serializable { private Long Id; private String Name; private String Type; private String Remark; - public InOutItem() - { + public InOutItem() { } - public InOutItem(Long Id) - { + public InOutItem(Long Id) { this.Id = Id; } @@ -24,43 +21,35 @@ public class InOutItem implements java.io.Serializable Remark = remark; } - public void setId(Long id) - { - Id = id; - } - - public Long getId() - { + public Long getId() { return Id; } - public void setName(String name) - { - Name = name; + public void setId(Long id) { + Id = id; } - public String getName() - { + public String getName() { return Name; } - public void setType(String type) - { - Type = type; + public void setName(String name) { + Name = name; } - public String getType() - { + public String getType() { return Type; } - public void setRemark(String remark) - { - Remark = remark; + public void setType(String type) { + Type = type; } - public String getRemark() - { + public String getRemark() { return Remark; } + + public void setRemark(String remark) { + Remark = remark; + } } diff --git a/src/main/java/com/jsh/model/po/Logdetails.java b/src/main/java/com/jsh/model/po/Logdetails.java index df9ad7bb..fb682596 100644 --- a/src/main/java/com/jsh/model/po/Logdetails.java +++ b/src/main/java/com/jsh/model/po/Logdetails.java @@ -3,52 +3,46 @@ package com.jsh.model.po; import java.sql.Timestamp; @SuppressWarnings("serial") -public class Logdetails implements java.io.Serializable -{ +public class Logdetails implements java.io.Serializable { - private Long id; - private Basicuser user; - private String operation; - private String clientIp; - private Timestamp createtime; - private Short status; - private String contentdetails; - private String remark; + private Long id; + private Basicuser user; + private String operation; + private String clientIp; + private Timestamp createtime; + private Short status; + private String contentdetails; + private String remark; - public Logdetails() - { - - } - - public Logdetails(Long id) - { - this.id = id; - } + public Logdetails() { - public Logdetails(Basicuser user, String operation, String clientIp, - Timestamp createtime, Short status, String contentdetails, - String remark) - { - this.user = user; - this.operation = operation; - this.clientIp = clientIp; - this.createtime = createtime; - this.status = status; - this.contentdetails = contentdetails; - this.remark = remark; - } + } - public Long getId() - { - return this.id; - } + public Logdetails(Long id) { + this.id = id; + } - public void setId(Long id) - { - this.id = id; - } + public Logdetails(Basicuser user, String operation, String clientIp, + Timestamp createtime, Short status, String contentdetails, + String remark) { + this.user = user; + this.operation = operation; + this.clientIp = clientIp; + this.createtime = createtime; + this.status = status; + this.contentdetails = contentdetails; + this.remark = remark; + } - public Basicuser getUser() { + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public Basicuser getUser() { return user; } @@ -56,64 +50,52 @@ public class Logdetails implements java.io.Serializable this.user = user; } - public String getOperation() - { - return this.operation; - } + public String getOperation() { + return this.operation; + } - public void setOperation(String operation) - { - this.operation = operation; - } + public void setOperation(String operation) { + this.operation = operation; + } - public String getClientIp() - { - return this.clientIp; - } + public String getClientIp() { + return this.clientIp; + } - public void setClientIp(String clientIp) - { - this.clientIp = clientIp; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public Timestamp getCreatetime() - { - return this.createtime; - } + public Timestamp getCreatetime() { + return this.createtime; + } - public void setCreatetime(Timestamp createtime) - { - this.createtime = createtime; - } + public void setCreatetime(Timestamp createtime) { + this.createtime = createtime; + } - public Short getStatus() - { - return this.status; - } + public Short getStatus() { + return this.status; + } - public void setStatus(Short status) - { - this.status = status; - } + public void setStatus(Short status) { + this.status = status; + } - public String getContentdetails() - { - return this.contentdetails; - } + public String getContentdetails() { + return this.contentdetails; + } - public void setContentdetails(String contentdetails) - { - this.contentdetails = contentdetails; - } + public void setContentdetails(String contentdetails) { + this.contentdetails = contentdetails; + } - public String getRemark() - { - return this.remark; - } + public String getRemark() { + return this.remark; + } - public void setRemark(String remark) - { - this.remark = remark; - } + public void setRemark(String remark) { + this.remark = remark; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/Material.java b/src/main/java/com/jsh/model/po/Material.java index 11d952ff..f44d7e60 100644 --- a/src/main/java/com/jsh/model/po/Material.java +++ b/src/main/java/com/jsh/model/po/Material.java @@ -3,310 +3,287 @@ package com.jsh.model.po; import java.util.Map; @SuppressWarnings("serial") -public class Material implements java.io.Serializable -{ - private Long Id; - private MaterialCategory materialCategory; - private String Name; - private String Mfrs; - private Double Packing; - private Double SafetyStock; - private String Model; - private String Standard; - private String Color; - private String Unit; +public class Material implements java.io.Serializable { + private Long Id; + private MaterialCategory materialCategory; + private String Name; + private String Mfrs; + private Double Packing; + private Double SafetyStock; + private String Model; + private String Standard; + private String Color; + private String Unit; private Double RetailPrice; private Double LowPrice; private Double PresetPriceOne; private Double PresetPriceTwo; - private Unit UnitId; - private String FirstOutUnit; - private String FirstInUnit; - private String PriceStrategy; - private String Remark; - private Boolean Enabled; - private String OtherField1; - private String OtherField2; - private String OtherField3; + private Unit UnitId; + private String FirstOutUnit; + private String FirstInUnit; + private String PriceStrategy; + private String Remark; + private Boolean Enabled; + private String OtherField1; + private String OtherField2; + private String OtherField3; - //----------以下属性导入exel表格使用-------------------- - /** - * 类型 right--正确 warn--警告 wrong--错误 - */ - private Map cellInfo; + //----------以下属性导入exel表格使用-------------------- + /** + * 类型 right--正确 warn--警告 wrong--错误 + */ + private Map cellInfo; - /** - * 行号 - */ - private Integer rowLineNum; + /** + * 行号 + */ + private Integer rowLineNum; - private String safetyStockStr; + private String safetyStockStr; - public Material() - { + public Material() { - } + } - public Material(Long Id) - { - this.Id = Id; - } + public Material(Long Id) { + this.Id = Id; + } - public Material(MaterialCategory materialCategory, String name, String mfrs, Double packing, - Double safetyStock, String model, String standard, String color, String unit, String remark, - Double retailPrice, Double lowPrice, Double presetPriceOne, Double presetPriceTwo, - Unit unitId, String firstOutUnit, String firstInUnit, String priceStrategy, Boolean enabled, - String otherField1, String otherField2, String otherField3) { - super(); - this.materialCategory = materialCategory; - Name = name; - Mfrs = mfrs; - Packing = packing; - SafetyStock = safetyStock; - Model = model; - Standard = standard; - Color = color; - Unit = unit; + public Material(MaterialCategory materialCategory, String name, String mfrs, Double packing, + Double safetyStock, String model, String standard, String color, String unit, String remark, + Double retailPrice, Double lowPrice, Double presetPriceOne, Double presetPriceTwo, + Unit unitId, String firstOutUnit, String firstInUnit, String priceStrategy, Boolean enabled, + String otherField1, String otherField2, String otherField3) { + super(); + this.materialCategory = materialCategory; + Name = name; + Mfrs = mfrs; + Packing = packing; + SafetyStock = safetyStock; + Model = model; + Standard = standard; + Color = color; + Unit = unit; RetailPrice = retailPrice; LowPrice = lowPrice; PresetPriceOne = presetPriceOne; PresetPriceTwo = presetPriceTwo; - Remark = remark; - UnitId = unitId; - FirstOutUnit = firstOutUnit; - FirstInUnit = firstInUnit; - PriceStrategy = priceStrategy; - Enabled = enabled; - OtherField1 = otherField1; - OtherField2 = otherField2; - OtherField3 = otherField3; - } - - public Long getId() - { - return Id; - } - - public void setId(Long id) - { - Id = id; - } - - public MaterialCategory getMaterialCategory() - { - return materialCategory; - } - - public void setMaterialCategory(MaterialCategory materialCategory) - { - this.materialCategory = materialCategory; - } - - public String getName() - { - return Name; - } - - public void setName(String name) - { - Name = name; - } - - public String getModel() - { - return Model; - } - - public void setModel(String model) - { - Model = model; - } - - public String getStandard() { - return Standard; - } - - public void setStandard(String standard) { - Standard = standard; - } - - public String getColor() - { - return Color; - } - - public void setColor(String color) - { - Color = color; - } - - public String getUnit() { - return Unit; - } - - public void setUnit(String unit) { - Unit = unit; - } - - public void setRetailPrice(Double retailPrice) - { - RetailPrice = retailPrice; + Remark = remark; + UnitId = unitId; + FirstOutUnit = firstOutUnit; + FirstInUnit = firstInUnit; + PriceStrategy = priceStrategy; + Enabled = enabled; + OtherField1 = otherField1; + OtherField2 = otherField2; + OtherField3 = otherField3; } - public Double getRetailPrice() - { + public Long getId() { + return Id; + } + + public void setId(Long id) { + Id = id; + } + + public MaterialCategory getMaterialCategory() { + return materialCategory; + } + + public void setMaterialCategory(MaterialCategory materialCategory) { + this.materialCategory = materialCategory; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getModel() { + return Model; + } + + public void setModel(String model) { + Model = model; + } + + public String getStandard() { + return Standard; + } + + public void setStandard(String standard) { + Standard = standard; + } + + public String getColor() { + return Color; + } + + public void setColor(String color) { + Color = color; + } + + public String getUnit() { + return Unit; + } + + public void setUnit(String unit) { + Unit = unit; + } + + public Double getRetailPrice() { return RetailPrice; } - public void setLowPrice(Double lowPrice) - { - LowPrice = lowPrice; + public void setRetailPrice(Double retailPrice) { + RetailPrice = retailPrice; } - public Double getLowPrice() - { + public Double getLowPrice() { return LowPrice; } - public void setPresetPriceOne(Double presetPriceOne) - { - PresetPriceOne = presetPriceOne; + public void setLowPrice(Double lowPrice) { + LowPrice = lowPrice; } - public Double getPresetPriceOne() - { + public Double getPresetPriceOne() { return PresetPriceOne; } - public void setPresetPriceTwo(Double presetPriceTwo) - { - PresetPriceTwo = presetPriceTwo; + public void setPresetPriceOne(Double presetPriceOne) { + PresetPriceOne = presetPriceOne; } - public Double getPresetPriceTwo() - { + public Double getPresetPriceTwo() { return PresetPriceTwo; } - public String getRemark() - { - return Remark; - } + public void setPresetPriceTwo(Double presetPriceTwo) { + PresetPriceTwo = presetPriceTwo; + } - public void setRemark(String remark) - { - Remark = remark; - } + public String getRemark() { + return Remark; + } - public String getMfrs() { - return Mfrs; - } + public void setRemark(String remark) { + Remark = remark; + } - public void setMfrs(String mfrs) { - Mfrs = mfrs; - } + public String getMfrs() { + return Mfrs; + } - public Double getPacking() { - return Packing; - } + public void setMfrs(String mfrs) { + Mfrs = mfrs; + } - public void setPacking(Double packing) { - Packing = packing; - } + public Double getPacking() { + return Packing; + } - public Double getSafetyStock() { - return SafetyStock; - } + public void setPacking(Double packing) { + Packing = packing; + } - public void setSafetyStock(Double safetyStock) { - SafetyStock = safetyStock; - } + public Double getSafetyStock() { + return SafetyStock; + } - public Unit getUnitId() { - return UnitId; - } + public void setSafetyStock(Double safetyStock) { + SafetyStock = safetyStock; + } - public void setUnitId(Unit unitId) { - UnitId = unitId; - } + public Unit getUnitId() { + return UnitId; + } - public String getFirstOutUnit() { - return FirstOutUnit; - } + public void setUnitId(Unit unitId) { + UnitId = unitId; + } - public void setFirstOutUnit(String firstOutUnit) { - FirstOutUnit = firstOutUnit; - } + public String getFirstOutUnit() { + return FirstOutUnit; + } - public String getFirstInUnit() { - return FirstInUnit; - } + public void setFirstOutUnit(String firstOutUnit) { + FirstOutUnit = firstOutUnit; + } - public void setFirstInUnit(String firstInUnit) { - FirstInUnit = firstInUnit; - } + public String getFirstInUnit() { + return FirstInUnit; + } - public String getPriceStrategy() { - return PriceStrategy; - } + public void setFirstInUnit(String firstInUnit) { + FirstInUnit = firstInUnit; + } - public void setPriceStrategy(String priceStrategy) { - PriceStrategy = priceStrategy; - } + public String getPriceStrategy() { + return PriceStrategy; + } - public Boolean getEnabled() { - return Enabled; - } + public void setPriceStrategy(String priceStrategy) { + PriceStrategy = priceStrategy; + } - public void setEnabled(Boolean enabled) { - Enabled = enabled; - } + public Boolean getEnabled() { + return Enabled; + } - public String getOtherField1() { - return OtherField1; - } + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } - public void setOtherField1(String otherField1) { - OtherField1 = otherField1; - } + public String getOtherField1() { + return OtherField1; + } - public String getOtherField3() { - return OtherField3; - } + public void setOtherField1(String otherField1) { + OtherField1 = otherField1; + } - public void setOtherField3(String otherField3) { - OtherField3 = otherField3; - } + public String getOtherField3() { + return OtherField3; + } - public String getOtherField2() { - return OtherField2; - } + public void setOtherField3(String otherField3) { + OtherField3 = otherField3; + } - public void setOtherField2(String otherField2) { - OtherField2 = otherField2; - } + public String getOtherField2() { + return OtherField2; + } - public Map getCellInfo() { - return cellInfo; - } + public void setOtherField2(String otherField2) { + OtherField2 = otherField2; + } - public void setCellInfo(Map cellInfo) { - this.cellInfo = cellInfo; - } + public Map getCellInfo() { + return cellInfo; + } - public Integer getRowLineNum() { - return rowLineNum; - } + public void setCellInfo(Map cellInfo) { + this.cellInfo = cellInfo; + } - public void setRowLineNum(Integer rowLineNum) { - this.rowLineNum = rowLineNum; - } + public Integer getRowLineNum() { + return rowLineNum; + } - public String getSafetyStockStr() { - return safetyStockStr; - } + public void setRowLineNum(Integer rowLineNum) { + this.rowLineNum = rowLineNum; + } - public void setSafetyStockStr(String safetyStockStr) { - this.safetyStockStr = safetyStockStr; - } + public String getSafetyStockStr() { + return safetyStockStr; + } + + public void setSafetyStockStr(String safetyStockStr) { + this.safetyStockStr = safetyStockStr; + } } diff --git a/src/main/java/com/jsh/model/po/MaterialCategory.java b/src/main/java/com/jsh/model/po/MaterialCategory.java index 22bc933b..ef300385 100644 --- a/src/main/java/com/jsh/model/po/MaterialCategory.java +++ b/src/main/java/com/jsh/model/po/MaterialCategory.java @@ -1,61 +1,58 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class MaterialCategory implements java.io.Serializable -{ - private Long Id; - private String Name; - private Short CategoryLevel; - private MaterialCategory materialCategory; - - - public MaterialCategory() - { - - } - - public MaterialCategory(Long Id) - { - this.Id = Id; - } +public class MaterialCategory implements java.io.Serializable { + private Long Id; + private String Name; + private Short CategoryLevel; + private MaterialCategory materialCategory; - public MaterialCategory(String name, Short categoryLevel, - MaterialCategory materialCategory) { - Name = name; - CategoryLevel = categoryLevel; - this.materialCategory = materialCategory; - } - public Long getId() { - return Id; - } + public MaterialCategory() { - public void setId(Long id) { - Id = id; - } + } - public String getName() { - return Name; - } + public MaterialCategory(Long Id) { + this.Id = Id; + } - public void setName(String name) { - Name = name; - } + public MaterialCategory(String name, Short categoryLevel, + MaterialCategory materialCategory) { + Name = name; + CategoryLevel = categoryLevel; + this.materialCategory = materialCategory; + } - public Short getCategoryLevel() { - return CategoryLevel; - } + public Long getId() { + return Id; + } - public void setCategoryLevel(Short categoryLevel) { - CategoryLevel = categoryLevel; - } + public void setId(Long id) { + Id = id; + } - public MaterialCategory getMaterialCategory() { - return materialCategory; - } + public String getName() { + return Name; + } - public void setMaterialCategory(MaterialCategory materialCategory) { - this.materialCategory = materialCategory; - } + public void setName(String name) { + Name = name; + } + + public Short getCategoryLevel() { + return CategoryLevel; + } + + public void setCategoryLevel(Short categoryLevel) { + CategoryLevel = categoryLevel; + } + + public MaterialCategory getMaterialCategory() { + return materialCategory; + } + + public void setMaterialCategory(MaterialCategory materialCategory) { + this.materialCategory = materialCategory; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/MaterialProperty.java b/src/main/java/com/jsh/model/po/MaterialProperty.java index b3aea945..214bab1c 100644 --- a/src/main/java/com/jsh/model/po/MaterialProperty.java +++ b/src/main/java/com/jsh/model/po/MaterialProperty.java @@ -2,65 +2,64 @@ package com.jsh.model.po; @SuppressWarnings("serial") public class MaterialProperty implements java.io.Serializable { - private Long id; - private String nativeName; - private Boolean enabled; - private String sort; - private String anotherName; + private Long id; + private String nativeName; + private Boolean enabled; + private String sort; + private String anotherName; - public MaterialProperty() { + public MaterialProperty() { - } + } - public MaterialProperty(Long id) - { - this.id = id; - } + public MaterialProperty(Long id) { + this.id = id; + } - public MaterialProperty(String nativeName, Boolean enabled,String sort, String anotherName) { - nativeName = nativeName; - enabled = enabled; - sort = sort; - anotherName = anotherName; - } + public MaterialProperty(String nativeName, Boolean enabled, String sort, String anotherName) { + nativeName = nativeName; + enabled = enabled; + sort = sort; + anotherName = anotherName; + } - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public String getNativeName() { - return nativeName; - } + public String getNativeName() { + return nativeName; + } - public void setNativeName(String nativeName) { - this.nativeName = nativeName; - } + public void setNativeName(String nativeName) { + this.nativeName = nativeName; + } - public Boolean getEnabled() { - return enabled; - } + public Boolean getEnabled() { + return enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public String getSort() { - return sort; - } + public String getSort() { + return sort; + } - public void setSort(String sort) { - this.sort = sort; - } + public void setSort(String sort) { + this.sort = sort; + } - public String getAnotherName() { - return anotherName; - } + public String getAnotherName() { + return anotherName; + } - public void setAnotherName(String anotherName) { - this.anotherName = anotherName; - } + public void setAnotherName(String anotherName) { + this.anotherName = anotherName; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/Person.java b/src/main/java/com/jsh/model/po/Person.java index 6e739bd1..e1b76ea0 100644 --- a/src/main/java/com/jsh/model/po/Person.java +++ b/src/main/java/com/jsh/model/po/Person.java @@ -1,49 +1,46 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class Person implements java.io.Serializable -{ - private Long Id; - private String Type; - private String Name; +public class Person implements java.io.Serializable { + private Long Id; + private String Type; + private String Name; - public Person() - { - - } - - public Person(Long Id) - { - this.Id = Id; - } + public Person() { - public Person(String type, String name) { - Type = type; - Name = name; - } + } - public Long getId() { - return Id; - } + public Person(Long Id) { + this.Id = Id; + } - public void setId(Long id) { - Id = id; - } + public Person(String type, String name) { + Type = type; + Name = name; + } - public String getType() { - return Type; - } + public Long getId() { + return Id; + } - public void setType(String type) { - Type = type; - } + public void setId(Long id) { + Id = id; + } - public String getName() { - return Name; - } + public String getType() { + return Type; + } + + public void setType(String type) { + Type = type; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } - public void setName(String name) { - Name = name; - } - } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/Role.java b/src/main/java/com/jsh/model/po/Role.java index 1e82eb27..ea7a3b9b 100644 --- a/src/main/java/com/jsh/model/po/Role.java +++ b/src/main/java/com/jsh/model/po/Role.java @@ -1,31 +1,29 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class Role implements java.io.Serializable -{ - private Long Id; - private String Name; +public class Role implements java.io.Serializable { + private Long Id; + private String Name; - public Role() - { - - } + public Role() { - public Long getId() { - return Id; - } + } - public void setId(Long id) { - Id = id; - } + public Long getId() { + return Id; + } - public String getName() { - return Name; - } + public void setId(Long id) { + Id = id; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } - public void setName(String name) { - Name = name; - } - } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/Supplier.java b/src/main/java/com/jsh/model/po/Supplier.java index 74db12da..10b7c51d 100644 --- a/src/main/java/com/jsh/model/po/Supplier.java +++ b/src/main/java/com/jsh/model/po/Supplier.java @@ -3,321 +3,307 @@ package com.jsh.model.po; import java.util.Map; @SuppressWarnings("serial") -public class Supplier implements java.io.Serializable -{ - private Long id =0l; - private String supplier = ""; - private String type = ""; - private String contacts = ""; - private String phonenum = ""; - private String fax = ""; - private String telephone = ""; - private String email = ""; - private String address = ""; - private Double advanceIn = 0d; - private String taxNum = ""; - private String bankName = ""; - private String accountNumber = ""; - private Double taxRate = 0d; +public class Supplier implements java.io.Serializable { + private Long id = 0l; + private String supplier = ""; + private String type = ""; + private String contacts = ""; + private String phonenum = ""; + private String fax = ""; + private String telephone = ""; + private String email = ""; + private String address = ""; + private Double advanceIn = 0d; + private String taxNum = ""; + private String bankName = ""; + private String accountNumber = ""; + private Double taxRate = 0d; private Double BeginNeedGet = 0d; private Double BeginNeedPay = 0d; private Double AllNeedGet = 0d; private Double AllNeedPay = 0d; - private Short isystem = 1; - private String description = ""; - private Boolean enabled = true; + private Short isystem = 1; + private String description = ""; + private Boolean enabled = true; - //----------以下属性导入exel表格使用-------------------- - /** - * 类型 right--正确 warn--警告 wrong--错误 - */ - private Map cellInfo; + //----------以下属性导入exel表格使用-------------------- + /** + * 类型 right--正确 warn--警告 wrong--错误 + */ + private Map cellInfo; - /** - * 行号 - */ - private Integer rowLineNum; + /** + * 行号 + */ + private Integer rowLineNum; - private String advanceInStr; + private String advanceInStr; - private String beginNeedGetStr; + private String beginNeedGetStr; - private String beginNeedPayStr; + private String beginNeedPayStr; - private String taxRateStr; + private String taxRateStr; - private String enabledStr; + private String enabledStr; - public Supplier() - { - - } - - public Supplier(Long id) - { - this.id = id; - } + public Supplier() { - public Supplier(String supplier, String type, String contacts, String phonenum, - String fax,String telephone, String email, String address, Short isystem, String description, - Boolean enabled, Double advanceIn, String taxNum,String bankName,String accountNumber, Double taxRate, - Double beginNeedGet,Double beginNeedPay,Double allNeedGet,Double allNeedPay) { - super(); - this.supplier = supplier; - this.type = type; - this.contacts = contacts; - this.phonenum = phonenum; - this.fax = fax; - this.telephone = telephone; - this.address = address; - this.email = email; + } + + public Supplier(Long id) { + this.id = id; + } + + public Supplier(String supplier, String type, String contacts, String phonenum, + String fax, String telephone, String email, String address, Short isystem, String description, + Boolean enabled, Double advanceIn, String taxNum, String bankName, String accountNumber, Double taxRate, + Double beginNeedGet, Double beginNeedPay, Double allNeedGet, Double allNeedPay) { + super(); + this.supplier = supplier; + this.type = type; + this.contacts = contacts; + this.phonenum = phonenum; + this.fax = fax; + this.telephone = telephone; + this.address = address; + this.email = email; this.BeginNeedGet = beginNeedGet; this.BeginNeedPay = beginNeedPay; this.AllNeedGet = allNeedGet; - this.AllNeedPay = allNeedPay; - this.isystem = isystem; - this.description = description; - this.enabled = enabled; - this.advanceIn = advanceIn; - this.taxNum = taxNum; - this.bankName = bankName; - this.accountNumber = accountNumber; - this.taxRate = taxRate; - } - - public Long getId() - { - return id; - } - - public void setId(Long id) - { - this.id = id; - } - - public String getSupplier() - { - return supplier; - } - - public void setSupplier(String supplier) { - this.supplier = supplier; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getContacts() { - return contacts; - } - - public void setContacts(String contacts) { - this.contacts = contacts; - } - - public String getPhonenum() { - return phonenum; - } - - public void setPhonenum(String phonenum) { - this.phonenum = phonenum; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public void setBeginNeedGet(Double beginNeedGet) - { - BeginNeedGet = beginNeedGet; + this.AllNeedPay = allNeedPay; + this.isystem = isystem; + this.description = description; + this.enabled = enabled; + this.advanceIn = advanceIn; + this.taxNum = taxNum; + this.bankName = bankName; + this.accountNumber = accountNumber; + this.taxRate = taxRate; } - public Double getBeginNeedGet() - { + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSupplier() { + return supplier; + } + + public void setSupplier(String supplier) { + this.supplier = supplier; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getContacts() { + return contacts; + } + + public void setContacts(String contacts) { + this.contacts = contacts; + } + + public String getPhonenum() { + return phonenum; + } + + public void setPhonenum(String phonenum) { + this.phonenum = phonenum; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Double getBeginNeedGet() { return BeginNeedGet; } - public void setBeginNeedPay(Double beginNeedPay) - { - BeginNeedPay = beginNeedPay; + public void setBeginNeedGet(Double beginNeedGet) { + BeginNeedGet = beginNeedGet; } - public Double getBeginNeedPay() - { + public Double getBeginNeedPay() { return BeginNeedPay; } - public void setAllNeedGet(Double allNeedGet) - { - AllNeedGet = allNeedGet; + public void setBeginNeedPay(Double beginNeedPay) { + BeginNeedPay = beginNeedPay; } - public Double getAllNeedGet() - { + public Double getAllNeedGet() { return AllNeedGet; } - public void setAllNeedPay(Double allNeedPay) - { - AllNeedPay = allNeedPay; + public void setAllNeedGet(Double allNeedGet) { + AllNeedGet = allNeedGet; } - public Double getAllNeedPay() - { + public Double getAllNeedPay() { return AllNeedPay; } - public Short getIsystem() { - return isystem; - } + public void setAllNeedPay(Double allNeedPay) { + AllNeedPay = allNeedPay; + } - public void setIsystem(Short isystem) { - this.isystem = isystem; - } + public Short getIsystem() { + return isystem; + } - public String getDescription() { - return description; - } + public void setIsystem(Short isystem) { + this.isystem = isystem; + } - public void setDescription(String description) { - this.description = description; - } + public String getDescription() { + return description; + } - public Boolean getEnabled() { - return enabled; - } + public void setDescription(String description) { + this.description = description; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public Boolean getEnabled() { + return enabled; + } - public Double getAdvanceIn() { - return advanceIn; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public void setAdvanceIn(Double advanceIn) { - this.advanceIn = advanceIn; - } + public Double getAdvanceIn() { + return advanceIn; + } - public String getFax() { - return fax; - } + public void setAdvanceIn(Double advanceIn) { + this.advanceIn = advanceIn; + } - public void setFax(String fax) { - this.fax = fax; - } + public String getFax() { + return fax; + } - public String getTelephone() { - return telephone; - } + public void setFax(String fax) { + this.fax = fax; + } - public void setTelephone(String telephone) { - this.telephone = telephone; - } + public String getTelephone() { + return telephone; + } - public String getAddress() { - return address; - } + public void setTelephone(String telephone) { + this.telephone = telephone; + } - public void setAddress(String address) { - this.address = address; - } + public String getAddress() { + return address; + } - public String getTaxNum() { - return taxNum; - } + public void setAddress(String address) { + this.address = address; + } - public void setTaxNum(String taxNum) { - this.taxNum = taxNum; - } + public String getTaxNum() { + return taxNum; + } - public String getBankName() { - return bankName; - } + public void setTaxNum(String taxNum) { + this.taxNum = taxNum; + } - public void setBankName(String bankName) { - this.bankName = bankName; - } + public String getBankName() { + return bankName; + } - public String getAccountNumber() { - return accountNumber; - } + public void setBankName(String bankName) { + this.bankName = bankName; + } - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } + public String getAccountNumber() { + return accountNumber; + } - public Double getTaxRate() { - return taxRate; - } + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } - public void setTaxRate(Double taxRate) { - this.taxRate = taxRate; - } + public Double getTaxRate() { + return taxRate; + } - public Map getCellInfo() { - return cellInfo; - } + public void setTaxRate(Double taxRate) { + this.taxRate = taxRate; + } - public void setCellInfo(Map cellInfo) { - this.cellInfo = cellInfo; - } + public Map getCellInfo() { + return cellInfo; + } - public Integer getRowLineNum() { - return rowLineNum; - } + public void setCellInfo(Map cellInfo) { + this.cellInfo = cellInfo; + } - public void setRowLineNum(Integer rowLineNum) { - this.rowLineNum = rowLineNum; - } + public Integer getRowLineNum() { + return rowLineNum; + } - public String getAdvanceInStr() { - return advanceInStr; - } + public void setRowLineNum(Integer rowLineNum) { + this.rowLineNum = rowLineNum; + } - public void setAdvanceInStr(String advanceInStr) { - this.advanceInStr = advanceInStr; - } + public String getAdvanceInStr() { + return advanceInStr; + } - public String getBeginNeedGetStr() { - return beginNeedGetStr; - } + public void setAdvanceInStr(String advanceInStr) { + this.advanceInStr = advanceInStr; + } - public void setBeginNeedGetStr(String beginNeedGetStr) { - this.beginNeedGetStr = beginNeedGetStr; - } + public String getBeginNeedGetStr() { + return beginNeedGetStr; + } - public String getBeginNeedPayStr() { - return beginNeedPayStr; - } + public void setBeginNeedGetStr(String beginNeedGetStr) { + this.beginNeedGetStr = beginNeedGetStr; + } - public void setBeginNeedPayStr(String beginNeedPayStr) { - this.beginNeedPayStr = beginNeedPayStr; - } + public String getBeginNeedPayStr() { + return beginNeedPayStr; + } - public String getTaxRateStr() { - return taxRateStr; - } + public void setBeginNeedPayStr(String beginNeedPayStr) { + this.beginNeedPayStr = beginNeedPayStr; + } - public void setTaxRateStr(String taxRateStr) { - this.taxRateStr = taxRateStr; - } + public String getTaxRateStr() { + return taxRateStr; + } - public String getEnabledStr() { - return enabledStr; - } + public void setTaxRateStr(String taxRateStr) { + this.taxRateStr = taxRateStr; + } - public void setEnabledStr(String enabledStr) { - this.enabledStr = enabledStr; - } + public String getEnabledStr() { + return enabledStr; + } + + public void setEnabledStr(String enabledStr) { + this.enabledStr = enabledStr; + } } diff --git a/src/main/java/com/jsh/model/po/SystemConfig.java b/src/main/java/com/jsh/model/po/SystemConfig.java index 77b3aafa..935d390a 100644 --- a/src/main/java/com/jsh/model/po/SystemConfig.java +++ b/src/main/java/com/jsh/model/po/SystemConfig.java @@ -1,51 +1,50 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class SystemConfig implements java.io.Serializable -{ - private Long id; - private String type; - private String name; - private String value; - private String description; +public class SystemConfig implements java.io.Serializable { + private Long id; + private String type; + private String name; + private String value; + private String description; - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public void setValue(String value) { - this.value = value; - } + public void setValue(String value) { + this.value = value; + } - public String getDescription() { - return description; - } + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } + public void setDescription(String description) { + this.description = description; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/Unit.java b/src/main/java/com/jsh/model/po/Unit.java index a639d54f..1a53dd3c 100644 --- a/src/main/java/com/jsh/model/po/Unit.java +++ b/src/main/java/com/jsh/model/po/Unit.java @@ -1,39 +1,36 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class Unit implements java.io.Serializable -{ - private Long id; - private String UName; +public class Unit implements java.io.Serializable { + private Long id; + private String UName; - public Unit() - { + public Unit() { - } + } - public Unit(Long id) { - this.id = id; - } + public Unit(Long id) { + this.id = id; + } - public Unit(String UName) - { - this.UName = UName; - } + public Unit(String UName) { + this.UName = UName; + } - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public String getUName() { - return UName; - } + public String getUName() { + return UName; + } - public void setUName(String UName) { - this.UName = UName; - } + public void setUName(String UName) { + this.UName = UName; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/po/UserBusiness.java b/src/main/java/com/jsh/model/po/UserBusiness.java index 421dc5df..6581dca1 100644 --- a/src/main/java/com/jsh/model/po/UserBusiness.java +++ b/src/main/java/com/jsh/model/po/UserBusiness.java @@ -1,56 +1,54 @@ package com.jsh.model.po; @SuppressWarnings("serial") -public class UserBusiness implements java.io.Serializable -{ - private Long Id; - private String Type; - private String KeyId; - private String Value; - private String BtnStr; +public class UserBusiness implements java.io.Serializable { + private Long Id; + private String Type; + private String KeyId; + private String Value; + private String BtnStr; - public UserBusiness() - { - - } + public UserBusiness() { - public Long getId() { - return Id; - } + } - public void setId(Long id) { - Id = id; - } + public Long getId() { + return Id; + } - public String getType() { - return Type; - } + public void setId(Long id) { + Id = id; + } - public void setType(String type) { - Type = type; - } + public String getType() { + return Type; + } - public String getKeyId() { - return KeyId; - } + public void setType(String type) { + Type = type; + } - public void setKeyId(String keyId) { - KeyId = keyId; - } + public String getKeyId() { + return KeyId; + } - public String getValue() { - return Value; - } + public void setKeyId(String keyId) { + KeyId = keyId; + } - public void setValue(String value) { - Value = value; - } + public String getValue() { + return Value; + } - public String getBtnStr() { - return BtnStr; - } + public void setValue(String value) { + Value = value; + } - public void setBtnStr(String btnStr) { - BtnStr = btnStr; - } + public String getBtnStr() { + return BtnStr; + } + + public void setBtnStr(String btnStr) { + BtnStr = btnStr; + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/model/vo/asset/AssetModel.java b/src/main/java/com/jsh/model/vo/asset/AssetModel.java index 8b361f33..bfd3702e 100644 --- a/src/main/java/com/jsh/model/vo/asset/AssetModel.java +++ b/src/main/java/com/jsh/model/vo/asset/AssetModel.java @@ -5,425 +5,368 @@ import java.io.InputStream; import java.io.Serializable; @SuppressWarnings("serial") -public class AssetModel implements Serializable -{ +public class AssetModel implements Serializable { private AssetShowModel showModel = new AssetShowModel(); - + /**======开始接受页面参数=================**/ /** * 资产名称ID */ - private Long assetNameID ; - + private Long assetNameID; + /** * 资产类型ID */ - private Long assetCategoryID ; - + private Long assetCategoryID; + /** * 位置属性 */ private String location = ""; - + /** * 状态属性 */ - private Short status ; - + private Short status; + /** * 用户ID */ - private Long userID ; - + private Long userID; + /** * 资产单价 */ private double price = 0; - + /** * 购买日期 */ private String purchasedate = ""; - + /** * 有效日期 */ private String periodofvalidity = ""; - + /** * 保修日期 */ private String warrantydate = ""; - + /** * 资产编号 */ private String assetnum = ""; - + /** * 资产序列号 */ private String serialnum = ""; - + /** * 标签 */ private String labels = ""; - + /** * 资产ID */ - private Long supplierID; - + private Long supplierID; + /** * 描述信息 */ private String description = ""; - - + + /** * 资产ID */ private Long assetID; - + /** * 资产IDs 批量操作使用 */ private String assetIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - + /** * 输入流,导出excel文件 */ - private InputStream excelStream; - - /** - * 文件名称 - */ - private String fileName = ""; - - /** - * 是否全部数据--根据搜索条件 - */ - private String isAllData = ""; - - /** - * 浏览器类型--中文字符乱码问题解决,火狐和IE下字符类型不一样 - */ - private String browserType = ""; - - /** - * 导入excel文件 - */ - private File assetFile; - - /** - * 文件类型 - */ - private String assetFileContentType; - - /** - * 文件名称 - */ - private String assetFileFileName; - - /** - * 是否只手工检查数据 0==检查 1==不检查直接导入数据库中 - */ - private Integer isCheck; + private InputStream excelStream; - public AssetShowModel getShowModel() - { + /** + * 文件名称 + */ + private String fileName = ""; + + /** + * 是否全部数据--根据搜索条件 + */ + private String isAllData = ""; + + /** + * 浏览器类型--中文字符乱码问题解决,火狐和IE下字符类型不一样 + */ + private String browserType = ""; + + /** + * 导入excel文件 + */ + private File assetFile; + + /** + * 文件类型 + */ + private String assetFileContentType; + + /** + * 文件名称 + */ + private String assetFileFileName; + + /** + * 是否只手工检查数据 0==检查 1==不检查直接导入数据库中 + */ + private Integer isCheck; + + public AssetShowModel getShowModel() { return showModel; } - public void setShowModel(AssetShowModel showModel) - { + public void setShowModel(AssetShowModel showModel) { this.showModel = showModel; } - public String getDescription() - { + public String getDescription() { return description; } - public void setDescription(String description) - { + public void setDescription(String description) { this.description = description; } - public Long getAssetID() - { + public Long getAssetID() { return assetID; } - public void setAssetID(Long assetID) - { + public void setAssetID(Long assetID) { this.assetID = assetID; } - public String getAssetIDs() - { + public String getAssetIDs() { return assetIDs; } - public void setAssetIDs(String assetIDs) - { + public void setAssetIDs(String assetIDs) { this.assetIDs = assetIDs; } - public int getPageSize() - { + public int getPageSize() { return pageSize; } - public void setPageSize(int pageSize) - { + public void setPageSize(int pageSize) { this.pageSize = pageSize; } - public int getPageNo() - { + public int getPageNo() { return pageNo; } - public void setPageNo(int pageNo) - { + public void setPageNo(int pageNo) { this.pageNo = pageNo; } - public String getClientIp() - { + public String getClientIp() { return clientIp; } - public void setClientIp(String clientIp) - { + public void setClientIp(String clientIp) { this.clientIp = clientIp; } - public Long getAssetNameID() - { + public Long getAssetNameID() { return assetNameID; } - public void setAssetNameID(Long assetNameID) - { + public void setAssetNameID(Long assetNameID) { this.assetNameID = assetNameID; } - public Long getAssetCategoryID() - { + public Long getAssetCategoryID() { return assetCategoryID; } - public void setAssetCategoryID(Long assetCategoryID) - { + public void setAssetCategoryID(Long assetCategoryID) { this.assetCategoryID = assetCategoryID; } - public String getLocation() - { + public String getLocation() { return location; } - public void setLocation(String location) - { + public void setLocation(String location) { this.location = location; } - public Short getStatus() - { + public Short getStatus() { return status; } - public void setStatus(Short status) - { + public void setStatus(Short status) { this.status = status; } - public Long getUserID() - { + public Long getUserID() { return userID; } - public void setUserID(Long userID) - { + public void setUserID(Long userID) { this.userID = userID; } - public double getPrice() - { + public double getPrice() { return price; } - public void setPrice(double price) - { + public void setPrice(double price) { this.price = price; } - public String getPurchasedate() - { + public String getPurchasedate() { return purchasedate; } - public void setPurchasedate(String purchasedate) - { + public void setPurchasedate(String purchasedate) { this.purchasedate = purchasedate; } - public String getPeriodofvalidity() - { + public String getPeriodofvalidity() { return periodofvalidity; } - public void setPeriodofvalidity(String periodofvalidity) - { + public void setPeriodofvalidity(String periodofvalidity) { this.periodofvalidity = periodofvalidity; } - public String getWarrantydate() - { + public String getWarrantydate() { return warrantydate; } - public void setWarrantydate(String warrantydate) - { + public void setWarrantydate(String warrantydate) { this.warrantydate = warrantydate; } - public String getLabels() - { + public String getLabels() { return labels; } - public void setLabels(String labels) - { + public void setLabels(String labels) { this.labels = labels; } - public Long getSupplierID() - { + public Long getSupplierID() { return supplierID; } - public void setSupplierID(Long supplierID) - { + public void setSupplierID(Long supplierID) { this.supplierID = supplierID; } - public String getAssetnum() - { + public String getAssetnum() { return assetnum; } - public void setAssetnum(String assetnum) - { + public void setAssetnum(String assetnum) { this.assetnum = assetnum; } - public String getSerialnum() - { + public String getSerialnum() { return serialnum; } - public void setSerialnum(String serialnum) - { + public void setSerialnum(String serialnum) { this.serialnum = serialnum; } - public InputStream getExcelStream() - { - return excelStream; - } + public InputStream getExcelStream() { + return excelStream; + } - public void setExcelStream(InputStream excelStream) - { - this.excelStream = excelStream; - } + public void setExcelStream(InputStream excelStream) { + this.excelStream = excelStream; + } - public String getFileName() - { - return fileName; - } + public String getFileName() { + return fileName; + } - public void setFileName(String fileName) - { - this.fileName = fileName; - } + public void setFileName(String fileName) { + this.fileName = fileName; + } - public String getIsAllData() - { - return isAllData; - } + public String getIsAllData() { + return isAllData; + } - public void setIsAllData(String isAllData) - { - this.isAllData = isAllData; - } + public void setIsAllData(String isAllData) { + this.isAllData = isAllData; + } - public String getBrowserType() - { - return browserType; - } + public String getBrowserType() { + return browserType; + } - public void setBrowserType(String browserType) - { - this.browserType = browserType; - } + public void setBrowserType(String browserType) { + this.browserType = browserType; + } - public File getAssetFile() - { - return assetFile; - } + public File getAssetFile() { + return assetFile; + } - public void setAssetFile(File assetFile) - { - this.assetFile = assetFile; - } + public void setAssetFile(File assetFile) { + this.assetFile = assetFile; + } - public Integer getIsCheck() - { + public Integer getIsCheck() { return isCheck; } - public void setIsCheck(Integer isCheck) - { + public void setIsCheck(Integer isCheck) { this.isCheck = isCheck; } - public String getAssetFileContentType() - { - return assetFileContentType; - } + public String getAssetFileContentType() { + return assetFileContentType; + } - public void setAssetFileContentType(String assetFileContentType) - { - this.assetFileContentType = assetFileContentType; - } + public void setAssetFileContentType(String assetFileContentType) { + this.assetFileContentType = assetFileContentType; + } - public String getAssetFileFileName() - { - return assetFileFileName; - } + public String getAssetFileFileName() { + return assetFileFileName; + } - public void setAssetFileFileName(String assetFileFileName) - { - this.assetFileFileName = assetFileFileName; - } + public void setAssetFileFileName(String assetFileFileName) { + this.assetFileFileName = assetFileFileName; + } } diff --git a/src/main/java/com/jsh/model/vo/asset/AssetShowModel.java b/src/main/java/com/jsh/model/vo/asset/AssetShowModel.java index 6ee4a371..523d88a4 100644 --- a/src/main/java/com/jsh/model/vo/asset/AssetShowModel.java +++ b/src/main/java/com/jsh/model/vo/asset/AssetShowModel.java @@ -5,39 +5,34 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@SuppressWarnings({ "serial" }) -public class AssetShowModel implements Serializable -{ +@SuppressWarnings({"serial"}) +public class AssetShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - + /** * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } @SuppressWarnings("rawtypes") - public Map getMap() - { + public Map getMap() { return map; } @SuppressWarnings("rawtypes") - public void setMap(Map map) - { + public void setMap(Map map) { this.map = map; } } diff --git a/src/main/java/com/jsh/model/vo/asset/ReportModel.java b/src/main/java/com/jsh/model/vo/asset/ReportModel.java index 52468229..4f4c1a2c 100644 --- a/src/main/java/com/jsh/model/vo/asset/ReportModel.java +++ b/src/main/java/com/jsh/model/vo/asset/ReportModel.java @@ -3,319 +3,276 @@ package com.jsh.model.vo.asset; import java.io.Serializable; @SuppressWarnings("serial") -public class ReportModel implements Serializable -{ +public class ReportModel implements Serializable { private ReportShowModel showModel = new ReportShowModel(); /**======开始接受页面参数=================**/ /** * 资产名称ID */ - private Long assetNameID ; - + private Long assetNameID; + /** * 资产类型ID */ - private Long assetCategoryID ; - + private Long assetCategoryID; + /** * 位置属性 */ private String location = ""; - + /** * 状态属性 */ - private Short status ; - + private Short status; + /** * 用户ID */ - private Long usernameID ; - + private Long usernameID; + /** * 资产单价 */ private float price = 0; - + /** * 购买日期 */ private String purchasedate = ""; - + /** * 有效日期 */ private String periodofvalidity = ""; - + /** * 保修日期 */ private String warrantydate = ""; - + /** * 资产编号 */ private String assetnum = ""; - + /** * 资产序列号 */ private String serialnum = ""; - + /** * 标签 */ private String labels = ""; - + /** * 资产ID */ - private Long supplierID; - + private Long supplierID; + /** * 描述信息 */ private String description = ""; - - + + /** * 资产ID */ private Long assetID; - + /** * 资产IDs 批量操作使用 */ private String assetIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - + /** * 报表类型 */ private Integer reportType; - public ReportShowModel getShowModel() - { + public ReportShowModel getShowModel() { return showModel; } - public void setShowModel(ReportShowModel showModel) - { + public void setShowModel(ReportShowModel showModel) { this.showModel = showModel; } - public Long getAssetNameID() - { + public Long getAssetNameID() { return assetNameID; } - public void setAssetNameID(Long assetNameID) - { + public void setAssetNameID(Long assetNameID) { this.assetNameID = assetNameID; } - public Long getAssetCategoryID() - { + public Long getAssetCategoryID() { return assetCategoryID; } - public void setAssetCategoryID(Long assetCategoryID) - { + public void setAssetCategoryID(Long assetCategoryID) { this.assetCategoryID = assetCategoryID; } - public String getLocation() - { + public String getLocation() { return location; } - public void setLocation(String location) - { + public void setLocation(String location) { this.location = location; } - public Short getStatus() - { + public Short getStatus() { return status; } - public void setStatus(Short status) - { + public void setStatus(Short status) { this.status = status; } - public Long getUsernameID() - { + public Long getUsernameID() { return usernameID; } - public void setUsernameID(Long usernameID) - { + public void setUsernameID(Long usernameID) { this.usernameID = usernameID; } - public float getPrice() - { + public float getPrice() { return price; } - public void setPrice(float price) - { + public void setPrice(float price) { this.price = price; } - public String getPurchasedate() - { + public String getPurchasedate() { return purchasedate; } - public void setPurchasedate(String purchasedate) - { + public void setPurchasedate(String purchasedate) { this.purchasedate = purchasedate; } - public String getPeriodofvalidity() - { + public String getPeriodofvalidity() { return periodofvalidity; } - public void setPeriodofvalidity(String periodofvalidity) - { + public void setPeriodofvalidity(String periodofvalidity) { this.periodofvalidity = periodofvalidity; } - public String getWarrantydate() - { + public String getWarrantydate() { return warrantydate; } - public void setWarrantydate(String warrantydate) - { + public void setWarrantydate(String warrantydate) { this.warrantydate = warrantydate; } - public String getAssetnum() - { + public String getAssetnum() { return assetnum; } - public void setAssetnum(String assetnum) - { + public void setAssetnum(String assetnum) { this.assetnum = assetnum; } - public String getSerialnum() - { + public String getSerialnum() { return serialnum; } - public void setSerialnum(String serialnum) - { + public void setSerialnum(String serialnum) { this.serialnum = serialnum; } - public String getLabels() - { + public String getLabels() { return labels; } - public void setLabels(String labels) - { + public void setLabels(String labels) { this.labels = labels; } - public Long getSupplierID() - { + public Long getSupplierID() { return supplierID; } - public void setSupplierID(Long supplierID) - { + public void setSupplierID(Long supplierID) { this.supplierID = supplierID; } - public String getDescription() - { + public String getDescription() { return description; } - public void setDescription(String description) - { + public void setDescription(String description) { this.description = description; } - public Long getAssetID() - { + public Long getAssetID() { return assetID; } - public void setAssetID(Long assetID) - { + public void setAssetID(Long assetID) { this.assetID = assetID; } - public String getAssetIDs() - { + public String getAssetIDs() { return assetIDs; } - public void setAssetIDs(String assetIDs) - { + public void setAssetIDs(String assetIDs) { this.assetIDs = assetIDs; } - public int getPageSize() - { + public int getPageSize() { return pageSize; } - public void setPageSize(int pageSize) - { + public void setPageSize(int pageSize) { this.pageSize = pageSize; } - public int getPageNo() - { + public int getPageNo() { return pageNo; } - public void setPageNo(int pageNo) - { + public void setPageNo(int pageNo) { this.pageNo = pageNo; } - public String getClientIp() - { + public String getClientIp() { return clientIp; } - public void setClientIp(String clientIp) - { + public void setClientIp(String clientIp) { this.clientIp = clientIp; } - public Integer getReportType() - { + public Integer getReportType() { return reportType; } - public void setReportType(Integer reportType) - { + public void setReportType(Integer reportType) { this.reportType = reportType; } } diff --git a/src/main/java/com/jsh/model/vo/asset/ReportShowModel.java b/src/main/java/com/jsh/model/vo/asset/ReportShowModel.java index ac77a242..2135e6db 100644 --- a/src/main/java/com/jsh/model/vo/asset/ReportShowModel.java +++ b/src/main/java/com/jsh/model/vo/asset/ReportShowModel.java @@ -4,31 +4,26 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.List; -@SuppressWarnings({"serial","rawtypes"}) -public class ReportShowModel implements Serializable -{ +@SuppressWarnings({"serial", "rawtypes"}) +public class ReportShowModel implements Serializable { //保存报表数据 - private List reportData = new ArrayList(); + private List reportData = new ArrayList(); //保存提示信息 private String msgTip = ""; - - public List getReportData() - { + + public List getReportData() { return reportData; } - - public void setReportData(List reportData) - { + + public void setReportData(List reportData) { this.reportData = reportData; } - - public String getMsgTip() - { + + public String getMsgTip() { return msgTip; } - - public void setMsgTip(String msgTip) - { + + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } } diff --git a/src/main/java/com/jsh/model/vo/basic/AccountModel.java b/src/main/java/com/jsh/model/vo/basic/AccountModel.java index 0f5e9802..d4244619 100644 --- a/src/main/java/com/jsh/model/vo/basic/AccountModel.java +++ b/src/main/java/com/jsh/model/vo/basic/AccountModel.java @@ -3,8 +3,7 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class AccountModel implements Serializable -{ +public class AccountModel implements Serializable { private AccountShowModel showModel = new AccountShowModel(); /**======开始接受页面参数=================**/ @@ -17,12 +16,12 @@ public class AccountModel implements Serializable * 编号 */ private String serialNo = ""; - + /** * 期初金额 */ private Double initialAmount; - + /** * 当前余额 */ @@ -63,56 +62,46 @@ public class AccountModel implements Serializable */ private String clientIp = ""; - public void setShowModel(AccountShowModel showModel) - { - this.showModel = showModel; - } - - public AccountShowModel getShowModel() - { + public AccountShowModel getShowModel() { return showModel; } - public void setName(String name) - { - this.name = name; + public void setShowModel(AccountShowModel showModel) { + this.showModel = showModel; } - public String getName() - { + public String getName() { return name; } - public void setSerialNo(String serialNo) - { - this.serialNo = serialNo; + public void setName(String name) { + this.name = name; } - public String getSerialNo() - { + public String getSerialNo() { return serialNo; } - public void setInitialAmount(Double initialAmount) - { - this.initialAmount = initialAmount; + public void setSerialNo(String serialNo) { + this.serialNo = serialNo; } - public Double getInitialAmount() - { + public Double getInitialAmount() { return initialAmount; } - public void setCurrentAmount(Double currentAmount) - { - this.currentAmount = currentAmount; + public void setInitialAmount(Double initialAmount) { + this.initialAmount = initialAmount; } - public Double getCurrentAmount() - { + public Double getCurrentAmount() { return currentAmount; } + public void setCurrentAmount(Double currentAmount) { + this.currentAmount = currentAmount; + } + public Boolean getIsDefault() { return isDefault; } @@ -121,63 +110,51 @@ public class AccountModel implements Serializable this.isDefault = isDefault; } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { + public String getRemark() { return remark; } - public void setAccountID(Long accountID) - { - this.accountID = accountID; + public void setRemark(String remark) { + this.remark = remark; } - public Long getAccountID() - { + public Long getAccountID() { return accountID; } - public void setAccountIDs(String accountIDs) - { - this.accountIDs = accountIDs; + public void setAccountID(Long accountID) { + this.accountID = accountID; } - public String getAccountIDs() - { + public String getAccountIDs() { return accountIDs; } - public void setPageSize(int pageSize) - { - this.pageSize = pageSize; + public void setAccountIDs(String accountIDs) { + this.accountIDs = accountIDs; } - public int getPageSize() - { + public int getPageSize() { return pageSize; } - public void setPageNo(int pageNo) - { - this.pageNo = pageNo; + public void setPageSize(int pageSize) { + this.pageSize = pageSize; } - public int getPageNo() - { + public int getPageNo() { return pageNo; } - public void setClientIp(String clientIp) - { - this.clientIp = clientIp; + public void setPageNo(int pageNo) { + this.pageNo = pageNo; } - public String getClientIp() - { + public String getClientIp() { return clientIp; } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } } diff --git a/src/main/java/com/jsh/model/vo/basic/AccountShowModel.java b/src/main/java/com/jsh/model/vo/basic/AccountShowModel.java index 96700bbd..ae5e8c93 100644 --- a/src/main/java/com/jsh/model/vo/basic/AccountShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/AccountShowModel.java @@ -6,8 +6,7 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class AccountShowModel implements Serializable -{ +public class AccountShowModel implements Serializable { /** * 提示信息 */ @@ -17,15 +16,13 @@ public class AccountShowModel implements Serializable * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } diff --git a/src/main/java/com/jsh/model/vo/basic/AppModel.java b/src/main/java/com/jsh/model/vo/basic/AppModel.java index c3439fc7..98e8d220 100644 --- a/src/main/java/com/jsh/model/vo/basic/AppModel.java +++ b/src/main/java/com/jsh/model/vo/basic/AppModel.java @@ -1,13 +1,10 @@ package com.jsh.model.vo.basic; -import org.springframework.web.multipart.MultipartFile; - import java.io.File; import java.io.Serializable; @SuppressWarnings("serial") -public class AppModel implements Serializable -{ +public class AppModel implements Serializable { private AppShowModel showModel = new AppShowModel(); /**======开始接受页面参数=================**/ @@ -20,54 +17,54 @@ public class AppModel implements Serializable * 名称 */ private String Name = ""; - + /** * 类型 */ private String Type = ""; - + /** * 图标 */ private String Icon = ""; - private File fileInfo; - private String fileInfoName; //图片名称 + private File fileInfo; + private String fileInfoName; //图片名称 /** * 链接 */ private String URL = ""; - + /** * 宽度 */ private String Width = ""; - + /** * 高度 */ private String Height = ""; - + /** * 拉伸 */ private Boolean ReSize = false; - + /** * 最大化 */ private Boolean OpenMax = false; - + /** * Flash */ private Boolean Flash = false; - + /** * 种类 */ private String ZL = ""; - + /** * 排序号 */ @@ -77,238 +74,238 @@ public class AppModel implements Serializable * 备注 */ private String Remark = ""; - + /** * 启用 */ private Boolean Enabled = false; - + /** * 分类ID */ private Long appID = 0l; - + /** * 分类IDs 批量操作使用 */ private String appIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - + /** * UBType,UserBusiness类型 */ private String UBType = ""; - + /** * UBKeyId,UserBusiness关键id */ private String UBKeyId = ""; - - public AppShowModel getShowModel() { - return showModel; - } - public void setShowModel(AppShowModel showModel) { - this.showModel = showModel; - } + public AppShowModel getShowModel() { + return showModel; + } - public String getNumber() { - return Number; - } + public void setShowModel(AppShowModel showModel) { + this.showModel = showModel; + } - public void setNumber(String number) { - Number = number; - } + public String getNumber() { + return Number; + } - public String getName() { - return Name; - } + public void setNumber(String number) { + Number = number; + } - public void setName(String name) { - Name = name; - } + public String getName() { + return Name; + } - public File getFileInfo() { - return fileInfo; - } + public void setName(String name) { + Name = name; + } - public void setFileInfo(File fileInfo) { - this.fileInfo = fileInfo; - } + public File getFileInfo() { + return fileInfo; + } - public String getFileInfoName() { - return fileInfoName; - } + public void setFileInfo(File fileInfo) { + this.fileInfo = fileInfo; + } - public void setFileInfoName(String fileInfoName) { - this.fileInfoName = fileInfoName; - } + public String getFileInfoName() { + return fileInfoName; + } - public String getType() { - return Type; - } + public void setFileInfoName(String fileInfoName) { + this.fileInfoName = fileInfoName; + } - public void setType(String type) { - Type = type; - } + public String getType() { + return Type; + } - public String getIcon() { - return Icon; - } + public void setType(String type) { + Type = type; + } - public void setIcon(String icon) { - Icon = icon; - } + public String getIcon() { + return Icon; + } - public String getURL() { - return URL; - } + public void setIcon(String icon) { + Icon = icon; + } - public void setURL(String uRL) { - URL = uRL; - } + public String getURL() { + return URL; + } - public String getWidth() { - return Width; - } + public void setURL(String uRL) { + URL = uRL; + } - public void setWidth(String width) { - Width = width; - } + public String getWidth() { + return Width; + } - public String getHeight() { - return Height; - } + public void setWidth(String width) { + Width = width; + } - public void setHeight(String height) { - Height = height; - } + public String getHeight() { + return Height; + } - public Boolean getReSize() { - return ReSize; - } + public void setHeight(String height) { + Height = height; + } - public void setReSize(Boolean reSize) { - ReSize = reSize; - } + public Boolean getReSize() { + return ReSize; + } - public Boolean getOpenMax() { - return OpenMax; - } + public void setReSize(Boolean reSize) { + ReSize = reSize; + } - public void setOpenMax(Boolean openMax) { - OpenMax = openMax; - } + public Boolean getOpenMax() { + return OpenMax; + } - public Boolean getFlash() { - return Flash; - } + public void setOpenMax(Boolean openMax) { + OpenMax = openMax; + } - public void setFlash(Boolean flash) { - Flash = flash; - } + public Boolean getFlash() { + return Flash; + } - public String getZL() { - return ZL; - } + public void setFlash(Boolean flash) { + Flash = flash; + } - public void setZL(String zL) { - ZL = zL; - } + public String getZL() { + return ZL; + } - public String getSort() { - return Sort; - } + public void setZL(String zL) { + ZL = zL; + } - public void setSort(String sort) { - Sort = sort; - } + public String getSort() { + return Sort; + } - public String getRemark() { - return Remark; - } + public void setSort(String sort) { + Sort = sort; + } - public void setRemark(String remark) { - Remark = remark; - } + public String getRemark() { + return Remark; + } - public Boolean getEnabled() { - return Enabled; - } + public void setRemark(String remark) { + Remark = remark; + } - public void setEnabled(Boolean enabled) { - Enabled = enabled; - } + public Boolean getEnabled() { + return Enabled; + } - public Long getAppID() { - return appID; - } + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } - public void setAppID(Long appID) { - this.appID = appID; - } + public Long getAppID() { + return appID; + } - public String getAppIDs() { - return appIDs; - } + public void setAppID(Long appID) { + this.appID = appID; + } - public void setAppIDs(String appIDs) { - this.appIDs = appIDs; - } + public String getAppIDs() { + return appIDs; + } - public int getPageSize() { - return pageSize; - } + public void setAppIDs(String appIDs) { + this.appIDs = appIDs; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public int getPageSize() { + return pageSize; + } - public int getPageNo() { - return pageNo; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public int getPageNo() { + return pageNo; + } - public String getClientIp() { - return clientIp; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public String getClientIp() { + return clientIp; + } - public String getUBType() { - return UBType; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public void setUBType(String uBType) { - UBType = uBType; - } + public String getUBType() { + return UBType; + } - public String getUBKeyId() { - return UBKeyId; - } + public void setUBType(String uBType) { + UBType = uBType; + } - public void setUBKeyId(String uBKeyId) { - UBKeyId = uBKeyId; - } + public String getUBKeyId() { + return UBKeyId; + } + + public void setUBKeyId(String uBKeyId) { + UBKeyId = uBKeyId; + } } diff --git a/src/main/java/com/jsh/model/vo/basic/AppShowModel.java b/src/main/java/com/jsh/model/vo/basic/AppShowModel.java index ebaf0c18..291859d6 100644 --- a/src/main/java/com/jsh/model/vo/basic/AppShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/AppShowModel.java @@ -3,20 +3,17 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class AppShowModel implements Serializable -{ +public class AppShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } } diff --git a/src/main/java/com/jsh/model/vo/basic/AssetNameModel.java b/src/main/java/com/jsh/model/vo/basic/AssetNameModel.java index a1d09481..b3b93834 100644 --- a/src/main/java/com/jsh/model/vo/basic/AssetNameModel.java +++ b/src/main/java/com/jsh/model/vo/basic/AssetNameModel.java @@ -3,8 +3,7 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class AssetNameModel implements Serializable -{ +public class AssetNameModel implements Serializable { private AssetNameShowModel showModel = new AssetNameShowModel(); /**======开始接受页面参数=================**/ /** @@ -16,139 +15,119 @@ public class AssetNameModel implements Serializable * 是否易耗品 */ private Short consumable; - + /** * 描述信息 */ private String description = ""; - + /** * 分类ID */ private Long categoryID; - + /** * ID */ private Long assetNameID = 0l; - + /** * IDs 批量操作使用 */ private String assetNameIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - public AssetNameShowModel getShowModel() - { + public AssetNameShowModel getShowModel() { return showModel; } - public void setShowModel(AssetNameShowModel showModel) - { + public void setShowModel(AssetNameShowModel showModel) { this.showModel = showModel; } - public String getAssetName() - { + public String getAssetName() { return assetName; } - public void setAssetName(String assetName) - { + public void setAssetName(String assetName) { this.assetName = assetName; } - public String getDescription() - { + public String getDescription() { return description; } - public void setDescription(String description) - { + public void setDescription(String description) { this.description = description; } - public Long getAssetNameID() - { + public Long getAssetNameID() { return assetNameID; } - public void setAssetNameID(Long assetNameID) - { + public void setAssetNameID(Long assetNameID) { this.assetNameID = assetNameID; } - public String getAssetNameIDs() - { + public String getAssetNameIDs() { return assetNameIDs; } - public void setAssetNameIDs(String assetNameIDs) - { + public void setAssetNameIDs(String assetNameIDs) { this.assetNameIDs = assetNameIDs; } - public int getPageSize() - { + public int getPageSize() { return pageSize; } - public void setPageSize(int pageSize) - { + public void setPageSize(int pageSize) { this.pageSize = pageSize; } - public int getPageNo() - { + public int getPageNo() { return pageNo; } - public void setPageNo(int pageNo) - { + public void setPageNo(int pageNo) { this.pageNo = pageNo; } - public String getClientIp() - { + public String getClientIp() { return clientIp; } - public void setClientIp(String clientIp) - { + public void setClientIp(String clientIp) { this.clientIp = clientIp; } - public Short getConsumable() - { + public Short getConsumable() { return consumable; } - public void setConsumable(Short consumable) - { + public void setConsumable(Short consumable) { this.consumable = consumable; } - public Long getCategoryID() - { + public Long getCategoryID() { return categoryID; } - public void setCategoryID(Long categoryID) - { + public void setCategoryID(Long categoryID) { this.categoryID = categoryID; } } diff --git a/src/main/java/com/jsh/model/vo/basic/AssetNameShowModel.java b/src/main/java/com/jsh/model/vo/basic/AssetNameShowModel.java index dd28afad..80ef3aa1 100644 --- a/src/main/java/com/jsh/model/vo/basic/AssetNameShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/AssetNameShowModel.java @@ -3,20 +3,17 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class AssetNameShowModel implements Serializable -{ +public class AssetNameShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } } diff --git a/src/main/java/com/jsh/model/vo/basic/CategoryModel.java b/src/main/java/com/jsh/model/vo/basic/CategoryModel.java index 1ec5ca99..d4078a50 100644 --- a/src/main/java/com/jsh/model/vo/basic/CategoryModel.java +++ b/src/main/java/com/jsh/model/vo/basic/CategoryModel.java @@ -3,8 +3,7 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class CategoryModel implements Serializable -{ +public class CategoryModel implements Serializable { private CategoryShowModel showModel = new CategoryShowModel(); /**======开始接受页面参数=================**/ @@ -17,109 +16,93 @@ public class CategoryModel implements Serializable * 描述信息 */ private String description = ""; - + /** * 分类ID */ private Long categoryID = 0l; - + /** * 分类IDs 批量操作使用 */ private String categoryIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - public CategoryShowModel getShowModel() - { + public CategoryShowModel getShowModel() { return showModel; } - public void setShowModel(CategoryShowModel showModel) - { + public void setShowModel(CategoryShowModel showModel) { this.showModel = showModel; } - public String getCategoryName() - { + public String getCategoryName() { return categoryName; } - public void setCategoryName(String categoryName) - { + public void setCategoryName(String categoryName) { this.categoryName = categoryName; } - public String getDescription() - { + public String getDescription() { return description; } - public void setDescription(String description) - { + public void setDescription(String description) { this.description = description; } - public Long getCategoryID() - { + public Long getCategoryID() { return categoryID; } - public void setCategoryID(Long categoryID) - { + public void setCategoryID(Long categoryID) { this.categoryID = categoryID; } - public String getCategoryIDs() - { + public String getCategoryIDs() { return categoryIDs; } - public void setCategoryIDs(String categoryIDs) - { + public void setCategoryIDs(String categoryIDs) { this.categoryIDs = categoryIDs; } - public int getPageSize() - { + public int getPageSize() { return pageSize; } - public void setPageSize(int pageSize) - { + public void setPageSize(int pageSize) { this.pageSize = pageSize; } - public int getPageNo() - { + public int getPageNo() { return pageNo; } - public void setPageNo(int pageNo) - { + public void setPageNo(int pageNo) { this.pageNo = pageNo; } - public String getClientIp() - { + public String getClientIp() { return clientIp; } - public void setClientIp(String clientIp) - { + public void setClientIp(String clientIp) { this.clientIp = clientIp; } } diff --git a/src/main/java/com/jsh/model/vo/basic/CategoryShowModel.java b/src/main/java/com/jsh/model/vo/basic/CategoryShowModel.java index f1e9d73b..54264c5c 100644 --- a/src/main/java/com/jsh/model/vo/basic/CategoryShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/CategoryShowModel.java @@ -3,20 +3,17 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class CategoryShowModel implements Serializable -{ +public class CategoryShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } } diff --git a/src/main/java/com/jsh/model/vo/basic/DepotModel.java b/src/main/java/com/jsh/model/vo/basic/DepotModel.java index d341ddd0..6b752119 100644 --- a/src/main/java/com/jsh/model/vo/basic/DepotModel.java +++ b/src/main/java/com/jsh/model/vo/basic/DepotModel.java @@ -3,189 +3,188 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class DepotModel implements Serializable -{ - private DepotShowModel showModel = new DepotShowModel(); +public class DepotModel implements Serializable { + private DepotShowModel showModel = new DepotShowModel(); - /**======开始接受页面参数=================**/ - /** - * 仓库名称 - */ - private String name = ""; + /**======开始接受页面参数=================**/ + /** + * 仓库名称 + */ + private String name = ""; - private String address = ""; //仓库地址 - private Double warehousing; //仓储费 - private Double truckage; //搬运费 + private String address = ""; //仓库地址 + private Double warehousing; //仓储费 + private Double truckage; //搬运费 - /** - * 排序 - */ - private String sort = ""; + /** + * 排序 + */ + private String sort = ""; - /** - * 类型 - */ - private Integer type = 0; + /** + * 类型 + */ + private Integer type = 0; - /** - * 描述 - */ - private String remark = ""; + /** + * 描述 + */ + private String remark = ""; - /** - * 分类ID - */ - private Long depotID = 0l; + /** + * 分类ID + */ + private Long depotID = 0l; - /** - * 分类IDs 批量操作使用 - */ - private String depotIDs = ""; + /** + * 分类IDs 批量操作使用 + */ + private String depotIDs = ""; - /** - * 每页显示的个数 - */ - private int pageSize = 10; + /** + * 每页显示的个数 + */ + private int pageSize = 10; - /** - * 当前页码 - */ - private int pageNo = 1; + /** + * 当前页码 + */ + private int pageNo = 1; - /** - * 用户IP,用户记录操作日志 - */ - private String clientIp = ""; + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; - /** - * UBType,UserBusiness类型 - */ - private String UBType = ""; + /** + * UBType,UserBusiness类型 + */ + private String UBType = ""; - /** - * UBKeyId,UserBusiness关键id - */ - private String UBKeyId = ""; + /** + * UBKeyId,UserBusiness关键id + */ + private String UBKeyId = ""; - public DepotShowModel getShowModel() { - return showModel; - } + public DepotShowModel getShowModel() { + return showModel; + } - public void setShowModel(DepotShowModel showModel) { - this.showModel = showModel; - } + public void setShowModel(DepotShowModel showModel) { + this.showModel = showModel; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getAddress() { - return address; - } + public String getAddress() { + return address; + } - public void setAddress(String address) { - this.address = address; - } + public void setAddress(String address) { + this.address = address; + } - public Double getWarehousing() { - return warehousing; - } + public Double getWarehousing() { + return warehousing; + } - public void setWarehousing(Double warehousing) { - this.warehousing = warehousing; - } + public void setWarehousing(Double warehousing) { + this.warehousing = warehousing; + } - public Double getTruckage() { - return truckage; - } + public Double getTruckage() { + return truckage; + } - public void setTruckage(Double truckage) { - this.truckage = truckage; - } + public void setTruckage(Double truckage) { + this.truckage = truckage; + } - public Integer getType() { - return type; - } + public Integer getType() { + return type; + } - public void setType(Integer type) { - this.type = type; - } + public void setType(Integer type) { + this.type = type; + } - public String getSort() { - return sort; - } + public String getSort() { + return sort; + } - public void setSort(String sort) { - this.sort = sort; - } + public void setSort(String sort) { + this.sort = sort; + } - public String getRemark() { - return remark; - } + public String getRemark() { + return remark; + } - public void setRemark(String remark) { - this.remark = remark; - } + public void setRemark(String remark) { + this.remark = remark; + } - public Long getDepotID() { - return depotID; - } + public Long getDepotID() { + return depotID; + } - public void setDepotID(Long depotID) { - this.depotID = depotID; - } + public void setDepotID(Long depotID) { + this.depotID = depotID; + } - public String getDepotIDs() { - return depotIDs; - } + public String getDepotIDs() { + return depotIDs; + } - public void setDepotIDs(String depotIDs) { - this.depotIDs = depotIDs; - } + public void setDepotIDs(String depotIDs) { + this.depotIDs = depotIDs; + } - public int getPageSize() { - return pageSize; - } + public int getPageSize() { + return pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public int getPageNo() { - return pageNo; - } + public int getPageNo() { + return pageNo; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public String getClientIp() { - return clientIp; - } + public String getClientIp() { + return clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public String getUBType() { - return UBType; - } + public String getUBType() { + return UBType; + } - public void setUBType(String uBType) { - UBType = uBType; - } + public void setUBType(String uBType) { + UBType = uBType; + } - public String getUBKeyId() { - return UBKeyId; - } + public String getUBKeyId() { + return UBKeyId; + } - public void setUBKeyId(String uBKeyId) { - UBKeyId = uBKeyId; - } + public void setUBKeyId(String uBKeyId) { + UBKeyId = uBKeyId; + } } diff --git a/src/main/java/com/jsh/model/vo/basic/DepotShowModel.java b/src/main/java/com/jsh/model/vo/basic/DepotShowModel.java index a56a4206..7535dcbf 100644 --- a/src/main/java/com/jsh/model/vo/basic/DepotShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/DepotShowModel.java @@ -6,38 +6,35 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class DepotShowModel implements Serializable -{ +public class DepotShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - + /** * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } - @SuppressWarnings("rawtypes") - public Map getMap() { - return map; - } + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + - @SuppressWarnings("rawtypes") - public void setMap(Map map) { - this.map = map; - } - - } diff --git a/src/main/java/com/jsh/model/vo/basic/FunctionsModel.java b/src/main/java/com/jsh/model/vo/basic/FunctionsModel.java index 865aa408..826b044f 100644 --- a/src/main/java/com/jsh/model/vo/basic/FunctionsModel.java +++ b/src/main/java/com/jsh/model/vo/basic/FunctionsModel.java @@ -3,8 +3,7 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class FunctionsModel implements Serializable -{ +public class FunctionsModel implements Serializable { private FunctionsShowModel showModel = new FunctionsShowModel(); /**======开始接受页面参数=================**/ @@ -40,190 +39,190 @@ public class FunctionsModel implements Serializable * 类型 */ private String Type = ""; - /** - * 功能按钮 - */ - private String PushBtn = ""; + /** + * 功能按钮 + */ + private String PushBtn = ""; /** * 拥有的功能列表 */ - private String hasFunctions= ""; + private String hasFunctions = ""; /** * 分类ID */ private Long functionsID = 0l; - + /** * 分类IDs 批量操作使用 */ private String functionsIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - + /** * UBType,UserBusiness类型 */ private String UBType = ""; - + /** * UBKeyId,UserBusiness关键id */ private String UBKeyId = ""; - public FunctionsShowModel getShowModel() { - return showModel; - } + public FunctionsShowModel getShowModel() { + return showModel; + } - public void setShowModel(FunctionsShowModel showModel) { - this.showModel = showModel; - } + public void setShowModel(FunctionsShowModel showModel) { + this.showModel = showModel; + } - public String getNumber() { - return Number; - } + public String getNumber() { + return Number; + } - public void setNumber(String number) { - Number = number; - } + public void setNumber(String number) { + Number = number; + } - public String getName() { - return Name; - } + public String getName() { + return Name; + } - public void setName(String name) { - Name = name; - } + public void setName(String name) { + Name = name; + } - public String getPNumber() { - return PNumber; - } + public String getPNumber() { + return PNumber; + } - public void setPNumber(String pNumber) { - PNumber = pNumber; - } + public void setPNumber(String pNumber) { + PNumber = pNumber; + } - public String getURL() { - return URL; - } + public String getURL() { + return URL; + } - public void setURL(String uRL) { - URL = uRL; - } + public void setURL(String uRL) { + URL = uRL; + } - public Boolean getState() { - return State; - } + public Boolean getState() { + return State; + } - public void setState(Boolean state) { - State = state; - } + public void setState(Boolean state) { + State = state; + } - public String getSort() { - return Sort; - } + public String getSort() { + return Sort; + } - public void setSort(String sort) { - Sort = sort; - } + public void setSort(String sort) { + Sort = sort; + } - public Boolean getEnabled() { - return Enabled; - } + public Boolean getEnabled() { + return Enabled; + } - public void setEnabled(Boolean enabled) { - Enabled = enabled; - } + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } - public String getType() { - return Type; - } + public String getType() { + return Type; + } - public void setType(String type) { - Type = type; - } + public void setType(String type) { + Type = type; + } - public Long getFunctionsID() { - return functionsID; - } + public Long getFunctionsID() { + return functionsID; + } - public void setFunctionsID(Long functionsID) { - this.functionsID = functionsID; - } + public void setFunctionsID(Long functionsID) { + this.functionsID = functionsID; + } - public String getFunctionsIDs() { - return functionsIDs; - } + public String getFunctionsIDs() { + return functionsIDs; + } - public void setFunctionsIDs(String functionsIDs) { - this.functionsIDs = functionsIDs; - } + public void setFunctionsIDs(String functionsIDs) { + this.functionsIDs = functionsIDs; + } - public int getPageSize() { - return pageSize; - } + public int getPageSize() { + return pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public int getPageNo() { - return pageNo; - } + public int getPageNo() { + return pageNo; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public String getClientIp() { - return clientIp; - } + public String getClientIp() { + return clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public String getUBType() { - return UBType; - } + public String getUBType() { + return UBType; + } - public void setUBType(String uBType) { - UBType = uBType; - } + public void setUBType(String uBType) { + UBType = uBType; + } - public String getUBKeyId() { - return UBKeyId; - } + public String getUBKeyId() { + return UBKeyId; + } - public void setUBKeyId(String uBKeyId) { - UBKeyId = uBKeyId; - } + public void setUBKeyId(String uBKeyId) { + UBKeyId = uBKeyId; + } - public String getHasFunctions() { - return hasFunctions; - } + public String getHasFunctions() { + return hasFunctions; + } - public void setHasFunctions(String hasFunctions) { - this.hasFunctions = hasFunctions; - } + public void setHasFunctions(String hasFunctions) { + this.hasFunctions = hasFunctions; + } - public String getPushBtn() { - return PushBtn; - } + public String getPushBtn() { + return PushBtn; + } - public void setPushBtn(String pushBtn) { - PushBtn = pushBtn; - } + public void setPushBtn(String pushBtn) { + PushBtn = pushBtn; + } } diff --git a/src/main/java/com/jsh/model/vo/basic/FunctionsShowModel.java b/src/main/java/com/jsh/model/vo/basic/FunctionsShowModel.java index 778b445c..1da40c7c 100644 --- a/src/main/java/com/jsh/model/vo/basic/FunctionsShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/FunctionsShowModel.java @@ -3,20 +3,17 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class FunctionsShowModel implements Serializable -{ +public class FunctionsShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } } diff --git a/src/main/java/com/jsh/model/vo/basic/InOutItemModel.java b/src/main/java/com/jsh/model/vo/basic/InOutItemModel.java index 579c5084..e859fbf4 100644 --- a/src/main/java/com/jsh/model/vo/basic/InOutItemModel.java +++ b/src/main/java/com/jsh/model/vo/basic/InOutItemModel.java @@ -3,8 +3,7 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class InOutItemModel implements Serializable -{ +public class InOutItemModel implements Serializable { private InOutItemShowModel showModel = new InOutItemShowModel(); /**======开始接受页面参数=================**/ @@ -48,93 +47,75 @@ public class InOutItemModel implements Serializable */ private String clientIp = ""; - public void setShowModel(InOutItemShowModel showModel) - { - this.showModel = showModel; - } - - public InOutItemShowModel getShowModel() - { + public InOutItemShowModel getShowModel() { return showModel; } - public void setName(String name) - { - this.name = name; + public void setShowModel(InOutItemShowModel showModel) { + this.showModel = showModel; } - public String getName() - { + public String getName() { return name; } - public void setType(String type) - { - this.type = type; + public void setName(String name) { + this.name = name; } - public String getType() - { + public String getType() { return type; } - public void setRemark(String remark) - { - this.remark = remark; + public void setType(String type) { + this.type = type; } - public String getRemark() - { + public String getRemark() { return remark; } - public void setInOutItemID(Long inOutItemID) - { - this.inOutItemID = inOutItemID; + public void setRemark(String remark) { + this.remark = remark; } - public Long getInOutItemID() - { + public Long getInOutItemID() { return inOutItemID; } - public void setInOutItemIDs(String inOutItemIDs) - { - this.inOutItemIDs = inOutItemIDs; + public void setInOutItemID(Long inOutItemID) { + this.inOutItemID = inOutItemID; } - public String getInOutItemIDs() - { + public String getInOutItemIDs() { return inOutItemIDs; } - public void setPageSize(int pageSize) - { - this.pageSize = pageSize; + public void setInOutItemIDs(String inOutItemIDs) { + this.inOutItemIDs = inOutItemIDs; } - public int getPageSize() - { + public int getPageSize() { return pageSize; } - public void setPageNo(int pageNo) - { - this.pageNo = pageNo; + public void setPageSize(int pageSize) { + this.pageSize = pageSize; } - public int getPageNo() - { + public int getPageNo() { return pageNo; } - public void setClientIp(String clientIp) - { - this.clientIp = clientIp; + public void setPageNo(int pageNo) { + this.pageNo = pageNo; } - public String getClientIp() - { + public String getClientIp() { return clientIp; } - } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } +} diff --git a/src/main/java/com/jsh/model/vo/basic/InOutItemShowModel.java b/src/main/java/com/jsh/model/vo/basic/InOutItemShowModel.java index f3967f4e..0708ff8b 100644 --- a/src/main/java/com/jsh/model/vo/basic/InOutItemShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/InOutItemShowModel.java @@ -6,8 +6,7 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class InOutItemShowModel implements Serializable -{ +public class InOutItemShowModel implements Serializable { /** * 提示信息 */ @@ -17,15 +16,13 @@ public class InOutItemShowModel implements Serializable * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } diff --git a/src/main/java/com/jsh/model/vo/basic/LogModel.java b/src/main/java/com/jsh/model/vo/basic/LogModel.java index bdd5f2e4..8ff786bc 100644 --- a/src/main/java/com/jsh/model/vo/basic/LogModel.java +++ b/src/main/java/com/jsh/model/vo/basic/LogModel.java @@ -3,198 +3,174 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class LogModel implements Serializable -{ - private LogShowModel showModel = new LogShowModel(); - /**======开始接受页面参数=================**/ - /** - * 用户ID - */ - private Long usernameID ; - - /** - * 操作 - */ - private String operation; - - /** - * 开始时间 - */ - private String beginTime; - - /** - * 结束时间 - */ - private String endTime; - - /** - * 是否成功 0==成功 1==失败 - */ - private Short status; - - /** - * 操作具体内容 - */ - private String contentdetails; - - /** - * 描述信息 - */ - private String remark = ""; - - /** - * 日志ID - */ - private Long logID = 0l; - - /** - * 日志IDs 批量操作使用 - */ - private String logIDs = ""; - - /** - * 每页显示的个数 - */ - private int pageSize = 10; - - /** - * 当前页码 - */ - private int pageNo = 1; - - /** +public class LogModel implements Serializable { + private LogShowModel showModel = new LogShowModel(); + /**======开始接受页面参数=================**/ + /** + * 用户ID + */ + private Long usernameID; + + /** + * 操作 + */ + private String operation; + + /** + * 开始时间 + */ + private String beginTime; + + /** + * 结束时间 + */ + private String endTime; + + /** + * 是否成功 0==成功 1==失败 + */ + private Short status; + + /** + * 操作具体内容 + */ + private String contentdetails; + + /** + * 描述信息 + */ + private String remark = ""; + + /** + * 日志ID + */ + private Long logID = 0l; + + /** + * 日志IDs 批量操作使用 + */ + private String logIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - public LogShowModel getShowModel() { - return showModel; - } - public void setShowModel(LogShowModel showModel) { - this.showModel = showModel; - } + public LogShowModel getShowModel() { + return showModel; + } - public Long getLogID() - { - return logID; - } + public void setShowModel(LogShowModel showModel) { + this.showModel = showModel; + } - public void setLogID(Long logID) - { - this.logID = logID; - } + public Long getLogID() { + return logID; + } - public String getLogIDs() - { - return logIDs; - } + public void setLogID(Long logID) { + this.logID = logID; + } - public void setLogIDs(String logIDs) - { - this.logIDs = logIDs; - } + public String getLogIDs() { + return logIDs; + } - public int getPageSize() - { - return pageSize; - } + public void setLogIDs(String logIDs) { + this.logIDs = logIDs; + } - public void setPageSize(int pageSize) - { - this.pageSize = pageSize; - } + public int getPageSize() { + return pageSize; + } - public int getPageNo() - { - return pageNo; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public void setPageNo(int pageNo) - { - this.pageNo = pageNo; - } + public int getPageNo() { + return pageNo; + } - public String getClientIp() - { - return clientIp; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public void setClientIp(String clientIp) - { - this.clientIp = clientIp; - } + public String getClientIp() { + return clientIp; + } - public Long getUsernameID() - { - return usernameID; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public void setUsernameID(Long usernameID) - { - this.usernameID = usernameID; - } + public Long getUsernameID() { + return usernameID; + } - public String getOperation() - { - return operation; - } + public void setUsernameID(Long usernameID) { + this.usernameID = usernameID; + } - public void setOperation(String operation) - { - this.operation = operation; - } + public String getOperation() { + return operation; + } - public String getBeginTime() - { - if(null == beginTime || beginTime.length() == 0) - return beginTime; - return beginTime + " 00:00:00"; - } + public void setOperation(String operation) { + this.operation = operation; + } - public void setBeginTime(String beginTime) - { - this.beginTime = beginTime; - } + public String getBeginTime() { + if (null == beginTime || beginTime.length() == 0) + return beginTime; + return beginTime + " 00:00:00"; + } - public String getEndTime() - { - if(null == endTime || endTime.length() ==0) - return endTime; - return endTime + " 23:59:59"; - } + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } - public void setEndTime(String endTime) - { - this.endTime = endTime; - } + public String getEndTime() { + if (null == endTime || endTime.length() == 0) + return endTime; + return endTime + " 23:59:59"; + } - public Short getStatus() - { - return status; - } + public void setEndTime(String endTime) { + this.endTime = endTime; + } - public void setStatus(Short status) - { - this.status = status; - } + public Short getStatus() { + return status; + } - public String getContentdetails() - { - return contentdetails; - } + public void setStatus(Short status) { + this.status = status; + } - public void setContentdetails(String contentdetails) - { - this.contentdetails = contentdetails; - } + public String getContentdetails() { + return contentdetails; + } - public String getRemark() - { - return remark; - } + public void setContentdetails(String contentdetails) { + this.contentdetails = contentdetails; + } - public void setRemark(String remark) - { - this.remark = remark; - } + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } } diff --git a/src/main/java/com/jsh/model/vo/basic/LogShowModel.java b/src/main/java/com/jsh/model/vo/basic/LogShowModel.java index 1dbb43b3..7a88a1cd 100644 --- a/src/main/java/com/jsh/model/vo/basic/LogShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/LogShowModel.java @@ -6,8 +6,7 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class LogShowModel implements Serializable -{ +public class LogShowModel implements Serializable { /** * 提示信息 */ @@ -17,27 +16,23 @@ public class LogShowModel implements Serializable * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } @SuppressWarnings("rawtypes") - public Map getMap() - { + public Map getMap() { return map; } @SuppressWarnings("rawtypes") - public void setMap(Map map) - { + public void setMap(Map map) { this.map = map; } } diff --git a/src/main/java/com/jsh/model/vo/basic/RoleModel.java b/src/main/java/com/jsh/model/vo/basic/RoleModel.java index 481fd4d0..8fdad4a0 100644 --- a/src/main/java/com/jsh/model/vo/basic/RoleModel.java +++ b/src/main/java/com/jsh/model/vo/basic/RoleModel.java @@ -3,8 +3,7 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class RoleModel implements Serializable -{ +public class RoleModel implements Serializable { private RoleShowModel showModel = new RoleShowModel(); /**======开始接受页面参数=================**/ @@ -12,112 +11,112 @@ public class RoleModel implements Serializable * 角色名称 */ private String Name = ""; - + /** * 分类ID */ private Long roleID = 0l; - + /** * 分类IDs 批量操作使用 */ private String roleIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - + /** * UBType,UserBusiness类型 */ private String UBType = ""; - + /** * UBKeyId,UserBusiness关键id */ private String UBKeyId = ""; - public RoleShowModel getShowModel() { - return showModel; - } + public RoleShowModel getShowModel() { + return showModel; + } - public void setShowModel(RoleShowModel showModel) { - this.showModel = showModel; - } + public void setShowModel(RoleShowModel showModel) { + this.showModel = showModel; + } - public String getName() { - return Name; - } + public String getName() { + return Name; + } - public void setName(String name) { - Name = name; - } + public void setName(String name) { + Name = name; + } - public Long getRoleID() { - return roleID; - } + public Long getRoleID() { + return roleID; + } - public void setRoleID(Long roleID) { - this.roleID = roleID; - } + public void setRoleID(Long roleID) { + this.roleID = roleID; + } - public String getRoleIDs() { - return roleIDs; - } + public String getRoleIDs() { + return roleIDs; + } - public void setRoleIDs(String roleIDs) { - this.roleIDs = roleIDs; - } + public void setRoleIDs(String roleIDs) { + this.roleIDs = roleIDs; + } - public int getPageSize() { - return pageSize; - } + public int getPageSize() { + return pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public int getPageNo() { - return pageNo; - } + public int getPageNo() { + return pageNo; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public String getClientIp() { - return clientIp; - } + public String getClientIp() { + return clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public String getUBType() { - return UBType; - } + public String getUBType() { + return UBType; + } - public void setUBType(String uBType) { - UBType = uBType; - } + public void setUBType(String uBType) { + UBType = uBType; + } - public String getUBKeyId() { - return UBKeyId; - } + public String getUBKeyId() { + return UBKeyId; + } + + public void setUBKeyId(String uBKeyId) { + UBKeyId = uBKeyId; + } - public void setUBKeyId(String uBKeyId) { - UBKeyId = uBKeyId; - } - } diff --git a/src/main/java/com/jsh/model/vo/basic/RoleShowModel.java b/src/main/java/com/jsh/model/vo/basic/RoleShowModel.java index f61b6c41..924912a9 100644 --- a/src/main/java/com/jsh/model/vo/basic/RoleShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/RoleShowModel.java @@ -3,20 +3,17 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class RoleShowModel implements Serializable -{ +public class RoleShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } } diff --git a/src/main/java/com/jsh/model/vo/basic/SupplierModel.java b/src/main/java/com/jsh/model/vo/basic/SupplierModel.java index 4884f561..f58979f7 100644 --- a/src/main/java/com/jsh/model/vo/basic/SupplierModel.java +++ b/src/main/java/com/jsh/model/vo/basic/SupplierModel.java @@ -5,369 +5,360 @@ import java.io.InputStream; import java.io.Serializable; @SuppressWarnings("serial") -public class SupplierModel implements Serializable -{ - private SupplierShowModel showModel = new SupplierShowModel(); - - /**======开始接受页面参数=================**/ - /** - * 名称 - */ - private String supplier = ""; +public class SupplierModel implements Serializable { + private SupplierShowModel showModel = new SupplierShowModel(); - /** - * 类型 - */ - private String type = ""; - - /** - * 联系人 - */ - private String contacts = ""; - - /** - * 联系电话 - */ - private String phonenum = ""; - - /** - * 电子邮箱 - */ - private String email = ""; + /**======开始接受页面参数=================**/ + /** + * 名称 + */ + private String supplier = ""; - /** + /** + * 类型 + */ + private String type = ""; + + /** + * 联系人 + */ + private String contacts = ""; + + /** + * 联系电话 + */ + private String phonenum = ""; + + /** + * 电子邮箱 + */ + private String email = ""; + + /** * 预付款 - */ + */ private Double AdvanceIn; - /** - * 期初应收 - */ - private Double BeginNeedGet; - + /** + * 期初应收 + */ + private Double BeginNeedGet; + /** * 期初应付 - */ + */ private Double BeginNeedPay; - + /** * 累计应收 - */ + */ private Double AllNeedGet; - + /** * 累计应付 - */ + */ private Double AllNeedPay; - - /** - * 描述信息 - */ - private String description = ""; - private String fax = ""; - private String telephone = ""; - private String address = ""; - private String taxNum = ""; - private String bankName = ""; - private String accountNumber = ""; - private Double taxRate; + /** + * 描述信息 + */ + private String description = ""; - private String UBType = ""; //UBType,UserBusiness类型 + private String fax = ""; + private String telephone = ""; + private String address = ""; + private String taxNum = ""; + private String bankName = ""; + private String accountNumber = ""; + private Double taxRate; - private String UBKeyId = ""; //UBKeyId,UserBusiness关键id + private String UBType = ""; //UBType,UserBusiness类型 + + private String UBKeyId = ""; //UBKeyId,UserBusiness关键id + + /** + * 导入excel文件 + */ + private File supplierFile; - /** - * 导入excel文件 - */ - private File supplierFile; - /** * 启用 */ private Boolean enabled = false; - - /** - * 供应商ID - */ - private Long supplierID = 0l; - - /** - * 供应商IDs 批量操作使用 - */ - private String supplierIDs = ""; - - /** - * 每页显示的个数 - */ - private int pageSize = 10; - - /** - * 当前页码 - */ - private int pageNo = 1; - - /** + + /** + * 供应商ID + */ + private Long supplierID = 0l; + + /** + * 供应商IDs 批量操作使用 + */ + private String supplierIDs = ""; + + /** + * 每页显示的个数 + */ + private int pageSize = 10; + + /** + * 当前页码 + */ + private int pageNo = 1; + + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - private String browserType = ""; //浏览器类型 - private String fileName = ""; //文件名称 - private InputStream excelStream; //输入流,导出excel文件 + private String browserType = ""; //浏览器类型 + private String fileName = ""; //文件名称 + private InputStream excelStream; //输入流,导出excel文件 - public SupplierShowModel getShowModel() { - return showModel; - } - - public void setShowModel(SupplierShowModel showModel) { - this.showModel = showModel; - } - - public String getSupplier() { - return supplier; - } - - public void setSupplier(String supplier) { - this.supplier = supplier; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getContacts() { - return contacts; - } - - public void setContacts(String contacts) { - this.contacts = contacts; - } - - public String getPhonenum() { - return phonenum; - } - - public void setPhonenum(String phonenum) { - this.phonenum = phonenum; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public Double getAdvanceIn() { - return AdvanceIn; - } - - public void setAdvanceIn(Double advanceIn) { - AdvanceIn = advanceIn; - } - - public void setBeginNeedGet(Double beginNeedGet) - { - BeginNeedGet = beginNeedGet; + public SupplierShowModel getShowModel() { + return showModel; } - public Double getBeginNeedGet() - { + public void setShowModel(SupplierShowModel showModel) { + this.showModel = showModel; + } + + public String getSupplier() { + return supplier; + } + + public void setSupplier(String supplier) { + this.supplier = supplier; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getContacts() { + return contacts; + } + + public void setContacts(String contacts) { + this.contacts = contacts; + } + + public String getPhonenum() { + return phonenum; + } + + public void setPhonenum(String phonenum) { + this.phonenum = phonenum; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Double getAdvanceIn() { + return AdvanceIn; + } + + public void setAdvanceIn(Double advanceIn) { + AdvanceIn = advanceIn; + } + + public Double getBeginNeedGet() { return BeginNeedGet; } - public void setBeginNeedPay(Double beginNeedPay) - { - BeginNeedPay = beginNeedPay; + public void setBeginNeedGet(Double beginNeedGet) { + BeginNeedGet = beginNeedGet; } - public Double getBeginNeedPay() - { + public Double getBeginNeedPay() { return BeginNeedPay; } - public void setAllNeedGet(Double allNeedGet) - { - AllNeedGet = allNeedGet; + public void setBeginNeedPay(Double beginNeedPay) { + BeginNeedPay = beginNeedPay; } - public Double getAllNeedGet() - { + public Double getAllNeedGet() { return AllNeedGet; } - public void setAllNeedPay(Double allNeedPay) - { + public void setAllNeedGet(Double allNeedGet) { + AllNeedGet = allNeedGet; + } + + public Double getAllNeedPay() { + return AllNeedPay; + } + + public void setAllNeedPay(Double allNeedPay) { AllNeedPay = allNeedPay; } - public Double getAllNeedPay() - { - return AllNeedPay; - } + public String getDescription() { + return description; + } - public String getDescription() { - return description; - } + public void setDescription(String description) { + this.description = description; + } - public void setDescription(String description) { - this.description = description; - } + public Boolean getEnabled() { + return enabled; + } - public Boolean getEnabled() { - return enabled; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public Long getSupplierID() { + return supplierID; + } - public Long getSupplierID() { - return supplierID; - } + public void setSupplierID(Long supplierID) { + this.supplierID = supplierID; + } - public void setSupplierID(Long supplierID) { - this.supplierID = supplierID; - } + public String getSupplierIDs() { + return supplierIDs; + } - public String getSupplierIDs() { - return supplierIDs; - } + public void setSupplierIDs(String supplierIDs) { + this.supplierIDs = supplierIDs; + } - public void setSupplierIDs(String supplierIDs) { - this.supplierIDs = supplierIDs; - } + public int getPageSize() { + return pageSize; + } - public int getPageSize() { - return pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public int getPageNo() { + return pageNo; + } - public int getPageNo() { - return pageNo; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public String getClientIp() { + return clientIp; + } - public String getClientIp() { - return clientIp; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public String getFax() { + return fax; + } - public String getFax() { - return fax; - } + public void setFax(String fax) { + this.fax = fax; + } - public void setFax(String fax) { - this.fax = fax; - } + public String getTelephone() { + return telephone; + } - public String getTelephone() { - return telephone; - } + public void setTelephone(String telephone) { + this.telephone = telephone; + } - public void setTelephone(String telephone) { - this.telephone = telephone; - } + public String getAddress() { + return address; + } - public String getAddress() { - return address; - } + public void setAddress(String address) { + this.address = address; + } - public void setAddress(String address) { - this.address = address; - } + public String getTaxNum() { + return taxNum; + } - public String getTaxNum() { - return taxNum; - } + public void setTaxNum(String taxNum) { + this.taxNum = taxNum; + } - public void setTaxNum(String taxNum) { - this.taxNum = taxNum; - } + public String getBankName() { + return bankName; + } - public String getBankName() { - return bankName; - } + public void setBankName(String bankName) { + this.bankName = bankName; + } - public void setBankName(String bankName) { - this.bankName = bankName; - } + public String getAccountNumber() { + return accountNumber; + } - public String getAccountNumber() { - return accountNumber; - } + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } + public Double getTaxRate() { + return taxRate; + } - public Double getTaxRate() { - return taxRate; - } + public void setTaxRate(Double taxRate) { + this.taxRate = taxRate; + } - public void setTaxRate(Double taxRate) { - this.taxRate = taxRate; - } + public String getUBType() { + return UBType; + } - public String getUBType() { - return UBType; - } + public void setUBType(String UBType) { + this.UBType = UBType; + } - public void setUBType(String UBType) { - this.UBType = UBType; - } + public String getUBKeyId() { + return UBKeyId; + } - public String getUBKeyId() { - return UBKeyId; - } + public void setUBKeyId(String UBKeyId) { + this.UBKeyId = UBKeyId; + } - public void setUBKeyId(String UBKeyId) { - this.UBKeyId = UBKeyId; - } + public String getBrowserType() { + return browserType; + } - public String getBrowserType() { - return browserType; - } + public void setBrowserType(String browserType) { + this.browserType = browserType; + } - public void setBrowserType(String browserType) { - this.browserType = browserType; - } + public String getFileName() { + return fileName; + } - public String getFileName() { - return fileName; - } + public void setFileName(String fileName) { + this.fileName = fileName; + } - public void setFileName(String fileName) { - this.fileName = fileName; - } + public InputStream getExcelStream() { + return excelStream; + } - public InputStream getExcelStream() { - return excelStream; - } + public void setExcelStream(InputStream excelStream) { + this.excelStream = excelStream; + } - public void setExcelStream(InputStream excelStream) { - this.excelStream = excelStream; - } + public File getSupplierFile() { + return supplierFile; + } - public File getSupplierFile() { - return supplierFile; - } - - public void setSupplierFile(File supplierFile) { - this.supplierFile = supplierFile; - } + public void setSupplierFile(File supplierFile) { + this.supplierFile = supplierFile; + } } diff --git a/src/main/java/com/jsh/model/vo/basic/SupplierShowModel.java b/src/main/java/com/jsh/model/vo/basic/SupplierShowModel.java index 9a0cffe7..9a24ad84 100644 --- a/src/main/java/com/jsh/model/vo/basic/SupplierShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/SupplierShowModel.java @@ -6,37 +6,34 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class SupplierShowModel implements Serializable -{ +public class SupplierShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - + /** * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } - @SuppressWarnings("rawtypes") - public Map getMap() { - return map; - } + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } - @SuppressWarnings("rawtypes") - public void setMap(Map map) { - this.map = map; - } - } diff --git a/src/main/java/com/jsh/model/vo/basic/SystemConfigModel.java b/src/main/java/com/jsh/model/vo/basic/SystemConfigModel.java index fafef09d..d8af20a9 100644 --- a/src/main/java/com/jsh/model/vo/basic/SystemConfigModel.java +++ b/src/main/java/com/jsh/model/vo/basic/SystemConfigModel.java @@ -3,75 +3,76 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class SystemConfigModel implements Serializable -{ +public class SystemConfigModel implements Serializable { private SystemConfigShowModel showModel = new SystemConfigShowModel(); - /**======开始接受页面参数=================**/ - private Long id = 0l; + /** + * ======开始接受页面参数================= + **/ + private Long id = 0l; private String type = ""; - private String name = ""; - private String value = ""; - private String description = ""; + private String name = ""; + private String value = ""; + private String description = ""; /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - public SystemConfigShowModel getShowModel() { - return showModel; - } + public SystemConfigShowModel getShowModel() { + return showModel; + } - public void setShowModel(SystemConfigShowModel showModel) { - this.showModel = showModel; - } + public void setShowModel(SystemConfigShowModel showModel) { + this.showModel = showModel; + } - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public void setValue(String value) { - this.value = value; - } + public void setValue(String value) { + this.value = value; + } - public String getDescription() { - return description; - } + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } + public void setDescription(String description) { + this.description = description; + } - public String getClientIp() { - return clientIp; - } + public String getClientIp() { + return clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } } diff --git a/src/main/java/com/jsh/model/vo/basic/SystemConfigShowModel.java b/src/main/java/com/jsh/model/vo/basic/SystemConfigShowModel.java index c775f510..1f36e97e 100644 --- a/src/main/java/com/jsh/model/vo/basic/SystemConfigShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/SystemConfigShowModel.java @@ -3,20 +3,17 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class SystemConfigShowModel implements Serializable -{ +public class SystemConfigShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } } diff --git a/src/main/java/com/jsh/model/vo/basic/UnitModel.java b/src/main/java/com/jsh/model/vo/basic/UnitModel.java index a261b46b..70524187 100644 --- a/src/main/java/com/jsh/model/vo/basic/UnitModel.java +++ b/src/main/java/com/jsh/model/vo/basic/UnitModel.java @@ -3,96 +3,95 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class UnitModel implements Serializable -{ - private DepotShowModel showModel = new DepotShowModel(); +public class UnitModel implements Serializable { + private DepotShowModel showModel = new DepotShowModel(); - /**======开始接受页面参数=================**/ - /** - * 名称 - */ - private String UName = ""; + /**======开始接受页面参数=================**/ + /** + * 名称 + */ + private String UName = ""; - /** - * ID - */ - private Long unitID = 0l; + /** + * ID + */ + private Long unitID = 0l; - /** - * IDs 批量操作使用 - */ - private String unitIDs = ""; + /** + * IDs 批量操作使用 + */ + private String unitIDs = ""; - /** - * 每页显示的个数 - */ - private int pageSize = 10; + /** + * 每页显示的个数 + */ + private int pageSize = 10; - /** - * 当前页码 - */ - private int pageNo = 1; + /** + * 当前页码 + */ + private int pageNo = 1; - /** - * 用户IP,用户记录操作日志 - */ - private String clientIp = ""; + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; - public DepotShowModel getShowModel() { - return showModel; - } + public DepotShowModel getShowModel() { + return showModel; + } - public void setShowModel(DepotShowModel showModel) { - this.showModel = showModel; - } + public void setShowModel(DepotShowModel showModel) { + this.showModel = showModel; + } - public String getUName() { - return UName; - } + public String getUName() { + return UName; + } - public void setUName(String UName) { - this.UName = UName; - } + public void setUName(String UName) { + this.UName = UName; + } - public Long getUnitID() { - return unitID; - } + public Long getUnitID() { + return unitID; + } - public void setUnitID(Long unitID) { - this.unitID = unitID; - } + public void setUnitID(Long unitID) { + this.unitID = unitID; + } - public String getUnitIDs() { - return unitIDs; - } + public String getUnitIDs() { + return unitIDs; + } - public void setUnitIDs(String unitIDs) { - this.unitIDs = unitIDs; - } + public void setUnitIDs(String unitIDs) { + this.unitIDs = unitIDs; + } - public int getPageSize() { - return pageSize; - } + public int getPageSize() { + return pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public int getPageNo() { - return pageNo; - } + public int getPageNo() { + return pageNo; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public String getClientIp() { - return clientIp; - } + public String getClientIp() { + return clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } } diff --git a/src/main/java/com/jsh/model/vo/basic/UnitShowModel.java b/src/main/java/com/jsh/model/vo/basic/UnitShowModel.java index 6ab9ca86..c68ce9cc 100644 --- a/src/main/java/com/jsh/model/vo/basic/UnitShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/UnitShowModel.java @@ -6,38 +6,35 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class UnitShowModel implements Serializable -{ +public class UnitShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - + /** * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } - @SuppressWarnings("rawtypes") - public Map getMap() { - return map; - } + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + - @SuppressWarnings("rawtypes") - public void setMap(Map map) { - this.map = map; - } - - } diff --git a/src/main/java/com/jsh/model/vo/basic/UserBusinessModel.java b/src/main/java/com/jsh/model/vo/basic/UserBusinessModel.java index eec667ac..a4cf03a5 100644 --- a/src/main/java/com/jsh/model/vo/basic/UserBusinessModel.java +++ b/src/main/java/com/jsh/model/vo/basic/UserBusinessModel.java @@ -3,8 +3,7 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class UserBusinessModel implements Serializable -{ +public class UserBusinessModel implements Serializable { private UserBusinessShowModel showModel = new UserBusinessShowModel(); /**======开始接受页面参数=================**/ @@ -12,121 +11,121 @@ public class UserBusinessModel implements Serializable * 角色名称 */ private String Type = ""; - + /** * 主ID */ private String KeyId = ""; - + /** * 值 */ private String Value = ""; - private String BtnStr = ""; - + private String BtnStr = ""; + /** * 分类ID */ private Long userBusinessID = 0l; - + /** * 分类IDs 批量操作使用 */ private String userBusinessIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - public UserBusinessShowModel getShowModel() { - return showModel; - } + public UserBusinessShowModel getShowModel() { + return showModel; + } - public void setShowModel(UserBusinessShowModel showModel) { - this.showModel = showModel; - } + public void setShowModel(UserBusinessShowModel showModel) { + this.showModel = showModel; + } - public String getType() { - return Type; - } + public String getType() { + return Type; + } - public void setType(String type) { - Type = type; - } + public void setType(String type) { + Type = type; + } - public String getKeyId() { - return KeyId; - } + public String getKeyId() { + return KeyId; + } - public void setKeyId(String keyId) { - KeyId = keyId; - } + public void setKeyId(String keyId) { + KeyId = keyId; + } - public String getValue() { - return Value; - } + public String getValue() { + return Value; + } - public void setValue(String value) { - Value = value; - } + public void setValue(String value) { + Value = value; + } - public Long getUserBusinessID() { - return userBusinessID; - } + public Long getUserBusinessID() { + return userBusinessID; + } - public void setUserBusinessID(Long userBusinessID) { - this.userBusinessID = userBusinessID; - } + public void setUserBusinessID(Long userBusinessID) { + this.userBusinessID = userBusinessID; + } - public String getUserBusinessIDs() { - return userBusinessIDs; - } + public String getUserBusinessIDs() { + return userBusinessIDs; + } - public void setUserBusinessIDs(String userBusinessIDs) { - this.userBusinessIDs = userBusinessIDs; - } + public void setUserBusinessIDs(String userBusinessIDs) { + this.userBusinessIDs = userBusinessIDs; + } - public int getPageSize() { - return pageSize; - } + public int getPageSize() { + return pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public int getPageNo() { - return pageNo; - } + public int getPageNo() { + return pageNo; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public String getClientIp() { - return clientIp; - } + public String getClientIp() { + return clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public String getBtnStr() { - return BtnStr; - } + public String getBtnStr() { + return BtnStr; + } - public void setBtnStr(String btnStr) { - BtnStr = btnStr; - } + public void setBtnStr(String btnStr) { + BtnStr = btnStr; + } } diff --git a/src/main/java/com/jsh/model/vo/basic/UserBusinessShowModel.java b/src/main/java/com/jsh/model/vo/basic/UserBusinessShowModel.java index 65dc4b27..d5e83227 100644 --- a/src/main/java/com/jsh/model/vo/basic/UserBusinessShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/UserBusinessShowModel.java @@ -6,38 +6,35 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class UserBusinessShowModel implements Serializable -{ +public class UserBusinessShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - + /** * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } - @SuppressWarnings("rawtypes") - public Map getMap() { - return map; - } + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + - @SuppressWarnings("rawtypes") - public void setMap(Map map) { - this.map = map; - } - - } diff --git a/src/main/java/com/jsh/model/vo/basic/UserModel.java b/src/main/java/com/jsh/model/vo/basic/UserModel.java index 42c8cf0e..65bb412d 100644 --- a/src/main/java/com/jsh/model/vo/basic/UserModel.java +++ b/src/main/java/com/jsh/model/vo/basic/UserModel.java @@ -3,253 +3,218 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class UserModel implements Serializable -{ - private UserShowModel showModel = new UserShowModel(); - - /*+++++用户登录开始+++++++++++*/ - private String username = "" ; - private String password = "" ; - /*+++++用户登录结束+++++++++++*/ - - /** - * ===============以下处理用户管理部分=============== - */ - /** - * 用户登录名称 - */ - private String loginame; - - /** - * 职位 - */ - private String position; - - /** - * 部门 - */ - private String department; - - /** - * 电子邮件 - */ - private String email; - - /** - * 电话号码 - */ - private String phonenum; - - /** - * 是否管理员 0 ==管理员 1==非管理员 - */ - private Short ismanager = 1; - - /** - * 用户描述 - */ - private String description; - - /** - * 用户ID - */ - private Long userID = 0l; - - /** - * 用户IDs 批量操作使用 - */ - private String userIDs = ""; - - /** - * 每页显示的个数 - */ - private int pageSize = 10; - - /** - * 当前页码 - */ - private int pageNo = 1; - - /** - * 用户IP,用户记录操作日志 - */ - private String clientIp = ""; - - /** - * 根据标识判断是校验登录名称还是用户名称 0==用户名称 1==登录名称 - */ - private int checkFlag = 0; - - private String orgpwd = ""; - - public String getClientIp() - { - return clientIp; - } - - public void setClientIp(String clientIp) - { - this.clientIp = clientIp; - } - - public String getUsername() - { - return username; - } - - public void setUsername(String username) - { - this.username = username; - } - - public String getPassword() - { - return password; - } - - public void setPassword(String password) - { - this.password = password; - } - - public UserShowModel getShowModel() - { - return showModel; - } - - public void setShowModel(UserShowModel showModel) - { - this.showModel = showModel; - } +public class UserModel implements Serializable { + private UserShowModel showModel = new UserShowModel(); - public String getLoginame() - { - return loginame; - } + /*+++++用户登录开始+++++++++++*/ + private String username = ""; + private String password = ""; + /*+++++用户登录结束+++++++++++*/ - public void setLoginame(String loginame) - { - this.loginame = loginame; - } + /** + * ===============以下处理用户管理部分=============== + */ + /** + * 用户登录名称 + */ + private String loginame; - public String getPosition() - { - return position; - } + /** + * 职位 + */ + private String position; - public void setPosition(String position) - { - this.position = position; - } + /** + * 部门 + */ + private String department; - public String getDepartment() - { - return department; - } + /** + * 电子邮件 + */ + private String email; - public void setDepartment(String department) - { - this.department = department; - } + /** + * 电话号码 + */ + private String phonenum; - public String getEmail() - { - return email; - } + /** + * 是否管理员 0 ==管理员 1==非管理员 + */ + private Short ismanager = 1; - public void setEmail(String email) - { - this.email = email; - } + /** + * 用户描述 + */ + private String description; - public String getPhonenum() - { - return phonenum; - } + /** + * 用户ID + */ + private Long userID = 0l; - public void setPhonenum(String phonenum) - { - this.phonenum = phonenum; - } + /** + * 用户IDs 批量操作使用 + */ + private String userIDs = ""; - public Short getIsmanager() - { - return ismanager; - } + /** + * 每页显示的个数 + */ + private int pageSize = 10; - public void setIsmanager(Short ismanager) - { - this.ismanager = ismanager; - } + /** + * 当前页码 + */ + private int pageNo = 1; - public String getDescription() - { - return description; - } + /** + * 用户IP,用户记录操作日志 + */ + private String clientIp = ""; - public void setDescription(String description) - { - this.description = description; - } + /** + * 根据标识判断是校验登录名称还是用户名称 0==用户名称 1==登录名称 + */ + private int checkFlag = 0; - public Long getUserID() - { - return userID; - } + private String orgpwd = ""; - public void setUserID(Long userID) - { - this.userID = userID; - } + public String getClientIp() { + return clientIp; + } - public String getUserIDs() - { - return userIDs; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public void setUserIDs(String userIDs) - { - this.userIDs = userIDs; - } + public String getUsername() { + return username; + } - public int getPageSize() - { - return pageSize; - } + public void setUsername(String username) { + this.username = username; + } - public void setPageSize(int pageSize) - { - this.pageSize = pageSize; - } + public String getPassword() { + return password; + } - public int getPageNo() - { - return pageNo; - } + public void setPassword(String password) { + this.password = password; + } - public void setPageNo(int pageNo) - { - this.pageNo = pageNo; - } + public UserShowModel getShowModel() { + return showModel; + } - public int getCheckFlag() - { - return checkFlag; - } + public void setShowModel(UserShowModel showModel) { + this.showModel = showModel; + } - public void setCheckFlag(int checkFlag) - { - this.checkFlag = checkFlag; - } + public String getLoginame() { + return loginame; + } - public String getOrgpwd() - { - return orgpwd; - } + public void setLoginame(String loginame) { + this.loginame = loginame; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPhonenum() { + return phonenum; + } + + public void setPhonenum(String phonenum) { + this.phonenum = phonenum; + } + + public Short getIsmanager() { + return ismanager; + } + + public void setIsmanager(Short ismanager) { + this.ismanager = ismanager; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Long getUserID() { + return userID; + } + + public void setUserID(Long userID) { + this.userID = userID; + } + + public String getUserIDs() { + return userIDs; + } + + public void setUserIDs(String userIDs) { + this.userIDs = userIDs; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNo() { + return pageNo; + } + + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public int getCheckFlag() { + return checkFlag; + } + + public void setCheckFlag(int checkFlag) { + this.checkFlag = checkFlag; + } + + public String getOrgpwd() { + return orgpwd; + } + + public void setOrgpwd(String orgpwd) { + this.orgpwd = orgpwd; + } - public void setOrgpwd(String orgpwd) - { - this.orgpwd = orgpwd; - } - } diff --git a/src/main/java/com/jsh/model/vo/basic/UserShowModel.java b/src/main/java/com/jsh/model/vo/basic/UserShowModel.java index 3a62dc44..7339d745 100644 --- a/src/main/java/com/jsh/model/vo/basic/UserShowModel.java +++ b/src/main/java/com/jsh/model/vo/basic/UserShowModel.java @@ -3,20 +3,17 @@ package com.jsh.model.vo.basic; import java.io.Serializable; @SuppressWarnings("serial") -public class UserShowModel implements Serializable -{ - /** - * 提示信息 - */ - private String msgTip = ""; +public class UserShowModel implements Serializable { + /** + * 提示信息 + */ + private String msgTip = ""; - public String getMsgTip() - { - return msgTip; - } + public String getMsgTip() { + return msgTip; + } - public void setMsgTip(String msgTip) - { - this.msgTip = msgTip; - } + public void setMsgTip(String msgTip) { + this.msgTip = msgTip; + } } diff --git a/src/main/java/com/jsh/model/vo/materials/AccountHeadModel.java b/src/main/java/com/jsh/model/vo/materials/AccountHeadModel.java index 4fc9fae7..afb90d19 100644 --- a/src/main/java/com/jsh/model/vo/materials/AccountHeadModel.java +++ b/src/main/java/com/jsh/model/vo/materials/AccountHeadModel.java @@ -3,25 +3,26 @@ package com.jsh.model.vo.materials; import java.io.Serializable; @SuppressWarnings("serial") -public class AccountHeadModel implements Serializable -{ +public class AccountHeadModel implements Serializable { private AccountHeadShowModel showModel = new AccountHeadShowModel(); - /**======开始接受页面参数=================**/ + /** + * ======开始接受页面参数================= + **/ private String Type; private Long OrganId; - private Long HandsPersonId; + private Long HandsPersonId; private Double ChangeAmount; private Double TotalPrice; private Long AccountId; private String BillNo; - private String BillTime; + private String BillTime; private String Remark; private String BeginTime; //查询开始时间 private String EndTime; //查询结束时间 private String MonthTime; //查询月份 - - private String supplierId; //单位Id,用于查询单位的收付款 + + private String supplierId; //单位Id,用于查询单位的收付款 private String supType; //单位类型,客户、供应商 /** @@ -49,192 +50,157 @@ public class AccountHeadModel implements Serializable */ private String clientIp = ""; - public void setShowModel(AccountHeadShowModel showModel) - { - this.showModel = showModel; - } - - public AccountHeadShowModel getShowModel() - { + public AccountHeadShowModel getShowModel() { return showModel; } - public void setType(String type) - { - Type = type; + public void setShowModel(AccountHeadShowModel showModel) { + this.showModel = showModel; } - public String getType() - { + public String getType() { return Type; } - public void setOrganId(Long organId) - { - OrganId = organId; + public void setType(String type) { + Type = type; } - public Long getOrganId() - { + public Long getOrganId() { return OrganId; } - public void setHandsPersonId(Long handsPersonId) - { - HandsPersonId = handsPersonId; + public void setOrganId(Long organId) { + OrganId = organId; } - public Long getHandsPersonId() - { + public Long getHandsPersonId() { return HandsPersonId; } - public void setChangeAmount(Double changeAmount) - { - ChangeAmount = changeAmount; + public void setHandsPersonId(Long handsPersonId) { + HandsPersonId = handsPersonId; } - public Double getChangeAmount() - { + public Double getChangeAmount() { return ChangeAmount; } - public void setTotalPrice(Double totalPrice) { - TotalPrice = totalPrice; - } - - public Double getTotalPrice() { - return TotalPrice; - } - - public void setAccountId(Long accountId) - { - AccountId = accountId; + public void setChangeAmount(Double changeAmount) { + ChangeAmount = changeAmount; } - public Long getAccountId() - { + public Double getTotalPrice() { + return TotalPrice; + } + + public void setTotalPrice(Double totalPrice) { + TotalPrice = totalPrice; + } + + public Long getAccountId() { return AccountId; } - public void setBillNo(String billNo) - { - BillNo = billNo; + public void setAccountId(Long accountId) { + AccountId = accountId; } - public String getBillNo() - { + public String getBillNo() { return BillNo; } - public void setBillTime(String billTime) - { - BillTime = billTime; + public void setBillNo(String billNo) { + BillNo = billNo; } - public String getBillTime() - { + public String getBillTime() { return BillTime; } - public void setRemark(String remark) - { - Remark = remark; + public void setBillTime(String billTime) { + BillTime = billTime; } - public String getRemark() - { + public String getRemark() { return Remark; } - public void setBeginTime(String beginTime) - { - BeginTime = beginTime; + public void setRemark(String remark) { + Remark = remark; } - public String getBeginTime() - { + public String getBeginTime() { return BeginTime; } - public void setEndTime(String endTime) - { - EndTime = endTime; + public void setBeginTime(String beginTime) { + BeginTime = beginTime; } - public String getEndTime() - { + public String getEndTime() { return EndTime; } - public void setMonthTime(String monthTime) - { - MonthTime = monthTime; + public void setEndTime(String endTime) { + EndTime = endTime; } - public String getMonthTime() - { + public String getMonthTime() { return MonthTime; } - public void setAccountHeadID(Long accountHeadID) - { - this.accountHeadID = accountHeadID; + public void setMonthTime(String monthTime) { + MonthTime = monthTime; } - public Long getAccountHeadID() - { + public Long getAccountHeadID() { return accountHeadID; } - public void setAccountHeadIDs(String accountHeadIDs) - { - this.accountHeadIDs = accountHeadIDs; + public void setAccountHeadID(Long accountHeadID) { + this.accountHeadID = accountHeadID; } - public String getAccountHeadIDs() - { + public String getAccountHeadIDs() { return accountHeadIDs; } - public void setPageSize(int pageSize) - { - this.pageSize = pageSize; + public void setAccountHeadIDs(String accountHeadIDs) { + this.accountHeadIDs = accountHeadIDs; } - public int getPageSize() - { + public int getPageSize() { return pageSize; } - public void setPageNo(int pageNo) - { - this.pageNo = pageNo; + public void setPageSize(int pageSize) { + this.pageSize = pageSize; } - public int getPageNo() - { + public int getPageNo() { return pageNo; } - - public void setClientIp(String clientIp) - { - this.clientIp = clientIp; + public void setPageNo(int pageNo) { + this.pageNo = pageNo; } - public String getClientIp() - { + public String getClientIp() { return clientIp; } - public String getSupplierId() { - return supplierId; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public void setSupplierId(String supplierId) { - this.supplierId = supplierId; - } + public String getSupplierId() { + return supplierId; + } + + public void setSupplierId(String supplierId) { + this.supplierId = supplierId; + } public String getSupType() { return supType; diff --git a/src/main/java/com/jsh/model/vo/materials/AccountHeadShowModel.java b/src/main/java/com/jsh/model/vo/materials/AccountHeadShowModel.java index 1e14ae9b..5a3d41b6 100644 --- a/src/main/java/com/jsh/model/vo/materials/AccountHeadShowModel.java +++ b/src/main/java/com/jsh/model/vo/materials/AccountHeadShowModel.java @@ -6,8 +6,7 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class AccountHeadShowModel implements Serializable -{ +public class AccountHeadShowModel implements Serializable { /** * 提示信息 */ @@ -17,15 +16,13 @@ public class AccountHeadShowModel implements Serializable * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } diff --git a/src/main/java/com/jsh/model/vo/materials/AccountItemModel.java b/src/main/java/com/jsh/model/vo/materials/AccountItemModel.java index 93d0d266..0a0da394 100644 --- a/src/main/java/com/jsh/model/vo/materials/AccountItemModel.java +++ b/src/main/java/com/jsh/model/vo/materials/AccountItemModel.java @@ -4,11 +4,12 @@ import java.io.InputStream; import java.io.Serializable; @SuppressWarnings("serial") -public class AccountItemModel implements Serializable -{ +public class AccountItemModel implements Serializable { private AccountItemShowModel showModel = new AccountItemShowModel(); - /**======开始接受页面参数=================**/ + /** + * ======开始接受页面参数================= + **/ private Long HeaderId; private Long AccountId; private Long InOutItemId; @@ -58,106 +59,86 @@ public class AccountItemModel implements Serializable */ private InputStream excelStream; - public void setShowModel(AccountItemShowModel showModel) - { - this.showModel = showModel; - } - - public AccountItemShowModel getShowModel() - { + public AccountItemShowModel getShowModel() { return showModel; } - public void setHeaderId(Long headerId) - { - HeaderId = headerId; + public void setShowModel(AccountItemShowModel showModel) { + this.showModel = showModel; } - public Long getHeaderId() - { + public Long getHeaderId() { return HeaderId; } - public void setAccountId(Long accountId) - { - AccountId = accountId; + public void setHeaderId(Long headerId) { + HeaderId = headerId; } - public Long getAccountId() - { + public Long getAccountId() { return AccountId; } - public void setInOutItemId(Long inOutItemId) - { - InOutItemId = inOutItemId; + public void setAccountId(Long accountId) { + AccountId = accountId; } - public Long getInOutItemId() - { + public Long getInOutItemId() { return InOutItemId; } - public void setEachAmount(Double eachAmount) - { - EachAmount = eachAmount; + public void setInOutItemId(Long inOutItemId) { + InOutItemId = inOutItemId; } - public Double getEachAmount() - { + public Double getEachAmount() { return EachAmount; } - public void setRemark(String remark) - { - Remark = remark; + public void setEachAmount(Double eachAmount) { + EachAmount = eachAmount; } - public String getRemark() - { + public String getRemark() { return Remark; } - public void setInserted(String inserted) - { - Inserted = inserted; + public void setRemark(String remark) { + Remark = remark; } - public String getInserted() - { + public String getInserted() { return Inserted; } - public void setDeleted(String deleted) - { - Deleted = deleted; + public void setInserted(String inserted) { + Inserted = inserted; } - public String getDeleted() - { + public String getDeleted() { return Deleted; } - public void setUpdated(String updated) - { - Updated = updated; + public void setDeleted(String deleted) { + Deleted = deleted; } - public String getUpdated() - { + public String getUpdated() { return Updated; } - public void setHeadIds(String headIds) - { - HeadIds = headIds; + public void setUpdated(String updated) { + Updated = updated; } - public String getHeadIds() - { + public String getHeadIds() { return HeadIds; } + public void setHeadIds(String headIds) { + HeadIds = headIds; + } + public String getListType() { return ListType; } @@ -166,95 +147,75 @@ public class AccountItemModel implements Serializable ListType = listType; } - public void setMonthTime(String monthTime) - { - MonthTime = monthTime; - } - - public String getMonthTime() - { + public String getMonthTime() { return MonthTime; } - public void setBrowserType(String browserType) - { - this.browserType = browserType; + public void setMonthTime(String monthTime) { + MonthTime = monthTime; } - public String getBrowserType() - { + public String getBrowserType() { return browserType; } - public void setFileName(String fileName) - { - this.fileName = fileName; + public void setBrowserType(String browserType) { + this.browserType = browserType; } - public String getFileName() - { + public String getFileName() { return fileName; } - public void setAccountItemID(Long accountItemID) - { - this.accountItemID = accountItemID; + public void setFileName(String fileName) { + this.fileName = fileName; } - public Long getAccountItemID() - { + public Long getAccountItemID() { return accountItemID; } - public void setAccountItemIDs(String accountItemIDs) - { - this.accountItemIDs = accountItemIDs; + public void setAccountItemID(Long accountItemID) { + this.accountItemID = accountItemID; } - public String getAccountItemIDs() - { + public String getAccountItemIDs() { return accountItemIDs; } - public void setPageSize(int pageSize) - { - this.pageSize = pageSize; + public void setAccountItemIDs(String accountItemIDs) { + this.accountItemIDs = accountItemIDs; } - public int getPageSize() - { + public int getPageSize() { return pageSize; } - public void setPageNo(int pageNo) - { - this.pageNo = pageNo; + public void setPageSize(int pageSize) { + this.pageSize = pageSize; } - public int getPageNo() - { + public int getPageNo() { return pageNo; } - public void setClientIp(String clientIp) - { + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { this.clientIp = clientIp; } - public String getClientIp() - { - return clientIp; - } - - - - public void setExcelStream(InputStream excelStream) - { - this.excelStream = excelStream; - } - - public InputStream getExcelStream() - { + public InputStream getExcelStream() { return excelStream; } + + public void setExcelStream(InputStream excelStream) { + this.excelStream = excelStream; + } } diff --git a/src/main/java/com/jsh/model/vo/materials/AccountItemShowModel.java b/src/main/java/com/jsh/model/vo/materials/AccountItemShowModel.java index 99810cf3..9b8e05c9 100644 --- a/src/main/java/com/jsh/model/vo/materials/AccountItemShowModel.java +++ b/src/main/java/com/jsh/model/vo/materials/AccountItemShowModel.java @@ -3,20 +3,17 @@ package com.jsh.model.vo.materials; import java.io.Serializable; @SuppressWarnings("serial") -public class AccountItemShowModel implements Serializable -{ +public class AccountItemShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } } diff --git a/src/main/java/com/jsh/model/vo/materials/DepotHeadShowModel.java b/src/main/java/com/jsh/model/vo/materials/DepotHeadShowModel.java index 0c7289eb..c71a2486 100644 --- a/src/main/java/com/jsh/model/vo/materials/DepotHeadShowModel.java +++ b/src/main/java/com/jsh/model/vo/materials/DepotHeadShowModel.java @@ -6,37 +6,34 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class DepotHeadShowModel implements Serializable -{ +public class DepotHeadShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - + /** * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } - @SuppressWarnings("rawtypes") - public Map getMap() { - return map; - } + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } - @SuppressWarnings("rawtypes") - public void setMap(Map map) { - this.map = map; - } - } diff --git a/src/main/java/com/jsh/model/vo/materials/DepotItemModel.java b/src/main/java/com/jsh/model/vo/materials/DepotItemModel.java index 1242ed0a..20d2bba8 100644 --- a/src/main/java/com/jsh/model/vo/materials/DepotItemModel.java +++ b/src/main/java/com/jsh/model/vo/materials/DepotItemModel.java @@ -4,381 +4,382 @@ import java.io.InputStream; import java.io.Serializable; @SuppressWarnings("serial") -public class DepotItemModel implements Serializable -{ +public class DepotItemModel implements Serializable { private DepotItemShowModel showModel = new DepotItemShowModel(); - /**======开始接受页面参数=================**/ - private Long HeaderId; - private Long MaterialId; - private String MUnit; //计量单位 - private Double OperNumber; - private Double BasicNumber; - private Double UnitPrice; - private Double TaxUnitPrice; //含税单价 - private Double AllPrice; - private String Remark = ""; - private String Img = ""; + /** + * ======开始接受页面参数================= + **/ + private Long HeaderId; + private Long MaterialId; + private String MUnit; //计量单位 + private Double OperNumber; + private Double BasicNumber; + private Double UnitPrice; + private Double TaxUnitPrice; //含税单价 + private Double AllPrice; + private String Remark = ""; + private String Img = ""; - private Long DepotId; - private Long AnotherDepotId; - private Double TaxRate; - private Double TaxMoney; - private Double TaxLastMoney; - private String OtherField1; - private String OtherField2; - private String OtherField3; - private String OtherField4; - private String OtherField5; - private String MType; - - private String Inserted = ""; //json插入记录 - private String Deleted = ""; //json删除记录 - private String Updated = ""; //json修改记录 - - private String HeadIds = ""; //表头集合列表 - private String MaterialIds = ""; //材料列表 - private String MonthTime = ""; //月份 - private Integer ProjectId = null; - private String browserType = ""; - /** - * 文件名称 - */ - private String fileName = ""; + private Long DepotId; + private Long AnotherDepotId; + private Double TaxRate; + private Double TaxMoney; + private Double TaxLastMoney; + private String OtherField1; + private String OtherField2; + private String OtherField3; + private String OtherField4; + private String OtherField5; + private String MType; + + private String Inserted = ""; //json插入记录 + private String Deleted = ""; //json删除记录 + private String Updated = ""; //json修改记录 + + private String HeadIds = ""; //表头集合列表 + private String MaterialIds = ""; //材料列表 + private String MonthTime = ""; //月份 + private Integer ProjectId = null; + private String browserType = ""; + /** + * 文件名称 + */ + private String fileName = ""; /** * 分类ID */ private Long depotItemID = 0l; - + /** * 分类IDs 批量操作使用 */ private String depotItemIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 800; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - - + + /** * 输入流,导出excel文件 */ - private InputStream excelStream; + private InputStream excelStream; - private String mpList = ""; //商品属性 + private String mpList = ""; //商品属性 - public DepotItemShowModel getShowModel() { - return showModel; - } + public DepotItemShowModel getShowModel() { + return showModel; + } - public void setShowModel(DepotItemShowModel showModel) { - this.showModel = showModel; - } + public void setShowModel(DepotItemShowModel showModel) { + this.showModel = showModel; + } - public Long getHeaderId() { - return HeaderId; - } + public Long getHeaderId() { + return HeaderId; + } - public void setHeaderId(Long headerId) { - HeaderId = headerId; - } + public void setHeaderId(Long headerId) { + HeaderId = headerId; + } - public Long getMaterialId() { - return MaterialId; - } + public Long getMaterialId() { + return MaterialId; + } - public void setMaterialId(Long materialId) { - MaterialId = materialId; - } + public void setMaterialId(Long materialId) { + MaterialId = materialId; + } - public String getMUnit() { - return MUnit; - } + public String getMUnit() { + return MUnit; + } - public void setMUnit(String MUnit) { - this.MUnit = MUnit; - } + public void setMUnit(String MUnit) { + this.MUnit = MUnit; + } - public Double getTaxUnitPrice() { - return TaxUnitPrice; - } + public Double getTaxUnitPrice() { + return TaxUnitPrice; + } - public void setTaxUnitPrice(Double taxUnitPrice) { - TaxUnitPrice = taxUnitPrice; - } + public void setTaxUnitPrice(Double taxUnitPrice) { + TaxUnitPrice = taxUnitPrice; + } - public Double getOperNumber() { - return OperNumber; - } + public Double getOperNumber() { + return OperNumber; + } - public void setOperNumber(Double operNumber) { - OperNumber = operNumber; - } + public void setOperNumber(Double operNumber) { + OperNumber = operNumber; + } - public Double getBasicNumber() { - return BasicNumber; - } + public Double getBasicNumber() { + return BasicNumber; + } - public void setBasicNumber(Double basicNumber) { - BasicNumber = basicNumber; - } + public void setBasicNumber(Double basicNumber) { + BasicNumber = basicNumber; + } - public Double getUnitPrice() { - return UnitPrice; - } + public Double getUnitPrice() { + return UnitPrice; + } - public void setUnitPrice(Double unitPrice) { - UnitPrice = unitPrice; - } + public void setUnitPrice(Double unitPrice) { + UnitPrice = unitPrice; + } - public Double getAllPrice() { - return AllPrice; - } + public Double getAllPrice() { + return AllPrice; + } - public void setAllPrice(Double allPrice) { - AllPrice = allPrice; - } + public void setAllPrice(Double allPrice) { + AllPrice = allPrice; + } - public String getRemark() { - return Remark; - } + public String getRemark() { + return Remark; + } - public void setRemark(String remark) { - Remark = remark; - } + public void setRemark(String remark) { + Remark = remark; + } - public String getImg() { - return Img; - } + public String getImg() { + return Img; + } - public void setImg(String img) { - Img = img; - } + public void setImg(String img) { + Img = img; + } - public Long getDepotItemID() { - return depotItemID; - } + public Long getDepotItemID() { + return depotItemID; + } - public void setDepotItemID(Long depotItemID) { - this.depotItemID = depotItemID; - } + public void setDepotItemID(Long depotItemID) { + this.depotItemID = depotItemID; + } - public String getDepotItemIDs() { - return depotItemIDs; - } + public String getDepotItemIDs() { + return depotItemIDs; + } - public void setDepotItemIDs(String depotItemIDs) { - this.depotItemIDs = depotItemIDs; - } + public void setDepotItemIDs(String depotItemIDs) { + this.depotItemIDs = depotItemIDs; + } - public int getPageSize() { - return pageSize; - } + public int getPageSize() { + return pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public int getPageNo() { - return pageNo; - } + public int getPageNo() { + return pageNo; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public String getClientIp() { - return clientIp; - } + public String getClientIp() { + return clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public String getInserted() { - return Inserted; - } + public String getInserted() { + return Inserted; + } - public void setInserted(String inserted) { - Inserted = inserted; - } + public void setInserted(String inserted) { + Inserted = inserted; + } - public String getDeleted() { - return Deleted; - } + public String getDeleted() { + return Deleted; + } - public void setDeleted(String deleted) { - Deleted = deleted; - } + public void setDeleted(String deleted) { + Deleted = deleted; + } - public String getUpdated() { - return Updated; - } + public String getUpdated() { + return Updated; + } - public void setUpdated(String updated) { - Updated = updated; - } + public void setUpdated(String updated) { + Updated = updated; + } - public String getHeadIds() { - return HeadIds; - } + public String getHeadIds() { + return HeadIds; + } - public void setHeadIds(String headIds) { - HeadIds = headIds; - } + public void setHeadIds(String headIds) { + HeadIds = headIds; + } - public String getMonthTime() { - return MonthTime; - } + public String getMonthTime() { + return MonthTime; + } - public void setMonthTime(String monthTime) { - MonthTime = monthTime; - } + public void setMonthTime(String monthTime) { + MonthTime = monthTime; + } - public Integer getProjectId() { - return ProjectId; - } + public Integer getProjectId() { + return ProjectId; + } - public void setProjectId(Integer projectId) { - ProjectId = projectId; - } + public void setProjectId(Integer projectId) { + ProjectId = projectId; + } - public String getMaterialIds() { - return MaterialIds; - } + public String getMaterialIds() { + return MaterialIds; + } - public void setMaterialIds(String materialIds) { - MaterialIds = materialIds; - } + public void setMaterialIds(String materialIds) { + MaterialIds = materialIds; + } - public String getBrowserType() { - return browserType; - } + public String getBrowserType() { + return browserType; + } - public void setBrowserType(String browserType) { - this.browserType = browserType; - } + public void setBrowserType(String browserType) { + this.browserType = browserType; + } - public String getFileName() { - return fileName; - } + public String getFileName() { + return fileName; + } - public void setFileName(String fileName) { - this.fileName = fileName; - } + public void setFileName(String fileName) { + this.fileName = fileName; + } - public InputStream getExcelStream() { - return excelStream; - } + public InputStream getExcelStream() { + return excelStream; + } - public void setExcelStream(InputStream excelStream) { - this.excelStream = excelStream; - } + public void setExcelStream(InputStream excelStream) { + this.excelStream = excelStream; + } - public Long getDepotId() { - return DepotId; - } + public Long getDepotId() { + return DepotId; + } - public void setDepotId(Long depotId) { - DepotId = depotId; - } + public void setDepotId(Long depotId) { + DepotId = depotId; + } - public Long getAnotherDepotId() { - return AnotherDepotId; - } + public Long getAnotherDepotId() { + return AnotherDepotId; + } - public void setAnotherDepotId(Long anotherDepotId) { - AnotherDepotId = anotherDepotId; - } + public void setAnotherDepotId(Long anotherDepotId) { + AnotherDepotId = anotherDepotId; + } - public Double getTaxRate() { - return TaxRate; - } + public Double getTaxRate() { + return TaxRate; + } - public void setTaxRate(Double taxRate) { - TaxRate = taxRate; - } + public void setTaxRate(Double taxRate) { + TaxRate = taxRate; + } - public Double getTaxMoney() { - return TaxMoney; - } + public Double getTaxMoney() { + return TaxMoney; + } - public void setTaxMoney(Double taxMoney) { - TaxMoney = taxMoney; - } + public void setTaxMoney(Double taxMoney) { + TaxMoney = taxMoney; + } - public Double getTaxLastMoney() { - return TaxLastMoney; - } + public Double getTaxLastMoney() { + return TaxLastMoney; + } - public void setTaxLastMoney(Double taxLastMoney) { - TaxLastMoney = taxLastMoney; - } + public void setTaxLastMoney(Double taxLastMoney) { + TaxLastMoney = taxLastMoney; + } - public String getOtherField1() { - return OtherField1; - } + public String getOtherField1() { + return OtherField1; + } - public void setOtherField1(String otherField1) { - OtherField1 = otherField1; - } + public void setOtherField1(String otherField1) { + OtherField1 = otherField1; + } - public String getOtherField2() { - return OtherField2; - } + public String getOtherField2() { + return OtherField2; + } - public void setOtherField2(String otherField2) { - OtherField2 = otherField2; - } + public void setOtherField2(String otherField2) { + OtherField2 = otherField2; + } - public String getOtherField3() { - return OtherField3; - } + public String getOtherField3() { + return OtherField3; + } - public void setOtherField3(String otherField3) { - OtherField3 = otherField3; - } + public void setOtherField3(String otherField3) { + OtherField3 = otherField3; + } - public String getOtherField4() { - return OtherField4; - } + public String getOtherField4() { + return OtherField4; + } - public void setOtherField4(String otherField4) { - OtherField4 = otherField4; - } + public void setOtherField4(String otherField4) { + OtherField4 = otherField4; + } - public String getOtherField5() { - return OtherField5; - } + public String getOtherField5() { + return OtherField5; + } - public void setOtherField5(String otherField5) { - OtherField5 = otherField5; - } + public void setOtherField5(String otherField5) { + OtherField5 = otherField5; + } - public String getMType() { - return MType; - } + public String getMType() { + return MType; + } - public void setMType(String MType) { - this.MType = MType; - } + public void setMType(String MType) { + this.MType = MType; + } - public String getMpList() { - return mpList; - } + public String getMpList() { + return mpList; + } - public void setMpList(String mpList) { - this.mpList = mpList; - } + public void setMpList(String mpList) { + this.mpList = mpList; + } } diff --git a/src/main/java/com/jsh/model/vo/materials/DepotItemShowModel.java b/src/main/java/com/jsh/model/vo/materials/DepotItemShowModel.java index 60826dbd..e4ff69c8 100644 --- a/src/main/java/com/jsh/model/vo/materials/DepotItemShowModel.java +++ b/src/main/java/com/jsh/model/vo/materials/DepotItemShowModel.java @@ -3,20 +3,17 @@ package com.jsh.model.vo.materials; import java.io.Serializable; @SuppressWarnings("serial") -public class DepotItemShowModel implements Serializable -{ +public class DepotItemShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } } diff --git a/src/main/java/com/jsh/model/vo/materials/MaterialCategoryModel.java b/src/main/java/com/jsh/model/vo/materials/MaterialCategoryModel.java index d63e32d9..1130f417 100644 --- a/src/main/java/com/jsh/model/vo/materials/MaterialCategoryModel.java +++ b/src/main/java/com/jsh/model/vo/materials/MaterialCategoryModel.java @@ -3,8 +3,7 @@ package com.jsh.model.vo.materials; import java.io.Serializable; @SuppressWarnings("serial") -public class MaterialCategoryModel implements Serializable -{ +public class MaterialCategoryModel implements Serializable { private MaterialCategoryShowModel showModel = new MaterialCategoryShowModel(); /**======开始接受页面参数=================**/ @@ -12,112 +11,112 @@ public class MaterialCategoryModel implements Serializable * 名称 */ private String Name = ""; - + /** * 等级 */ private Short CategoryLevel; - + /** * ParentId */ private Long ParentId; - + /** * 分类ID */ private Long materialCategoryID = 0l; - + /** * 分类IDs 批量操作使用 */ private String materialCategoryIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - public MaterialCategoryShowModel getShowModel() { - return showModel; - } + public MaterialCategoryShowModel getShowModel() { + return showModel; + } - public void setShowModel(MaterialCategoryShowModel showModel) { - this.showModel = showModel; - } + public void setShowModel(MaterialCategoryShowModel showModel) { + this.showModel = showModel; + } - public String getName() { - return Name; - } + public String getName() { + return Name; + } - public void setName(String name) { - Name = name; - } + public void setName(String name) { + Name = name; + } - public Short getCategoryLevel() { - return CategoryLevel; - } + public Short getCategoryLevel() { + return CategoryLevel; + } - public void setCategoryLevel(Short categoryLevel) { - CategoryLevel = categoryLevel; - } + public void setCategoryLevel(Short categoryLevel) { + CategoryLevel = categoryLevel; + } - public Long getParentId() { - return ParentId; - } + public Long getParentId() { + return ParentId; + } - public void setParentId(Long parentId) { - ParentId = parentId; - } + public void setParentId(Long parentId) { + ParentId = parentId; + } - public Long getMaterialCategoryID() { - return materialCategoryID; - } + public Long getMaterialCategoryID() { + return materialCategoryID; + } - public void setMaterialCategoryID(Long materialCategoryID) { - this.materialCategoryID = materialCategoryID; - } + public void setMaterialCategoryID(Long materialCategoryID) { + this.materialCategoryID = materialCategoryID; + } - public String getMaterialCategoryIDs() { - return materialCategoryIDs; - } + public String getMaterialCategoryIDs() { + return materialCategoryIDs; + } - public void setMaterialCategoryIDs(String materialCategoryIDs) { - this.materialCategoryIDs = materialCategoryIDs; - } + public void setMaterialCategoryIDs(String materialCategoryIDs) { + this.materialCategoryIDs = materialCategoryIDs; + } - public int getPageSize() { - return pageSize; - } + public int getPageSize() { + return pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public int getPageNo() { - return pageNo; - } + public int getPageNo() { + return pageNo; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public String getClientIp() { - return clientIp; - } + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } - } diff --git a/src/main/java/com/jsh/model/vo/materials/MaterialCategoryShowModel.java b/src/main/java/com/jsh/model/vo/materials/MaterialCategoryShowModel.java index 01b0e6cc..8a451111 100644 --- a/src/main/java/com/jsh/model/vo/materials/MaterialCategoryShowModel.java +++ b/src/main/java/com/jsh/model/vo/materials/MaterialCategoryShowModel.java @@ -6,38 +6,35 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class MaterialCategoryShowModel implements Serializable -{ +public class MaterialCategoryShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - + /** * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } - @SuppressWarnings("rawtypes") - public Map getMap() { - return map; - } + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + - @SuppressWarnings("rawtypes") - public void setMap(Map map) { - this.map = map; - } - - } diff --git a/src/main/java/com/jsh/model/vo/materials/MaterialModel.java b/src/main/java/com/jsh/model/vo/materials/MaterialModel.java index 105054b6..d70b4a37 100644 --- a/src/main/java/com/jsh/model/vo/materials/MaterialModel.java +++ b/src/main/java/com/jsh/model/vo/materials/MaterialModel.java @@ -5,8 +5,7 @@ import java.io.InputStream; import java.io.Serializable; @SuppressWarnings("serial") -public class MaterialModel implements Serializable -{ +public class MaterialModel implements Serializable { private MaterialShowModel showModel = new MaterialShowModel(); /**======开始接受页面参数=================**/ @@ -15,392 +14,384 @@ public class MaterialModel implements Serializable */ private String Name = ""; - private String Mfrs = ""; //制造商 + private String Mfrs = ""; //制造商 - private Double Packing; //包装(KG/包) + private Double Packing; //包装(KG/包) - private Double SafetyStock; //安全存量(KG) + private Double SafetyStock; //安全存量(KG) /** * 型号 */ private String Model = ""; - /** - * 规格 - */ - private String Standard = ""; - + /** + * 规格 + */ + private String Standard = ""; + /** * 颜色 */ private String Color = ""; - + /** * 单位 */ private String Unit = ""; - + /** * 零售价 */ private Double RetailPrice; - + /** * 最低售价 */ private Double LowPrice; - + /** * 预设售价一 */ private Double PresetPriceOne; - + /** * 预设售价二 - */ + */ private Double PresetPriceTwo; - + /** * 备注 */ private String Remark = ""; - private Long UnitId; - private String FirstOutUnit; - private String FirstInUnit; - private String PriceStrategy; + private Long UnitId; + private String FirstOutUnit; + private String FirstInUnit; + private String PriceStrategy; - /** - * 导入excel文件 - */ - private File materialFile; + /** + * 导入excel文件 + */ + private File materialFile; - private Boolean Enabled = true; //是否启用 + private Boolean Enabled = true; //是否启用 - private String OtherField1; + private String OtherField1; - private String OtherField2; + private String OtherField2; + + private String OtherField3; - private String OtherField3; - /** * CategoryId */ private Long CategoryId; - + /** * CategoryIds 用于in子查询 */ private String CategoryIds = "1"; - + /** * 分类ID */ private Long materialID = 0l; - + /** * 分类IDs 批量操作使用 */ private String materialIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - private String browserType = ""; //浏览器类型 - private String fileName = ""; //文件名称 - private InputStream excelStream; //输入流,导出excel文件 + private String browserType = ""; //浏览器类型 + private String fileName = ""; //文件名称 + private InputStream excelStream; //输入流,导出excel文件 - private String mpList = ""; //商品属性 + private String mpList = ""; //商品属性 - public MaterialShowModel getShowModel() { - return showModel; - } - - public void setShowModel(MaterialShowModel showModel) { - this.showModel = showModel; - } - - public String getName() { - return Name; - } - - public void setName(String name) { - Name = name; - } - - public String getMfrs() { - return Mfrs; - } - - public void setMfrs(String mfrs) { - Mfrs = mfrs; - } - - public Double getPacking() { - return Packing; - } - - public void setPacking(Double packing) { - Packing = packing; - } - - public Double getSafetyStock() { - return SafetyStock; - } - - public void setSafetyStock(Double safetyStock) { - SafetyStock = safetyStock; - } - - public String getModel() { - return Model; - } - - public void setModel(String model) { - Model = model; - } - - public String getStandard() { - return Standard; - } - - public void setStandard(String standard) { - Standard = standard; - } - - public String getColor() { - return Color; - } - - public void setColor(String color) { - Color = color; - } - - public String getUnit() { - return Unit; - } - - public void setUnit(String unit) { - Unit = unit; - } - - public void setRetailPrice(Double retailPrice) - { - RetailPrice = retailPrice; + public MaterialShowModel getShowModel() { + return showModel; } - public Double getRetailPrice() - { + public void setShowModel(MaterialShowModel showModel) { + this.showModel = showModel; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getMfrs() { + return Mfrs; + } + + public void setMfrs(String mfrs) { + Mfrs = mfrs; + } + + public Double getPacking() { + return Packing; + } + + public void setPacking(Double packing) { + Packing = packing; + } + + public Double getSafetyStock() { + return SafetyStock; + } + + public void setSafetyStock(Double safetyStock) { + SafetyStock = safetyStock; + } + + public String getModel() { + return Model; + } + + public void setModel(String model) { + Model = model; + } + + public String getStandard() { + return Standard; + } + + public void setStandard(String standard) { + Standard = standard; + } + + public String getColor() { + return Color; + } + + public void setColor(String color) { + Color = color; + } + + public String getUnit() { + return Unit; + } + + public void setUnit(String unit) { + Unit = unit; + } + + public Double getRetailPrice() { return RetailPrice; } - public void setLowPrice(Double lowPrice) - { - LowPrice = lowPrice; + public void setRetailPrice(Double retailPrice) { + RetailPrice = retailPrice; } - public Double getLowPrice() - { + public Double getLowPrice() { return LowPrice; } - public void setPresetPriceOne(Double presetPriceOne) - { - PresetPriceOne = presetPriceOne; + public void setLowPrice(Double lowPrice) { + LowPrice = lowPrice; } - public Double getPresetPriceOne() - { + public Double getPresetPriceOne() { return PresetPriceOne; } - public void setPresetPriceTwo(Double presetPriceTwo) - { - PresetPriceTwo = presetPriceTwo; + public void setPresetPriceOne(Double presetPriceOne) { + PresetPriceOne = presetPriceOne; } - public Double getPresetPriceTwo() - { + public Double getPresetPriceTwo() { return PresetPriceTwo; } - public String getRemark() { - return Remark; - } + public void setPresetPriceTwo(Double presetPriceTwo) { + PresetPriceTwo = presetPriceTwo; + } - public void setRemark(String remark) { - Remark = remark; - } + public String getRemark() { + return Remark; + } - public Long getCategoryId() { - return CategoryId; - } + public void setRemark(String remark) { + Remark = remark; + } - public void setCategoryId(Long categoryId) { - CategoryId = categoryId; - } + public Long getCategoryId() { + return CategoryId; + } - public Long getMaterialID() { - return materialID; - } + public void setCategoryId(Long categoryId) { + CategoryId = categoryId; + } - public void setMaterialID(Long materialID) { - this.materialID = materialID; - } + public Long getMaterialID() { + return materialID; + } - public String getMaterialIDs() { - return materialIDs; - } + public void setMaterialID(Long materialID) { + this.materialID = materialID; + } - public void setMaterialIDs(String materialIDs) { - this.materialIDs = materialIDs; - } + public String getMaterialIDs() { + return materialIDs; + } - public int getPageSize() { - return pageSize; - } + public void setMaterialIDs(String materialIDs) { + this.materialIDs = materialIDs; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public int getPageSize() { + return pageSize; + } - public int getPageNo() { - return pageNo; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public int getPageNo() { + return pageNo; + } - public String getClientIp() { - return clientIp; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public String getClientIp() { + return clientIp; + } - public String getCategoryIds() { - return CategoryIds; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public void setCategoryIds(String categoryIds) { - CategoryIds = categoryIds; - } + public String getCategoryIds() { + return CategoryIds; + } - public Long getUnitId() { - return UnitId; - } + public void setCategoryIds(String categoryIds) { + CategoryIds = categoryIds; + } - public void setUnitId(Long unitId) { - UnitId = unitId; - } + public Long getUnitId() { + return UnitId; + } - public String getFirstOutUnit() { - return FirstOutUnit; - } + public void setUnitId(Long unitId) { + UnitId = unitId; + } - public void setFirstOutUnit(String firstOutUnit) { - FirstOutUnit = firstOutUnit; - } + public String getFirstOutUnit() { + return FirstOutUnit; + } - public String getFirstInUnit() { - return FirstInUnit; - } + public void setFirstOutUnit(String firstOutUnit) { + FirstOutUnit = firstOutUnit; + } - public void setFirstInUnit(String firstInUnit) { - FirstInUnit = firstInUnit; - } + public String getFirstInUnit() { + return FirstInUnit; + } - public String getPriceStrategy() { - return PriceStrategy; - } + public void setFirstInUnit(String firstInUnit) { + FirstInUnit = firstInUnit; + } - public void setPriceStrategy(String priceStrategy) { - PriceStrategy = priceStrategy; - } + public String getPriceStrategy() { + return PriceStrategy; + } - public Boolean getEnabled() { - return Enabled; - } + public void setPriceStrategy(String priceStrategy) { + PriceStrategy = priceStrategy; + } - public void setEnabled(Boolean enabled) { - Enabled = enabled; - } + public Boolean getEnabled() { + return Enabled; + } - public String getOtherField1() { - return OtherField1; - } + public void setEnabled(Boolean enabled) { + Enabled = enabled; + } - public void setOtherField1(String otherField1) { - OtherField1 = otherField1; - } + public String getOtherField1() { + return OtherField1; + } - public String getOtherField2() { - return OtherField2; - } + public void setOtherField1(String otherField1) { + OtherField1 = otherField1; + } - public void setOtherField2(String otherField2) { - OtherField2 = otherField2; - } + public String getOtherField2() { + return OtherField2; + } - public String getOtherField3() { - return OtherField3; - } + public void setOtherField2(String otherField2) { + OtherField2 = otherField2; + } - public void setOtherField3(String otherField3) { - OtherField3 = otherField3; - } + public String getOtherField3() { + return OtherField3; + } - public String getBrowserType() { - return browserType; - } + public void setOtherField3(String otherField3) { + OtherField3 = otherField3; + } - public void setBrowserType(String browserType) { - this.browserType = browserType; - } + public String getBrowserType() { + return browserType; + } - public String getFileName() { - return fileName; - } + public void setBrowserType(String browserType) { + this.browserType = browserType; + } - public void setFileName(String fileName) { - this.fileName = fileName; - } + public String getFileName() { + return fileName; + } - public InputStream getExcelStream() { - return excelStream; - } + public void setFileName(String fileName) { + this.fileName = fileName; + } - public void setExcelStream(InputStream excelStream) { - this.excelStream = excelStream; - } + public InputStream getExcelStream() { + return excelStream; + } - public File getMaterialFile() { - return materialFile; - } + public void setExcelStream(InputStream excelStream) { + this.excelStream = excelStream; + } - public void setMaterialFile(File materialFile) { - this.materialFile = materialFile; - } + public File getMaterialFile() { + return materialFile; + } - public String getMpList() { - return mpList; - } + public void setMaterialFile(File materialFile) { + this.materialFile = materialFile; + } - public void setMpList(String mpList) { - this.mpList = mpList; - } + public String getMpList() { + return mpList; + } + + public void setMpList(String mpList) { + this.mpList = mpList; + } } diff --git a/src/main/java/com/jsh/model/vo/materials/MaterialPropertyModel.java b/src/main/java/com/jsh/model/vo/materials/MaterialPropertyModel.java index 8673eb6c..f1d99784 100644 --- a/src/main/java/com/jsh/model/vo/materials/MaterialPropertyModel.java +++ b/src/main/java/com/jsh/model/vo/materials/MaterialPropertyModel.java @@ -3,8 +3,7 @@ package com.jsh.model.vo.materials; import java.io.Serializable; @SuppressWarnings("serial") -public class MaterialPropertyModel implements Serializable -{ +public class MaterialPropertyModel implements Serializable { private MaterialCategoryShowModel showModel = new MaterialCategoryShowModel(); /**======开始接受页面参数=================**/ @@ -12,111 +11,111 @@ public class MaterialPropertyModel implements Serializable * 名称 */ private String nativeName; - + /** * 是否启用 */ - private Boolean enabled = true; + private Boolean enabled = true; /** * 排序 */ private String sort; - /** - * 别名 - */ - private String anotherName; + /** + * 别名 + */ + private String anotherName; + + /** + * Id编号 + */ + private Long id; - /** - * Id编号 - */ - private Long id; - /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - public MaterialCategoryShowModel getShowModel() { - return showModel; - } + public MaterialCategoryShowModel getShowModel() { + return showModel; + } - public void setShowModel(MaterialCategoryShowModel showModel) { - this.showModel = showModel; - } + public void setShowModel(MaterialCategoryShowModel showModel) { + this.showModel = showModel; + } - public String getNativeName() { - return nativeName; - } + public String getNativeName() { + return nativeName; + } - public void setNativeName(String nativeName) { - this.nativeName = nativeName; - } + public void setNativeName(String nativeName) { + this.nativeName = nativeName; + } - public Boolean getEnabled() { - return enabled; - } + public Boolean getEnabled() { + return enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public String getSort() { - return sort; - } + public String getSort() { + return sort; + } - public void setSort(String sort) { - this.sort = sort; - } + public void setSort(String sort) { + this.sort = sort; + } - public String getAnotherName() { - return anotherName; - } + public String getAnotherName() { + return anotherName; + } - public void setAnotherName(String anotherName) { - this.anotherName = anotherName; - } + public void setAnotherName(String anotherName) { + this.anotherName = anotherName; + } - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - public int getPageSize() { - return pageSize; - } + public int getPageSize() { + return pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public int getPageNo() { - return pageNo; - } + public int getPageNo() { + return pageNo; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public String getClientIp() { - return clientIp; - } + public String getClientIp() { + return clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } } diff --git a/src/main/java/com/jsh/model/vo/materials/MaterialPropertyShowModel.java b/src/main/java/com/jsh/model/vo/materials/MaterialPropertyShowModel.java index 5fda4daa..4440b500 100644 --- a/src/main/java/com/jsh/model/vo/materials/MaterialPropertyShowModel.java +++ b/src/main/java/com/jsh/model/vo/materials/MaterialPropertyShowModel.java @@ -6,38 +6,35 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class MaterialPropertyShowModel implements Serializable -{ +public class MaterialPropertyShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - + /** * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } - @SuppressWarnings("rawtypes") - public Map getMap() { - return map; - } + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + - @SuppressWarnings("rawtypes") - public void setMap(Map map) { - this.map = map; - } - - } diff --git a/src/main/java/com/jsh/model/vo/materials/MaterialShowModel.java b/src/main/java/com/jsh/model/vo/materials/MaterialShowModel.java index bcfcd00e..9056215d 100644 --- a/src/main/java/com/jsh/model/vo/materials/MaterialShowModel.java +++ b/src/main/java/com/jsh/model/vo/materials/MaterialShowModel.java @@ -6,38 +6,35 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class MaterialShowModel implements Serializable -{ +public class MaterialShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - + /** * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } - @SuppressWarnings("rawtypes") - public Map getMap() { - return map; - } + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } + - @SuppressWarnings("rawtypes") - public void setMap(Map map) { - this.map = map; - } - - } diff --git a/src/main/java/com/jsh/model/vo/materials/PersonModel.java b/src/main/java/com/jsh/model/vo/materials/PersonModel.java index d6c07271..3c43c69a 100644 --- a/src/main/java/com/jsh/model/vo/materials/PersonModel.java +++ b/src/main/java/com/jsh/model/vo/materials/PersonModel.java @@ -3,8 +3,7 @@ package com.jsh.model.vo.materials; import java.io.Serializable; @SuppressWarnings("serial") -public class PersonModel implements Serializable -{ +public class PersonModel implements Serializable { private PersonShowModel showModel = new PersonShowModel(); /**======开始接受页面参数=================**/ @@ -16,94 +15,94 @@ public class PersonModel implements Serializable * 姓名 */ private String Name = ""; - + /** * 分类ID */ private Long personID = 0l; - + /** * 分类IDs 批量操作使用 */ private String personIDs = ""; - + /** * 每页显示的个数 */ private int pageSize = 10; - + /** * 当前页码 */ private int pageNo = 1; - + /** * 用户IP,用户记录操作日志 */ private String clientIp = ""; - public PersonShowModel getShowModel() { - return showModel; - } + public PersonShowModel getShowModel() { + return showModel; + } - public void setShowModel(PersonShowModel showModel) { - this.showModel = showModel; - } + public void setShowModel(PersonShowModel showModel) { + this.showModel = showModel; + } - public String getType() { - return Type; - } + public String getType() { + return Type; + } - public void setType(String type) { - Type = type; - } + public void setType(String type) { + Type = type; + } - public String getName() { - return Name; - } + public String getName() { + return Name; + } - public void setName(String name) { - Name = name; - } + public void setName(String name) { + Name = name; + } - public Long getPersonID() { - return personID; - } + public Long getPersonID() { + return personID; + } - public void setPersonID(Long personID) { - this.personID = personID; - } + public void setPersonID(Long personID) { + this.personID = personID; + } - public String getPersonIDs() { - return personIDs; - } + public String getPersonIDs() { + return personIDs; + } - public void setPersonIDs(String personIDs) { - this.personIDs = personIDs; - } + public void setPersonIDs(String personIDs) { + this.personIDs = personIDs; + } - public int getPageSize() { - return pageSize; - } + public int getPageSize() { + return pageSize; + } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } - public int getPageNo() { - return pageNo; - } + public int getPageNo() { + return pageNo; + } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } - public String getClientIp() { - return clientIp; - } + public String getClientIp() { + return clientIp; + } + + public void setClientIp(String clientIp) { + this.clientIp = clientIp; + } - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } - } diff --git a/src/main/java/com/jsh/model/vo/materials/PersonShowModel.java b/src/main/java/com/jsh/model/vo/materials/PersonShowModel.java index 5c638090..4162fce7 100644 --- a/src/main/java/com/jsh/model/vo/materials/PersonShowModel.java +++ b/src/main/java/com/jsh/model/vo/materials/PersonShowModel.java @@ -6,37 +6,34 @@ import java.util.List; import java.util.Map; @SuppressWarnings("serial") -public class PersonShowModel implements Serializable -{ +public class PersonShowModel implements Serializable { /** * 提示信息 */ private String msgTip = ""; - + /** * 系统数据 */ @SuppressWarnings("rawtypes") - private Map map = new HashMap(); + private Map map = new HashMap(); - public String getMsgTip() - { + public String getMsgTip() { return msgTip; } - public void setMsgTip(String msgTip) - { + public void setMsgTip(String msgTip) { this.msgTip = msgTip; } - @SuppressWarnings("rawtypes") - public Map getMap() { - return map; - } + @SuppressWarnings("rawtypes") + public Map getMap() { + return map; + } + + @SuppressWarnings("rawtypes") + public void setMap(Map map) { + this.map = map; + } - @SuppressWarnings("rawtypes") - public void setMap(Map map) { - this.map = map; - } - } diff --git a/src/main/java/com/jsh/service/asset/AssetIService.java b/src/main/java/com/jsh/service/asset/AssetIService.java index 77bc7d54..f18a8891 100644 --- a/src/main/java/com/jsh/service/asset/AssetIService.java +++ b/src/main/java/com/jsh/service/asset/AssetIService.java @@ -1,30 +1,30 @@ package com.jsh.service.asset; +import com.jsh.base.BaseIService; +import com.jsh.model.po.Asset; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; + import java.io.File; import java.io.InputStream; -import com.jsh.base.BaseIService; -import com.jsh.util.JshException; -import com.jsh.model.po.Asset; -import com.jsh.util.PageUtil; +public interface AssetIService extends BaseIService { + /** + * 导出信息 + * + * @return + */ + InputStream exmportExcel(String isAllPage, PageUtil pageUtil) throws JshException; -public interface AssetIService extends BaseIService -{ - /** - * 导出信息 - * @return - */ - InputStream exmportExcel(String isAllPage,PageUtil pageUtil)throws JshException; - - /** - * 导入资产excel文件--表格格式 同 媒资列表 || 资产名称-资产类型-单价-用户-购买时间-状态-位置-资产编号-序列号-有效日期-保修日期-供应商-标签-描述 - * 业务规则:导入时,检查资产名称是否存在,如存在就不考虑表格中资产类型。如资产名不存在,就新建资产名,类型用表格中的,但类型必须是系统中存在的,不存在的不能导入。 - * 资产名称,用户可以添加,其他的应该不能填 - * - * @param assetFile excel表格文件 - * @param isCheck 是否检查 0--手工确定 1--直接导入数据库中 - * @return 错误的表格数据 - * @throws JshException - */ - InputStream importExcel(File assetFile,int isCheck)throws JshException; + /** + * 导入资产excel文件--表格格式 同 媒资列表 || 资产名称-资产类型-单价-用户-购买时间-状态-位置-资产编号-序列号-有效日期-保修日期-供应商-标签-描述 + * 业务规则:导入时,检查资产名称是否存在,如存在就不考虑表格中资产类型。如资产名不存在,就新建资产名,类型用表格中的,但类型必须是系统中存在的,不存在的不能导入。 + * 资产名称,用户可以添加,其他的应该不能填 + * + * @param assetFile excel表格文件 + * @param isCheck 是否检查 0--手工确定 1--直接导入数据库中 + * @return 错误的表格数据 + * @throws JshException + */ + InputStream importExcel(File assetFile, int isCheck) throws JshException; } diff --git a/src/main/java/com/jsh/service/asset/AssetService.java b/src/main/java/com/jsh/service/asset/AssetService.java index 568b08db..4c24cb1a 100644 --- a/src/main/java/com/jsh/service/asset/AssetService.java +++ b/src/main/java/com/jsh/service/asset/AssetService.java @@ -1,183 +1,144 @@ package com.jsh.service.asset; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Timestamp; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - +import com.jsh.base.BaseService; +import com.jsh.base.Log; +import com.jsh.dao.asset.AssetIDAO; +import com.jsh.dao.basic.AssetNameIDAO; +import com.jsh.dao.basic.CategoryIDAO; +import com.jsh.dao.basic.SupplierIDAO; +import com.jsh.dao.basic.UserIDAO; +import com.jsh.model.po.Asset; +import com.jsh.model.po.Assetname; +import com.jsh.model.po.Category; +import com.jsh.model.po.Supplier; +import com.jsh.util.AssetConstants; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; +import com.jsh.util.Tools; import jxl.Workbook; import jxl.format.Colour; -import jxl.write.Label; -import jxl.write.WritableCellFormat; -import jxl.write.WritableSheet; -import jxl.write.WritableWorkbook; -import jxl.write.WriteException; - +import jxl.write.*; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.Row; -import com.jsh.base.BaseService; -import com.jsh.base.Log; -import com.jsh.util.AssetConstants; -import com.jsh.dao.asset.AssetIDAO; -import com.jsh.dao.basic.AssetNameIDAO; -import com.jsh.dao.basic.CategoryIDAO; -import com.jsh.dao.basic.SupplierIDAO; -import com.jsh.dao.basic.UserIDAO; -import com.jsh.util.JshException; -import com.jsh.model.po.Asset; -import com.jsh.model.po.Assetname; -import com.jsh.model.po.Category; -import com.jsh.model.po.Supplier; -import com.jsh.util.PageUtil; -import com.jsh.util.Tools; +import java.io.*; +import java.sql.Timestamp; +import java.text.ParseException; +import java.util.*; -public class AssetService extends BaseService implements AssetIService -{ - private AssetIDAO assetDao; - - private AssetNameIDAO assetNameDao; - - private CategoryIDAO categoryDao; - - private SupplierIDAO supplierDao; - - private UserIDAO userDao; - - /** - * 初始化加载所有系统基础数据 - */ - @SuppressWarnings({"rawtypes"}) - private static Map mapData = new HashMap(); - - /** - * 错误的表格数据 - */ - private static List wrongData = new ArrayList(); - - /** - * 导出Excel表格 - */ - @Override - public InputStream exmportExcel(String isAllPage,PageUtil pageUtil)throws JshException - { - try - { - if("currentPage".equals(isAllPage)) - { - assetDao.find(pageUtil); - } - else - { - pageUtil.setCurPage(0); - pageUtil.setPageSize(0); - assetDao.find(pageUtil); - } - - //将OutputStream转化为InputStream - ByteArrayOutputStream out = new ByteArrayOutputStream(); - putDataOnOutputStream(out,pageUtil.getPageList()); - return new ByteArrayInputStream(out.toByteArray()); - } - catch (Exception e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e); - throw new JshException("export asset info to excel exception",e); - } - } - - @Override - public InputStream importExcel(File assetFile,int isCheck) throws JshException - { - //全局变量--每次调用前需要清空数据 - mapData.clear(); - //1、加载系统基础数据 - loadSystemData(); - //2、解析文件成资产数据 - parseFile(assetFile); - - if(null != wrongData && wrongData.size()>0) - { - //将OutputStream转化为InputStream - ByteArrayOutputStream out = new ByteArrayOutputStream(); - putDataOnOutputStream(out,wrongData); - return new ByteArrayInputStream(out.toByteArray()); - } - else - return null; - //2、是否直接插入数据库中 +public class AssetService extends BaseService implements AssetIService { + /** + * 初始化加载所有系统基础数据 + */ + @SuppressWarnings({"rawtypes"}) + private static Map mapData = new HashMap(); + /** + * 错误的表格数据 + */ + private static List wrongData = new ArrayList(); + private AssetIDAO assetDao; + private AssetNameIDAO assetNameDao; + private CategoryIDAO categoryDao; + private SupplierIDAO supplierDao; + private UserIDAO userDao; + + /** + * 导出Excel表格 + */ + @Override + public InputStream exmportExcel(String isAllPage, PageUtil pageUtil) throws JshException { + try { + if ("currentPage".equals(isAllPage)) { + assetDao.find(pageUtil); + } else { + pageUtil.setCurPage(0); + pageUtil.setPageSize(0); + assetDao.find(pageUtil); + } + + //将OutputStream转化为InputStream + ByteArrayOutputStream out = new ByteArrayOutputStream(); + putDataOnOutputStream(out, pageUtil.getPageList()); + return new ByteArrayInputStream(out.toByteArray()); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e); + throw new JshException("export asset info to excel exception", e); + } + } + + @Override + public InputStream importExcel(File assetFile, int isCheck) throws JshException { + //全局变量--每次调用前需要清空数据 + mapData.clear(); + //1、加载系统基础数据 + loadSystemData(); + //2、解析文件成资产数据 + parseFile(assetFile); + + if (null != wrongData && wrongData.size() > 0) { + //将OutputStream转化为InputStream + ByteArrayOutputStream out = new ByteArrayOutputStream(); + putDataOnOutputStream(out, wrongData); + return new ByteArrayInputStream(out.toByteArray()); + } else + return null; + //2、是否直接插入数据库中 // if(0 == isCheck) // System.out.println("手动检查"); // else // System.out.println("自动检查插入"); - } - - /** + } + + /** * 初始加载系统基础数据--导入过程中,不用频繁查询数据库内容,影响系统性能。 + * * @throws JshException */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - private void loadSystemData()throws JshException - { - PageUtil pageUtil = new PageUtil(); + @SuppressWarnings({"unchecked", "rawtypes"}) + private void loadSystemData() throws JshException { + PageUtil pageUtil = new PageUtil(); pageUtil.setPageSize(0); pageUtil.setCurPage(0); - try - { - Map condition = pageUtil.getAdvSearch(); + try { + Map condition = pageUtil.getAdvSearch(); condition.put("id_s_order", "desc"); categoryDao.find(pageUtil); mapData.put("categoryList", pageUtil.getPageList()); - + supplierDao.find(pageUtil); mapData.put("supplierList", pageUtil.getPageList()); - + condition.put("isystem_n_eq", 1); condition.put("id_s_order", "desc"); userDao.find(pageUtil); mapData.put("userList", pageUtil.getPageList()); - + //清除搜索条件 防止对查询有影响 condition.remove("isystem_n_eq"); - + assetNameDao.find(pageUtil); mapData.put("assetnameList", pageUtil.getPageList()); - } - catch (Exception e) - { + } catch (Exception e) { Log.errorFileSync(">>>>>>>>>>>>>查找系统基础数据信息异常", e); } } - - /** - * 解析excel表格 - * @param assetFile - */ - @SuppressWarnings("unchecked") - private void parseFile(File assetFile) - { - //每次调用前清空 - wrongData.clear(); - int totalRow = 0; - try - { + + /** + * 解析excel表格 + * + * @param assetFile + */ + @SuppressWarnings("unchecked") + private void parseFile(File assetFile) { + //每次调用前清空 + wrongData.clear(); + int totalRow = 0; + try { //创建对Excel工作簿文件的引用 - HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(assetFile)); + HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(assetFile)); //创建对工作表的引用,获取第一个工作表的内容 HSSFSheet sheet = workbook.getSheetAt(0); /** @@ -187,78 +148,72 @@ public class AssetService extends BaseService implements AssetIService * 3、如果是修改过的文件内容 */ Iterator itsheet = sheet.rowIterator(); - while(itsheet.hasNext()) - { + while (itsheet.hasNext()) { //获取当前行数据 Row row = itsheet.next(); //获取一行有多少单元格 // System.out.println(row.getLastCellNum()); - + //excel表格第几行数据 从1开始 0 是表头 int rowNum = row.getRowNum(); /** * 表头跳过不读 */ - if(AssetConstants.BusinessForExcel.EXCEL_TABLE_HEAD == rowNum) + if (AssetConstants.BusinessForExcel.EXCEL_TABLE_HEAD == rowNum) continue; - + //开始处理excel表格内容 --每行数据读取,同时统计总共行数 - totalRow ++; - + totalRow++; + //获取excel表格的每格数据内容 Iterator it = row.cellIterator(); //资产子类型--添加了一些excel表格数据 Asset asset = new Asset(); //保存每个单元格错误类型 - Map cellType = new HashMap(); - + Map cellType = new HashMap(); + //名称需要类型字段 Assetname nameModel = null; //资产名称 - @SuppressWarnings("unused") - String assetname = ""; - + @SuppressWarnings("unused") + String assetname = ""; + //资产类型 String categoryStr = ""; //设置列号 asset.setRowLineNum(rowNum); - + Cell cell = null; //判断列号--从零开始 int cellIndex = 0; - while(it.hasNext()) - { + while (it.hasNext()) { //获取每个单元格对象 cell = it.next(); //获取列号 cellIndex = cell.getColumnIndex(); //设置此单元格为字符串类型 cell.setCellType(Cell.CELL_TYPE_STRING); - + Log.infoFileSync("==================excel表格中第" + totalRow + "行的第 " + cellIndex + "列的值为" + cell.getStringCellValue()); - + //每行中数据顺序 资产名称-资产类型-单价-用户-购买时间-状态-位置-资产编号-序列号-有效日期-保修日期-供应商-标签-描述 - switch(cellIndex) - { - case AssetConstants.BusinessForExcel.EXCEL_ASSETNAME : + switch (cellIndex) { + case AssetConstants.BusinessForExcel.EXCEL_ASSETNAME: //资产名称是否存在 boolean isAssetnameExist = false; //此处添加资产名称处理 String nameValue = cell.getStringCellValue(); - if(null == nameValue || "".equals(nameValue)) - { + if (null == nameValue || "".equals(nameValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产名称没有填写"); cellType.put(cellIndex, "wrong"); break; } assetname = nameValue; - + List nameList = mapData.get("assetnameList"); - for(Assetname name:nameList) - { + for (Assetname name : nameList) { //表示名称存在--直接进行保存,不需要判断类型字段 - if(nameValue.equals(name.getAssetname())) - { + if (nameValue.equals(name.getAssetname())) { isAssetnameExist = true; //直接进行设置 asset.setAssetname(name); @@ -266,37 +221,33 @@ public class AssetService extends BaseService implements AssetIService } } //名称不存在 重新创建 - if(!isAssetnameExist) - { + if (!isAssetnameExist) { isAssetnameExist = false; nameModel = new Assetname(); nameModel.setAssetname(nameValue); - nameModel.setIsconsumables((short)0); - nameModel.setIsystem((short)1); + nameModel.setIsconsumables((short) 0); + nameModel.setIsystem((short) 1); nameModel.setDescription(""); - + asset.setAssetnameStr(nameValue); } break; - case AssetConstants.BusinessForExcel.EXCEL_CATEGORY : + case AssetConstants.BusinessForExcel.EXCEL_CATEGORY: //此处添加资产类型处理 //类型信息是否存在 boolean isCategoryExist = false; String categoryValue = cell.getStringCellValue(); - if((null == categoryValue || "".equals(categoryValue)) && null != nameModel) - { + if ((null == categoryValue || "".equals(categoryValue)) && null != nameModel) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产名称没有指定类型"); cellType.put(cellIndex, "wrong"); break; } categoryStr = categoryValue; - + List categoryList = mapData.get("categoryList"); - for(Category category:categoryList) - { + for (Category category : categoryList) { //表示新创建 --名称设置过 不需要再进行处理 - if(category.getAssetname().equals(categoryValue) && null != nameModel) - { + if (category.getAssetname().equals(categoryValue) && null != nameModel) { isCategoryExist = true; nameModel.setCategory(category); asset.setAssetname(nameModel); @@ -305,24 +256,22 @@ public class AssetService extends BaseService implements AssetIService } } //重新创建 - if(null != nameModel && !isCategoryExist) - { + if (null != nameModel && !isCategoryExist) { //首先创建类型信息 Category canew = new Category(); canew.setAssetname(categoryValue); - canew.setIsystem((short)1); + canew.setIsystem((short) 1); canew.setDescription(""); categoryDao.create(canew); - + nameModel.setCategory(canew); - + assetNameDao.create(nameModel); - + asset.setAssetname(nameModel); } //nameModel为空表示 已经处理过类型信息 --此处不需要进行处理 - else - { + else { asset.setCategory(categoryStr); } break; @@ -330,166 +279,136 @@ public class AssetService extends BaseService implements AssetIService //此处添加单价处理 String priceValue = cell.getStringCellValue(); //String priceValue = getCellFormatValue(cell); - if(null == priceValue || "".equals(priceValue)) - { + if (null == priceValue || "".equals(priceValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写单价"); break; } //解析价格 - if(Tools.checkStrIsNum(priceValue)) + if (Tools.checkStrIsNum(priceValue)) asset.setPrice(Double.parseDouble(priceValue)); - else - { + else { Log.errorFileSync(">>>>>>>>>>>>>>>>>资产价格不是数字格式"); cellType.put(cellIndex, "wrong"); asset.setPrice(0.00d); asset.setPriceStr(priceValue); } break; - case AssetConstants.BusinessForExcel.EXCEL_USER : + case AssetConstants.BusinessForExcel.EXCEL_USER: //此处添加用户处理--用户信息不需要进行处理 break; - case AssetConstants.BusinessForExcel.EXCEL_PURCHASE_DATE : + case AssetConstants.BusinessForExcel.EXCEL_PURCHASE_DATE: //此处添加购买时间处理--时间不需要处理 - String purchaseValue = cell.getStringCellValue(); - if(null == purchaseValue || "".equals(purchaseValue)) - { + String purchaseValue = cell.getStringCellValue(); + if (null == purchaseValue || "".equals(purchaseValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写购买日期"); break; } - try - { + try { asset.setPurchasedate(new Timestamp(Tools.parse(purchaseValue, "yyyy-MM-dd").getTime())); - } - catch (ParseException e) - { + } catch (ParseException e) { Log.errorFileSync(">>>>>>>>>>>>>>>>>解析购买日期异常", e); - try - { + try { asset.setPurchasedate(new Timestamp(DateUtil.getJavaDate(Double.parseDouble(purchaseValue)).getTime())); - } - catch (Exception t) - { + } catch (Exception t) { asset.setPurchasedateStr(purchaseValue); cellType.put(cellIndex, "wrong"); } } break; - case AssetConstants.BusinessForExcel.EXCEL_STATUS : + case AssetConstants.BusinessForExcel.EXCEL_STATUS: //此处添加状态处理--默认为在库状态 - asset.setStatus((short)0); + asset.setStatus((short) 0); break; - case AssetConstants.BusinessForExcel.EXCEL_LOCATION : + case AssetConstants.BusinessForExcel.EXCEL_LOCATION: //此处添加位置处理--不需要进行处理 String locationValue = cell.getStringCellValue(); - if(null == locationValue || "".equals(locationValue)) - { + if (null == locationValue || "".equals(locationValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写位置信息"); break; } asset.setLocation(locationValue); break; - case AssetConstants.BusinessForExcel.EXCEL_NUM : + case AssetConstants.BusinessForExcel.EXCEL_NUM: //此处添加资产编号处理 String assetnumValue = cell.getStringCellValue(); - if(null == assetnumValue || "".equals(assetnumValue)) - { + if (null == assetnumValue || "".equals(assetnumValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写资产编号"); break; } //设置资产编号 asset.setAssetnum(assetnumValue); break; - case AssetConstants.BusinessForExcel.EXCEL_SERIALNO : + case AssetConstants.BusinessForExcel.EXCEL_SERIALNO: //此处添加序列号处理 String assetseriValue = cell.getStringCellValue(); - if(null == assetseriValue || "".equals(assetseriValue)) - { + if (null == assetseriValue || "".equals(assetseriValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写序列号"); break; } //设置资产编号 asset.setSerialnum(assetseriValue); break; - case AssetConstants.BusinessForExcel.EXCEL_EXPIRATION_DATE : + case AssetConstants.BusinessForExcel.EXCEL_EXPIRATION_DATE: //此处添加有效日期处理--不需要处理 String expirationValue = cell.getStringCellValue(); - if(null == expirationValue || "".equals(expirationValue)) - { + if (null == expirationValue || "".equals(expirationValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有有效日期"); break; } - - try - { + + try { asset.setPeriodofvalidity(new Timestamp(Tools.parse(expirationValue, "yyyy-MM-dd").getTime())); - } - catch (ParseException e) - { - try - { + } catch (ParseException e) { + try { asset.setPeriodofvalidity(new Timestamp(DateUtil.getJavaDate(Double.parseDouble(expirationValue)).getTime())); - } - catch (Exception t) - { + } catch (Exception t) { Log.errorFileSync(">>>>>>>>>>>>>>>>>解析有效日期异常", t); asset.setPeriodofvalidityStr(expirationValue); cellType.put(cellIndex, "wrong"); } } break; - case AssetConstants.BusinessForExcel.EXCEL_WARRANTY_DATE : + case AssetConstants.BusinessForExcel.EXCEL_WARRANTY_DATE: //此处添加保修日期处理--不需要处理 String warrantyValue = cell.getStringCellValue(); - if(null == warrantyValue || "".equals(warrantyValue)) - { + if (null == warrantyValue || "".equals(warrantyValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有保修日期"); break; } - try - { + try { asset.setWarrantydate(new Timestamp(Tools.parse(warrantyValue, "yyyy-MM-dd").getTime())); - } - catch (ParseException e) - { - try - { + } catch (ParseException e) { + try { asset.setWarrantydate(new Timestamp(DateUtil.getJavaDate(Double.parseDouble(warrantyValue)).getTime())); - } - catch (Exception t) - { + } catch (Exception t) { Log.errorFileSync(">>>>>>>>>>>>>>>>>解析保修日期异常", t); asset.setWarrantydateStr(warrantyValue); cellType.put(cellIndex, "wrong"); } } break; - case AssetConstants.BusinessForExcel.EXCEL_SUPPLIER : + case AssetConstants.BusinessForExcel.EXCEL_SUPPLIER: //此处添加供应商处理 - + String supplierValue = cell.getStringCellValue(); - if(null == supplierValue || "".equals(supplierValue)) - { + if (null == supplierValue || "".equals(supplierValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写供应商"); cellType.put(cellIndex, "wrong"); break; } //供应商 List supplierList = mapData.get("supplierList"); - boolean isSupplerExist =false; - for(Supplier supplier:supplierList) - { - if(supplierValue.equals(supplier.getSupplier())) - { - isSupplerExist =true; - asset.setSupplier(supplier); - break; - } + boolean isSupplerExist = false; + for (Supplier supplier : supplierList) { + if (supplierValue.equals(supplier.getSupplier())) { + isSupplerExist = true; + asset.setSupplier(supplier); + break; + } } - if(!isSupplerExist) - { + if (!isSupplerExist) { Supplier sup = new Supplier(); - sup.setIsystem((short)1); + sup.setIsystem((short) 1); sup.setSupplier(supplierValue); sup.setDescription(""); supplierDao.create(sup); @@ -497,21 +416,19 @@ public class AssetService extends BaseService implements AssetIService asset.setSupplier(sup); } break; - case AssetConstants.BusinessForExcel.EXCEL_LABLE : + case AssetConstants.BusinessForExcel.EXCEL_LABLE: //此处添加标签处理 String lableValue = cell.getStringCellValue(); - if(null == lableValue || "".equals(lableValue)) - { + if (null == lableValue || "".equals(lableValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写标签信息"); break; } asset.setLabels(lableValue); break; - case AssetConstants.BusinessForExcel.EXCEL_DESC : + case AssetConstants.BusinessForExcel.EXCEL_DESC: //此处添加描述信息处理 String descValue = cell.getStringCellValue(); - if(null == descValue || "".equals(descValue)) - { + if (null == descValue || "".equals(descValue)) { Log.errorFileSync(">>>>>>>>>>>>>>>>资产没有填写描述信息"); break; } @@ -522,7 +439,7 @@ public class AssetService extends BaseService implements AssetIService asset.setCreatetime(new Timestamp(Calendar.getInstance().getTime().getTime())); asset.setUpdatetime(new Timestamp(Calendar.getInstance().getTime().getTime())); asset.setCellInfo(cellType); - + Log.infoFileSync(totalRow + "行总共有" + cellIndex + "列"); //资产文件为13列,否则不是资产模板文件--不输入的时候 判断会有问题 暂时去掉 // if(cellIndex != 13) @@ -530,217 +447,183 @@ public class AssetService extends BaseService implements AssetIService // Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>导入文件格式不合法,请重新选择文件进行操作!"); // return; // } - + //判断完成后增加数据 - if((null!=cellType && cellType.size() >0) + if ((null != cellType && cellType.size() > 0) || asset.getAssetname() == null || asset.getAssetname().getCategory() == null) wrongData.add(asset); - else - { - if(null == asset.getStatus()) - asset.setStatus((short)0); - assetDao.save(asset); + else { + if (null == asset.getStatus()) + asset.setStatus((short) 0); + assetDao.save(asset); } - } - } - catch (FileNotFoundException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!",e); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !",e); - } - Log.infoFileSync("===================excel表格总共有 " + totalRow + " 条记录!"); - } - - /** - * 生成excel表格 - * @param os - */ - private void putDataOnOutputStream(OutputStream os,List dataList) - { - WritableWorkbook workbook = null; - try - { - workbook = Workbook.createWorkbook(os); - WritableSheet sheet = workbook.createSheet("资产详细信息", 0); - //增加列头 - int[] colunmWidth = {30,30,10,15,20,10,30,30,30,20,20,20,30,80}; - String[] colunmName = {"资产名称","资产类型","单价","用户","购买时间","状态","位置","资产编号","序列号","有效日期","保修日期","供应商","标签","描述"}; - for(int i = 0 ;i < colunmWidth.length;i ++) - { - sheet.setColumnView(i,colunmWidth[i]); - sheet.addCell(new Label(i, 0, colunmName[i])); - } - - if (null != dataList &&dataList.size() > 0) - { - int i = 1; - for (Asset asset: dataList) - { - int j = 0; - Map cellInfo = asset.getCellInfo(); - - //第一列,填充 数据, Label(列,行,值) - sheet.addCell(getLabelInfo(cellInfo,j++,i,asset.getAssetname() == null ?"":asset.getAssetname().getAssetname(),asset)); - sheet.addCell(getLabelInfo(cellInfo,j++,i,asset.getAssetname() == null || asset.getAssetname().getCategory() == null ?"":asset.getAssetname().getCategory().getAssetname(),asset)); - sheet.addCell(getLabelInfo(cellInfo,j++,i,asset.getPrice() == null?"":asset.getPrice().toString(),asset)); - sheet.addCell(new Label(j++, i, asset.getUser()==null?"":asset.getUser().getUsername())); - sheet.addCell(getLabelInfo(cellInfo,j++,i,asset.getPurchasedate() == null ?"":Tools.getCurrentMonth(asset.getPurchasedate()),asset)); - Short status = asset.getStatus(); - if(null == status) - status = 0 ; - if(AssetConstants.BusinessForExcel.EXCEl_STATUS_ZAIKU == status) - sheet.addCell(new Label(j++, i, "在库")); - else if(AssetConstants.BusinessForExcel.EXCEl_STATUS_INUSE == status) - sheet.addCell(new Label(j++, i, "在用")); - else if(AssetConstants.BusinessForExcel.EXCEl_STATUS_CONSUME == status) - sheet.addCell(new Label(j++, i, "消费")); - sheet.addCell(new Label(j++, i, asset.getLocation())); - sheet.addCell(new Label(j++, i, asset.getAssetnum())); - sheet.addCell(new Label(j++, i, asset.getSerialnum())); - sheet.addCell(getLabelInfo(cellInfo,j++,i, asset.getPeriodofvalidity() == null ?"":Tools.getCurrentMonth(asset.getPeriodofvalidity()),asset)); - sheet.addCell(getLabelInfo(cellInfo,j++,i,asset.getWarrantydate() == null ?"":Tools.getCurrentMonth(asset.getWarrantydate()),asset)); - sheet.addCell(new Label(j++, i, asset.getSupplier()==null?"":asset.getSupplier().getSupplier())); - sheet.addCell(new Label(j++, i, asset.getLabels())); - sheet.addCell(new Label(j++, i, asset.getDescription())); - - i++; - } - } - workbook.write(); - workbook.close(); - } - catch (Exception e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e); - } - } - - /** - * 根据错误信息进行提示--execel表格背景设置为红色,表示导入信息有误 - * @param cellInfo - * @param cellNum - * @param columnNum - * @param value - * @return - */ - private Label getLabelInfo(Map cellInfo,int cellNum,int columnNum,String value,Asset asset) - { - Label label = null; - - //设置背景颜色 - WritableCellFormat cellFormat = new WritableCellFormat(); - try - { - cellFormat.setBackground(Colour.RED); - } - catch (WriteException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误", e); - } - - if(null == cellInfo || cellInfo.size() == 0) - { - if(cellNum == AssetConstants.BusinessForExcel.EXCEL_ASSETNAME) - { - if(null == asset.getAssetname() && null != asset.getAssetnameStr()) - label = new Label(cellNum, columnNum,asset.getAssetnameStr()); - else if(null != asset.getAssetname()) - label = new Label(cellNum, columnNum, value); - else - label = new Label(cellNum, columnNum, null,cellFormat); } - else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_CATEGORY) - { - if(null != asset.getAssetnameStr() && null == asset.getAssetname()) - label = new Label(cellNum, columnNum, null,cellFormat); - else if(null == asset.getAssetnameStr() && null == asset.getAssetname() - && asset.getCategory() != null &&asset.getCategory().length()>0) - label = new Label(cellNum, columnNum, asset.getCategory()); + } catch (FileNotFoundException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !", e); + } + Log.infoFileSync("===================excel表格总共有 " + totalRow + " 条记录!"); + } + + /** + * 生成excel表格 + * + * @param os + */ + private void putDataOnOutputStream(OutputStream os, List dataList) { + WritableWorkbook workbook = null; + try { + workbook = Workbook.createWorkbook(os); + WritableSheet sheet = workbook.createSheet("资产详细信息", 0); + //增加列头 + int[] colunmWidth = {30, 30, 10, 15, 20, 10, 30, 30, 30, 20, 20, 20, 30, 80}; + String[] colunmName = {"资产名称", "资产类型", "单价", "用户", "购买时间", "状态", "位置", "资产编号", "序列号", "有效日期", "保修日期", "供应商", "标签", "描述"}; + for (int i = 0; i < colunmWidth.length; i++) { + sheet.setColumnView(i, colunmWidth[i]); + sheet.addCell(new Label(i, 0, colunmName[i])); + } + + if (null != dataList && dataList.size() > 0) { + int i = 1; + for (Asset asset : dataList) { + int j = 0; + Map cellInfo = asset.getCellInfo(); + + //第一列,填充 数据, Label(列,行,值) + sheet.addCell(getLabelInfo(cellInfo, j++, i, asset.getAssetname() == null ? "" : asset.getAssetname().getAssetname(), asset)); + sheet.addCell(getLabelInfo(cellInfo, j++, i, asset.getAssetname() == null || asset.getAssetname().getCategory() == null ? "" : asset.getAssetname().getCategory().getAssetname(), asset)); + sheet.addCell(getLabelInfo(cellInfo, j++, i, asset.getPrice() == null ? "" : asset.getPrice().toString(), asset)); + sheet.addCell(new Label(j++, i, asset.getUser() == null ? "" : asset.getUser().getUsername())); + sheet.addCell(getLabelInfo(cellInfo, j++, i, asset.getPurchasedate() == null ? "" : Tools.getCurrentMonth(asset.getPurchasedate()), asset)); + Short status = asset.getStatus(); + if (null == status) + status = 0; + if (AssetConstants.BusinessForExcel.EXCEl_STATUS_ZAIKU == status) + sheet.addCell(new Label(j++, i, "在库")); + else if (AssetConstants.BusinessForExcel.EXCEl_STATUS_INUSE == status) + sheet.addCell(new Label(j++, i, "在用")); + else if (AssetConstants.BusinessForExcel.EXCEl_STATUS_CONSUME == status) + sheet.addCell(new Label(j++, i, "消费")); + sheet.addCell(new Label(j++, i, asset.getLocation())); + sheet.addCell(new Label(j++, i, asset.getAssetnum())); + sheet.addCell(new Label(j++, i, asset.getSerialnum())); + sheet.addCell(getLabelInfo(cellInfo, j++, i, asset.getPeriodofvalidity() == null ? "" : Tools.getCurrentMonth(asset.getPeriodofvalidity()), asset)); + sheet.addCell(getLabelInfo(cellInfo, j++, i, asset.getWarrantydate() == null ? "" : Tools.getCurrentMonth(asset.getWarrantydate()), asset)); + sheet.addCell(new Label(j++, i, asset.getSupplier() == null ? "" : asset.getSupplier().getSupplier())); + sheet.addCell(new Label(j++, i, asset.getLabels())); + sheet.addCell(new Label(j++, i, asset.getDescription())); + + i++; + } + } + workbook.write(); + workbook.close(); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e); + } + } + + /** + * 根据错误信息进行提示--execel表格背景设置为红色,表示导入信息有误 + * + * @param cellInfo + * @param cellNum + * @param columnNum + * @param value + * @return + */ + private Label getLabelInfo(Map cellInfo, int cellNum, int columnNum, String value, Asset asset) { + Label label = null; + + //设置背景颜色 + WritableCellFormat cellFormat = new WritableCellFormat(); + try { + cellFormat.setBackground(Colour.RED); + } catch (WriteException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误", e); + } + + if (null == cellInfo || cellInfo.size() == 0) { + if (cellNum == AssetConstants.BusinessForExcel.EXCEL_ASSETNAME) { + if (null == asset.getAssetname() && null != asset.getAssetnameStr()) + label = new Label(cellNum, columnNum, asset.getAssetnameStr()); + else if (null != asset.getAssetname()) + label = new Label(cellNum, columnNum, value); + else + label = new Label(cellNum, columnNum, null, cellFormat); + } else if (cellNum == AssetConstants.BusinessForExcel.EXCEL_CATEGORY) { + if (null != asset.getAssetnameStr() && null == asset.getAssetname()) + label = new Label(cellNum, columnNum, null, cellFormat); + else if (null == asset.getAssetnameStr() && null == asset.getAssetname() + && asset.getCategory() != null && asset.getCategory().length() > 0) + label = new Label(cellNum, columnNum, asset.getCategory()); + else + label = new Label(cellNum, columnNum, value); + } else + label = new Label(cellNum, columnNum, value); + } else { + //表示此单元格有错误 + if (cellInfo.containsKey(cellNum)) { + if (cellNum == AssetConstants.BusinessForExcel.EXCEL_ASSETNAME) { + if (null == asset.getAssetname() && null != asset.getAssetnameStr()) + label = new Label(cellNum, columnNum, asset.getAssetnameStr()); + if (null != asset.getAssetname()) + label = new Label(cellNum, columnNum, asset.getAssetname().getAssetname()); + else + label = new Label(cellNum, columnNum, value, cellFormat); + } else if (cellNum == AssetConstants.BusinessForExcel.EXCEL_CATEGORY) { + if (null != asset.getAssetnameStr() && null == asset.getAssetname()) + label = new Label(cellNum, columnNum, null, cellFormat); + else if (null == asset.getAssetnameStr() && null == asset.getAssetname() + && asset.getCategory() != null && asset.getCategory().length() > 0) + label = new Label(cellNum, columnNum, asset.getCategory()); + } else if (cellNum == AssetConstants.BusinessForExcel.EXCEL_PRICE) + label = new Label(cellNum, columnNum, asset.getPriceStr(), cellFormat); + else if (cellNum == AssetConstants.BusinessForExcel.EXCEL_PURCHASE_DATE) + label = new Label(cellNum, columnNum, asset.getPurchasedateStr(), cellFormat); + else if (cellNum == AssetConstants.BusinessForExcel.EXCEL_WARRANTY_DATE) + label = new Label(cellNum, columnNum, asset.getWarrantydateStr(), cellFormat); + else if (cellNum == AssetConstants.BusinessForExcel.EXCEL_EXPIRATION_DATE) + label = new Label(cellNum, columnNum, asset.getPeriodofvalidityStr(), cellFormat); + else + label = new Label(cellNum, columnNum, value, cellFormat); + } else { + if (null == asset.getAssetname() && null != asset.getAssetnameStr() && cellNum == 0) + label = new Label(cellNum, columnNum, asset.getAssetnameStr()); + else if (null == asset.getAssetnameStr() && null == asset.getAssetname() + && asset.getCategory() != null && asset.getCategory().length() > 0 && cellNum == 1) + label = new Label(cellNum, columnNum, asset.getCategory()); else label = new Label(cellNum, columnNum, value); } - else - label = new Label(cellNum, columnNum, value); - } - else - { - //表示此单元格有错误 - if(cellInfo.containsKey(cellNum)) - { - if(cellNum == AssetConstants.BusinessForExcel.EXCEL_ASSETNAME) - { - if(null == asset.getAssetname() && null != asset.getAssetnameStr()) - label = new Label(cellNum, columnNum,asset.getAssetnameStr()); - if(null != asset.getAssetname()) - label = new Label(cellNum, columnNum,asset.getAssetname().getAssetname()); - else - label = new Label(cellNum, columnNum, value,cellFormat); - } - else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_CATEGORY) - { - if(null != asset.getAssetnameStr() && null == asset.getAssetname()) - label = new Label(cellNum, columnNum, null,cellFormat); - else if(null == asset.getAssetnameStr() && null == asset.getAssetname() - && asset.getCategory() != null &&asset.getCategory().length()>0) - label = new Label(cellNum, columnNum, asset.getCategory()); - } - else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_PRICE) - label = new Label(cellNum, columnNum,asset.getPriceStr(),cellFormat); - else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_PURCHASE_DATE) - label = new Label(cellNum, columnNum,asset.getPurchasedateStr(),cellFormat); - else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_WARRANTY_DATE) - label = new Label(cellNum, columnNum,asset.getWarrantydateStr(),cellFormat); - else if(cellNum == AssetConstants.BusinessForExcel.EXCEL_EXPIRATION_DATE) - label = new Label(cellNum, columnNum,asset.getPeriodofvalidityStr(),cellFormat); - else - label = new Label(cellNum, columnNum, value,cellFormat); - } - else - { - if(null == asset.getAssetname() && null != asset.getAssetnameStr()&& cellNum == 0) - label = new Label(cellNum, columnNum,asset.getAssetnameStr()); - else if(null == asset.getAssetnameStr() && null == asset.getAssetname() - && asset.getCategory() != null &&asset.getCategory().length()>0&& cellNum == 1) - label = new Label(cellNum, columnNum, asset.getCategory()); - else - label = new Label(cellNum, columnNum, value); - } - } - return label; - } - - /*=====================以下处理与业务无关的共用方法=================================*/ - public void setAssetDao(AssetIDAO assetDao) - { + } + return label; + } + + /*=====================以下处理与业务无关的共用方法=================================*/ + public void setAssetDao(AssetIDAO assetDao) { this.assetDao = assetDao; } - public void setAssetNameDao(AssetNameIDAO assetNameDao) - { + public void setAssetNameDao(AssetNameIDAO assetNameDao) { this.assetNameDao = assetNameDao; } - public void setCategoryDao(CategoryIDAO categoryDao) - { + public void setCategoryDao(CategoryIDAO categoryDao) { this.categoryDao = categoryDao; } - public void setSupplierDao(SupplierIDAO supplierDao) - { + public void setSupplierDao(SupplierIDAO supplierDao) { this.supplierDao = supplierDao; } - public void setUserDao(UserIDAO userDao) - { + public void setUserDao(UserIDAO userDao) { this.userDao = userDao; } @Override - protected Class getEntityClass() - { + protected Class getEntityClass() { return Asset.class; } } diff --git a/src/main/java/com/jsh/service/asset/ReportIService.java b/src/main/java/com/jsh/service/asset/ReportIService.java index edd60a22..c8cd3234 100644 --- a/src/main/java/com/jsh/service/asset/ReportIService.java +++ b/src/main/java/com/jsh/service/asset/ReportIService.java @@ -1,15 +1,15 @@ package com.jsh.service.asset; -import com.jsh.util.JshException; import com.jsh.model.po.Asset; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public interface ReportIService -{ +public interface ReportIService { /** * 查找报表数据 + * * @param asset * @throws JshException */ - void find(PageUtil asset,String reportType,String reportName)throws JshException; + void find(PageUtil asset, String reportType, String reportName) throws JshException; } diff --git a/src/main/java/com/jsh/service/asset/ReportService.java b/src/main/java/com/jsh/service/asset/ReportService.java index f4baa017..6ad9f958 100644 --- a/src/main/java/com/jsh/service/asset/ReportService.java +++ b/src/main/java/com/jsh/service/asset/ReportService.java @@ -1,23 +1,20 @@ package com.jsh.service.asset; import com.jsh.dao.asset.ReportIDAO; -import com.jsh.util.JshException; import com.jsh.model.po.Asset; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public class ReportService implements ReportIService -{ +public class ReportService implements ReportIService { private ReportIDAO reportDao; - public void setReportDao(ReportIDAO reportDao) - { + public void setReportDao(ReportIDAO reportDao) { this.reportDao = reportDao; } @Override - public void find(PageUtil pageUtil, String reportType,String reportName) throws JshException - { - reportDao.find(pageUtil, reportType,reportName); + public void find(PageUtil pageUtil, String reportType, String reportName) throws JshException { + reportDao.find(pageUtil, reportType, reportName); } - + } diff --git a/src/main/java/com/jsh/service/basic/AccountIService.java b/src/main/java/com/jsh/service/basic/AccountIService.java index d3811429..7e2615c5 100644 --- a/src/main/java/com/jsh/service/basic/AccountIService.java +++ b/src/main/java/com/jsh/service/basic/AccountIService.java @@ -5,7 +5,6 @@ import com.jsh.model.po.Account; import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public interface AccountIService extends BaseIService -{ - public void findAccountInOutList(PageUtil depotHead, Long accountId)throws JshException; +public interface AccountIService extends BaseIService { + public void findAccountInOutList(PageUtil depotHead, Long accountId) throws JshException; } diff --git a/src/main/java/com/jsh/service/basic/AccountService.java b/src/main/java/com/jsh/service/basic/AccountService.java index f5c03f8d..01d30dfa 100644 --- a/src/main/java/com/jsh/service/basic/AccountService.java +++ b/src/main/java/com/jsh/service/basic/AccountService.java @@ -1,23 +1,21 @@ package com.jsh.service.basic; + import com.jsh.base.BaseService; import com.jsh.dao.basic.AccountIDAO; import com.jsh.model.po.Account; import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public class AccountService extends BaseService implements AccountIService -{ +public class AccountService extends BaseService implements AccountIService { @SuppressWarnings("unused") private AccountIDAO accountDao; - public void setAccountDao(AccountIDAO accountDao) - { + public void setAccountDao(AccountIDAO accountDao) { this.accountDao = accountDao; } - + @Override - protected Class getEntityClass() - { + protected Class getEntityClass() { return Account.class; } diff --git a/src/main/java/com/jsh/service/basic/AppIService.java b/src/main/java/com/jsh/service/basic/AppIService.java index 84810fb6..a5e575be 100644 --- a/src/main/java/com/jsh/service/basic/AppIService.java +++ b/src/main/java/com/jsh/service/basic/AppIService.java @@ -3,7 +3,6 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; import com.jsh.model.po.App; -public interface AppIService extends BaseIService -{ - +public interface AppIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/basic/AppService.java b/src/main/java/com/jsh/service/basic/AppService.java index dbb05645..b8140850 100644 --- a/src/main/java/com/jsh/service/basic/AppService.java +++ b/src/main/java/com/jsh/service/basic/AppService.java @@ -5,27 +5,24 @@ import com.jsh.dao.basic.AppIDAO; import com.jsh.dao.basic.UserBusinessIDAO; import com.jsh.model.po.App; -public class AppService extends BaseService implements AppIService -{ - @SuppressWarnings("unused") - private AppIDAO appDao; - @SuppressWarnings("unused") - private UserBusinessIDAO userBusinessDao; +public class AppService extends BaseService implements AppIService { + @SuppressWarnings("unused") + private AppIDAO appDao; + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; - public void setAppDao(AppIDAO appDao) - { - this.appDao = appDao; - } + public void setAppDao(AppIDAO appDao) { + this.appDao = appDao; + } - public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { - this.userBusinessDao = userBusinessDao; - } + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { + this.userBusinessDao = userBusinessDao; + } + + @Override + protected Class getEntityClass() { + return App.class; + } - @Override - protected Class getEntityClass() - { - return App.class; - } - } diff --git a/src/main/java/com/jsh/service/basic/AssetNameIService.java b/src/main/java/com/jsh/service/basic/AssetNameIService.java index 35d4a5cd..0505861f 100644 --- a/src/main/java/com/jsh/service/basic/AssetNameIService.java +++ b/src/main/java/com/jsh/service/basic/AssetNameIService.java @@ -3,7 +3,6 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; import com.jsh.model.po.Assetname; -public interface AssetNameIService extends BaseIService -{ - +public interface AssetNameIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/basic/AssetNameService.java b/src/main/java/com/jsh/service/basic/AssetNameService.java index ee12b168..bb8340d7 100644 --- a/src/main/java/com/jsh/service/basic/AssetNameService.java +++ b/src/main/java/com/jsh/service/basic/AssetNameService.java @@ -4,19 +4,16 @@ import com.jsh.base.BaseService; import com.jsh.dao.basic.AssetNameIDAO; import com.jsh.model.po.Assetname; -public class AssetNameService extends BaseService implements AssetNameIService -{ - @SuppressWarnings("unused") - private AssetNameIDAO assetNameDao; +public class AssetNameService extends BaseService implements AssetNameIService { + @SuppressWarnings("unused") + private AssetNameIDAO assetNameDao; - public void setAssetNameDao(AssetNameIDAO assetNameDao) - { + public void setAssetNameDao(AssetNameIDAO assetNameDao) { this.assetNameDao = assetNameDao; } - @Override - protected Class getEntityClass() - { - return Assetname.class; - } + @Override + protected Class getEntityClass() { + return Assetname.class; + } } diff --git a/src/main/java/com/jsh/service/basic/CategoryIService.java b/src/main/java/com/jsh/service/basic/CategoryIService.java index 209832f4..3a2aee7f 100644 --- a/src/main/java/com/jsh/service/basic/CategoryIService.java +++ b/src/main/java/com/jsh/service/basic/CategoryIService.java @@ -3,7 +3,6 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; import com.jsh.model.po.Category; -public interface CategoryIService extends BaseIService -{ - +public interface CategoryIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/basic/CategoryService.java b/src/main/java/com/jsh/service/basic/CategoryService.java index 490b3efb..6482fd58 100644 --- a/src/main/java/com/jsh/service/basic/CategoryService.java +++ b/src/main/java/com/jsh/service/basic/CategoryService.java @@ -4,20 +4,17 @@ import com.jsh.base.BaseService; import com.jsh.dao.basic.CategoryIDAO; import com.jsh.model.po.Category; -public class CategoryService extends BaseService implements CategoryIService -{ - @SuppressWarnings("unused") - private CategoryIDAO categoryDao; +public class CategoryService extends BaseService implements CategoryIService { + @SuppressWarnings("unused") + private CategoryIDAO categoryDao; - public void setCategoryDao(CategoryIDAO categoryDao) - { + public void setCategoryDao(CategoryIDAO categoryDao) { this.categoryDao = categoryDao; } - @Override - protected Class getEntityClass() - { - return Category.class; - } - + @Override + protected Class getEntityClass() { + return Category.class; + } + } diff --git a/src/main/java/com/jsh/service/basic/DepotIService.java b/src/main/java/com/jsh/service/basic/DepotIService.java index 30489e1f..47634f95 100644 --- a/src/main/java/com/jsh/service/basic/DepotIService.java +++ b/src/main/java/com/jsh/service/basic/DepotIService.java @@ -3,7 +3,6 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; import com.jsh.model.po.Depot; -public interface DepotIService extends BaseIService -{ - +public interface DepotIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/basic/DepotService.java b/src/main/java/com/jsh/service/basic/DepotService.java index 7da7f5b8..e8833d02 100644 --- a/src/main/java/com/jsh/service/basic/DepotService.java +++ b/src/main/java/com/jsh/service/basic/DepotService.java @@ -5,28 +5,25 @@ import com.jsh.dao.basic.DepotIDAO; import com.jsh.dao.basic.UserBusinessIDAO; import com.jsh.model.po.Depot; -public class DepotService extends BaseService implements DepotIService -{ - @SuppressWarnings("unused") - private DepotIDAO depotDao; - @SuppressWarnings("unused") - private UserBusinessIDAO userBusinessDao; +public class DepotService extends BaseService implements DepotIService { + @SuppressWarnings("unused") + private DepotIDAO depotDao; + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; - public void setDepotDao(DepotIDAO depotDao) - { - this.depotDao = depotDao; - } - - public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { - this.userBusinessDao = userBusinessDao; - } + public void setDepotDao(DepotIDAO depotDao) { + this.depotDao = depotDao; + } + + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { + this.userBusinessDao = userBusinessDao; + } - @Override - protected Class getEntityClass() - { - return Depot.class; - } - + @Override + protected Class getEntityClass() { + return Depot.class; + } + } diff --git a/src/main/java/com/jsh/service/basic/FunctionsIService.java b/src/main/java/com/jsh/service/basic/FunctionsIService.java index 3fb4c71b..57d89f78 100644 --- a/src/main/java/com/jsh/service/basic/FunctionsIService.java +++ b/src/main/java/com/jsh/service/basic/FunctionsIService.java @@ -3,7 +3,6 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; import com.jsh.model.po.Functions; -public interface FunctionsIService extends BaseIService -{ - +public interface FunctionsIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/basic/FunctionsService.java b/src/main/java/com/jsh/service/basic/FunctionsService.java index 77567986..b9b539cf 100644 --- a/src/main/java/com/jsh/service/basic/FunctionsService.java +++ b/src/main/java/com/jsh/service/basic/FunctionsService.java @@ -5,27 +5,24 @@ import com.jsh.dao.basic.FunctionsIDAO; import com.jsh.dao.basic.UserBusinessIDAO; import com.jsh.model.po.Functions; -public class FunctionsService extends BaseService implements FunctionsIService -{ - @SuppressWarnings("unused") - private FunctionsIDAO functionsDao; - @SuppressWarnings("unused") - private UserBusinessIDAO userBusinessDao; +public class FunctionsService extends BaseService implements FunctionsIService { + @SuppressWarnings("unused") + private FunctionsIDAO functionsDao; + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; - public void setFunctionsDao(FunctionsIDAO functionsDao) - { - this.functionsDao = functionsDao; - } - - public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { - this.userBusinessDao = userBusinessDao; - } - - @Override - protected Class getEntityClass() - { - return Functions.class; - } - + public void setFunctionsDao(FunctionsIDAO functionsDao) { + this.functionsDao = functionsDao; + } + + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { + this.userBusinessDao = userBusinessDao; + } + + @Override + protected Class getEntityClass() { + return Functions.class; + } + } diff --git a/src/main/java/com/jsh/service/basic/InOutItemIService.java b/src/main/java/com/jsh/service/basic/InOutItemIService.java index 0509160b..7702102e 100644 --- a/src/main/java/com/jsh/service/basic/InOutItemIService.java +++ b/src/main/java/com/jsh/service/basic/InOutItemIService.java @@ -3,7 +3,6 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; import com.jsh.model.po.InOutItem; -public interface InOutItemIService extends BaseIService -{ +public interface InOutItemIService extends BaseIService { } diff --git a/src/main/java/com/jsh/service/basic/InOutItemService.java b/src/main/java/com/jsh/service/basic/InOutItemService.java index 960f0fb6..eb3dd2be 100644 --- a/src/main/java/com/jsh/service/basic/InOutItemService.java +++ b/src/main/java/com/jsh/service/basic/InOutItemService.java @@ -4,19 +4,16 @@ import com.jsh.base.BaseService; import com.jsh.dao.basic.InOutItemIDAO; import com.jsh.model.po.InOutItem; -public class InOutItemService extends BaseService implements InOutItemIService -{ +public class InOutItemService extends BaseService implements InOutItemIService { @SuppressWarnings("unused") private InOutItemIDAO inOutItemDao; - public void setInOutItemDao(InOutItemIDAO inOutItemDao) - { + public void setInOutItemDao(InOutItemIDAO inOutItemDao) { this.inOutItemDao = inOutItemDao; } @Override - protected Class getEntityClass() - { + protected Class getEntityClass() { return InOutItem.class; } diff --git a/src/main/java/com/jsh/service/basic/LogIService.java b/src/main/java/com/jsh/service/basic/LogIService.java index f69101e7..856f1322 100644 --- a/src/main/java/com/jsh/service/basic/LogIService.java +++ b/src/main/java/com/jsh/service/basic/LogIService.java @@ -1,16 +1,16 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; -import com.jsh.util.JshException; import com.jsh.model.po.Logdetails; +import com.jsh.util.JshException; -public interface LogIService extends BaseIService -{ - /** - * 增加 - * @param t 对象 - * @throws JshException - */ - @Override - void save(Logdetails t); +public interface LogIService extends BaseIService { + /** + * 增加 + * + * @param t 对象 + * @throws JshException + */ + @Override + void save(Logdetails t); } diff --git a/src/main/java/com/jsh/service/basic/LogService.java b/src/main/java/com/jsh/service/basic/LogService.java index b0185c0e..56e064fa 100644 --- a/src/main/java/com/jsh/service/basic/LogService.java +++ b/src/main/java/com/jsh/service/basic/LogService.java @@ -5,32 +5,25 @@ import com.jsh.base.Log; import com.jsh.dao.basic.LogIDAO; import com.jsh.model.po.Logdetails; -public class LogService extends BaseService implements LogIService -{ +public class LogService extends BaseService implements LogIService { @SuppressWarnings("unused") - private LogIDAO logDao; + private LogIDAO logDao; - public void setLogDao(LogIDAO logDao) - { + public void setLogDao(LogIDAO logDao) { this.logDao = logDao; } - @Override - protected Class getEntityClass() - { - return Logdetails.class; - } - - @Override - public void save(Logdetails t) - { - try - { - super.save(t); - } - catch (Exception e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>创建操作日志异常", e); - } - } + @Override + protected Class getEntityClass() { + return Logdetails.class; + } + + @Override + public void save(Logdetails t) { + try { + super.save(t); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>创建操作日志异常", e); + } + } } \ No newline at end of file diff --git a/src/main/java/com/jsh/service/basic/RoleIService.java b/src/main/java/com/jsh/service/basic/RoleIService.java index 6ee433ee..8cc2aaa3 100644 --- a/src/main/java/com/jsh/service/basic/RoleIService.java +++ b/src/main/java/com/jsh/service/basic/RoleIService.java @@ -3,7 +3,6 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; import com.jsh.model.po.Role; -public interface RoleIService extends BaseIService -{ - +public interface RoleIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/basic/RoleService.java b/src/main/java/com/jsh/service/basic/RoleService.java index 74b3b2b3..3ce8dfd2 100644 --- a/src/main/java/com/jsh/service/basic/RoleService.java +++ b/src/main/java/com/jsh/service/basic/RoleService.java @@ -5,26 +5,23 @@ import com.jsh.dao.basic.RoleIDAO; import com.jsh.dao.basic.UserBusinessIDAO; import com.jsh.model.po.Role; -public class RoleService extends BaseService implements RoleIService -{ - @SuppressWarnings("unused") - private RoleIDAO roleDao; - @SuppressWarnings("unused") - private UserBusinessIDAO userBusinessDao; +public class RoleService extends BaseService implements RoleIService { + @SuppressWarnings("unused") + private RoleIDAO roleDao; + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; + + public void setRoleDao(RoleIDAO roleDao) { + this.roleDao = roleDao; + } + + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { + this.userBusinessDao = userBusinessDao; + } + + @Override + protected Class getEntityClass() { + return Role.class; + } - public void setRoleDao(RoleIDAO roleDao) - { - this.roleDao = roleDao; - } - - public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { - this.userBusinessDao = userBusinessDao; - } - - @Override - protected Class getEntityClass() - { - return Role.class; - } - } diff --git a/src/main/java/com/jsh/service/basic/SupplierIService.java b/src/main/java/com/jsh/service/basic/SupplierIService.java index 3a637968..02880701 100644 --- a/src/main/java/com/jsh/service/basic/SupplierIService.java +++ b/src/main/java/com/jsh/service/basic/SupplierIService.java @@ -8,11 +8,10 @@ import com.jsh.util.PageUtil; import java.io.File; import java.io.InputStream; -public interface SupplierIService extends BaseIService -{ - public void batchSetEnable(Boolean enable,String supplierIDs); +public interface SupplierIService extends BaseIService { + public void batchSetEnable(Boolean enable, String supplierIDs); - public InputStream exmportExcel(String isAllPage,PageUtil pageUtil)throws JshException; + public InputStream exmportExcel(String isAllPage, PageUtil pageUtil) throws JshException; - public InputStream importExcel(File assetFile)throws JshException; + public InputStream importExcel(File assetFile) throws JshException; } diff --git a/src/main/java/com/jsh/service/basic/SupplierService.java b/src/main/java/com/jsh/service/basic/SupplierService.java index 731c7cbd..3eed4ec4 100644 --- a/src/main/java/com/jsh/service/basic/SupplierService.java +++ b/src/main/java/com/jsh/service/basic/SupplierService.java @@ -5,7 +5,10 @@ import com.jsh.base.Log; import com.jsh.dao.basic.SupplierIDAO; import com.jsh.dao.basic.UserBusinessIDAO; 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.format.Colour; import jxl.write.*; @@ -18,442 +21,417 @@ import java.io.*; import java.lang.Boolean; import java.util.*; -public class SupplierService extends BaseService implements SupplierIService -{ - @SuppressWarnings("unused") - private SupplierIDAO supplierDao; - @SuppressWarnings("unused") - private UserBusinessIDAO userBusinessDao; +public class SupplierService extends BaseService implements SupplierIService { + /** + * 初始化加载所有系统基础数据 + */ + @SuppressWarnings({"rawtypes"}) + private static Map mapData = new HashMap(); + /** + * 错误的表格数据 + */ + private static List wrongData = new ArrayList(); + @SuppressWarnings("unused") + private SupplierIDAO supplierDao; + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; - /** - * 设置映射基类 - * @return - */ - @Override - protected Class getEntityClass() - { - return Supplier.class; - } - - public void setSupplierDao(SupplierIDAO supplierDao) - { - this.supplierDao = supplierDao; - } + /** + * 设置映射基类 + * + * @return + */ + @Override + protected Class getEntityClass() { + return Supplier.class; + } - public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { - this.userBusinessDao = userBusinessDao; - } + public void setSupplierDao(SupplierIDAO supplierDao) { + this.supplierDao = supplierDao; + } - public void batchSetEnable(Boolean enable,String supplierIDs){ - supplierDao.batchSetEnable(enable, supplierIDs); - } + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { + this.userBusinessDao = userBusinessDao; + } - /** - * 初始化加载所有系统基础数据 - */ - @SuppressWarnings({"rawtypes"}) - private static Map mapData = new HashMap(); + public void batchSetEnable(Boolean enable, String supplierIDs) { + supplierDao.batchSetEnable(enable, supplierIDs); + } - /** - * 错误的表格数据 - */ - private static List wrongData = new ArrayList(); - /** - * 导出Excel表格 - */ - @Override - public InputStream exmportExcel(String isAllPage, PageUtil pageUtil)throws JshException - { - try - { - //将OutputStream转化为InputStream - 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表格 + */ + @Override + public InputStream exmportExcel(String isAllPage, PageUtil pageUtil) throws JshException { + try { + //将OutputStream转化为InputStream + 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表格 - * @param os - */ - @SuppressWarnings("deprecation") - private void putDataOnOutputStream(OutputStream os, List dataList) { - WritableWorkbook workbook = null; - try { - workbook = Workbook.createWorkbook(os); - WritableSheet sheet = workbook.createSheet("信息报表", 0); - //增加列头 - String[] colunmName = {"名称","类型","联系人","电话","电子邮箱","预收款","期初应收","期初应付","备注","传真","手机","地址","纳税人识别号","开户行","账号","税率","状态"}; - for(int i = 0 ;i < colunmName.length;i ++) { - sheet.setColumnView(i, 10); - sheet.addCell(new Label(i, 0, colunmName[i])); - } - if (null != dataList && dataList.size() > 0) { - int i = 1; - for (Supplier supplier: dataList){ - int j = 0; - Map cellInfo = supplier.getCellInfo(); - sheet.addCell(new Label(j++,i, supplier.getSupplier())); - sheet.addCell(new Label(j++,i, supplier.getType())); - sheet.addCell(new Label(j++,i, supplier.getContacts() == null ?"": supplier.getContacts())); - sheet.addCell(new Label(j++,i, supplier.getPhonenum() == null ?"": supplier.getPhonenum())); - sheet.addCell(new Label(j++,i, supplier.getEmail() == null ?"": supplier.getEmail())); - sheet.addCell(getLabelInfo(cellInfo,j++,i, supplier.getAdvanceIn() == null ?"": supplier.getAdvanceIn().toString(),supplier)); - sheet.addCell(getLabelInfo(cellInfo,j++,i, supplier.getBeginNeedGet() == null ?"": supplier.getBeginNeedGet().toString(),supplier)); - sheet.addCell(getLabelInfo(cellInfo,j++,i, supplier.getBeginNeedPay() == null ?"": supplier.getBeginNeedPay().toString(),supplier)); - sheet.addCell(new Label(j++,i, supplier.getDescription() == null ?"": supplier.getDescription())); - sheet.addCell(new Label(j++,i, supplier.getFax() == null ?"": supplier.getFax())); - sheet.addCell(new Label(j++,i, supplier.getTelephone() == null ?"": supplier.getTelephone())); - sheet.addCell(new Label(j++,i, supplier.getAddress() == null ?"": supplier.getAddress())); - sheet.addCell(new Label(j++,i, supplier.getTaxNum() == null ?"": supplier.getTaxNum())); - sheet.addCell(new Label(j++,i, supplier.getBankName() == null ?"": supplier.getBankName())); - sheet.addCell(new Label(j++,i, supplier.getAccountNumber() == null ?"": supplier.getAccountNumber())); - sheet.addCell(getLabelInfo(cellInfo,j++,i, supplier.getTaxRate() == null ?"": supplier.getTaxRate().toString(),supplier)); - sheet.addCell(new Label(j++,i, supplier.getEnabled()?"启用":"禁用")); - i++; - } - } - workbook.write(); - workbook.close(); - } - catch (Exception e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e); - } - } + /** + * 生成excel表格 + * + * @param os + */ + @SuppressWarnings("deprecation") + private void putDataOnOutputStream(OutputStream os, List dataList) { + WritableWorkbook workbook = null; + try { + workbook = Workbook.createWorkbook(os); + WritableSheet sheet = workbook.createSheet("信息报表", 0); + //增加列头 + String[] colunmName = {"名称", "类型", "联系人", "电话", "电子邮箱", "预收款", "期初应收", "期初应付", "备注", "传真", "手机", "地址", "纳税人识别号", "开户行", "账号", "税率", "状态"}; + for (int i = 0; i < colunmName.length; i++) { + sheet.setColumnView(i, 10); + sheet.addCell(new Label(i, 0, colunmName[i])); + } + if (null != dataList && dataList.size() > 0) { + int i = 1; + for (Supplier supplier : dataList) { + int j = 0; + Map cellInfo = supplier.getCellInfo(); + sheet.addCell(new Label(j++, i, supplier.getSupplier())); + sheet.addCell(new Label(j++, i, supplier.getType())); + sheet.addCell(new Label(j++, i, supplier.getContacts() == null ? "" : supplier.getContacts())); + sheet.addCell(new Label(j++, i, supplier.getPhonenum() == null ? "" : supplier.getPhonenum())); + sheet.addCell(new Label(j++, i, supplier.getEmail() == null ? "" : supplier.getEmail())); + sheet.addCell(getLabelInfo(cellInfo, j++, i, supplier.getAdvanceIn() == null ? "" : supplier.getAdvanceIn().toString(), supplier)); + sheet.addCell(getLabelInfo(cellInfo, j++, i, supplier.getBeginNeedGet() == null ? "" : supplier.getBeginNeedGet().toString(), supplier)); + sheet.addCell(getLabelInfo(cellInfo, j++, i, supplier.getBeginNeedPay() == null ? "" : supplier.getBeginNeedPay().toString(), supplier)); + sheet.addCell(new Label(j++, i, supplier.getDescription() == null ? "" : supplier.getDescription())); + sheet.addCell(new Label(j++, i, supplier.getFax() == null ? "" : supplier.getFax())); + sheet.addCell(new Label(j++, i, supplier.getTelephone() == null ? "" : supplier.getTelephone())); + sheet.addCell(new Label(j++, i, supplier.getAddress() == null ? "" : supplier.getAddress())); + sheet.addCell(new Label(j++, i, supplier.getTaxNum() == null ? "" : supplier.getTaxNum())); + sheet.addCell(new Label(j++, i, supplier.getBankName() == null ? "" : supplier.getBankName())); + sheet.addCell(new Label(j++, i, supplier.getAccountNumber() == null ? "" : supplier.getAccountNumber())); + sheet.addCell(getLabelInfo(cellInfo, j++, i, supplier.getTaxRate() == null ? "" : supplier.getTaxRate().toString(), supplier)); + sheet.addCell(new Label(j++, i, supplier.getEnabled() ? "启用" : "禁用")); + i++; + } + } + workbook.write(); + workbook.close(); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e); + } + } - /** - * 根据错误信息进行提示--excel表格背景设置为红色,表示导入信息有误 - * @param cellInfo - * @param cellNum - * @param columnNum - * @param value - * @return - */ - private Label getLabelInfo(Map cellInfo,int cellNum,int columnNum,String value,Supplier supplier) - { - Label label = null; + /** + * 根据错误信息进行提示--excel表格背景设置为红色,表示导入信息有误 + * + * @param cellInfo + * @param cellNum + * @param columnNum + * @param value + * @return + */ + private Label getLabelInfo(Map cellInfo, int cellNum, int columnNum, String value, Supplier supplier) { + Label label = null; - //设置背景颜色 - WritableCellFormat cellFormat = new WritableCellFormat(); - try - { - cellFormat.setBackground(Colour.RED); - } - catch (WriteException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误", e); - } + //设置背景颜色 + WritableCellFormat cellFormat = new WritableCellFormat(); + try { + cellFormat.setBackground(Colour.RED); + } catch (WriteException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误", e); + } - if(null == cellInfo || cellInfo.size() == 0) { - label = new Label(cellNum, columnNum, value); - } - else { - //表示此单元格有错误 - if(cellInfo.containsKey(cellNum)) { - if(cellNum == SupplierConstants.BusinessForExcel.EXCEL_ADVANCE_IN) { - 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_PAY) { - label = new Label(cellNum, columnNum, supplier.getBeginNeedPayStr(), cellFormat); - } - else if(cellNum == SupplierConstants.BusinessForExcel.EXCEL_TAX_RATE) { - label = new Label(cellNum, columnNum, supplier.getTaxRateStr(), cellFormat); - } - } - else{ - label = new Label(cellNum, columnNum, value); - } - } - return label; - } + if (null == cellInfo || cellInfo.size() == 0) { + label = new Label(cellNum, columnNum, value); + } else { + //表示此单元格有错误 + if (cellInfo.containsKey(cellNum)) { + if (cellNum == SupplierConstants.BusinessForExcel.EXCEL_ADVANCE_IN) { + 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_PAY) { + label = new Label(cellNum, columnNum, supplier.getBeginNeedPayStr(), cellFormat); + } else if (cellNum == SupplierConstants.BusinessForExcel.EXCEL_TAX_RATE) { + label = new Label(cellNum, columnNum, supplier.getTaxRateStr(), cellFormat); + } + } else { + label = new Label(cellNum, columnNum, value); + } + } + return label; + } - @Override - public InputStream importExcel(File assetFile) throws JshException { - //全局变量--每次调用前需要清空数据 - mapData.clear(); - //2、解析文件成资产数据 - parseFile(assetFile); + @Override + public InputStream importExcel(File assetFile) throws JshException { + //全局变量--每次调用前需要清空数据 + mapData.clear(); + //2、解析文件成资产数据 + parseFile(assetFile); - if(null != wrongData && wrongData.size()>0) { - //将OutputStream转化为InputStream - ByteArrayOutputStream out = new ByteArrayOutputStream(); - putDataOnOutputStream(out,wrongData); - return new ByteArrayInputStream(out.toByteArray()); - } - else{ - return null; - } - } + if (null != wrongData && wrongData.size() > 0) { + //将OutputStream转化为InputStream + ByteArrayOutputStream out = new ByteArrayOutputStream(); + putDataOnOutputStream(out, wrongData); + return new ByteArrayInputStream(out.toByteArray()); + } else { + return null; + } + } - /** - * 解析excel表格 - * @param assetFile - */ - @SuppressWarnings("unchecked") - private void parseFile(File assetFile) { - //每次调用前清空 - wrongData.clear(); - int totalRow = 0; - try { - //创建对Excel工作簿文件的引用 - HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(assetFile)); - //创建对工作表的引用,获取第一个工作表的内容 - HSSFSheet sheet = workbook.getSheetAt(0); - /** - * ===================================== - * 1、此处要增加文件的验证,如果不是资产文件需要进行特殊的处理,13列 - * 2、文件内容为空处理 - * 3、如果是修改过的文件内容 - */ - Iterator itsheet = sheet.rowIterator(); - while(itsheet.hasNext()) { - //获取当前行数据 - Row row = itsheet.next(); - //获取一行有多少单元格 + /** + * 解析excel表格 + * + * @param assetFile + */ + @SuppressWarnings("unchecked") + private void parseFile(File assetFile) { + //每次调用前清空 + wrongData.clear(); + int totalRow = 0; + try { + //创建对Excel工作簿文件的引用 + HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(assetFile)); + //创建对工作表的引用,获取第一个工作表的内容 + HSSFSheet sheet = workbook.getSheetAt(0); + /** + * ===================================== + * 1、此处要增加文件的验证,如果不是资产文件需要进行特殊的处理,13列 + * 2、文件内容为空处理 + * 3、如果是修改过的文件内容 + */ + Iterator itsheet = sheet.rowIterator(); + while (itsheet.hasNext()) { + //获取当前行数据 + Row row = itsheet.next(); + //获取一行有多少单元格 // System.out.println(row.getLastCellNum()); - //excel表格第几行数据 从1开始 0 是表头 - int rowNum = row.getRowNum(); - /** - * 表头跳过不读 - */ - if(SupplierConstants.BusinessForExcel.EXCEL_TABLE_HEAD == rowNum) - continue; + //excel表格第几行数据 从1开始 0 是表头 + int rowNum = row.getRowNum(); + /** + * 表头跳过不读 + */ + if (SupplierConstants.BusinessForExcel.EXCEL_TABLE_HEAD == rowNum) + continue; - //开始处理excel表格内容 --每行数据读取,同时统计总共行数 - totalRow ++; + //开始处理excel表格内容 --每行数据读取,同时统计总共行数 + totalRow++; - //获取excel表格的每格数据内容 - Iterator it = row.cellIterator(); - //资产子类型--添加了一些excel表格数据 - Supplier supplier = new Supplier(); - //保存每个单元格错误类型 - Map cellType = new HashMap(); - Boolean hasBeginNeedGet = false; //是否存在期初应付 - //设置列号 - supplier.setRowLineNum(rowNum); + //获取excel表格的每格数据内容 + Iterator it = row.cellIterator(); + //资产子类型--添加了一些excel表格数据 + Supplier supplier = new Supplier(); + //保存每个单元格错误类型 + Map cellType = new HashMap(); + Boolean hasBeginNeedGet = false; //是否存在期初应付 + //设置列号 + supplier.setRowLineNum(rowNum); - Cell cell = null; - //判断列号--从零开始 - int cellIndex = 0; - while(it.hasNext()) { - //获取每个单元格对象 - cell = it.next(); - //获取列号 - cellIndex = cell.getColumnIndex(); - //设置此单元格为字符串类型 - cell.setCellType(Cell.CELL_TYPE_STRING); + Cell cell = null; + //判断列号--从零开始 + int cellIndex = 0; + while (it.hasNext()) { + //获取每个单元格对象 + cell = it.next(); + //获取列号 + cellIndex = cell.getColumnIndex(); + //设置此单元格为字符串类型 + cell.setCellType(Cell.CELL_TYPE_STRING); - Log.infoFileSync("==================excel表格中第" + totalRow + "行的第 " + cellIndex + "列的值为" + cell.getStringCellValue()); + Log.infoFileSync("==================excel表格中第" + totalRow + "行的第 " + cellIndex + "列的值为" + cell.getStringCellValue()); - //每行中数据顺序 "名称","类型","联系人","电话","电子邮箱","预收款","期初应收","期初应付","备注","传真","手机","地址","纳税人识别号","开户行","账号","税率" - switch(cellIndex) { - case SupplierConstants.BusinessForExcel.EXCEL_SUPPLIER : - String supplierName = cell.getStringCellValue(); - if(null == supplierName || "".equals(supplierName)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(名称)信息"); - break; - } - supplier.setSupplier(supplierName); - break; - case SupplierConstants.BusinessForExcel.EXCEL_TYPE : - String type = cell.getStringCellValue(); - if(null == type || "".equals(type)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(类型)信息"); - break; - } - supplier.setType(type); - break; - case SupplierConstants.BusinessForExcel.EXCEL_CONTACTS: - String contacts = cell.getStringCellValue(); - if(null == contacts || "".equals(contacts)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(联系人)信息"); - break; - } - supplier.setContacts(contacts); - break; - case SupplierConstants.BusinessForExcel.EXCEL_PHONE_NUM : - String phoneNum = cell.getStringCellValue(); - if(null == phoneNum || "".equals(phoneNum)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(电话)信息"); - break; - } - supplier.setPhonenum(phoneNum); - break; - case SupplierConstants.BusinessForExcel.EXCEL_EMAIL : - String email = cell.getStringCellValue(); - if(null == email || "".equals(email)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(电子邮箱)信息"); - break; - } - supplier.setEmail(email); - break; - case SupplierConstants.BusinessForExcel.EXCEL_ADVANCE_IN : - String advanceIn = cell.getStringCellValue(); - if(null == advanceIn || "".equals(advanceIn)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(预收款)信息"); - break; - } - if(Tools.checkStrIsNum(advanceIn)) { - supplier.setAdvanceIn(Double.parseDouble(advanceIn)); - } - else{ - Log.errorFileSync(">>>>>>>>>>>>>>>>>(预收款)不是数字格式"); - cellType.put(cellIndex, "wrong"); - supplier.setAdvanceIn(0.00d); - supplier.setAdvanceInStr(advanceIn); - } - break; - case SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_GET : - String beginNeedGet = cell.getStringCellValue(); - if(null == beginNeedGet || "".equals(beginNeedGet)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(期初应收)信息"); - break; - } - if(Tools.checkStrIsNum(beginNeedGet) && Double.parseDouble(beginNeedGet)>=0) { - if(Double.parseDouble(beginNeedGet)>0) { - hasBeginNeedGet = true; //存在期初应付信息 - } - supplier.setBeginNeedGet(Double.parseDouble(beginNeedGet)); - } - else{ - Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应收)不是数字格式"); - cellType.put(cellIndex, "wrong"); - supplier.setBeginNeedGet(0.00d); - supplier.setBeginNeedGetStr(beginNeedGet); - } - break; - case SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_PAY : - String beginNeedPay = cell.getStringCellValue(); - if(null == beginNeedPay || "".equals(beginNeedPay)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(期初应付)信息"); - break; - } - if(Tools.checkStrIsNum(beginNeedPay) && Double.parseDouble(beginNeedPay)>=0) { - if(hasBeginNeedGet){ //同时存在不允许 - Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应付)和期初应收不能同时存在"); - cellType.put(cellIndex, "wrong"); - supplier.setBeginNeedPay(0.00d); - supplier.setBeginNeedPayStr(beginNeedPay); - } - else { - supplier.setBeginNeedPay(Double.parseDouble(beginNeedPay)); - } - } - else{ - Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应付)不是数字格式"); - cellType.put(cellIndex, "wrong"); - supplier.setBeginNeedPay(0.00d); - supplier.setBeginNeedPayStr(beginNeedPay); - } - break; - case SupplierConstants.BusinessForExcel.EXCEL_DESCRIPTION : - String description = cell.getStringCellValue(); - if(null == description || "".equals(description)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(备注)信息"); - break; - } - supplier.setDescription(description); - break; - case SupplierConstants.BusinessForExcel.EXCEL_FAX : - String fax = cell.getStringCellValue(); - if(null == fax || "".equals(fax)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(传真)信息"); - break; - } - supplier.setFax(fax); - break; - case SupplierConstants.BusinessForExcel.EXCEL_TELEPHONE : - String telephone = cell.getStringCellValue(); - if(null == telephone || "".equals(telephone)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(手机)信息"); - break; - } - supplier.setTelephone(telephone); - break; - case SupplierConstants.BusinessForExcel.EXCEL_ADDRESS : - String address = cell.getStringCellValue(); - if(null == address || "".equals(address)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(地址)信息"); - break; - } - supplier.setAddress(address); - break; - case SupplierConstants.BusinessForExcel.EXCEL_TAX_NUM : - String taxNum = cell.getStringCellValue(); - if(null == taxNum || "".equals(taxNum)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(纳税人识别号)信息"); - break; - } - supplier.setTaxNum(taxNum); - break; - case SupplierConstants.BusinessForExcel.EXCEL_BANK_NAME : - String bankName = cell.getStringCellValue(); - if(null == bankName || "".equals(bankName)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(开户行)信息"); - break; - } - supplier.setBankName(bankName); - break; - case SupplierConstants.BusinessForExcel.EXCEL_ACCOUNT_NUMBER : - String accountNumber = cell.getStringCellValue(); - if(null == accountNumber || "".equals(accountNumber)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(账号)信息"); - break; - } - supplier.setAccountNumber(accountNumber); - break; - case SupplierConstants.BusinessForExcel.EXCEL_TAX_RATE : - String taxRate = cell.getStringCellValue(); - if(null == taxRate || "".equals(taxRate)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(税率)信息"); - break; - } - if(Tools.checkStrIsNum(taxRate)) { - supplier.setTaxRate(Double.parseDouble(taxRate)); - } - else{ - Log.errorFileSync(">>>>>>>>>>>>>>>>>(税率)不是数字格式"); - cellType.put(cellIndex, "wrong"); - supplier.setTaxRate(0.00d); - supplier.setTaxRateStr(taxRate); - } - break; - } - } - supplier.setCellInfo(cellType); + //每行中数据顺序 "名称","类型","联系人","电话","电子邮箱","预收款","期初应收","期初应付","备注","传真","手机","地址","纳税人识别号","开户行","账号","税率" + switch (cellIndex) { + case SupplierConstants.BusinessForExcel.EXCEL_SUPPLIER: + String supplierName = cell.getStringCellValue(); + if (null == supplierName || "".equals(supplierName)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(名称)信息"); + break; + } + supplier.setSupplier(supplierName); + break; + case SupplierConstants.BusinessForExcel.EXCEL_TYPE: + String type = cell.getStringCellValue(); + if (null == type || "".equals(type)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(类型)信息"); + break; + } + supplier.setType(type); + break; + case SupplierConstants.BusinessForExcel.EXCEL_CONTACTS: + String contacts = cell.getStringCellValue(); + if (null == contacts || "".equals(contacts)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(联系人)信息"); + break; + } + supplier.setContacts(contacts); + break; + case SupplierConstants.BusinessForExcel.EXCEL_PHONE_NUM: + String phoneNum = cell.getStringCellValue(); + if (null == phoneNum || "".equals(phoneNum)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(电话)信息"); + break; + } + supplier.setPhonenum(phoneNum); + break; + case SupplierConstants.BusinessForExcel.EXCEL_EMAIL: + String email = cell.getStringCellValue(); + if (null == email || "".equals(email)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(电子邮箱)信息"); + break; + } + supplier.setEmail(email); + break; + case SupplierConstants.BusinessForExcel.EXCEL_ADVANCE_IN: + String advanceIn = cell.getStringCellValue(); + if (null == advanceIn || "".equals(advanceIn)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(预收款)信息"); + break; + } + if (Tools.checkStrIsNum(advanceIn)) { + supplier.setAdvanceIn(Double.parseDouble(advanceIn)); + } else { + Log.errorFileSync(">>>>>>>>>>>>>>>>>(预收款)不是数字格式"); + cellType.put(cellIndex, "wrong"); + supplier.setAdvanceIn(0.00d); + supplier.setAdvanceInStr(advanceIn); + } + break; + case SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_GET: + String beginNeedGet = cell.getStringCellValue(); + if (null == beginNeedGet || "".equals(beginNeedGet)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(期初应收)信息"); + break; + } + if (Tools.checkStrIsNum(beginNeedGet) && Double.parseDouble(beginNeedGet) >= 0) { + if (Double.parseDouble(beginNeedGet) > 0) { + hasBeginNeedGet = true; //存在期初应付信息 + } + supplier.setBeginNeedGet(Double.parseDouble(beginNeedGet)); + } else { + Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应收)不是数字格式"); + cellType.put(cellIndex, "wrong"); + supplier.setBeginNeedGet(0.00d); + supplier.setBeginNeedGetStr(beginNeedGet); + } + break; + case SupplierConstants.BusinessForExcel.EXCEL_BEGIN_NEED_PAY: + String beginNeedPay = cell.getStringCellValue(); + if (null == beginNeedPay || "".equals(beginNeedPay)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(期初应付)信息"); + break; + } + if (Tools.checkStrIsNum(beginNeedPay) && Double.parseDouble(beginNeedPay) >= 0) { + if (hasBeginNeedGet) { //同时存在不允许 + Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应付)和期初应收不能同时存在"); + cellType.put(cellIndex, "wrong"); + supplier.setBeginNeedPay(0.00d); + supplier.setBeginNeedPayStr(beginNeedPay); + } else { + supplier.setBeginNeedPay(Double.parseDouble(beginNeedPay)); + } + } else { + Log.errorFileSync(">>>>>>>>>>>>>>>>>(期初应付)不是数字格式"); + cellType.put(cellIndex, "wrong"); + supplier.setBeginNeedPay(0.00d); + supplier.setBeginNeedPayStr(beginNeedPay); + } + break; + case SupplierConstants.BusinessForExcel.EXCEL_DESCRIPTION: + String description = cell.getStringCellValue(); + if (null == description || "".equals(description)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(备注)信息"); + break; + } + supplier.setDescription(description); + break; + case SupplierConstants.BusinessForExcel.EXCEL_FAX: + String fax = cell.getStringCellValue(); + if (null == fax || "".equals(fax)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(传真)信息"); + break; + } + supplier.setFax(fax); + break; + case SupplierConstants.BusinessForExcel.EXCEL_TELEPHONE: + String telephone = cell.getStringCellValue(); + if (null == telephone || "".equals(telephone)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(手机)信息"); + break; + } + supplier.setTelephone(telephone); + break; + case SupplierConstants.BusinessForExcel.EXCEL_ADDRESS: + String address = cell.getStringCellValue(); + if (null == address || "".equals(address)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(地址)信息"); + break; + } + supplier.setAddress(address); + break; + case SupplierConstants.BusinessForExcel.EXCEL_TAX_NUM: + String taxNum = cell.getStringCellValue(); + if (null == taxNum || "".equals(taxNum)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(纳税人识别号)信息"); + break; + } + supplier.setTaxNum(taxNum); + break; + case SupplierConstants.BusinessForExcel.EXCEL_BANK_NAME: + String bankName = cell.getStringCellValue(); + if (null == bankName || "".equals(bankName)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(开户行)信息"); + break; + } + supplier.setBankName(bankName); + break; + case SupplierConstants.BusinessForExcel.EXCEL_ACCOUNT_NUMBER: + String accountNumber = cell.getStringCellValue(); + if (null == accountNumber || "".equals(accountNumber)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(账号)信息"); + break; + } + supplier.setAccountNumber(accountNumber); + break; + case SupplierConstants.BusinessForExcel.EXCEL_TAX_RATE: + String taxRate = cell.getStringCellValue(); + if (null == taxRate || "".equals(taxRate)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(税率)信息"); + break; + } + if (Tools.checkStrIsNum(taxRate)) { + supplier.setTaxRate(Double.parseDouble(taxRate)); + } else { + Log.errorFileSync(">>>>>>>>>>>>>>>>>(税率)不是数字格式"); + cellType.put(cellIndex, "wrong"); + supplier.setTaxRate(0.00d); + supplier.setTaxRateStr(taxRate); + } + break; + } + } + supplier.setCellInfo(cellType); - Log.infoFileSync(totalRow + "行总共有" + cellIndex + "列"); + Log.infoFileSync(totalRow + "行总共有" + cellIndex + "列"); - //判断完成后增加数据 - if((null!=cellType && cellType.size() >0) || supplier.getSupplier() == null) { - wrongData.add(supplier); - } - else { - supplier.setEnabled(true); - supplier.setIsystem((short)1); - supplierDao.save(supplier); - } - } - } - catch (FileNotFoundException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!",e); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !",e); - } - Log.infoFileSync("===================excel表格总共有 " + totalRow + " 条记录!"); - } + //判断完成后增加数据 + if ((null != cellType && cellType.size() > 0) || supplier.getSupplier() == null) { + wrongData.add(supplier); + } else { + supplier.setEnabled(true); + supplier.setIsystem((short) 1); + supplierDao.save(supplier); + } + } + } catch (FileNotFoundException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !", e); + } + Log.infoFileSync("===================excel表格总共有 " + totalRow + " 条记录!"); + } } diff --git a/src/main/java/com/jsh/service/basic/SystemConfigIService.java b/src/main/java/com/jsh/service/basic/SystemConfigIService.java index a0c627a2..5cca2eb9 100644 --- a/src/main/java/com/jsh/service/basic/SystemConfigIService.java +++ b/src/main/java/com/jsh/service/basic/SystemConfigIService.java @@ -3,7 +3,6 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; import com.jsh.model.po.SystemConfig; -public interface SystemConfigIService extends BaseIService -{ - +public interface SystemConfigIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/basic/SystemConfigService.java b/src/main/java/com/jsh/service/basic/SystemConfigService.java index ce1ee2ae..8d94977a 100644 --- a/src/main/java/com/jsh/service/basic/SystemConfigService.java +++ b/src/main/java/com/jsh/service/basic/SystemConfigService.java @@ -4,20 +4,17 @@ import com.jsh.base.BaseService; import com.jsh.dao.basic.SystemConfigIDAO; import com.jsh.model.po.SystemConfig; -public class SystemConfigService extends BaseService implements SystemConfigIService -{ - @SuppressWarnings("unused") - private SystemConfigIDAO systemConfigDao; +public class SystemConfigService extends BaseService implements SystemConfigIService { + @SuppressWarnings("unused") + private SystemConfigIDAO systemConfigDao; - public void setSystemConfigDao(SystemConfigIDAO systemConfigDao) - { - this.systemConfigDao = systemConfigDao; - } + public void setSystemConfigDao(SystemConfigIDAO systemConfigDao) { + this.systemConfigDao = systemConfigDao; + } + + @Override + protected Class getEntityClass() { + return SystemConfig.class; + } - @Override - protected Class getEntityClass() - { - return SystemConfig.class; - } - } diff --git a/src/main/java/com/jsh/service/basic/UnitIService.java b/src/main/java/com/jsh/service/basic/UnitIService.java index 13638946..630eb252 100644 --- a/src/main/java/com/jsh/service/basic/UnitIService.java +++ b/src/main/java/com/jsh/service/basic/UnitIService.java @@ -3,7 +3,6 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; import com.jsh.model.po.Unit; -public interface UnitIService extends BaseIService -{ - +public interface UnitIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/basic/UnitService.java b/src/main/java/com/jsh/service/basic/UnitService.java index 049ab3db..f49d1855 100644 --- a/src/main/java/com/jsh/service/basic/UnitService.java +++ b/src/main/java/com/jsh/service/basic/UnitService.java @@ -4,21 +4,18 @@ import com.jsh.base.BaseService; import com.jsh.dao.basic.UnitIDAO; import com.jsh.model.po.Unit; -public class UnitService extends BaseService implements UnitIService -{ - @SuppressWarnings("unused") - private UnitIDAO unitDao; +public class UnitService extends BaseService implements UnitIService { + @SuppressWarnings("unused") + private UnitIDAO unitDao; - public void setUnitDao(UnitIDAO unitDao) - { - this.unitDao = unitDao; - } + public void setUnitDao(UnitIDAO unitDao) { + this.unitDao = unitDao; + } + + @Override + protected Class getEntityClass() { + return Unit.class; + } - @Override - protected Class getEntityClass() - { - return Unit.class; - } - } diff --git a/src/main/java/com/jsh/service/basic/UserBusinessIService.java b/src/main/java/com/jsh/service/basic/UserBusinessIService.java index 11686157..94ff0a58 100644 --- a/src/main/java/com/jsh/service/basic/UserBusinessIService.java +++ b/src/main/java/com/jsh/service/basic/UserBusinessIService.java @@ -1,15 +1,14 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; -import com.jsh.util.JshException; import com.jsh.model.po.UserBusiness; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public interface UserBusinessIService extends BaseIService -{ - /* - * 测试一下自定义hql语句 - */ - void find(PageUtil userBusiness,String ceshi)throws JshException; +public interface UserBusinessIService extends BaseIService { + /* + * 测试一下自定义hql语句 + */ + void find(PageUtil userBusiness, String ceshi) throws JshException; } diff --git a/src/main/java/com/jsh/service/basic/UserBusinessService.java b/src/main/java/com/jsh/service/basic/UserBusinessService.java index 0b20790a..5f883adc 100644 --- a/src/main/java/com/jsh/service/basic/UserBusinessService.java +++ b/src/main/java/com/jsh/service/basic/UserBusinessService.java @@ -2,31 +2,27 @@ package com.jsh.service.basic; import com.jsh.base.BaseService; import com.jsh.dao.basic.UserBusinessIDAO; -import com.jsh.util.JshException; import com.jsh.model.po.UserBusiness; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public class UserBusinessService extends BaseService implements UserBusinessIService -{ - @SuppressWarnings("unused") - private UserBusinessIDAO userBusinessDao; +public class UserBusinessService extends BaseService implements UserBusinessIService { + @SuppressWarnings("unused") + private UserBusinessIDAO userBusinessDao; - public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) - { - this.userBusinessDao = userBusinessDao; - } - - @Override - protected Class getEntityClass() - { - return UserBusiness.class; - } - - @Override - public void find(PageUtil pageUtil, String ceshi) throws JshException - { - userBusinessDao.find(pageUtil, ceshi); + public void setUserBusinessDao(UserBusinessIDAO userBusinessDao) { + this.userBusinessDao = userBusinessDao; } - + @Override + protected Class getEntityClass() { + return UserBusiness.class; + } + + @Override + public void find(PageUtil pageUtil, String ceshi) throws JshException { + userBusinessDao.find(pageUtil, ceshi); + } + + } diff --git a/src/main/java/com/jsh/service/basic/UserIService.java b/src/main/java/com/jsh/service/basic/UserIService.java index 5acfc515..2584e6aa 100644 --- a/src/main/java/com/jsh/service/basic/UserIService.java +++ b/src/main/java/com/jsh/service/basic/UserIService.java @@ -1,33 +1,35 @@ package com.jsh.service.basic; import com.jsh.base.BaseIService; -import com.jsh.util.JshException; import com.jsh.model.po.Basicuser; +import com.jsh.util.JshException; -public interface UserIService extends BaseIService -{ - /** - * 判断用户名是否符合登录条件 - * @param username 用户名 String password - * @return int 1、用户名不存在 2、密码不正确 3、黑名单用户 4、符合条件 5、访问后台异常 - */ - int validateUser(String username,String password)throws JshException; +public interface UserIService extends BaseIService { + /** + * 判断用户名是否符合登录条件 + * + * @param username 用户名 String password + * @return int 1、用户名不存在 2、密码不正确 3、黑名单用户 4、符合条件 5、访问后台异常 + */ + int validateUser(String username, String password) throws JshException; - /** - * 获取用户信息 - * @param username - * @return 用户信息 - * @throws JshException - */ - public Basicuser getUser(String username) throws JshException; - - /** - * 检查用户名称是否存在 - * @param field 用户属性 - * @param username 用户名称 - * @param userID 供应商ID - * @return true==存在重名 false==不存在 - * @throws JshException - */ - Boolean checkIsNameExist(String field,String username,Long userID)throws JshException; + /** + * 获取用户信息 + * + * @param username + * @return 用户信息 + * @throws JshException + */ + public Basicuser getUser(String username) throws JshException; + + /** + * 检查用户名称是否存在 + * + * @param field 用户属性 + * @param username 用户名称 + * @param userID 供应商ID + * @return true==存在重名 false==不存在 + * @throws JshException + */ + Boolean checkIsNameExist(String field, String username, Long userID) throws JshException; } diff --git a/src/main/java/com/jsh/service/basic/UserService.java b/src/main/java/com/jsh/service/basic/UserService.java index f4a52e0b..9996bfdf 100644 --- a/src/main/java/com/jsh/service/basic/UserService.java +++ b/src/main/java/com/jsh/service/basic/UserService.java @@ -1,114 +1,98 @@ package com.jsh.service.basic; +import com.jsh.base.BaseService; +import com.jsh.base.Log; +import com.jsh.dao.basic.UserIDAO; +import com.jsh.model.po.Basicuser; +import com.jsh.util.ExceptionCodeConstants; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; + import java.util.HashMap; import java.util.List; import java.util.Map; -import com.jsh.base.BaseService; -import com.jsh.base.Log; -import com.jsh.util.ExceptionCodeConstants; -import com.jsh.dao.basic.UserBusinessIDAO; -import com.jsh.dao.basic.UserIDAO; -import com.jsh.util.JshException; -import com.jsh.model.po.Basicuser; -import com.jsh.util.PageUtil; +public class UserService extends BaseService implements UserIService { + private PageUtil pageUtil = new PageUtil(); + private Map condition = new HashMap(); + private UserIDAO userDao; -public class UserService extends BaseService implements UserIService -{ - private PageUtil pageUtil = new PageUtil(); - private Map condition = new HashMap(); - private UserIDAO userDao; + @Override + public int validateUser(String username, String password) throws JshException { + try { + //全局变量 每次使用前清除 + condition.clear(); - @Override - public int validateUser(String username, String password)throws JshException - { - try - { - //全局变量 每次使用前清除 - condition.clear(); - - /**默认是可以登录的*/ - List list = null ; - try - { - - condition.put("loginame_s_eq", username); - pageUtil.setAdvSearch(condition); - userDao.find(pageUtil); - list = pageUtil.getPageList(); - } - catch (Exception e) - { - Log.errorFileSync(">>>>>>>>访问验证用户姓名是否存在后台信息异常",e); - return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; - } - - if(null !=list && list.size() == 0) - return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST ; - - try - { - condition.put("loginame_s_eq", username); - condition.put("password_s_eq", password); - pageUtil.setAdvSearch(condition); - userDao.find(pageUtil); - list = pageUtil.getPageList(); - } - catch (Exception e) - { - Log.errorFileSync(">>>>>>>>>>访问验证用户密码后台信息异常",e); - return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; - } - - if(null !=list && list.size() == 0) - return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR; - return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT; - } - catch (Exception e) - { - throw new JshException("unknown exception",e); - } - } + /**默认是可以登录的*/ + List list = null; + try { - @Override - public Basicuser getUser(String username) throws JshException - { - //全局变量 每次使用前清除 - condition.clear(); - condition.put("loginame_s_eq", username); + condition.put("loginame_s_eq", username); + pageUtil.setAdvSearch(condition); + userDao.find(pageUtil); + list = pageUtil.getPageList(); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e); + return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; + } + + if (null != list && list.size() == 0) + return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST; + + try { + condition.put("loginame_s_eq", username); + condition.put("password_s_eq", password); + pageUtil.setAdvSearch(condition); + userDao.find(pageUtil); + list = pageUtil.getPageList(); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>访问验证用户密码后台信息异常", e); + return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; + } + + if (null != list && list.size() == 0) + return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR; + return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT; + } catch (Exception e) { + throw new JshException("unknown exception", e); + } + } + + @Override + public Basicuser getUser(String username) throws JshException { + //全局变量 每次使用前清除 + condition.clear(); + condition.put("loginame_s_eq", username); pageUtil.setAdvSearch(condition); userDao.find(pageUtil); List list = pageUtil.getPageList(); - if(null != list && list.size() >0) - return list.get(0); - else - throw new JshException("no username exist"); - } - - @Override - public Boolean checkIsNameExist(String field,String username, Long userID)throws JshException - { - condition.clear(); + if (null != list && list.size() > 0) + return list.get(0); + else + throw new JshException("no username exist"); + } + + @Override + public Boolean checkIsNameExist(String field, String username, Long userID) throws JshException { + condition.clear(); condition.put(field + "_s_eq", username); condition.put("id_n_neq", userID); pageUtil.setAdvSearch(condition); userDao.find(pageUtil); - + List dataList = pageUtil.getPageList(); - if(null != dataList && dataList.size() > 0) + if (null != dataList && dataList.size() > 0) return true; return false; - } - - //==============spring注入等公共方法,与业务无关========================= - public void setUserDao(UserIDAO userDao) - { - this.userDao = userDao; - } + } - @Override - protected Class getEntityClass() - { - return Basicuser.class; - } + //==============spring注入等公共方法,与业务无关========================= + public void setUserDao(UserIDAO userDao) { + this.userDao = userDao; + } + + @Override + protected Class getEntityClass() { + return Basicuser.class; + } } diff --git a/src/main/java/com/jsh/service/materials/AccountHeadIService.java b/src/main/java/com/jsh/service/materials/AccountHeadIService.java index cb46fcd7..afadf326 100644 --- a/src/main/java/com/jsh/service/materials/AccountHeadIService.java +++ b/src/main/java/com/jsh/service/materials/AccountHeadIService.java @@ -1,18 +1,15 @@ package com.jsh.service.materials; import com.jsh.base.BaseIService; -import com.jsh.util.JshException; import com.jsh.model.po.AccountHead; -import com.jsh.model.po.DepotHead; -import com.jsh.model.po.UserBusiness; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public interface AccountHeadIService extends BaseIService -{ +public interface AccountHeadIService extends BaseIService { /* * 获取MaxId */ - void find(PageUtil accountHead,String maxid)throws JshException; - - void findAllMoney(PageUtil accountHead, Integer supplierId, String type, String mode)throws JshException; + void find(PageUtil accountHead, String maxid) throws JshException; + + void findAllMoney(PageUtil accountHead, Integer supplierId, String type, String mode) throws JshException; } diff --git a/src/main/java/com/jsh/service/materials/AccountHeadService.java b/src/main/java/com/jsh/service/materials/AccountHeadService.java index c4267b1f..69599b96 100644 --- a/src/main/java/com/jsh/service/materials/AccountHeadService.java +++ b/src/main/java/com/jsh/service/materials/AccountHeadService.java @@ -2,14 +2,11 @@ package com.jsh.service.materials; import com.jsh.base.BaseService; import com.jsh.dao.materials.AccountHeadIDAO; -import com.jsh.util.JshException; import com.jsh.model.po.AccountHead; -import com.jsh.model.po.DepotHead; -import com.jsh.model.po.UserBusiness; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public class AccountHeadService extends BaseService implements AccountHeadIService -{ +public class AccountHeadService extends BaseService implements AccountHeadIService { @SuppressWarnings("unused") private AccountHeadIDAO accountHeadDao; @@ -20,18 +17,15 @@ public class AccountHeadService extends BaseService implements Acco @Override - protected Class getEntityClass() - { + protected Class getEntityClass() { return AccountHead.class; } - public void find(PageUtil pageUtil, String maxid) throws JshException - { + public void find(PageUtil pageUtil, String maxid) throws JshException { accountHeadDao.find(pageUtil, maxid); } - - public void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String mode) throws JshException - { - accountHeadDao.findAllMoney(pageUtil, supplierId, type, mode); + + public void findAllMoney(PageUtil pageUtil, Integer supplierId, String type, String mode) throws JshException { + accountHeadDao.findAllMoney(pageUtil, supplierId, type, mode); } } diff --git a/src/main/java/com/jsh/service/materials/AccountItemIService.java b/src/main/java/com/jsh/service/materials/AccountItemIService.java index abd4bebb..b225fa08 100644 --- a/src/main/java/com/jsh/service/materials/AccountItemIService.java +++ b/src/main/java/com/jsh/service/materials/AccountItemIService.java @@ -1,18 +1,8 @@ package com.jsh.service.materials; -import java.io.InputStream; -import java.util.List; - -import net.sf.json.JSONArray; - import com.jsh.base.BaseIService; -import com.jsh.util.JshException; -import com.jsh.model.po.Asset; -import com.jsh.model.po.AccountHead; import com.jsh.model.po.AccountItem; -import com.jsh.util.PageUtil; -public interface AccountItemIService extends BaseIService -{ - +public interface AccountItemIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/materials/AccountItemService.java b/src/main/java/com/jsh/service/materials/AccountItemService.java index 8a982f9b..9e9ff19a 100644 --- a/src/main/java/com/jsh/service/materials/AccountItemService.java +++ b/src/main/java/com/jsh/service/materials/AccountItemService.java @@ -1,24 +1,10 @@ package com.jsh.service.materials; -import java.util.List; -import java.util.Map; - -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; - import com.jsh.base.BaseService; -import com.jsh.base.Log; -import com.jsh.util.AssetConstants; import com.jsh.dao.materials.AccountItemIDAO; -import com.jsh.util.JshException; -import com.jsh.model.po.Asset; -import com.jsh.model.po.AccountHead; import com.jsh.model.po.AccountItem; -import com.jsh.util.PageUtil; -import com.jsh.util.Tools; -public class AccountItemService extends BaseService implements AccountItemIService -{ +public class AccountItemService extends BaseService implements AccountItemIService { @SuppressWarnings("unused") private AccountItemIDAO accoumtItemDao; @@ -29,8 +15,7 @@ public class AccountItemService extends BaseService implements Acco @Override - protected Class getEntityClass() - { + protected Class getEntityClass() { return AccountItem.class; } diff --git a/src/main/java/com/jsh/service/materials/DepotHeadIService.java b/src/main/java/com/jsh/service/materials/DepotHeadIService.java index a0ffcc36..86cd36db 100644 --- a/src/main/java/com/jsh/service/materials/DepotHeadIService.java +++ b/src/main/java/com/jsh/service/materials/DepotHeadIService.java @@ -1,29 +1,27 @@ package com.jsh.service.materials; import com.jsh.base.BaseIService; -import com.jsh.util.JshException; import com.jsh.model.po.DepotHead; -import com.jsh.model.po.UserBusiness; +import com.jsh.util.JshException; import com.jsh.util.PageUtil; -public interface DepotHeadIService extends BaseIService -{ - /* - * 获取MaxId - */ - void find(PageUtil depotHead,String maxid)throws JshException; - - void findAllMoney(PageUtil depotHead, Integer supplierId, String type, String subType, String mode)throws JshException; +public interface DepotHeadIService extends BaseIService { + /* + * 获取MaxId + */ + void find(PageUtil depotHead, String maxid) throws JshException; - void batchSetStatus(Boolean status,String depotHeadIDs); + void findAllMoney(PageUtil depotHead, Integer supplierId, String type, String subType, String mode) throws JshException; - void findInDetail(PageUtil pageUtil,String beginTime,String endTime, String type, Long pid,String dids,Long oId)throws JshException; + void batchSetStatus(Boolean status, String depotHeadIDs); - void findInOutMaterialCount(PageUtil pageUtil,String beginTime,String endTime, String type, Long pid,String dids,Long oId)throws JshException; + void findInDetail(PageUtil pageUtil, String beginTime, String endTime, String type, Long pid, String dids, Long oId) throws JshException; - void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId)throws JshException; + void findInOutMaterialCount(PageUtil pageUtil, String beginTime, String endTime, String type, Long pid, String dids, Long oId) throws JshException; - void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime, Long organId, String supType)throws JshException; + void findMaterialsListByHeaderId(PageUtil pageUtil, Long headerId) throws JshException; - void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam,String depotIds)throws JshException; + void findStatementAccount(PageUtil pageUtil, String beginTime, String endTime, Long organId, String supType) throws JshException; + + void getHeaderIdByMaterial(PageUtil pageUtil, String materialParam, String depotIds) throws JshException; } diff --git a/src/main/java/com/jsh/service/materials/DepotItemIService.java b/src/main/java/com/jsh/service/materials/DepotItemIService.java index 61f9a4f3..2f7b80c4 100644 --- a/src/main/java/com/jsh/service/materials/DepotItemIService.java +++ b/src/main/java/com/jsh/service/materials/DepotItemIService.java @@ -1,34 +1,30 @@ package com.jsh.service.materials; -import java.io.InputStream; -import java.util.List; - +import com.jsh.base.BaseIService; +import com.jsh.model.po.DepotItem; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; import net.sf.json.JSONArray; -import com.jsh.base.BaseIService; -import com.jsh.util.JshException; -import com.jsh.model.po.Asset; -import com.jsh.model.po.DepotHead; -import com.jsh.model.po.DepotItem; -import com.jsh.util.PageUtil; +import java.io.InputStream; -public interface DepotItemIService extends BaseIService -{ - void findByType(PageUtil depotItem, String type,Integer ProjectId, Long MId, String MonthTime,Boolean isPrev)throws JshException; +public interface DepotItemIService extends BaseIService { + void findByType(PageUtil depotItem, String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) throws JshException; - void findByTypeAndMaterialId(PageUtil depotItem, String type, Long MId)throws JshException; + void findByTypeAndMaterialId(PageUtil depotItem, String type, Long MId) throws JshException; - void findDetailByTypeAndMaterialId(PageUtil depotItem, Long MId)throws JshException; + void findDetailByTypeAndMaterialId(PageUtil depotItem, Long MId) throws JshException; - void findPriceByType(PageUtil depotItem, String type,Integer ProjectId, Long MId, String MonthTime,Boolean isPrev)throws JshException; - - void buyOrSale(PageUtil depotItem, String type, String subType, Long MId, String MonthTime, String sumType)throws JshException; + void findPriceByType(PageUtil depotItem, String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) throws JshException; - void findGiftByType(PageUtil depotItem, String subType,Integer ProjectId, Long MId, String type)throws JshException; + void buyOrSale(PageUtil depotItem, String type, String subType, Long MId, String MonthTime, String sumType) throws JshException; - /** - * 导出信息 - * @return - */ - InputStream exmportExcel(String isAllPage,JSONArray dataArray)throws JshException; + void findGiftByType(PageUtil depotItem, String subType, Integer ProjectId, Long MId, String type) throws JshException; + + /** + * 导出信息 + * + * @return + */ + InputStream exmportExcel(String isAllPage, JSONArray dataArray) throws JshException; } diff --git a/src/main/java/com/jsh/service/materials/DepotItemService.java b/src/main/java/com/jsh/service/materials/DepotItemService.java index 73062c47..09c2aea9 100644 --- a/src/main/java/com/jsh/service/materials/DepotItemService.java +++ b/src/main/java/com/jsh/service/materials/DepotItemService.java @@ -1,150 +1,124 @@ package com.jsh.service.materials; +import com.jsh.base.BaseService; +import com.jsh.base.Log; +import com.jsh.dao.materials.DepotItemIDAO; +import com.jsh.model.po.DepotItem; +import com.jsh.util.JshException; +import com.jsh.util.PageUtil; +import jxl.Workbook; +import jxl.write.Label; +import jxl.write.WritableSheet; +import jxl.write.WritableWorkbook; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; -import java.text.DecimalFormat; -import java.util.List; -import java.util.Map; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; - -import jxl.Workbook; -import jxl.write.Label; -import jxl.write.WritableSheet; -import jxl.write.WritableWorkbook; - -import com.jsh.base.BaseService; -import com.jsh.base.Log; -import com.jsh.util.AssetConstants; -import com.jsh.dao.materials.DepotItemIDAO; -import com.jsh.util.JshException; -import com.jsh.model.po.Asset; -import com.jsh.model.po.DepotHead; -import com.jsh.model.po.DepotItem; -import com.jsh.util.PageUtil; -import com.jsh.util.Tools; - -public class DepotItemService extends BaseService implements DepotItemIService -{ - @SuppressWarnings("unused") - private DepotItemIDAO depotItemDao; - - - public void setDepotItemDao(DepotItemIDAO depotItemDao) { - this.depotItemDao = depotItemDao; - } +public class DepotItemService extends BaseService implements DepotItemIService { + @SuppressWarnings("unused") + private DepotItemIDAO depotItemDao; - @Override - protected Class getEntityClass() - { - return DepotItem.class; - } - - @Override - public void findByType(PageUtil pageUtil, String type,Integer ProjectId,Long MId, String MonthTime,Boolean isPrev) throws JshException - { - depotItemDao.findByType(pageUtil, type, ProjectId, MId, MonthTime,isPrev); + public void setDepotItemDao(DepotItemIDAO depotItemDao) { + this.depotItemDao = depotItemDao; } - @Override - public void findByTypeAndMaterialId(PageUtil pageUtil, String type,Long MId) throws JshException - { - depotItemDao.findByTypeAndMaterialId(pageUtil, type, MId); - } - @Override - public void findDetailByTypeAndMaterialId(PageUtil pageUtil,Long MId) throws JshException - { - depotItemDao.findDetailByTypeAndMaterialId(pageUtil, MId); - } - - @Override - public void findPriceByType(PageUtil pageUtil, String type,Integer ProjectId,Long MId, String MonthTime,Boolean isPrev) throws JshException - { - depotItemDao.findPriceByType(pageUtil, type, ProjectId, MId, MonthTime,isPrev); - } - @Override - public void buyOrSale(PageUtil pageUtil, String type,String subType, Long MId, String MonthTime, String sumType) throws JshException - { - depotItemDao.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType); + protected Class getEntityClass() { + return DepotItem.class; } - @Override - public void findGiftByType(PageUtil pageUtil, String subType,Integer ProjectId,Long MId,String type) throws JshException - { - depotItemDao.findGiftByType(pageUtil, subType, ProjectId, MId, type); - } - - /** - * 导出Excel表格 - */ - @Override - public InputStream exmportExcel(String isAllPage,JSONArray dataArray)throws JshException - { - try - { - //将OutputStream转化为InputStream - ByteArrayOutputStream out = new ByteArrayOutputStream(); - putDataOnOutputStream(out,dataArray); - return new ByteArrayInputStream(out.toByteArray()); - } - catch (Exception e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e); - throw new JshException("export asset info to excel exception",e); - } - } - - /** - * 生成excel表格 - * @param os - */ - @SuppressWarnings("deprecation") - private void putDataOnOutputStream(OutputStream os,JSONArray dataArray) - { - WritableWorkbook workbook = null; - try - { - workbook = Workbook.createWorkbook(os); - WritableSheet sheet = workbook.createSheet("进销存报表", 0); - //增加列头 - int[] colunmWidth = {10,10,10,10,10,10,15,15,15,15,15}; - String[] colunmName = {"名称","型号","规格","颜色","单位","单价","上月结存数量","入库数量","出库数量","本月结存数量","结存金额"}; - for(int i = 0 ;i < colunmWidth.length;i ++) - { - sheet.setColumnView(i,colunmWidth[i]); - sheet.addCell(new Label(i, 0, colunmName[i])); - } - if (null != dataArray &&dataArray.size() > 0) - { - for(int j=0; j < dataArray.size(); j++){ - JSONObject jo = JSONObject.fromObject(dataArray.get(j)); - sheet.addCell(new Label(0, j+1, jo.getString("MaterialName"))); - sheet.addCell(new Label(1, j+1, jo.getString("MaterialModel"))); - sheet.addCell(new Label(2, j+1, jo.getString("MaterialStandard"))); - sheet.addCell(new Label(3, j+1, jo.getString("MaterialColor"))); - sheet.addCell(new Label(4, j+1, jo.getString("MaterialUnit"))); - sheet.addCell(new Label(5, j+1, jo.getString("UnitPrice"))); - sheet.addCell(new Label(6, j+1, jo.getString("prevSum"))); - sheet.addCell(new Label(7, j+1, jo.getString("InSum"))); - sheet.addCell(new Label(8, j+1, jo.getString("OutSum"))); - sheet.addCell(new Label(9, j+1, jo.getString("thisSum"))); - double d = Double.parseDouble(jo.getString("thisAllPrice").toString()); - String s1 = String.format("%.2f", d); - sheet.addCell(new Label(10, j+1, s1)); - } - } - workbook.write(); - workbook.close(); - } - catch (Exception e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e); - } - } + @Override + public void findByType(PageUtil pageUtil, String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) throws JshException { + depotItemDao.findByType(pageUtil, type, ProjectId, MId, MonthTime, isPrev); + } + + @Override + public void findByTypeAndMaterialId(PageUtil pageUtil, String type, Long MId) throws JshException { + depotItemDao.findByTypeAndMaterialId(pageUtil, type, MId); + } + + @Override + public void findDetailByTypeAndMaterialId(PageUtil pageUtil, Long MId) throws JshException { + depotItemDao.findDetailByTypeAndMaterialId(pageUtil, MId); + } + + @Override + public void findPriceByType(PageUtil pageUtil, String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) throws JshException { + depotItemDao.findPriceByType(pageUtil, type, ProjectId, MId, MonthTime, isPrev); + } + + @Override + public void buyOrSale(PageUtil pageUtil, String type, String subType, Long MId, String MonthTime, String sumType) throws JshException { + depotItemDao.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType); + } + + @Override + public void findGiftByType(PageUtil pageUtil, String subType, Integer ProjectId, Long MId, String type) throws JshException { + depotItemDao.findGiftByType(pageUtil, subType, ProjectId, MId, type); + } + + /** + * 导出Excel表格 + */ + @Override + public InputStream exmportExcel(String isAllPage, JSONArray dataArray) throws JshException { + try { + //将OutputStream转化为InputStream + ByteArrayOutputStream out = new ByteArrayOutputStream(); + putDataOnOutputStream(out, dataArray); + return new ByteArrayInputStream(out.toByteArray()); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e); + throw new JshException("export asset info to excel exception", e); + } + } + + /** + * 生成excel表格 + * + * @param os + */ + @SuppressWarnings("deprecation") + private void putDataOnOutputStream(OutputStream os, JSONArray dataArray) { + WritableWorkbook workbook = null; + try { + workbook = Workbook.createWorkbook(os); + WritableSheet sheet = workbook.createSheet("进销存报表", 0); + //增加列头 + int[] colunmWidth = {10, 10, 10, 10, 10, 10, 15, 15, 15, 15, 15}; + String[] colunmName = {"名称", "型号", "规格", "颜色", "单位", "单价", "上月结存数量", "入库数量", "出库数量", "本月结存数量", "结存金额"}; + for (int i = 0; i < colunmWidth.length; i++) { + sheet.setColumnView(i, colunmWidth[i]); + sheet.addCell(new Label(i, 0, colunmName[i])); + } + if (null != dataArray && dataArray.size() > 0) { + for (int j = 0; j < dataArray.size(); j++) { + JSONObject jo = JSONObject.fromObject(dataArray.get(j)); + sheet.addCell(new Label(0, j + 1, jo.getString("MaterialName"))); + sheet.addCell(new Label(1, j + 1, jo.getString("MaterialModel"))); + sheet.addCell(new Label(2, j + 1, jo.getString("MaterialStandard"))); + sheet.addCell(new Label(3, j + 1, jo.getString("MaterialColor"))); + sheet.addCell(new Label(4, j + 1, jo.getString("MaterialUnit"))); + sheet.addCell(new Label(5, j + 1, jo.getString("UnitPrice"))); + sheet.addCell(new Label(6, j + 1, jo.getString("prevSum"))); + sheet.addCell(new Label(7, j + 1, jo.getString("InSum"))); + sheet.addCell(new Label(8, j + 1, jo.getString("OutSum"))); + sheet.addCell(new Label(9, j + 1, jo.getString("thisSum"))); + double d = Double.parseDouble(jo.getString("thisAllPrice").toString()); + String s1 = String.format("%.2f", d); + sheet.addCell(new Label(10, j + 1, s1)); + } + } + workbook.write(); + workbook.close(); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e); + } + } } diff --git a/src/main/java/com/jsh/service/materials/MaterialCategoryIService.java b/src/main/java/com/jsh/service/materials/MaterialCategoryIService.java index f5bbbbfa..58cf9ca1 100644 --- a/src/main/java/com/jsh/service/materials/MaterialCategoryIService.java +++ b/src/main/java/com/jsh/service/materials/MaterialCategoryIService.java @@ -3,7 +3,6 @@ package com.jsh.service.materials; import com.jsh.base.BaseIService; import com.jsh.model.po.MaterialCategory; -public interface MaterialCategoryIService extends BaseIService -{ - +public interface MaterialCategoryIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/materials/MaterialCategoryService.java b/src/main/java/com/jsh/service/materials/MaterialCategoryService.java index 00805889..a5ebb93a 100644 --- a/src/main/java/com/jsh/service/materials/MaterialCategoryService.java +++ b/src/main/java/com/jsh/service/materials/MaterialCategoryService.java @@ -4,21 +4,19 @@ import com.jsh.base.BaseService; import com.jsh.dao.materials.MaterialCategoryIDAO; import com.jsh.model.po.MaterialCategory; -public class MaterialCategoryService extends BaseService implements MaterialCategoryIService -{ - @SuppressWarnings("unused") - private MaterialCategoryIDAO materialCategoryDao; - - - public void setMaterialCategoryDao(MaterialCategoryIDAO materialCategoryDao) { - this.materialCategoryDao = materialCategoryDao; - } +public class MaterialCategoryService extends BaseService implements MaterialCategoryIService { + @SuppressWarnings("unused") + private MaterialCategoryIDAO materialCategoryDao; - @Override - protected Class getEntityClass() - { - return MaterialCategory.class; - } - + public void setMaterialCategoryDao(MaterialCategoryIDAO materialCategoryDao) { + this.materialCategoryDao = materialCategoryDao; + } + + + @Override + protected Class getEntityClass() { + return MaterialCategory.class; + } + } diff --git a/src/main/java/com/jsh/service/materials/MaterialIService.java b/src/main/java/com/jsh/service/materials/MaterialIService.java index 681a4347..83862b4a 100644 --- a/src/main/java/com/jsh/service/materials/MaterialIService.java +++ b/src/main/java/com/jsh/service/materials/MaterialIService.java @@ -8,13 +8,12 @@ import com.jsh.util.PageUtil; import java.io.File; import java.io.InputStream; -public interface MaterialIService extends BaseIService -{ - public void batchSetEnable(Boolean enable,String supplierIDs); +public interface MaterialIService extends BaseIService { + public void batchSetEnable(Boolean enable, String supplierIDs); - public void findUnitName(PageUtil material, Long mId)throws JshException; + public void findUnitName(PageUtil material, Long mId) throws JshException; - public InputStream exmportExcel(String isAllPage,PageUtil pageUtil)throws JshException; + public InputStream exmportExcel(String isAllPage, PageUtil pageUtil) throws JshException; - public InputStream importExcel(File materialFile)throws JshException; + public InputStream importExcel(File materialFile) throws JshException; } diff --git a/src/main/java/com/jsh/service/materials/MaterialPropertyIService.java b/src/main/java/com/jsh/service/materials/MaterialPropertyIService.java index 211a8adf..7dc2eca6 100644 --- a/src/main/java/com/jsh/service/materials/MaterialPropertyIService.java +++ b/src/main/java/com/jsh/service/materials/MaterialPropertyIService.java @@ -3,7 +3,6 @@ package com.jsh.service.materials; import com.jsh.base.BaseIService; import com.jsh.model.po.MaterialProperty; -public interface MaterialPropertyIService extends BaseIService -{ - +public interface MaterialPropertyIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/materials/MaterialPropertyService.java b/src/main/java/com/jsh/service/materials/MaterialPropertyService.java index a1a30a7c..73feece7 100644 --- a/src/main/java/com/jsh/service/materials/MaterialPropertyService.java +++ b/src/main/java/com/jsh/service/materials/MaterialPropertyService.java @@ -4,21 +4,19 @@ import com.jsh.base.BaseService; import com.jsh.dao.materials.MaterialPropertyIDAO; import com.jsh.model.po.MaterialProperty; -public class MaterialPropertyService extends BaseService implements MaterialPropertyIService -{ - @SuppressWarnings("unused") - private MaterialPropertyIDAO materialPropertyDao; - - - public void setMaterialPropertyDao(MaterialPropertyIDAO materialPropertyDao) { - this.materialPropertyDao = materialPropertyDao; - } +public class MaterialPropertyService extends BaseService implements MaterialPropertyIService { + @SuppressWarnings("unused") + private MaterialPropertyIDAO materialPropertyDao; - @Override - protected Class getEntityClass() - { - return MaterialProperty.class; - } - + public void setMaterialPropertyDao(MaterialPropertyIDAO materialPropertyDao) { + this.materialPropertyDao = materialPropertyDao; + } + + + @Override + protected Class getEntityClass() { + return MaterialProperty.class; + } + } diff --git a/src/main/java/com/jsh/service/materials/MaterialService.java b/src/main/java/com/jsh/service/materials/MaterialService.java index c15c84ad..c96bfc25 100644 --- a/src/main/java/com/jsh/service/materials/MaterialService.java +++ b/src/main/java/com/jsh/service/materials/MaterialService.java @@ -21,305 +21,284 @@ import java.io.*; import java.lang.Boolean; import java.util.*; -public class MaterialService extends BaseService implements MaterialIService -{ - @SuppressWarnings("unused") - private MaterialIDAO materialDao; +public class MaterialService extends BaseService implements MaterialIService { + /** + * 初始化加载所有系统基础数据 + */ + @SuppressWarnings({"rawtypes"}) + private static Map mapData = new HashMap(); + /** + * 错误的表格数据 + */ + private static List wrongData = new ArrayList(); + @SuppressWarnings("unused") + private MaterialIDAO materialDao; - - public void setMaterialDao(MaterialIDAO materialDao) { - this.materialDao = materialDao; - } + public void setMaterialDao(MaterialIDAO materialDao) { + this.materialDao = materialDao; + } - public void batchSetEnable(Boolean enable,String supplierIDs){ - materialDao.batchSetEnable(enable, supplierIDs); - } + public void batchSetEnable(Boolean enable, String supplierIDs) { + materialDao.batchSetEnable(enable, supplierIDs); + } + + @Override + public void findUnitName(PageUtil pageUtil, Long mId) throws JshException { + materialDao.findUnitName(pageUtil, mId); + } + + @Override + protected Class getEntityClass() { + return Material.class; + } + + /** + * 导出Excel表格 + */ + @Override + public InputStream exmportExcel(String isAllPage, PageUtil pageUtil) throws JshException { + try { + //将OutputStream转化为InputStream + 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表格 + * + * @param os + */ + @SuppressWarnings("deprecation") + private void putDataOnOutputStream(OutputStream os, List dataList) { + WritableWorkbook workbook = null; + try { + workbook = Workbook.createWorkbook(os); + WritableSheet sheet = workbook.createSheet("信息报表", 0); + //增加列头 + String[] colunmName = {"品名", "类型", "型号", "安全存量", "单位", "零售价", "最低售价", "预计采购价", "批发价", "备注", "状态"}; + for (int i = 0; i < colunmName.length; i++) { + sheet.setColumnView(i, 10); + sheet.addCell(new Label(i, 0, colunmName[i])); + } + if (null != dataList && dataList.size() > 0) { + int i = 1; + for (Material material : dataList) { + int j = 0; + Map cellInfo = material.getCellInfo(); + sheet.addCell(new Label(j++, i, material.getName())); + sheet.addCell(new Label(j++, i, material.getMaterialCategory().getName())); + sheet.addCell(new Label(j++, i, material.getModel() == null ? "" : material.getModel())); + sheet.addCell(getLabelInfo(cellInfo, j++, i, material.getSafetyStock() == null ? "" : material.getSafetyStock().toString(), material)); + sheet.addCell(new Label(j++, i, material.getUnit() == null ? "" : material.getUnit())); + sheet.addCell(new Label(j++, i, material.getRetailPrice() == null ? "" : material.getRetailPrice().toString())); + sheet.addCell(new Label(j++, i, material.getLowPrice() == null ? "" : material.getLowPrice().toString())); + sheet.addCell(new Label(j++, i, material.getPresetPriceOne() == null ? "" : material.getPresetPriceOne().toString())); + sheet.addCell(new Label(j++, i, material.getPresetPriceTwo() == null ? "" : material.getPresetPriceTwo().toString())); + sheet.addCell(new Label(j++, i, material.getRemark() == null ? "" : material.getRemark())); + sheet.addCell(new Label(j++, i, material.getEnabled() ? "启用" : "禁用")); + i++; + } + } + workbook.write(); + workbook.close(); + } catch (Exception e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e); + } + } + + /** + * 根据错误信息进行提示--excel表格背景设置为红色,表示导入信息有误 + * + * @param cellInfo + * @param cellNum + * @param columnNum + * @param value + * @return + */ + private Label getLabelInfo(Map cellInfo, int cellNum, int columnNum, String value, Material material) { + Label label = null; + + //设置背景颜色 + WritableCellFormat cellFormat = new WritableCellFormat(); + try { + cellFormat.setBackground(Colour.RED); + } catch (WriteException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误", e); + } + + if (null == cellInfo || cellInfo.size() == 0) { + label = new Label(cellNum, columnNum, value); + } else { + //表示此单元格有错误 + if (cellInfo.containsKey(cellNum)) { + if (cellNum == MaterialConstants.BusinessForExcel.EXCEL_SAFETY_STOCK) { + label = new Label(cellNum, columnNum, material.getSafetyStockStr(), cellFormat); + } + } else { + label = new Label(cellNum, columnNum, value); + } + } + return label; + } + + @Override + public InputStream importExcel(File materialFile) throws JshException { + //全局变量--每次调用前需要清空数据 + mapData.clear(); + //2、解析文件成资产数据 + parseFile(materialFile); + + if (null != wrongData && wrongData.size() > 0) { + //将OutputStream转化为InputStream + ByteArrayOutputStream out = new ByteArrayOutputStream(); + putDataOnOutputStream(out, wrongData); + return new ByteArrayInputStream(out.toByteArray()); + } else { + return null; + } + } - @Override - public void findUnitName(PageUtil pageUtil, Long mId) throws JshException - { - materialDao.findUnitName(pageUtil, mId); - } + /** + * 解析excel表格 + * + * @param assetFile + */ + @SuppressWarnings("unchecked") + private void parseFile(File assetFile) { + //每次调用前清空 + wrongData.clear(); + int totalRow = 0; + try { + //创建对Excel工作簿文件的引用 + HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(assetFile)); + //创建对工作表的引用,获取第一个工作表的内容 + HSSFSheet sheet = workbook.getSheetAt(0); + /** + * ===================================== + * 1、此处要增加文件的验证,如果不是资产文件需要进行特殊的处理,13列 + * 2、文件内容为空处理 + * 3、如果是修改过的文件内容 + */ + Iterator itsheet = sheet.rowIterator(); + while (itsheet.hasNext()) { + //获取当前行数据 + Row row = itsheet.next(); - @Override - protected Class getEntityClass() - { - return Material.class; - } + //excel表格第几行数据 从1开始 0 是表头 + int rowNum = row.getRowNum(); + /** + * 表头跳过不读 + */ + if (MaterialConstants.BusinessForExcel.EXCEL_TABLE_HEAD == rowNum) + continue; - /** - * 初始化加载所有系统基础数据 - */ - @SuppressWarnings({"rawtypes"}) - private static Map mapData = new HashMap(); + //开始处理excel表格内容 --每行数据读取,同时统计总共行数 + totalRow++; - /** - * 错误的表格数据 - */ - private static List wrongData = new ArrayList(); - /** - * 导出Excel表格 - */ - @Override - public InputStream exmportExcel(String isAllPage, PageUtil pageUtil)throws JshException - { - try - { - //将OutputStream转化为InputStream - 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表格的每格数据内容 + Iterator it = row.cellIterator(); + //资产子类型--添加了一些excel表格数据 + Material material = new Material(); + //保存每个单元格错误类型 + Map cellType = new HashMap(); + //设置列号 + material.setRowLineNum(rowNum); - /** - * 生成excel表格 - * @param os - */ - @SuppressWarnings("deprecation") - private void putDataOnOutputStream(OutputStream os, List dataList) { - WritableWorkbook workbook = null; - try { - workbook = Workbook.createWorkbook(os); - WritableSheet sheet = workbook.createSheet("信息报表", 0); - //增加列头 - String[] colunmName = {"品名","类型","型号","安全存量","单位","零售价","最低售价","预计采购价","批发价","备注","状态"}; - for(int i = 0 ;i < colunmName.length;i ++) { - sheet.setColumnView(i, 10); - sheet.addCell(new Label(i, 0, colunmName[i])); - } - if (null != dataList && dataList.size() > 0) { - int i = 1; - for (Material material: dataList){ - int j = 0; - Map cellInfo = material.getCellInfo(); - sheet.addCell(new Label(j++,i, material.getName())); - sheet.addCell(new Label(j++,i, material.getMaterialCategory().getName())); - sheet.addCell(new Label(j++,i, material.getModel() == null ?"": material.getModel())); - sheet.addCell(getLabelInfo(cellInfo,j++,i, material.getSafetyStock() == null ?"": material.getSafetyStock().toString(),material)); - sheet.addCell(new Label(j++,i, material.getUnit() == null ?"": material.getUnit())); - sheet.addCell(new Label(j++,i, material.getRetailPrice() == null ?"": material.getRetailPrice().toString())); - sheet.addCell(new Label(j++,i, material.getLowPrice() == null ?"": material.getLowPrice().toString())); - sheet.addCell(new Label(j++,i, material.getPresetPriceOne() == null ?"": material.getPresetPriceOne().toString())); - sheet.addCell(new Label(j++,i, material.getPresetPriceTwo() == null ?"": material.getPresetPriceTwo().toString())); - sheet.addCell(new Label(j++,i, material.getRemark() == null ?"": material.getRemark())); - sheet.addCell(new Label(j++,i, material.getEnabled()?"启用":"禁用")); - i++; - } - } - workbook.write(); - workbook.close(); - } - catch (Exception e) { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e); - } - } + Cell cell = null; + //判断列号--从零开始 + int cellIndex = 0; + while (it.hasNext()) { + //获取每个单元格对象 + cell = it.next(); + //获取列号 + cellIndex = cell.getColumnIndex(); + //设置此单元格为字符串类型 + cell.setCellType(Cell.CELL_TYPE_STRING); - /** - * 根据错误信息进行提示--excel表格背景设置为红色,表示导入信息有误 - * @param cellInfo - * @param cellNum - * @param columnNum - * @param value - * @return - */ - private Label getLabelInfo(Map cellInfo,int cellNum,int columnNum,String value,Material material) - { - Label label = null; + Log.infoFileSync("==================excel表格中第" + totalRow + "行的第 " + cellIndex + "列的值为" + cell.getStringCellValue()); - //设置背景颜色 - WritableCellFormat cellFormat = new WritableCellFormat(); - try - { - cellFormat.setBackground(Colour.RED); - } - catch (WriteException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>设置单元格背景颜色错误", e); - } + //每行中数据顺序 "品名","类型","型号","安全存量","单位","零售价","最低售价","预计采购价","批发价","备注","状态" + switch (cellIndex) { + case MaterialConstants.BusinessForExcel.EXCEL_NAME: + String materialName = cell.getStringCellValue(); + if (null == materialName || "".equals(materialName)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(品名)信息"); + break; + } + material.setName(materialName); + break; + case MaterialConstants.BusinessForExcel.EXCEL_CATEGORY: + String category = cell.getStringCellValue(); + if (null == category || "".equals(category)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(类型)信息"); + break; + } + material.setMaterialCategory(new MaterialCategory(1l)); //根目录 + break; + case MaterialConstants.BusinessForExcel.EXCEL_MODEL: + String model = cell.getStringCellValue(); + if (null == model || "".equals(model)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(型号)信息"); + break; + } + material.setModel(model); + break; + case MaterialConstants.BusinessForExcel.EXCEL_SAFETY_STOCK: + String safetyStock = cell.getStringCellValue(); + if (null == safetyStock || "".equals(safetyStock)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(安全存量)信息"); + break; + } + if (Tools.checkStrIsNum(safetyStock)) { + material.setSafetyStock(Double.parseDouble(safetyStock)); + } else { + Log.errorFileSync(">>>>>>>>>>>>>>>>>(安全存量)不是数字格式"); + cellType.put(cellIndex, "wrong"); + material.setSafetyStock(0.00d); + material.setSafetyStockStr(safetyStock); + } + break; + case MaterialConstants.BusinessForExcel.EXCEL_UNIT: + String unit = cell.getStringCellValue(); + if (null == unit || "".equals(unit)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(单位)信息"); + break; + } + material.setUnit(unit); + break; + case MaterialConstants.BusinessForExcel.EXCEL_REMARK: + String remark = cell.getStringCellValue(); + if (null == remark || "".equals(remark)) { + Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(备注)信息"); + break; + } + material.setRemark(remark); + break; + } + } + material.setCellInfo(cellType); - if(null == cellInfo || cellInfo.size() == 0) { - label = new Label(cellNum, columnNum, value); - } - else { - //表示此单元格有错误 - if(cellInfo.containsKey(cellNum)) { - if(cellNum == MaterialConstants.BusinessForExcel.EXCEL_SAFETY_STOCK) { - label = new Label(cellNum, columnNum, material.getSafetyStockStr(), cellFormat); - } - } - else{ - label = new Label(cellNum, columnNum, value); - } - } - return label; - } + Log.infoFileSync(totalRow + "行总共有" + cellIndex + "列"); - @Override - public InputStream importExcel(File materialFile) throws JshException { - //全局变量--每次调用前需要清空数据 - mapData.clear(); - //2、解析文件成资产数据 - parseFile(materialFile); - - if(null != wrongData && wrongData.size()>0) { - //将OutputStream转化为InputStream - ByteArrayOutputStream out = new ByteArrayOutputStream(); - putDataOnOutputStream(out,wrongData); - return new ByteArrayInputStream(out.toByteArray()); - } - else{ - return null; - } - } - - - /** - * 解析excel表格 - * @param assetFile - */ - @SuppressWarnings("unchecked") - private void parseFile(File assetFile) { - //每次调用前清空 - wrongData.clear(); - int totalRow = 0; - try { - //创建对Excel工作簿文件的引用 - HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(assetFile)); - //创建对工作表的引用,获取第一个工作表的内容 - HSSFSheet sheet = workbook.getSheetAt(0); - /** - * ===================================== - * 1、此处要增加文件的验证,如果不是资产文件需要进行特殊的处理,13列 - * 2、文件内容为空处理 - * 3、如果是修改过的文件内容 - */ - Iterator itsheet = sheet.rowIterator(); - while(itsheet.hasNext()) { - //获取当前行数据 - Row row = itsheet.next(); - - //excel表格第几行数据 从1开始 0 是表头 - int rowNum = row.getRowNum(); - /** - * 表头跳过不读 - */ - if(MaterialConstants.BusinessForExcel.EXCEL_TABLE_HEAD == rowNum) - continue; - - //开始处理excel表格内容 --每行数据读取,同时统计总共行数 - totalRow ++; - - //获取excel表格的每格数据内容 - Iterator it = row.cellIterator(); - //资产子类型--添加了一些excel表格数据 - Material material = new Material(); - //保存每个单元格错误类型 - Map cellType = new HashMap(); - //设置列号 - material.setRowLineNum(rowNum); - - Cell cell = null; - //判断列号--从零开始 - int cellIndex = 0; - while(it.hasNext()) { - //获取每个单元格对象 - cell = it.next(); - //获取列号 - cellIndex = cell.getColumnIndex(); - //设置此单元格为字符串类型 - cell.setCellType(Cell.CELL_TYPE_STRING); - - Log.infoFileSync("==================excel表格中第" + totalRow + "行的第 " + cellIndex + "列的值为" + cell.getStringCellValue()); - - //每行中数据顺序 "品名","类型","型号","安全存量","单位","零售价","最低售价","预计采购价","批发价","备注","状态" - switch(cellIndex) { - case MaterialConstants.BusinessForExcel.EXCEL_NAME : - String materialName = cell.getStringCellValue(); - if(null == materialName || "".equals(materialName)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(品名)信息"); - break; - } - material.setName(materialName); - break; - case MaterialConstants.BusinessForExcel.EXCEL_CATEGORY : - String category = cell.getStringCellValue(); - if(null == category || "".equals(category)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(类型)信息"); - break; - } - material.setMaterialCategory(new MaterialCategory(1l)); //根目录 - break; - case MaterialConstants.BusinessForExcel.EXCEL_MODEL: - String model = cell.getStringCellValue(); - if(null == model || "".equals(model)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(型号)信息"); - break; - } - material.setModel(model); - break; - case MaterialConstants.BusinessForExcel.EXCEL_SAFETY_STOCK : - String safetyStock = cell.getStringCellValue(); - if(null == safetyStock || "".equals(safetyStock)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(安全存量)信息"); - break; - } - if(Tools.checkStrIsNum(safetyStock)) { - material.setSafetyStock(Double.parseDouble(safetyStock)); - } - else{ - Log.errorFileSync(">>>>>>>>>>>>>>>>>(安全存量)不是数字格式"); - cellType.put(cellIndex, "wrong"); - material.setSafetyStock(0.00d); - material.setSafetyStockStr(safetyStock); - } - break; - case MaterialConstants.BusinessForExcel.EXCEL_UNIT: - String unit = cell.getStringCellValue(); - if(null == unit || "".equals(unit)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(单位)信息"); - break; - } - material.setUnit(unit); - break; - case MaterialConstants.BusinessForExcel.EXCEL_REMARK : - String remark = cell.getStringCellValue(); - if(null == remark || "".equals(remark)) { - Log.errorFileSync(">>>>>>>>>>>>>>>>列表没有填写(备注)信息"); - break; - } - material.setRemark(remark); - break; - } - } - material.setCellInfo(cellType); - - Log.infoFileSync(totalRow + "行总共有" + cellIndex + "列"); - - //判断完成后增加数据 - if((null!=cellType && cellType.size() >0) || material.getName() == null) { - wrongData.add(material); - } - else { - material.setEnabled(true); - materialDao.save(material); - } - } - } - catch (FileNotFoundException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!",e); - } - catch (IOException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !",e); - } - Log.infoFileSync("===================excel表格总共有 " + totalRow + " 条记录!"); - } + //判断完成后增加数据 + if ((null != cellType && cellType.size() > 0) || material.getName() == null) { + wrongData.add(material); + } else { + material.setEnabled(true); + materialDao.save(material); + } + } + } catch (FileNotFoundException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常:找不到指定文件!", e); + } catch (IOException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>读取excel文件异常,请确认文件格式是否正确 !", e); + } + Log.infoFileSync("===================excel表格总共有 " + totalRow + " 条记录!"); + } } diff --git a/src/main/java/com/jsh/service/materials/PersonIService.java b/src/main/java/com/jsh/service/materials/PersonIService.java index 8f49cd9b..948a6479 100644 --- a/src/main/java/com/jsh/service/materials/PersonIService.java +++ b/src/main/java/com/jsh/service/materials/PersonIService.java @@ -3,7 +3,6 @@ package com.jsh.service.materials; import com.jsh.base.BaseIService; import com.jsh.model.po.Person; -public interface PersonIService extends BaseIService -{ - +public interface PersonIService extends BaseIService { + } diff --git a/src/main/java/com/jsh/service/materials/PersonService.java b/src/main/java/com/jsh/service/materials/PersonService.java index 47563a23..1e05c4c4 100644 --- a/src/main/java/com/jsh/service/materials/PersonService.java +++ b/src/main/java/com/jsh/service/materials/PersonService.java @@ -4,21 +4,19 @@ import com.jsh.base.BaseService; import com.jsh.dao.materials.PersonIDAO; import com.jsh.model.po.Person; -public class PersonService extends BaseService implements PersonIService -{ - @SuppressWarnings("unused") - private PersonIDAO personDao; - - - public void setPersonDao(PersonIDAO personDao) { - this.personDao = personDao; - } +public class PersonService extends BaseService implements PersonIService { + @SuppressWarnings("unused") + private PersonIDAO personDao; - @Override - protected Class getEntityClass() - { - return Person.class; - } - + public void setPersonDao(PersonIDAO personDao) { + this.personDao = personDao; + } + + + @Override + protected Class getEntityClass() { + return Person.class; + } + } diff --git a/src/main/java/com/jsh/util/AssetConstants.java b/src/main/java/com/jsh/util/AssetConstants.java index e92e3f19..b88bdac8 100644 --- a/src/main/java/com/jsh/util/AssetConstants.java +++ b/src/main/java/com/jsh/util/AssetConstants.java @@ -2,26 +2,26 @@ package com.jsh.util; /** * 定义资产管理常量 + * * @author jishenghua */ -public interface AssetConstants -{ +public interface AssetConstants { /** * 公共常量 + * * @author jishenghua */ - public class Common - { + public class Common { + - } /** * 资产常量--导入导出excel表格业务相关 + * * @author jishenghua */ - public class BusinessForExcel - { + public class BusinessForExcel { /** * 资产名称常量 */ @@ -65,17 +65,17 @@ public interface AssetConstants /** * 序列号 */ - public static final int EXCEL_SERIALNO = 8; + public static final int EXCEL_SERIALNO = 8; /** * 有效日期 */ - public static final int EXCEL_EXPIRATION_DATE = 9; + public static final int EXCEL_EXPIRATION_DATE = 9; /** * 保修日期 */ - public static final int EXCEL_WARRANTY_DATE = 10; + public static final int EXCEL_WARRANTY_DATE = 10; /** * 供应商 @@ -116,6 +116,6 @@ public interface AssetConstants * action返回excel结果 */ public static final String EXCEL = "excel"; - + } } diff --git a/src/main/java/com/jsh/util/BeanFactoryUtil.java b/src/main/java/com/jsh/util/BeanFactoryUtil.java index fe01bf22..719cabe4 100644 --- a/src/main/java/com/jsh/util/BeanFactoryUtil.java +++ b/src/main/java/com/jsh/util/BeanFactoryUtil.java @@ -1,127 +1,117 @@ package com.jsh.util; -import java.util.HashMap; -import java.util.Map; - import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; +import java.util.HashMap; +import java.util.Map; + /** * 获取spring配置中的bean对象,是单例,只会加载一次,请注意使用 * 注意:此工具类默认处理UI组件WEB-INF目录下的applicationContext.xml配置文件,请注意文件 名和路径 - * @author jishenghua - * @qq 7 5 2 7 1 8 9 2 0 + * + * @author jishenghua * @version V1.0 + * @qq 7 5 2 7 1 8 9 2 0 */ -public class BeanFactoryUtil -{ +public class BeanFactoryUtil { private static BeanFactoryUtil defaultBeanFactory; - - private ApplicationContext defaultAC = null; - - //private ApplicationContext autoLoadAC = null; - private static BeanFactoryUtil specialBeanFactory; - - private ApplicationContext specialAC = null; - + + //private ApplicationContext autoLoadAC = null; private static Map beanMap = new HashMap(); - + private ApplicationContext defaultAC = null; + private ApplicationContext specialAC = null; + //private Logger log = Logger.getLogger(BeanFactoryUtil.class); - + /** * 私有构造函数,默认为UI组件WEB-INF目录下的applicationContext.xml配置文件 */ - private BeanFactoryUtil() - { + private BeanFactoryUtil() { String fileUrl = PathTool.getWebinfPath(); //这里只对UI组件WEB-INF目录下的applicationContext.xml配置文件 - defaultAC = new FileSystemXmlApplicationContext( new - String[]{fileUrl - + "spring/basic-applicationContext.xml", - fileUrl + "spring/dao-applicationContext.xml"}); + defaultAC = new FileSystemXmlApplicationContext(new + String[]{fileUrl + + "spring/basic-applicationContext.xml", + fileUrl + "spring/dao-applicationContext.xml"}); } - + /** * 私有构造函数,带有文件的classpath路径,可能是非applicationContext.xml文件 */ - private BeanFactoryUtil(String fileClassPath) - { + private BeanFactoryUtil(String fileClassPath) { specialAC = new ClassPathXmlApplicationContext("classpath:" + fileClassPath); } - + /** * 非web.xml方式加载spring配置文件方式的实体实例获取方式 + * * @param fileClassPath * @param beanName - * @return + * @return */ public synchronized static Object getBeanByClassPathAndBeanName( - String fileClassPath, String beanName) - { + String fileClassPath, String beanName) { ApplicationContext ac = beanMap.get(fileClassPath); - if (null == ac) - { + if (null == ac) { ac = new ClassPathXmlApplicationContext("classpath:" + fileClassPath); beanMap.put(fileClassPath, ac); } return ac.getBean(beanName); } - + /** * 获取类实例 * 默认加载UI组件WEB-INF目录下的applicationContext.xml配置文件 - * @return * + * @return */ - public synchronized static BeanFactoryUtil getInstance() - { - if (null == defaultBeanFactory) - { + public synchronized static BeanFactoryUtil getInstance() { + if (null == defaultBeanFactory) { defaultBeanFactory = new BeanFactoryUtil(); } return defaultBeanFactory; } - + /** * 获取类实例,这种情况一定是在依赖其他组件时没有在applicationContext.xml加载器spring文件时使用 * 这种情况请少用 + * * @param fileClassPath - * @return + * @return */ @Deprecated - public synchronized static BeanFactoryUtil getInstance(String fileClassPath) - { - if (null == specialBeanFactory) - { + public synchronized static BeanFactoryUtil getInstance(String fileClassPath) { + if (null == specialBeanFactory) { specialBeanFactory = new BeanFactoryUtil(fileClassPath); } return specialBeanFactory; } - + /** * 获取UI组件WEB-INF目录下的applicationContext.xml配置文件中配置的bean实例 + * * @param beanName - * @return + * @return */ - public Object getBean(String beanName) - { + public Object getBean(String beanName) { return defaultAC.getBean(beanName); } - + /** * 获取没有在applicationContext.xml配置文件中引入的spring配置文件,即没有用容器加载过的配置文件 * 这里为特殊情况下使用,不推荐使用 * 推荐在applicationContext.xml配置文件中引入需要使用的spring配置文件,然后使用BeanFactoryUtil.getInstance().getBean("")方法 + * * @param beanName - * @return + * @return */ @Deprecated - public Object getSpecialBean(String beanName) - { + public Object getSpecialBean(String beanName) { return specialAC.getBean(beanName); } } diff --git a/src/main/java/com/jsh/util/ExceptionCodeConstants.java b/src/main/java/com/jsh/util/ExceptionCodeConstants.java index 36de1fab..db4afcad 100644 --- a/src/main/java/com/jsh/util/ExceptionCodeConstants.java +++ b/src/main/java/com/jsh/util/ExceptionCodeConstants.java @@ -1,12 +1,10 @@ package com.jsh.util; -public interface ExceptionCodeConstants -{ +public interface ExceptionCodeConstants { /** * 用户错误码定义 */ - public class UserExceptionCode - { + public class UserExceptionCode { /** * 用户不存在 */ diff --git a/src/main/java/com/jsh/util/JshConstants.java b/src/main/java/com/jsh/util/JshConstants.java index a4a31dd1..91332ef3 100644 --- a/src/main/java/com/jsh/util/JshConstants.java +++ b/src/main/java/com/jsh/util/JshConstants.java @@ -1,13 +1,12 @@ package com.jsh.util; -public interface JshConstants -{ +public interface JshConstants { /** * 定义资产管理公共常量 + * * @author jishenghua */ - public class Common - { + public class Common { /** * Info级别日志前缀 */ @@ -19,17 +18,17 @@ public interface JshConstants public static final String LOG_ERROR_PREFIX = ">>>>>>>>>>"; /** - * debug级别日志前缀 + * debug级别日志前缀 */ public static final String LOG_DEBUG_PREFIX = "-----------"; /** - * fatal级别日志前缀 + * fatal级别日志前缀 */ public static final String LOG_FATAL_PREFIX = "$$$$$$$$$$"; /** - * warn级别日志前缀 + * warn级别日志前缀 */ public static final String LOG_WARN_PREFIX = "##########"; } diff --git a/src/main/java/com/jsh/util/JshException.java b/src/main/java/com/jsh/util/JshException.java index ad643868..d7b2a0d3 100644 --- a/src/main/java/com/jsh/util/JshException.java +++ b/src/main/java/com/jsh/util/JshException.java @@ -1,74 +1,63 @@ package com.jsh.util; /** - * @title: 平台异常基类 - * @description: 用于包装一些异常信息,打印日志等服务 * @author jishenghua + * @title: 平台异常基类 + * @description: 用于包装一些异常信息,打印日志等服务 * @qq 7 5 2 7 1 8 9 2 0 * @since: 2014-02-24 */ @SuppressWarnings("serial") -public class JshException extends Exception -{ +public class JshException extends Exception { public long errorCode = -1; - public String message ; + public String message; - public JshException() - { + public JshException() { super(); } - public JshException(String message) - { + public JshException(String message) { super(message); this.message = message; } - public JshException(String message, Throwable cause) - { + public JshException(String message, Throwable cause) { super(message, cause); this.message = message; } - public JshException(Throwable cause) - { + public JshException(Throwable cause) { super(cause); } - public JshException(long errorCode) - { + public JshException(long errorCode) { super(); this.errorCode = errorCode; } - public JshException(String message, long errorCode) - { + public JshException(String message, long errorCode) { super(message); this.errorCode = errorCode; this.message = message; } - public JshException(String message, long errorCode, Throwable cause) - { + public JshException(String message, long errorCode, Throwable cause) { super(message, cause); this.errorCode = errorCode; this.message = message; } - public JshException(long errorCode, Throwable cause) - { + public JshException(long errorCode, Throwable cause) { super(cause); this.errorCode = errorCode; } - public long getErrorCode() - { + public long getErrorCode() { return errorCode; } - public String getMessage() - { + public String getMessage() { return message; } } diff --git a/src/main/java/com/jsh/util/MaterialConstants.java b/src/main/java/com/jsh/util/MaterialConstants.java index d5f5a3ad..a7987445 100644 --- a/src/main/java/com/jsh/util/MaterialConstants.java +++ b/src/main/java/com/jsh/util/MaterialConstants.java @@ -2,25 +2,25 @@ package com.jsh.util; /** * 定义商品信息常量 + * * @author jishenghua */ -public interface MaterialConstants -{ +public interface MaterialConstants { /** * 公共常量 + * * @author ji sheng hua */ - public class Common - { + public class Common { } /** * 常量--导入导出excel表格业务相关 + * * @author jishenghua */ - public class BusinessForExcel - { + public class BusinessForExcel { /** * 名称 */ diff --git a/src/main/java/com/jsh/util/OpenSessionInViewFilterExtend.java b/src/main/java/com/jsh/util/OpenSessionInViewFilterExtend.java index daec6104..224e2543 100644 --- a/src/main/java/com/jsh/util/OpenSessionInViewFilterExtend.java +++ b/src/main/java/com/jsh/util/OpenSessionInViewFilterExtend.java @@ -6,19 +6,17 @@ import org.hibernate.SessionFactory; import org.springframework.dao.DataAccessResourceFailureException; import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter; -public class OpenSessionInViewFilterExtend extends OpenSessionInViewFilter -{ - @Override - protected Session getSession(SessionFactory sessionFactory) - throws DataAccessResourceFailureException - { - this.setFlushMode(FlushMode.AUTO); - return super.getSession(sessionFactory); - } - @Override - protected void closeSession(Session session, SessionFactory sessionFactory) - { - session.flush(); - super.closeSession(session, sessionFactory); - } +public class OpenSessionInViewFilterExtend extends OpenSessionInViewFilter { + @Override + protected Session getSession(SessionFactory sessionFactory) + throws DataAccessResourceFailureException { + this.setFlushMode(FlushMode.AUTO); + return super.getSession(sessionFactory); + } + + @Override + protected void closeSession(Session session, SessionFactory sessionFactory) { + session.flush(); + super.closeSession(session, sessionFactory); + } } diff --git a/src/main/java/com/jsh/util/PageUtil.java b/src/main/java/com/jsh/util/PageUtil.java index 17a29854..3cf286af 100644 --- a/src/main/java/com/jsh/util/PageUtil.java +++ b/src/main/java/com/jsh/util/PageUtil.java @@ -5,195 +5,186 @@ import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import java.util.Map; + /** * 分页工具类,实现分页功能 - * @author jishenghua + * + * @author jishenghua + * @version [版本号version01, 2014-2-21] * @qq 7 5 2 7 1 8 9 2 0 - * @version [版本号version01, 2014-2-21] */ @SuppressWarnings("serial") -public class PageUtil implements Serializable -{ - /** - * 总页数,根据总数和单页显示个数进行计算 - */ - private int totalPage = 0; - - /** - * 总个数 - */ - private int totalCount = 0 ; - - /** - * 当前页码 - */ - private int curPage = 1; - - /** - * 每页显示个数 - */ - private int pageSize = 10; - - /** - * 是否为第一页 - */ - private boolean isFirstPage = false; - /** - * 是否是最后一页 - */ - private boolean isLastPage = false; - - /** - * 是否有上一页 - */ - private boolean hasPrevious = false; - - /** - * 是否有下一页 - */ - private boolean hasNext = false; - - /** - * 返回页面list数组 - */ - private List pageList = new ArrayList(); - - /** - * 页面搜索条件,用map来实现 - */ - private Map advSearch = new Hashtable(); - - public PageUtil() - { - - } - - public PageUtil(int totalCount,int pageSize,int curPage,Map adv) - { - init(totalCount,pageSize,curPage,adv); - } - /** - * 初始化页面显示参数 - * @param totalCount 总数 - * @param pageSize 页面显示个数 - * @param curPage 当前页面 - */ - public void init(int totalCount,int pageSize,int curPage,Map adv) - { - this.totalCount = totalCount; - this.pageSize = pageSize ; - this.curPage = curPage; - this.advSearch = adv; - //计算总页数 - if(pageSize != 0) - { - this.totalPage = (totalCount+pageSize-1)/pageSize; - } - if(curPage <1) - { - this.curPage = 1; - } - if(curPage>this.totalPage) - { - this.curPage = this.totalPage; - } - if(curPage>0&&this.totalPage!=1&&curPage0&&this.totalPage!=1&&curPage>1&&curPage<=this.totalPage) - { - this.hasPrevious = true; - } - if(curPage == 1) - { - this.isFirstPage = true ; - } - if(curPage == this.totalPage) - { - this.isLastPage = true; - } - } - public int getTotalPage() - { - return totalPage; - } - public void setTotalPage(int totalPage) - { - this.totalPage = totalPage; - } - public int getTotalCount() - { - return totalCount; - } - public void setTotalCount(int totalCount) - { - this.totalCount = totalCount; - } - public int getCurPage() - { - return curPage; - } - public void setCurPage(int curPage) - { - this.curPage = curPage; - } - public int getPageSize() - { - return pageSize; - } - public void setPageSize(int pageSize) - { - this.pageSize = pageSize; - } - public boolean isFirstPage() - { - return isFirstPage; - } - public void setFirstPage(boolean isFirstPage) - { - this.isFirstPage = isFirstPage; - } - public boolean isLastPage() - { - return isLastPage; - } - public void setLastPage(boolean isLastPage) - { - this.isLastPage = isLastPage; - } - public boolean isHasPrevious() - { - return hasPrevious; - } - public void setHasPrevious(boolean hasPrevious) - { - this.hasPrevious = hasPrevious; - } - public boolean isHasNext() - { - return hasNext; - } - public void setHasNext(boolean hasNext) - { - this.hasNext = hasNext; - } - - public List getPageList() - { - return pageList; - } - public void setPageList(List pageList) - { - this.pageList = pageList; - } - - public Map getAdvSearch() - { - return advSearch; - } - public void setAdvSearch(Map advSearch) - { - this.advSearch = advSearch; - } +public class PageUtil implements Serializable { + /** + * 总页数,根据总数和单页显示个数进行计算 + */ + private int totalPage = 0; + + /** + * 总个数 + */ + private int totalCount = 0; + + /** + * 当前页码 + */ + private int curPage = 1; + + /** + * 每页显示个数 + */ + private int pageSize = 10; + + /** + * 是否为第一页 + */ + private boolean isFirstPage = false; + /** + * 是否是最后一页 + */ + private boolean isLastPage = false; + + /** + * 是否有上一页 + */ + private boolean hasPrevious = false; + + /** + * 是否有下一页 + */ + private boolean hasNext = false; + + /** + * 返回页面list数组 + */ + private List pageList = new ArrayList(); + + /** + * 页面搜索条件,用map来实现 + */ + private Map advSearch = new Hashtable(); + + public PageUtil() { + + } + + public PageUtil(int totalCount, int pageSize, int curPage, Map adv) { + init(totalCount, pageSize, curPage, adv); + } + + /** + * 初始化页面显示参数 + * + * @param totalCount 总数 + * @param pageSize 页面显示个数 + * @param curPage 当前页面 + */ + public void init(int totalCount, int pageSize, int curPage, Map adv) { + this.totalCount = totalCount; + this.pageSize = pageSize; + this.curPage = curPage; + this.advSearch = adv; + //计算总页数 + if (pageSize != 0) { + this.totalPage = (totalCount + pageSize - 1) / pageSize; + } + if (curPage < 1) { + this.curPage = 1; + } + if (curPage > this.totalPage) { + this.curPage = this.totalPage; + } + if (curPage > 0 && this.totalPage != 1 && curPage < this.totalPage) { + this.hasNext = true; + } + if (curPage > 0 && this.totalPage != 1 && curPage > 1 && curPage <= this.totalPage) { + this.hasPrevious = true; + } + if (curPage == 1) { + this.isFirstPage = true; + } + if (curPage == this.totalPage) { + this.isLastPage = true; + } + } + + public int getTotalPage() { + return totalPage; + } + + public void setTotalPage(int totalPage) { + this.totalPage = totalPage; + } + + public int getTotalCount() { + return totalCount; + } + + public void setTotalCount(int totalCount) { + this.totalCount = totalCount; + } + + public int getCurPage() { + return curPage; + } + + public void setCurPage(int curPage) { + this.curPage = curPage; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public boolean isFirstPage() { + return isFirstPage; + } + + public void setFirstPage(boolean isFirstPage) { + this.isFirstPage = isFirstPage; + } + + public boolean isLastPage() { + return isLastPage; + } + + public void setLastPage(boolean isLastPage) { + this.isLastPage = isLastPage; + } + + public boolean isHasPrevious() { + return hasPrevious; + } + + public void setHasPrevious(boolean hasPrevious) { + this.hasPrevious = hasPrevious; + } + + public boolean isHasNext() { + return hasNext; + } + + public void setHasNext(boolean hasNext) { + this.hasNext = hasNext; + } + + public List getPageList() { + return pageList; + } + + public void setPageList(List pageList) { + this.pageList = pageList; + } + + public Map getAdvSearch() { + return advSearch; + } + + public void setAdvSearch(Map advSearch) { + this.advSearch = advSearch; + } } diff --git a/src/main/java/com/jsh/util/PathTool.java b/src/main/java/com/jsh/util/PathTool.java index b3e1335a..041b9904 100644 --- a/src/main/java/com/jsh/util/PathTool.java +++ b/src/main/java/com/jsh/util/PathTool.java @@ -1,84 +1,75 @@ package com.jsh.util; +import com.jsh.base.Log; + import java.io.File; import java.net.URISyntaxException; import java.net.URL; -import com.jsh.base.Log; - /** * 获取应用系统路径 - * @author jishenghua + * + * @author jishenghua * @qq 7 5 2 7 1 8 9 2 0 */ -public class PathTool -{ - +public class PathTool { + /** * 获取WEB-INF的绝对路径 - * @return + * + * @return */ - public static String getWebinfPath() - { + public static String getWebinfPath() { String webinfPath = ""; //获取URL对象 URL url = PathTool.class.getClassLoader().getResource(""); - try - { + try { //获取路径 - webinfPath = url.toURI().getPath(); + webinfPath = url.toURI().getPath(); //截取路径到WEB-INF结束 // webinfPath = path.substring(0, path.indexOf("/WEB-INF") + 8); - } - catch (URISyntaxException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>路径获取异常", e); + } catch (URISyntaxException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>路径获取异常", e); } return webinfPath; } - + /** * 获取webapp的绝对路径 - * @return + * + * @return */ - public static String getWebappPath() - { + public static String getWebappPath() { //先获取工程路径 String projectPath = getProjectPath(); //获取工程路径的上级路径 File f = new File(projectPath); //路径不存在就返回 - if (!f.exists()) - { + if (!f.exists()) { return projectPath; - } - else - { + } else { //返回webapp路径 return f.getParent(); } } - + /** * 获取工程的绝对路径 - * @return + * + * @return */ - public static String getProjectPath() - { + public static String getProjectPath() { String projectPath = ""; //获取URL对象 URL url = PathTool.class.getClassLoader().getResource(""); String path = null; - try - { + try { //获取路径 path = url.toURI().getPath(); //截取webapp路径 projectPath = path.substring(0, path.indexOf("/WEB-INF")); - } - catch (URISyntaxException e) - { - Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>路径获取异常", e); + } catch (URISyntaxException e) { + Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>路径获取异常", e); } return projectPath; } diff --git a/src/main/java/com/jsh/util/SearchConditionUtil.java b/src/main/java/com/jsh/util/SearchConditionUtil.java index b2bf40a9..0e8b1e61 100644 --- a/src/main/java/com/jsh/util/SearchConditionUtil.java +++ b/src/main/java/com/jsh/util/SearchConditionUtil.java @@ -6,61 +6,58 @@ import java.util.Set; /** * 根据搜索条件拼装成查询hql语句 + * * @author jishenghua qq:752718920 */ -public class SearchConditionUtil -{ +public class SearchConditionUtil { //拼接字符串的前缀空格字符串 private static final String emptyPrefix = " and "; - + /** * 根据搜索条件自动拼接成hql搜索语句 + * * @param condition 搜索条件 规则: - * 1、类型 n--数字 s--字符串 - * 2、属性 eq--等于 neq--不等于 like--像'%XX%' llike--左像'%XX' rlike--右像'XX%' in--包含 gt--大于 gteq--大于等于 lt--小于 lteq--小于等于 - * order--value desc asc gy-- group by - * 示例: - * Map condition = new HashMap(); - * condition.put("supplier_s_like", "aaa"); - * condition.put("contacts_s_llike", "186"); - * condition.put("contacts_s_rlike", "186"); - * condition.put("phonenum_s_eq", null); - * condition.put("email_n_neq", 23); - * condition.put("description_s_order", "desc"); + * 1、类型 n--数字 s--字符串 + * 2、属性 eq--等于 neq--不等于 like--像'%XX%' llike--左像'%XX' rlike--右像'XX%' in--包含 gt--大于 gteq--大于等于 lt--小于 lteq--小于等于 + * order--value desc asc gy-- group by + * 示例: + * Map condition = new HashMap(); + * condition.put("supplier_s_like", "aaa"); + * condition.put("contacts_s_llike", "186"); + * condition.put("contacts_s_rlike", "186"); + * condition.put("phonenum_s_eq", null); + * condition.put("email_n_neq", 23); + * condition.put("description_s_order", "desc"); * @return 封装后的字符串 */ - public static String getCondition(Map condition) - { + public static String getCondition(Map condition) { StringBuffer hql = new StringBuffer(); Set key = condition.keySet(); String groupbyInfo = ""; String orderInfo = ""; - for(String keyInfo:key) - { + for (String keyInfo : key) { /* * 1、数组为三个 第一个为对象实例的字段 第二个为字段类型 第三个为属性 * 2、根据分解后的数组拼接搜索条件 */ Object valueInfo = condition.get(keyInfo); - if(null != valueInfo &&valueInfo.toString().length()>0) - { + if (null != valueInfo && valueInfo.toString().length() > 0) { String[] searchCondition = keyInfo.split("_"); - if(searchCondition[1].equals("n")) + if (searchCondition[1].equals("n")) hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + valueInfo); - else if(searchCondition[1].equals("s")) - { - if(searchCondition[2].equals("like")) + else if (searchCondition[1].equals("s")) { + if (searchCondition[2].equals("like")) hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'%" + valueInfo + "%'"); - else if(searchCondition[2].equals("llike")) - hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'%" + valueInfo + "'"); - else if(searchCondition[2].equals("rlike")) - hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'" + valueInfo + "%'"); - else if(searchCondition[2].equals("in")) - hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "(" + valueInfo + ")"); - else if(searchCondition[2].equals("order")) - orderInfo = " order by " + searchCondition[0] + " " + valueInfo; - else if(searchCondition[2].equals("gb")) - groupbyInfo = " group by " + searchCondition[0]; + else if (searchCondition[2].equals("llike")) + hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'%" + valueInfo + "'"); + else if (searchCondition[2].equals("rlike")) + hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'" + valueInfo + "%'"); + else if (searchCondition[2].equals("in")) + hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "(" + valueInfo + ")"); + else if (searchCondition[2].equals("order")) + orderInfo = " order by " + searchCondition[0] + " " + valueInfo; + else if (searchCondition[2].equals("gb")) + groupbyInfo = " group by " + searchCondition[0]; else hql.append(emptyPrefix + searchCondition[0] + getType(searchCondition[2]) + "'" + valueInfo + "'"); } @@ -68,51 +65,50 @@ public class SearchConditionUtil } return hql.append(groupbyInfo).append(orderInfo).toString(); } - + /** * 获取指定类型的符号 * 属性 eq--等于 neq--不等于 like--像 in--包含 gt--大于 gteq--大于等于 lt--小于 lteq--小于等于 order--value desc asc + * * @param type * @return 类型字符串 */ - private static String getType(String type) - { + private static String getType(String type) { String typeStr = ""; - if(type.equals("eq")) + if (type.equals("eq")) typeStr = " = "; - else if(type.equals("neq")) + else if (type.equals("neq")) typeStr = " != "; - else if(type.equals("like")) + else if (type.equals("like")) typeStr = " like "; - else if(type.equals("llike")) - typeStr = " like "; - else if(type.equals("rlike")) - typeStr = " like "; - else if(type.equals("in")) - typeStr = " in "; - else if(type.equals("gt")) + else if (type.equals("llike")) + typeStr = " like "; + else if (type.equals("rlike")) + typeStr = " like "; + else if (type.equals("in")) + typeStr = " in "; + else if (type.equals("gt")) typeStr = " > "; - else if(type.equals("gteq")) + else if (type.equals("gteq")) typeStr = " >= "; - else if(type.equals("lt")) + else if (type.equals("lt")) typeStr = " < "; - else if(type.equals("lteq")) + else if (type.equals("lteq")) typeStr = " <= "; - else if(type.equals("order")) + else if (type.equals("order")) typeStr = " order "; - else if(type.equals("gy")) + else if (type.equals("gy")) typeStr = " group by "; else typeStr = "unknown"; return typeStr; } - - public static void main(String[] args) - { + + public static void main(String[] args) { /** * 拼接搜索条件 */ - Map condition = new HashMap(); + Map condition = new HashMap(); condition.put("supplier_s_like", "aaa"); condition.put("contacts_s_llike", "186"); condition.put("contacts_s_rlike", "186"); @@ -120,7 +116,7 @@ public class SearchConditionUtil condition.put("email_n_neq", 23); condition.put("description_s_order", "desc"); condition.put("description_s_gb", "aaa"); - + //获取搜索条件拼接 System.out.println(getCondition(condition)); } diff --git a/src/main/java/com/jsh/util/SessionFilter.java b/src/main/java/com/jsh/util/SessionFilter.java index 762a3c32..cb6a1643 100644 --- a/src/main/java/com/jsh/util/SessionFilter.java +++ b/src/main/java/com/jsh/util/SessionFilter.java @@ -1,42 +1,38 @@ package com.jsh.util; -import java.io.IOException; -import java.io.PrintWriter; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import java.io.IOException; + /** * 用户登录session处理类 * 过滤session是否超时 - * @author jishenghua qq_752718920 - * @version [版本号, 2012-3-6] - * @see [相关类/方法] - * @since + * + * @author jishenghua qq_752718920 + * @version [版本号, 2012-3-6] + * @see [相关类/方法] + * @since */ -public class SessionFilter implements Filter -{ +public class SessionFilter implements Filter { /** * 初始化过滤器 暂不处理 * 重载方法 + * * @param arg0 * @throws ServletException */ - + public void init(FilterConfig arg0) - throws ServletException - { - + throws ServletException { + } + /** * 判断用户session是否存在 不存在则跳转到登录页面 * 重载方法 + * * @param srequest * @param sresponse * @param chain @@ -44,27 +40,25 @@ public class SessionFilter implements Filter * @throws ServletException */ public void doFilter(ServletRequest srequest, ServletResponse sresponse, FilterChain chain) - throws IOException, ServletException - { + throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) srequest; HttpServletResponse response = (HttpServletResponse) sresponse; HttpSession session = request.getSession(); - + //获取工程路径 String path = request.getContextPath(); String requestURl = request.getRequestURI(); - - if(requestURl.contains("/pages") &&null != session.getAttribute("user")) + + if (requestURl.contains("/pages") && null != session.getAttribute("user")) chain.doFilter(request, response); else response.sendRedirect(path + "/logout.jsp"); } - + /** * 销毁过滤器 - */ - public void destroy() - { - + */ + public void destroy() { + } } diff --git a/src/main/java/com/jsh/util/SupplierConstants.java b/src/main/java/com/jsh/util/SupplierConstants.java index 9feb7c25..5a591e3c 100644 --- a/src/main/java/com/jsh/util/SupplierConstants.java +++ b/src/main/java/com/jsh/util/SupplierConstants.java @@ -2,25 +2,25 @@ package com.jsh.util; /** * 定义供应商、客户管理常量 + * * @author jishenghua */ -public interface SupplierConstants -{ +public interface SupplierConstants { /** * 公共常量 + * * @author jishenghua */ - public class Common - { + public class Common { } /** * 常量--导入导出excel表格业务相关 + * * @author jishenghua */ - public class BusinessForExcel - { + public class BusinessForExcel { /** * 名称 */ diff --git a/src/main/java/com/jsh/util/Tools.java b/src/main/java/com/jsh/util/Tools.java index 14044acd..84dcfe36 100644 --- a/src/main/java/com/jsh/util/Tools.java +++ b/src/main/java/com/jsh/util/Tools.java @@ -3,6 +3,7 @@ package com.jsh.util; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.math.BigInteger; import java.net.InetAddress; import java.net.URLDecoder; import java.net.URLEncoder; @@ -11,566 +12,545 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; +import java.util.UUID; import java.util.regex.Pattern; -import java.math.BigInteger; + /** * 工具类 + * * @author jishenghua qq:7-5-2-7-1-8-9-2-0 */ -public class Tools -{ - /** +public class Tools { + /** * 获得32位唯一序列号 + * * @return 32为ID字符串 */ - public static String getUUID_32() - { - return UUID.randomUUID().toString().replaceAll("-", ""); + public static String getUUID_32() { + return UUID.randomUUID().toString().replaceAll("-", ""); } + /** * 获得当天时间,格式为yyyy-MM-dd + * * @return 格式化后的日期格式 */ - public static String getNow() - { - return new SimpleDateFormat("yyyy-MM-dd").format(new Date()); + public static String getNow() { + return new SimpleDateFormat("yyyy-MM-dd").format(new Date()); } - + /** * 获取当前月 yyyy-MM + * * @return */ - public static String getCurrentMonth() - { - return new SimpleDateFormat("yyyy-MM").format(new Date()); + public static String getCurrentMonth() { + return new SimpleDateFormat("yyyy-MM").format(new Date()); } - + /** * 获取指定日期格式 yyyy-MM-dd + * * @return */ - public static String getCurrentMonth(Date date) - { + public static String getCurrentMonth(Date date) { return new SimpleDateFormat("yyyy-MM-dd").format(date); } - + /** * 获得当天时间,格式为yyyyMMddHHmmss + * * @return 格式化后的日期格式 */ - public static String getNow2(Date date) - { - return new SimpleDateFormat("yyyyMMddHHmmss").format(date); + public static String getNow2(Date date) { + return new SimpleDateFormat("yyyyMMddHHmmss").format(date); } + /** * 获得当天时间,格式为yyyy-MM-dd HH:mm:ss + * * @return 格式化后的日期格式 */ - public static String getNow3() - { - return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); + public static String getNow3() { + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); } + /** * 获得指定时间,格式为yyyy-MM-dd HH:mm:ss + * * @return 格式化后的日期格式 */ - public static String getCenternTime(Date date) - { - return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date); + public static String getCenternTime(Date date) { + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date); } - + /** * 获得指定时间,格式为mm:ss + * * @return 格式化后的日期格式 */ - public static String getTimeInfo(Date date) - { - return new SimpleDateFormat("mm:ss").format(date); + public static String getTimeInfo(Date date) { + return new SimpleDateFormat("mm:ss").format(date); } + /** * 获取当前日期是星期几 * return 星期几 */ - public static String getWeekDay() - { - Calendar c = Calendar.getInstance(Locale.CHINA); - c.setTime(new Date()); - int day=c.get(Calendar.DAY_OF_WEEK); + public static String getWeekDay() { + Calendar c = Calendar.getInstance(Locale.CHINA); + c.setTime(new Date()); + int day = c.get(Calendar.DAY_OF_WEEK); String weekDay = ""; - switch (day) - { - case 1: - weekDay = "星期日"; - break; - case 2: - weekDay = "星期一"; - break; - case 3: - weekDay = "星期二"; - break; - case 4: - weekDay = "星期三"; - break; - case 5: - weekDay = "星期四"; - break; - case 6: - weekDay = "星期五"; - break; - case 7: - weekDay = "星期六"; - break; - default: - break; - } + switch (day) { + case 1: + weekDay = "星期日"; + break; + case 2: + weekDay = "星期一"; + break; + case 3: + weekDay = "星期二"; + break; + case 4: + weekDay = "星期三"; + break; + case 5: + weekDay = "星期四"; + break; + case 6: + weekDay = "星期五"; + break; + case 7: + weekDay = "星期六"; + break; + default: + break; + } return weekDay; } + /** * 判断字符串是否全部为数字 + * * @param accountWaste - * @return boolean值 + * @return boolean值 */ - public static boolean checkStrIsNum(String checkStr) - { - if(checkStr == null || checkStr.length() ==0) - return false; - return Pattern.compile("^[0-9]*.{1}[0-9]*$").matcher(checkStr).matches(); + public static boolean checkStrIsNum(String checkStr) { + if (checkStr == null || checkStr.length() == 0) + return false; + return Pattern.compile("^[0-9]*.{1}[0-9]*$").matcher(checkStr).matches(); // return Pattern.compile(":^[0-9]+(.[0-9])*$").matcher(checkStr).matches(); } + /** * 获得前一天的时间 + * * @return 前一天日期 */ - public static String getPreviousDate() - { - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DATE, -1); - return new SimpleDateFormat("yyyy-MM").format(cal.getTime()); + public static String getPreviousDate() { + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.DATE, -1); + return new SimpleDateFormat("yyyy-MM").format(cal.getTime()); } - - /** - * 截取字符串长度 - * @param beforeStr - * @param cutLeng - * @return 截取后的字符串 - */ - public static String subStr(String beforeStr,int cutLeng){ - if(beforeStr.length()>cutLeng) - return beforeStr.substring(0,cutLeng)+ "..." ; - return beforeStr ; - } - /** - * 生成随机字符串,字母和数字混合 - * @return 组合后的字符串 ^[0-9a-zA-Z] - */ - public static String getRandomChar(){ - //生成一个0、1、2的随机数字 - int rand = (int)Math.round(Math.random() * 1); - long itmp = 0; - char ctmp = '\u0000'; - switch (rand) - { - //生成大写字母 + 1000以内数字 - case 1: - itmp = Math.round(Math.random() * 25 + 65); - ctmp = (char)itmp; - return String.valueOf(ctmp) + (int)Math.random()*1000; - //生成小写字母 - case 2: - itmp = Math.round(Math.random() * 25 + 97); - ctmp = (char)itmp; - return String.valueOf(ctmp)+ (int)Math.random()*1000; - //生成数字 - default : - itmp = Math.round(Math.random() * 1000); - return itmp + ""; - } - } - - /** - * 判断首字母以数字开头,字符串包括数字、字母%以及空格 - * @param str 检查字符串 - * @return 是否以数字开头 - */ - public static boolean CheckIsStartWithNum(String str) - { - return Pattern.compile("^[0-9][a-zA-Z0-9%,\\s]*$").matcher(str).matches(); - } - /** - * 判断首字母以","开头,字符串包括数字、字母%以及空格 - * @param str 检查字符串 - * @return 是否以数字开头 - */ - public static boolean CheckIsStartWithSpec(String str) - { - return Pattern.compile("^[,][a-zA-Z0-9%,\\s]*$").matcher(str).matches(); - } - /** - * 字符转码 - * @param aValue - * @return - * @see 转码后的字符串 - */ - public static String encodeValue(String aValue) - { - if(aValue.trim().length() ==0) - { + + /** + * 截取字符串长度 + * + * @param beforeStr + * @param cutLeng + * @return 截取后的字符串 + */ + public static String subStr(String beforeStr, int cutLeng) { + if (beforeStr.length() > cutLeng) + return beforeStr.substring(0, cutLeng) + "..."; + return beforeStr; + } + + /** + * 生成随机字符串,字母和数字混合 + * + * @return 组合后的字符串 ^[0-9a-zA-Z] + */ + public static String getRandomChar() { + //生成一个0、1、2的随机数字 + int rand = (int) Math.round(Math.random() * 1); + long itmp = 0; + char ctmp = '\u0000'; + switch (rand) { + //生成大写字母 + 1000以内数字 + case 1: + itmp = Math.round(Math.random() * 25 + 65); + ctmp = (char) itmp; + return String.valueOf(ctmp) + (int) Math.random() * 1000; + //生成小写字母 + case 2: + itmp = Math.round(Math.random() * 25 + 97); + ctmp = (char) itmp; + return String.valueOf(ctmp) + (int) Math.random() * 1000; + //生成数字 + default: + itmp = Math.round(Math.random() * 1000); + return itmp + ""; + } + } + + /** + * 判断首字母以数字开头,字符串包括数字、字母%以及空格 + * + * @param str 检查字符串 + * @return 是否以数字开头 + */ + public static boolean CheckIsStartWithNum(String str) { + return Pattern.compile("^[0-9][a-zA-Z0-9%,\\s]*$").matcher(str).matches(); + } + + /** + * 判断首字母以","开头,字符串包括数字、字母%以及空格 + * + * @param str 检查字符串 + * @return 是否以数字开头 + */ + public static boolean CheckIsStartWithSpec(String str) { + return Pattern.compile("^[,][a-zA-Z0-9%,\\s]*$").matcher(str).matches(); + } + + /** + * 字符转码 + * + * @param aValue + * @return + * @see 转码后的字符串 + */ + public static String encodeValue(String aValue) { + if (aValue.trim().length() == 0) { return ""; } String valueAfterTransCode = null; - try - { + try { valueAfterTransCode = URLEncoder.encode(aValue, "UTF-8"); - } - catch (UnsupportedEncodingException e) - { + } catch (UnsupportedEncodingException e) { e.getMessage(); } return valueAfterTransCode; } - /** - * 字符转码 - * @param aValue - * @return - * @see 转码后的字符串 - */ - public static String decodeValue(String aValue) - { - if(aValue.trim().length() ==0) - { - return ""; - } - String valueAfterTransCode = null; - try - { - valueAfterTransCode = URLDecoder.decode(aValue, "UTF-8"); - } - catch (UnsupportedEncodingException e) - { - e.getMessage(); - } - return valueAfterTransCode; - } + /** + * 字符转码 + * + * @param aValue + * @return + * @see 转码后的字符串 + */ + public static String decodeValue(String aValue) { + if (aValue.trim().length() == 0) { + return ""; + } + String valueAfterTransCode = null; + try { + valueAfterTransCode = URLDecoder.decode(aValue, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.getMessage(); + } + return valueAfterTransCode; + } - /** - * 去除str中的' - * @param str - * @return 除去'后的字符串 - * @see [类、类#方法、类#成员] - */ - public static String afterDealStr(String str) - { - return str.replace("'", ""); - } + /** + * 去除str中的' + * + * @param str + * @return 除去'后的字符串 + * @see [类、类#方法、类#成员] + */ + public static String afterDealStr(String str) { + return str.replace("'", ""); + } - /** - * 获取用户IP地址(停用) - * @return 用户IP - * @see [类、类#方法、类#成员] - */ - public static String getCurrentUserIP() - { - try - { - return InetAddress.getLocalHost().getHostAddress(); - } - catch (UnknownHostException e) - { - e.printStackTrace(); - return "127.0.0.1"; - } - } + /** + * 获取用户IP地址(停用) + * + * @return 用户IP + * @see [类、类#方法、类#成员] + */ + public static String getCurrentUserIP() { + try { + return InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + e.printStackTrace(); + return "127.0.0.1"; + } + } - /** - * 从Request对象中获得客户端IP,处理了HTTP代理服务器和Nginx的反向代理截取了ip - * @param request - * @return ip - */ - public static String getLocalIp(HttpServletRequest request) { - String remoteAddr = request.getRemoteAddr(); - String forwarded = request.getHeader("X-Forwarded-For"); - String realIp = request.getHeader("X-Real-IP"); + /** + * 从Request对象中获得客户端IP,处理了HTTP代理服务器和Nginx的反向代理截取了ip + * + * @param request + * @return ip + */ + public static String getLocalIp(HttpServletRequest request) { + String remoteAddr = request.getRemoteAddr(); + String forwarded = request.getHeader("X-Forwarded-For"); + String realIp = request.getHeader("X-Real-IP"); - String ip = null; - if (realIp == null) { - if (forwarded == null) { - ip = remoteAddr; - } else { - ip = remoteAddr + "/" + forwarded.split(",")[0]; - } - } else { - if (realIp.equals(forwarded)) { - ip = realIp; - } else { - if(forwarded != null){ - forwarded = forwarded.split(",")[0]; - } - ip = realIp + "/" + forwarded; - } - } - return ip; - } - - /** - * 转化前台批量传入的ID值 - * @param data - * @return 转化后的ID值数组 - */ - public static int[] changeDataForm(String data) - { - String[] dataStr = data.split(","); - int[] dataInt = new int[dataStr.length]; - for(int i = 0 ;i < dataStr.length;i ++) - dataInt[i] = Integer.parseInt(dataStr[i]); - return dataInt; - } - - /** - * 解决导出文件中文乱码问题firefox和ie下中文乱码 - */ - public static String changeUnicode(String fileName,String browserType) - { - String returnFileName = ""; - try - { - if(browserType.equalsIgnoreCase("MSIE")) - { - returnFileName = URLEncoder.encode(fileName, "ISO8859-1"); - returnFileName = returnFileName.replace(" ","%20"); - if (returnFileName.length() > 150) - { - returnFileName = new String(fileName.getBytes("GB2312"), "ISO8859-1"); - returnFileName = returnFileName.replace(" ", "%20"); - } - } - else if(browserType.equalsIgnoreCase("Firefox")) - { - returnFileName = new String(fileName.getBytes("ISO8859-1"),"ISO8859-1"); - returnFileName = returnFileName.replace(" ", "%20"); - } - else - { - returnFileName = URLEncoder.encode(fileName, "ISO8859-1"); - returnFileName = returnFileName.replace(" ","%20"); - if (returnFileName.length() > 150) - { - - returnFileName = new String(returnFileName.getBytes("GB2312"), "ISO8859-1"); - returnFileName = returnFileName.replace(" ", "%20"); - } - } - } - catch (UnsupportedEncodingException e) - { - e.printStackTrace(); - } - return returnFileName; - } - - /** - * 写理财日志内容转化特殊字符 - * @param str 需要转化的字符 - * @return 转化后的字符 - */ - public static String htmlspecialchars(String str) - { - str = str.replaceAll("&", "&"); - str = str.replaceAll("<", "<"); - str = str.replaceAll(">", ">"); - str = str.replaceAll("\"", """); - return str; - } - - /** - * 根据消费日期获取消费月 - * @param consumeDate 消费日期 - * @return 返回消费月信息 - */ - public static String getConsumeMonth(String consumeDate) - { - return consumeDate.substring(0,7); - } - - /** - * 获取当前日期的前XX个月 - * @param 之前的第几个月 - * @return 前XX个月字符串 - */ - public static String getBeforeMonth(int beforeMonth) - { - Calendar c = Calendar.getInstance(); - c.add(Calendar.MONTH, -beforeMonth); - return new SimpleDateFormat("yyyy-MM").format(c.getTime()); - } - - - /** - * 获取email用户姓名 - * @param args - */ - public static String getEmailUserName(String emailAddress) - { - return emailAddress.substring(0,emailAddress.lastIndexOf("@")); - } - - /** - * 获取中文编码,邮件附件乱码问题解决 - * @param str - * @return - */ - public static String getChineseString(String emailAttchmentTitle) - { - if(emailAttchmentTitle!=null&&!emailAttchmentTitle.equals("")) - { - try - { - return new String(emailAttchmentTitle.getBytes(),"ISO-8859-1"); - } - catch (UnsupportedEncodingException e) - { - e.printStackTrace(); - } - } - return emailAttchmentTitle; - } + String ip = null; + if (realIp == null) { + if (forwarded == null) { + ip = remoteAddr; + } else { + ip = remoteAddr + "/" + forwarded.split(",")[0]; + } + } else { + if (realIp.equals(forwarded)) { + ip = realIp; + } else { + if (forwarded != null) { + forwarded = forwarded.split(",")[0]; + } + ip = realIp + "/" + forwarded; + } + } + return ip; + } - /** - * 判断userTel是否合法,userTel只能是数字 - * @param userTel - * @return true 合法 false不合法 - */ - public static boolean isTelNumber(String userTel) - { - String reg_phone="^(\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}$"; - String reg_tel="^(1[0-9][0-9]|1[0-9][0|3|6|8|9])\\d{8}$"; - boolean b_phpne=Pattern.compile(reg_phone).matcher(userTel).matches(); - boolean b_tel=Pattern.compile(reg_tel).matcher(userTel).matches(); - return (b_phpne || b_tel); - } - - /** - * 模糊判断电话号码是否合法,只能是数字 - * @param macAddress - * @return - */ - public static boolean isTelNumberBySlur(String userTel) - { - return Pattern.compile("^([\\s0-9]{0,12}$)").matcher(userTel).matches(); - } - - /** - * 获取当前时间的字符串类型 - * @return 处理后的字符串类型 - */ - public static String getNowTime() - { - return new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance().getTime()); - } - - /** - * 开打指定文件 - * @param filePath 文件的绝对路径 - */ - public static void openFile(String filePath) - { - String viewFilePath = filePath.replace("\\", "/"); - // Runtime.getRuntime().exec("cmd /c start "+filePath); - // 解决路径中带空格问题 - Runtime r = Runtime.getRuntime(); - String[] cmdArray = new String[] { "cmd.exe", "/c", viewFilePath }; - try - { - r.exec(cmdArray); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - - /** - * 判断字符串中是否含有中文 - * @author jishenghua + /** + * 转化前台批量传入的ID值 + * + * @param data + * @return 转化后的ID值数组 + */ + public static int[] changeDataForm(String data) { + String[] dataStr = data.split(","); + int[] dataInt = new int[dataStr.length]; + for (int i = 0; i < dataStr.length; i++) + dataInt[i] = Integer.parseInt(dataStr[i]); + return dataInt; + } + + /** + * 解决导出文件中文乱码问题firefox和ie下中文乱码 + */ + public static String changeUnicode(String fileName, String browserType) { + String returnFileName = ""; + try { + if (browserType.equalsIgnoreCase("MSIE")) { + returnFileName = URLEncoder.encode(fileName, "ISO8859-1"); + returnFileName = returnFileName.replace(" ", "%20"); + if (returnFileName.length() > 150) { + returnFileName = new String(fileName.getBytes("GB2312"), "ISO8859-1"); + returnFileName = returnFileName.replace(" ", "%20"); + } + } else if (browserType.equalsIgnoreCase("Firefox")) { + returnFileName = new String(fileName.getBytes("ISO8859-1"), "ISO8859-1"); + returnFileName = returnFileName.replace(" ", "%20"); + } else { + returnFileName = URLEncoder.encode(fileName, "ISO8859-1"); + returnFileName = returnFileName.replace(" ", "%20"); + if (returnFileName.length() > 150) { + + returnFileName = new String(returnFileName.getBytes("GB2312"), "ISO8859-1"); + returnFileName = returnFileName.replace(" ", "%20"); + } + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return returnFileName; + } + + /** + * 写理财日志内容转化特殊字符 + * + * @param str 需要转化的字符 + * @return 转化后的字符 + */ + public static String htmlspecialchars(String str) { + str = str.replaceAll("&", "&"); + str = str.replaceAll("<", "<"); + str = str.replaceAll(">", ">"); + str = str.replaceAll("\"", """); + return str; + } + + /** + * 根据消费日期获取消费月 + * + * @param consumeDate 消费日期 + * @return 返回消费月信息 + */ + public static String getConsumeMonth(String consumeDate) { + return consumeDate.substring(0, 7); + } + + /** + * 获取当前日期的前XX个月 + * + * @param 之前的第几个月 + * @return 前XX个月字符串 + */ + public static String getBeforeMonth(int beforeMonth) { + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, -beforeMonth); + return new SimpleDateFormat("yyyy-MM").format(c.getTime()); + } + + + /** + * 获取email用户姓名 + * + * @param args + */ + public static String getEmailUserName(String emailAddress) { + return emailAddress.substring(0, emailAddress.lastIndexOf("@")); + } + + /** + * 获取中文编码,邮件附件乱码问题解决 + * * @param str * @return */ - public static boolean isContainsChinese(String str) - { - return Pattern.compile("[\u4e00-\u9fa5]").matcher(str).matches(); + public static String getChineseString(String emailAttchmentTitle) { + if (emailAttchmentTitle != null && !emailAttchmentTitle.equals("")) { + try { + return new String(emailAttchmentTitle.getBytes(), "ISO-8859-1"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + return emailAttchmentTitle; } - - /** - * 过滤html文件中的文本 - * @param content - * @return过滤后的文本 - */ - public static String filterText(String content) - { - return content.replace("/<(?:.|\\s)*?>/g",""); - } - - /** - * 去掉字符串中所有符号,不论是全角,还是半角的,或是货币符号或者空格等 - * @author jishenghua - * @param s - * @return + + /** + * 判断userTel是否合法,userTel只能是数字 * + * @param userTel + * @return true 合法 false不合法 */ - public static String removeSymbolForString(String s) - { + public static boolean isTelNumber(String userTel) { + String reg_phone = "^(\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}$"; + String reg_tel = "^(1[0-9][0-9]|1[0-9][0|3|6|8|9])\\d{8}$"; + boolean b_phpne = Pattern.compile(reg_phone).matcher(userTel).matches(); + boolean b_tel = Pattern.compile(reg_tel).matcher(userTel).matches(); + return (b_phpne || b_tel); + } + + /** + * 模糊判断电话号码是否合法,只能是数字 + * + * @param macAddress + * @return + */ + public static boolean isTelNumberBySlur(String userTel) { + return Pattern.compile("^([\\s0-9]{0,12}$)").matcher(userTel).matches(); + } + + /** + * 获取当前时间的字符串类型 + * + * @return 处理后的字符串类型 + */ + public static String getNowTime() { + return new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance().getTime()); + } + + /** + * 开打指定文件 + * + * @param filePath 文件的绝对路径 + */ + public static void openFile(String filePath) { + String viewFilePath = filePath.replace("\\", "/"); + // Runtime.getRuntime().exec("cmd /c start "+filePath); + // 解决路径中带空格问题 + Runtime r = Runtime.getRuntime(); + String[] cmdArray = new String[]{"cmd.exe", "/c", viewFilePath}; + try { + r.exec(cmdArray); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 判断字符串中是否含有中文 + * + * @param str + * @return + * @author jishenghua + */ + public static boolean isContainsChinese(String str) { + return Pattern.compile("[\u4e00-\u9fa5]").matcher(str).matches(); + } + + /** + * 过滤html文件中的文本 + * + * @param content + * @return过滤后的文本 + */ + public static String filterText(String content) { + return content.replace("/<(?:.|\\s)*?>/g", ""); + } + + /** + * 去掉字符串中所有符号,不论是全角,还是半角的,或是货币符号或者空格等 + * + * @param s + * @return + * @author jishenghua + */ + public static String removeSymbolForString(String s) { StringBuffer buffer = new StringBuffer(); char[] chars = s.toCharArray(); - for (int i = 0; i < chars.length; i++) - { - if ((chars[i] >= 19968 && chars[i] <= 40869) || (chars[i] >= 97 && chars[i] <= 122) || (chars[i] >= 65 && chars[i] <= 90)) - { + for (int i = 0; i < chars.length; i++) { + if ((chars[i] >= 19968 && chars[i] <= 40869) || (chars[i] >= 97 && chars[i] <= 122) || (chars[i] >= 65 && chars[i] <= 90)) { buffer.append(chars[i]); } } return buffer.toString(); } - + /** * 获取一个字符串的MD5 + * * @param msg * @return 加密后的MD5字符串 - * @throws NoSuchAlgorithmException + * @throws NoSuchAlgorithmException */ - public static String md5Encryp(String msg) throws NoSuchAlgorithmException - { + public static String md5Encryp(String msg) throws NoSuchAlgorithmException { // 生成一个MD5加密计算摘要 MessageDigest md = MessageDigest.getInstance("MD5"); // 计算md5函数 md.update(msg.getBytes()); return new BigInteger(1, md.digest()).toString(16); } - + /** * 处理字符串null值 + * * @param beforeStr 处理前字符串 * @return 处理后的字符串 */ - public static String dealNullStr(String beforeStr) - { - if(null == beforeStr || beforeStr.length()==0) - return ""; - return beforeStr; + public static String dealNullStr(String beforeStr) { + if (null == beforeStr || beforeStr.length() == 0) + return ""; + return beforeStr; } - + /** * 使用参数Format将字符串转为Date - * @author jishenghua + * * @param strDate * @param pattern * @return - * @throws ParseException - * + * @throws ParseException + * @author jishenghua */ public static Date parse(String strDate, String pattern) - throws ParseException - { + throws ParseException { return new SimpleDateFormat(pattern).parse(strDate); } @@ -583,34 +563,28 @@ public class Tools // { // return content.matches("//g"); // } - - public static void main(String[] args) - { - String aa = "的付的反对法的发的说法"; - char[] bb = aa.toCharArray(); - for(char c : bb) - { - System.out.println(c); - } - System.out.println(getBeforeMonth(1)); - - try - { - System.out.println(md5Encryp("guest")); - System.out.println(md5Encryp("admin")); - } - catch (NoSuchAlgorithmException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - String value = "2333"; - System.out.println(checkStrIsNum(value)); - - for(int i = 0 ;i < 100;i ++) - { - System.out.print(getRandomChar() + " || "); - } - } + + public static void main(String[] args) { + String aa = "的付的反对法的发的说法"; + char[] bb = aa.toCharArray(); + for (char c : bb) { + System.out.println(c); + } + System.out.println(getBeforeMonth(1)); + + try { + System.out.println(md5Encryp("guest")); + System.out.println(md5Encryp("admin")); + } catch (NoSuchAlgorithmException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + String value = "2333"; + System.out.println(checkStrIsNum(value)); + + for (int i = 0; i < 100; i++) { + System.out.print(getRandomChar() + " || "); + } + } }