| | |
| | | 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.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentHistoryLog; |
| | | import org.jeecg.modules.eam.constant.InspectionStatus; |
| | | import org.jeecg.modules.eam.constant.ReportRepairEnum; |
| | | import org.jeecg.modules.eam.constant.WeekMaintenanceStatusEnum; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentHistoryLogService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | 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()); |
| | |
| | | } |
| | | 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.getOperateTime()); |
| | | } |
| | | } |
| | | 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; |
| | | case THIRD_MAINTENANCE: |
| | | break; |
| | | case REPORT_REPAIR: |
| | | if (result instanceof EamReportRepair) { |
| | | EamReportRepair repair = (EamReportRepair) result; |
| | | log.setEquipmentId(repair.getEquipmentId()); |
| | | log.setBusinessId(repair.getId()); |
| | | log.setOperator(repair.getCreateBy()); |
| | | log.setDescription(repair.getFaultDescription()); |
| | | log.setCreateTime(repair.getFaultStartTime()); |
| | | } |
| | | break; |
| | | case REPAIRED: |
| | | if (result instanceof EamRepairOrder) { |
| | | EamRepairOrder order = (EamRepairOrder) result; |
| | | if (ReportRepairEnum.COMPLETE.name().equals(order.getRepairStatus())) { |
| | | log.setEquipmentId(order.getEquipmentId()); |
| | | log.setBusinessId(order.getId()); |
| | | log.setOperator(order.getRepairer()); |
| | | log.setDescription(order.getRepairDescription()); |
| | | log.setCreateTime(order.getActualEndTime()); |
| | | } |
| | | } |
| | | break; |
| | | case MAJOR_REPAIR: |
| | | break; |