From 767ba5a54ca5597de816015f387981776b928f7b Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期三, 16 七月 2025 19:20:44 +0800
Subject: [PATCH] H5首页待执行工单统计接口调整

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamDashboardController.java |   53 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 31 insertions(+), 22 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 c2e132f..575571e 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
@@ -4,10 +4,13 @@
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.parser.Feature;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
@@ -15,10 +18,10 @@
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.TranslateDictTextUtils;
 import org.jeecg.modules.eam.constant.*;
-import org.jeecg.modules.eam.entity.EamEquipment;
-import org.jeecg.modules.eam.entity.EamInspectionOrder;
-import org.jeecg.modules.eam.entity.EamRepairOrder;
-import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrder;
+import org.jeecg.modules.eam.entity.*;
+import org.jeecg.modules.eam.request.EamInspectionOrderQuery;
+import org.jeecg.modules.eam.request.EamReportRepairQuery;
+import org.jeecg.modules.eam.request.EamWeekMaintenanceQuery;
 import org.jeecg.modules.eam.service.*;
 import org.jeecg.modules.eam.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -257,30 +260,36 @@
     @GetMapping(value = "/pendingExecOrderCountBySelf")
     public Result<?> pendingExecOrderCountBySelf() {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        String post = user.getPost();
         Map<String, Integer> countMap = CollectionUtil.newHashMap();
+        if (user == null) {
+            return Result.ok(countMap);
+        }
+        String post = user.getPost();
+
         if (BusinessCodeConst.PCR0001.equals(post)) {
-            //鏄搷浣滃伐锛屾煡璇㈠緟鐐规宸ュ崟銆佸緟鍛ㄤ繚宸ュ崟
-            List<EamInspectionOrder> unExecInspectionOrderList = inspectionOrderService.list(new LambdaQueryWrapper<EamInspectionOrder>()
-                    .eq(EamInspectionOrder::getOperator, user.getUsername())
-                    .eq(EamInspectionOrder::getInspectionStatus, InspectionStatus.UNDER_INSPECTION.name())
-                    .eq(EamInspectionOrder::getDelFlag, CommonConstant.DEL_FLAG_0));
-            List<EamWeekMaintenanceOrder> unExecMaintenanceOrderList = weekMaintenanceOrderService.list(new LambdaQueryWrapper<EamWeekMaintenanceOrder>()
-                    .eq(EamWeekMaintenanceOrder::getOperator, user.getUsername())
-                    .eq(EamWeekMaintenanceOrder::getMaintenanceStatus, WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name())
-                    .eq(EamWeekMaintenanceOrder::getDelFlag, CommonConstant.DEL_FLAG_0));
-            countMap.put("unExecInspectionOrderCount", unExecInspectionOrderList.size());
-            countMap.put("unExecMaintenanceOrderCount", unExecMaintenanceOrderList.size());
+            //鏄搷浣滃伐锛屾煡璇㈠彲棰嗗彇鐨勭偣妫�銆佸懆淇濆伐鍗�
+            Page<EamInspectionOrder> inspectionOrderPage = new Page<>(1, 99999999);
+            EamInspectionOrderQuery inspectionOrderQuery = new EamInspectionOrderQuery();
+            inspectionOrderQuery.setInspectionStatus(InspectionStatus.WAIT_INSPECTION.name());
+            List<EamInspectionOrder> unReceivedInspectionOrderList = inspectionOrderService.queryPageList(inspectionOrderPage, inspectionOrderQuery).getRecords();
+
+            Page<EamWeekMaintenanceOrder> maintenanceOrderPage = new Page<>(1, 99999999);
+            EamWeekMaintenanceQuery weekMaintenanceQuery = new EamWeekMaintenanceQuery();
+            weekMaintenanceQuery.setMaintenanceStatus(WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name());
+            List<EamWeekMaintenanceOrder> unReceivedMaintenanceOrderList = weekMaintenanceOrderService.queryPageList(maintenanceOrderPage, weekMaintenanceQuery).getRecords();
+            countMap.put("unExecInspectionOrderCount", unReceivedInspectionOrderList.size());
+            countMap.put("unExecMaintenanceOrderCount", unReceivedMaintenanceOrderList.size());
             countMap.put("unExecRepairOrderCount", 0);
         } else if (BusinessCodeConst.PCR0002.equals(post)) {
-            //鏄淮淇伐锛屾煡璇㈠緟缁翠慨宸ュ崟
-            List<EamRepairOrder> unExecRepairOrderList = repairOrderService.list(new LambdaQueryWrapper<EamRepairOrder>()
-                    .eq(EamRepairOrder::getRepairer, user.getUsername())
-                    .eq(EamRepairOrder::getRepairStatus, EquipmentRepairStatus.UNDER_REPAIR.name())
-                    .eq(EamRepairOrder::getDelFlag, CommonConstant.DEL_FLAG_0));
+            //鏄淮淇伐锛屾煡璇㈠彲棰嗗彇鐨勬姤淇崟
+            Page<EamReportRepair> maintenanceOrderPage = new Page<>(1, 99999999);
+            EamReportRepairQuery reportRepairQuery = new EamReportRepairQuery();
+            reportRepairQuery.setReportStatus(EquipmentRepairStatus.WAIT_REPAIR.name());
+            List<EamReportRepair> unReceivedOrderList = reportRepairService.pageList(maintenanceOrderPage, reportRepairQuery).getRecords();
+
             countMap.put("unExecInspectionOrderCount", 0);
             countMap.put("unExecMaintenanceOrderCount", 0);
-            countMap.put("unExecRepairOrderCount", unExecRepairOrderList.size());
+            countMap.put("unExecRepairOrderCount", unReceivedOrderList.size());
         } else {
             countMap.put("unExecInspectionOrderCount", 0);
             countMap.put("unExecMaintenanceOrderCount", 0);

--
Gitblit v1.9.3