|
@@ -857,6 +857,121 @@ public class IotRhDailyReportController {
|
|
|
// key小组最后1条记录id value 小计平均运行时效
|
|
// key小组最后1条记录id value 小计平均运行时效
|
|
|
Map<Long, BigDecimal> groupIdTransTimePair = new HashMap<>();
|
|
Map<Long, BigDecimal> groupIdTransTimePair = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
+ // key队伍id value 队伍当年累计注气量
|
|
|
|
|
+ Map<Long, BigDecimal> yearGasInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value 队伍当年累计注水量
|
|
|
|
|
+ Map<Long, BigDecimal> yearWaterInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value 队伍当年累计用电量
|
|
|
|
|
+ Map<Long, BigDecimal> yearPowerPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value 队伍当年累计油耗
|
|
|
|
|
+ Map<Long, BigDecimal> yearFuelPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key任务井id value 井累计注气量
|
|
|
|
|
+ Map<Long, BigDecimal> wellGasInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key任务井id value 井累计注水量
|
|
|
|
|
+ Map<Long, BigDecimal> wellWaterInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key任务井id value 井累计用电量
|
|
|
|
|
+ Map<Long, BigDecimal> wellPowerPair = new HashMap<>();
|
|
|
|
|
+ // key任务井id value 井累计油耗
|
|
|
|
|
+ Map<Long, BigDecimal> wellFuelPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 查询所有井日报数据
|
|
|
|
|
+ IotRhDailyReportPageReqVO wellTaskReqVO = new IotRhDailyReportPageReqVO();
|
|
|
|
|
+ wellTaskReqVO.setTaskIds(convertList(reports, IotRhDailyReportDO::getTaskId));
|
|
|
|
|
+ List<IotRhDailyReportDO> taskDailyReports = iotRhDailyReportMapper.dailyReports(wellTaskReqVO);
|
|
|
|
|
+
|
|
|
|
|
+ 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 (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());
|
|
|
|
|
+ BigDecimal tempResult = tempPower.add(report.getDailyPowerUsage());
|
|
|
|
|
+ wellPowerPair.put(report.getTaskId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wellPowerPair.put(report.getTaskId(), report.getDailyPowerUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 油耗
|
|
|
|
|
+ if (wellFuelPair.containsKey(report.getTaskId())) {
|
|
|
|
|
+ BigDecimal tempFuel = wellFuelPair.get(report.getTaskId());
|
|
|
|
|
+ BigDecimal tempResult = tempFuel.add(report.getDailyOilUsage());
|
|
|
|
|
+ wellFuelPair.put(report.getTaskId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wellFuelPair.put(report.getTaskId(), report.getDailyOilUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 根据传递的时间筛选获取要查询的 yyyy
|
|
|
|
|
+ // 如果没有传递时间区间 默认当年
|
|
|
|
|
+ LocalDateTime nowDate = LocalDateTime.now();
|
|
|
|
|
+ String year = StrUtil.EMPTY;
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pageReqVO.getCreateTime())) {
|
|
|
|
|
+ LocalDateTime[] createTimeAttr = pageReqVO.getCreateTime();
|
|
|
|
|
+ if (createTimeAttr.length > 0) {
|
|
|
|
|
+ LocalDateTime startTime = createTimeAttr[0];
|
|
|
|
|
+ year = String.valueOf(startTime.getYear());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ year = String.valueOf(nowDate.getYear());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 只有传递了 时间查询条件 才会查询 当年累计的工作量数据
|
|
|
|
|
+ IotRhDailyReportPageReqVO yearReqVO = new IotRhDailyReportPageReqVO();
|
|
|
|
|
+ yearReqVO.setYear(year);
|
|
|
|
|
+ yearReqVO.setDeptIds(convertList(reports, IotRhDailyReportDO::getDeptId));
|
|
|
|
|
+ List<IotRhDailyReportDO> dailyReports = iotRhDailyReportMapper.dailyReports(yearReqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
|
|
+ dailyReports.forEach(report -> {
|
|
|
|
|
+ // 注气量
|
|
|
|
|
+ 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());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 查询 当前分页 所有部门 任务井 日报数据 小计工作量
|
|
// 查询 当前分页 所有部门 任务井 日报数据 小计工作量
|
|
|
IotRhDailyReportPageReqVO currentTaskReqVO = new IotRhDailyReportPageReqVO();
|
|
IotRhDailyReportPageReqVO currentTaskReqVO = new IotRhDailyReportPageReqVO();
|
|
|
currentTaskReqVO.setTaskIds(convertSet(reports, IotRhDailyReportDO::getTaskId));
|
|
currentTaskReqVO.setTaskIds(convertSet(reports, IotRhDailyReportDO::getTaskId));
|
|
@@ -1028,6 +1143,11 @@ public class IotRhDailyReportController {
|
|
|
reportVO.setTransitTimeRate(transitTimeRate);
|
|
reportVO.setTransitTimeRate(transitTimeRate);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 导出列表时 格式化时间为 yyyy-MM-dd
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(reportVO.getCreateTime())) {
|
|
|
|
|
+ reportVO.setCreateTimeStr(LocalDateTimeUtil.format(reportVO.getCreateTime(), DatePattern.NORM_DATE_PATTERN));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 转换用电量 单位 kWh 转换成 MWh
|
|
// 转换用电量 单位 kWh 转换成 MWh
|
|
|
// 用电量 kWh 转换单位 MWh
|
|
// 用电量 kWh 转换单位 MWh
|
|
|
if (reportVO.getDailyPowerUsage().compareTo(BigDecimal.ZERO) > 0) {
|
|
if (reportVO.getDailyPowerUsage().compareTo(BigDecimal.ZERO) > 0) {
|
|
@@ -1036,6 +1156,13 @@ public class IotRhDailyReportController {
|
|
|
reportVO.setDailyPowerUsage(powerW);
|
|
reportVO.setDailyPowerUsage(powerW);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 转换当日油耗 原始单位 方 转换成 万方
|
|
|
|
|
+ if (reportVO.getDailyGasInjection().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
+ BigDecimal gasW = reportVO.getDailyGasInjection()
|
|
|
|
|
+ .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ reportVO.setDailyGasInjection(gasW);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 2.1 拼接部门信息
|
|
// 2.1 拼接部门信息
|
|
|
findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
|
|
|
|
|
@@ -1071,13 +1198,57 @@ public class IotRhDailyReportController {
|
|
|
// 2.4 设计注气量
|
|
// 2.4 设计注气量
|
|
|
findAndThen(taskExtPropertyPair, reportVO.getTaskId(), designInjection -> reportVO.setDesignInjection(designInjection));
|
|
findAndThen(taskExtPropertyPair, reportVO.getTaskId(), designInjection -> reportVO.setDesignInjection(designInjection));
|
|
|
// 2.5 搬迁安装天数
|
|
// 2.5 搬迁安装天数
|
|
|
- findAndThen(relocationDaysPair, reportVO.getDeptId(), relocationDays -> reportVO.setRelocationDays(relocationDays));
|
|
|
|
|
|
|
+ findAndThen(relocationDaysPair, reportVO.getDeptId(), relocationDays -> {
|
|
|
|
|
+ if (relocationDays.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
+ reportVO.setRelocationDays(BigDecimal.ZERO);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ reportVO.setRelocationDays(relocationDays);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
// 2.6 产能
|
|
// 2.6 产能
|
|
|
findAndThen(capacityPair.get(), reportVO.getDeptId(), capacity -> reportVO.setCapacity(capacity));
|
|
findAndThen(capacityPair.get(), reportVO.getDeptId(), capacity -> reportVO.setCapacity(capacity));
|
|
|
// 施工状态 数据字典
|
|
// 施工状态 数据字典
|
|
|
findAndThen(constructStatusPair, reportVO.getConstructionStatus(), statusLabel -> reportVO.setConstructionStatusName(statusLabel));
|
|
findAndThen(constructStatusPair, reportVO.getConstructionStatus(), statusLabel -> reportVO.setConstructionStatusName(statusLabel));
|
|
|
// 非生产时间原因 数据字典
|
|
// 非生产时间原因 数据字典
|
|
|
findAndThen(nptReasonPair, reportVO.getNptReason(), statusLabel -> reportVO.setNptReasonName(statusLabel));
|
|
findAndThen(nptReasonPair, reportVO.getNptReason(), statusLabel -> reportVO.setNptReasonName(statusLabel));
|
|
|
|
|
+
|
|
|
|
|
+ // 井当年累计注气量
|
|
|
|
|
+ findAndThen(wellGasInjectionPair, reportVO.getTaskId(), gasInjection -> {
|
|
|
|
|
+ // 转换单位为 万方
|
|
|
|
|
+ BigDecimal gasInjectionWanFang = gasInjection
|
|
|
|
|
+ .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ reportVO.setWellTotalGasInjection(gasInjectionWanFang);
|
|
|
|
|
+ });
|
|
|
|
|
+ // 井当年累计注水量
|
|
|
|
|
+ findAndThen(wellWaterInjectionPair, reportVO.getTaskId(), waterInjection -> reportVO.setWellTotalWaterInjection(waterInjection));
|
|
|
|
|
+ // 井当年累计用电量
|
|
|
|
|
+ findAndThen(wellPowerPair, reportVO.getTaskId(), power -> {
|
|
|
|
|
+ // 换算单位为 MWh
|
|
|
|
|
+ BigDecimal powerW = power
|
|
|
|
|
+ .divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ reportVO.setWellTotalPower(powerW);
|
|
|
|
|
+ });
|
|
|
|
|
+ // 井当年累计油耗
|
|
|
|
|
+ findAndThen(wellFuelPair, reportVO.getTaskId(), fuel -> reportVO.setWellTotalFuel(fuel));
|
|
|
|
|
+
|
|
|
|
|
+ // 队伍当年累计注气量
|
|
|
|
|
+ findAndThen(yearGasInjectionPair, reportVO.getDeptId(), gasInjection -> {
|
|
|
|
|
+ // 转换单位为 万方
|
|
|
|
|
+ BigDecimal gasInjectionWanFang = gasInjection
|
|
|
|
|
+ .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ reportVO.setYearTotalGasInjection(gasInjectionWanFang);
|
|
|
|
|
+ });
|
|
|
|
|
+ // 队伍当年累计注水量
|
|
|
|
|
+ findAndThen(yearWaterInjectionPair, reportVO.getDeptId(), waterInjection -> reportVO.setYearTotalWaterInjection(waterInjection));
|
|
|
|
|
+ // 队伍当年累计用电量
|
|
|
|
|
+ findAndThen(yearPowerPair, reportVO.getDeptId(), power -> {
|
|
|
|
|
+ // 换算单位为 MWh
|
|
|
|
|
+ BigDecimal powerW = power
|
|
|
|
|
+ .divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ reportVO.setYearTotalPower(powerW);
|
|
|
|
|
+ });
|
|
|
|
|
+ // 队伍当年累计油耗
|
|
|
|
|
+ findAndThen(yearFuelPair, reportVO.getDeptId(), fuel -> reportVO.setYearTotalFuel(fuel));
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1135,6 +1306,120 @@ public class IotRhDailyReportController {
|
|
|
// key小组最后1条记录id value 任务井小计平均运行时效
|
|
// key小组最后1条记录id value 任务井小计平均运行时效
|
|
|
Map<Long, BigDecimal> groupIdTransTimePair = new HashMap<>();
|
|
Map<Long, BigDecimal> groupIdTransTimePair = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
+ // key队伍id value 队伍当年累计注气量
|
|
|
|
|
+ Map<Long, BigDecimal> yearGasInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value 队伍当年累计注水量
|
|
|
|
|
+ Map<Long, BigDecimal> yearWaterInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value 队伍当年累计用电量
|
|
|
|
|
+ Map<Long, BigDecimal> yearPowerPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value 队伍当年累计油耗
|
|
|
|
|
+ Map<Long, BigDecimal> yearFuelPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key任务井id value 井累计注气量
|
|
|
|
|
+ Map<Long, BigDecimal> wellGasInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key任务井id value 井累计注水量
|
|
|
|
|
+ Map<Long, BigDecimal> wellWaterInjectionPair = new HashMap<>();
|
|
|
|
|
+ // key任务井id value 井累计用电量
|
|
|
|
|
+ Map<Long, BigDecimal> wellPowerPair = new HashMap<>();
|
|
|
|
|
+ // key任务井id value 井累计油耗
|
|
|
|
|
+ Map<Long, BigDecimal> wellFuelPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 查询所有井日报数据
|
|
|
|
|
+ IotRhDailyReportPageReqVO teamTaskReqVO = new IotRhDailyReportPageReqVO();
|
|
|
|
|
+ teamTaskReqVO.setTaskIds(convertList(reports, IotRhDailyReportDO::getTaskId));
|
|
|
|
|
+ List<IotRhDailyReportDO> taskDailyReports = iotRhDailyReportMapper.dailyReports(teamTaskReqVO);
|
|
|
|
|
+ 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 (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());
|
|
|
|
|
+ BigDecimal tempResult = tempPower.add(report.getDailyPowerUsage());
|
|
|
|
|
+ wellPowerPair.put(report.getTaskId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wellPowerPair.put(report.getTaskId(), report.getDailyPowerUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 油耗
|
|
|
|
|
+ if (wellFuelPair.containsKey(report.getTaskId())) {
|
|
|
|
|
+ BigDecimal tempFuel = wellFuelPair.get(report.getTaskId());
|
|
|
|
|
+ BigDecimal tempResult = tempFuel.add(report.getDailyOilUsage());
|
|
|
|
|
+ wellFuelPair.put(report.getTaskId(), tempResult);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wellFuelPair.put(report.getTaskId(), report.getDailyOilUsage());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 根据传递的时间筛选获取要查询的 yyyy
|
|
|
|
|
+ // 如果没有传递时间区间 默认当年
|
|
|
|
|
+ LocalDateTime nowDate = LocalDateTime.now();
|
|
|
|
|
+ String year = StrUtil.EMPTY;
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pageReqVO.getCreateTime())) {
|
|
|
|
|
+ LocalDateTime[] createTimeAttr = pageReqVO.getCreateTime();
|
|
|
|
|
+ if (createTimeAttr.length > 0) {
|
|
|
|
|
+ LocalDateTime startTime = createTimeAttr[0];
|
|
|
|
|
+ year = String.valueOf(startTime.getYear());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ year = String.valueOf(nowDate.getYear());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 只有传递了 时间查询条件 才会查询 当年累计的工作量数据
|
|
|
|
|
+ IotRhDailyReportPageReqVO yearReqVO = new IotRhDailyReportPageReqVO();
|
|
|
|
|
+ yearReqVO.setYear(year);
|
|
|
|
|
+ yearReqVO.setDeptIds(convertList(reports, IotRhDailyReportDO::getDeptId));
|
|
|
|
|
+ List<IotRhDailyReportDO> dailyReports = iotRhDailyReportMapper.dailyReports(yearReqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
|
|
+ dailyReports.forEach(report -> {
|
|
|
|
|
+ // 注气量
|
|
|
|
|
+ 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());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 查询 当前分页 所有部门 任务井 日报数据 小计工作量
|
|
// 查询 当前分页 所有部门 任务井 日报数据 小计工作量
|
|
|
IotRhDailyReportPageReqVO currentTaskReqVO = new IotRhDailyReportPageReqVO();
|
|
IotRhDailyReportPageReqVO currentTaskReqVO = new IotRhDailyReportPageReqVO();
|
|
|
currentTaskReqVO.setTaskIds(convertSet(reports, IotRhDailyReportDO::getTaskId));
|
|
currentTaskReqVO.setTaskIds(convertSet(reports, IotRhDailyReportDO::getTaskId));
|
|
@@ -1307,12 +1592,24 @@ public class IotRhDailyReportController {
|
|
|
// 赋值
|
|
// 赋值
|
|
|
reportVO.setTransitTimeRate(transitTimeRate);
|
|
reportVO.setTransitTimeRate(transitTimeRate);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 导出列表时 格式化时间为 yyyy-MM-dd
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(reportVO.getCreateTime())) {
|
|
|
|
|
+ reportVO.setCreateTimeStr(LocalDateTimeUtil.format(reportVO.getCreateTime(), DatePattern.NORM_DATE_PATTERN));
|
|
|
|
|
+ }
|
|
|
// 用电量 kWh 转换单位 MWh
|
|
// 用电量 kWh 转换单位 MWh
|
|
|
if (reportVO.getDailyPowerUsage().compareTo(BigDecimal.ZERO) > 0) {
|
|
if (reportVO.getDailyPowerUsage().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
BigDecimal powerW = reportVO.getDailyPowerUsage()
|
|
BigDecimal powerW = reportVO.getDailyPowerUsage()
|
|
|
.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP);
|
|
.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP);
|
|
|
reportVO.setDailyPowerUsage(powerW);
|
|
reportVO.setDailyPowerUsage(powerW);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 转换当日油耗 原始单位 方 转换成 万方
|
|
|
|
|
+ if (reportVO.getDailyGasInjection().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
+ BigDecimal gasW = reportVO.getDailyGasInjection()
|
|
|
|
|
+ .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ reportVO.setDailyGasInjection(gasW);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 2.1 拼接部门信息
|
|
// 2.1 拼接部门信息
|
|
|
findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
|
|
|
|
|
@@ -1348,13 +1645,57 @@ public class IotRhDailyReportController {
|
|
|
// 2.4 设计注气量
|
|
// 2.4 设计注气量
|
|
|
findAndThen(taskExtPropertyPair, reportVO.getTaskId(), designInjection -> reportVO.setDesignInjection(designInjection));
|
|
findAndThen(taskExtPropertyPair, reportVO.getTaskId(), designInjection -> reportVO.setDesignInjection(designInjection));
|
|
|
// 2.5 搬迁安装天数
|
|
// 2.5 搬迁安装天数
|
|
|
- findAndThen(relocationDaysPair, reportVO.getDeptId(), relocationDays -> reportVO.setRelocationDays(relocationDays));
|
|
|
|
|
|
|
+ findAndThen(relocationDaysPair, reportVO.getDeptId(), relocationDays -> {
|
|
|
|
|
+ if (relocationDays.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
+ reportVO.setRelocationDays(BigDecimal.ZERO);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ reportVO.setRelocationDays(relocationDays);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
// 2.6 产能
|
|
// 2.6 产能
|
|
|
findAndThen(capacityPair.get(), reportVO.getDeptId(), capacity -> reportVO.setCapacity(capacity));
|
|
findAndThen(capacityPair.get(), reportVO.getDeptId(), capacity -> reportVO.setCapacity(capacity));
|
|
|
// 施工状态 数据字典
|
|
// 施工状态 数据字典
|
|
|
findAndThen(constructStatusPair, reportVO.getConstructionStatus(), statusLabel -> reportVO.setConstructionStatusName(statusLabel));
|
|
findAndThen(constructStatusPair, reportVO.getConstructionStatus(), statusLabel -> reportVO.setConstructionStatusName(statusLabel));
|
|
|
// 非生产时间原因 数据字典
|
|
// 非生产时间原因 数据字典
|
|
|
findAndThen(nptReasonPair, reportVO.getNptReason(), statusLabel -> reportVO.setNptReasonName(statusLabel));
|
|
findAndThen(nptReasonPair, reportVO.getNptReason(), statusLabel -> reportVO.setNptReasonName(statusLabel));
|
|
|
|
|
+
|
|
|
|
|
+ // 队伍当年累计注气量
|
|
|
|
|
+ findAndThen(yearGasInjectionPair, reportVO.getDeptId(), gasInjection -> {
|
|
|
|
|
+ // 转换单位为 万方
|
|
|
|
|
+ BigDecimal gasInjectionWanFang = gasInjection
|
|
|
|
|
+ .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ reportVO.setYearTotalGasInjection(gasInjectionWanFang);
|
|
|
|
|
+ });
|
|
|
|
|
+ // 队伍当年累计注水量
|
|
|
|
|
+ findAndThen(yearWaterInjectionPair, reportVO.getDeptId(), waterInjection -> reportVO.setYearTotalWaterInjection(waterInjection));
|
|
|
|
|
+ // 队伍当年累计用电量
|
|
|
|
|
+ findAndThen(yearPowerPair, reportVO.getDeptId(), power -> {
|
|
|
|
|
+ // 换算单位为 MWh
|
|
|
|
|
+ BigDecimal powerW = power
|
|
|
|
|
+ .divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ reportVO.setYearTotalPower(powerW);
|
|
|
|
|
+ });
|
|
|
|
|
+ // 队伍当年累计油耗
|
|
|
|
|
+ findAndThen(yearFuelPair, reportVO.getDeptId(), fuel -> reportVO.setYearTotalFuel(fuel));
|
|
|
|
|
+
|
|
|
|
|
+ // 井当年累计注气量
|
|
|
|
|
+ findAndThen(wellGasInjectionPair, reportVO.getTaskId(), gasInjection -> {
|
|
|
|
|
+ // 转换单位为 万方
|
|
|
|
|
+ BigDecimal gasInjectionWanFang = gasInjection
|
|
|
|
|
+ .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ reportVO.setWellTotalGasInjection(gasInjectionWanFang);
|
|
|
|
|
+ });
|
|
|
|
|
+ // 井当年累计注水量
|
|
|
|
|
+ findAndThen(wellWaterInjectionPair, reportVO.getTaskId(), waterInjection -> reportVO.setWellTotalWaterInjection(waterInjection));
|
|
|
|
|
+ // 井当年累计用电量
|
|
|
|
|
+ findAndThen(wellPowerPair, reportVO.getTaskId(), power -> {
|
|
|
|
|
+ // 换算单位为 MWh
|
|
|
|
|
+ BigDecimal powerW = power
|
|
|
|
|
+ .divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
+ reportVO.setWellTotalPower(powerW);
|
|
|
|
|
+ });
|
|
|
|
|
+ // 井当年累计油耗
|
|
|
|
|
+ findAndThen(wellFuelPair, reportVO.getTaskId(), fuel -> reportVO.setWellTotalFuel(fuel));
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1448,4 +1789,80 @@ public class IotRhDailyReportController {
|
|
|
IotRhDailyReportStatisticsRespVO.class, statistics);
|
|
IotRhDailyReportStatisticsRespVO.class, statistics);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @GetMapping("/exportSingleWells")
|
|
|
|
|
+ @Operation(summary = "导出瑞恒日报 报表统计 单井 Excel")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-rh-daily-report:export')")
|
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+ public void exportSingleWells(@Valid IotRhDailyReportPageReqVO 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<IotRhDailyReportDO> reports = iotRhDailyReportService.teamReports(pageReqVO).getList();
|
|
|
|
|
+ // 导出 Excel
|
|
|
|
|
+ ExcelUtils.write(response, "瑞恒日报单井统计.xls", "日报单井统计",
|
|
|
|
|
+ IotRhDailyReportRespVO.class, buildSubtotalRhDailyReports(reports, pageReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/exportSingleTeams")
|
|
|
|
|
+ @Operation(summary = "导出瑞恒日报 报表统计 队伍 Excel")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-rh-daily-report:export')")
|
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+ public void exportSingleTeams(@Valid IotRhDailyReportPageReqVO 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<IotRhDailyReportDO> reports = iotRhDailyReportService.wellReports(pageReqVO).getList();
|
|
|
|
|
+ // 导出 Excel
|
|
|
|
|
+ ExcelUtils.write(response, "瑞恒日报单队伍统计.xls", "日报单队伍统计",
|
|
|
|
|
+ IotRhDailyReportRespVO.class, buildWellRhDailyReports(reports, pageReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|