| | |
| | | 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; |
| | |
| | | private InsOrderStateMapper insOrderStateMapper; |
| | | @Resource |
| | | UserMapper userMapper; |
| | | |
| | | @Resource |
| | | InformationNotificationService informationNotificationService; |
| | | @Resource |
| | | PowerMapper powerMapper; |
| | | @Resource |
| | |
| | | } |
| | | |
| | | }); |
| | | 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)) { |
| | |
| | | System.err.println("附件上传错误"); |
| | | } |
| | | } |
| | | } |
| | | //todo 根据订单类型判断是否需要推送企业微信 @zss |
| | | if (!insOrder.getFormType().equals("其他成品")) { |
| | | String account = userMapper.selectById(insOrder.getIssueUser()).getAccount(); |
| | | 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系统消息推送 |
| | | 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(); |
| | | } |
| | |
| | | //审核通过才会生成委托编号 |
| | | insOrder.setEntrustCode(giveCode.giveCode2("WT-", "ins_order", "-", "yyMMdd")); |
| | | insOrder.setSendTime(LocalDateTime.now()); |
| | | //todo 根据订单类型判断是否需要推送企业微信 @zss |
| | | /* if (!order.getFormType().equals("其他成品")) { |
| | | String account = userMapper.selectById(order.getIssueUser()).getAccount(); |
| | | 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系统查看。订单号是:"+order.getEntrustCode()+",请前往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); |
| | | }*/ |
| | | } |
| | | return insOrderMapper.updateById(insOrder); |
| | | } |