zhangherong
2025-04-21 ebc4996578cc06cacda5561a45a4dfc2c951d070
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;