From 3625accd261feb99a6927013d7551a08d68c756e Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 19 九月 2023 15:01:58 +0800
Subject: [PATCH] 修改   9.19

---
 inspect-server/src/main/resources/mapper/FinishedInspectMapper.xml                          |    6 +
 inspect-server/src/main/resources/mapper/RawInspectMapper.xml                               |    8 ++
 inspect-server/src/main/java/com/yuanchu/mom/mapper/ProcessInspectMapper.java               |    3 
 inventory-server/src/main/java/com/yuanchu/mom/pojo/Sale.java                               |    5 
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/InspectUnacceptedServiceImpl.java |    3 
 system-run/src/main/resources/application-dev.yml                                           |    6 
 inspect-server/src/main/java/com/yuanchu/mom/mapper/FinishedInspectMapper.java              |    3 
 inspect-server/src/main/resources/mapper/InspectionItemMapper.xml                           |   30 +++++++
 inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInspectMapper.java                   |    4 +
 inspect-server/src/main/java/com/yuanchu/mom/mapper/InspectionItemMapper.java               |    3 
 inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInsProductMapper.java                |    2 
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java           |   80 +++++++++++++++++--
 inspect-server/src/main/resources/mapper/ProcessInspectMapper.xml                           |    5 +
 inspect-server/src/main/resources/mapper/RawInsProductMapper.xml                            |   30 +++++++
 14 files changed, 172 insertions(+), 16 deletions(-)

diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/FinishedInspectMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/FinishedInspectMapper.java
index 20e1362..74f011f 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/FinishedInspectMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/FinishedInspectMapper.java
@@ -26,4 +26,7 @@
 
     //鏍规嵁妫�楠屽崟id鏌ヨ鎴愬搧妫�楠屽崟璇︽儏
     List<Map<String, Object>> selectFinishInspectsListById(Integer id);
+
+    //娓呯┖妫�楠岀姸鎬�
+    void updById(Integer rawInspectId);
 }
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/InspectionItemMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/InspectionItemMapper.java
index 0871763..f0305f9 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/InspectionItemMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/InspectionItemMapper.java
@@ -24,4 +24,7 @@
     List<InspectionItemDto> selectInspectionItem(Integer id, Integer type);
 
 
+    //鎵归噺淇敼,鎶婂師鏈夌殑妫�楠岄」鐩殑鏁版嵁娓呯┖
+    void updateBatch(List<InspectionItem> inspectionItems);
+
 }
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/ProcessInspectMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/ProcessInspectMapper.java
index c986c40..c3dd81e 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/ProcessInspectMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/ProcessInspectMapper.java
@@ -24,5 +24,8 @@
 
     //鍒嗛〉鏌ヨ杩囩▼妫�楠屽崟鍒楄〃
     IPage<Map<String, Object>> selectProcessInspectsList(Page<Object> page, String techfather, Integer result, String name);
+
+    //灏嗘楠岀姸鎬佷慨鏀逛负null
+    void updById(Integer rawInspectId);
 }
 
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInsProductMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInsProductMapper.java
index 5a34469..1b9dc7f 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInsProductMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInsProductMapper.java
@@ -20,5 +20,7 @@
     List<Integer> getresult(Integer id);
 
 
+    //鎵归噺娓呯┖妫�楠屽��
+    void updateBatch(List<RawInsProduct> rawInsProductList);
 }
 
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInspectMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInspectMapper.java
index 9e52a9b..ded3510 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInspectMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInspectMapper.java
@@ -29,6 +29,10 @@
     //鏍规嵁鍘熸潗鏂欐楠屽崟id鏌ョ湅璇︽儏
     Map<String, Object> selectRawInspectsListById(Integer id);
 
+    //娓呯┖妫�楠岀粨璁�
+    void updById(Integer rawInspectId);
+
+
 }
 
 
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InspectUnacceptedServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InspectUnacceptedServiceImpl.java
index 3953455..1146807 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InspectUnacceptedServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InspectUnacceptedServiceImpl.java
@@ -63,8 +63,7 @@
     public Integer rawEvaluate(Integer rawId, Integer passOrNo) {
         LambdaUpdateWrapper<InspectUnaccepted> updateWrapper = Wrappers.<InspectUnaccepted>lambdaUpdate()
                 .eq(InspectUnaccepted::getId, rawId)
-                .set(InspectUnaccepted::getDealReasult, passOrNo)
-                .set(InspectUnaccepted::getDealState, 1);
+                .set(InspectUnaccepted::getDealReasult, passOrNo);
         //濡傛灉鏄瘎瀹′笉閫氳繃鍒欐柊澧炰笉鍚堟牸澶勭悊鎰忚琛�
         if (passOrNo==0) {
             List<Opinion> opinions = new ArrayList<>();
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java
index f56d37a..69fd347 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java
@@ -1,18 +1,13 @@
 package com.yuanchu.mom.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.yuanchu.mom.pojo.InspectUnaccepted;
-import com.yuanchu.mom.pojo.Opinion;
-import com.yuanchu.mom.mapper.OpinionMapper;
+import com.yuanchu.mom.mapper.*;
+import com.yuanchu.mom.pojo.*;
 import com.yuanchu.mom.pojo.dto.UpdateInspectUnacceptedDto;
-import com.yuanchu.mom.service.InspectUnacceptedService;
 import com.yuanchu.mom.service.OpinionService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yuanchu.mom.utils.JackSonUtil;
-import com.yuanchu.mom.utils.MyUtil;
+import com.yuanchu.mom.vo.Result;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -20,6 +15,8 @@
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * <p>
@@ -34,6 +31,24 @@
 
     @Resource
     private OpinionMapper opinionMapper;
+
+    @Resource
+    InspectUnacceptedMapper inspectUnacceptedMapper;
+
+    @Resource
+    RawInspectMapper rawInspectMapper;
+
+    @Resource
+    ProcessInspectMapper processInspectMapper;
+
+    @Resource
+    FinishedInspectMapper finishedInspectMapper;
+
+    @Resource
+    InspectionItemMapper inspectionItemMapper;
+
+    @Resource
+    RawInsProductMapper rawInsProductMapper;
 
 
     @Override
@@ -53,20 +68,67 @@
         return mapList;
     }
 
+    //缂栬緫鎰忚
     @Override
     public Integer updateOpinion(String id, List<?> opinion) {
         List<Opinion> list = new ArrayList<>();
+        AtomicInteger a= new AtomicInteger();
+        AtomicInteger unId= new AtomicInteger();
         opinion.forEach(i -> {
             try {
                 Opinion unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(i), Opinion.class);
                 unmarshal.setUserId(Integer.valueOf(id));
                 unmarshal.setFillDate(new Date());
                 list.add(unmarshal);
+                //璁板綍澶勭悊鐨勬柟寮忎负杩斾慨鐨勬鏁�
+                if (unmarshal.getWay()==1){
+                    a.getAndIncrement();
+                }
+                //璁板綍杩欎釜澶勭悊鎰忚鍏宠仈鐨勪笉鍚堟牸璁㈠崟id
+                unId.set(opinionMapper.selectById(unmarshal.getId()).getRawUnacceptedId());
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
         });
-        return opinionMapper.updateOpinion(list);
+        //缂栬緫鎰忚涔嬪悗濮滃鐞嗙姸鎬佷慨鏀逛负1宸插鐞�
+        InspectUnaccepted inspectUnaccepted = inspectUnacceptedMapper.selectById(unId.get());
+        inspectUnaccepted.setDealState(1);
+        inspectUnacceptedMapper.updateById(inspectUnaccepted);
+        //濡傛灉鍏ㄩ儴閮芥槸杩斾慨鍒欒繑鍥炴楠�,灏嗘楠岀姸鎬佹竻绌�
+        if (a.get()==opinion.size()){
+            switch (inspectUnaccepted.getType()){
+                case 1:
+                    //鎴愬搧妫�楠屽崟
+                    finishedInspectMapper.updById(inspectUnaccepted.getRawInspectId());
+                    //鎴愬搧妫�楠岄」鐩�
+                    List<InspectionItem> inspectionItemList = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query()
+                            .eq("type", 2)
+                            .eq("inspect_id", inspectUnaccepted.getRawInspectId()));
+                    inspectionItemMapper.updateBatch(inspectionItemList);
+                    break;
+                case 2:
+                    //杩囩▼妫�楠屽崟
+                    processInspectMapper.updById(inspectUnaccepted.getRawInspectId());
+                    //杩囩▼妫�楠岄」鐩�
+                    List<InspectionItem> inspectionItems = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query()
+                            .eq("type", 1)
+                            .eq("inspect_id", inspectUnaccepted.getRawInspectId()));
+                    inspectionItemMapper.updateBatch(inspectionItems);
+                    break;
+                case 0:
+                    //鍘熸潗鏂欐楠屽崟
+                    rawInspectMapper.updById(inspectUnaccepted.getRawInspectId());
+                    //鍘熸潗鏂欐楠岄」鐩�
+                    List<RawInsProduct> rawInsProductList = rawInsProductMapper.selectList(Wrappers.<RawInsProduct>query()
+                            .eq("raw_inspect_id", inspectUnaccepted.getRawInspectId()));
+                    rawInsProductMapper.updateBatch(rawInsProductList);
+                    break;
+                default:
+                    break;
+            }
+        }
+        //鏇存柊鎰忚
+        return  opinionMapper.updateOpinion(list);
     }
 
     @Override
diff --git a/inspect-server/src/main/resources/mapper/FinishedInspectMapper.xml b/inspect-server/src/main/resources/mapper/FinishedInspectMapper.xml
index 5f5ea10..1030be2 100644
--- a/inspect-server/src/main/resources/mapper/FinishedInspectMapper.xml
+++ b/inspect-server/src/main/resources/mapper/FinishedInspectMapper.xml
@@ -1,6 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yuanchu.mom.mapper.FinishedInspectMapper">
+    <!--娓呯┖妫�楠岀姸鎬�-->
+    <update id="updById">
+        update mom_ocean.finished_inspect
+        set result=null
+        where id = #{rawInspectId}
+    </update>
     <select id="selectFinishedInspectPage" resultType="map">
         SELECT f.`id`,
         f.`order_number`,
diff --git a/inspect-server/src/main/resources/mapper/InspectionItemMapper.xml b/inspect-server/src/main/resources/mapper/InspectionItemMapper.xml
index 496cdf2..9008f43 100644
--- a/inspect-server/src/main/resources/mapper/InspectionItemMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InspectionItemMapper.xml
@@ -1,6 +1,36 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yuanchu.mom.mapper.InspectionItemMapper">
+    <!--鎶婂師鏈夌殑妫�楠岄」鐩殑鏁版嵁娓呯┖-->
+    <update id="updateBatch">
+        UPDATE mom_ocean.inspection_item o
+        <trim prefix="set" suffixOverrides=",">
+            <trim prefix="inspection_value=case" suffix="end,">
+                <foreach collection="inspectionItems" item="item" index="index">
+                    WHEN o.id = #{item.id} THEN null
+                </foreach>
+            </trim>
+            <trim prefix="device_id=case" suffix="end,">
+                <foreach collection="inspectionItems" item="item" index="index">
+                    WHEN o.id = #{item.id} THEN null
+                </foreach>
+            </trim>
+            <trim prefix="result=case" suffix="end,">
+                <foreach collection="inspectionItems" item="item" index="index">
+                    WHEN o.id = #{item.id} THEN null
+                </foreach>
+            </trim>
+            <trim prefix="username=case" suffix="end,">
+                <foreach collection="inspectionItems" item="item" index="index">
+                    WHEN o.id = #{item.id} THEN null
+                </foreach>
+            </trim>
+        </trim>
+        WHERE o.id in
+        <foreach collection="inspectionItems" index="index" item="item" separator="," open="(" close=")">
+            #{item.id, jdbcType=BIGINT}
+        </foreach>
+    </update>
     <resultMap id="selectInspectionItemMap" type="inspectionItemDto">
         <id property="father" column="ifather"/>
         <association property="children" resultMap="selectInspectionItemDto2Map"/>
diff --git a/inspect-server/src/main/resources/mapper/ProcessInspectMapper.xml b/inspect-server/src/main/resources/mapper/ProcessInspectMapper.xml
index e18c187..1ec0742 100644
--- a/inspect-server/src/main/resources/mapper/ProcessInspectMapper.xml
+++ b/inspect-server/src/main/resources/mapper/ProcessInspectMapper.xml
@@ -1,6 +1,11 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.yuanchu.mom.mapper.ProcessInspectMapper">
+
+    <!--灏嗘楠岀姸鎬佷慨鏀逛负null-->
+    <update id="updById">
+        update mom_ocean.process_inspect set result=null where id=#{rawInspectId}
+    </update>
     <!--鏂板杩囩▼妫�楠屽崟-鏍规嵁璁㈠崟鍙烽�夋嫨浜у搧淇℃伅鍜屽伐鑹�-->
     <resultMap id="oneMap" type="map">
         <id property="name" column="material"/>
diff --git a/inspect-server/src/main/resources/mapper/RawInsProductMapper.xml b/inspect-server/src/main/resources/mapper/RawInsProductMapper.xml
index 3c9a5d9..b21cdb4 100644
--- a/inspect-server/src/main/resources/mapper/RawInsProductMapper.xml
+++ b/inspect-server/src/main/resources/mapper/RawInsProductMapper.xml
@@ -1,6 +1,36 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.yuanchu.mom.mapper.RawInsProductMapper">
+    <!--鎵归噺娓呯┖妫�楠岀姸鎬�-->
+    <update id="updateBatch">
+        UPDATE mom_ocean.raw_ins_product o
+        <trim prefix="set" suffixOverrides=",">
+            <trim prefix="test_value=case" suffix="end,">
+                <foreach collection="rawInsProductList" item="item" index="index">
+                    WHEN o.id = #{item.id} THEN null
+                </foreach>
+            </trim>
+            <trim prefix="device_id=case" suffix="end,">
+                <foreach collection="rawInsProductList" item="item" index="index">
+                    WHEN o.id = #{item.id} THEN null
+                </foreach>
+            </trim>
+            <trim prefix="test_state=case" suffix="end,">
+                <foreach collection="rawInsProductList" item="item" index="index">
+                    WHEN o.id = #{item.id} THEN null
+                </foreach>
+            </trim>
+            <trim prefix="user_id=case" suffix="end,">
+                <foreach collection="rawInsProductList" item="item" index="index">
+                    WHEN o.id = #{item.id} THEN null
+                </foreach>
+            </trim>
+        </trim>
+        WHERE o.id in
+        <foreach collection="rawInsProductList" index="index" item="item" separator="," open="(" close=")">
+            #{item.id, jdbcType=BIGINT}
+        </foreach>
+    </update>
     <!--鏍规嵁鍘熸潗鏂欐楠屽崟id鏌ヨ妫�楠岄」鐩�-->
     <select id="getresult" resultType="java.lang.Integer">
         select test_state
diff --git a/inspect-server/src/main/resources/mapper/RawInspectMapper.xml b/inspect-server/src/main/resources/mapper/RawInspectMapper.xml
index 985266e..b6f7a8c 100644
--- a/inspect-server/src/main/resources/mapper/RawInspectMapper.xml
+++ b/inspect-server/src/main/resources/mapper/RawInspectMapper.xml
@@ -3,6 +3,14 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yuanchu.mom.mapper.RawInspectMapper">
+    <!--娓呯┖鍘熸潗鏂欐楠岀粨璁�-->
+    <update id="updById">
+        update mom_ocean.raw_inspect
+        set ins_state=0,
+            ins_time=null,
+            judge_state=null
+        where id = #{rawInspectId}
+    </update>
     <select id="selCountRaw" resultType="java.lang.Integer">
         select count(id)
         from mom_ocean.raw_inspect
diff --git a/inventory-server/src/main/java/com/yuanchu/mom/pojo/Sale.java b/inventory-server/src/main/java/com/yuanchu/mom/pojo/Sale.java
index a890fe4..dbe6b3c 100644
--- a/inventory-server/src/main/java/com/yuanchu/mom/pojo/Sale.java
+++ b/inventory-server/src/main/java/com/yuanchu/mom/pojo/Sale.java
@@ -87,9 +87,10 @@
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date updateTime;
 
-    @ApiModelProperty(value = "鐘舵�� 0:涓嶉�氳繃;1:閫氳繃")
+    @ApiModelProperty(value = "鐘舵�� 0:涓嶉�氳繃;1:閫氳繃;2:鏈鏍�")
     private Integer type;
 
-
+    @ApiModelProperty(value = "澶囨敞")
+    private String note;
 
 }
diff --git a/system-run/src/main/resources/application-dev.yml b/system-run/src/main/resources/application-dev.yml
index ecbb862..3f5b47d 100644
--- a/system-run/src/main/resources/application-dev.yml
+++ b/system-run/src/main/resources/application-dev.yml
@@ -34,7 +34,7 @@
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
     driverClassName: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://192.168.0.22:3306/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
+    url: jdbc:mysql://114.132.189.42:9004/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
     username: user
     password: 123456
     druid:
@@ -59,9 +59,9 @@
     # redis鏁版嵁搴撶储寮�(榛樿涓�0)锛屾垜浠娇鐢ㄧ储寮曚负3鐨勬暟鎹簱锛岄伩鍏嶅拰鍏朵粬鏁版嵁搴撳啿绐�
     database: 0
     # redis鏈嶅姟鍣ㄥ湴鍧�锛堥粯璁や负localhost锛�
-    host: 192.168.0.22
+    host: 114.132.189.42
     # redis绔彛锛堥粯璁や负6379锛�
-    port: 6379
+    port: 9003
     # redis璁块棶瀵嗙爜锛堥粯璁や负绌猴級
     password: null
     # redis杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶆绉掞級

--
Gitblit v1.9.3