Forráskód Böngészése

pms 瑞都 日报汇总 导出

zhangcl 2 napja
szülő
commit
2d94d29e60

+ 76 - 4
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrddailyreport/IotRdDailyReportController.java

@@ -2423,16 +2423,88 @@ public class IotRdDailyReportController {
     }
 
     @GetMapping("/export-excel")
-    @Operation(summary = "导出瑞都日报 Excel")
+    @Operation(summary = "导出瑞都日报汇总 Excel")
     @PreAuthorize("@ss.hasPermission('pms:iot-rd-daily-report:export')")
     @ApiAccessLog(operateType = EXPORT)
     public void exportIotRdDailyReportExcel(@Valid IotRdDailyReportPageReqVO pageReqVO,
               HttpServletResponse response) throws IOException {
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
-        List<IotRdDailyReportDO> list = iotRdDailyReportService.getIotRdDailyReportPage(pageReqVO).getList();
+        // 根据查询参数筛选出 符合条件 的记录id 再传入 分页查询
+        Set<Long> projectIds = new HashSet<>();
+        Set<Long> taskIds = new HashSet<>();
+        if (StrUtil.isNotBlank(pageReqVO.getContractName())) {
+            IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
+            reqVO.setContractName(pageReqVO.getContractName());
+            List<IotProjectInfoDO> projects = iotProjectInfoService.getIotProjectInfos(reqVO);
+            if (CollUtil.isNotEmpty(projects)) {
+                projects.forEach(project -> {
+                    projectIds.add(project.getId());
+                });
+                pageReqVO.setProjectIds(projectIds);
+            }
+        }
+        if (StrUtil.isNotBlank(pageReqVO.getTaskName())) {
+            IotProjectTaskPageReqVO reqVO = new IotProjectTaskPageReqVO();
+            reqVO.setSearchKey(pageReqVO.getTaskName());
+            List<IotProjectTaskDO> tasks = iotProjectTaskService.projectTasks(reqVO);
+            if (CollUtil.isNotEmpty(tasks)) {
+                tasks.forEach(task -> {
+                    taskIds.add(task.getId());
+                });
+                pageReqVO.setTaskIds(taskIds);
+            }
+        }
+        List<IotRdDailyReportStatisticsRespVO> result = iotRdDailyReportService.statistics(pageReqVO);
+        // 提取出所有工作量数据
+        if (CollUtil.isNotEmpty(result)) {
+            // key施工状态数据字典value   value施工状态数据字典label
+            Map<String, String> constructStatusPair = new HashMap<>();
+            // 施工状态 字典数据
+            List<DictDataDO> rdStatusData = dictDataService.getDictDataListByDictType("rdStatus");
+            if (CollUtil.isNotEmpty(rdStatusData)) {
+                rdStatusData.forEach(data -> {
+                    constructStatusPair.put(data.getValue(), data.getLabel());
+                });
+            }
+
+            result.forEach(well -> {
+                // 施工状态
+                if (constructStatusPair.containsKey(well.getRdStatus())) {
+                    well.setRdStatusLabel(constructStatusPair.get(well.getRdStatus()));
+                }
+                // 统计了井信息
+                List<IotRdDailyReportStatisticsItemVO> items = well.getItems();
+                if (CollUtil.isNotEmpty(items)) {
+                    items.forEach(item -> {
+                        // 设置每个工作量的值
+                        if ("个数".equals(item.getUnit())) {
+                            well.setCumulativeBridgePlug(item.getWorkload());
+                        }
+                        if ("趟数".equals(item.getUnit())) {
+                            well.setCumulativeRunCount(item.getWorkload());
+                        }
+                        if ("小时".equals(item.getUnit())) {
+                            well.setCumulativeHourCount(item.getWorkload());
+                        }
+                        if ("方".equals(item.getUnit())) {
+                            well.setCumulativeWaterVolume(item.getWorkload());
+                        }
+                        if ("井数".equals(item.getUnit())) {
+                            well.setCumulativeWorkingWell(item.getWorkload());
+                        }
+                        if ("段数".equals(item.getUnit())) {
+                            well.setCumulativeWorkingLayers(item.getWorkload());
+                        }
+                        if ("台次".equals(item.getUnit())) {
+                            well.setTaici(item.getWorkload());
+                        }
+                    });
+                }
+            });
+        }
         // 导出 Excel
-        ExcelUtils.write(response, "瑞都日报.xls", "数据", IotRdDailyReportRespVO.class,
-                        BeanUtils.toBean(list, IotRdDailyReportRespVO.class));
+        ExcelUtils.write(response, "瑞都日报汇总.xls", "日报汇总", IotRdDailyReportStatisticsRespVO.class,
+                result);
     }
 
 }

+ 10 - 11
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrddailyreport/vo/IotRdDailyReportStatisticsRespVO.java

@@ -15,11 +15,9 @@ import java.util.List;
 public class IotRdDailyReportStatisticsRespVO {
 
     @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13853")
-    @ExcelProperty("主键id")
     private Long id;
 
     @Schema(description = "项目部id", example = "125")
-    @ExcelProperty("项目部id")
     private Long deptId;
 
     @Schema(description = "项目部id", example = "125")
@@ -44,7 +42,6 @@ public class IotRdDailyReportStatisticsRespVO {
     private String type;
 
     @Schema(description = "任务id", example = "15678")
-    @ExcelProperty("任务id")
     private Long taskId;
 
     @Schema(description = "甲方")
@@ -56,13 +53,16 @@ public class IotRdDailyReportStatisticsRespVO {
     private String wellName;
 
     @Schema(description = "施工周期 天")
-    @ExcelProperty("施工周期")
+    @ExcelProperty("施工周期(D)")
     private String period;
 
     @Schema(description = "施工状态")
-    @ExcelProperty("施工状态")
     private String rdStatus;
 
+    @Schema(description = "施工状态")
+    @ExcelProperty("施工状态")
+    private String rdStatusLabel;
+
     @Schema(description = "施工工艺 多个逗号分隔")
     @ExcelProperty("施工工艺")
     private String techniques;
@@ -72,11 +72,9 @@ public class IotRdDailyReportStatisticsRespVO {
     private BigDecimal workloadDesign;
 
     @Schema(description = "已完成工作量")
-    @ExcelProperty("已完成工作量")
     private BigDecimal finishedWorkload;
 
     @Schema(description = "任务创建时间")
-    @ExcelProperty("任务创建时间")
     private LocalDateTime createTime;
 
     @Schema(description = "油耗L")
@@ -87,7 +85,6 @@ public class IotRdDailyReportStatisticsRespVO {
     private Integer sort;
 
     @Schema(description = "工作量明细")
-    @ExcelProperty("工作量明细")
     private List<IotRdDailyReportStatisticsItemVO> items;
 
     // 汇总统计 工作量
@@ -107,12 +104,14 @@ public class IotRdDailyReportStatisticsRespVO {
     @ExcelProperty("水方量(方)")
     private BigDecimal cumulativeWaterVolume;
     @Schema(description = "段数  累计施工-层")
-    @ExcelProperty("段数  累计施工-层")
+    @ExcelProperty("段数")
     private BigDecimal cumulativeWorkingLayers;
     @Schema(description = "台次 当日仪表/混砂")
-    @ExcelProperty("台次 当日仪表/混砂")
     private BigDecimal cumulativeMixSand;
     @Schema(description = "台次 当日泵车台次")
-    @ExcelProperty("台次 当日泵车台次")
     private BigDecimal cumulativePumpTrips;
+
+    @Schema(description = "台次 泵车台次 仪表/混砂")
+    @ExcelProperty("台次")
+    private BigDecimal taici;
 }