Переглянути джерело

pms 瑞恒看板 项目部 设备利用率逻辑调整。

zhangcl 1 день тому
батько
коміт
c73c258585

+ 43 - 8
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/IotStaticController.java

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.pms.controller.admin.stat;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ObjUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.iocoder.yudao.framework.common.exception.ErrorCode;
@@ -1771,6 +1772,20 @@ public class IotStaticController {
         Map<Long, Set<Long>> projectTeamPair = new HashMap<>();
         // 队伍id 集合
         Set<Long> teamDepartmentIds = new HashSet<>();
+
+        // 筛选瑞恒 主设备 rq_iot_rh_main_device_category
+        Set<Long> mainDeviceCategoryIds = new HashSet<>();
+        List<DictDataDO> constructionStatusDictData = dictDataService.getDictDataListByDictType("rq_iot_rh_main_device_category");
+        if (CollUtil.isNotEmpty(constructionStatusDictData)) {
+            constructionStatusDictData.forEach(data -> {
+                String value = data.getValue();
+                if (NumberUtil.isNumber(value)) {
+                    Long longValue = Long.valueOf(value);
+                    mainDeviceCategoryIds.add(longValue);
+                }
+            });
+        }
+
         // 查询 瑞恒 所有设备 只统计包含 施工 状态设备的队伍
         IotDevicePageReqVO deviceReqVO = new IotDevicePageReqVO();
         deviceReqVO.setDeptIds(new ArrayList<>(childDeptIds));
@@ -1778,8 +1793,11 @@ public class IotStaticController {
         Set<Long> haveDeviceDeptIds = new HashSet<>();
         if (CollUtil.isNotEmpty(allRhDevices)) {
             // 筛选出包含设备的队伍部门集合
+            // 20260608 修改成 包含瑞恒主设备的 部门队伍id集合
             allRhDevices.forEach(device -> {
-                haveDeviceDeptIds.add(device.getDeptId());
+                if (mainDeviceCategoryIds.contains(device.getAssetClass())) {
+                    haveDeviceDeptIds.add(device.getDeptId());
+                }
             });
         }
         if (CollUtil.isNotEmpty(allDeptPair)) {
@@ -1829,12 +1847,14 @@ public class IotStaticController {
                 if (CollUtil.isNotEmpty(projectTeamPair)) {
                     projectTeamPair.forEach((projectDeptId, teamDeptIds) -> {
                         if (teamDeptIds.contains(report.getDeptId())) {
-                            // 项目部日报数量
-                            if (projectReportPair.containsKey(projectDeptId)) {
-                                Integer tempCount = projectReportPair.get(projectDeptId);
-                                projectReportPair.put(projectDeptId, ++tempCount);
-                            } else {
-                                projectReportPair.put(projectDeptId, 1);
+                            if (report.getDailyGasInjection().compareTo(BigDecimal.ZERO)>0 || report.getDailyWaterInjection().compareTo(BigDecimal.ZERO)>0) {
+                                // 项目部日报数量 20260608 统计 注气量 or 注水量 > 0 的日报数量
+                                if (projectReportPair.containsKey(projectDeptId)) {
+                                    Integer tempCount = projectReportPair.get(projectDeptId);
+                                    projectReportPair.put(projectDeptId, ++tempCount);
+                                } else {
+                                    projectReportPair.put(projectDeptId, 1);
+                                }
                             }
                             // 项目部 注气量
                             if (projectGasInjectionPair.containsKey(projectDeptId)) {
@@ -1988,6 +2008,19 @@ public class IotStaticController {
             }
         }
 
+        // 筛选瑞恒 主设备 rq_iot_rh_main_device_category
+        Set<Long> mainDeviceCategoryIds = new HashSet<>();
+        List<DictDataDO> constructionStatusDictData = dictDataService.getDictDataListByDictType("rq_iot_rh_main_device_category");
+        if (CollUtil.isNotEmpty(constructionStatusDictData)) {
+            constructionStatusDictData.forEach(data -> {
+                String value = data.getValue();
+                if (NumberUtil.isNumber(value)) {
+                    Long longValue = Long.valueOf(value);
+                    mainDeviceCategoryIds.add(longValue);
+                }
+            });
+        }
+
         // 查询 项目部下 包含 施工 状态设备的队伍
         IotDevicePageReqVO deviceReqVO = new IotDevicePageReqVO();
         deviceReqVO.setDeptIds(new ArrayList<>(projectTeamIds));
@@ -1996,7 +2029,9 @@ public class IotStaticController {
         if (CollUtil.isNotEmpty(allRhDevices)) {
             // 筛选出包含设备的队伍部门集合
             allRhDevices.forEach(device -> {
-                haveDeviceDeptIds.add(device.getDeptId());
+                if (mainDeviceCategoryIds.contains(device.getAssetClass())) {
+                    haveDeviceDeptIds.add(device.getDeptId());
+                }
             });
         }