ソースを参照

pms 瑞恒日报 列表 设备号

zhangcl 3 日 前
コミット
76f5be94f0

+ 33 - 48
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrhdailyreport/IotRhDailyReportController.java

@@ -742,10 +742,13 @@ public class IotRhDailyReportController {
         Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(reports, IotRhDailyReportDO::getDeptId));
         Set<Long> projectDeptIds = new HashSet<>();
         Map<Long, String> teamIdProjectNamePair = new HashMap<>();
+        // 施工队伍id集合
+        Set<Long> teamIds = new HashSet<>();
         // 查询施工队伍的上级项目部 计算气电比使用
         if (CollUtil.isNotEmpty(deptMap)) {
             deptMap.forEach((deptId, dept) -> {
                 projectDeptIds.add(dept.getParentId());
+                teamIds.add(deptId);
             });
         }
         // 查询所有项目部的名称
@@ -777,6 +780,32 @@ public class IotRhDailyReportController {
             });
         }
 
+        // 查询每个队伍的 增压机 类型的设备 查询设备的 型号 device_no
+        // 瑞恒 增压机 设备类别 字典数据
+        Set<Long> deviceCategories = new HashSet<>();
+        List<DictDataDO> deviceCategoryDictData = dictDataService.getDictDataListByDictType("rq_iot_rh_daily_report_device_no");
+        if (CollUtil.isNotEmpty(deviceCategoryDictData)) {
+            deviceCategoryDictData.forEach(data -> {
+                // 瑞恒 增压机设备 类别
+                String value = data.getValue();
+                if (NumberUtil.isNumber(value)) {
+                    deviceCategories.add(Long.valueOf(value));
+                }
+            });
+        }
+        Map<Long, String> deviceNoPair = new HashMap<>();
+        // 查找日报部门下 设备类别对应的 设备型号 如果有部门队伍下有多个相关类别的增压机 随机取1个
+        IotDevicePageReqVO deviceReqVO = new IotDevicePageReqVO();
+        deviceReqVO.setDeptIds(new ArrayList<>(teamIds));
+        deviceReqVO.setAssetClasses(new ArrayList<>(deviceCategories));
+        List<IotDeviceDO> allRhDevices = iotDeviceMapper.selectListAlone(deviceReqVO);
+        if (CollUtil.isNotEmpty(allRhDevices)) {
+            allRhDevices.forEach(device -> {
+                // 设备型号
+                deviceNoPair.put(device.getDeptId(), device.getDeviceNo());
+            });
+        }
+
         // key项目id   value项目合同号
         Map<Long, String> projectPair = new HashMap<>();
         //  key任务id     value任务井号
@@ -823,14 +852,7 @@ public class IotRhDailyReportController {
         List<IotRhDailyReportDO> taskDailyReports = iotRhDailyReportMapper.dailyReports(currentTaskReqVO);
         if (CollUtil.isNotEmpty(taskDailyReports)) {
             taskDailyReports.forEach(report -> {
-                // 注气量
-                /* if (wellGasInjectionPair.containsKey(report.getTaskId())) {
-                    BigDecimal tempGasInjection = wellGasInjectionPair.get(report.getTaskId());
-                    BigDecimal tempResult = tempGasInjection.add(report.getDailyGasInjection());
-                    wellGasInjectionPair.put(report.getTaskId(), tempResult);
-                } else {
-                    wellGasInjectionPair.put(report.getTaskId(), report.getDailyGasInjection());
-                } */
+
                 // 井相关的所有日报列表
                 if (wellReportsPair.containsKey(report.getTaskId())) {
                     List<IotRhDailyReportDO> tempReports = wellReportsPair.get(report.getTaskId());
@@ -841,14 +863,7 @@ public class IotRhDailyReportController {
                     tempReports.add(report);
                     wellReportsPair.put(report.getTaskId(), tempReports);
                 }
-                // 注水量
-                /* if (wellWaterInjectionPair.containsKey(report.getTaskId())) {
-                    BigDecimal tempWaterInjection = wellWaterInjectionPair.get(report.getTaskId());
-                    BigDecimal tempResult = tempWaterInjection.add(report.getDailyWaterInjection());
-                    wellWaterInjectionPair.put(report.getTaskId(), tempResult);
-                } else {
-                    wellWaterInjectionPair.put(report.getTaskId(), report.getDailyWaterInjection());
-                } */
+
                 // 电量
                 if (wellPowerPair.containsKey(report.getTaskId())) {
                     BigDecimal tempPower = wellPowerPair.get(report.getTaskId());
@@ -926,38 +941,6 @@ public class IotRhDailyReportController {
                             tempReports.add(report);
                             deptReportsPair.put(report.getDeptId(), tempReports);
                         }
-                        // 注气量
-                        /* if (yearGasInjectionPair.containsKey(report.getDeptId())) {
-                            BigDecimal tempGasInjection = yearGasInjectionPair.get(report.getDeptId());
-                            BigDecimal tempResult = tempGasInjection.add(report.getDailyGasInjection());
-                            yearGasInjectionPair.put(report.getDeptId(), tempResult);
-                        } else {
-                            yearGasInjectionPair.put(report.getDeptId(), report.getDailyGasInjection());
-                        } */
-                        // 注水量
-                        /* if (yearWaterInjectionPair.containsKey(report.getDeptId())) {
-                            BigDecimal tempWaterInjection = yearWaterInjectionPair.get(report.getDeptId());
-                            BigDecimal tempResult = tempWaterInjection.add(report.getDailyWaterInjection());
-                            yearWaterInjectionPair.put(report.getDeptId(), tempResult);
-                        } else {
-                            yearWaterInjectionPair.put(report.getDeptId(), report.getDailyWaterInjection());
-                        } */
-                        // 电量
-                        /* if (yearPowerPair.containsKey(report.getDeptId())) {
-                            BigDecimal tempPower = yearPowerPair.get(report.getDeptId());
-                            BigDecimal tempResult = tempPower.add(report.getDailyPowerUsage());
-                            yearPowerPair.put(report.getDeptId(), tempResult);
-                        } else {
-                            yearPowerPair.put(report.getDeptId(), report.getDailyPowerUsage());
-                        } */
-                        // 油耗
-                        /* if (yearFuelPair.containsKey(report.getDeptId())) {
-                            BigDecimal tempFuel = yearFuelPair.get(report.getDeptId());
-                            BigDecimal tempResult = tempFuel.add(report.getDailyOilUsage());
-                            yearFuelPair.put(report.getDeptId(), tempResult);
-                        } else {
-                            yearFuelPair.put(report.getDeptId(), report.getDailyOilUsage());
-                        } */
                     });
 
                     // 2. 对每个部门的日报列表按 createTime 排序,计算滚动累计
@@ -1120,6 +1103,8 @@ public class IotRhDailyReportController {
             }
             // 2.1 拼接部门信息
             findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
+            // 队伍下 增压机 设备型号
+            findAndThen(deviceNoPair, reportVO.getDeptId(), deviceNo -> reportVO.setDeviceNo(deviceNo));
             // 2.1 拼接项目部信息
             findAndThen(projectDeptNamePair, reportVO.getDeptId(), projectDeptName -> reportVO.setProjectDeptName(projectDeptName));
             // 队伍当年累计注气量

+ 2 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrhdailyreport/vo/IotRhDailyReportRespVO.java

@@ -288,5 +288,6 @@ public class IotRhDailyReportRespVO {
     @Schema(description = "任务施工工艺 value 区分 注氮 注天然气")
     private String technique;
 
-
+    @Schema(description = "队伍下增压机 的设备型号")
+    private String deviceNo;
 }