From cd60954222dc5540ccdaf6b015a4be4c70b2b605 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期三, 23 八月 2023 11:51:01 +0800
Subject: [PATCH] 8-23 修改2.0

---
 inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java |    4 
 inspection-server/src/main/java/com/yuanchu/limslaboratory/service/PlanService.java          |    2 
 inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java |   49 ++++++++++++++--
 inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java      |   22 ++++++
 inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/InspectionMaterial.java      |    8 --
 inspection-server/src/main/resources/mapper/InspectionMapper.xml                             |   62 ++++++++++++++++++++
 6 files changed, 128 insertions(+), 19 deletions(-)

diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java
index fc4b374..adcb5dd 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java
@@ -50,9 +50,27 @@
     Long qualifiedfin(Integer i);
 
     //鏌ヨ璇ユ棩鏈熺殑鍘熸潗鏂欐楠屾暟閲�
-    Integer getMaterByDay(String dayofWeek);
+    Integer getMaterByDay(String time);
 
     //鏌ヨ璇ユ棩鏈熺殑鎴愬搧妫�楠屾暟閲�
-    Integer getFinByDay(String dayofWeek);
+    Integer getFinByDay(String time);
+
+    //鏌ヨ璇ユ棩鏈熺殑鍘熸潗鏂欏悎鏍兼暟閲�
+    Long getOkMaterByDay(String time);
+
+    //鏌ヨ璇ユ棩鏈熺殑鎴愬搧鍚堟牸鏁伴噺
+    Long getOkFinByDay(String time);
+
+    //鏌ヨ璇ユ湀鐨勫師鏉愭枡妫�楠屾暟閲�
+    Integer getMaterByMonth(String monthofYear);
+
+    //鏌ヨ璇ユ湀鐨勬垚鍝佹楠屾暟閲�
+    Integer getFinByMonth(String monthofYear);
+
+    //鏌ヨ璇ユ湀鐨勫師鏉愭枡鍚堟牸鐜�
+    Long getOkMaterByMonth(String monthofYear);
+
+    //鏌ヨ璇ユ湀鐨勬垚鍝佸悎鏍肩巼
+    Long getOkFinByMonth(String monthofYear);
 }
 
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/InspectionMaterial.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/InspectionMaterial.java
index 55311dc..134e029 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/InspectionMaterial.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/InspectionMaterial.java
@@ -73,17 +73,13 @@
      **/
     private Integer state;
 
-    /**
-     * ${column.comment}
-     **/
+
     @TableField(fill = FieldFill.INSERT)
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date createTime;
 
-    /**
-     * ${column.comment}
-     **/
+
     @TableField(fill = FieldFill.INSERT_UPDATE)
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/PlanService.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/PlanService.java
index 8c870a6..b519e38 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/PlanService.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/PlanService.java
@@ -42,7 +42,7 @@
      * @param value
      * @return
      */
-    String check(Integer id, String value);
+    Integer check(Integer id, String value);
 
     /**
      * 涓婃姤
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java
index 0cde463..ef21304 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java
@@ -126,7 +126,8 @@
         List<Object> list3 = new ArrayList<>();
         List<Object> list4 = new ArrayList<>();
         switch (type) {
-            case 1:         /*鏈懆*/
+            /*鏈懆*/
+            case 1:
                 List<String> dayofWeeks = getDayofWeeks();
                 lineChartVO.setXAxis(dayofWeeks);
                 for (String dayofWeek : dayofWeeks) {
@@ -137,21 +138,56 @@
                     Integer allFinByDay = inspectionMapper.getFinByDay(dayofWeek);
                     list2.add(allFinByDay);
                     //鏌ヨ璇ユ棩鏈熺殑鍘熸潗鏂欏悎鏍肩巼
-
+                    Long okMaterByDay = inspectionMapper.getOkMaterByDay(dayofWeek);
+                    list3.add(getRadio(allMaterByDay, okMaterByDay));
                     //鏌ヨ璇ユ棩鏈熺殑鎴愬搧鍚堟牸鐜�
+                    Long okFinByDay = inspectionMapper.getOkFinByDay(dayofWeek);
+                    list4.add(getRadio(allFinByDay, okFinByDay));
                 }
-                lineSeriesVO1.setData(list1);
-
                 break;
-            case 2:         /*鏈湀*/
+            /*鏈湀*/
+            case 2:
                 List<String> dayofMonths = getDayofMonth();
                 lineChartVO.setXAxis(dayofMonths);
+                for (String dayofMonth : dayofMonths) {
+                    //鏌ヨ璇ユ棩鏈熺殑鍘熸潗鏂欐楠屾暟閲�
+                    Integer allMaterByDay = inspectionMapper.getMaterByDay(dayofMonth);
+                    list1.add(allMaterByDay);
+                    //鏌ヨ璇ユ棩鏈熺殑鎴愬搧妫�楠屾暟閲�
+                    Integer allFinByDay = inspectionMapper.getFinByDay(dayofMonth);
+                    list2.add(allFinByDay);
+                    //鏌ヨ璇ユ棩鏈熺殑鍘熸潗鏂欏悎鏍肩巼
+                    Long okMaterByDay = inspectionMapper.getOkMaterByDay(dayofMonth);
+                    list3.add(getRadio(allMaterByDay, okMaterByDay));
+                    //鏌ヨ璇ユ棩鏈熺殑鎴愬搧鍚堟牸鐜�
+                    Long okFinByDay = inspectionMapper.getOkFinByDay(dayofMonth);
+                    list4.add(getRadio(allFinByDay, okFinByDay));
+                }
                 break;
-            case 3:         /*鏈勾*/
+            /*鏈勾*/
+            case 3:
                 List<String> monthofYears = getMonthofYear();
                 lineChartVO.setXAxis(monthofYears);
+                for (String monthofYear : monthofYears) {
+                    //鏌ヨ璇ユ棩鏈熻寖鍥村唴鐨勫師鏉愭枡妫�楠屾暟閲�
+                    Integer allMaterByDay = inspectionMapper.getMaterByMonth(monthofYear);
+                    list1.add(allMaterByDay);
+                    //鏌ヨ璇ユ棩鏈熺殑鎴愬搧妫�楠屾暟閲�
+                    Integer allFinByDay = inspectionMapper.getFinByMonth(monthofYear);
+                    list2.add(allFinByDay);
+                    //鏌ヨ璇ユ棩鏈熺殑鍘熸潗鏂欏悎鏍肩巼
+                    Long okMaterByDay = inspectionMapper.getOkMaterByMonth(monthofYear);
+                    list3.add(getRadio(allMaterByDay, okMaterByDay));
+                    //鏌ヨ璇ユ棩鏈熺殑鎴愬搧鍚堟牸鐜�
+                    Long okFinByDay = inspectionMapper.getOkFinByMonth(monthofYear);
+                    list4.add(getRadio(allFinByDay, okFinByDay));
+                }
                 break;
         }
+        lineSeriesVO1.setData(list1);
+        lineSeriesVO2.setData(list2);
+        lineSeriesVO3.setData(list3);
+        lineSeriesVO4.setData(list4);
         series.add(lineSeriesVO1);
         series.add(lineSeriesVO2);
         series.add(lineSeriesVO3);
@@ -227,4 +263,5 @@
     }
 
 
+
 }
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 ccacfa4..97a838d 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
@@ -77,7 +77,7 @@
     //妫�楠�
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public String check(Integer id, String value) {
+    public Integer check(Integer id, String value) {
         InspectionProduct inspectionProduct = inspectionProductMapper.selectById(id);
         //鍒ゆ柇妫�娴嬪�兼槸鍚︽弧瓒虫爣鍑嗗�煎拰鍐呮帶鍊肩殑瑕佹眰,濡傛灉涓嶆弧瓒冲垯妫�楠岀粨璁轰负涓嶅悎鏍�0
         String required = inspectionProduct.getRequired();//鏍囧噯鍊�
@@ -94,7 +94,7 @@
             inspectionProduct.setTestState(1);
         }
         inspectionProductMapper.updateById(inspectionProduct);
-        return "鎻愪氦鎴愬姛!";
+        return inspectionProduct.getTestState();
     }
 
     //涓婃姤
diff --git a/inspection-server/src/main/resources/mapper/InspectionMapper.xml b/inspection-server/src/main/resources/mapper/InspectionMapper.xml
index e97fc5a..711a5fe 100644
--- a/inspection-server/src/main/resources/mapper/InspectionMapper.xml
+++ b/inspection-server/src/main/resources/mapper/InspectionMapper.xml
@@ -110,7 +110,7 @@
         from lims_laboratory.inspection
         where state = 1
           and type = 0
-          and create_time = #{dayofWeek}
+          and create_time = #{time}
     </select>
 
     <!--鏌ヨ璇ユ棩鏈熺殑鎴愬搧妫�楠屾暟閲�-->
@@ -119,6 +119,64 @@
         from lims_laboratory.inspection
         where state = 1
           and type in (1, 2)
-          and create_time = #{dayofWeek}
+          and create_time = #{time}
+    </select>
+
+    <!--鏌ヨ璇ユ棩鏈熺殑鍘熸潗鏂欏悎鏍兼暟閲�-->
+    <select id="getOkMaterByDay" resultType="java.lang.Long">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type = 0
+          and inspection_status = 1
+          and end_time = #{time}
+    </select>
+
+    <!--鏌ヨ璇ユ棩鏈熺殑鎴愬搧鍚堟牸鏁伴噺-->
+    <select id="getOkFinByDay" resultType="java.lang.Long">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type in (1, 2)
+          and inspection_status = 1
+          and end_time = #{time}
+    </select>
+
+    <!--鏌ヨ璇ユ湀鐨勫師鏉愭枡妫�楠屾暟閲�-->
+    <select id="getMaterByMonth" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type = 0
+          and DATE_FORMAT(create_time, '%Y-%m') = #{monthofYear}
+    </select>
+
+    <!--鏌ヨ璇ユ湀鐨勬垚鍝佹楠屾暟閲�-->
+    <select id="getFinByMonth" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type in (1, 2)
+          and DATE_FORMAT(create_time, '%Y-%m') = #{monthofYear}
+    </select>
+
+    <!--鏌ヨ璇ユ湀鐨勫師鏉愭枡鍚堟牸鐜�-->
+    <select id="getOkMaterByMonth" resultType="java.lang.Long">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type = 0
+          and inspection_status = 1
+          and DATE_FORMAT(end_time, '%Y-%m') = #{monthofYear}
+    </select>
+
+    <!--鏌ヨ璇ユ湀鐨勬垚鍝佸悎鏍肩巼-->
+    <select id="getOkFinByMonth" resultType="java.lang.Long">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type in (1, 2)
+          and inspection_status = 1
+          and DATE_FORMAT(end_time, '%Y-%m') = #{monthofYear}
     </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3