From d073e531919d945344ae37b2df0737f245e345d3 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期五, 11 七月 2025 11:39:04 +0800
Subject: [PATCH] art: 工单信息转译

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationOrderServiceImpl.java |   50 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 40 insertions(+), 10 deletions(-)

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 65c5bd8..7125c4e 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
@@ -11,6 +11,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.flowable.engine.TaskService;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.constant.DataBaseConstant;
 import org.jeecg.common.exception.JeecgBootException;
@@ -40,6 +41,7 @@
 import org.jeecg.modules.system.service.IBaseFactoryUserService;
 import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
 import org.jeecg.modules.system.service.ISysUserService;
+import org.jeecg.modules.system.vo.UserSelector;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -220,6 +222,10 @@
         if (!TechnicalStatusEvaluationOrderStatusEnum.WAIT_EVALUATION.name().equals(entity.getEvaluationStatus())) {
             throw new JeecgBootException("璇ュ伐鍗曞凡杩涜杩囬鍙栵紒");
         }
+        EamTechnicalStatusEvaluationStandard standard = standardService.getById(entity.getStandardId());
+        if(standard == null) {
+            throw new JeecgBootException("璁惧淇濆吇鏍囧噯涓嶅瓨鍦紝璇锋鏌ワ紒");
+        }
         EamEquipment equipment = equipmentService.getById(entity.getEquipmentId());
         if (equipment == null) {
             throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�");
@@ -228,6 +234,11 @@
         if(sysUser == null) {
             throw new JeecgBootException("涓嶆槸缁翠慨宸ワ紝鏃犳硶棰嗗彇姝ゅ伐鍗曪紒");
         }
+        List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002);
+        if (CollectionUtil.isEmpty(userSelectors)) {
+            throw new JeecgBootException("璁惧鏈垎閰嶇粰缁翠慨宸ワ紝鏃犳硶棰嗗彇锛�");
+        }
+        List<String> userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
         entity.setEvaluator(sysUser.getUsername());
         entity.setEvaluationStatus(TechnicalStatusEvaluationOrderStatusEnum.UNDER_EVALUATION.name());
         entity.setActualStartTime(new Date());
@@ -245,16 +256,35 @@
             variables.put("organization", entity.getRemark());
             variables.put("comment", entity.getRemark());
         }
-//        variables.put("proofreading", true);
-//        List<String> usernames = new ArrayList<>();
-//        usernames.add(entity.getOperator());
-//        variables.put("NextAssignee", usernames);
-//        Result result = flowDefinitionService.startProcessInstanceByKey("second_maintenance_process", variables);
-//        if (result != null) {
-//            //鏇存柊璁惧淇濆吇鐘舵��
-//            eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_SECOND_MAINTENANCE.name());
-//            return result.isSuccess();
-//        }
+        variables.put("proofreading", true);
+        if(CommonConstant.STATUS_1.equals(standard.getHasSafetyEquipmentCheck())) {
+            variables.put("hasSafetyEquipmentCheck", CommonConstant.STATUS_1);
+            variables.put("safety_equipment_check", userApprovalList);
+            entity.setSafetyCheckCompleted(CommonConstant.STATUS_0);
+        } else {
+            variables.put("hasSafetyEquipmentCheck", CommonConstant.STATUS_0);
+            variables.put("safety_equipment_check", userApprovalList);
+        }
+        if(CommonConstant.STATUS_1.equals(standard.getHasPrecisionCheck())) {
+            variables.put("hasPrecisionCheck", CommonConstant.STATUS_1);
+            variables.put("equipment_precision_check", userApprovalList);
+            entity.setPrecisionCheckCompleted(CommonConstant.STATUS_0);
+        } else {
+            variables.put("hasPrecisionCheck", CommonConstant.STATUS_0);
+            variables.put("equipment_precision_check", userApprovalList);
+        }
+        if(CommonConstant.STATUS_1.equals(standard.getHasOtherCheck())) {
+            variables.put("hasOtherCheck", CommonConstant.STATUS_1);
+            variables.put("other_check", userApprovalList);
+            entity.setOtherCheckCompleted(CommonConstant.STATUS_0);
+        } else {
+            variables.put("hasOtherCheck ", CommonConstant.STATUS_0);
+            variables.put("other_check", userApprovalList);
+        }
+        Result<?> result = flowDefinitionService.startProcessInstanceByKey("technical_status_evaluation_process", variables);
+        if(result == null || !result.isSuccess()) {
+            throw new JeecgBootException("鍚姩娴佺▼澶辫触锛岄鍙栧け璐�");
+        }
         return true;
     }
 

--
Gitblit v1.9.3