From aac0fb36d6b6762f8f28827be417b6dc97e7e34e Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期一, 13 五月 2024 16:30:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java |   38 +++++++++++++++++++++++++++-----------
 1 files changed, 27 insertions(+), 11 deletions(-)

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 e2b7560..b1d8c72 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
@@ -26,6 +26,7 @@
 import com.yuanchu.mom.exception.ErrorException;
 import com.yuanchu.mom.mapper.*;
 import com.yuanchu.mom.pojo.*;
+import com.yuanchu.mom.service.InformationNotificationService;
 import com.yuanchu.mom.service.InsOrderPlanService;
 import com.yuanchu.mom.service.InsOrderService;
 import com.yuanchu.mom.service.StandardTemplateService;
@@ -93,6 +94,9 @@
 
     @Resource
     private InsProductUserMapper insProductUserMapper;
+
+    @Resource
+    private InformationNotificationService informationNotificationService;
 
     @Override
     public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) {
@@ -255,9 +259,7 @@
                 // 閫氳繃璁㈠崟id鏌ユ壘鎵�鏈夋牱鏈琲d
                 List<Integer> sampleIds = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)).stream().map(InsSample::getId).collect(Collectors.toList());
                 // 閫氳繃妫�鏌ユ瘡涓�涓牱鏈琲d鏌ュ埌灞炰簬妫�楠岄」缁撹 is null鐨勬暟閲�
-                Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()));
-                // is null鐨勬暟閲忎负0鏄皢璁㈠崟鐘舵�佽〃鐨勭姸鎬佹敼涓哄凡妫�楠�
-                List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()));
+                Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()).eq(InsProduct::getState, 1));
                 if (count == 0) {
                     insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate()
                             .eq(InsOrderState::getInsOrderId, orderId)
@@ -563,7 +565,7 @@
                 table.put("tableSize", tables.size() + 1);
             });
             List<Map<String, String>> deviceList = null;
-            if(deviceSet.size()!=0){
+            if (deviceSet.size() != 0) {
                 deviceList = insOrderMapper.selectDeviceList(deviceSet);
             }
             Map<String, String> codeStr = new HashMap<>();
@@ -630,7 +632,7 @@
                 FileInputStream stream = new FileInputStream(path);
                 XWPFDocument document = new XWPFDocument(stream);
                 List<XWPFTable> xwpfTables = document.getTables();
-                for (int i = 1; i < xwpfTables.size() - (deviceList==null?1:2); i++) {
+                for (int i = 1; i < xwpfTables.size() - (deviceList == null ? 1 : 2); i++) {
                     Set<String> set1 = new HashSet<>();
                     Map<String, Map<String, Integer>> maps = new HashMap<>();
                     for (int j = 0; j < xwpfTables.get(i).getRows().size(); j++) {
@@ -660,7 +662,7 @@
                             }
                         }
                     }
-                    maps.forEach((k,v)->{
+                    maps.forEach((k, v) -> {
                     });
                     List<String> list = new ArrayList<>();
                     for (String s : maps.keySet()) {
@@ -669,9 +671,11 @@
                     for (int a = list.size() - 1; a >= 0; a--) {
                         Map<String, Integer> v = maps.get(list.get(a));
                         for (int j = 0; j < v.get("er") - v.get("sr") + 1; j++) {
-                            TableTools.mergeCellsHorizonal(xwpfTables.get(i), v.get("sr") + j, v.get("sc"), v.get("ec"));
+                            if (v.get("ec") > v.get("sc")) {
+                                TableTools.mergeCellsHorizonal(xwpfTables.get(i), v.get("sr") + j, v.get("sc"), v.get("ec"));
+                            }
                         }
-                        if(v.get("er")>v.get("sr")){
+                        if (v.get("er") > v.get("sr")) {
                             TableTools.mergeCellsVertically(xwpfTables.get(i), v.get("sc"), v.get("sr"), v.get("er"));
                         }
                     }
@@ -713,18 +717,30 @@
     }
 
     @Override
-    public int submitPlan(Integer orderId, String laboratory) {
+    public int submitPlan(Integer orderId, String laboratory, Integer verifyUser) {
         List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId));
         List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList());
         List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, ids).eq(InsProduct::getSonLaboratory, laboratory).eq(InsProduct::getState, 1).isNull(InsProduct::getInsResult));
         if (insProducts.size() > 0) {
             String str = "";
             for (InsProduct product : insProducts) {
-                str += product.getInspectionItem() + product.getInspectionItemSubclass() + "锛�";
+                str += product.getInspectionItem() + " " + product.getInspectionItemSubclass() + "锛�";
             }
             throw new ErrorException("浠ヤ笅鏄湭妫�楠岀殑椤圭洰锛�" + str);
         }
-        insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, LocalDateTime.now()).set(InsOrderState::getInsState, 3));
+        insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, LocalDateTime.now()).set(InsOrderState::getInsState, 3).set(InsOrderState::getVerifyUser, verifyUser));
+        Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
+        InformationNotification info = new InformationNotification();
+        info.setCreateUser(insProductMapper.selectUserById(userId).get("name"));
+        info.setMessageType("2");
+        info.setTheme("澶嶆牳閫氱煡");
+        info.setContent("鎮ㄦ湁涓�鏉℃楠屼换鍔″緟澶嶆牳娑堟伅");
+        info.setSenderId(userId);
+        info.setConsigneeId(verifyUser);
+        info.setViewStatus(false);
+        info.setJumpPath("b1-inspect-order-plan");
+        informationNotificationService.addInformationNotification(info);
+        upPlanUser(userId, orderId);
         return 1;
     }
 

--
Gitblit v1.9.3