|
|
@@ -727,6 +727,26 @@ public class IotRyDailyReportController {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ // key施工状态数据字典value value施工状态数据字典label
|
|
|
+ Map<String, String> constructStatusPair = new HashMap<>();
|
|
|
+
|
|
|
+ // 钻井 施工状态 字典数据
|
|
|
+ List<DictDataDO> rigStatusDictData = dictDataService.getDictDataListByDictType("rigStatus");
|
|
|
+ // 修井 施工状态 字典数据
|
|
|
+ List<DictDataDO> repairStatusDictData = dictDataService.getDictDataListByDictType("repairStatus");
|
|
|
+ // 钻井施工状态
|
|
|
+ if ("1".equals(pageReqVO.getProjectClassification()) && CollUtil.isNotEmpty(rigStatusDictData)) {
|
|
|
+ rigStatusDictData.forEach(data -> {
|
|
|
+ constructStatusPair.put(data.getValue(), data.getLabel());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 修井施工状态
|
|
|
+ if ("2".equals(pageReqVO.getProjectClassification()) && CollUtil.isNotEmpty(repairStatusDictData)) {
|
|
|
+ repairStatusDictData.forEach(data -> {
|
|
|
+ constructStatusPair.put(data.getValue(), data.getLabel());
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
DataPermissionUtils.executeIgnore(() -> {
|
|
|
// 查询日报关联的项目信息
|
|
|
IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
|
|
|
@@ -806,8 +826,30 @@ public class IotRyDailyReportController {
|
|
|
// 2.1 拼接部门信息
|
|
|
findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
|
|
|
|
+ findAndThen(completedTasksPair, reportVO.getDeptId(), completedTaskCount -> reportVO.setCompletedWells(completedTaskCount));
|
|
|
+ // 钻井 施工状态 数据字典
|
|
|
+ findAndThen(constructStatusPair, reportVO.getRigStatus(), statusLabel -> {
|
|
|
+ if ("1".equals(pageReqVO.getProjectClassification())) {
|
|
|
+ reportVO.setConstructionStatusName(statusLabel);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 修井 施工状态 数据字典
|
|
|
+ findAndThen(constructStatusPair, reportVO.getRepairStatus(), statusLabel -> {
|
|
|
+ if ("2".equals(pageReqVO.getProjectClassification())) {
|
|
|
+ reportVO.setConstructionStatusName(statusLabel);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 创建时间 格式化 yyyy-MM-dd
|
|
|
+ if (ObjUtil.isNotEmpty(reportVO.getCreateTime())) {
|
|
|
+ reportVO.setCreateTimeStr(LocalDateTimeUtil.format(reportVO.getCreateTime(), DatePattern.NORM_DATE_PATTERN));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 上井次完井时间 格式化时间为 yyyy-MM-dd
|
|
|
+ if (ObjUtil.isNotEmpty(reportVO.getLatestWellDoneTime())) {
|
|
|
+ reportVO.setLatestWellDoneTimeStr(LocalDateTimeUtil.format(reportVO.getLatestWellDoneTime(), DatePattern.NORM_DATE_PATTERN));
|
|
|
+ }
|
|
|
+
|
|
|
// 转换用电量 单位 kWh 转换成 MWh
|
|
|
- // 用电量 kWh 转换单位 MWh
|
|
|
if (reportVO.getDailyPowerUsage().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
BigDecimal powerW = reportVO.getDailyPowerUsage()
|
|
|
.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP);
|
|
|
@@ -1100,6 +1142,25 @@ public class IotRyDailyReportController {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ // key施工状态数据字典value value施工状态数据字典label
|
|
|
+ Map<String, String> constructStatusPair = new HashMap<>();
|
|
|
+ // 钻井 施工状态 字典数据
|
|
|
+ List<DictDataDO> rigStatusDictData = dictDataService.getDictDataListByDictType("rigStatus");
|
|
|
+ // 修井 施工状态 字典数据
|
|
|
+ List<DictDataDO> repairStatusDictData = dictDataService.getDictDataListByDictType("repairStatus");
|
|
|
+ // 钻井施工状态
|
|
|
+ if ("1".equals(pageReqVO.getProjectClassification()) && CollUtil.isNotEmpty(rigStatusDictData)) {
|
|
|
+ rigStatusDictData.forEach(data -> {
|
|
|
+ constructStatusPair.put(data.getValue(), data.getLabel());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 修井施工状态
|
|
|
+ if ("2".equals(pageReqVO.getProjectClassification()) && CollUtil.isNotEmpty(repairStatusDictData)) {
|
|
|
+ repairStatusDictData.forEach(data -> {
|
|
|
+ constructStatusPair.put(data.getValue(), data.getLabel());
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
DataPermissionUtils.executeIgnore(() -> {
|
|
|
// 查询日报关联的项目信息
|
|
|
IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
|
|
|
@@ -1179,8 +1240,16 @@ public class IotRyDailyReportController {
|
|
|
// 2.1 拼接部门信息
|
|
|
findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
|
|
|
|
+ // 日报生成日期 格式化时间为 yyyy-MM-dd
|
|
|
+ if (ObjUtil.isNotEmpty(reportVO.getCreateTime())) {
|
|
|
+ reportVO.setCreateTimeStr(LocalDateTimeUtil.format(reportVO.getCreateTime(), DatePattern.NORM_DATE_PATTERN));
|
|
|
+ }
|
|
|
+ // 上井次完井时间 格式化时间为 yyyy-MM-dd
|
|
|
+ if (ObjUtil.isNotEmpty(reportVO.getLatestWellDoneTime())) {
|
|
|
+ reportVO.setLatestWellDoneTimeStr(LocalDateTimeUtil.format(reportVO.getLatestWellDoneTime(), DatePattern.NORM_DATE_PATTERN));
|
|
|
+ }
|
|
|
+
|
|
|
// 转换用电量 单位 kWh 转换成 MWh
|
|
|
- // 用电量 kWh 转换单位 MWh
|
|
|
if (reportVO.getDailyPowerUsage().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
BigDecimal powerW = reportVO.getDailyPowerUsage()
|
|
|
.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP);
|
|
|
@@ -1246,6 +1315,18 @@ public class IotRyDailyReportController {
|
|
|
// 2.8 总施工井数 完工井数
|
|
|
findAndThen(totalTasksPair, reportVO.getDeptId(), totalTaskCount -> reportVO.setTotalConstructionWells(totalTaskCount));
|
|
|
findAndThen(completedTasksPair, reportVO.getDeptId(), completedTaskCount -> reportVO.setCompletedWells(completedTaskCount));
|
|
|
+ // 钻井 施工状态 数据字典
|
|
|
+ findAndThen(constructStatusPair, reportVO.getRigStatus(), statusLabel -> {
|
|
|
+ if ("1".equals(pageReqVO.getProjectClassification())) {
|
|
|
+ reportVO.setConstructionStatusName(statusLabel);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 修井 施工状态 数据字典
|
|
|
+ findAndThen(constructStatusPair, reportVO.getRepairStatus(), statusLabel -> {
|
|
|
+ if ("2".equals(pageReqVO.getProjectClassification())) {
|
|
|
+ reportVO.setConstructionStatusName(statusLabel);
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -1535,4 +1616,80 @@ public class IotRyDailyReportController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/exportSingleWells")
|
|
|
+ @Operation(summary = "导出瑞鹰 日报 单井统计 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-ry-daily-report:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportSingleWells(@Valid IotRyDailyReportPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ // 根据查询参数筛选出 符合条件 的记录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<IotRyDailyReportDO> list = iotRyDailyReportService.teamReports(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "瑞鹰日报单井统计.xls", "瑞鹰日报单井统计数据", IotRyDailyReportRespVO.class,
|
|
|
+ buildSubtotalRyDailyReports(list, pageReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/exportSingleTeams")
|
|
|
+ @Operation(summary = "导出瑞鹰 日报 单队伍 统计 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-ry-daily-report:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportSingleTeams(@Valid IotRyDailyReportPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ // 根据查询参数筛选出 符合条件 的记录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<IotRyDailyReportDO> list = iotRyDailyReportService.wellReports(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "瑞鹰日报单队伍统计.xls", "瑞鹰日报单队伍统计数据", IotRyDailyReportRespVO.class,
|
|
|
+ buildWellRyDailyReports(list, pageReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
}
|