| | |
| | | import com.ruoyi.order.api.model.TChargingBill; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.web.context.WebServerInitializedEvent; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | * @date 2023/7/11 8:39 |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> { |
| | | |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | |
| | | private Integer port = null; |
| | | |
| | | |
| | | @Override |
| | | public void onApplicationEvent(WebServerInitializedEvent event) { |
| | | port = event.getWebServer().getPort(); |
| | | System.out.println("端口号:" + port); |
| | | } |
| | | |
| | | |
| | | // 每天凌晨12点30执行 推送充电用能统计 |
| | | @Scheduled(cron = "0 30 0 * * ?") |
| | | public void superviseNotificationOperationStatsInfo() { |
| | | String port = System.getProperty("server.port"); |
| | | if("5071".equals(port)){ |
| | | if(null != port && port == 5701){ |
| | | StationStatsInfoResult res = new StationStatsInfoResult(); |
| | | int dayOfMonth1 = LocalDateTime.now().getYear(); |
| | | int dayOfMonth2 = LocalDateTime.now().getMonthValue(); |
| | |
| | | // 每15分钟执行一次的定时任务 |
| | | @Scheduled(cron = "0 0/15 * * * ?") |
| | | public void supervise_notification_realtime_power_info() { |
| | | String port = System.getProperty("server.port"); |
| | | if("5071".equals(port)){ |
| | | if(null != port && port == 5701){ |
| | | List<Site> data = siteClient.getSiteAll().getData(); |
| | | List<Integer> siteIds = data.stream().filter(s->s.getStatus() == 1).map(Site::getId).collect(Collectors.toList()); |
| | | List<TChargingPile> tChargingPiles = chargingPileClient.getChargingPileBySiteIds(siteIds).getData(); |