| | |
| | | * @decription |
| | | * @date 2023/8/8 10:49 |
| | | */ |
| | | //@Component |
| | | @Component |
| | | public class HeartbeatSchedule { |
| | | |
| | | @Autowired |
| | |
| | | private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | |
| | | @Scheduled(cron = "0/1 * * * * ?") // 每秒执行一次 |
| | | |
| | | @Scheduled(cron = "0/30 * * * * ?") |
| | | @Async(value = "SocketTaskExecutor") |
| | | public void gasConcentrationStatus() { |
| | | GasConcentration gasConcentration = gasConcentrationService.getLastData(); |
| | | if (gasConcentration != null){ |
| | | LocalDateTime lastReceiveTime = gasConcentration.getDataReceivingTime().plusMinutes(1); |
| | | LocalDateTime lastReceiveTime = gasConcentration.getDataReceivingTime().plusMinutes(2); |
| | | if (LocalDateTime.now().compareTo(lastReceiveTime) > 0){ |
| | | try { |
| | | heartbeatExcWebsocketServer.sendInfo(HeartbeatExecEnum.GAS_CONCENTRATION.getStatus()+"",null); |