From 06d7422f44d0c3103dd00e360e9a4362817b3e59 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期六, 12 七月 2025 14:59:52 +0800
Subject: [PATCH] art: 技术状态鉴定工单-审批接口优化

---
 db/ZHR/dict_zhr.sql                                                                                                |    4 +-
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationOrderController.java    |    3 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java |   78 ++++++++++++++++++++++++++++++---------
 3 files changed, 65 insertions(+), 20 deletions(-)

diff --git a/db/ZHR/dict_zhr.sql b/db/ZHR/dict_zhr.sql
index a0513a2..86d71cd 100644
--- a/db/ZHR/dict_zhr.sql
+++ b/db/ZHR/dict_zhr.sql
@@ -10,11 +10,11 @@
 INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943282588527325186', N'1943282255763828737', N'缁翠慨瀹や富浠荤瀛椾腑', N'REPAIR_MANAGER_SIGNING', '', 4, 1, N'admin', '2025-07-10 20:14:08.2040000', NULL, NULL);
 INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943282688888631297', N'1943282255763828737', N'宸ヨ壓鍛樼瀛椾腑', N'PROCESS_TECHNICIAN_SIGNING', '', 5, 1, N'admin', '2025-07-10 20:14:32.1330000', NULL, NULL);
 INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943282764902002689', N'1943282255763828737', N'浣跨敤鍗曚綅鎶�鏈富绠$瀛椾腑', N'DEPART_TECHNICAL_LEADER_SIGNING', '', 6, 1, N'admin', '2025-07-10 20:14:50.2570000', NULL, NULL);
-INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943282836200976386', N'1943282255763828737', N'INSPECTOR_SIGNING', N'璁惧妫�楠屽憳绛惧瓧涓�', '', 7, 1, N'admin', '2025-07-10 20:15:07.2550000', NULL, NULL);
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943282836200976386', N'1943282255763828737', N'璁惧妫�楠屽憳绛惧瓧涓�', N'INSPECTOR_SIGNING', '', 7, 1, N'admin', '2025-07-10 20:15:07.2550000', NULL, NULL);
 INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943282897358123009', N'1943282255763828737', N'宸插畬鎴�', N'COMPLETED', '', 8, 1, N'admin', '2025-07-10 20:15:21.8360000', NULL, NULL);
 INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943282982930313218', N'1943282255763828737', N'宸查攣瀹�', N'LOCKED', '', 9, 1, N'admin', '2025-07-10 20:15:42.2430000', NULL, NULL);
 INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943283076018696194', N'1943282255763828737', N'鍙樻洿涓�', N'CHANGING', '', 10, 1, N'admin', '2025-07-10 20:16:04.4340000', NULL, NULL);
-INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943283135447789569', N'1943282255763828737', N'EXPIRED', N'宸茶繃鏈�', '', 11, 1, N'admin', '2025-07-10 20:16:18.6020000', NULL, NULL);
+INSERT INTO [dbo].[sys_dict_item] ([id], [dict_id], [item_text], [item_value], [description], [sort_order], [status], [create_by], [create_time], [update_by], [update_time]) VALUES (N'1943283135447789569', N'1943282255763828737', N'宸茶繃鏈�', N'EXPIRED', '', 11, 1, N'admin', '2025-07-10 20:16:18.6020000', NULL, NULL);
 
 --鎶�鏈姸鎬佹鏌ラ」鍒嗙被
 delete from [dbo].[sys_dict_item] where dict_id in (select id from [dbo].[sys_dict] where dict_code='technical_status_evaluation_check_category');
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationOrderController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationOrderController.java
index 24948b2..b187777 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationOrderController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationOrderController.java
@@ -101,6 +101,9 @@
         if (request == null) {
             return Result.error("瀹℃壒鐨勫璞′笉鑳戒负绌猴紒");
         }
+        if(CollectionUtil.isEmpty(request.getTableDetailList())) {
+            return Result.error("妫�鏌ユ槑缁嗕俊鎭负绌猴紒");
+        }
         // 妫�鏌ヨ姹傚弬鏁�
         if (StrUtil.isBlank(request.getTaskId()) || StrUtil.isBlank(request.getDataId()) || StrUtil.isBlank(request.getInstanceId())) {
             return Result.error("瀹℃壒浠诲姟閿欒鎴栦笉瀛樺湪锛�");
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java
index 2734f62..f64b5b6 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java
@@ -8,6 +8,7 @@
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import liquibase.pro.packaged.E;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.flowable.engine.TaskService;
@@ -367,13 +368,18 @@
                         }
                     } else {
                         //瀹夊叏瑁呯疆妫�鏌ョ粨鏋滃~鎶�
-                        if (CollectionUtil.isNotEmpty(request.getTableDetailList())) {
-                            for (EamTechnicalStatusEvaluationOrderDetail detail : request.getTableDetailList()) {
-                                detail.setRepairmanSignature(user.getUsername());
-                                detail.setRepairmanSignatureTime(new Date());
-                            }
-                            orderDetailService.updateBatchById(request.getTableDetailList());
+                        List<EamTechnicalStatusEvaluationOrderDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                        if(CollectionUtil.isEmpty(collect)) {
+                            throw new JeecgBootException("瀹夊叏瑁呯疆妫�鏌ラ」鏄庣粏涓虹┖锛�");
                         }
+                        //缁撴灉椤规鏌�
+                        checkDetailResult(request.getTableDetailList(), TechnicalStatusEvaluationCheckCategoryEnum.SAFETY_EQUIPMENT_CHECK);
+                        //娣诲姞鎿嶄綔浜轰俊鎭�
+                        for (EamTechnicalStatusEvaluationOrderDetail detail : collect) {
+                            detail.setRepairmanSignature(user.getUsername());
+                            detail.setRepairmanSignatureTime(new Date());
+                        }
+                        orderDetailService.updateBatchById(collect);
                         values.put("NextAssignee", userApprovalList);
                         entity.setSafetyCheckCompleted(CommonConstant.STATUS_1);
                     }
@@ -394,13 +400,18 @@
                         }
                     } else {
                         //璁惧绮惧害妫�鏌ョ粨鏋滃~鎶�
-                        if (CollectionUtil.isNotEmpty(request.getTableDetailList())) {
-                            for (EamTechnicalStatusEvaluationOrderDetail detail : request.getTableDetailList()) {
-                                detail.setRepairmanSignature(user.getUsername());
-                                detail.setRepairmanSignatureTime(new Date());
-                            }
-                            orderDetailService.updateBatchById(request.getTableDetailList());
+                        List<EamTechnicalStatusEvaluationOrderDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                        if(CollectionUtil.isEmpty(collect)) {
+                            throw new JeecgBootException("璁惧绮惧害妫�鏌ラ」鏄庣粏涓虹┖锛�");
                         }
+                        //缁撴灉椤规鏌�
+                        checkDetailResult(request.getTableDetailList(), TechnicalStatusEvaluationCheckCategoryEnum.PRECISION_CHECK);
+                        //娣诲姞鎿嶄綔浜轰俊鎭�
+                        for (EamTechnicalStatusEvaluationOrderDetail detail : collect) {
+                            detail.setRepairmanSignature(user.getUsername());
+                            detail.setRepairmanSignatureTime(new Date());
+                        }
+                        orderDetailService.updateBatchById(collect);
                         values.put("NextAssignee", userApprovalList);
                         entity.setPrecisionCheckCompleted(CommonConstant.STATUS_1);
                     }
@@ -422,13 +433,20 @@
                         }
                     } else {
                         //鍏朵粬妫�鏌ョ粨鏋滃~鎶�
-                        if (CollectionUtil.isNotEmpty(request.getTableDetailList())) {
-                            for (EamTechnicalStatusEvaluationOrderDetail detail : request.getTableDetailList()) {
-                                detail.setRepairmanSignature(user.getUsername());
-                                detail.setRepairmanSignatureTime(new Date());
-                            }
-                            orderDetailService.updateBatchById(request.getTableDetailList());
+                        List<EamTechnicalStatusEvaluationOrderDetail> collect = request.getTableDetailList().stream().filter(item -> TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK.name().equals(item.getCheckCategory())).collect(Collectors.toList());
+                        if(CollectionUtil.isEmpty(collect)) {
+                            throw new JeecgBootException("鍏朵粬妫�鏌ラ」鏄庣粏涓虹┖锛�");
                         }
+                        //缁撴灉椤规鏌�
+                        checkDetailResult(request.getTableDetailList(), TechnicalStatusEvaluationCheckCategoryEnum.OTHER_CHECK);
+                        //娣诲姞鎿嶄綔浜轰俊鎭�
+                        for (EamTechnicalStatusEvaluationOrderDetail detail : collect) {
+                            detail.setRepairmanSignature(user.getUsername());
+                            detail.setRepairmanSignatureTime(new Date());
+                        }
+                        orderDetailService.updateBatchById(collect);
+                        values.put("NextAssignee", userApprovalList);
+                        entity.setPrecisionCheckCompleted(CommonConstant.STATUS_1);
                         values.put("NextAssignee", userApprovalList);
                         entity.setOtherCheckCompleted(CommonConstant.STATUS_1);
                     }
@@ -553,6 +571,30 @@
         return entity;
     }
 
+    private void checkDetailResult(List<EamTechnicalStatusEvaluationOrderDetail> detailList, TechnicalStatusEvaluationCheckCategoryEnum checkCategory) {
+        boolean b;
+        switch (checkCategory) {
+            case SAFETY_EQUIPMENT_CHECK:
+                b = detailList.stream().allMatch(item -> StringUtils.isNotBlank(item.getSafetyEquipmentCheckResult()));
+                if(!b) {
+                    throw new JeecgBootException("鏈夊畨鍏ㄨ缃鏌ョ粨鏋滄湭濉啓锛�");
+                }
+                break;
+            case PRECISION_CHECK:
+                b = detailList.stream().allMatch(item -> item.getPrecisionCheckResult() != null);
+                if(!b) {
+                    throw new JeecgBootException("鏈夎澶囩簿搴︽鏌ョ粨鏋滄湭濉啓锛�");
+                }
+                break;
+            case OTHER_CHECK:
+                b = detailList.stream().allMatch(item -> StringUtils.isNotBlank(item.getOtherCheckResult()));
+                if(!b) {
+                    throw new JeecgBootException("鏈夊叾浠栨鏌ョ粨鏋滄湭濉啓锛�");
+                }
+                break;
+        }
+    }
+
     @Override
     public void afterFlowHandle(FlowMyBusiness business) {
         business.getTaskNameId();//鎺ヤ笅鏉ュ鎵圭殑鑺傜偣

--
Gitblit v1.9.3