From 548de3053898bc6571c90d014a40050c39a7d195 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期六, 02 八月 2025 15:33:07 +0800
Subject: [PATCH] 二保添加流转节点

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

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderServiceImpl.java
index a24b234..97aaf33 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSecondMaintenanceOrderServiceImpl.java
@@ -80,8 +80,6 @@
     @Autowired
     private IEamEquipmentService eamEquipmentService;
     @Autowired
-    private IEamReportRepairService eamReportRepairService;
-    @Autowired
     private IEamEquipmentExtendService eamEquipmentExtendService;
     @Autowired
     private IEamBaseHFCodeService hfCodeService;
@@ -430,43 +428,52 @@
                     throw new JeecgBootException("璁惧鏈瓨鍦ㄦ鏌ヤ汉锛屾棤娉曡繘鍏ヤ笅绾у鎵癸紒");
                 }else{
                     userApprovalList= userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
-                    values.put("NextAssignee", userApprovalList);
                     values.put("dataId", entity.getId());
-                    if (StrUtil.isEmpty(request.getDealDescription())){
-                        request.setDealDescription("");
+                    if (StrUtil.isEmpty(request.getManageUserResult())){
+                        request.setManageUserResult("");
                     }
                     values.put("organization",request.getDealDescription());
-                    values.put("comment", request.getDealDescription());
+                    values.put("comment", request.getManageUserResult());
                     values.put("manageUserResult",request.getManageUserResult());
-                    entity.setMaintenanceStatus(SecondMaintenanceStatusEnum.WAIT_INSPECTOR_CONFIRM.name());
-                    entity.setManageUser(user.getUsername());
-                    entity.setProblemDescription(request.getProblemDescription());
-                    entity.setManageUserResult(request.getManageUserResult());
-                    entity.setDealDescription(request.getDealDescription());
-                    entity.setConfirmTime(new Date());
                     request.setComment(request.getDealDescription());
                     if (request.getManageUserResult().equals("2")){
-                        entity.setMaintenanceStatus(SecondMaintenanceStatusEnum.REJECTED.name());
+                        entity.setMaintenanceStatus(SecondMaintenanceStatusEnum.UNDER_MAINTENANCE.name());
+                    }else {
+                        values.put("NextAssignee", userApprovalList);
+                        entity.setMaintenanceStatus(SecondMaintenanceStatusEnum.WAIT_INSPECTOR_CONFIRM.name());
+                        entity.setConfirmTime(new Date());
+                        entity.setManageUser(user.getUsername());
+                        entity.setProblemDescription(request.getProblemDescription());
+                        entity.setManageUserResult(request.getManageUserResult());
+                        entity.setDealDescription(request.getDealDescription());
                     }
                 }
                 break;
             case WAIT_INSPECTOR_CONFIRM:
                 //妫�鏌ヤ汉纭
-                if (StrUtil.isEmpty(request.getDealDescription())){
-                    request.setDealDescription("");
+                if (StrUtil.isEmpty(request.getInspectConfirmComment())){
+                    request.setInspectConfirmComment("");
                 }
                 values.put("dataId", entity.getId());
                 values.put("organization",request.getInspectConfirmComment());
                 values.put("comment", request.getInspectConfirmComment());
                 values.put("inspectorResult",request.getInspectorResult());
-                entity.setMaintenanceStatus(SecondMaintenanceStatusEnum.COMPLETE.name());
-                entity.setInspector(user.getUsername());
-                entity.setInspectorResult(request.getInspectorResult());
-                entity.setInspectConfirmComment(request.getInspectConfirmComment());
-                entity.setInspectConfirmTime(new Date());
-                request.setComment(request.getDealDescription());
+                request.setComment(request.getInspectConfirmComment());
                 if (request.getInspectorResult().equals("2")){
-                    entity.setMaintenanceStatus(SecondMaintenanceStatusEnum.REJECTED.name());
+                    entity.setMaintenanceStatus(SecondMaintenanceStatusEnum.WAIT_ADMIN_CONFIRM.name());
+                    userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0004);
+                    if (CollectionUtil.isEmpty(userSelectors)) {
+                        throw new JeecgBootException("璁惧鏈瓨鍦ㄧ鐞嗗憳锛屾棤娉曡繘鍏ヤ笅绾у鎵癸紒");
+                    }else{
+                        userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
+                        values.put("NextAssignee", userApprovalList);
+                    }
+                }else {
+                    entity.setMaintenanceStatus(SecondMaintenanceStatusEnum.COMPLETE.name());
+                    entity.setInspector(user.getUsername());
+                    entity.setInspectorResult(request.getInspectorResult());
+                    entity.setInspectConfirmComment(request.getInspectConfirmComment());
+                    entity.setInspectConfirmTime(new Date());
                 }
                 break;
             default:
@@ -478,6 +485,31 @@
         if (!result.isSuccess()) {
             throw new JeecgBootException("瀹℃壒澶辫触锛岃鍒锋柊鏌ョ湅锛�");
         }
+        if (user.getPost().equals(BusinessCodeConst.PCR0004)&&request.getManageUserResult().equals("2")){
+            //绠$悊鍛樻嫆缁濓紝浼氱鑺傜偣淇敼瀵瑰簲鍏崇郴
+            List<FlowMyBusiness> list = flowMyBusinessService.list(new LambdaQueryWrapper<FlowMyBusiness>().eq(FlowMyBusiness::getProcessInstanceId, request.getInstanceId()));
+            if (CollectionUtils.isNotEmpty(list)) {
+                list.forEach(item -> {
+                    if (item.getTaskNameId().equals("maintenance_task")) {
+                        //鑾峰彇缁翠慨宸ュ矖浣嶇敤鎴�
+                        List<UserSelector> userSelectorList = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002);
+                        if (!CollectionUtils.isEmpty(userSelectorList)) {
+                            List<String> usernameList = userSelectorList.stream().map(UserSelector::getUsername).collect(Collectors.toList());
+                            item.setTodoUsers(JSON.toJSONString(usernameList));
+                        }
+                    }
+                    if (item.getTaskNameId().equals("operator_task")) {
+                        //鑾峰彇鎿嶄綔浜哄矖浣嶇敤鎴�
+                        List<UserSelector> userSelectorList = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0001);
+                        if (!CollectionUtils.isEmpty(userSelectorList)) {
+                            List<String> usernameList = userSelectorList.stream().map(UserSelector::getUsername).collect(Collectors.toList());
+                            item.setTodoUsers(JSON.toJSONString(usernameList));
+                        }
+                    }
+                });
+                flowMyBusinessService.updateBatchById(list);
+            }
+        }
         //淇濆瓨宸ュ崟
         eamSecondMaintenanceOrderMapper.updateById(entity);
         return entity;

--
Gitblit v1.9.3