From 0830f6724578925ac2279fbfae2966b0bb88b027 Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期五, 26 四月 2024 21:59:51 +0800
Subject: [PATCH] 标准库刷新检验项目

---
 cnas-server/src/main/java/com/yuanchu/mom/service/impl/CapacityScopeServiceImpl.java   |   10 +---
 inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java            |    2 +
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java |   18 +++++++-
 system-run/src/main/resources/application-dev.yml                                      |    2 
 inspect-server/src/main/resources/mapper/InsOrderMapper.xml                            |    4 +-
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java |    3 -
 inspect-server/src/main/resources/mapper/StandardTreeMapper.xml                        |   33 ++++++++++++++--
 7 files changed, 52 insertions(+), 20 deletions(-)

diff --git a/cnas-server/src/main/java/com/yuanchu/mom/service/impl/CapacityScopeServiceImpl.java b/cnas-server/src/main/java/com/yuanchu/mom/service/impl/CapacityScopeServiceImpl.java
index f98ca4b..9bdff63 100644
--- a/cnas-server/src/main/java/com/yuanchu/mom/service/impl/CapacityScopeServiceImpl.java
+++ b/cnas-server/src/main/java/com/yuanchu/mom/service/impl/CapacityScopeServiceImpl.java
@@ -1,6 +1,5 @@
 package com.yuanchu.mom.service.impl;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -57,13 +56,13 @@
             itemParameter.setBsm("0");
         }
         int insert = structureItemParameterMapper.insert(itemParameter);
-        standardTreeService.reTreeBySampleType(structureTestObjectMapper.selectById(itemParameter.getSample()).getSpecimenName());
+        standardTreeService.reTreeBySampleType(itemParameter.getSample());
         return insert;
     }
 
     @Override
     public int delItemParameter(Integer id) {
-        standardTreeService.reTreeBySampleType(structureTestObjectMapper.selectById(structureItemParameterMapper.selectById(id).getSample()).getSpecimenName());
+        standardTreeService.reTreeBySampleType(structureItemParameterMapper.selectById(id).getSample());
         int i = structureItemParameterMapper.deleteById(id);
         return i;
     }
@@ -71,10 +70,7 @@
     @Override
     public int upItemParameter(StructureItemParameter itemParameter) {
         int i = structureItemParameterMapper.updateById(itemParameter);
-        if(itemParameter.getSample() != null){
-            List<String> list = JSON.parseArray(itemParameter.getSample(), String.class);
-            standardTreeService.reTreeBySampleType(list.get(0));
-        }
+        standardTreeService.reTreeBySampleType(itemParameter.getSample());
         return i;
     }
 
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
index 7ee85ef..b9071d8 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
@@ -18,6 +18,8 @@
 
     List<FactoryDto> selectStandardTreeList();
 
+    List<StandardTree> selectStandardTreeList2(String sampleType);
+
     StandardProductList selectStandardProductById(Integer id);
 
     List<StandardProductList> getStandardProductListBySample(String sampleType);
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
index 83c2394..ae0bf3d 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -526,8 +526,7 @@
             tables.forEach(table -> {
                 table.put("tableSize", tables.size() + 1);
             });
-//            List<Map<String, String>> deviceList = insOrderMapper.selectDeviceList(deviceSet);
-            List<Map<String, String>> deviceList = new ArrayList<>();
+            List<Map<String, String>> deviceList = insOrderMapper.selectDeviceList(deviceSet);
             Map<String, String> codeStr = new HashMap<>();
             codeStr.put("鎶ュ憡缂栧彿", insReport.getCode());
             codeStr.put("鏍峰搧鍚嶇О", insOrder.getSample());
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 a4f2008..ca0f086 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
@@ -152,12 +152,24 @@
     public void reTreeBySampleType(String sampleType) {
         Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
         CompletableFuture.supplyAsync(() -> {
-            //鏍规嵁鏍峰搧鍚嶇О鏌ヨ鎵�鏈夋娴嬮」鐩弬鏁�(鑳藉姏)
+            System.out.println(sampleType);
+            List<String> sampleTree = new ArrayList<>();
+            if(sampleType != null){
+                sampleTree = JSON.parseArray(sampleType, String.class);
+            }
             List<StandardProductList> productList = standardTreeMapper.getStandardProductListBySample(sampleType);
             List<StandardProductList> productList1 = JSON.parseArray(JSON.toJSONString(productList), StandardProductList.class);
-            List<StandardMethodList> methodList = standardTreeMapper.getStandardMethodListBySample(sampleType);
+            List<StandardMethodList> methodList = standardTreeMapper.getStandardMethodListBySample(sampleTree.get(0));
             List<StandardMethodList> methodList1 = JSON.parseArray(JSON.toJSONString(methodList), StandardMethodList.class);
-            List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getSampleType, sampleType));
+            List<StandardTree> treeList;
+            if(sampleTree.size()==1){
+                treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getSampleType, sampleTree.get(0)));
+                treeList.addAll(standardTreeMapper.selectStandardTreeList2(sampleTree.get(0)));
+            }else if(sampleTree.size()==2){
+                treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getSampleType, sampleTree.get(0)).eq(StandardTree::getSample, sampleTree.get(1)));
+            }else{
+                treeList = standardTreeMapper.selectList(null);
+            }
             for (StandardTree tree : treeList) {
                 String treeStr = tree.getFactory() + " - " + tree.getLaboratory() + " - " + tree.getSampleType() + (tree.getSample() == null ? "" : " - " + tree.getSample()) + (tree.getModel() == null ? "" : " - " + tree.getModel());
                 List<StandardMethodList> standardMethodList = JSON.parseArray(JSON.toJSONString(standardMethodListService.selectsStandardMethodByFLSSM(treeStr).get("standardMethodList")), StandardMethodList.class);
diff --git a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
index eaf47c5..6c4a405 100644
--- a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -159,9 +159,9 @@
         </if>
     </select>
     <select id="selectDeviceList" resultType="java.util.Map">
-        select device_name,specification_model,factory_no,date_format(latest_traceability, '%Y-%m-%d')
+        select device_name,specification_model,factory_no,date_format(next_calibration_date, '%Y-%m-%d')
         latest_traceability from device
-        where device_name in
+        where factory_no in
         <foreach collection="names" index="index" open="(" separator="," close=")" item="val">
             #{val}
         </foreach>
diff --git a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
index 1e6fdd4..d5f28cd 100644
--- a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
+++ b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -47,7 +47,13 @@
     </resultMap>
 
     <select id="selectStandardTreeList" resultMap="FactoryDto">
-        select factory,laboratory,sample_type,sample,model from standard_tree
+#         select factory,laboratory,sample_type,sample,model from standard_tree
+        select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory, l.laboratory_name laboratory, sto.specimen_name sample_type, p.name sample, st.model from laboratory l
+        left join structure_test_object sto on sto.laboratory_id = l.id
+        left join product p on p.object_id = sto.id
+        left join standard_tree st on st.laboratory = l.laboratory_name
+        and st.sample_type = sto.specimen_name
+        and st.sample = p.name
     </select>
 
     <select id="selectStandardProductById" resultType="com.yuanchu.mom.pojo.StandardProductList">
@@ -98,14 +104,31 @@
                ask,
                ask_tell as tell
         from structure_item_parameter sp
-        left join structure_test_object sto on sto.id = sp.sample
-        where sto.specimen_name = #{sampleType}
+        where sp.sample = #{sampleType}
+        or sp.sample = ''
+        or sp.sample = '[]'
     </select>
     <select id="getStandardMethodListBySample" resultType="com.yuanchu.mom.pojo.StandardMethodList">
         select sm.code,sm.name,sm.remark from standard_method sm
         left join structure_test_object sto on sm.structure_test_object_id = sto.id
-        where sto.specimen_name = #{sampleType}
-        and is_use = 1
+        where is_use = 1
         and is_product = 1
+        <if test="sampleType != null">
+            and sto.specimen_name = #{sampleType}
+        </if>
+    </select>
+    <select id="selectStandardTreeList2" resultType="com.yuanchu.mom.pojo.StandardTree">
+        select '涓ぉ绉戞妧妫�娴嬩腑蹇�'  factory,
+               l.laboratory_name  laboratory,
+               sto.specimen_name  sample_type,
+               p.name             sample
+        from laboratory l
+                 left join structure_test_object sto on sto.laboratory_id = l.id
+                 left join product p on p.object_id = sto.id
+                 left join standard_tree st on st.laboratory = l.laboratory_name
+            and st.sample_type = sto.specimen_name
+            and st.sample = p.name
+        where sto.specimen_name = #{sampleType}
+        group by sto.specimen_name
     </select>
 </mapper>
diff --git a/system-run/src/main/resources/application-dev.yml b/system-run/src/main/resources/application-dev.yml
index 8436085..c04bd96 100644
--- a/system-run/src/main/resources/application-dev.yml
+++ b/system-run/src/main/resources/application-dev.yml
@@ -67,7 +67,7 @@
     # redis绔彛锛堥粯璁や负6379锛�
     port: 6379
     # redis璁块棶瀵嗙爜锛堥粯璁や负绌猴級
-    password: 123456
+    password:
     # redis杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶆绉掞級
     timeout: 50
     # redis杩炴帴姹犻厤缃�

--
Gitblit v1.9.3