|
|
|
@ -55,7 +55,8 @@ public class StationChargeStatus { |
|
|
|
public static class GunUsageDuration { |
|
|
|
@Schema(description = "枪名") |
|
|
|
private String gunName; |
|
|
|
|
|
|
|
// @Schema(description = "枪id") |
|
|
|
// private String connectorId; |
|
|
|
@Schema(description = "枪使用时长,单位 h") |
|
|
|
private BigDecimal hours; |
|
|
|
} |
|
|
|
@ -75,7 +76,7 @@ public class StationChargeStatus { |
|
|
|
.collect( |
|
|
|
Collectors.toMap( |
|
|
|
ConnectorInfoEntity::getConnectorId, |
|
|
|
ConnectorInfoEntity::getConnectorName, |
|
|
|
ConnectorInfoEntity::getConnectorId, |
|
|
|
(v1, v2) -> v1)); |
|
|
|
|
|
|
|
// 汇总使用率数据 |
|
|
|
@ -97,10 +98,18 @@ public class StationChargeStatus { |
|
|
|
BigDecimal.valueOf(24 * (long) chargeStatus.getTotalGunCount()), |
|
|
|
3, |
|
|
|
RoundingMode.HALF_UP); |
|
|
|
List<GunUsageDuration> updatedList = |
|
|
|
gunUsageDurationList.stream() |
|
|
|
.sorted(Comparator.comparing(GunUsageDuration::getGunName)) // 排序 |
|
|
|
.toList(); |
|
|
|
|
|
|
|
// 遍历排序后的列表,设置connectorName为下标 |
|
|
|
for (int i = 0; i < updatedList.size(); i++) { |
|
|
|
updatedList.get(i).setGunName(String.valueOf(i)); // 设置connectorName为下标值 |
|
|
|
} |
|
|
|
return chargeStatus |
|
|
|
.setUsagePercent(usagePercent.multiply(new BigDecimal("100"))) |
|
|
|
.setGunUsageDurations(gunUsageDurationList); |
|
|
|
.setGunUsageDurations(updatedList); |
|
|
|
} |
|
|
|
|
|
|
|
private StationChargeStatus add(ConnectorInfoEntity gunInfo) { |
|
|
|
|