From a33e38956895c1e4b14894fb1848088578c6d509 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 08 七月 2025 16:58:09 +0800
Subject: [PATCH] 排除辅材数据
---
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 51 +++++++++++++++++++++++++--------------------------
1 files changed, 25 insertions(+), 26 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 71da0be..ca14986 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();
@@ -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);
+ }
}
--
Gitblit v1.9.3