| | |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | |
| | | 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; |
| | | import com.yuanchu.mom.utils.GiveCode; |
| | | import com.yuanchu.mom.utils.QYWXApi; |
| | | import com.yuanchu.mom.utils.QueryWrappers; |
| | | import com.yuanchu.mom.vo.SampleDefectsFatherVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | |
| | | CustomMapper customMapper; |
| | | @Resource |
| | | QYWXApi qywxApi; |
| | | @Autowired |
| | | ProcessOrder1Mapper processOrderMapper; |
| | | |
| | | |
| | | //获取检验下单数据 |
| | |
| | | a.setInsOrderId(insOrder.getId()); |
| | | //样品编号 |
| | | if (StrUtil.isEmpty(a.getSampleCode())) { |
| | | a.setSampleCode("YP-" + a.getModel() + "-" + giveCode.split("-")[2] + "-" + count.get()); |
| | | a.setSampleCode("YP-" + giveCode.split("-")[2] + "-" + count.get()); |
| | | } |
| | | insSampleMapper.insert(a); |
| | | //样品的检验项目 |
| | |
| | | upInsOrderOfState(insOrder); |
| | | } else if (insOrder.getOrderType().equals("A")) { |
| | | //常规外部单需消息提醒检验中心主任和研发部经理 |
| | | //todo 企业微信推送 |
| | | //todo 下单审核企业微信推送 |
| | | users1.addAll(users2); |
| | | String account = users1.stream().map(User::getAccount).collect(Collectors.joining("|")); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | |
| | | 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>"); |
| | | hashMap.put("content", "您有一条检验订单需要审核,请前往LIMS系统查看。外部订单号是:" + insOrder.getOutEntrustCode() + |
| | | ",样品名称是:"+list.stream().map(SampleProductDto::getSample).collect(Collectors.joining(","))+ |
| | | ",请前往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否 |
| | |
| | | info.setCreateUser(userMapper.selectById(userId).getName()); |
| | | info.setMessageType("2"); |
| | | info.setTheme("审核通知"); |
| | | info.setContent("您有一条检验订单待审核消息,订单的外部编号是:" + insOrder.getOutEntrustCode()); |
| | | info.setContent("您有一条检验订单待审核消息,订单的外部编号是:" + insOrder.getOutEntrustCode()+",样品名称是:"+list.stream().map(SampleProductDto::getSample).collect(Collectors.joining(","))); |
| | | info.setSenderId(userId); |
| | | info.setViewStatus(false); |
| | | info.setJumpPath("b1-inspect-order"); |
| | | info.setJumpPath("b1-inspection-order"); |
| | | info.setConsigneeId(user.getId()); |
| | | notificationArrayList.add(info); |
| | | } |
| | | informationNotificationService.saveBatch(notificationArrayList); |
| | | } else if (insOrder.getOrderType().equals("B")) { |
| | | //非常规外部单需消息提醒检验中心主任,研发部经理和技术负责人 |
| | | //todo 企业微信推送 |
| | | //todo 下单审核企业微信推送 |
| | | users1.addAll(users2); |
| | | users1.addAll(users3); |
| | | String account = users1.stream().map(User::getAccount).collect(Collectors.joining("|")); |
| | |
| | | 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>"); |
| | | hashMap.put("content", "您有一条检验订单需要审核,请前往LIMS系统查看。外部订单号是:" + insOrder.getOutEntrustCode() + |
| | | ",样品名称是:"+list.stream().map(SampleProductDto::getSample).collect(Collectors.joining(",")) + |
| | | ",请前往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否 |
| | |
| | | info.setCreateUser(userMapper.selectById(userId).getName()); |
| | | info.setMessageType("2"); |
| | | info.setTheme("审核通知"); |
| | | info.setContent("您有一条检验订单待审核消息,订单的外部编号是:" + insOrder.getOutEntrustCode()); |
| | | info.setContent("您有一条检验订单待审核消息,订单的外部编号是:" + insOrder.getOutEntrustCode()+",样品名称是:"+list.stream().map(SampleProductDto::getSample).collect(Collectors.joining(","))); |
| | | info.setSenderId(userId); |
| | | info.setViewStatus(false); |
| | | info.setJumpPath("b1-inspect-order"); |
| | | info.setJumpPath("b1-inspection-order"); |
| | | info.setConsigneeId(user.getId()); |
| | | notificationArrayList.add(info); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | //todo 根据订单类型判断是否需要推送企业微信 @zss |
| | | //todo 样机员推送企业微信 @zss |
| | | if (!insOrder.getFormType().equals("其他成品")) { |
| | | String account = userMapper.selectById(insOrder.getIssueUser()).getAccount(); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | |
| | | 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>"); |
| | | hashMap.put("content", "您有一条订单需要完成,请前往LIMS系统查看。外部订单号是:" + insOrder.getOutEntrustCode() + |
| | | ",样品名称是:"+list.stream().map(SampleProductDto::getSample).collect(Collectors.joining(","))+ |
| | | ",请前往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否 |
| | |
| | | info.setCreateUser(insProductMapper.selectUserById(userId).get("name")); |
| | | info.setMessageType("1"); |
| | | info.setTheme("样机员通知"); |
| | | info.setContent("您有一条检验订单的样机待完成消息,外部订单号是:" + insOrder.getOutEntrustCode() + ",请前往LIMS系统查看。"); |
| | | info.setContent("您有一条检验订单的样机待完成消息,外部订单号是:" + insOrder.getOutEntrustCode() + ",样品名称是:"+list.stream().map(SampleProductDto::getSample).collect(Collectors.joining(","))); |
| | | info.setSenderId(userId); |
| | | info.setConsigneeId(insOrder.getIssueUser()); |
| | | info.setViewStatus(false); |
| | | info.setJumpPath("b1-inspect-order"); |
| | | info.setJumpPath("b1-inspection-order"); |
| | | informationNotificationService.addInformationNotification(info); |
| | | } |
| | | return insOrder.getId(); |
| | |
| | | //审核通过才会生成委托编号 |
| | | insOrder.setEntrustCode(giveCode.giveCode2("WT-", "ins_order", "-", "yyMMdd")); |
| | | insOrder.setSendTime(LocalDateTime.now()); |
| | | /*审核通过还需要新增一条cnas要求、标书和合同评审*/ |
| | | ProcessOrder processOrder = new ProcessOrder(); |
| | | processOrder.setInsOrderId(insOrder.getId()); |
| | | processOrder.setRule(insOrder.getRule()); |
| | | processOrderMapper.insert(processOrder); |
| | | } |
| | | return insOrderMapper.updateById(insOrder); |
| | | } |
| | |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId()).isNull(InsProductResult::getNum)); |
| | | insProduct.setInsProductResult(insProductResult); |
| | | } |
| | | BeanUtils.copyProperties(insSample,sampleProductDto); |
| | | sampleProductDto.setInsProduct(insProducts); |
| | | SampleProductDto dto = new SampleProductDto(); |
| | | dto.setInsProduct(insProducts); |
| | | BeanUtils.copyProperties(insSample,dto); |
| | | sampleProductDto=dto; |
| | | } |
| | | List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList()); |
| | | List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery() |