| | |
| | | @Resource |
| | | private InsSampleMapper insSampleMapper; |
| | | @Resource |
| | | InsProductResult2Mapper insProductResult2Mapper; |
| | | @Resource |
| | | InsProductResultMapper insProductResultMapper; |
| | | @Resource |
| | | private WarehouseHistoryMapper warehouseHistoryMapper; |
| | | @Resource |
| | | private InsProductMapper insProductMapper; |
| | |
| | | } |
| | | //如果有上传的附件 |
| | | if (CollectionUtils.isNotEmpty(files)) { |
| | | for (MultipartFile file : files ) { |
| | | for (MultipartFile file : files) { |
| | | String urlString; |
| | | String pathName; |
| | | String path; |
| | |
| | | if (insOrder.getState() == 1) { |
| | | //审核通过才会生成委托编号 |
| | | insOrder.setEntrustCode(giveCode.giveCode2("WT-", "ins_order", "-", "yyMMdd")); |
| | | //确定订单的下发时间和约定时间 |
| | | //int day = insProductService.selectOrderManDay(insOrder.getId());//预计完成时间 |
| | | //insOrder.setAppointed(LocalDate.parse(LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))); |
| | | insOrder.setSendTime(LocalDateTime.now()); |
| | | /*todo 根据订单类型判断是否需要推送企业微信 @zss*/ |
| | | if (!order.getFormType().equals("其他成品")) { |
| | | /* HashMap<String, Object> map = new HashMap<>(); |
| | | /*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("toparty", "");//接收部门id |
| | | map.put("totag", "");//消息标签id |
| | | map.put("msgtype", "text");//消息类型 text:文本 |
| | | map.put("agentid", 1000513);//应用id |
| | | map.put("agentid", 1000517);//应用id |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("content", "您有一条订单需生成检验,请前往LIMS系统查看。<a href=\"http://10.1.13.77/enter\"> </a>"); |
| | | map.put("text", JSONArray.toJSONString(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);*/ |
| | | } |
| | | qywxApi.send(map); |
| | | }*/ |
| | | } |
| | | return insOrderMapper.updateById(insOrder); |
| | | } |
| | |
| | | public Map<String, Object> getInsOrderAndSample(Integer id, String laboratory) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | InsOrder insOrder = insOrderMapper.selectById2(id); |
| | | List<SampleProductDto> insSamples = insSampleMapper.selectList1(insOrder.getId()); |
| | | List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory); |
| | | if (list.size() == 0) { |
| | | list = insSampleMapper.getInsOrderAndSample2(id, laboratory); |
| | | //再次试验会出现为空的情况 |
| | | if (list.size() != insSamples.size()) { |
| | | List<Integer> ids = list.stream().map(sampleProductDto -> sampleProductDto.getId()).distinct().collect(Collectors.toList()); |
| | | List<SampleProductDto> samples = insSamples.stream().filter(insSample -> |
| | | !ids.contains(insSample.getId()) |
| | | ).collect(Collectors.toList()); |
| | | for (SampleProductDto insSample : samples) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()) |
| | | .eq(InsProduct::getState, 1) |
| | | .eq(InsProduct::getSonLaboratory, laboratory)); |
| | | for (InsProduct insProduct : insProducts) { |
| | | List<InsProductResult2> insProductResult2List = insProductResult2Mapper.selectList(Wrappers.<InsProductResult2>lambdaQuery() |
| | | .eq(InsProductResult2::getInsProductId, insProduct.getId()).isNull(InsProductResult2::getNum)); |
| | | insProduct.setInsProductResult2(insProductResult2List); |
| | | InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId()).isNull(InsProductResult::getNum)); |
| | | insProduct.setInsProductResult(insProductResult); |
| | | } |
| | | insSample.setInsProduct(insProducts); |
| | | list.add(insSample); |
| | | } |
| | | |
| | | } |
| | | for (SampleProductDto sampleProductDto : list) { |
| | | List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList()); |