From 8c37d903a2fe25d5857c4555c791d552bec60cb8 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 22 八月 2023 17:48:44 +0800
Subject: [PATCH] 改动6.0

---
 inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java
index 94334c3..ccacfa4 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java
@@ -10,8 +10,10 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -76,19 +78,22 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String check(Integer id, String value) {
-        //濡傛灉妫�楠屽�间笉涓虹┖
-        if (StringUtils.isNotBlank(value)) {
-            InspectionProduct inspectionProduct = inspectionProductMapper.selectById(id);
-            //鍒ゆ柇妫�娴嬪�兼槸鍚︽弧瓒虫爣鍑嗗�煎拰鍐呮帶鍊肩殑瑕佹眰,濡傛灉涓嶆弧瓒冲垯妫�楠岀粨璁轰负涓嶅悎鏍�0
-            String required = inspectionProduct.getRequired();//鏍囧噯鍊�
-            String internal = inspectionProduct.getInternal();//鍐呮帶鍊�
-            inspectionProduct.setTestValue(value);
-            inspectionProduct.setTestState(checkValues(required, internal, value));
-            inspectionProductMapper.updateById(inspectionProduct);
-        } else {
-            //濡傛灉妫�楠屽�间负绌�,灏嗗師鏈夌殑妫�楠岀粨璁鸿鐩栦负null
-            inspectionProductMapper.upda(id);
+        InspectionProduct inspectionProduct = inspectionProductMapper.selectById(id);
+        //鍒ゆ柇妫�娴嬪�兼槸鍚︽弧瓒虫爣鍑嗗�煎拰鍐呮帶鍊肩殑瑕佹眰,濡傛灉涓嶆弧瓒冲垯妫�楠岀粨璁轰负涓嶅悎鏍�0
+        String required = inspectionProduct.getRequired();//鏍囧噯鍊�
+        String internal = inspectionProduct.getInternal();//鍐呮帶鍊�
+        inspectionProduct.setTestValue(value);
+        List<Integer> list = Arrays.stream(value.split(",")).map(s -> {
+            int values = checkValues(required, internal, s);
+            return values;
+        }).collect(Collectors.toList());
+        if (list.contains(0)) {
+            //濡傛灉鍏朵腑涓�涓楠屽�间笉鍚堟牸鍒欒椤圭洰妫�楠屼笉鍚堟牸
+            inspectionProduct.setTestState(0);
+        }else {
+            inspectionProduct.setTestState(1);
         }
+        inspectionProductMapper.updateById(inspectionProduct);
         return "鎻愪氦鎴愬姛!";
     }
 
@@ -101,7 +106,7 @@
         List<Integer> results = inspectionProductMapper.getresult(id);
         int count = 0;
         for (Integer result : results) {
-            if (result != null && result==1) {
+            if (result != null && result == 1) {
                 count++;
             }
         }

--
Gitblit v1.9.3