From ec6c3bc0b778178b2518302ffc9099ac8f6cc8a2 Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期二, 30 四月 2024 00:54:34 +0800
Subject: [PATCH] 标准库修复

---
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java        |   17 +-------
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java  |   13 ++++--
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java |   10 +++-
 cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureTestObject.java                       |    6 ++
 inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml                         |   28 +++++++++-----
 inspect-server/src/main/resources/mapper/StandardTreeMapper.xml                               |    2 
 cnas-server/src/main/java/com/yuanchu/mom/dto/PageTestObjectDto.java                          |    2 
 cnas-server/src/main/resources/mapper/StructureTestMapper.xml                                 |    3 +
 inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java             |    2 +
 9 files changed, 46 insertions(+), 37 deletions(-)

diff --git a/cnas-server/src/main/java/com/yuanchu/mom/dto/PageTestObjectDto.java b/cnas-server/src/main/java/com/yuanchu/mom/dto/PageTestObjectDto.java
index f6fb326..dbfd01e 100644
--- a/cnas-server/src/main/java/com/yuanchu/mom/dto/PageTestObjectDto.java
+++ b/cnas-server/src/main/java/com/yuanchu/mom/dto/PageTestObjectDto.java
@@ -16,7 +16,7 @@
     @ApiModelProperty(value = "浜у搧")
     private String product;
 
-    @ValueTableShow(2)
+    @ValueTableShow(3)
     @ApiModelProperty(value = "鍒涘缓浜�")
     private String createUserName;
 
diff --git a/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureTestObject.java b/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureTestObject.java
index 6a6859a..b254027 100644
--- a/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureTestObject.java
+++ b/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureTestObject.java
@@ -31,6 +31,10 @@
     @ApiModelProperty(value = "妫�楠屽璞�")
     private String specimenName;
 
+    @ValueTableShow(1)
+    @ApiModelProperty(value = "妫�楠屽璞N")
+    private String specimenNameEn;
+
     @ValueTableShow(2)
     @ApiModelProperty(value = "瀵硅薄浠e彿")
     private String code;
@@ -43,7 +47,7 @@
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private Integer updateUser;
 
-    @ValueTableShow(3)
+    @ValueTableShow(4)
     @ApiModelProperty(value = "鍒涘缓鏃堕棿")
     @TableField(fill = FieldFill.INSERT)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
diff --git a/cnas-server/src/main/resources/mapper/StructureTestMapper.xml b/cnas-server/src/main/resources/mapper/StructureTestMapper.xml
index 1dac2c9..7fc7fdc 100644
--- a/cnas-server/src/main/resources/mapper/StructureTestMapper.xml
+++ b/cnas-server/src/main/resources/mapper/StructureTestMapper.xml
@@ -14,7 +14,8 @@
         sto.update_time,
         sto.code,
         sto.laboratory_id,
-        GROUP_CONCAT(p.name) product
+        GROUP_CONCAT(p.name) product,
+        sto.specimen_name_en
         from structure_test_object sto
         left join user u1 on sto.create_user = u1.id
         left join user u2 on sto.update_user = u2.id
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
index 07e199d..59fdd55 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
@@ -21,6 +21,8 @@
 
     List<StandardMethodList> selectStandardMethodLists(String tree);
 
+    List<StandardMethodList> selectStandardMethodLists3(String tree);
+
     List<StandardMethodList> selectStandardMethodLists2(String data1,String data2,String data3,String data4, String data5);
 
     List<StandardProductList> selectParameterList(String code);
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
index 69f8145..b4efc3c 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
@@ -9,7 +9,6 @@
 import com.yuanchu.mom.service.StandardMethodListService;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -31,7 +30,6 @@
     private StandardProductListMapper standardProductListMapper;
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public int addStandardMethodList(Integer standardId, String tree) {
         String[] trees = tree.split(" - ");
         Map<String, String> map = standardMethodListMapper.selectStandardMethodById(standardId);
@@ -83,18 +81,25 @@
         switch (trees.length){
             case 5:
                 str += "\"" + trees[2] + "\",\"" + trees[3] + "\",\"" + trees[4] + "\"";
+                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
+                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\",\"" + trees[3] + "\""));
+                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\""));
                 break;
             case 4:
                 str += "\"" + trees[2] + "\",\"" + trees[3] + "\"";
+                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
+                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\""));
                 break;
             case 3:
                 str += "\"" + trees[2] + "\"";
+                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists3(str));
                 break;
             default:
                 map.put("standardMethodList", null);
                 return map;
         }
-        map.put("standardMethodList", standardMethodListMapper.selectStandardMethodLists(str));
+
+        map.put("standardMethodList", standardMethodLists);
         return map;
     }
 
@@ -125,12 +130,10 @@
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public int delStandardMethodByFLSSM(Integer id) {
         standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id));
         return standardMethodListMapper.deleteById(id);
     }
-
     @Override
     public List<StandardMethodList> selectStandardMethodEnum() {
         return standardMethodListMapper.selectList(Wrappers.<StandardMethodList>lambdaQuery().select(StandardMethodList::getId,StandardMethodList::getCode,StandardMethodList::getName));
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 0a6d4e0..8de102a 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
@@ -13,6 +13,7 @@
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 import java.util.concurrent.CompletableFuture;
@@ -46,7 +47,7 @@
 
     @Override
     public List<StandardProductList> selectStandardProductList(InsSample insSample) {
-        List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1));
+        List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, insSample.getModel()));
         list = list.stream().filter(a -> {
             try {
                 if (a.getSection() != null && !Objects.equals(a.getSection(), "")) {
@@ -82,16 +83,19 @@
     public List<StandardProductList> selectStandardProductListByMethodId(Integer id, String tree) {
         String[] trees = tree.split(" - ");
         StringBuffer str = new StringBuffer();
+        List<StandardProductList> list = new ArrayList<>();
         if (trees.length == 3) {
             str.append("\"").append(trees[2]).append("\"");
         } else {
             str.append("\"").append(trees[2]).append("\",\"").append(trees[3]).append("\"");
+            list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\""));
         }
-        List<StandardProductList> list = standardTreeMapper.selectStandardProductListByTree(str + "");
+        list.addAll(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())) {
+                if (Objects.equals(sp.getInspectionItem(), pl.getInspectionItem())
+                        && Objects.equals(sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass())) {
                     pl.setId(sp.getId());
                     pl.setState(sp.getState());
                     pl.setFactory(sp.getFactory());
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
index aa72274..0654d4a 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
@@ -2,7 +2,6 @@
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yuanchu.mom.dto.FactoryDto;
@@ -20,7 +19,6 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * @author Administrator
@@ -61,7 +59,7 @@
             case 5:
                 standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]).eq(StandardTree::getModel, trees[4]));
                 break;
-            case 4:
+            /*case 4:
                 standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
                 break;
             case 3:
@@ -72,18 +70,7 @@
                 break;
             case 1:
                 standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]));
-                break;
-        }
-        Map<String, List<?>> listMap = standardMethodListService.selectsStandardMethodByFLSSM2(tree);
-        if (listMap.get("standardMethodList").size() != 0) {
-            for (Object o : listMap.get("standardMethodList")) {
-                JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(o));
-                List<StandardProductList> list = standardProductListService.selectStandardProductListByMethodId((Integer) jsonObject.get("id"), tree);
-                if (list.size() != 0) {
-                    standardProductListMapper.deleteBatchIds(list);
-                }
-            }
-            standardMethodListMapper.deleteBatchIds(listMap.get("standardMethodList"));
+                break;*/
         }
         return 1;
     }
diff --git a/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml b/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
index c59fe21..b0f5bc6 100644
--- a/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
+++ b/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
@@ -31,16 +31,14 @@
         where is_use = 1
         and is_product = 1
         and (
-                structure_test_object_id is null
-                OR structure_test_object_id = ''
-                OR structure_test_object_id = '[]'
-                or structure_test_object_id LIKE CONCAT('%', #{tree}, '%')
-            )
+            structure_test_object_id is null
+            OR structure_test_object_id = ''
+            OR structure_test_object_id = '[]'
+            or structure_test_object_id LIKE CONCAT('%[', #{tree}, ']%')
+        )
     </select>
     <select id="selectParameterList" resultType="standardProductList">
-        select
-               inspection_item,
-               inspection_item_classify,
+        select inspection_item,
                inspection_item_subclass,
                laboratory,
                unit,
@@ -49,10 +47,8 @@
                man_hour_group,
                inspection_item_type,
                inspection_value_type,
-               device_group,
                checkout_number,
                section,
-               value_type,
                method,
                man_day,
                bsm,
@@ -79,4 +75,16 @@
             and model = #{data5}
         </if>
     </select>
+    <select id="selectStandardMethodLists3" resultType="com.yuanchu.mom.pojo.StandardMethodList">
+        select id, code, name, remark
+        from standard_method
+        where is_use = 1
+          and is_product = 1
+          and (
+                structure_test_object_id is null
+                OR structure_test_object_id = ''
+                OR structure_test_object_id = '[]'
+                or structure_test_object_id LIKE CONCAT('%', #{tree}, '%')
+            )
+    </select>
 </mapper>
diff --git a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
index fecb954..5f8c2cb 100644
--- a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
+++ b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -158,7 +158,7 @@
                       sample is NULL
                       OR sample = ''
                       or sample = '[]'
-                      OR sample LIKE CONCAT('%', #{tree}, '%')
+                      OR sample LIKE CONCAT('%[', #{tree}, ']%')
                   )
     </select>
 

--
Gitblit v1.9.3