From c9eea9f24aa52ea59dbb8dcf1cb6cf513ddc74a9 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期五, 25 四月 2025 11:37:32 +0800 Subject: [PATCH] 待机停机维护 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java | 76 ++++++++++++++++++++++++++++++++------ 1 files changed, 64 insertions(+), 12 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java index 1e28e3a..faf446f 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java @@ -2,26 +2,26 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.FileUploadResult; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.modules.eam.constant.ReportRepairEnum; -import org.jeecg.modules.eam.entity.EamInspectionOrderDetail; -import org.jeecg.modules.eam.entity.EamReportRepair; -import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrderDetail; +import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; +import org.jeecg.modules.eam.constant.*; +import org.jeecg.modules.eam.entity.*; import org.jeecg.modules.eam.mapper.EamReportRepairMapper; import org.jeecg.modules.eam.request.EamReportRepairQuery; +import org.jeecg.modules.eam.service.IEamEquipmentExtendService; import org.jeecg.modules.eam.service.IEamReportRepairService; import org.springframework.stereotype.Service; - import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; +import javax.annotation.Resource; +import java.util.*; /** * @Description: 鏁呴殰鎶ヤ慨 @@ -30,6 +30,9 @@ */ @Service public class EamReportRepairServiceImpl extends ServiceImpl<EamReportRepairMapper, EamReportRepair> implements IEamReportRepairService { + + @Resource + private IEamEquipmentExtendService eamEquipmentExtendService; /** * 鍒嗛〉鍒楄〃 @@ -55,7 +58,8 @@ @Override @Transactional(rollbackFor = Exception.class) - public boolean reportRepairFromMaintenance(String equipmentId, String reportUser, List<EamWeekMaintenanceOrderDetail> detailList) { + @EquipmentHistoryLog(operationTag = EquipmentOperationTagEnum.REPORT_REPAIR, businessTable = "eam_report_repair") + public EamReportRepair reportRepairFromMaintenance(String equipmentId, String reportUser, List<EamWeekMaintenanceOrderDetail> detailList) { StringBuilder sb = new StringBuilder(); detailList.forEach(detail -> { sb.append(detail.getItemCode()).append("銆�"); @@ -72,12 +76,15 @@ entity.setFaultType(CommonConstant.DEFAULT_1); entity.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name()); this.baseMapper.insert(entity); - return true; + //鏇存柊璁惧缁翠慨鐘舵�� + eamEquipmentExtendService.updateEquipmentRepairStatus(entity.getEquipmentId(), EquipmentRepairStatus.WAIT_REPAIR.name()); + return entity; } @Override @Transactional(rollbackFor = Exception.class) - public boolean reportRepairFromInspection(String equipmentId, String reportUser, List<EamInspectionOrderDetail> detailList) { + @EquipmentHistoryLog(operationTag = EquipmentOperationTagEnum.REPORT_REPAIR, businessTable = "eam_report_repair") + public EamReportRepair reportRepairFromInspection(String equipmentId, String reportUser, List<EamInspectionOrderDetail> detailList) { StringBuilder sb = new StringBuilder(); detailList.forEach(detail -> { sb.append(detail.getItemCode()).append("銆�"); @@ -94,6 +101,51 @@ entity.setFaultType(CommonConstant.DEFAULT_1); entity.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name()); this.baseMapper.insert(entity); + //鏇存柊璁惧缁翠慨鐘舵�� + eamEquipmentExtendService.updateEquipmentRepairStatus(entity.getEquipmentId(), EquipmentRepairStatus.WAIT_REPAIR.name()); + return entity; + } + + @Override + @Transactional(rollbackFor = Exception.class) + @EquipmentHistoryLog(operationTag = EquipmentOperationTagEnum.REPORT_REPAIR, businessTable = "eam_report_repair") + public EamReportRepair add(EamReportRepair eamReportRepair) { + eamReportRepair.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name()); + eamReportRepair.setDelFlag(CommonConstant.DEL_FLAG_0); + // 闄勪欢澶勭悊 + if (eamReportRepair.getImageFilesResult() != null) { + List<FileUploadResult> imageFilesResult = eamReportRepair.getImageFilesResult(); + ObjectMapper mapper = new ObjectMapper(); + try { + String referenceFile = mapper.writeValueAsString(imageFilesResult); + eamReportRepair.setImageFiles(referenceFile); + } catch (JsonProcessingException e) { + return null; + } + } + this.baseMapper.insert(eamReportRepair); + //鏇存柊璁惧缁翠慨鐘舵�� + eamEquipmentExtendService.updateEquipmentRepairStatus(eamReportRepair.getEquipmentId(), EquipmentRepairStatus.WAIT_REPAIR.name()); + return eamReportRepair; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean edit(EamReportRepair eamReportRepair) { + // 闄勪欢澶勭悊 + if (eamReportRepair.getImageFilesResult() != null) { + List<FileUploadResult> imageFilesResult = eamReportRepair.getImageFilesResult(); + ObjectMapper mapper = new ObjectMapper(); + try { + String referenceFile = mapper.writeValueAsString(imageFilesResult); + eamReportRepair.setImageFiles(referenceFile); + } catch (JsonProcessingException e) { + return false; + } + } else { + eamReportRepair.setImageFiles(null); + } + this.baseMapper.updateById(eamReportRepair); return true; } } -- Gitblit v1.9.3