From a092e089316c05c6f7732d779e8fdff6060592c0 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期五, 09 五月 2025 11:10:28 +0800
Subject: [PATCH] art: 设备管理-维修看板-维修状态统计,维修列表统计

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentRepairStatusStatistics.java      |   25 ++++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamReportRepairService.java         |   14 +++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml         |   29 +++++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java       |   53 ++++++++++++-
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamReportRepairMapper.java            |   14 +++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java |   12 +++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentRepairListVO.java                |   50 ++++++++++++
 7 files changed, 193 insertions(+), 4 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 864c55b..20a427c 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
@@ -1,10 +1,15 @@
 package org.jeecg.modules.eam.controller;
 
+import cn.hutool.core.collection.CollectionUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.parser.Feature;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.TranslateDictTextUtils;
 import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus;
 import org.jeecg.modules.eam.constant.EquipmentRepairStatus;
 import org.jeecg.modules.eam.entity.EamEquipment;
@@ -12,16 +17,14 @@
 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.jeecg.modules.eam.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import java.time.LocalDate;
 import java.util.*;
 
@@ -38,6 +41,11 @@
     private IEamInspectionOrderService inspectionOrderService;
     @Autowired
     private IEamWeekMaintenanceOrderService weekMaintenanceOrderService;
+    @Resource
+    private ObjectMapper objectMapper;
+
+    @Resource
+    private TranslateDictTextUtils translateDictTextUtils;
 
     @ApiOperation(value = "鐪嬫澘鎺ュ彛-缁翠繚鐘舵�佺粺璁�", notes = "鐪嬫澘鎺ュ彛-缁翠繚鐘舵�佺粺璁�")
     @GetMapping(value = "/equipmentStatusStatistics")
@@ -151,4 +159,41 @@
         resultList.sort(Comparator.comparing(EquipmentMaintenanceStatistics::getMonthStr));
         return Result.ok(resultList);
     }
+
+    @ApiOperation(value = "缁翠慨鐪嬫澘-缁翠慨鐘舵�佺粺璁�", notes = "缁翠慨鐪嬫澘-缁翠慨鐘舵�佺粺璁�")
+    @GetMapping(value = "/repairStatusStatistics")
+    public Result<?> repairStatusStatistics() {
+        EquipmentRepairStatusStatistics statistics = reportRepairService.repairStatusStatistics();
+        return Result.OK(statistics);
+    }
+
+    @ApiOperation(value = "缁翠慨鐪嬫澘-缁翠慨鍒楄〃", notes = "缁翠慨鐪嬫澘-缁翠慨鍒楄〃")
+    @GetMapping(value = "/repairList")
+    public Result<?> repairList() {
+        List<EquipmentRepairListVO> list = reportRepairService.repairList();
+        if(CollectionUtil.isEmpty(list)) {
+            return Result.ok(Collections.emptyList());
+        }
+        List<JSONObject> items = new ArrayList<>();
+        try {
+            for(EquipmentRepairListVO vo : list) {
+                String json = objectMapper.writeValueAsString(vo);
+                JSONObject item = JSONObject.parseObject(json, Feature.OrderedField);
+                translateDictTextUtils.translateField("reportOperator", vo.getReportOperator(), item, "sys_user,realname,username");
+                translateDictTextUtils.translateField("repairOperator", vo.getRepairOperator(), item, "sys_user,realname,username");
+                translateDictTextUtils.translateField("reportStatus", vo.getReportStatus(), item, "report_repair_status");
+                translateDictTextUtils.translateField("orgId", vo.getOrgId(), item, "mdc_production,production_name,id");
+                items.add(item);
+            }
+            return Result.OK(items);
+        }catch (Exception e) {
+            return Result.error("鏁版嵁杞瘧澶辫触锛�");
+        }
+    }
+
+    @ApiOperation(value = "缁翠慨鐪嬫澘-缁翠慨宸ユ帓鍚�", notes = "缁翠慨鐪嬫澘-缁翠慨宸ユ帓鍚�")
+    @GetMapping(value = "/repairmanRanking")
+    public Result<?> repairmanRanking() {
+        return null;
+    }
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamReportRepairMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamReportRepairMapper.java
index b507bcc..b548ce1 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamReportRepairMapper.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamReportRepairMapper.java
@@ -6,7 +6,9 @@
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.eam.entity.EamReportRepair;
 import org.jeecg.modules.eam.request.EamReportRepairQuery;
+import org.jeecg.modules.eam.vo.EquipmentRepairListVO;
 import org.jeecg.modules.eam.vo.EquipmentRepairStatistics;
+import org.jeecg.modules.eam.vo.EquipmentRepairStatusStatistics;
 
 import java.util.List;
 
@@ -35,4 +37,16 @@
      * @return
      */
     List<EquipmentRepairStatistics> equipmentRepairStatistics(@Param("productionIds") List<String> productionIds, @Param("start") String start, @Param("end") String end);
+
+    /**
+     * 缁熻缁翠慨鐘舵�佹暟鎹�
+     * @return
+     */
+    EquipmentRepairStatusStatistics repairStatusStatistics();
+
+    /**
+     * 缁翠慨 鏈畬鎴愬垪琛�
+     * @return
+     */
+    List<EquipmentRepairListVO> repairList();
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml
index cf05e8a..55e6baf 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml
@@ -67,4 +67,33 @@
         and err.create_time &lt; #{end}
         group by FORMAT(err.create_time, 'yyyy-MM')
     </select>
+    <select id="repairStatusStatistics" resultType="org.jeecg.modules.eam.vo.EquipmentRepairStatusStatistics">
+        SELECT
+            SUM(CASE WHEN t.report_status='WAIT_REPAIR' THEN 1 ELSE 0 END) AS waitRepair,
+            SUM(CASE WHEN t.report_status='UNDER_REPAIR' THEN 1 ELSE 0 END) AS underRepair,
+            SUM(CASE WHEN t.report_status='WAIT_SPARES' THEN 1 ELSE 0 END) AS waitSpares,
+            SUM(CASE WHEN t.report_status='WAIT_CONFIRM' THEN 1 ELSE 0 END) AS waitConfirm
+        from eam_report_repair t
+        where t.report_status not in ('ABOLISH', 'COMPLETE') and t.del_flag = 0
+    </select>
+
+    <select id="repairList" resultType="org.jeecg.modules.eam.vo.EquipmentRepairListVO">
+        select e.equipment_code,
+               e.equipment_name,
+               e.org_id,
+               e.installation_position,
+               err.create_by as reportOperator,
+               err.fault_start_time,
+               ero.repairer as repairOperator,
+               ero.actual_start_time as repairStartTime,
+               err.report_status
+        from eam_report_repair err
+                 left join eam_equipment e
+                           on err.equipment_id = e.id
+                 left join eam_repair_order ero
+                           on ero.report_id = err.id
+        where err.report_status not in ('ABOLISH', 'COMPLETE')
+          and err.del_flag = 0
+        order by e.org_id, err.fault_start_time
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamReportRepairService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamReportRepairService.java
index d7e4ae9..656c6f7 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamReportRepairService.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamReportRepairService.java
@@ -7,7 +7,9 @@
 import org.jeecg.modules.eam.entity.EamReportRepair;
 import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrderDetail;
 import org.jeecg.modules.eam.request.EamReportRepairQuery;
+import org.jeecg.modules.eam.vo.EquipmentRepairListVO;
 import org.jeecg.modules.eam.vo.EquipmentRepairStatistics;
+import org.jeecg.modules.eam.vo.EquipmentRepairStatusStatistics;
 
 import java.time.LocalDate;
 import java.util.List;
@@ -64,4 +66,16 @@
      * @return
      */
     List<EquipmentRepairStatistics> equipmentRepairStatistics(String productionId, LocalDate firstOfMonth, LocalDate today);
+
+    /**
+     * 缁翠慨鐘舵�佺粺璁�
+     * @return
+     */
+    EquipmentRepairStatusStatistics repairStatusStatistics();
+
+    /**
+     * 缁翠慨鍒楄〃
+     * @return
+     */
+    List<EquipmentRepairListVO> repairList();
 }
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 fcba01b..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
@@ -19,7 +19,9 @@
 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;
@@ -190,4 +192,14 @@
         }
         return list;
     }
+
+    @Override
+    public EquipmentRepairStatusStatistics repairStatusStatistics() {
+        return this.baseMapper.repairStatusStatistics();
+    }
+
+    @Override
+    public List<EquipmentRepairListVO> repairList() {
+        return this.baseMapper.repairList();
+    }
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentRepairListVO.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentRepairListVO.java
new file mode 100644
index 0000000..cf5ee86
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentRepairListVO.java
@@ -0,0 +1,50 @@
+package org.jeecg.modules.eam.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class EquipmentRepairListVO implements Serializable {
+    /**
+     * 璁惧缂栫爜
+     */
+    private String equipmentCode;
+    /**
+     * 璁惧鍚嶇О
+     */
+    private String equipmentName;
+    /**
+     * 浣跨敤杞﹂棿
+     */
+    private String orgId;
+    /**
+     * 瀹夎浣嶇疆
+     */
+    private String installationPosition;
+    /**
+     * 鎶ヤ慨浜�
+     */
+    private String reportOperator;
+    /**
+     * 鏁呴殰寮�濮嬫椂闂�
+     */
+    private Date faultStartTime;
+    /**
+     * 缁翠慨浜�
+     */
+    private String repairOperator;
+    /**
+     * 鎺ュ崟鏃堕棿
+     */
+    private Date repairStartTime;
+    /**
+     * 鏁呴殰鎸佺画鏃堕暱(MIN)
+     */
+    private Integer faultDuration;
+    /**
+     * 宸ュ崟鐘舵��
+     */
+    private String reportStatus;
+}
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentRepairStatusStatistics.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentRepairStatusStatistics.java
new file mode 100644
index 0000000..1fcefb4
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentRepairStatusStatistics.java
@@ -0,0 +1,25 @@
+package org.jeecg.modules.eam.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class EquipmentRepairStatusStatistics implements Serializable {
+    /**
+     * 寰呮帴鍗�
+     */
+    private Integer waitRepair;
+    /**
+     * 缁翠慨涓�
+     */
+    private Integer underRepair;
+    /**
+     * 绛夊浠�
+     */
+    private Integer waitSpares;
+    /**
+     * 寰呯‘璁�
+     */
+    private Integer waitConfirm;
+}

--
Gitblit v1.9.3