From 8577a11e5093871b2b5d6988431e7e22e76d43e6 Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期一, 29 四月 2024 01:46:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java | 43 +++++++++++++++++++++++++++++++++++++------
1 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
index 53363b1..6aeb5bb 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -10,10 +10,12 @@
import com.yuanchu.mom.service.StandardProductListService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
+import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
@@ -29,6 +31,8 @@
private StandardProductListMapper standardProductListMapper;
private StandardTreeMapper standardTreeMapper;
+
+ private StandardProductListService standardProductListService;
@Override
public int upStandardProductList(StandardProductList list) {
@@ -75,15 +79,42 @@
}
@Override
+ @Transactional(rollbackFor = Exception.class)
public List<StandardProductList> selectStandardProductListByMethodId(Integer id, String tree) {
String[] trees = tree.split(" - ");
- List<StandardProductList> list;
- if(tree.length() == 3){
- list = standardTreeMapper.selectStandardProductListByTree(trees[2], trees[3]);
- }else{
- list = standardTreeMapper.selectStandardProductListByTree(trees[2], null);
+ StringBuffer str = new StringBuffer();
+ if (trees.length == 3) {
+ str.append("\"").append(trees[2]).append("\"");
+ } else {
+ str.append("\"").append(trees[2]).append("\",\"").append(trees[3]).append("\"");
}
- List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id));
+ List<StandardProductList> list = standardTreeMapper.selectStandardProductListByTree(str + "");
+ List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id).eq(StandardProductList::getTree, tree));
+ for (StandardProductList sp : standardProductLists) {
+ for (StandardProductList pl : list) {
+ if (sp.getInspectionItem().equals(pl.getInspectionItem()) && sp.getInspectionItemSubclass().equals(pl.getInspectionItemSubclass())) {
+ pl.setId(sp.getId());
+ pl.setState(sp.getState());
+ pl.setFactory(sp.getFactory());
+ pl.setLaboratory(sp.getLaboratory());
+ pl.setSampleType(sp.getSampleType());
+ pl.setSample(sp.getSample());
+ pl.setModel(sp.getModel());
+ pl.setMethodS(sp.getMethodS());
+ break;
+ }
+ }
+ }
+ CompletableFuture.supplyAsync(() -> {
+ standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).eq(StandardProductList::getTree, tree));
+ standardProductListService.saveBatch(list);
+ return null;
+ }).thenAccept(res -> {
+ }).exceptionally(e -> {
+ e.printStackTrace();
+ return null;
+ });
+ ;
return list;
}
}
--
Gitblit v1.9.3