From a00890e840b80a741f62eb6cb31b46f13be6202f Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 24 十月 2024 16:46:45 +0800
Subject: [PATCH] 附件调试修改+辐射站点报告生成

---
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java |  106 +++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 91 insertions(+), 15 deletions(-)

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 98799f9..82d1f22 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
@@ -2,14 +2,15 @@
 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.yuanchu.mom.pojo.StandardMethodList;
-import com.yuanchu.mom.service.StandardMethodListService;
 import com.yuanchu.mom.mapper.StandardMethodListMapper;
+import com.yuanchu.mom.mapper.StandardProductListMapper;
+import com.yuanchu.mom.pojo.StandardMethodList;
+import com.yuanchu.mom.pojo.StandardProductList;
+import com.yuanchu.mom.service.StandardMethodListService;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
 * @author Administrator
@@ -23,6 +24,8 @@
 
     private StandardMethodListMapper standardMethodListMapper;
 
+    private StandardProductListMapper standardProductListMapper;
+
     @Override
     public int addStandardMethodList(Integer standardId, String tree) {
         String[] trees = tree.split(" - ");
@@ -32,37 +35,110 @@
         list.setName(map.get("name"));
         list.setRemark(map.get("remark"));
         list.setFactory(trees[0]);
-        list.setLaboratory(trees[1]);
-        list.setSample_type(trees[2]);
-        list.setSample(trees[3]);
+        try {
+            list.setLaboratory(trees[1]);
+        }catch (Exception e){}
+        try {
+            list.setSampleType(trees[2]);
+        }catch (Exception e){}
+        try {
+            list.setSample(trees[3]);
+        }catch (Exception e){}
         try {
             list.setModel(trees[4]);
         }catch (Exception e){}
-        return standardMethodListMapper.insert(list);
+        standardMethodListMapper.insert(list);
+        List<StandardProductList> standardProductLists = standardMethodListMapper.selectParameterList(list.getCode());
+        for (StandardProductList standardProductList : standardProductLists) {
+            standardProductList.setStandardMethodListId(list.getId());
+            standardProductList.setFactory(trees[0]);
+            try {
+                standardProductList.setLaboratory(trees[1]);
+            }catch (Exception e){}
+            try {
+                standardProductList.setSampleType(trees[2]);
+            }catch (Exception e){}
+            try {
+                standardProductList.setSample(trees[3]);
+            }catch (Exception e){}
+            try {
+                standardProductList.setModel(trees[4]);
+            }catch (Exception e){}
+            standardProductListMapper.insert(standardProductList);
+        }
+        return 1;
     }
 
     @Override
-    public List<StandardMethodList> selectsStandardMethodByFLSSM(String tree) {
+    public Map<String, List<?>> selectsStandardMethodByFLSSM(String tree) {
+        String[] trees = tree.split(" - ");
+        Map<String, List<?>> map = new HashMap<>();
+        String str = "";
+        List<StandardMethodList> standardMethodLists = new ArrayList<>();
+        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;
+        }
+        standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodListsByNull(str));
+        map.put("standardMethodList", standardMethodLists);
+        return map;
+    }
+
+    @Override
+    public Map<String, List<?>> selectsStandardMethodByFLSSM2(String tree) {
         String[] trees = tree.split(" - ");
         List<StandardMethodList> standardMethodLists = null;
         switch (trees.length){
             case 5:
-                standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],trees[3],trees[4]);
+                standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],trees[3],trees[4]);
                 break;
             case 4:
-                standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],trees[3],null);
+                standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],trees[3],null);
                 break;
             case 3:
-                standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],null,null);
+                standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],null,null);
                 break;
             case 2:
-                standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],null,null,null);
+                standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],null,null,null);
                 break;
             case 1:
-                standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],null,null,null,null);
+                standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],null,null,null,null);
                 break;
         }
-        return standardMethodLists;
+        Map<String, List<?>> map = new HashMap<>();
+        map.put("standardMethodList", standardMethodLists);
+        return map;
+    }
+
+    @Override
+    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.selectListEnum();
+    }
+
+    @Override
+    public Integer getStandardMethodId(String code) {
+        return baseMapper.getStandardMethodId(code);
     }
 }
 

--
Gitblit v1.9.3