| | |
| | | |
| | | private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | //@Scheduled(cron = "1 * * * * *") // 每分钟执行一次 |
| | | @Scheduled(cron = "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); |
| | |
| | | if (save == null) |
| | | throw new BusinessException(this.getClass(), ResultCode.SYSTEM_ERROR_DATABASE_FAIL.getCode(),"设备异常日志保存失败"); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw new BusinessException(this.getClass(), ResultCode.SYSTEM_ERROR_WEBSOCKET_SEND_INFO_FAIL.getCode(),"设备异常消息推送失败"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (save == null) |
| | | throw new BusinessException(this.getClass(), ResultCode.SYSTEM_ERROR_DATABASE_FAIL.getCode(),"设备异常日志保存失败"); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw new BusinessException(this.getClass(), ResultCode.SYSTEM_ERROR_WEBSOCKET_SEND_INFO_FAIL.getCode(),"设备异常消息推送失败"); |
| | | } |
| | | } |
| | | } |