From 61f34419e094f2363276d614a960b379cc456482 Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期二, 20 五月 2025 10:37:15 +0800 Subject: [PATCH] 业务代码合并 --- inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 63 ++++++++++++++++--------------- 1 files changed, 32 insertions(+), 31 deletions(-) diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java index 68ad415..8d29eee 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java +++ b/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(); @@ -502,22 +503,31 @@ // 娣诲姞宸ユ椂 // 鍒ゆ柇鏄惁鍙槸鍙備笌璁$畻鍊�, 鍙備笌璁$畻鍊煎疄闄呮病鏈夊~鍐� if (StringUtils.isNotBlank(newResult.getInsValue()) && !newResult.getInsValue().equals("[]")) { - InsProduct finalInsProduct = insProductMapper.selectById(product.getId()); threadPoolTaskExecutor.execute(() -> { + InsProduct finalInsProduct = insProductMapper.selectById(product.getId()); InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId()); this.addAuxiliary(userId, finalInsProduct, insOrder); }); + } else { + // 鍒ゆ柇鏄惁鏄病鏈夋楠屽�肩殑鍐呭 + if (saveInsContextDto.getIsNoTestValue() != null && saveInsContextDto.getIsNoTestValue() == 1) { + threadPoolTaskExecutor.execute(() -> { + InsProduct finalInsProduct = insProductMapper.selectById(product.getId()); + InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId()); + 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 +615,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 +818,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"); @@ -967,13 +962,13 @@ * @param ifsInventoryQuantity * @param order */ - private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String userName) { + private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String sendUserAccount) { for (InsProduct insProduct : productList) { // 鍒ゆ柇鏄惁鏄暟鍊肩被鍨� if (insProduct.getInspectionValueType().equals("1") && insProduct.getInsResult().equals(1)) { List<InsProductDeviationWarningDetail> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName()); - if (insProductAnalysisDtoList.size() < 5) { + if (insProductAnalysisDtoList.size() < 10) { continue; } @@ -1034,10 +1029,10 @@ message += "\n妫�楠岄」: " + insProduct.getInspectionItem() + insProduct.getInspectionItemSubclass(); message += "\n鍋忓樊瓒呰繃浜� 10%"; // 鍙戦�佺粰鎻愪氦浜� - WxCpUtils.inform(userName, message, null); - - // todo: 鍙戦�佺粰妫�娴嬩腑蹇冧富浠�(鍥哄畾姝�) - WxCpUtils.inform("ZT-004704", message, null); +// WxCpUtils.inform(sendUserAccount, message, null); +// +// // todo: 鍙戦�佺粰妫�娴嬩腑蹇冧富浠�(鍥哄畾姝�) +// WxCpUtils.inform("ZT-004704", message, null); } catch (Exception e) { e.printStackTrace(); log.error("鍋忓樊棰勮浼佷笟寰俊閫氱煡鎶ラ敊"); @@ -2015,7 +2010,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 +2563,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 +4238,11 @@ // 淇濆瓨鍒伴檮浠堕噷闈� uploadFile(insOrderId, multipartFile); + try { + inputStream.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } } -- Gitblit v1.9.3