| | |
| | | } |
| | | List<Map<String,Object>> capMap = chargingOrderService.getchargingCapacity(siteIds,statisticsQueryDto); |
| | | List<TChargingPile> chargingPiles = chargingPileClient.getChargingPileBySiteIds(siteIds).getData(); |
| | | //获取chargingPiles的ratedPower的总和再乘以chargingPiles的数量再乘以24 |
| | | BigDecimal totalRatedPower = chargingPiles.stream().map(TChargingPile::getRatedPower).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(new BigDecimal(chargingPiles.size())).multiply(new BigDecimal(24)); |
| | | |
| | | //将capMap的chargingCapacity除以totalRatedPower保留两位数 |
| | | //每日利用率=当日充电度数/(总桩数量*桩总功率*24小时) |
| | | BigDecimal multiply1 = new BigDecimal(chargingPiles.size()).multiply(totalRatedPower).multiply(new BigDecimal(24)); |
| | | capMap.forEach(map -> { |
| | | BigDecimal chargingCapacity = (BigDecimal) map.get("chargingCapacity"); |
| | | BigDecimal result = chargingCapacity.divide(totalRatedPower, 4, RoundingMode.HALF_UP); |
| | | BigDecimal result = chargingCapacity.divide(multiply1, 4, RoundingMode.HALF_UP); |
| | | BigDecimal multiply = result.multiply(new BigDecimal(100)); |
| | | map.put("chargingCapacity", multiply); |
| | | }); |
| | | |
| | | |
| | | |
| | | // |
| | | // 解析 startTime 和 endTime 为 LocalDate |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | return R.ok(dateRangeStatistics); |
| | | |
| | | |
| | | } |
| | | |
| | | |