| | |
| | | |
| | | 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.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; |
| | | import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus; |
| | | import org.jeecg.modules.eam.constant.EquipmentOperationTagEnum; |
| | | import org.jeecg.modules.eam.constant.EquipmentRepairStatus; |
| | | 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.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.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | */ |
| | | @Service |
| | | public class EamReportRepairServiceImpl extends ServiceImpl<EamReportRepairMapper, EamReportRepair> implements IEamReportRepairService { |
| | | |
| | | @Resource |
| | | private IEamEquipmentExtendService eamEquipmentExtendService; |
| | | |
| | | /** |
| | | * 分页列表 |
| | |
| | | |
| | | @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("、"); |
| | |
| | | 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("、"); |
| | |
| | | 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; |
| | | } |
| | | } |