From 7dc1cdaafca7e60f9a0737d8e265d2db175a86bf Mon Sep 17 00:00:00 2001 From: qiankunpingtai Date: Thu, 28 Mar 2019 15:23:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E4=BA=A7=E5=93=81=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=A1=A8=09jsh=5Fmaterialcategory=20=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8F=B7=E8=A1=A8=09jsh=5Fserial=5Fnumber=20=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=A1=A8=09jsh=5Fuser=20=E6=9C=BA=E6=9E=84=E8=A1=A8?= =?UTF-8?q?=09jsh=5Forganization=20=E6=9C=BA=E6=9E=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=85=B3=E7=B3=BB=E8=A1=A8=09jsh=5Forga=5Fuser=5Frel=20?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84=E5=88=A0=E9=99=A4=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erp_web/pages/manage/serialNumber.html | 7 +++- .../jsh/erp/constants/ExceptionConstants.java | 3 ++ .../jsh/erp/controller/RoleController.java | 1 + .../controller/SerialNumberController.java | 41 +++++++++++-------- .../mappers/SerialNumberMapperEx.java | 2 + .../serialNumber/SerialNumberService.java | 19 +++++++++ .../com/jsh/erp/service/user/UserService.java | 10 ++--- .../resources/mapper_xml/DepotMapperEx.xml | 2 +- src/main/resources/mapper_xml/LogMapperEx.xml | 4 +- .../mapper_xml/MaterialCategoryMapperEx.xml | 8 ++-- .../mapper_xml/OrganizationMapperEx.xml | 6 +-- .../mapper_xml/SerialNumberMapperEx.xml | 27 ++++++++++-- .../resources/mapper_xml/UserMapperEx.xml | 20 ++++----- 13 files changed, 102 insertions(+), 48 deletions(-) diff --git a/erp_web/pages/manage/serialNumber.html b/erp_web/pages/manage/serialNumber.html index caaca1fa..d6f903bb 100644 --- a/erp_web/pages/manage/serialNumber.html +++ b/erp_web/pages/manage/serialNumber.html @@ -314,8 +314,11 @@ if (r) { $.ajax({ type: "post", - url: "/serialNumber/" + id + "/delete", + url: "/serialNumber/batchDeleteSerialNumberByIds", dataType: "json", + data: ({ + ids: id + }), success: function (res) { if(res && res.code == 200) { $("#searchBtn").click(); @@ -353,7 +356,7 @@ } $.ajax({ type: "post", - url: "/serialNumber/batchDelete", + url: "/serialNumber/batchDeleteSerialNumberByIds", dataType: "json", async: false, data: ({ diff --git a/src/main/java/com/jsh/erp/constants/ExceptionConstants.java b/src/main/java/com/jsh/erp/constants/ExceptionConstants.java index 771a9e43..5fe743c9 100644 --- a/src/main/java/com/jsh/erp/constants/ExceptionConstants.java +++ b/src/main/java/com/jsh/erp/constants/ExceptionConstants.java @@ -101,6 +101,9 @@ public class ExceptionConstants { /**商品%s下序列号不充足,请补充后重试*/ public static final int MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE = 10500002; public static final String MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG = "商品:%s下序列号不充足,请补充后重试"; + /**删序列号信息失败*/ + public static final int SERIAL_NUMBERE_DELETE_FAILED_CODE = 10500003; + public static final String SERIAL_NUMBERE_DELETE_FAILED_MSG = "删序列号信息失败"; /** * 机构 * type = 110 diff --git a/src/main/java/com/jsh/erp/controller/RoleController.java b/src/main/java/com/jsh/erp/controller/RoleController.java index b204e995..0c4c04c5 100644 --- a/src/main/java/com/jsh/erp/controller/RoleController.java +++ b/src/main/java/com/jsh/erp/controller/RoleController.java @@ -76,4 +76,5 @@ public class RoleController { public List list(HttpServletRequest request) { return roleService.getRole(); } + } diff --git a/src/main/java/com/jsh/erp/controller/SerialNumberController.java b/src/main/java/com/jsh/erp/controller/SerialNumberController.java index f47a6210..01776cbb 100644 --- a/src/main/java/com/jsh/erp/controller/SerialNumberController.java +++ b/src/main/java/com/jsh/erp/controller/SerialNumberController.java @@ -5,14 +5,12 @@ import com.alibaba.fastjson.JSONObject; import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.datasource.entities.SerialNumberEx; import com.jsh.erp.exception.BusinessParamCheckingException; +import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.service.serialNumber.SerialNumberService; import com.jsh.erp.utils.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -109,19 +107,26 @@ public class SerialNumberController { return result; } - - - - - - - - - - - - - - + /** + * create by: qiankunpingtai + * website:http://39.105.146.63/symphony/ + * description: + * 逻辑删除序列号信息 + * create time: 2019/3/27 17:43 + * @Param: ids + * @return java.lang.Object + */ + @RequestMapping(value = "/serialNumber/batchDeleteSerialNumberByIds") + public Object batchDeleteSerialNumberByIds(@RequestParam("ids") String ids) throws Exception { + JSONObject result = ExceptionConstants.standardSuccess(); + int i= serialNumberService.batchDeleteSerialNumberByIds(ids); + if(i<1){ + logger.error("异常码[{}],异常提示[{}],参数,ids[{}]", + ExceptionConstants.SERIAL_NUMBERE_DELETE_FAILED_CODE,ExceptionConstants.SERIAL_NUMBERE_DELETE_FAILED_MSG,ids); + throw new BusinessRunTimeException(ExceptionConstants.SERIAL_NUMBERE_DELETE_FAILED_CODE, + ExceptionConstants.SERIAL_NUMBERE_DELETE_FAILED_MSG); + } + return result; + } } diff --git a/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java b/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java index 7bd5906d..d934ec7c 100644 --- a/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java +++ b/src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java @@ -60,4 +60,6 @@ public interface SerialNumberMapperEx { * 批量添加序列号 * */ int batAddSerialNumber(@Param("list") List list); + + int batchDeleteSerialNumberByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]); } 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 7f1f450d..12b61615 100644 --- a/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java +++ b/src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java @@ -391,4 +391,23 @@ public class SerialNumberService { }while(batAddTotal>0); } } + /** + * create by: qiankunpingtai + * website:http://39.105.146.63/symphony/ + * description: + * 逻辑删除序列号信息 + * create time: 2019/3/27 17:43 + * @Param: ids + * @return + */ + @Transactional(value = "transactionManager", rollbackFor = Exception.class) + public int batchDeleteSerialNumberByIds(String ids) { + logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, + new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), + ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); + User userInfo=userService.getCurrentUser(); + String [] idArray=ids.split(","); + return serialNumberMapperEx.batchDeleteSerialNumberByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); + + } } 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 e9289dd7..7e99aa3f 100644 --- a/src/main/java/com/jsh/erp/service/user/UserService.java +++ b/src/main/java/com/jsh/erp/service/user/UserService.java @@ -112,7 +112,7 @@ public class UserService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int updateUserByObj(User user) { - logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER, + logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(user.getId()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); return userMapper.updateByPrimaryKeySelective(user); @@ -128,7 +128,7 @@ public class UserService { */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int resetPwd(String md5Pwd, Long id) { - logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER, + logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User user = new User(); @@ -217,7 +217,7 @@ public class UserService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void addUserAndOrgUserRel(UserEx ue) throws Exception{ - logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER, + logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, BusinessConstants.LOG_OPERATION_TYPE_ADD, ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //检查用户名和登录名 @@ -274,7 +274,7 @@ public class UserService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void updateUserAndOrgUserRel(UserEx ue) throws Exception{ - logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER, + logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); //检查用户名和登录名 @@ -405,7 +405,7 @@ public class UserService { * */ @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void batDeleteUser(String ids) { - logService.insertLog(BusinessConstants.LOG_MODULE_NAME_USER, + logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); String idsArray[]=ids.split(","); diff --git a/src/main/resources/mapper_xml/DepotMapperEx.xml b/src/main/resources/mapper_xml/DepotMapperEx.xml index 05b20962..66c77665 100644 --- a/src/main/resources/mapper_xml/DepotMapperEx.xml +++ b/src/main/resources/mapper_xml/DepotMapperEx.xml @@ -41,7 +41,7 @@ select l.*,u.username userName - FROM jsh_log l left join jsh_user u - on l.userID = u.id + FROM jsh_log l + left join jsh_user u on l.userID = u.id and ifnull(u.status,'0') not in('1','2') where 1=1 and l.operation like '%${operation}%' diff --git a/src/main/resources/mapper_xml/MaterialCategoryMapperEx.xml b/src/main/resources/mapper_xml/MaterialCategoryMapperEx.xml index dc32af67..bd73eaba 100644 --- a/src/main/resources/mapper_xml/MaterialCategoryMapperEx.xml +++ b/src/main/resources/mapper_xml/MaterialCategoryMapperEx.xml @@ -5,6 +5,7 @@ select * FROM jsh_materialcategory where 1=1 + and ifnull(status,'0') !='2' and name like '%${name}%' @@ -21,6 +22,7 @@ COUNT(id) FROM jsh_materialcategory WHERE 1=1 + and ifnull(status,'0') !='2' and name like '%${name}%' @@ -56,7 +58,7 @@ and id !=#{currentId} - and status !='2' + and ifnull(status,'0') !='2' order by sort asc @@ -65,7 +67,7 @@ ,#{currentId} as currentId FROM jsh_materialcategory WHERE ParentId = -1 - and status !='2' + and ifnull(status,'0') !='2' and id !=#{currentId} @@ -103,7 +105,7 @@ FROM jsh_materialcategory where 1=1 and serial_no=#{serialNo} - and status !='2' + and ifnull(status,'0') !='2' \ No newline at end of file diff --git a/src/main/resources/mapper_xml/OrganizationMapperEx.xml b/src/main/resources/mapper_xml/OrganizationMapperEx.xml index 10e1b744..bdf80d7b 100644 --- a/src/main/resources/mapper_xml/OrganizationMapperEx.xml +++ b/src/main/resources/mapper_xml/OrganizationMapperEx.xml @@ -30,7 +30,7 @@ and id !=#{currentId} - and org_stcd !='5' + and ifnull(org_stcd,'0') !='5' order by sort asc @@ -42,7 +42,7 @@ and id !=#{currentId} - and org_stcd !='5' + and ifnull(org_stcd,'0') !='5' order by sort asc and mat.name like #{materialName} + and ifnull(ser.delete_Flag,'0') !='1' order by ser.id desc limit #{offset},#{rows} @@ -45,6 +46,7 @@ and mat.name like #{materialName} + and ifnull(ser.delete_Flag,'0') !='1' order by ser.id desc and ser.material_Id=#{materialId} - and ser.delete_Flag !='1' + and ifnull(ser.delete_Flag,'0') !='1' and ser.is_Sell !='1' update jsh_serial_number @@ -156,6 +160,7 @@ and material_Id = #{materialId} and is_Sell != '1' + and ifnull(delete_Flag,'0') !='1' and id in ( select batchSN.id from @@ -165,6 +170,7 @@ and selFrom.material_Id = #{materialId} and selFrom.is_Sell != '1' + and ifnull(selFrom.delete_Flag,'0') !='1' limit 0,#{count} ) batchSN ) @@ -190,6 +196,7 @@ and depothead_Id = #{depotheadId,jdbcType=BIGINT} and is_Sell != '0' + and ifnull(delete_Flag,'0') !='1' and id in ( select batchSN.id from @@ -202,6 +209,7 @@ and selFrom.depothead_Id = #{depotheadId,jdbcType=BIGINT} and selFrom.is_Sell !='0' + and ifnull(selFrom.delete_Flag,'0') !='1' limit 0,#{count} ) batchSN ) @@ -219,6 +227,17 @@ ) + + update jsh_serial_number + set update_Time=#{updateTime},updater=#{updater},delete_Flag='1' + where 1=1 + and ifnull(delete_Flag,'0') !='1' + and id in ( + + #{id} + + ) + diff --git a/src/main/resources/mapper_xml/UserMapperEx.xml b/src/main/resources/mapper_xml/UserMapperEx.xml index 6e39ff49..f34247ec 100644 --- a/src/main/resources/mapper_xml/UserMapperEx.xml +++ b/src/main/resources/mapper_xml/UserMapperEx.xml @@ -11,7 +11,7 @@ select * FROM jsh_user where 1=1 - and status not in('1','2') + and ifnull(status,'0') not in('1','2') and username like '%${userName}%' @@ -27,7 +27,7 @@ COUNT(id) FROM jsh_user WHERE 1=1 - and status not in('1','2') + and ifnull(status,'0') not in('1','2') and username like '%${userName}%' @@ -40,10 +40,10 @@ user.description, user.remark,user.isystem,org.id as orgaId,org.org_abr,rel.user_blng_orga_dspl_seq, rel.id as orgaUserRelId FROM jsh_user user - left join jsh_orga_user_rel rel on user.id=rel.user_id and rel.delete_flag!='1' - left join jsh_organization org on rel.orga_id=org.id + left join jsh_orga_user_rel rel on user.id=rel.user_id and ifnull(rel.delete_flag,'0') !='1' + left join jsh_organization org on rel.orga_id=org.id and ifnull(org.org_stcd,'0') !='5' where 1=1 - and user.status not in('1','2') + and ifnull(user.status,'0') not in('1','2') and user.userName like #{userName} @@ -114,7 +114,7 @@ user.description, user.remark,user.isystem FROM jsh_user user where 1=1 - and user.status not in('1','2') + and ifnull(user.status,'0') not in('1','2') and user.userName = #{userName} @@ -161,7 +161,7 @@ org.id, org.org_abr as text,org.org_no as orgNo,org.sort as sort,null as iconCls,'0' as type FROM jsh_organization org WHERE org.org_parent_no = #{orgNo} - and org.org_stcd !='5' + and ifnull(org.org_stcd,'0') !='5' union all select user.id,user.username as text, null as orgNo,rel.user_blng_orga_dspl_seq as sort,'icon-user' as iconCls,'1' as type @@ -170,8 +170,8 @@ 1=1 and user.id=rel.user_id and rel.orga_id=#{orgId} - and rel.delete_flag !='1' - and user.status not in ('1','2') + and ifnull(rel.delete_flag,'0') !='1' + and ifnull(user.status,'0') not in('1','2') ) node order by sort asc @@ -181,7 +181,7 @@ id, org_abr as text,org_no as orgNo,'0' as type FROM jsh_organization WHERE org_parent_no = -1 - and org_stcd !='5' + and ifnull(org_stcd,'0') !='5' order by sort asc \ No newline at end of file