zhuo
8 天以前 fc543916cfac06f0cf16d018b9751417e3a119f7
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -361,15 +361,16 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveInsContext(Map<String, Object> insContext, Integer currentTable, Integer currentSampleId, Integer orderId, String sonLaboratory) {
    public void saveInsContext(SaveInsContextDto saveInsContextDto) {
        Map<String, Object> insContext = JSON.parseObject(saveInsContextDto.getParam(), Map.class);
        Integer userId = SecurityUtils.getUserId().intValue();
        InsSample insSample = insSampleMapper.selectById(currentSampleId);
        InsSample insSample = insSampleMapper.selectById(saveInsContextDto.getSampleId());
        insContext.forEach((k, v) -> {
            JSONObject jo = JSON.parseObject(JSON.toJSONString(v));
            InsProduct insProduct = new InsProduct();
            insProduct.setId(Integer.parseInt(k));
            InsProduct product = insProductMapper.selectById(insProduct.getId());
            if (currentTable.equals(product.getTemplateId()) && currentSampleId.equals(product.getInsSampleId())) {
            if (saveInsContextDto.getCurrentTable().equals(product.getTemplateId()) && saveInsContextDto.getSampleId().equals(product.getInsSampleId())) {
                List<InsProductResult> oldResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery()
                        .eq(InsProductResult::getInsProductId, insProduct.getId()));
                InsProductResult newResult = new InsProductResult();
@@ -501,23 +502,30 @@
                // 添加工时
                // 判断是否只是参与计算值, 参与计算值实际没有填写
                InsProduct finalInsProduct = insProductMapper.selectById(product.getId());
                InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId());
                if (StringUtils.isNotBlank(newResult.getInsValue()) && !newResult.getInsValue().equals("[]")) {
                    InsProduct finalInsProduct = insProductMapper.selectById(product.getId());
                    threadPoolTaskExecutor.execute(() -> {
                        InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId());
                        this.addAuxiliary(userId, finalInsProduct, insOrder);
                    });
                } else {
                    // 判断是否是没有检验值的内容
                    if (saveInsContextDto.getIsNoTestValue() != null && saveInsContextDto.getIsNoTestValue() == 1) {
                        threadPoolTaskExecutor.execute(() -> {
                            this.addAuxiliary(userId, finalInsProduct, insOrder);
                        });
                    }
                }
            }
        });
        String sampleIdStr = insContext.keySet().stream().findFirst().orElse(null);
        if (sampleIdStr != null) {
            int count = insProductMapper.selectInsProductCountByOrderId(orderId);
            int count = insProductMapper.selectInsProductCountByOrderId(saveInsContextDto.getOrderId());
            if (count == 0) {
                insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate()
                        .eq(InsOrderState::getInsOrderId, orderId)
                        .eq(InsOrderState::getLaboratory, sonLaboratory)
                        .eq(InsOrderState::getInsOrderId, saveInsContextDto.getOrderId())
                        .eq(InsOrderState::getLaboratory, saveInsContextDto.getSonLaboratory())
                        .set(InsOrderState::getInsState, 2));
            }
        }
@@ -605,20 +613,6 @@
     */
    private void getTemplateThing(InsOrder order, List<InsProduct> insProducts) {
        Set<Integer> set = new HashSet<>();
        // 检验项分类+检验项+检验子项的拼接
//        List<String> itemNameList = insProducts.stream().map(insProduct -> {
//            String itemName = "";
//            if (StringUtils.isNotBlank(insProduct.getInspectionItemClass())) {
//                itemName += insProduct.getInspectionItemClass().trim();
//            }
//            if (StringUtils.isNotBlank(insProduct.getInspectionItem())) {
//                itemName += insProduct.getInspectionItem().trim();
//            }
//            if (StringUtils.isNotBlank(insProduct.getInspectionItemSubclass())) {
//                itemName += insProduct.getInspectionItemSubclass().trim();
//            }
//            return itemName;
//        }).collect(Collectors.toList());
        // 查询订单状态判断是否是查历史模板
        if (order.getIsFirstSubmit() != null && order.getIsFirstSubmit().equals(1)) {
            InsOrderState insOrderState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
@@ -822,10 +816,9 @@
        // 5.发送消息通知给复核人
        // 查询当前人信息
        Integer userId = SecurityUtils.getUserId().intValue();
        Map<String, String> userMap = insProductMapper.selectUserById(verifyUser);
        String userName = userMap.get("name");
        String userName = insProductMapper.selectUserById(userId).get("name");
        // 查询发送人信息
        String sendUserAccount = userMap.get("account");
        String sendUserAccount = insProductMapper.selectUserById(verifyUser).get("account");
        InformationNotification info = new InformationNotification();
        info.setCreateUser(userName);
        info.setMessageType("2");
@@ -2015,7 +2008,7 @@
            insReportMapper.delete(Wrappers.<InsReport>lambdaQuery()
                    .eq(InsReport::getInsOrderId, insOrder.getId()));
            insReportMapper.insert(insReport);
            inputStream.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
@@ -2568,6 +2561,7 @@
            insReportMapper.delete(Wrappers.<InsReport>lambdaQuery()
                    .eq(InsReport::getInsOrderId, insOrder.getId()));
            insReportMapper.insert(insReport);
            inputStream.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
@@ -4242,6 +4236,11 @@
        // 保存到附件里面
        uploadFile(insOrderId, multipartFile);
        try {
            inputStream.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }