From 753c865deb50386237617514ee80acc88db1f9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Wed, 10 Jun 2020 00:34:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=A0=E9=99=A4=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsh/erp/controller/AccountController.java | 10 ------- .../MaterialExtend/MaterialExtendService.java | 5 ---- .../erp/service/account/AccountService.java | 22 ++++++++++++-- .../accountHead/AccountHeadService.java | 22 ++++++++++++-- .../jsh/erp/service/depot/DepotService.java | 23 ++++++++++++-- .../service/depotHead/DepotHeadService.java | 7 ----- .../service/depotItem/DepotItemService.java | 12 -------- .../service/functions/FunctionsService.java | 30 +++++++++++++++---- .../service/inOutItem/InOutItemService.java | 23 ++++++++++++-- .../erp/service/material/MaterialService.java | 22 ++++++++++++-- .../MaterialCategoryService.java | 27 +++++++++++++---- .../organization/OrganizationService.java | 27 ++++++++++++++--- .../jsh/erp/service/person/PersonService.java | 23 ++++++++++++-- .../com/jsh/erp/service/role/RoleService.java | 23 ++++++++++++-- .../serialNumber/SerialNumberService.java | 22 ++++++++++++-- .../erp/service/supplier/SupplierService.java | 22 ++++++++++++-- .../com/jsh/erp/service/unit/UnitService.java | 23 ++++++++++++-- .../com/jsh/erp/service/user/UserService.java | 22 ++++++++++++-- 18 files changed, 295 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/jsh/erp/controller/AccountController.java b/src/main/java/com/jsh/erp/controller/AccountController.java index 54485a3b..a3f6e65a 100644 --- a/src/main/java/com/jsh/erp/controller/AccountController.java +++ b/src/main/java/com/jsh/erp/controller/AccountController.java @@ -143,9 +143,6 @@ public class AccountController { } } /** - * create by: qiankunpingtai - * website:https://qiankunpingtai.cn - * description: * 批量删除账户信息 * create time: 2019/3/29 10:49 * @Param: ids @@ -156,13 +153,6 @@ public class AccountController { required =false,defaultValue=BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception { JSONObject result = ExceptionConstants.standardSuccess(); - /** - * create by: qiankunpingtai - * create time: 2019/4/10 10:19 - * website:https://qiankunpingtai.cn - * description: - * 出于兼容性考虑,没有传递删除类型时,默认为正常删除 - */ int i=0; if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){ i= accountService.batchDeleteAccountByIdsNormal(ids); diff --git a/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendService.java b/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendService.java index f6078fa4..67d2f143 100644 --- a/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendService.java +++ b/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendService.java @@ -77,8 +77,6 @@ public class MaterialExtendService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public String saveDetials(String inserted, String deleted, String updated, String sortList, Long materialId) throws Exception { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - logService.insertLog("商品价格扩展", - BusinessConstants.LOG_OPERATION_TYPE_ADD, request); //转为json JSONArray insertedJson = JSONArray.parseArray(inserted); JSONArray deletedJson = JSONArray.parseArray(deleted); @@ -249,9 +247,6 @@ public class MaterialExtendService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteMaterialExtendByIds(String ids, HttpServletRequest request) throws Exception{ - logService.insertLog("商品价格扩展", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), - ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); String [] idArray=ids.split(","); int result = 0; try{ 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 27cbad9f..40508367 100644 --- a/src/main/java/com/jsh/erp/service/account/AccountService.java +++ b/src/main/java/com/jsh/erp/service/account/AccountService.java @@ -61,6 +61,19 @@ public class AccountService { return accountMapper.selectByPrimaryKey(id); } + public List getAccountListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + AccountExample example = new AccountExample(); + example.createCriteria().andIdIn(idList); + list = accountMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getAccount() throws Exception{ AccountExample example = new AccountExample(); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); @@ -442,8 +455,13 @@ public class AccountService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteAccountByIds(String ids) throws Exception{ - logService.insertLog("账户", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getAccountListByIds(ids); + for(Account account: list){ + sb.append("[").append(account.getName()).append("]"); + } + logService.insertLog("账户", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 bb3cab9b..0ebd4ed0 100644 --- a/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java +++ b/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java @@ -55,6 +55,19 @@ public class AccountHeadService { return result; } + public List getAccountHeadListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + AccountHeadExample example = new AccountHeadExample(); + example.createCriteria().andIdIn(idList); + list = accountHeadMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getAccountHead() throws Exception{ AccountHeadExample example = new AccountHeadExample(); List list=null; @@ -268,8 +281,13 @@ public class AccountHeadService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteAccountHeadByIds(String ids)throws Exception { - logService.insertLog("财务", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getAccountHeadListByIds(ids); + for(AccountHead accountHead: list){ + sb.append("[").append(accountHead.getBillno()).append("]"); + } + logService.insertLog("财务", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 5a1955c3..6a526d80 100644 --- a/src/main/java/com/jsh/erp/service/depot/DepotService.java +++ b/src/main/java/com/jsh/erp/service/depot/DepotService.java @@ -20,6 +20,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -52,6 +53,19 @@ public class DepotService { return result; } + public List getDepotListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + DepotExample example = new DepotExample(); + example.createCriteria().andIdIn(idList); + list = depotMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getDepot()throws Exception { DepotExample example = new DepotExample(); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); @@ -195,8 +209,13 @@ public class DepotService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteDepotByIds(String ids)throws Exception { - logService.insertLog("仓库", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getDepotListByIds(ids); + for(Depot depot: list){ + sb.append("[").append(depot.getName()).append("]"); + } + logService.insertLog("仓库", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 f65bbba7..40f70f32 100644 --- a/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java +++ b/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java @@ -60,7 +60,6 @@ public class DepotHeadService { @Resource private LogService logService; - public DepotHead getDepotHead(long id)throws Exception { DepotHead result=null; try{ @@ -590,9 +589,6 @@ public class DepotHeadService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void batchDeleteDepotHeadAndDetail(String ids) throws Exception{ - logService.insertLog("单据", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), - ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); if(StringUtil.isNotEmpty(ids)){ String [] headIds=ids.split(","); for(int i=0;i getFunctionsListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + FunctionsExample example = new FunctionsExample(); + example.createCriteria().andIdIn(idList); + list = functionsMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getFunctions()throws Exception { FunctionsExample example = new FunctionsExample(); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); @@ -84,11 +98,12 @@ public class FunctionsService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int insertFunctions(String beanJson, HttpServletRequest request)throws Exception { - Functions depot = JSONObject.parseObject(beanJson, Functions.class); + Functions functions = JSONObject.parseObject(beanJson, Functions.class); int result=0; try{ - result=functionsMapper.insertSelective(depot); - logService.insertLog("功能", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); + result=functionsMapper.insertSelective(functions); + logService.insertLog("功能", + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(functions.getName()).toString(),request); }catch(Exception e){ JshException.writeFail(logger, e); } @@ -195,8 +210,13 @@ public class FunctionsService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteFunctionsByIds(String ids)throws Exception { - logService.insertLog("功能", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getFunctionsListByIds(ids); + for(Functions functions: list){ + sb.append("[").append(functions.getName()).append("]"); + } + logService.insertLog("功能", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 cedbd86c..d46b8b77 100644 --- a/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java +++ b/src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java @@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -51,6 +52,19 @@ public class InOutItemService { return result; } + public List getInOutItemListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + InOutItemExample example = new InOutItemExample(); + example.createCriteria().andIdIn(idList); + list = inOutItemMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getInOutItem()throws Exception { InOutItemExample example = new InOutItemExample(); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); @@ -171,8 +185,13 @@ public class InOutItemService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteInOutItemByIds(String ids)throws Exception { - logService.insertLog("收支项目", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getInOutItemListByIds(ids); + for(InOutItem inOutItem: list){ + sb.append("[").append(inOutItem.getName()).append("]"); + } + logService.insertLog("收支项目", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 757ee686..722d6f7b 100644 --- a/src/main/java/com/jsh/erp/service/material/MaterialService.java +++ b/src/main/java/com/jsh/erp/service/material/MaterialService.java @@ -75,6 +75,19 @@ public class MaterialService { return result; } + public List getMaterialListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + MaterialExample example = new MaterialExample(); + example.createCriteria().andIdIn(idList); + list = materialMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getMaterial() throws Exception{ MaterialExample example = new MaterialExample(); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); @@ -592,8 +605,13 @@ public class MaterialService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteMaterialByIds(String ids) throws Exception{ - logService.insertLog("商品", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getMaterialListByIds(ids); + for(Material material: list){ + sb.append("[").append(material.getName()).append("]"); + } + logService.insertLog("商品", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 17d4b33a..8e48ae62 100644 --- a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java +++ b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java @@ -52,6 +52,19 @@ public class MaterialCategoryService { return result; } + public List getMaterialCategoryListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + MaterialCategoryExample example = new MaterialCategoryExample(); + example.createCriteria().andIdIn(idList); + list = materialCategoryMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getMaterialCategory()throws Exception { MaterialCategoryExample example = new MaterialCategoryExample(); List list=null; @@ -212,7 +225,7 @@ public class MaterialCategoryService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int addMaterialCategory(MaterialCategory mc) throws Exception { logService.insertLog("商品类型", - BusinessConstants.LOG_OPERATION_TYPE_ADD, + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(mc.getName()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); if(mc==null){ return 0; @@ -245,8 +258,13 @@ public class MaterialCategoryService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteMaterialCategoryByIds(String ids) throws Exception { - logService.insertLog("商品类型", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getMaterialCategoryListByIds(ids); + for(MaterialCategory materialCategory: list){ + sb.append("[").append(materialCategory.getName()).append("]"); + } + logService.insertLog("商品类型", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //更新时间 Date updateDate =new Date(); @@ -268,13 +286,12 @@ public class MaterialCategoryService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int editMaterialCategory(MaterialCategory mc) throws Exception{ logService.insertLog("商品类型", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getId()).toString(), + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getName()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); if(mc.getParentid()==null){ //没有给定父级目录的id,默认设置父级目录为根目录的父目录 mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID); } - //检查商品类型编号是否已存在 checkMaterialCategorySerialNo(mc); //更新时间 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 7960ea8b..5452240f 100644 --- a/src/main/java/com/jsh/erp/service/organization/OrganizationService.java +++ b/src/main/java/com/jsh/erp/service/organization/OrganizationService.java @@ -24,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -50,6 +51,19 @@ public class OrganizationService { return organizationMapper.selectByPrimaryKey(id); } + public List getOrganizationListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + OrganizationExample example = new OrganizationExample(); + example.createCriteria().andIdIn(idList); + list = organizationMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int insertOrganization(String beanJson, HttpServletRequest request)throws Exception { Organization organization = JSONObject.parseObject(beanJson, Organization.class); @@ -106,7 +120,7 @@ public class OrganizationService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int addOrganization(Organization org) throws Exception{ logService.insertLog("机构", - BusinessConstants.LOG_OPERATION_TYPE_ADD, + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(org.getOrgFullName()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //新增时间 Date date=new Date(); @@ -141,7 +155,7 @@ public class OrganizationService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int editOrganization(Organization org)throws Exception { logService.insertLog("机构", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(org.getId()).toString(), + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(org.getOrgFullName()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //修改时间 org.setUpdateTime(new Date()); @@ -240,8 +254,13 @@ public class OrganizationService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteOrganizationByIds(String ids) throws Exception{ - logService.insertLog("机构", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getOrganizationListByIds(ids); + for(Organization organization: list){ + sb.append("[").append(organization.getOrgFullName()).append("]"); + } + logService.insertLog("机构", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 86885c1f..48f24a45 100644 --- a/src/main/java/com/jsh/erp/service/person/PersonService.java +++ b/src/main/java/com/jsh/erp/service/person/PersonService.java @@ -23,6 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -54,6 +55,19 @@ public class PersonService { return result; } + public List getPersonListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + PersonExample example = new PersonExample(); + example.createCriteria().andIdIn(idList); + list = personMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getPerson()throws Exception { PersonExample example = new PersonExample(); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); @@ -190,8 +204,13 @@ public class PersonService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeletePersonByIds(String ids)throws Exception { - logService.insertLog("经手人", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getPersonListByIds(ids); + for(Person person: list){ + sb.append("[").append(person.getName()).append("]"); + } + logService.insertLog("经手人", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 9db275de..29b961da 100644 --- a/src/main/java/com/jsh/erp/service/role/RoleService.java +++ b/src/main/java/com/jsh/erp/service/role/RoleService.java @@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -48,6 +49,19 @@ public class RoleService { return result; } + public List getRoleListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + RoleExample example = new RoleExample(); + example.createCriteria().andIdIn(idList); + list = roleMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getRole()throws Exception { RoleExample example = new RoleExample(); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); @@ -172,8 +186,13 @@ public class RoleService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteRoleByIds(String ids) throws Exception{ - logService.insertLog("序列号", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getRoleListByIds(ids); + for(Role role: list){ + sb.append("[").append(role.getName()).append("]"); + } + logService.insertLog("角色", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 5f1be031..09051042 100644 --- a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java +++ b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java @@ -59,6 +59,19 @@ public class SerialNumberService { return result; } + public List getSerialNumberListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + SerialNumberExample example = new SerialNumberExample(); + example.createCriteria().andIdIn(idList); + list = serialNumberMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getSerialNumber()throws Exception { SerialNumberExample example = new SerialNumberExample(); List list=null; @@ -511,8 +524,13 @@ public class SerialNumberService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteSerialNumberByIds(String ids) throws Exception{ - logService.insertLog("序列号", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getSerialNumberListByIds(ids); + for(SerialNumber serialNumber: list){ + sb.append("[").append(serialNumber.getSerialNumber()).append("]"); + } + logService.insertLog("序列号", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 a7cc5407..29366a47 100644 --- a/src/main/java/com/jsh/erp/service/supplier/SupplierService.java +++ b/src/main/java/com/jsh/erp/service/supplier/SupplierService.java @@ -63,6 +63,19 @@ public class SupplierService { return result; } + public List getSupplierListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + SupplierExample example = new SupplierExample(); + example.createCriteria().andIdIn(idList); + list = supplierMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getSupplier()throws Exception { SupplierExample example = new SupplierExample(); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); @@ -346,8 +359,13 @@ public class SupplierService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteSupplierByIds(String ids)throws Exception { - logService.insertLog("商家", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getSupplierListByIds(ids); + for(Supplier supplier: list){ + sb.append("[").append(supplier.getSupplier()).append("]"); + } + logService.insertLog("商家", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 1c72e4ae..866b0441 100644 --- a/src/main/java/com/jsh/erp/service/unit/UnitService.java +++ b/src/main/java/com/jsh/erp/service/unit/UnitService.java @@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -51,6 +52,19 @@ public class UnitService { return result; } + public List getUnitListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + UnitExample example = new UnitExample(); + example.createCriteria().andIdIn(idList); + list = unitMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getUnit()throws Exception { UnitExample example = new UnitExample(); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); @@ -153,8 +167,13 @@ public class UnitService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteUnitByIds(String ids)throws Exception { - logService.insertLog("计量单位", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getUnitListByIds(ids); + for(Unit unit: list){ + sb.append("[").append(unit.getUname()).append("]"); + } + logService.insertLog("计量单位", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); 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 1f5be1b5..6d781885 100644 --- a/src/main/java/com/jsh/erp/service/user/UserService.java +++ b/src/main/java/com/jsh/erp/service/user/UserService.java @@ -66,6 +66,19 @@ public class UserService { return result; } + public List getUserListByIds(String ids)throws Exception { + List idList = StringUtil.strToLongList(ids); + List list = new ArrayList<>(); + try{ + UserExample example = new UserExample(); + example.createCriteria().andIdIn(idList); + list = userMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + public List getUser()throws Exception { UserExample example = new UserExample(); example.createCriteria().andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL); @@ -605,8 +618,13 @@ public class UserService { * */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void batDeleteUser(String ids) throws Exception{ - logService.insertLog("用户", - new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List list = getUserListByIds(ids); + for(User user: list){ + sb.append("[").append(user.getLoginName()).append("]"); + } + logService.insertLog("用户", sb.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); String idsArray[]=ids.split(","); int result =0;