From 76f3ac76d7cb9c88ddc8bdc7643e829f741b4261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Fri, 17 Dec 2021 00:09:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E6=AD=A2=E8=B6=85=E7=AE=A1=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jsh/erp/service/msg/MsgService.java | 64 +++++++++++-------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgService.java index fa763707..815dffd4 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/msg/MsgService.java @@ -80,11 +80,14 @@ public class MsgService { public List select(String name, int offset, int rows)throws Exception { List list=null; try{ - list = msgMapperEx.selectByConditionMsg(name, offset, rows); - if (null != list) { - for (MsgEx msgEx : list) { - if(msgEx.getCreateTime() != null) { - msgEx.setCreateTimeStr(getCenternTime(msgEx.getCreateTime())); + User userInfo = userService.getCurrentUser(); + if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) { + list = msgMapperEx.selectByConditionMsg(name, offset, rows); + if (null != list) { + for (MsgEx msgEx : list) { + if (msgEx.getCreateTime() != null) { + msgEx.setCreateTimeStr(getCenternTime(msgEx.getCreateTime())); + } } } } @@ -100,7 +103,10 @@ public class MsgService { public Long countMsg(String name)throws Exception { Long result=null; try{ - result=msgMapperEx.countsByMsg(name); + User userInfo = userService.getCurrentUser(); + if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) { + result = msgMapperEx.countsByMsg(name); + } }catch(Exception e){ logger.error("异常码[{}],异常提示[{}],异常[{}]", ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e); @@ -226,20 +232,23 @@ public class MsgService { public List getMsgByStatus(String status)throws Exception { List resList=new ArrayList<>(); try{ - MsgExample example = new MsgExample(); - example.createCriteria().andStatusEqualTo(status).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); - List list = msgMapper.selectByExample(example); - if (null != list) { - for (Msg msg : list) { - if(msg.getCreateTime() != null) { - MsgEx msgEx = new MsgEx(); - msgEx.setId(msg.getId()); - msgEx.setMsgTitle(msg.getMsgTitle()); - msgEx.setMsgContent(msg.getMsgContent()); - msgEx.setStatus(msg.getStatus()); - msgEx.setType(msg.getType()); - msgEx.setCreateTimeStr(Tools.parseDateToStr(msg.getCreateTime())); - resList.add(msgEx); + User userInfo = userService.getCurrentUser(); + if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) { + MsgExample example = new MsgExample(); + example.createCriteria().andStatusEqualTo(status).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); + List list = msgMapper.selectByExample(example); + if (null != list) { + for (Msg msg : list) { + if (msg.getCreateTime() != null) { + MsgEx msgEx = new MsgEx(); + msgEx.setId(msg.getId()); + msgEx.setMsgTitle(msg.getMsgTitle()); + msgEx.setMsgContent(msg.getMsgContent()); + msgEx.setStatus(msg.getStatus()); + msgEx.setType(msg.getType()); + msgEx.setCreateTimeStr(Tools.parseDateToStr(msg.getCreateTime())); + resList.add(msgEx); + } } } } @@ -273,7 +282,9 @@ public class MsgService { Long result=null; try{ User userInfo=userService.getCurrentUser(); - result=msgMapperEx.getMsgCountByStatus(status, userInfo.getId()); + if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) { + result = msgMapperEx.getMsgCountByStatus(status, userInfo.getId()); + } }catch(Exception e){ logger.error("异常码[{}],异常提示[{}],异常[{}]", ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e); @@ -286,10 +297,13 @@ public class MsgService { public Integer getMsgCountByType(String type)throws Exception { int msgCount = 0; try{ - MsgExample example = new MsgExample(); - example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); - List list = msgMapper.selectByExample(example); - msgCount = list.size(); + User userInfo = userService.getCurrentUser(); + if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) { + MsgExample example = new MsgExample(); + example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); + List list = msgMapper.selectByExample(example); + msgCount = list.size(); + } }catch(Exception e){ logger.error("异常码[{}],异常提示[{}],异常[{}]", ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);