|
@@ -1195,6 +1195,21 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ Long days;
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pageReqVO.getCreateTime())) {
|
|
|
|
|
+ LocalDateTime[] createTimes = pageReqVO.getCreateTime();
|
|
|
|
|
+ // 获取开始时间和结束时间
|
|
|
|
|
+ LocalDateTime startTime = createTimes[0];
|
|
|
|
|
+ LocalDateTime endTime = createTimes[1];
|
|
|
|
|
+ // 截断到日期(忽略时分秒)
|
|
|
|
|
+ LocalDate startDate = startTime.toLocalDate();
|
|
|
|
|
+ LocalDate endDate = endTime.toLocalDate();
|
|
|
|
|
+ // 计算天数:日期差 + 1(包含首尾两天)
|
|
|
|
|
+ days = ChronoUnit.DAYS.between(startDate, endDate) + 1;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ days = 0l;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 生成返回的数据列表集合
|
|
// 生成返回的数据列表集合
|
|
|
projectDeptPair.forEach((deptId, dept) -> {
|
|
projectDeptPair.forEach((deptId, dept) -> {
|
|
|
IotRyDailyReportStatisticsRespVO statistics = new IotRyDailyReportStatisticsRespVO();
|
|
IotRyDailyReportStatisticsRespVO statistics = new IotRyDailyReportStatisticsRespVO();
|
|
@@ -1206,7 +1221,13 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
statistics.setCumulativeConstructWells(cumulativeConstructWellsPair.get(deptId));
|
|
statistics.setCumulativeConstructWells(cumulativeConstructWellsPair.get(deptId));
|
|
|
statistics.setCumulativeCompletedWells(cumulativeCompletedWellsPair.get(deptId));
|
|
statistics.setCumulativeCompletedWells(cumulativeCompletedWellsPair.get(deptId));
|
|
|
statistics.setCumulativePowerConsumption(cumulativePowerConsumptionPair.get(deptId));
|
|
statistics.setCumulativePowerConsumption(cumulativePowerConsumptionPair.get(deptId));
|
|
|
- statistics.setCumulativeFuelConsumption(cumulativeFuelConsumptionPair.get(deptId));
|
|
|
|
|
|
|
+ // 累计油耗
|
|
|
|
|
+ BigDecimal cumulativeFuelConsumption = cumulativeFuelConsumptionPair.get(deptId);
|
|
|
|
|
+ statistics.setCumulativeFuelConsumption(cumulativeFuelConsumption);
|
|
|
|
|
+ // 平均油耗
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(cumulativeFuelConsumption) && ObjUtil.isNotEmpty(pageReqVO.getCreateTime())) {
|
|
|
|
|
+ statistics.setAverageFuelConsumption(cumulativeFuelConsumption.divide(new BigDecimal(days), 2, RoundingMode.HALF_UP));
|
|
|
|
|
+ }
|
|
|
statistics.setTransitTime(cumulativeTransitTimePair.get(deptId));
|
|
statistics.setTransitTime(cumulativeTransitTimePair.get(deptId));
|
|
|
statistics.setNonProductiveTime(cumulativeNonProductionPair.get(deptId));
|
|
statistics.setNonProductiveTime(cumulativeNonProductionPair.get(deptId));
|
|
|
result.add(statistics);
|
|
result.add(statistics);
|
|
@@ -1552,6 +1573,21 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ Long days;
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pageReqVO.getCreateTime())) {
|
|
|
|
|
+ LocalDateTime[] createTimes = pageReqVO.getCreateTime();
|
|
|
|
|
+ // 获取开始时间和结束时间
|
|
|
|
|
+ LocalDateTime startTime = createTimes[0];
|
|
|
|
|
+ LocalDateTime endTime = createTimes[1];
|
|
|
|
|
+ // 截断到日期(忽略时分秒)
|
|
|
|
|
+ LocalDate startDate = startTime.toLocalDate();
|
|
|
|
|
+ LocalDate endDate = endTime.toLocalDate();
|
|
|
|
|
+ // 计算天数:日期差 + 1(包含首尾两天)
|
|
|
|
|
+ days = ChronoUnit.DAYS.between(startDate, endDate) + 1;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ days = 0l;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 生成返回的数据列表集合
|
|
// 生成返回的数据列表集合
|
|
|
teamDeptPair.forEach((teamDeptId, dept) -> {
|
|
teamDeptPair.forEach((teamDeptId, dept) -> {
|
|
|
IotRyDailyReportStatisticsRespVO statistics = new IotRyDailyReportStatisticsRespVO();
|
|
IotRyDailyReportStatisticsRespVO statistics = new IotRyDailyReportStatisticsRespVO();
|
|
@@ -1563,7 +1599,13 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
statistics.setCumulativeConstructWells(totalTasksPair.get(teamDeptId));
|
|
statistics.setCumulativeConstructWells(totalTasksPair.get(teamDeptId));
|
|
|
statistics.setCumulativeCompletedWells(completedTasksPair.get(teamDeptId));
|
|
statistics.setCumulativeCompletedWells(completedTasksPair.get(teamDeptId));
|
|
|
statistics.setCumulativePowerConsumption(cumulativePowerConsumptionPair.get(teamDeptId));
|
|
statistics.setCumulativePowerConsumption(cumulativePowerConsumptionPair.get(teamDeptId));
|
|
|
- statistics.setCumulativeFuelConsumption(cumulativeFuelConsumptionPair.get(teamDeptId));
|
|
|
|
|
|
|
+ // 累计油耗
|
|
|
|
|
+ BigDecimal cumulativeFuelConsumption = cumulativeFuelConsumptionPair.get(teamDeptId);
|
|
|
|
|
+ statistics.setCumulativeFuelConsumption(cumulativeFuelConsumption);
|
|
|
|
|
+ // 平均油耗
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(cumulativeFuelConsumption) && ObjUtil.isNotEmpty(pageReqVO.getCreateTime())) {
|
|
|
|
|
+ statistics.setAverageFuelConsumption(cumulativeFuelConsumption.divide(new BigDecimal(days), 2, RoundingMode.HALF_UP));
|
|
|
|
|
+ }
|
|
|
statistics.setTransitTime(cumulativeTransitTimePair.get(teamDeptId));
|
|
statistics.setTransitTime(cumulativeTransitTimePair.get(teamDeptId));
|
|
|
result.add(statistics);
|
|
result.add(statistics);
|
|
|
});
|
|
});
|