|
|
@@ -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);
|
|
|
}
|
|
|
|
|
|
}
|