| | |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | |
| | | |
| | | |
| | | // 每天凌晨12点30执行 推送充电用能统计 |
| | | @Scheduled(cron = "0 30 0 * * ?") |
| | | public void superviseNotificationOperationStatsInfo() { |
| | | StationStatsInfoResult res = new StationStatsInfoResult(); |
| | | |
| | | int dayOfMonth1 = LocalDateTime.now().getYear(); |
| | | int dayOfMonth2 = LocalDateTime.now().getMonthValue(); |
| | | int dayOfMonth3 = LocalDateTime.now().getDayOfMonth(); |
| | | List<Site> data = siteClient.getSiteAll().getData(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime startLocalDateTime = now.minusDays(1); |
| | | LocalDateTime endLocalDateTime = now.minusDays(1); |
| | | // 获取今天凌晨 |
| | | startLocalDateTime.withHour(0); |
| | | startLocalDateTime.withMinute(0); |
| | | startLocalDateTime.withSecond(0); |
| | | LocalDateTime startLocalDateTime = LocalDateTime.of(dayOfMonth1, dayOfMonth2, dayOfMonth3, 0, 0, 0); |
| | | LocalDateTime endLocalDateTime = LocalDateTime.of(dayOfMonth1, dayOfMonth2, dayOfMonth3, 23, 59, 59); |
| | | String start = DateUtils.localDateTimeToString(startLocalDateTime); |
| | | endLocalDateTime.withHour(23); |
| | | endLocalDateTime.withMinute(59); |
| | | endLocalDateTime.withSecond(59); |
| | | String end = DateUtils.localDateTimeToString(endLocalDateTime); |
| | | ChargingStatisticeDTO chargingStatisticeDTO = new ChargingStatisticeDTO(); |
| | | chargingStatisticeDTO.setStartTime(startLocalDateTime); |
| | |
| | | BigDecimal divide = collect.stream().map(TChargingOrder::getChargingPower).reduce(BigDecimal::add).get().divide(new BigDecimal(collect.size()).setScale(4, BigDecimal.ROUND_DOWN)); |
| | | supStationPowerInfo.setStationRealTimePower(divide); |
| | | supStationPowerInfo.setEquipmentPowerInfos(buildEquipmentPowerInfo(datum.getId(), tChargingPiles, chargingGunList)); |
| | | |
| | | stationStatsInfos.add(supStationPowerInfo); |
| | | } |
| | | supStationPowerInfoResult.setStationStatsInfos(stationStatsInfos); |
| | | supStationPowerInfoResult.setSupStationPowerInfos(stationStatsInfos); |
| | | tcecSuperviseUtil.superviseNotificationRealtimePowerInfo(supStationPowerInfoResult); |
| | | |
| | | } |