From ebc4996578cc06cacda5561a45a4dfc2c951d070 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期一, 21 四月 2025 10:18:53 +0800
Subject: [PATCH] art: 设备管理-点检工单/周保工单-设备状态,设备履历变化修改

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

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java
index 8c41f9a..31fa8f9 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java
@@ -21,19 +21,15 @@
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.eam.constant.BusinessCodeConst;
-import org.jeecg.modules.eam.constant.OrderCreationMethodEnum;
-import org.jeecg.modules.eam.constant.WeekMaintenanceStatusEnum;
+import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog;
+import org.jeecg.modules.eam.constant.*;
 import org.jeecg.modules.eam.entity.EamEquipment;
 import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrder;
 import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrderDetail;
 import org.jeecg.modules.eam.mapper.EamWeekMaintenanceOrderMapper;
 import org.jeecg.modules.eam.request.EamWeekMaintenanceQuery;
 import org.jeecg.modules.eam.request.EamWeekMaintenanceRequest;
-import org.jeecg.modules.eam.service.IEamEquipmentService;
-import org.jeecg.modules.eam.service.IEamReportRepairService;
-import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderDetailService;
-import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderService;
+import org.jeecg.modules.eam.service.*;
 import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness;
 import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService;
 import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI;
@@ -82,6 +78,8 @@
     private IEamEquipmentService eamEquipmentService;
     @Autowired
     private IEamReportRepairService eamReportRepairService;
+    @Autowired
+    private IEamEquipmentExtendService eamEquipmentExtendService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -133,6 +131,8 @@
                 eamWeekMaintenanceOrderMapper.updateById(order);
                 return result.isSuccess();
             }
+            //鏇存柊璁惧淇濆吇鐘舵��
+            eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name());
         }
 
         return true;
@@ -253,6 +253,8 @@
                 eamWeekMaintenanceOrderMapper.updateById(entity);
                 return result.isSuccess();
             }
+            //鏇存柊璁惧淇濆吇鐘舵��
+            eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name());
         }
         return true;
     }
@@ -291,6 +293,8 @@
         variables.put("NextAssignee", usernames);
         Result result = flowDefinitionService.startProcessInstanceByKey("week_maintenance_process", variables);
         if (result != null) {
+            //鏇存柊璁惧淇濆吇鐘舵��
+            eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name());
             return result.isSuccess();
         }
         return true;
@@ -298,7 +302,8 @@
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public boolean approval(EamWeekMaintenanceRequest request) {
+    @EquipmentHistoryLog(operationTag = EquipmentOperationTagEnum.WEEK_MAINTENANCE, businessTable = "eam_week_maintenance_order")
+    public EamWeekMaintenanceOrder approval(EamWeekMaintenanceRequest request) {
         EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderMapper.selectById(request.getId());
         if (entity == null) {
             throw new JeecgBootException("瀹℃壒鐨勬暟鎹凡鍒犻櫎锛岃鍒锋柊閲嶈瘯锛�");
@@ -331,7 +336,7 @@
 
         WeekMaintenanceStatusEnum status = WeekMaintenanceStatusEnum.getInstance(entity.getMaintenanceStatus());
         if (status == null) {
-            return false;
+            return null;
         }
         //娴佺▼鍙橀噺
         Map<String, Object> values = new HashMap<>();
@@ -366,6 +371,8 @@
                 if (CollectionUtil.isNotEmpty(request.getTableDetailList())) {
                     eamWeekMaintenanceOrderDetailService.updateBatchById(request.getTableDetailList());
                 }
+                //鏇存柊璁惧淇濆吇鐘舵��
+                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.WAIT_CONFIRM.name());
                 break;
             case WAIT_CONFIRM:
                 if(StringUtils.isBlank(equipment.getEquipmentManager())) {
@@ -448,6 +455,8 @@
                         log.error("JSON杞崲澶辫触锛�" + e.getMessage(), e);
                     }
                 }
+                //鏇存柊璁惧淇濆吇鐘舵��
+                eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.NORMAL.name());
                 break;
         }
         request.setValues(values);
@@ -459,7 +468,7 @@
         }
         //淇濆瓨宸ュ崟
         eamWeekMaintenanceOrderMapper.updateById(entity);
-        return true;
+        return entity;
     }
 
     @Override

--
Gitblit v1.9.3