| | |
| | | import org.jeecg.modules.eam.constant.EquipmentRepairStatus; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IEamInspectionOrderService; |
| | | import org.jeecg.modules.eam.service.IEamReportRepairService; |
| | | import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderService; |
| | | import org.jeecg.modules.eam.vo.EquipmentInspectionStatistics; |
| | | import org.jeecg.modules.eam.vo.EquipmentMaintenanceStatistics; |
| | | import org.jeecg.modules.eam.vo.EquipmentRepairStatistics; |
| | | import org.jeecg.modules.eam.vo.EquipmentStatusStatistics; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private IEamEquipmentService eamEquipmentService; |
| | | @Autowired |
| | | private IEamReportRepairService reportRepairService; |
| | | @Autowired |
| | | private IEamInspectionOrderService inspectionOrderService; |
| | | @Autowired |
| | | private IEamWeekMaintenanceOrderService weekMaintenanceOrderService; |
| | | |
| | | @ApiOperation(value = "看板接口-维保状态统计", notes = "看板接口-维保状态统计") |
| | | @GetMapping(value = "/equipmentStatusStatistics") |
| | |
| | | resultList.sort(Comparator.comparing(EquipmentRepairStatistics::getMonthStr)); |
| | | return Result.ok(resultList); |
| | | } |
| | | |
| | | @ApiOperation(value = "看板接口-点检统计", notes = "看板接口-点检统计") |
| | | @GetMapping(value = "/equipmentInspectionStatistics") |
| | | public Result<?> equipmentInspectionStatistics(@RequestParam(required = false, value = "productionId") String productionId) { |
| | | //统计结束日期 |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate localDate = today.minusMonths(5); |
| | | //统计开始日期 |
| | | LocalDate firstOfMonth = DateUtils.getFirstOfMonth(localDate); |
| | | |
| | | //初始化返回值 |
| | | Map<String, EquipmentInspectionStatistics> statisticsMap = new HashMap<>(); |
| | | List<String> monthsBetween = DateUtils.getMonthsBetween(firstOfMonth, today); |
| | | monthsBetween.forEach(month -> { |
| | | statisticsMap.put(month, new EquipmentInspectionStatistics(month)); |
| | | }); |
| | | |
| | | List<EquipmentInspectionStatistics> list = inspectionOrderService.equipmentInspectionStatistics(productionId, firstOfMonth, today); |
| | | for (EquipmentInspectionStatistics statistics : list) { |
| | | if (statisticsMap.containsKey(statistics.getMonthStr())) { |
| | | statisticsMap.put(statistics.getMonthStr(), statistics); |
| | | } |
| | | } |
| | | List<EquipmentInspectionStatistics> resultList = new ArrayList<>(statisticsMap.values()); |
| | | //排序 |
| | | resultList.sort(Comparator.comparing(EquipmentInspectionStatistics::getMonthStr)); |
| | | return Result.ok(resultList); |
| | | } |
| | | |
| | | @ApiOperation(value = "看板接口-周保统计", notes = "看板接口-周保统计") |
| | | @GetMapping(value = "/equipmentMaintenanceStatistics") |
| | | public Result<?> equipmentMaintenanceStatistics(@RequestParam(required = false, value = "productionId") String productionId) { |
| | | //统计结束日期 |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate localDate = today.minusMonths(5); |
| | | //统计开始日期 |
| | | LocalDate firstOfMonth = DateUtils.getFirstOfMonth(localDate); |
| | | |
| | | //初始化返回值 |
| | | Map<String, EquipmentMaintenanceStatistics> statisticsMap = new HashMap<>(); |
| | | List<String> monthsBetween = DateUtils.getMonthsBetween(firstOfMonth, today); |
| | | monthsBetween.forEach(month -> { |
| | | statisticsMap.put(month, new EquipmentMaintenanceStatistics(month)); |
| | | }); |
| | | |
| | | List<EquipmentMaintenanceStatistics> list = weekMaintenanceOrderService.equipmentMaintenanceStatistics(productionId, firstOfMonth, today); |
| | | for (EquipmentMaintenanceStatistics statistics : list) { |
| | | if (statisticsMap.containsKey(statistics.getMonthStr())) { |
| | | statisticsMap.put(statistics.getMonthStr(), statistics); |
| | | } |
| | | } |
| | | List<EquipmentMaintenanceStatistics> resultList = new ArrayList<>(statisticsMap.values()); |
| | | //排序 |
| | | resultList.sort(Comparator.comparing(EquipmentMaintenanceStatistics::getMonthStr)); |
| | | return Result.ok(resultList); |
| | | } |
| | | } |