From 915a2e40175c6390802af1257e57effea5fd02ef Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期二, 06 五月 2025 17:35:32 +0800
Subject: [PATCH] art: 设备管理-看板接口-点检、周保统计接口

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java |   64 ++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java
index 109ffa9..864c55b 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java
@@ -9,7 +9,11 @@
 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;
@@ -30,6 +34,10 @@
     private IEamEquipmentService eamEquipmentService;
     @Autowired
     private IEamReportRepairService reportRepairService;
+    @Autowired
+    private IEamInspectionOrderService inspectionOrderService;
+    @Autowired
+    private IEamWeekMaintenanceOrderService weekMaintenanceOrderService;
 
     @ApiOperation(value = "鐪嬫澘鎺ュ彛-缁翠繚鐘舵�佺粺璁�", notes = "鐪嬫澘鎺ュ彛-缁翠繚鐘舵�佺粺璁�")
     @GetMapping(value = "/equipmentStatusStatistics")
@@ -87,4 +95,60 @@
         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);
+    }
 }

--
Gitblit v1.9.3