diff --git a/src/main/java/com/jsh/erp/constants/BusinessConstants.java b/src/main/java/com/jsh/erp/constants/BusinessConstants.java index 5d2e9bfb..18cdf4fe 100644 --- a/src/main/java/com/jsh/erp/constants/BusinessConstants.java +++ b/src/main/java/com/jsh/erp/constants/BusinessConstants.java @@ -151,55 +151,6 @@ public class BusinessConstants { * 条 * */ public static final String LOG_DATA_UNIT = "条"; - /** - * 模块中文名称 - * 模块对应的标识 - * */ - public static final String LOG_MODULE_NAME_USER= "用户"; - public static final String LOG_INTERFACE_NAME_USER= "user"; - public static final String LOG_MODULE_NAME_ROLE= "角色"; - public static final String LOG_INTERFACE_NAME_ROLE= "role"; - public static final String LOG_MODULE_NAME_APP= "应用"; - public static final String LOG_INTERFACE_NAME_APP= "app"; - public static final String LOG_MODULE_NAME_DEPOT= "仓库"; - public static final String LOG_INTERFACE_NAME_DEPOT= "depot"; - public static final String LOG_MODULE_NAME_FUNCTIONS= "功能"; - public static final String LOG_INTERFACE_NAME_FUNCTIONS= "functions"; - public static final String LOG_MODULE_NAME_IN_OUT_ITEM= "收支项目"; - public static final String LOG_INTERFACE_NAME_IN_OUT_ITEM= "inOutItem"; - public static final String LOG_MODULE_NAME_UNIT= "计量单位"; - public static final String LOG_INTERFACE_NAME_UNIT= "unit"; - public static final String LOG_MODULE_NAME_PERSON= "经手人"; - public static final String LOG_INTERFACE_NAME_PERSON= "person"; - public static final String LOG_MODULE_NAME_USER_BUSINESS= "关联关系"; - public static final String LOG_INTERFACE_NAME_USER_BUSINESS= "userBusiness"; - public static final String LOG_MODULE_NAME_SYSTEM_CONFIG= "系统配置"; - public static final String LOG_INTERFACE_NAME_SYSTEM_CONFIG= "systemConfig"; - public static final String LOG_MODULE_NAME_MATERIAL_PROPERTY= "商品属性"; - public static final String LOG_INTERFACE_NAME_MATERIAL_PROPERTY= "materialProperty"; - public static final String LOG_MODULE_NAME_ACCOUNT= "账户"; - public static final String LOG_INTERFACE_NAME_ACCOUNT= "account"; - public static final String LOG_MODULE_NAME_SUPPLIER= "商家"; - public static final String LOG_INTERFACE_NAME_SUPPLIER= "supplier"; - public static final String LOG_MODULE_NAME_MATERIAL_CATEGORY= "商品类型"; - public static final String LOG_INTERFACE_NAME_MATERIAL_CATEGORY= "materialCategory"; - public static final String LOG_MODULE_NAME_MATERIAL= "商品"; - public static final String LOG_INTERFACE_NAME_MATERIAL= "material"; - public static final String LOG_MODULE_NAME_DEPOT_HEAD= "单据"; - public static final String LOG_INTERFACE_NAME_DEPOT_HEAD= "depotHead"; - public static final String LOG_MODULE_NAME_DEPOT_ITEM= "单据明细"; - public static final String LOG_INTERFACE_NAME_DEPOT_ITEM= "depotItem"; - public static final String LOG_MODULE_NAME_ACCOUNT_HEAD= "财务"; - public static final String LOG_INTERFACE_NAME_ACCOUNT_HEAD= "accountHead"; - public static final String LOG_MODULE_NAME_ACCOUNT_ITEM= "财务明细"; - public static final String LOG_INTERFACE_NAME_ACCOUNT_ITEM= "accountItem"; - public static final String LOG_MODULE_NAME_SERIAL_NUMBER= "序列号"; - public static final String LOG_INTERFACE_NAME_SERIAL_NUMBER= "serialNumber"; - public static final String LOG_MODULE_NAME_ORGANIZATION= "机构"; - public static final String LOG_INTERFACE_NAME_ORGANIZATION= "organization"; - - public static final String TYPE_NAME_ROLE_APP = "RoleAPP"; - public static final String TYPE_NAME_ROLE_FUNCTIONS = "RoleFunctions"; /** * 删除类型 diff --git a/src/main/java/com/jsh/erp/controller/DepotHeadController.java b/src/main/java/com/jsh/erp/controller/DepotHeadController.java index 79042d20..a46251b2 100644 --- a/src/main/java/com/jsh/erp/controller/DepotHeadController.java +++ b/src/main/java/com/jsh/erp/controller/DepotHeadController.java @@ -404,7 +404,7 @@ public class DepotHeadController { throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE, ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG); } else { - depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated,tenantId); + depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated,tenantId, request); } return result; } @@ -431,7 +431,7 @@ public class DepotHeadController { HttpServletRequest request) throws Exception{ Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString()); JSONObject result = ExceptionConstants.standardSuccess(); - depotHeadService.updateDepotHeadAndDetail(id,beanJson,inserted,deleted,updated,preTotalPrice,tenantId); + depotHeadService.updateDepotHeadAndDetail(id,beanJson,inserted,deleted,updated,preTotalPrice,tenantId,request); return result; } /** diff --git a/src/main/java/com/jsh/erp/controller/UserController.java b/src/main/java/com/jsh/erp/controller/UserController.java index a905ebfd..9856c176 100644 --- a/src/main/java/com/jsh/erp/controller/UserController.java +++ b/src/main/java/com/jsh/erp/controller/UserController.java @@ -120,7 +120,7 @@ public class UserController { } } } - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, + logService.insertLog("用户", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_LOGIN).append(user.getId()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); } catch (Exception e) { diff --git a/src/main/java/com/jsh/erp/service/CommonQueryManager.java b/src/main/java/com/jsh/erp/service/CommonQueryManager.java index d7a84ff6..f66e99d2 100644 --- a/src/main/java/com/jsh/erp/service/CommonQueryManager.java +++ b/src/main/java/com/jsh/erp/service/CommonQueryManager.java @@ -72,7 +72,6 @@ public class CommonQueryManager { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int insert(String apiName, String beanJson, HttpServletRequest request) throws Exception{ if (StringUtil.isNotEmpty(apiName)) { - logService.insertLog(apiName, BusinessConstants.LOG_OPERATION_TYPE_ADD, request); return container.getCommonQuery(apiName).insert(beanJson, request); } return 0; @@ -88,9 +87,7 @@ public class CommonQueryManager { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int update(String apiName, String beanJson, Long id, HttpServletRequest request)throws Exception { if (StringUtil.isNotEmpty(apiName)) { - logService.insertLog(apiName, - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); - return container.getCommonQuery(apiName).update(beanJson, id); + return container.getCommonQuery(apiName).update(beanJson, id, request); } return 0; } @@ -104,9 +101,7 @@ public class CommonQueryManager { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int delete(String apiName, Long id, HttpServletRequest request)throws Exception { if (StringUtil.isNotEmpty(apiName)) { - logService.insertLog(apiName, - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); - return container.getCommonQuery(apiName).delete(id); + return container.getCommonQuery(apiName).delete(id, request); } return 0; } @@ -120,8 +115,7 @@ public class CommonQueryManager { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDelete(String apiName, String ids, HttpServletRequest request)throws Exception { if (StringUtil.isNotEmpty(apiName)) { - logService.insertLog(apiName, "批量删除,id集:" + ids, request); - return container.getCommonQuery(apiName).batchDelete(ids); + return container.getCommonQuery(apiName).batchDelete(ids, request); } return 0; } diff --git a/src/main/java/com/jsh/erp/service/ICommonQuery.java b/src/main/java/com/jsh/erp/service/ICommonQuery.java index 25d19880..ccf30d6c 100644 --- a/src/main/java/com/jsh/erp/service/ICommonQuery.java +++ b/src/main/java/com/jsh/erp/service/ICommonQuery.java @@ -50,7 +50,7 @@ public interface ICommonQuery { * @param beanJson * @return */ - int update(String beanJson, Long id) throws Exception; + int update(String beanJson, Long id, HttpServletRequest request) throws Exception; /** * 删除数据 @@ -58,7 +58,7 @@ public interface ICommonQuery { * @param id * @return */ - int delete(Long id) throws Exception; + int delete(Long id, HttpServletRequest request) throws Exception; /** * 批量删除数据 @@ -66,7 +66,7 @@ public interface ICommonQuery { * @param ids * @return */ - int batchDelete(String ids) throws Exception; + int batchDelete(String ids, HttpServletRequest request) throws Exception; /** * 查询名称是否存在 diff --git a/src/main/java/com/jsh/erp/service/account/AccountComponent.java b/src/main/java/com/jsh/erp/service/account/AccountComponent.java index a1b159f9..47dae08a 100644 --- a/src/main/java/com/jsh/erp/service/account/AccountComponent.java +++ b/src/main/java/com/jsh/erp/service/account/AccountComponent.java @@ -52,18 +52,18 @@ public class AccountComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return accountService.updateAccount(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return accountService.updateAccount(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return accountService.deleteAccount(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return accountService.deleteAccount(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return accountService.batchDeleteAccount(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return accountService.batchDeleteAccount(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/account/AccountService.java b/src/main/java/com/jsh/erp/service/account/AccountService.java index fd077e4d..c05a6071 100644 --- a/src/main/java/com/jsh/erp/service/account/AccountService.java +++ b/src/main/java/com/jsh/erp/service/account/AccountService.java @@ -122,6 +122,7 @@ public class AccountService { int result=0; try{ result = accountMapper.insertSelective(account); + logService.insertLog("账户", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -129,12 +130,14 @@ public class AccountService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateAccount(String beanJson, Long id)throws Exception { + public int updateAccount(String beanJson, Long id, HttpServletRequest request)throws Exception { Account account = JSONObject.parseObject(beanJson, Account.class); account.setId(id); int result=0; try{ result = accountMapper.updateByPrimaryKeySelective(account); + logService.insertLog("账户", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -142,10 +145,12 @@ public class AccountService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteAccount(Long id) throws Exception{ + public int deleteAccount(Long id, HttpServletRequest request) throws Exception{ int result=0; try{ result = accountMapper.deleteByPrimaryKey(id); + logService.insertLog("账户", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -153,13 +158,14 @@ public class AccountService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteAccount(String ids)throws Exception { + public int batchDeleteAccount(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); AccountExample example = new AccountExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result = accountMapper.deleteByExample(example); + logService.insertLog("账户", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -421,7 +427,7 @@ public class AccountService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int updateAmountIsDefault(Boolean isDefault, Long accountId) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,BusinessConstants.LOG_OPERATION_TYPE_EDIT+accountId, + logService.insertLog("账户",BusinessConstants.LOG_OPERATION_TYPE_EDIT+accountId, ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); Account account = new Account(); account.setIsdefault(isDefault); @@ -437,7 +443,7 @@ public class AccountService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteAccountByIds(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT, + logService.insertLog("账户", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/accountHead/AccountHeadComponent.java b/src/main/java/com/jsh/erp/service/accountHead/AccountHeadComponent.java index 01f9ca98..5bdf7111 100644 --- a/src/main/java/com/jsh/erp/service/accountHead/AccountHeadComponent.java +++ b/src/main/java/com/jsh/erp/service/accountHead/AccountHeadComponent.java @@ -54,18 +54,18 @@ public class AccountHeadComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return accountHeadService.updateAccountHead(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return accountHeadService.updateAccountHead(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return accountHeadService.deleteAccountHead(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return accountHeadService.deleteAccountHead(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return accountHeadService.batchDeleteAccountHead(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return accountHeadService.batchDeleteAccountHead(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java b/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java index 9d485400..3007861b 100644 --- a/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java +++ b/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java @@ -102,6 +102,7 @@ public class AccountHeadService { int result=0; try{ result = accountHeadMapper.insertSelective(accountHead); + logService.insertLog("财务", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -109,12 +110,14 @@ public class AccountHeadService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateAccountHead(String beanJson, Long id)throws Exception { + public int updateAccountHead(String beanJson, Long id, HttpServletRequest request)throws Exception { AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class); accountHead.setId(id); int result=0; try{ result = accountHeadMapper.updateByPrimaryKeySelective(accountHead); + logService.insertLog("财务", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -122,10 +125,12 @@ public class AccountHeadService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteAccountHead(Long id)throws Exception { + public int deleteAccountHead(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result = accountHeadMapper.deleteByPrimaryKey(id); + logService.insertLog("财务", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -133,13 +138,14 @@ public class AccountHeadService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteAccountHead(String ids)throws Exception { + public int batchDeleteAccountHead(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); AccountHeadExample example = new AccountHeadExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result = accountHeadMapper.deleteByExample(example); + logService.insertLog("财务", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -257,7 +263,7 @@ public class AccountHeadService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteAccountHeadByIds(String ids)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_HEAD, + logService.insertLog("财务", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/accountItem/AccountItemComponent.java b/src/main/java/com/jsh/erp/service/accountItem/AccountItemComponent.java index b2fd6d5d..05af1e7f 100644 --- a/src/main/java/com/jsh/erp/service/accountItem/AccountItemComponent.java +++ b/src/main/java/com/jsh/erp/service/accountItem/AccountItemComponent.java @@ -52,18 +52,18 @@ public class AccountItemComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return accountItemService.updateAccountItem(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return accountItemService.updateAccountItem(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return accountItemService.deleteAccountItem(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return accountItemService.deleteAccountItem(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return accountItemService.batchDeleteAccountItem(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return accountItemService.batchDeleteAccountItem(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java b/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java index e02d5820..e05240a1 100644 --- a/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java +++ b/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java @@ -95,6 +95,7 @@ public class AccountItemService { int result=0; try{ result = accountItemMapper.insertSelective(accountItem); + logService.insertLog("财务明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -102,12 +103,14 @@ public class AccountItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateAccountItem(String beanJson, Long id)throws Exception { + public int updateAccountItem(String beanJson, Long id, HttpServletRequest request)throws Exception { AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class); accountItem.setId(id); int result=0; try{ result = accountItemMapper.updateByPrimaryKeySelective(accountItem); + logService.insertLog("财务明细", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -115,10 +118,12 @@ public class AccountItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteAccountItem(Long id)throws Exception { + public int deleteAccountItem(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result = accountItemMapper.deleteByPrimaryKey(id); + logService.insertLog("财务明细", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -126,13 +131,14 @@ public class AccountItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteAccountItem(String ids)throws Exception { + public int batchDeleteAccountItem(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); AccountItemExample example = new AccountItemExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result = accountItemMapper.deleteByExample(example); + logService.insertLog("财务明细", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -184,7 +190,7 @@ public class AccountItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public String saveDetials(String inserted, String deleted, String updated, Long headerId, String listType) throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM, + logService.insertLog("财务明细", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(",headerId:").append(headerId).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //转为json @@ -257,7 +263,7 @@ public class AccountItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteAccountItemByIds(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM, + logService.insertLog("财务明细", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/depot/DepotComponent.java b/src/main/java/com/jsh/erp/service/depot/DepotComponent.java index 0e5de244..1d9a9ab8 100644 --- a/src/main/java/com/jsh/erp/service/depot/DepotComponent.java +++ b/src/main/java/com/jsh/erp/service/depot/DepotComponent.java @@ -52,18 +52,18 @@ public class DepotComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return depotService.updateDepot(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return depotService.updateDepot(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return depotService.deleteDepot(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return depotService.deleteDepot(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return depotService.batchDeleteDepot(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return depotService.batchDeleteDepot(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/depot/DepotService.java b/src/main/java/com/jsh/erp/service/depot/DepotService.java index d349f620..803fd70d 100644 --- a/src/main/java/com/jsh/erp/service/depot/DepotService.java +++ b/src/main/java/com/jsh/erp/service/depot/DepotService.java @@ -103,6 +103,7 @@ public class DepotService { int result=0; try{ result=depotMapper.insertSelective(depot); + logService.insertLog("仓库", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -110,12 +111,14 @@ public class DepotService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateDepot(String beanJson, Long id) throws Exception{ + public int updateDepot(String beanJson, Long id, HttpServletRequest request) throws Exception{ Depot depot = JSONObject.parseObject(beanJson, Depot.class); depot.setId(id); int result=0; try{ result= depotMapper.updateByPrimaryKeySelective(depot); + logService.insertLog("仓库", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -123,10 +126,12 @@ public class DepotService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteDepot(Long id)throws Exception { + public int deleteDepot(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result= depotMapper.deleteByPrimaryKey(id); + logService.insertLog("仓库", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -134,13 +139,14 @@ public class DepotService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteDepot(String ids) throws Exception{ + public int batchDeleteDepot(String ids, HttpServletRequest request) throws Exception{ List idList = StringUtil.strToLongList(ids); DepotExample example = new DepotExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result= depotMapper.deleteByExample(example); + logService.insertLog("仓库", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -196,7 +202,7 @@ public class DepotService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteDepotByIds(String ids)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT, + logService.insertLog("仓库", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); @@ -272,7 +278,7 @@ public class DepotService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int updateDepotIsDefault(Boolean isDefault, Long depotID) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT,BusinessConstants.LOG_OPERATION_TYPE_EDIT+depotID, + logService.insertLog("仓库",BusinessConstants.LOG_OPERATION_TYPE_EDIT+depotID, ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); Depot depot = new Depot(); depot.setIsDefault(isDefault); diff --git a/src/main/java/com/jsh/erp/service/depotHead/DepotHeadComponent.java b/src/main/java/com/jsh/erp/service/depotHead/DepotHeadComponent.java index 74326b00..70f0fbf0 100644 --- a/src/main/java/com/jsh/erp/service/depotHead/DepotHeadComponent.java +++ b/src/main/java/com/jsh/erp/service/depotHead/DepotHeadComponent.java @@ -59,18 +59,18 @@ public class DepotHeadComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return depotHeadService.updateDepotHead(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return depotHeadService.updateDepotHead(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return depotHeadService.deleteDepotHead(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return depotHeadService.deleteDepotHead(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return depotHeadService.batchDeleteDepotHead(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return depotHeadService.batchDeleteDepotHead(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java b/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java index 0177ffbf..59a36be1 100644 --- a/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java +++ b/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java @@ -142,6 +142,7 @@ public class DepotHeadService { int result=0; try{ result=depotHeadMapper.insert(depotHead); + logService.insertLog("单据", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -149,7 +150,7 @@ public class DepotHeadService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateDepotHead(String beanJson, Long id) throws Exception{ + public int updateDepotHead(String beanJson, Long id, HttpServletRequest request) throws Exception{ DepotHead dh=null; try{ dh = depotHeadMapper.selectByPrimaryKey(id); @@ -164,6 +165,8 @@ public class DepotHeadService { int result=0; try{ result = depotHeadMapper.updateByPrimaryKey(depotHead); + logService.insertLog("单据", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -171,10 +174,12 @@ public class DepotHeadService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteDepotHead(Long id)throws Exception { + public int deleteDepotHead(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result = depotHeadMapper.deleteByPrimaryKey(id); + logService.insertLog("单据", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -182,13 +187,14 @@ public class DepotHeadService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteDepotHead(String ids)throws Exception { + public int batchDeleteDepotHead(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); DepotHeadExample example = new DepotHeadExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result = depotHeadMapper.deleteByExample(example); + logService.insertLog("单据", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -209,7 +215,7 @@ public class DepotHeadService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchSetStatus(String status, String depotHeadIDs)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD, + logService.insertLog("单据", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHeadIDs).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); List ids = StringUtil.strToLongList(depotHeadIDs); @@ -469,8 +475,9 @@ public class DepotHeadService { * @return java.lang.String */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated,Long tenantId) throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD, + public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated,Long tenantId, + HttpServletRequest request) throws Exception { + logService.insertLog("单据", BusinessConstants.LOG_OPERATION_TYPE_ADD, ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); /**处理单据主表数据*/ @@ -494,7 +501,7 @@ public class DepotHeadService { } } /**入库和出库处理单据子表信息*/ - depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId); + depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId, request); /**如果关联单据号非空则更新订单的状态为2 */ if(depotHead.getLinknumber()!=null) { DepotHead depotHeadOrders = new DepotHead(); @@ -523,8 +530,8 @@ public class DepotHeadService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void updateDepotHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated, - BigDecimal preTotalPrice, Long tenantId)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD, + BigDecimal preTotalPrice, Long tenantId,HttpServletRequest request)throws Exception { + logService.insertLog("单据", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); /**更新单据主表信息*/ @@ -546,7 +553,7 @@ public class DepotHeadService { } } /**入库和出库处理单据子表信息*/ - depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId); + depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId,request); } /** @@ -559,7 +566,7 @@ public class DepotHeadService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void deleteDepotHeadAndDetail(Long id) throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD, + logService.insertLog("单据", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //查询单据主表信息 @@ -604,7 +611,7 @@ public class DepotHeadService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void batchDeleteDepotHeadAndDetail(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD, + logService.insertLog("单据", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); if(StringUtil.isNotEmpty(ids)){ @@ -616,7 +623,7 @@ public class DepotHeadService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteDepotHeadByIds(String ids)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD, + logService.insertLog("单据", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/depotItem/DepotItemComponent.java b/src/main/java/com/jsh/erp/service/depotItem/DepotItemComponent.java index 0adc4089..70ae9845 100644 --- a/src/main/java/com/jsh/erp/service/depotItem/DepotItemComponent.java +++ b/src/main/java/com/jsh/erp/service/depotItem/DepotItemComponent.java @@ -52,18 +52,18 @@ public class DepotItemComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return depotItemService.updateDepotItem(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return depotItemService.updateDepotItem(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return depotItemService.deleteDepotItem(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return depotItemService.deleteDepotItem(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return depotItemService.batchDeleteDepotItem(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return depotItemService.batchDeleteDepotItem(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java index 982f11ef..474626e6 100644 --- a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java +++ b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java @@ -107,6 +107,7 @@ public class DepotItemService { int result =0; try{ result=depotItemMapper.insertSelective(depotItem); + logService.insertLog("单据明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.readFail(logger, e); } @@ -114,12 +115,14 @@ public class DepotItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateDepotItem(String beanJson, Long id)throws Exception { + public int updateDepotItem(String beanJson, Long id, HttpServletRequest request)throws Exception { DepotItem depotItem = JSONObject.parseObject(beanJson, DepotItem.class); depotItem.setId(id); int result =0; try{ result=depotItemMapper.updateByPrimaryKeySelective(depotItem); + logService.insertLog("单据明细", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.readFail(logger, e); } @@ -127,10 +130,12 @@ public class DepotItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteDepotItem(Long id)throws Exception { + public int deleteDepotItem(Long id, HttpServletRequest request)throws Exception { int result =0; try{ result=depotItemMapper.deleteByPrimaryKey(id); + logService.insertLog("单据明细", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -138,13 +143,14 @@ public class DepotItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteDepotItem(String ids)throws Exception { + public int batchDeleteDepotItem(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); DepotItemExample example = new DepotItemExample(); example.createCriteria().andIdIn(idList); int result =0; try{ result=depotItemMapper.deleteByExample(example); + logService.insertLog("单据明细", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -284,8 +290,8 @@ public class DepotItemService { * 这里重点重申一下:BasicNumber=OperNumber*ratio * */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM, + public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId, HttpServletRequest request) throws Exception{ + logService.insertLog("单据明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //查询单据主表信息 @@ -330,7 +336,7 @@ public class DepotItemService { userInfo); } } - this.deleteDepotItem(tempDeletedJson.getLong("Id")); + this.deleteDepotItem(tempDeletedJson.getLong("Id"), request); bf.append(tempDeletedJson.getLong("Id")); if(i<(deletedJson.size()-1)){ bf.append(","); @@ -598,7 +604,7 @@ public class DepotItemService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteDepotItemByIds(String ids)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM, + logService.insertLog("单据明细", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/functions/FunctionsComponent.java b/src/main/java/com/jsh/erp/service/functions/FunctionsComponent.java index fb695d0e..c1620745 100644 --- a/src/main/java/com/jsh/erp/service/functions/FunctionsComponent.java +++ b/src/main/java/com/jsh/erp/service/functions/FunctionsComponent.java @@ -51,18 +51,18 @@ public class FunctionsComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return functionsService.updateFunctions(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return functionsService.updateFunctions(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return functionsService.deleteFunctions(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return functionsService.deleteFunctions(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return functionsService.batchDeleteFunctions(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return functionsService.batchDeleteFunctions(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/functions/FunctionsService.java b/src/main/java/com/jsh/erp/service/functions/FunctionsService.java index f4ccff6b..bba795b4 100644 --- a/src/main/java/com/jsh/erp/service/functions/FunctionsService.java +++ b/src/main/java/com/jsh/erp/service/functions/FunctionsService.java @@ -88,6 +88,7 @@ public class FunctionsService { int result=0; try{ result=functionsMapper.insertSelective(depot); + logService.insertLog("功能", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -95,12 +96,14 @@ public class FunctionsService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateFunctions(String beanJson, Long id) throws Exception{ + public int updateFunctions(String beanJson, Long id, HttpServletRequest request) throws Exception{ Functions depot = JSONObject.parseObject(beanJson, Functions.class); depot.setId(id); int result=0; try{ result=functionsMapper.updateByPrimaryKeySelective(depot); + logService.insertLog("功能", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -108,10 +111,12 @@ public class FunctionsService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteFunctions(Long id)throws Exception { + public int deleteFunctions(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=functionsMapper.deleteByPrimaryKey(id); + logService.insertLog("功能", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -119,13 +124,14 @@ public class FunctionsService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteFunctions(String ids)throws Exception { + public int batchDeleteFunctions(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); FunctionsExample example = new FunctionsExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=functionsMapper.deleteByExample(example); + logService.insertLog("功能", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -189,7 +195,7 @@ public class FunctionsService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteFunctionsByIds(String ids)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_FUNCTIONS, + logService.insertLog("功能", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/inOutItem/InOutItemComponent.java b/src/main/java/com/jsh/erp/service/inOutItem/InOutItemComponent.java index cc8812f9..a9467d70 100644 --- a/src/main/java/com/jsh/erp/service/inOutItem/InOutItemComponent.java +++ b/src/main/java/com/jsh/erp/service/inOutItem/InOutItemComponent.java @@ -52,18 +52,18 @@ public class InOutItemComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return inOutItemService.updateInOutItem(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return inOutItemService.updateInOutItem(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return inOutItemService.deleteInOutItem(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return inOutItemService.deleteInOutItem(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return inOutItemService.batchDeleteInOutItem(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return inOutItemService.batchDeleteInOutItem(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java b/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java index 641ac6e1..53c6b8db 100644 --- a/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java +++ b/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java @@ -89,6 +89,7 @@ public class InOutItemService { int result=0; try{ result=inOutItemMapper.insertSelective(depot); + logService.insertLog("收支项目", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -96,12 +97,14 @@ public class InOutItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateInOutItem(String beanJson, Long id)throws Exception { + public int updateInOutItem(String beanJson, Long id, HttpServletRequest request)throws Exception { InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class); depot.setId(id); int result=0; try{ result=inOutItemMapper.updateByPrimaryKeySelective(depot); + logService.insertLog("收支项目", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -109,10 +112,12 @@ public class InOutItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteInOutItem(Long id)throws Exception { + public int deleteInOutItem(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=inOutItemMapper.deleteByPrimaryKey(id); + logService.insertLog("收支项目", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -120,13 +125,14 @@ public class InOutItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteInOutItem(String ids)throws Exception { + public int batchDeleteInOutItem(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); InOutItemExample example = new InOutItemExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=inOutItemMapper.deleteByExample(example); + logService.insertLog("收支项目", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -164,7 +170,7 @@ public class InOutItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteInOutItemByIds(String ids)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_IN_OUT_ITEM, + logService.insertLog("收支项目", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/log/LogComponent.java b/src/main/java/com/jsh/erp/service/log/LogComponent.java index 1432c9f3..211c81d1 100644 --- a/src/main/java/com/jsh/erp/service/log/LogComponent.java +++ b/src/main/java/com/jsh/erp/service/log/LogComponent.java @@ -61,18 +61,18 @@ public class LogComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return logService.updateLog(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return logService.updateLog(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return logService.deleteLog(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return logService.deleteLog(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return logService.batchDeleteLog(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return logService.batchDeleteLog(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/log/LogService.java b/src/main/java/com/jsh/erp/service/log/LogService.java index b8b06bd2..b936bf10 100644 --- a/src/main/java/com/jsh/erp/service/log/LogService.java +++ b/src/main/java/com/jsh/erp/service/log/LogService.java @@ -96,7 +96,7 @@ public class LogService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateLog(String beanJson, Long id)throws Exception { + public int updateLog(String beanJson, Long id, HttpServletRequest request)throws Exception { Log log = JSONObject.parseObject(beanJson, Log.class); log.setId(id); int result=0; @@ -109,7 +109,7 @@ public class LogService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteLog(Long id)throws Exception { + public int deleteLog(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=logMapper.deleteByPrimaryKey(id); @@ -120,7 +120,7 @@ public class LogService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteLog(String ids)throws Exception { + public int batchDeleteLog(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); LogExample example = new LogExample(); example.createCriteria().andIdIn(idList); @@ -148,64 +148,15 @@ public class LogService { } } - public String getModule(String apiName)throws Exception{ - String moduleName = null; - switch (apiName) { - case BusinessConstants.LOG_INTERFACE_NAME_USER: - moduleName = BusinessConstants.LOG_MODULE_NAME_USER; break; - case BusinessConstants.LOG_INTERFACE_NAME_ROLE: - moduleName = BusinessConstants.LOG_MODULE_NAME_ROLE; break; - case BusinessConstants.LOG_INTERFACE_NAME_APP: - moduleName =BusinessConstants.LOG_MODULE_NAME_APP; break; - case BusinessConstants.LOG_INTERFACE_NAME_DEPOT: - moduleName = BusinessConstants.LOG_MODULE_NAME_DEPOT; break; - case BusinessConstants.LOG_INTERFACE_NAME_FUNCTIONS: - moduleName = BusinessConstants.LOG_MODULE_NAME_FUNCTIONS; break; - case BusinessConstants.LOG_INTERFACE_NAME_IN_OUT_ITEM: - moduleName = BusinessConstants.LOG_MODULE_NAME_IN_OUT_ITEM; break; - case BusinessConstants.LOG_INTERFACE_NAME_UNIT: - moduleName = BusinessConstants.LOG_MODULE_NAME_UNIT; break; - case BusinessConstants.LOG_INTERFACE_NAME_PERSON: - moduleName = BusinessConstants.LOG_MODULE_NAME_PERSON; break; - case BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS: - moduleName = BusinessConstants.LOG_MODULE_NAME_USER_BUSINESS; break; - case BusinessConstants.LOG_INTERFACE_NAME_SYSTEM_CONFIG: - moduleName = BusinessConstants.LOG_MODULE_NAME_SYSTEM_CONFIG; break; - case BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_PROPERTY: - moduleName = BusinessConstants.LOG_MODULE_NAME_MATERIAL_PROPERTY; break; - case BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT: - moduleName = BusinessConstants.LOG_MODULE_NAME_ACCOUNT; break; - case BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER: - moduleName = BusinessConstants.LOG_MODULE_NAME_SUPPLIER; break; - case BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY: - moduleName = BusinessConstants.LOG_MODULE_NAME_MATERIAL_CATEGORY; break; - case BusinessConstants.LOG_INTERFACE_NAME_MATERIAL: - moduleName = BusinessConstants.LOG_MODULE_NAME_MATERIAL; break; - case BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD: - moduleName = BusinessConstants.LOG_MODULE_NAME_DEPOT_HEAD; break; - case BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM: - moduleName = BusinessConstants.LOG_MODULE_NAME_DEPOT_ITEM; break; - case BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_HEAD: - moduleName = BusinessConstants.LOG_MODULE_NAME_ACCOUNT_HEAD; break; - case BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM: - moduleName = BusinessConstants.LOG_MODULE_NAME_ACCOUNT_ITEM; break; - case BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER: - moduleName = BusinessConstants.LOG_MODULE_NAME_SERIAL_NUMBER; break; - case BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION: - moduleName = BusinessConstants.LOG_MODULE_NAME_ORGANIZATION; break; - } - return moduleName; - } - - public void insertLog(String apiName, String type, HttpServletRequest request)throws Exception{ + public void insertLog(String moduleName, String type, HttpServletRequest request)throws Exception{ Log log = new Log(); log.setUserid(getUserId(request)); - log.setOperation(getModule(apiName)); + log.setOperation(moduleName); log.setClientip(getLocalIp(request)); log.setCreatetime(new Date()); Byte status = 0; log.setStatus(status); - log.setContentdetails(type + getModule(apiName)); + log.setContentdetails(type + moduleName); try{ logMapper.insertSelective(log); }catch(Exception e){ diff --git a/src/main/java/com/jsh/erp/service/material/MaterialComponent.java b/src/main/java/com/jsh/erp/service/material/MaterialComponent.java index b49a5f7e..5c96a0e5 100644 --- a/src/main/java/com/jsh/erp/service/material/MaterialComponent.java +++ b/src/main/java/com/jsh/erp/service/material/MaterialComponent.java @@ -56,18 +56,18 @@ public class MaterialComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return materialService.updateMaterial(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return materialService.updateMaterial(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return materialService.deleteMaterial(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return materialService.deleteMaterial(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return materialService.batchDeleteMaterial(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return materialService.batchDeleteMaterial(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/material/MaterialService.java b/src/main/java/com/jsh/erp/service/material/MaterialService.java index fb90474e..5dff0edf 100644 --- a/src/main/java/com/jsh/erp/service/material/MaterialService.java +++ b/src/main/java/com/jsh/erp/service/material/MaterialService.java @@ -125,6 +125,7 @@ public class MaterialService { int result =0; try{ result= materialMapper.insertSelective(material); + logService.insertLog("商品", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -132,7 +133,7 @@ public class MaterialService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateMaterial(String beanJson, Long id) throws Exception{ + public int updateMaterial(String beanJson, Long id, HttpServletRequest request) throws Exception{ Material material = JSONObject.parseObject(beanJson, Material.class); material.setId(id); int res =0; @@ -144,6 +145,8 @@ public class MaterialService { } else { materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空 } + logService.insertLog("商品", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -152,10 +155,12 @@ public class MaterialService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteMaterial(Long id)throws Exception { + public int deleteMaterial(Long id, HttpServletRequest request)throws Exception { int result =0; try{ result= materialMapper.deleteByPrimaryKey(id); + logService.insertLog("商品", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -163,13 +168,14 @@ public class MaterialService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteMaterial(String ids)throws Exception { + public int batchDeleteMaterial(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); MaterialExample example = new MaterialExample(); example.createCriteria().andIdIn(idList); int result =0; try{ result= materialMapper.deleteByExample(example); + logService.insertLog("商品", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -215,7 +221,7 @@ public class MaterialService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchSetEnable(Boolean enabled, String materialIDs)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL, + logService.insertLog("商品", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(materialIDs).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); List ids = StringUtil.strToLongList(materialIDs); @@ -292,7 +298,7 @@ public class MaterialService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public BaseResponseInfo importExcel(List mList) throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL, + logService.insertLog("商品", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_IMPORT).append(mList.size()).append(BusinessConstants.LOG_DATA_UNIT).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); BaseResponseInfo info = new BaseResponseInfo(); @@ -324,7 +330,7 @@ public class MaterialService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteMaterialByIds(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL, + logService.insertLog("商品", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryComponent.java b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryComponent.java index b6bb92ac..d76d5f73 100644 --- a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryComponent.java +++ b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryComponent.java @@ -52,18 +52,18 @@ public class MaterialCategoryComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return materialCategoryService.updateMaterialCategory(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return materialCategoryService.updateMaterialCategory(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return materialCategoryService.deleteMaterialCategory(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return materialCategoryService.deleteMaterialCategory(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return materialCategoryService.batchDeleteMaterialCategory(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return materialCategoryService.batchDeleteMaterialCategory(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java index 789aa6ff..56bb21b9 100644 --- a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java +++ b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java @@ -118,6 +118,7 @@ public class MaterialCategoryService { int result=0; try{ result=materialCategoryMapper.insertSelective(materialCategory); + logService.insertLog("商品类型", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -125,12 +126,14 @@ public class MaterialCategoryService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateMaterialCategory(String beanJson, Long id) throws Exception{ + public int updateMaterialCategory(String beanJson, Long id, HttpServletRequest request) throws Exception{ MaterialCategory materialCategory = JSONObject.parseObject(beanJson, MaterialCategory.class); materialCategory.setId(id); int result=0; try{ result=materialCategoryMapper.updateByPrimaryKeySelective(materialCategory); + logService.insertLog("商品类型", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -138,10 +141,12 @@ public class MaterialCategoryService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteMaterialCategory(Long id)throws Exception { + public int deleteMaterialCategory(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=materialCategoryMapper.deleteByPrimaryKey(id); + logService.insertLog("商品类型", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -149,13 +154,14 @@ public class MaterialCategoryService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteMaterialCategory(String ids)throws Exception { + public int batchDeleteMaterialCategory(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); MaterialCategoryExample example = new MaterialCategoryExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=materialCategoryMapper.deleteByExample(example); + logService.insertLog("商品类型", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -204,7 +210,7 @@ public class MaterialCategoryService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int addMaterialCategory(MaterialCategory mc) throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY, + logService.insertLog("商品类型", BusinessConstants.LOG_OPERATION_TYPE_ADD, ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); if(mc==null){ @@ -238,7 +244,7 @@ public class MaterialCategoryService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteMaterialCategoryByIds(String ids) throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY, + logService.insertLog("商品类型", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //更新时间 @@ -260,7 +266,7 @@ public class MaterialCategoryService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int editMaterialCategory(MaterialCategory mc) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY, + logService.insertLog("商品类型", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getId()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); if(mc.getParentid()==null){ diff --git a/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyComponent.java b/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyComponent.java index 33a39ccc..9165ea29 100644 --- a/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyComponent.java +++ b/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyComponent.java @@ -48,18 +48,18 @@ public class MaterialPropertyComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return materialPropertyService.updateMaterialProperty(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return materialPropertyService.updateMaterialProperty(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return materialPropertyService.deleteMaterialProperty(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return materialPropertyService.deleteMaterialProperty(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return materialPropertyService.batchDeleteMaterialProperty(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return materialPropertyService.batchDeleteMaterialProperty(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyService.java b/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyService.java index 35a58476..e5c9b660 100644 --- a/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyService.java +++ b/src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyService.java @@ -87,6 +87,7 @@ public class MaterialPropertyService { int result=0; try{ result=materialPropertyMapper.insertSelective(materialProperty); + logService.insertLog("商品属性", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -94,12 +95,14 @@ public class MaterialPropertyService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateMaterialProperty(String beanJson, Long id)throws Exception { + public int updateMaterialProperty(String beanJson, Long id, HttpServletRequest request)throws Exception { MaterialProperty materialProperty = JSONObject.parseObject(beanJson, MaterialProperty.class); materialProperty.setId(id); int result=0; try{ result=materialPropertyMapper.updateByPrimaryKeySelective(materialProperty); + logService.insertLog("商品属性", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -107,10 +110,12 @@ public class MaterialPropertyService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteMaterialProperty(Long id)throws Exception { + public int deleteMaterialProperty(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=materialPropertyMapper.deleteByPrimaryKey(id); + logService.insertLog("商品属性", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -118,13 +123,14 @@ public class MaterialPropertyService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteMaterialProperty(String ids)throws Exception { + public int batchDeleteMaterialProperty(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); MaterialPropertyExample example = new MaterialPropertyExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=materialPropertyMapper.deleteByExample(example); + logService.insertLog("商品属性", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -136,7 +142,7 @@ public class MaterialPropertyService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteMaterialPropertyByIds(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_PROPERTY, + logService.insertLog("商品属性", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/msg/MsgComponent.java b/src/main/java/com/jsh/erp/service/msg/MsgComponent.java index 7eac1848..d904f0c1 100644 --- a/src/main/java/com/jsh/erp/service/msg/MsgComponent.java +++ b/src/main/java/com/jsh/erp/service/msg/MsgComponent.java @@ -49,18 +49,18 @@ public class MsgComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return msgService.updateMsg(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return msgService.updateMsg(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return msgService.deleteMsg(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return msgService.deleteMsg(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return msgService.batchDeleteMsg(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return msgService.batchDeleteMsg(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/msg/MsgService.java b/src/main/java/com/jsh/erp/service/msg/MsgService.java index 0e22ff60..f5f2a191 100644 --- a/src/main/java/com/jsh/erp/service/msg/MsgService.java +++ b/src/main/java/com/jsh/erp/service/msg/MsgService.java @@ -97,6 +97,7 @@ public class MsgService { int result=0; try{ result=msgMapper.insertSelective(msg); + logService.insertLog("消息", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ logger.error("异常码[{}],异常提示[{}],异常[{}]", ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e); @@ -107,12 +108,14 @@ public class MsgService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateMsg(String beanJson, Long id) throws Exception{ + public int updateMsg(String beanJson, Long id, HttpServletRequest request) throws Exception{ Msg msg = JSONObject.parseObject(beanJson, Msg.class); msg.setId(id); int result=0; try{ result=msgMapper.updateByPrimaryKeySelective(msg); + logService.insertLog("消息", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ logger.error("异常码[{}],异常提示[{}],异常[{}]", ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e); @@ -123,10 +126,12 @@ public class MsgService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteMsg(Long id)throws Exception { + public int deleteMsg(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=msgMapper.deleteByPrimaryKey(id); + logService.insertLog("消息", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ logger.error("异常码[{}],异常提示[{}],异常[{}]", ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e); @@ -137,13 +142,14 @@ public class MsgService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteMsg(String ids) throws Exception{ + public int batchDeleteMsg(String ids, HttpServletRequest request) throws Exception{ List idList = StringUtil.strToLongList(ids); MsgExample example = new MsgExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=msgMapper.deleteByExample(example); + logService.insertLog("消息", "批量删除,id集:" + ids, request); }catch(Exception e){ logger.error("异常码[{}],异常提示[{}],异常[{}]", ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e); @@ -179,7 +185,7 @@ public class MsgService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteMsgByIds(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, + logService.insertLog("序列号", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); String [] idArray=ids.split(","); diff --git a/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelComponent.java b/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelComponent.java index 2024d2df..e59e5bc8 100644 --- a/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelComponent.java +++ b/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelComponent.java @@ -45,18 +45,18 @@ public class OrgaUserRelComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return orgaUserRelService.updateOrgaUserRel(beanJson,id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return orgaUserRelService.updateOrgaUserRel(beanJson,id, request); } @Override - public int delete(Long id)throws Exception { - return orgaUserRelService.deleteOrgaUserRel(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return orgaUserRelService.deleteOrgaUserRel(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return orgaUserRelService.batchDeleteOrgaUserRel(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return orgaUserRelService.batchDeleteOrgaUserRel(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelService.java b/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelService.java index 0d57cf84..17f9ac50 100644 --- a/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelService.java +++ b/src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelService.java @@ -53,41 +53,47 @@ public class OrgaUserRelService { int result=0; try{ result=orgaUserRelMapper.insertSelective(orgaUserRel); + logService.insertLog("用户与机构关系", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } return result; } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateOrgaUserRel(String beanJson, Long id) throws Exception{ + public int updateOrgaUserRel(String beanJson, Long id, HttpServletRequest request) throws Exception{ OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class); orgaUserRel.setId(id); int result=0; try{ result=orgaUserRelMapper.updateByPrimaryKeySelective(orgaUserRel); + logService.insertLog("用户与机构关系", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } return result; } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteOrgaUserRel(Long id)throws Exception { + public int deleteOrgaUserRel(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=orgaUserRelMapper.deleteByPrimaryKey(id); + logService.insertLog("用户与机构关系", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } return result; } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteOrgaUserRel(String ids)throws Exception { + public int batchDeleteOrgaUserRel(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); OrgaUserRelExample example = new OrgaUserRelExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=orgaUserRelMapper.deleteByExample(example); + logService.insertLog("用户与机构关系", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } diff --git a/src/main/java/com/jsh/erp/service/organization/OrganizationComponent.java b/src/main/java/com/jsh/erp/service/organization/OrganizationComponent.java index 435c8379..dd46dc1d 100644 --- a/src/main/java/com/jsh/erp/service/organization/OrganizationComponent.java +++ b/src/main/java/com/jsh/erp/service/organization/OrganizationComponent.java @@ -46,18 +46,18 @@ public class OrganizationComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return organizationService.updateOrganization(beanJson,id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return organizationService.updateOrganization(beanJson,id, request); } @Override - public int delete(Long id)throws Exception { - return organizationService.deleteOrganization(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return organizationService.deleteOrganization(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return organizationService.batchDeleteOrganization(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return organizationService.batchDeleteOrganization(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/organization/OrganizationService.java b/src/main/java/com/jsh/erp/service/organization/OrganizationService.java index 2805b9d3..92e32550 100644 --- a/src/main/java/com/jsh/erp/service/organization/OrganizationService.java +++ b/src/main/java/com/jsh/erp/service/organization/OrganizationService.java @@ -56,41 +56,47 @@ public class OrganizationService { int result=0; try{ result=organizationMapper.insertSelective(organization); + logService.insertLog("机构", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } return result; } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateOrganization(String beanJson, Long id)throws Exception { + public int updateOrganization(String beanJson, Long id, HttpServletRequest request)throws Exception { Organization organization = JSONObject.parseObject(beanJson, Organization.class); organization.setId(id); int result=0; try{ result=organizationMapper.updateByPrimaryKeySelective(organization); + logService.insertLog("机构", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } return result; } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteOrganization(Long id)throws Exception { + public int deleteOrganization(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=organizationMapper.deleteByPrimaryKey(id); + logService.insertLog("机构", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } return result; } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteOrganization(String ids)throws Exception { + public int batchDeleteOrganization(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); OrganizationExample example = new OrganizationExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=organizationMapper.deleteByExample(example); + logService.insertLog("机构", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -98,7 +104,7 @@ public class OrganizationService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int addOrganization(Organization org) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION, + logService.insertLog("机构", BusinessConstants.LOG_OPERATION_TYPE_ADD, ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //新增时间 @@ -133,7 +139,7 @@ public class OrganizationService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int editOrganization(Organization org)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION, + logService.insertLog("机构", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(org.getId()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //修改时间 @@ -233,7 +239,7 @@ public class OrganizationService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteOrganizationByIds(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION, + logService.insertLog("机构", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/person/PersonComponent.java b/src/main/java/com/jsh/erp/service/person/PersonComponent.java index bb3f27dd..d46f96dd 100644 --- a/src/main/java/com/jsh/erp/service/person/PersonComponent.java +++ b/src/main/java/com/jsh/erp/service/person/PersonComponent.java @@ -52,18 +52,18 @@ public class PersonComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return personService.updatePerson(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return personService.updatePerson(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return personService.deletePerson(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return personService.deletePerson(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return personService.batchDeletePerson(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return personService.batchDeletePerson(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/person/PersonService.java b/src/main/java/com/jsh/erp/service/person/PersonService.java index f94d475b..4ad3478a 100644 --- a/src/main/java/com/jsh/erp/service/person/PersonService.java +++ b/src/main/java/com/jsh/erp/service/person/PersonService.java @@ -92,6 +92,7 @@ public class PersonService { int result=0; try{ result=personMapper.insertSelective(person); + logService.insertLog("经手人", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -99,12 +100,14 @@ public class PersonService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updatePerson(String beanJson, Long id)throws Exception { + public int updatePerson(String beanJson, Long id, HttpServletRequest request)throws Exception { Person person = JSONObject.parseObject(beanJson, Person.class); person.setId(id); int result=0; try{ result=personMapper.updateByPrimaryKeySelective(person); + logService.insertLog("经手人", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -112,10 +115,12 @@ public class PersonService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deletePerson(Long id)throws Exception { + public int deletePerson(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=personMapper.deleteByPrimaryKey(id); + logService.insertLog("经手人", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -123,13 +128,14 @@ public class PersonService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeletePerson(String ids) throws Exception{ + public int batchDeletePerson(String ids, HttpServletRequest request) throws Exception{ List idList = StringUtil.strToLongList(ids); PersonExample example = new PersonExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=personMapper.deleteByExample(example); + logService.insertLog("经手人", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -183,7 +189,7 @@ public class PersonService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeletePersonByIds(String ids)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_PERSON, + logService.insertLog("经手人", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/role/RoleComponent.java b/src/main/java/com/jsh/erp/service/role/RoleComponent.java index b4b513ec..e757b083 100644 --- a/src/main/java/com/jsh/erp/service/role/RoleComponent.java +++ b/src/main/java/com/jsh/erp/service/role/RoleComponent.java @@ -49,18 +49,18 @@ public class RoleComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return roleService.updateRole(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return roleService.updateRole(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return roleService.deleteRole(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return roleService.deleteRole(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return roleService.batchDeleteRole(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return roleService.batchDeleteRole(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/role/RoleService.java b/src/main/java/com/jsh/erp/service/role/RoleService.java index 6a20514f..c02ecb2b 100644 --- a/src/main/java/com/jsh/erp/service/role/RoleService.java +++ b/src/main/java/com/jsh/erp/service/role/RoleService.java @@ -86,6 +86,7 @@ public class RoleService { int result=0; try{ result=roleMapper.insertSelective(role); + logService.insertLog("角色", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -93,12 +94,14 @@ public class RoleService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateRole(String beanJson, Long id) throws Exception{ + public int updateRole(String beanJson, Long id, HttpServletRequest request) throws Exception{ Role role = JSONObject.parseObject(beanJson, Role.class); role.setId(id); int result=0; try{ result=roleMapper.updateByPrimaryKeySelective(role); + logService.insertLog("角色", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -106,10 +109,12 @@ public class RoleService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteRole(Long id)throws Exception { + public int deleteRole(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=roleMapper.deleteByPrimaryKey(id); + logService.insertLog("角色", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -117,13 +122,14 @@ public class RoleService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteRole(String ids) throws Exception{ + public int batchDeleteRole(String ids, HttpServletRequest request) throws Exception{ List idList = StringUtil.strToLongList(ids); RoleExample example = new RoleExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=roleMapper.deleteByExample(example); + logService.insertLog("角色", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -153,7 +159,7 @@ public class RoleService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteRoleByIds(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, + logService.insertLog("序列号", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberComponent.java b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberComponent.java index 992a3117..97f06c19 100644 --- a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberComponent.java +++ b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberComponent.java @@ -56,18 +56,18 @@ public class SerialNumberComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return serialNumberService.updateSerialNumber(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return serialNumberService.updateSerialNumber(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return serialNumberService.deleteSerialNumber(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return serialNumberService.deleteSerialNumber(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return serialNumberService.batchDeleteSerialNumber(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return serialNumberService.batchDeleteSerialNumber(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java index ff8c85ed..35674bda 100644 --- a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java +++ b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java @@ -94,10 +94,11 @@ public class SerialNumberService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int insertSerialNumber(String beanJson, HttpServletRequest request)throws Exception { SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class); - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, BusinessConstants.LOG_OPERATION_TYPE_ADD, request); + logService.insertLog("序列号", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); int result=0; try{ result=serialNumberMapper.insertSelective(serialNumber); + logService.insertLog("序列号", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -105,12 +106,14 @@ public class SerialNumberService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateSerialNumber(String beanJson, Long id) throws Exception{ + public int updateSerialNumber(String beanJson, Long id, HttpServletRequest request) throws Exception{ SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class); serialNumber.setId(id); int result=0; try{ result=serialNumberMapper.updateByPrimaryKeySelective(serialNumber); + logService.insertLog("序列号", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -118,10 +121,12 @@ public class SerialNumberService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteSerialNumber(Long id)throws Exception { + public int deleteSerialNumber(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=serialNumberMapper.deleteByPrimaryKey(id); + logService.insertLog("序列号", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -129,13 +134,14 @@ public class SerialNumberService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteSerialNumber(String ids)throws Exception { + public int batchDeleteSerialNumber(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); SerialNumberExample example = new SerialNumberExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=serialNumberMapper.deleteByExample(example); + logService.insertLog("序列号", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -246,7 +252,7 @@ public class SerialNumberService { * */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public SerialNumberEx addSerialNumber(SerialNumberEx serialNumberEx) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,BusinessConstants.LOG_OPERATION_TYPE_ADD, + logService.insertLog("序列号",BusinessConstants.LOG_OPERATION_TYPE_ADD, ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); if(serialNumberEx==null){ return null; @@ -276,7 +282,7 @@ public class SerialNumberService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public SerialNumberEx updateSerialNumber(SerialNumberEx serialNumberEx)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, + logService.insertLog("序列号", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(serialNumberEx.getId()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); if(serialNumberEx==null){ @@ -454,7 +460,7 @@ public class SerialNumberService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void batAddSerialNumber(String materialName, String serialNumberPrefix, Integer batAddTotal, String remark)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, + logService.insertLog("序列号", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_BATCH_ADD).append(batAddTotal).append(BusinessConstants.LOG_DATA_UNIT).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); if(StringUtil.isNotEmpty(materialName)){ @@ -505,7 +511,7 @@ public class SerialNumberService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteSerialNumberByIds(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, + logService.insertLog("序列号", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/supplier/SupplierComponent.java b/src/main/java/com/jsh/erp/service/supplier/SupplierComponent.java index 67943682..98cc9c24 100644 --- a/src/main/java/com/jsh/erp/service/supplier/SupplierComponent.java +++ b/src/main/java/com/jsh/erp/service/supplier/SupplierComponent.java @@ -58,18 +58,18 @@ public class SupplierComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return supplierService.updateSupplier(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return supplierService.updateSupplier(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return supplierService.deleteSupplier(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return supplierService.deleteSupplier(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return supplierService.batchDeleteSupplier(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return supplierService.batchDeleteSupplier(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/supplier/SupplierService.java b/src/main/java/com/jsh/erp/service/supplier/SupplierService.java index 8bcb4269..1e5fb25f 100644 --- a/src/main/java/com/jsh/erp/service/supplier/SupplierService.java +++ b/src/main/java/com/jsh/erp/service/supplier/SupplierService.java @@ -133,6 +133,7 @@ public class SupplierService { int result=0; try{ result=supplierMapper.insertSelective(supplier); + logService.insertLog("商家", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -140,7 +141,7 @@ public class SupplierService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateSupplier(String beanJson, Long id)throws Exception { + public int updateSupplier(String beanJson, Long id, HttpServletRequest request)throws Exception { Supplier supplier = JSONObject.parseObject(beanJson, Supplier.class); if(supplier.getBeginneedpay() == null) { supplier.setBeginneedpay(BigDecimal.ZERO); @@ -152,6 +153,8 @@ public class SupplierService { int result=0; try{ result=supplierMapper.updateByPrimaryKeySelective(supplier); + logService.insertLog("商家", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -159,10 +162,12 @@ public class SupplierService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteSupplier(Long id)throws Exception { + public int deleteSupplier(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=supplierMapper.deleteByPrimaryKey(id); + logService.insertLog("商家", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -170,13 +175,14 @@ public class SupplierService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteSupplier(String ids) throws Exception{ + public int batchDeleteSupplier(String ids, HttpServletRequest request) throws Exception{ List idList = StringUtil.strToLongList(ids); SupplierExample example = new SupplierExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=supplierMapper.deleteByExample(example); + logService.insertLog("商家", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -197,7 +203,7 @@ public class SupplierService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int updateAdvanceIn(Long supplierId, BigDecimal advanceIn)throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER, + logService.insertLog("商家", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierId).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); Supplier supplier=null; @@ -275,7 +281,7 @@ public class SupplierService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchSetEnable(Boolean enabled, String supplierIDs)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER, + logService.insertLog("商家", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierIDs).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); List ids = StringUtil.strToLongList(supplierIDs); @@ -318,7 +324,7 @@ public class SupplierService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public BaseResponseInfo importExcel(List mList) throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER, + logService.insertLog("商家", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_IMPORT).append(mList.size()).append(BusinessConstants.LOG_DATA_UNIT).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); BaseResponseInfo info = new BaseResponseInfo(); @@ -339,7 +345,7 @@ public class SupplierService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteSupplierByIds(String ids)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER, + logService.insertLog("商家", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigComponent.java b/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigComponent.java index 7fd76977..362eaf70 100644 --- a/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigComponent.java +++ b/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigComponent.java @@ -50,18 +50,18 @@ public class SystemConfigComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return systemConfigService.updateSystemConfig(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return systemConfigService.updateSystemConfig(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return systemConfigService.deleteSystemConfig(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return systemConfigService.deleteSystemConfig(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return systemConfigService.batchDeleteSystemConfig(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return systemConfigService.batchDeleteSystemConfig(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java b/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java index 2585222c..90293e4d 100644 --- a/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java +++ b/src/main/java/com/jsh/erp/service/systemConfig/SystemConfigService.java @@ -87,6 +87,7 @@ public class SystemConfigService { int result=0; try{ result=systemConfigMapper.insertSelective(systemConfig); + logService.insertLog("系统配置", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -94,12 +95,14 @@ public class SystemConfigService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateSystemConfig(String beanJson, Long id) throws Exception{ + public int updateSystemConfig(String beanJson, Long id, HttpServletRequest request) throws Exception{ SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class); systemConfig.setId(id); int result=0; try{ result=systemConfigMapper.updateByPrimaryKeySelective(systemConfig); + logService.insertLog("系统配置", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -107,10 +110,12 @@ public class SystemConfigService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteSystemConfig(Long id)throws Exception { + public int deleteSystemConfig(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=systemConfigMapper.deleteByPrimaryKey(id); + logService.insertLog("系统配置", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -118,13 +123,14 @@ public class SystemConfigService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteSystemConfig(String ids)throws Exception { + public int batchDeleteSystemConfig(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); SystemConfigExample example = new SystemConfigExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=systemConfigMapper.deleteByExample(example); + logService.insertLog("系统配置", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -145,7 +151,7 @@ public class SystemConfigService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteSystemConfigByIds(String ids)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SYSTEM_CONFIG, + logService.insertLog("系统配置", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/tenant/TenantComponent.java b/src/main/java/com/jsh/erp/service/tenant/TenantComponent.java index 6e960838..fc000e5e 100644 --- a/src/main/java/com/jsh/erp/service/tenant/TenantComponent.java +++ b/src/main/java/com/jsh/erp/service/tenant/TenantComponent.java @@ -49,18 +49,18 @@ public class TenantComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return tenantService.updateTenant(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return tenantService.updateTenant(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return tenantService.deleteTenant(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return tenantService.deleteTenant(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return tenantService.batchDeleteTenant(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return tenantService.batchDeleteTenant(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/tenant/TenantService.java b/src/main/java/com/jsh/erp/service/tenant/TenantService.java index 1bc5c0c7..11f09af5 100644 --- a/src/main/java/com/jsh/erp/service/tenant/TenantService.java +++ b/src/main/java/com/jsh/erp/service/tenant/TenantService.java @@ -83,7 +83,7 @@ public class TenantService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateTenant(String beanJson, Long id)throws Exception { + public int updateTenant(String beanJson, Long id, HttpServletRequest request)throws Exception { Tenant tenant = JSONObject.parseObject(beanJson, Tenant.class); int result=0; try{ @@ -96,7 +96,7 @@ public class TenantService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteTenant(Long id)throws Exception { + public int deleteTenant(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result= tenantMapper.deleteByPrimaryKey(id); @@ -107,7 +107,7 @@ public class TenantService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteTenant(String ids)throws Exception { + public int batchDeleteTenant(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); TenantExample example = new TenantExample(); example.createCriteria().andIdIn(idList); diff --git a/src/main/java/com/jsh/erp/service/unit/UnitComponent.java b/src/main/java/com/jsh/erp/service/unit/UnitComponent.java index 5c62cdcd..2094b02c 100644 --- a/src/main/java/com/jsh/erp/service/unit/UnitComponent.java +++ b/src/main/java/com/jsh/erp/service/unit/UnitComponent.java @@ -48,18 +48,18 @@ public class UnitComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return unitService.updateUnit(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return unitService.updateUnit(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return unitService.deleteUnit(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return unitService.deleteUnit(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return unitService.batchDeleteUnit(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return unitService.batchDeleteUnit(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/unit/UnitService.java b/src/main/java/com/jsh/erp/service/unit/UnitService.java index f65bddc6..74ed75b1 100644 --- a/src/main/java/com/jsh/erp/service/unit/UnitService.java +++ b/src/main/java/com/jsh/erp/service/unit/UnitService.java @@ -89,6 +89,7 @@ public class UnitService { int result=0; try{ result=unitMapper.insertSelective(unit); + logService.insertLog("计量单位", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -96,12 +97,14 @@ public class UnitService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateUnit(String beanJson, Long id)throws Exception { + public int updateUnit(String beanJson, Long id, HttpServletRequest request)throws Exception { Unit unit = JSONObject.parseObject(beanJson, Unit.class); unit.setId(id); int result=0; try{ result=unitMapper.updateByPrimaryKeySelective(unit); + logService.insertLog("计量单位", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -109,10 +112,12 @@ public class UnitService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteUnit(Long id)throws Exception { + public int deleteUnit(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=unitMapper.deleteByPrimaryKey(id); + logService.insertLog("计量单位", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -120,13 +125,14 @@ public class UnitService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteUnit(String ids) throws Exception{ + public int batchDeleteUnit(String ids, HttpServletRequest request) throws Exception{ List idList = StringUtil.strToLongList(ids); UnitExample example = new UnitExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=unitMapper.deleteByExample(example); + logService.insertLog("计量单位", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -146,7 +152,7 @@ public class UnitService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteUnitByIds(String ids)throws Exception { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_UNIT, + logService.insertLog("计量单位", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); diff --git a/src/main/java/com/jsh/erp/service/user/UserComponent.java b/src/main/java/com/jsh/erp/service/user/UserComponent.java index eabdfa2a..da16d14e 100644 --- a/src/main/java/com/jsh/erp/service/user/UserComponent.java +++ b/src/main/java/com/jsh/erp/service/user/UserComponent.java @@ -50,18 +50,18 @@ public class UserComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return userService.updateUser(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return userService.updateUser(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return userService.deleteUser(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return userService.deleteUser(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return userService.batchDeleteUser(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return userService.batchDeleteUser(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/user/UserService.java b/src/main/java/com/jsh/erp/service/user/UserService.java index 100abaeb..27573681 100644 --- a/src/main/java/com/jsh/erp/service/user/UserService.java +++ b/src/main/java/com/jsh/erp/service/user/UserService.java @@ -120,6 +120,7 @@ public class UserService { int result=0; try{ result=userMapper.insertSelective(user); + logService.insertLog("用户", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -135,12 +136,14 @@ public class UserService { * @return int */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateUser(String beanJson, Long id) throws Exception{ + public int updateUser(String beanJson, Long id, HttpServletRequest request) throws Exception{ User user = JSONObject.parseObject(beanJson, User.class); user.setId(id); int result=0; try{ result=userMapper.updateByPrimaryKeySelective(user); + logService.insertLog("用户", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -156,7 +159,7 @@ public class UserService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int updateUserByObj(User user) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, + logService.insertLog("用户", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(user.getId()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); int result=0; @@ -178,7 +181,7 @@ public class UserService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int resetPwd(String md5Pwd, Long id) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, + logService.insertLog("用户", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User user = new User(); @@ -194,10 +197,12 @@ public class UserService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteUser(Long id)throws Exception { + public int deleteUser(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result= userMapper.deleteByPrimaryKey(id); + logService.insertLog("用户", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -205,13 +210,14 @@ public class UserService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteUser(String ids)throws Exception { + public int batchDeleteUser(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); UserExample example = new UserExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result= userMapper.deleteByExample(example); + logService.insertLog("用户", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -307,7 +313,7 @@ public class UserService { throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE, ExceptionConstants.USER_NAME_LIMIT_USE_MSG); } else { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, + logService.insertLog("用户", BusinessConstants.LOG_OPERATION_TYPE_ADD, ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //检查用户名和登录名 @@ -438,7 +444,7 @@ public class UserService { throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE, ExceptionConstants.USER_NAME_LIMIT_USE_MSG); } else { - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, + logService.insertLog("用户", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //检查用户名和登录名 @@ -586,7 +592,7 @@ public class UserService { * */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void batDeleteUser(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, + logService.insertLog("用户", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); String idsArray[]=ids.split(","); diff --git a/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessComponent.java b/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessComponent.java index 74b8e033..0b6ee16a 100644 --- a/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessComponent.java +++ b/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessComponent.java @@ -46,18 +46,18 @@ public class UserBusinessComponent implements ICommonQuery { } @Override - public int update(String beanJson, Long id)throws Exception { - return userBusinessService.updateUserBusiness(beanJson, id); + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return userBusinessService.updateUserBusiness(beanJson, id, request); } @Override - public int delete(Long id)throws Exception { - return userBusinessService.deleteUserBusiness(id); + public int delete(Long id, HttpServletRequest request)throws Exception { + return userBusinessService.deleteUserBusiness(id, request); } @Override - public int batchDelete(String ids)throws Exception { - return userBusinessService.batchDeleteUserBusiness(ids); + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return userBusinessService.batchDeleteUserBusiness(ids, request); } @Override diff --git a/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java b/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java index f5baa394..35247f16 100644 --- a/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java +++ b/src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java @@ -72,6 +72,7 @@ public class UserBusinessService { int result=0; try{ result=userBusinessMapper.insertSelective(userBusiness); + logService.insertLog("关联关系", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -79,12 +80,14 @@ public class UserBusinessService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int updateUserBusiness(String beanJson, Long id) throws Exception { + public int updateUserBusiness(String beanJson, Long id, HttpServletRequest request) throws Exception { UserBusiness userBusiness = JSONObject.parseObject(beanJson, UserBusiness.class); userBusiness.setId(id); int result=0; try{ result=userBusinessMapper.updateByPrimaryKeySelective(userBusiness); + logService.insertLog("关联关系", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -92,10 +95,12 @@ public class UserBusinessService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int deleteUserBusiness(Long id)throws Exception { + public int deleteUserBusiness(Long id, HttpServletRequest request)throws Exception { int result=0; try{ result=userBusinessMapper.deleteByPrimaryKey(id); + logService.insertLog("关联关系", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -103,13 +108,14 @@ public class UserBusinessService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) - public int batchDeleteUserBusiness(String ids)throws Exception { + public int batchDeleteUserBusiness(String ids, HttpServletRequest request)throws Exception { List idList = StringUtil.strToLongList(ids); UserBusinessExample example = new UserBusinessExample(); example.createCriteria().andIdIn(idList); int result=0; try{ result=userBusinessMapper.deleteByExample(example); + logService.insertLog("关联关系", "批量删除,id集:" + ids, request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -175,7 +181,7 @@ public class UserBusinessService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int updateBtnStr(Long userBusinessId, String btnStr) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS, + logService.insertLog("关联关系", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(userBusinessId).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); UserBusiness userBusiness = new UserBusiness(); @@ -220,7 +226,7 @@ public class UserBusinessService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteUserBusinessByIds(String ids) throws Exception{ - logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS, + logService.insertLog("关联关系", new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser();