framework/src/main/java/com/yuanchu/mom/service/impl/InformationNotificationServiceImpl.java
@@ -85,7 +85,8 @@ Map<String, Object> map = new HashMap<>(); map1 = getLook.selectPowerByMethodAndUserId("selectInsOrderParameter"); Long totalNumberOfMessages = baseMapper.selectCount(Wrappers.<InformationNotification>lambdaQuery() .eq(InformationNotification::getConsigneeId, map1.get("userId"))); .eq(InformationNotification::getConsigneeId, map1.get("userId")) .eq(InformationNotification::getViewStatus, false)); Long totalNumberOfReadMessages = baseMapper.selectCount(Wrappers.<InformationNotification>lambdaQuery() .eq(InformationNotification::getConsigneeId, map1.get("userId")) .eq(InformationNotification::getViewStatus, true)); @@ -93,8 +94,9 @@ LocalDate sevenDaysAgo = today.minusDays(7); Long totalNumberOfMessagesInThePastSevenDays = baseMapper.selectCount(Wrappers.<InformationNotification>lambdaQuery() .eq(InformationNotification::getConsigneeId, map1.get("userId")) .between(InformationNotification::getCreateTime, today, sevenDaysAgo)); .between(InformationNotification::getCreateTime, today.atStartOfDay(), sevenDaysAgo.atStartOfDay())); long remainingToDo = totalNumberOfMessages - totalNumberOfReadMessages; remainingToDo=remainingToDo<0?0:remainingToDo; map.put("totalNumberOfMessages", totalNumberOfMessages); map.put("remainingToDo", remainingToDo); map.put("totalNumberOfReadMessages", totalNumberOfReadMessages); inspect-server/src/main/java/com/yuanchu/mom/dto/InsOrderPlanDTO.java
@@ -29,4 +29,7 @@ @ApiModelProperty("委托编号") private String entrustCode; @ApiModelProperty("样品编号") private String sampleCode; } inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -414,9 +414,7 @@ orderState.setInsState(0); orderState.setNum(orderState.getNum() + 1);//递增 insOrderStateMapper.updateById(orderState); } /*else { throw new ErrorException("该订单站点的任务已创建,无法再次创建!"); }*/ } } else { InsOrderState insOrderState = new InsOrderState(); insOrderState.setInsOrderId(insSample.getInsOrderId()); @@ -1117,9 +1115,9 @@ info.setViewStatus(false); info.setJumpPath("b1-inspect-order-plan"); informationNotificationService.addInformationNotification(info); // todo 企业微信消息推送@zss // todo 企业微信消息推送@zss HashMap<String, Object> map = new HashMap<>(); String account = userMapper.selectById(userId).getAccount(); String account = userMapper.selectById(submitPlanDto.getVerifyUser()).getAccount(); map.put("touser", account);//接收消息成员的账号'ZT-031292'这种类型(如果有多个用'|'分隔) map.put("toparty", "");//接收部门id map.put("totag", "");//消息标签id inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java
@@ -21,6 +21,7 @@ import com.yuanchu.mom.exception.ErrorException; import com.yuanchu.mom.mapper.*; import com.yuanchu.mom.pojo.*; import com.yuanchu.mom.service.InformationNotificationService; import com.yuanchu.mom.service.InsOrderPlanService; import com.yuanchu.mom.service.InsOrderService; import com.yuanchu.mom.service.InsProductService; @@ -95,6 +96,9 @@ private InsOrderStateMapper insOrderStateMapper; @Resource UserMapper userMapper; @Resource InformationNotificationService informationNotificationService; @Resource PowerMapper powerMapper; @Resource @@ -246,10 +250,76 @@ } }); List<User> users1 = userMapper.getUserByRole("检测中心主任"); List<User> users2 = userMapper.getUserByRole("研发部经理"); List<User> users3 = userMapper.getUserByRole("技术负责人"); //通信:如果是C类订单无需审核直接通过 if (insOrder.getOrderType().equals("C")) { insOrder.setState(1); upInsOrderOfState(insOrder); }else if (insOrder.getOrderType().equals("A")){ //常规外部单需消息提醒检验中心主任和研发部经理 //todo 企业微信推送 users1.addAll(users2); String account = users1.stream().map(User::getAccount).collect(Collectors.joining("|")); HashMap<String, Object> map = new HashMap<>(); map.put("touser", account);//接收消息成员的账号'ZT-031292'这种类型(如果有多个用'|'分隔) map.put("msgtype", "text");//消息类型 text:文本 map.put("agentid", 1000517);//应用id HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("content", "您有一条检验订单需要审核,请前往LIMS系统查看。外部订单号是:"+insOrder.getOutEntrustCode()+",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); map.put("text", hashMap);//消息内容 map.put("safe", 0);//是否保密消息.0否 map.put("enable_id_trans", 0);//是否开启id转译.0否 map.put("enable_duplicate_check", 0);//是否开启重复消息检查.0否 qywxApi.send(map); //lims消息提醒 ArrayList<InformationNotification> notificationArrayList = new ArrayList<>(); for (User user : users1) { InformationNotification info = new InformationNotification(); info.setCreateUser(userMapper.selectById(userId).getName()); info.setMessageType("2"); info.setTheme("审核通知"); info.setContent("您有一条检验订单待审核消息,订单的外部编号是:"+insOrder.getOutEntrustCode()); info.setSenderId(userId); info.setViewStatus(false); info.setJumpPath("b1-inspect-order"); info.setConsigneeId(user.getId()); notificationArrayList.add(info); } informationNotificationService.saveBatch(notificationArrayList); }else if (insOrder.getOrderType().equals("B")){ //非常规外部单需消息提醒检验中心主任,研发部经理和技术负责人 //todo 企业微信推送 users1.addAll(users2); users1.addAll(users3); String account = users1.stream().map(User::getAccount).collect(Collectors.joining("|")); HashMap<String, Object> map = new HashMap<>(); map.put("touser", account);//接收消息成员的账号'ZT-031292'这种类型(如果有多个用'|'分隔) map.put("msgtype", "text");//消息类型 text:文本 map.put("agentid", 1000517);//应用id HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("content", "您有一条检验订单需要审核,请前往LIMS系统查看。外部订单号是:"+insOrder.getOutEntrustCode()+",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); map.put("text", hashMap);//消息内容 map.put("safe", 0);//是否保密消息.0否 map.put("enable_id_trans", 0);//是否开启id转译.0否 map.put("enable_duplicate_check", 0);//是否开启重复消息检查.0否 qywxApi.send(map); //lims消息提醒 ArrayList<InformationNotification> notificationArrayList = new ArrayList<>(); for (User user : users1) { InformationNotification info = new InformationNotification(); info.setCreateUser(userMapper.selectById(userId).getName()); info.setMessageType("2"); info.setTheme("审核通知"); info.setContent("您有一条检验订单待审核消息,订单的外部编号是:"+insOrder.getOutEntrustCode()); info.setSenderId(userId); info.setViewStatus(false); info.setJumpPath("b1-inspect-order"); info.setConsigneeId(user.getId()); notificationArrayList.add(info); } informationNotificationService.saveBatch(notificationArrayList); } //如果有上传的附件 if (CollectionUtils.isNotEmpty(files)) { @@ -295,12 +365,24 @@ map.put("msgtype", "text");//消息类型 text:文本 map.put("agentid", 1000517);//应用id HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("content", "您有一条订单需要完成,请前往LIMS系统查看。订单号是:"+insOrder.getEntrustCode()+",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); hashMap.put("content", "您有一条订单需要完成,请前往LIMS系统查看。外部订单号是:"+insOrder.getOutEntrustCode()+",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); map.put("text", hashMap);//消息内容 map.put("safe", 0);//是否保密消息.0否 map.put("enable_id_trans", 0);//是否开启id转译.0否 map.put("enable_duplicate_check", 0);//是否开启重复消息检查.0否 qywxApi.send(map); //LIMS系统消息推送 InformationNotification info = new InformationNotification(); info.setCreateUser(insProductMapper.selectUserById(userId).get("name")); info.setMessageType("1"); info.setTheme("样机员通知"); info.setContent("您有一条检验订单的样机待完成消息,外部订单号是:"+insOrder.getOutEntrustCode()+",请前往LIMS系统查看。"); info.setSenderId(userId); info.setConsigneeId(insOrder.getIssueUser()); info.setViewStatus(false); info.setJumpPath("b1-inspect-order"); informationNotificationService.addInformationNotification(info); } return insOrder.getId(); } inspect-server/src/main/java/com/yuanchu/mom/vo/InsOrderPlanTaskSwitchVo.java
@@ -14,6 +14,9 @@ @ValueTableShow(value = 2,name = "检验对象") private String sampleType; @ValueTableShow(value = 3,name = "样品编号") private String sampleCode; @ValueTableShow(value = 4,name = "紧急程度") private String type; inspect-server/src/main/java/com/yuanchu/mom/vo/InsOrderPlanVO.java
@@ -13,7 +13,10 @@ @ValueTableShow(value = 1,name = "委托编号",width = 180) private String entrustCode; @ValueTableShow(value = 2,name = "样品名称") @ValueTableShow(value = 2,name = "样品编号") private String sampleCode; @ValueTableShow(value = 3,name = "样品名称") private String sample; @ValueTableShow(value = 4,name = "紧急程度") inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -25,7 +25,8 @@ </resultMap> <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO"> select * from(select * from( select * from( select * from( SELECT a.*, ios.ins_state, @@ -48,6 +49,7 @@ io.appointed, io.send_time, group_concat(distinct isa.sample,' ') sample, group_concat(distinct isa.sample_code,' ') sampleCode, userName, checkName, ip.son_laboratory, @@ -114,6 +116,7 @@ io.appointed, io.send_time, group_concat(distinct isa.sample,' ') sampleType, group_concat(distinct isa.sample_code,' ') sampleCode, isu.user_id, user.name userName, ip.son_laboratory, user-server/src/main/java/com/yuanchu/mom/mapper/UserMapper.java
@@ -26,4 +26,8 @@ List<User> getUser(); String selectDepartLims(String prepareUser); //获取系统的某个角色的账号 List<User> getUserByRole(String name); } user-server/src/main/resources/mapper/UserMapper.xml
@@ -51,4 +51,9 @@ select name from department_lims where id= (select SUBSTRING_INDEX(SUBSTRING_INDEX(depart_lims_id, ',', -2), ',', 1) AS depart_lims_id from user where name=#{prepareUser}) </select> <select id="getUserByRole" resultType="com.yuanchu.mom.pojo.User"> select u.* from user u left join role r on u.role_id = r.id where r.name=#{name} </select> </mapper>