From 8203359e4e68775b3ce0e540837bf3332d970798 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期五, 09 五月 2025 11:38:49 +0800 Subject: [PATCH] art: 设备管理-维修看板-维修工排名统计 --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java | 81 +++++++++++++++++++++++++++++++--------- 1 files changed, 62 insertions(+), 19 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 b6f808a..f64ece6 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 @@ -1,5 +1,7 @@ package org.jeecg.modules.eam.service.impl; +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.core.JsonProcessingException; @@ -7,32 +9,28 @@ 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.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.IEamEquipmentFaultReasonService; import org.jeecg.modules.eam.service.IEamReportRepairService; +import org.jeecg.modules.eam.vo.EquipmentRepairListVO; +import org.jeecg.modules.eam.vo.EquipmentRepairStatistics; +import org.jeecg.modules.eam.vo.EquipmentRepairStatusStatistics; +import org.jeecg.modules.system.service.IMdcProductionService; 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; -import java.util.List; +import java.time.LocalDate; +import java.util.*; /** * @Description: 鏁呴殰鎶ヤ慨 @@ -44,6 +42,10 @@ @Resource private IEamEquipmentExtendService eamEquipmentExtendService; + @Autowired + private IMdcProductionService mdcProductionService; + @Autowired + private IEamEquipmentFaultReasonService eamEquipmentFaultReasonService; /** * 鍒嗛〉鍒楄〃 @@ -76,15 +78,20 @@ sb.append(detail.getItemCode()).append("銆�"); sb.append(detail.getExceptionDescription()).append(";"); }); + EamEquipmentFaultReason reason = eamEquipmentFaultReasonService.selectByFaultCode(BusinessCodeConst.EFR20250009); EamReportRepair entity = new EamReportRepair(); entity.setEquipmentId(equipmentId); entity.setCreateBy(reportUser); entity.setFaultStartTime(new Date()); entity.setBreakdownFlag(CommonConstant.DEFAULT_0); entity.setDelFlag(CommonConstant.DEL_FLAG_0); - entity.setFaultName("鍛ㄤ繚鎵ц鎶ヤ慨澶勭悊"); - entity.setFaultDescription(sb.toString()); - entity.setFaultType(CommonConstant.DEFAULT_1); + if(reason == null){ + entity.setFaultName("鍛ㄤ繚鎵ц鎶ヤ慨澶勭悊"); + entity.setFaultDescription(sb.toString()); + }else { + entity.setFaultName(reason.getFaultName()); + entity.setFaultType(reason.getFaultCategory()); + } entity.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name()); this.baseMapper.insert(entity); //鏇存柊璁惧缁翠慨鐘舵�� @@ -101,15 +108,20 @@ sb.append(detail.getItemCode()).append("銆�"); sb.append(detail.getExceptionDescription()).append(";"); }); + EamEquipmentFaultReason reason = eamEquipmentFaultReasonService.selectByFaultCode(BusinessCodeConst.EFR20250010); EamReportRepair entity = new EamReportRepair(); entity.setEquipmentId(equipmentId); entity.setCreateBy(reportUser); entity.setFaultStartTime(new Date()); entity.setBreakdownFlag(CommonConstant.DEFAULT_0); entity.setDelFlag(CommonConstant.DEL_FLAG_0); - entity.setFaultName("鐐规鎵ц鎶ヤ慨澶勭悊"); - entity.setFaultDescription(sb.toString()); - entity.setFaultType(CommonConstant.DEFAULT_1); + if(reason == null){ + entity.setFaultName("鐐规鎵ц鎶ヤ慨澶勭悊"); + entity.setFaultDescription(sb.toString()); + }else { + entity.setFaultName(reason.getFaultName()); + entity.setFaultType(reason.getFaultCategory()); + } entity.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name()); this.baseMapper.insert(entity); //鏇存柊璁惧缁翠慨鐘舵�� @@ -159,4 +171,35 @@ this.baseMapper.updateById(eamReportRepair); return true; } + + @Override + public List<EquipmentRepairStatistics> equipmentRepairStatistics(String productionId, LocalDate firstOfMonth, LocalDate today) { + if (StringUtils.isNotBlank(productionId)) { + //杞﹂棿缂栫爜涓嶄负绌� + List<String> productIds = mdcProductionService.recursionChildren(productionId); + if (CollectionUtil.isEmpty(productIds)) { + return Collections.emptyList(); + } + List<EquipmentRepairStatistics> list = this.baseMapper.equipmentRepairStatistics(productIds, firstOfMonth.toString(), today.plusDays(1).toString()); + if (CollectionUtil.isEmpty(list)) { + return Collections.emptyList(); + } + return list; + } + List<EquipmentRepairStatistics> list = this.baseMapper.equipmentRepairStatistics(null, firstOfMonth.toString(), today.plusDays(1).toString()); + if (CollectionUtil.isEmpty(list)) { + return Collections.emptyList(); + } + return list; + } + + @Override + public EquipmentRepairStatusStatistics repairStatusStatistics() { + return this.baseMapper.repairStatusStatistics(); + } + + @Override + public List<EquipmentRepairListVO> repairList() { + return this.baseMapper.repairList(); + } } -- Gitblit v1.9.3