From 57945f688fd21076e36ab5332028c8b4a6dcf59c Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期四, 04 九月 2025 16:37:31 +0800
Subject: [PATCH] 同步密网设备管理代码

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java |  112 +++++++++++++++++++++++++++-----------------------------
 1 files changed, 54 insertions(+), 58 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java
index 74d7f13..86a24d7 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java
@@ -171,32 +171,28 @@
         }
         //鍒ゆ柇鏄惁瀛樺湪淇濆吇浜� 濡傛灉瀛樺湪鍒欏惎鍔ㄦ祦绋�
         if (StringUtils.isNotBlank(order.getOperator())) {
-            //鍚姩娴佺▼ TODO
-//            flowCommonService.initActBusiness("宸ュ崟鍙�:" + order.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";杩涜璁惧浜屼繚",
-//                    order.getId(), "IEamWeekMaintenanceOrderService", "week_maintenance_process", null);
-//            Map<String, Object> variables = new HashMap<>();
-//            variables.put("dataId", order.getId());
-//            if (StrUtil.isEmpty(order.getRemark())) {
-//                variables.put("organization", "鏂板鍛ㄤ繚宸ュ崟榛樿鍚姩娴佺▼");
-//                variables.put("comment", "鏂板鍛ㄤ繚宸ュ崟榛樿鍚姩娴佺▼");
-//            } else {
-//                variables.put("organization", order.getRemark());
-//                variables.put("comment", order.getRemark());
-//            }
-//            variables.put("proofreading", true);
-//            List<String> usernames = new ArrayList<>();
-//            usernames.add(order.getOperator());
-//            variables.put("NextAssignee", usernames);
-//            Result result = flowDefinitionService.startProcessInstanceByKey("week_maintenance_process", variables);
-//            if (result != null) {
-//                //鏇存柊鍛ㄤ繚鐘舵��
-//                order.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name());
-//                order.setActualStartTime(new Date());
-//                eamWeekMaintenanceOrderMapper.updateById(order);
-//                //鏇存柊璁惧淇濆吇鐘舵��
-//                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name());
-//                return result.isSuccess();
-//            }
+            //鍚姩娴佺▼
+            flowCommonService.initActBusiness("宸ュ崟鍙�:" + order.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";瀹夎浣嶇疆" + equipment.getInstallationPosition(),
+                    order.getId(), "IEamThirdMaintenanceOrderService", "third_maintenance_process", null);
+            Map<String, Object> variables = new HashMap<>();
+            variables.put("dataId", order.getId());
+            if (StrUtil.isEmpty(order.getRemark())) {
+                variables.put("organization", "鏂板涓変繚宸ュ崟榛樿鍚姩娴佺▼");
+                variables.put("comment", "鏂板涓変繚宸ュ崟榛樿鍚姩娴佺▼");
+            } else {
+                variables.put("organization", order.getRemark());
+                variables.put("comment", order.getRemark());
+            }
+            variables.put("proofreading", true);
+            //骞惰浠诲姟浼氱
+            variables.put("maintenance_execution", Collections.singletonList(request.getOperator()));
+            variables.put("precision_check", Collections.singletonList(equipment.getEquipmentManager()));
+            Result result = flowDefinitionService.startProcessInstanceByKey("third_maintenance_process", variables);
+            if (result != null) {
+                //鏇存柊璁惧淇濆吇鐘舵��
+                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_THIRD_MAINTENANCE.name());
+                return result.isSuccess();
+            }
         }
 
         return true;
@@ -246,32 +242,28 @@
         }
         //鍒ゆ柇鏄惁瀛樺湪淇濆吇浜� 濡傛灉瀛樺湪鍒欏惎鍔ㄦ祦绋�
         if (StringUtils.isNotBlank(entity.getOperator())) {
-            //鍚姩娴佺▼ TODO
-//            flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";杩涜璁惧鍛ㄤ繚",
-//                    entity.getId(), "IEamWeekMaintenanceOrderService", "week_maintenance_process", null);
-//            Map<String, Object> variables = new HashMap<>();
-//            variables.put("dataId", entity.getId());
-//            if (StrUtil.isEmpty(entity.getRemark())) {
-//                variables.put("organization", "鏂板鍛ㄤ繚宸ュ崟榛樿鍚姩娴佺▼");
-//                variables.put("comment", "鏂板鍛ㄤ繚宸ュ崟榛樿鍚姩娴佺▼");
-//            } else {
-//                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("week_maintenance_process", variables);
-//            if (result != null) {
-//                //鏇存柊鍛ㄤ繚鐘舵��
-//                entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name());
-//                entity.setActualStartTime(new Date());
-//                eamWeekMaintenanceOrderMapper.updateById(entity);
-//                //鏇存柊璁惧淇濆吇鐘舵��
-//                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name());
-//                return result.isSuccess();
-//            }
+            //鍚姩娴佺▼
+            flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";瀹夎浣嶇疆" + equipment.getInstallationPosition(),
+                    entity.getId(), "IEamThirdMaintenanceOrderService", "third_maintenance_process", null);
+            Map<String, Object> variables = new HashMap<>();
+            variables.put("dataId", entity.getId());
+            if (StrUtil.isEmpty(entity.getRemark())) {
+                variables.put("organization", "鏂板涓変繚宸ュ崟榛樿鍚姩娴佺▼");
+                variables.put("comment", "鏂板涓変繚宸ュ崟榛樿鍚姩娴佺▼");
+            } else {
+                variables.put("organization", entity.getRemark());
+                variables.put("comment", entity.getRemark());
+            }
+            variables.put("proofreading", true);
+            //骞惰浠诲姟浼氱
+            variables.put("maintenance_execution", Collections.singletonList(request.getOperator()));
+            variables.put("precision_check", Collections.singletonList(equipment.getEquipmentManager()));
+            Result result = flowDefinitionService.startProcessInstanceByKey("third_maintenance_process", variables);
+            if (result != null) {
+                //鏇存柊璁惧淇濆吇鐘舵��
+                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_THIRD_MAINTENANCE.name());
+                return result.isSuccess();
+            }
 
         }
         return true;
@@ -291,9 +283,11 @@
         if (equipment == null) {
             throw new JeecgBootException("璁惧涓嶅瓨鍦紝娣诲姞澶辫触锛�");
         }
-        if (StringUtils.isBlank(equipment.getEquipmentManager())) {
-            throw new JeecgBootException("璁惧鏈垎閰嶈澶囩鐞嗗憳锛屾棤娉曡繘鍏ヤ笅绾у鎵癸紒");
+        List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0002);
+        if (CollectionUtil.isEmpty(userSelectors)) {
+            throw new JeecgBootException("璁惧鏈垎閰嶇粰缁翠慨宸ワ紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
         }
+        List<String> userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         if (sysUser == null || !BusinessCodeConst.PCR0001.equals(sysUser.getPost())) {
             throw new JeecgBootException("涓嶆槸鎿嶄綔宸ワ紝鏃犳硶棰嗗彇姝ゅ伐鍗曪紒");
@@ -304,7 +298,7 @@
         eamThirdMaintenanceOrderMapper.updateById(entity);
 
         //鍚姩娴佺▼
-        flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";杩涜璁惧涓変繚",
+        flowCommonService.initActBusiness("宸ュ崟鍙�:" + entity.getOrderNum() + ";璁惧缂栧彿: " + equipment.getEquipmentCode() + ";瀹夎浣嶇疆" + equipment.getInstallationPosition(),
                 entity.getId(), "IEamThirdMaintenanceOrderService", "third_maintenance_process", null);
         Map<String, Object> variables = new HashMap<>();
         boolean equipmentPrecisionFlag = precisionCheckDetailService.hasPrecisionCheckDetail(entity.getId());
@@ -319,8 +313,10 @@
         }
         variables.put("proofreading", true);
         //骞惰浠诲姟浼氱
+        //鎿嶄綔宸ユ墽琛屼繚鍏�
         variables.put("maintenance_execution", Collections.singletonList(sysUser.getUsername()));
-        variables.put("precision_check", Collections.singletonList(equipment.getEquipmentManager()));
+        //缁翠慨宸ョ簿搴︽楠�
+        variables.put("precision_check", userApprovalList);
         Result result = flowDefinitionService.startProcessInstanceByKey("third_maintenance_process", variables);
         if (result != null) {
             //鏇存柊璁惧淇濆吇鐘舵��
@@ -378,7 +374,7 @@
                 //鎵ц瀹屾垚
                 userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0006);
                 if (CollectionUtil.isEmpty(userSelectors)) {
-                    throw new JeecgBootException("璁惧鏈垎閰嶇粰杞﹂棿鐝粍闀匡紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
+                    throw new JeecgBootException("璁惧鏈垎閰嶇粰鏈哄姩鍔烇紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
                 }
                 userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                 values.put("dataId", entity.getId());
@@ -426,7 +422,7 @@
             case WAIT_CONFIRM:
                 userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0003);
                 if (CollectionUtil.isEmpty(userSelectors)) {
-                    throw new JeecgBootException("璁惧鏈垎閰嶇粰杞﹂棿鐝粍闀匡紝鏃犳硶杩涘叆涓嬬骇瀹℃壒锛�");
+                    throw new JeecgBootException("璁惧鏈垎閰嶇粰缁翠慨涓讳换锛屾棤娉曡繘鍏ヤ笅绾у鎵癸紒");
                 }
                 //鐝粍闀跨‘璁�
                 userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());

--
Gitblit v1.9.3