瀏覽代碼

pms 瑞恒日报 区分氮气 天然气 注气量

zhangcl 3 天之前
父節點
當前提交
05094271f1

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

@@ -520,13 +520,39 @@ public class IotRhDailyReportController {
 
         List<IotRhDailyReportDO> list = iotRhDailyReportService.getIotRhDailyReportPage(pageReqVO).getList();
         Map<String, BigDecimal> result = new HashMap<>();
+        // 累计注气量
         BigDecimal totalGasInjection = BigDecimal.ZERO;
+        // 累计氮气注气量
+        BigDecimal totalN2GasInjection = BigDecimal.ZERO;
+        // 累计天然气注气量
+        BigDecimal totalNaturalGasInjection = BigDecimal.ZERO;
+
         BigDecimal totalWaterInjection = BigDecimal.ZERO;
         BigDecimal totalPowerConsumption = BigDecimal.ZERO;
         BigDecimal totalFuelConsumption = BigDecimal.ZERO;
         double rate = 0.0;
         Integer reportCount = 0;
         if (CollUtil.isNotEmpty(list)) {
+            // 筛选出指定搜索条件下日报关联任务的工艺 类别 N2 或 天然气
+            Set<Long> filteredTaskIds = new HashSet<>();
+            list.forEach(report -> {
+                if (ObjUtil.isNotEmpty(report.getTaskId())) {
+                    filteredTaskIds.add(report.getTaskId());
+                }
+            });
+            // 查询日报对应的任务列表 获得 任务的施工工艺 N2(2) 或 天然气(15)
+            IotProjectTaskPageReqVO taskReqVO = new IotProjectTaskPageReqVO();
+            taskReqVO.setTaskIds(new ArrayList<>(filteredTaskIds));
+            List<IotProjectTaskDO> tasks = iotProjectTaskService.projectTasks(taskReqVO);
+            Map<Long, String> taskTechniquePair = new HashMap<>();
+            if (CollUtil.isNotEmpty(tasks)) {
+                tasks.forEach(task -> {
+                    if (StrUtil.isNotBlank(task.getTechnique())) {
+                        taskTechniquePair.put(task.getId(), task.getTechnique());
+                    }
+                });
+            }
+
             for (IotRhDailyReportDO report : list) {
                 // 统计出状态为 LY 的项目部下的施工队伍的日报数量
                 if (teamProjectIdPair.containsKey(report.getDeptId())) {
@@ -538,6 +564,17 @@ public class IotRhDailyReportController {
                 BigDecimal oilConsumption = report.getDailyOilUsage();
                 if (ObjUtil.isNotEmpty(dailyGasInjection)) {
                     totalGasInjection = totalGasInjection.add(dailyGasInjection);
+                    if (taskTechniquePair.containsKey(report.getTaskId())) {
+                        String technique = taskTechniquePair.get(report.getTaskId());
+                        if ("2".equals(technique)) {
+                            // 注氮气
+                            totalN2GasInjection = totalN2GasInjection.add(dailyGasInjection);
+                        }
+                        if ("15".equals(technique)) {
+                            // 注天然气
+                            totalNaturalGasInjection = totalNaturalGasInjection.add(dailyGasInjection);
+                        }
+                    }
                 }
                 if (ObjUtil.isNotEmpty(dailyWaterInjection)) {
                     totalWaterInjection = totalWaterInjection.add(dailyWaterInjection);
@@ -572,6 +609,10 @@ public class IotRhDailyReportController {
             }
             // 汇总 指定搜索时间段内的 累计注气量 累计注水量 累计用电量 累计油耗
             result.put("totalGasInjection", totalGasInjection);
+            // 区分出 累计注气量 中的 氮气/天然气 注气量
+            result.put("totalN2GasInjection", totalN2GasInjection);
+            result.put("totalNaturalGasInjection", totalNaturalGasInjection);
+
             result.put("totalWaterInjection", totalWaterInjection);
             result.put("totalPowerConsumption", totalPowerConsumption);
             result.put("totalFuelConsumption", totalFuelConsumption);
@@ -806,6 +847,10 @@ public class IotRhDailyReportController {
                 nptReasonPair.put(data.getValue(), data.getLabel());
             });
         }
+        // 施工工艺数据字典集合 key施工工艺value    value施工工艺label
+        Map<String, String> techniquePair = new HashMap<>();
+        // 施工工艺数据字典集合 key任务id    value施工工艺label
+        Map<Long, String> taskTechniqueNamePair = new HashMap<>();
         DataPermissionUtils.executeIgnore(() -> {
             // 查询日报关联的项目信息
             IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
@@ -820,6 +865,15 @@ public class IotRhDailyReportController {
             IotProjectTaskPageReqVO taskReqVO = new IotProjectTaskPageReqVO();
             taskReqVO.setTaskIds(convertList(reports, IotRhDailyReportDO::getTaskId));
             List<IotProjectTaskDO> tasks = iotProjectTaskService.projectTasks(taskReqVO);
+
+            // 查询 瑞恒 施工工艺 数据字典集合 匹配数据字典value 对应的 label
+            List<DictDataDO> techniqueDictData = dictDataService.getDictDataListByDictType("rq_iot_project_technology_rh");
+            if (CollUtil.isNotEmpty(techniqueDictData)) {
+                techniqueDictData.forEach(data -> {
+                    techniquePair.put(data.getValue(), data.getLabel());
+                });
+            }
+
             if (CollUtil.isNotEmpty(tasks)) {
                 tasks.forEach(task -> {
                     taskPair.put(task.getId(), task.getWellName());
@@ -835,6 +889,11 @@ public class IotRhDailyReportController {
                             });
                         }
                     }
+                    // 设置每个任务对应的施工工艺数据字典label
+                    if (techniquePair.containsKey(task.getTechnique())) {
+                        String techniqueLabel = techniquePair.get(task.getTechnique());
+                        taskTechniqueNamePair.put(task.getId(), techniqueLabel);
+                    }
                 });
             }
             // 查询当前日报所属施工队伍中包含 增压机 的产能
@@ -958,6 +1017,8 @@ public class IotRhDailyReportController {
             findAndThen(constructStatusPair, reportVO.getConstructionStatus(), statusLabel -> reportVO.setConstructionStatusName(statusLabel));
             // 非生产时间原因 数据字典
             findAndThen(nptReasonPair, reportVO.getNptReason(), statusLabel -> reportVO.setNptReasonName(statusLabel));
+            // 施工工艺字典 区分 注氮 注气
+            findAndThen(taskTechniqueNamePair, reportVO.getTaskId(), techniqueName -> reportVO.setTechniqueNames(techniqueName));
         });
     }
 

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

@@ -280,4 +280,10 @@ public class IotRhDailyReportRespVO {
 
     @Schema(description = "非生产时效")
     private BigDecimal nonProductionRate;
+
+    @Schema(description = "任务施工工艺 value 区分 注氮 注天然气")
+    private String technique;
+
+    @Schema(description = "施工工艺 label 区分 注氮 注天然气")
+    private String techniqueNames;
 }