Bladeren bron

pms 瑞恒 日报汇总 已填报 未填报 数量逻辑调整

zhangcl 4 dagen geleden
bovenliggende
commit
c8c64b1aff

+ 39 - 10
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrhdailyreport/IotRhDailyReportServiceImpl.java

@@ -2750,6 +2750,20 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
             }
         });
 
+        // 20260605 筛选包含瑞恒主设备的队伍
+        // 筛选瑞恒 主设备 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<>(ids));
@@ -2758,7 +2772,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
         Set<Long> deviceTeamIds = new HashSet<>();
         if (CollUtil.isNotEmpty(devices)) {
             devices.forEach(device -> {
-                if (teamDeptIds.contains(device.getDeptId())) {
+                if (teamDeptIds.contains(device.getDeptId()) && mainDeviceCategoryIds.contains(device.getAssetClass())) {
                     deviceTeamIds.add(device.getDeptId());
                 }
             });
@@ -2799,13 +2813,15 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
             Set<Long> createdDeptIds = new HashSet<>();
             if (CollUtil.isNotEmpty(reports)) {
                 reports.forEach(report -> {
-                    createdDeptIds.add(report.getDeptId());
-                    // status = 0未填报    status = 1已填报
-                    if (report.getStatus() == 1) {
-                        rhFinishedCount.set(rhFinishedCount.get() + 1);
-                    }
-                    if (report.getStatus() == 0) {
-                        rhUnfinishedCount.set(rhUnfinishedCount.get() + 1);
+                    if (deviceTeamIds.contains(report.getDeptId())) {
+                        createdDeptIds.add(report.getDeptId());
+                        // status = 0未填报    status = 1已填报
+                        if (report.getStatus() == 1) {
+                            rhFinishedCount.set(rhFinishedCount.get() + 1);
+                        }
+                        if (report.getStatus() == 0) {
+                            rhUnfinishedCount.set(rhUnfinishedCount.get() + 1);
+                        }
                     }
                 });
             }
@@ -2873,7 +2889,20 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
             }
         });
 
-        // 筛选有设备的队伍部门
+        // 筛选瑞恒 主设备 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);
+                }
+            });
+        }
+
+        // 筛选有设备的队伍部门 20260605 修改成 查询包含瑞恒主设备的队伍
         IotDevicePageReqVO deviceReqVO = new IotDevicePageReqVO();
         deviceReqVO.setDeptIds(new ArrayList<>(ids));
         List<IotDeviceDO> devices = iotDeviceMapper.selectListAlone(deviceReqVO);
@@ -2881,7 +2910,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
         Set<Long> deviceTeamIds = new HashSet<>();
         if (CollUtil.isNotEmpty(devices)) {
             devices.forEach(device -> {
-                if (teamDeptIds.contains(device.getDeptId())) {
+                if (teamDeptIds.contains(device.getDeptId()) && mainDeviceCategoryIds.contains(device.getAssetClass())) {
                     deviceTeamIds.add(device.getDeptId());
                 }
             });