|
|
@@ -1656,7 +1656,7 @@ public class IotStaticController {
|
|
|
}
|
|
|
|
|
|
// key日期2026-06-08 value日期对应的日报数量
|
|
|
- Map<String, Set<Long>> dateReportDeviceIdPair = new HashMap<>();
|
|
|
+ Map<String, List<Long>> dateReportDeviceIdPair = new HashMap<>();
|
|
|
reports.forEach(report -> {
|
|
|
// 按照日期维度统计各 工作量数据 累计用电量 累计油耗 累计注气量 累计注水量
|
|
|
LocalDateTime reportLocalDate = report.getCreateTime();
|
|
|
@@ -1666,11 +1666,13 @@ public class IotStaticController {
|
|
|
Set<Long> reportDeviceIds = report.getDeviceIds();
|
|
|
if (CollUtil.isNotEmpty(reportDeviceIds)) {
|
|
|
if (dateReportDeviceIdPair.containsKey(reportDateStr)) {
|
|
|
- Set<Long> tempDeviceIds = dateReportDeviceIdPair.get(reportDateStr);
|
|
|
+ List<Long> tempDeviceIds = dateReportDeviceIdPair.get(reportDateStr);
|
|
|
tempDeviceIds.addAll(reportDeviceIds);
|
|
|
dateReportDeviceIdPair.put(reportDateStr, tempDeviceIds);
|
|
|
} else {
|
|
|
- dateReportDeviceIdPair.put(reportDateStr, reportDeviceIds);
|
|
|
+ List<Long> tempDeviceIds = new ArrayList<>();
|
|
|
+ tempDeviceIds.addAll(reportDeviceIds);
|
|
|
+ dateReportDeviceIdPair.put(reportDateStr, tempDeviceIds);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -1680,14 +1682,16 @@ public class IotStaticController {
|
|
|
dateReportDeviceIdPair.forEach((reportDateStr, deviceIds) -> {
|
|
|
// 计算每天的所有日报涉及到的压裂连油主设备
|
|
|
// 1. 求交集:实际使用的A B类设备
|
|
|
- Set<Long> utilizedDeviceIds = deviceIds.stream()
|
|
|
+ List<Long> utilizedDeviceIds = deviceIds.stream()
|
|
|
.filter(abDeviceIds::contains)
|
|
|
- .collect(Collectors.toSet());
|
|
|
+ .collect(Collectors.toList());
|
|
|
if (CollUtil.isNotEmpty(abDeviceIds)) {
|
|
|
BigDecimal deviceUtilization = new BigDecimal((double) utilizedDeviceIds.size() / abDeviceIds.size())
|
|
|
.setScale(4, RoundingMode.HALF_UP);
|
|
|
dateReportUtilizationPair.put(reportDateStr, deviceUtilization);
|
|
|
}
|
|
|
+ System.out.println(reportDateStr + "瑞都设备利用率-分子:" + utilizedDeviceIds.size());
|
|
|
+ System.out.println(reportDateStr + "瑞都设备利用率-分母:" + abDeviceIds.size());
|
|
|
});
|
|
|
}
|
|
|
// 5. 按日期升序补全最近7天,缺失填0
|