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-common/src/main/java/org/jeecg/modules/eam/aspect/EquipmentHistoryLogAspect.java |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/aspect/EquipmentHistoryLogAspect.java b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/aspect/EquipmentHistoryLogAspect.java
index 1bde718..9c166d0 100644
--- a/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/aspect/EquipmentHistoryLogAspect.java
+++ b/lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/aspect/EquipmentHistoryLogAspect.java
@@ -1,14 +1,19 @@
 package org.jeecg.modules.eam.aspect;
 
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.aspectj.lang.JoinPoint;
 import org.aspectj.lang.ProceedingJoinPoint;
 import org.aspectj.lang.annotation.*;
 import org.aspectj.lang.reflect.MethodSignature;
 import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog;
 import org.jeecg.modules.eam.constant.EquipmentOperationTagEnum;
+import org.jeecg.modules.eam.constant.InspectionStatus;
+import org.jeecg.modules.eam.constant.WeekMaintenanceStatusEnum;
 import org.jeecg.modules.eam.entity.EamEquipment;
 import org.jeecg.modules.eam.entity.EamEquipmentHistoryLog;
+import org.jeecg.modules.eam.entity.EamInspectionOrder;
+import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrder;
 import org.jeecg.modules.eam.service.IEamEquipmentHistoryLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -54,7 +59,9 @@
             log.setBusinessTable(syslog.businessTable());
             log.setOperationTag(syslog.operationTag().name());
             convertResult(log, syslog.operationTag(), result);
-            equipmentHistoryLogService.save(log);
+            if (StringUtils.isNotBlank(log.getEquipmentId())) {
+                equipmentHistoryLogService.save(log);
+            }
         }
     }
 
@@ -62,7 +69,7 @@
     private void convertResult(EamEquipmentHistoryLog log, EquipmentOperationTagEnum operationTag, Object result) {
         switch (operationTag) {
             case ACCEPTANCE:
-                if(result instanceof EamEquipment) {
+                if (result instanceof EamEquipment) {
                     EamEquipment equipment = (EamEquipment) result;
                     log.setEquipmentId(equipment.getId());
                     log.setBusinessId(equipment.getId());
@@ -72,6 +79,28 @@
                 }
                 break;
             case POINT_INSPECTION:
+                if (result instanceof EamInspectionOrder) {
+                    EamInspectionOrder order = (EamInspectionOrder) result;
+                    if (InspectionStatus.COMPLETE.name().equals(order.getInspectionStatus())) {
+                        log.setEquipmentId(order.getEquipmentId());
+                        log.setBusinessId(order.getId());
+                        log.setOperator(order.getOperator());
+                        log.setDescription(order.getConfirmComment());
+                        log.setCreateTime(order.getInspectionDate());
+                    }
+                }
+                break;
+            case WEEK_MAINTENANCE:
+                if (result instanceof EamWeekMaintenanceOrder) {
+                    EamWeekMaintenanceOrder order = (EamWeekMaintenanceOrder) result;
+                    if (WeekMaintenanceStatusEnum.COMPLETE.name().equals(order.getMaintenanceStatus())) {
+                        log.setEquipmentId(order.getEquipmentId());
+                        log.setBusinessId(order.getId());
+                        log.setOperator(order.getOperator());
+                        log.setDescription(order.getFinalAcceptanceComment());
+                        log.setCreateTime(order.getActualEndTime());
+                    }
+                }
                 break;
             case SECOND_MAINTENANCE:
                 break;

--
Gitblit v1.9.3