| | |
| | | |
| | | private static final String warnContentFormat = "【气体监测预警提示】{0} {1}气体浓度连续超标系统判断为{2},请相关负责人及时检查处置。"; |
| | | |
| | | private static final String deviceExcLogFormat = "【设备预警提示】{0} 硬件设备离线。"; |
| | | |
| | | private static final DateTimeFormatter deviceExcLogFormatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss"); |
| | | |
| | | private static final DateTimeFormatter warnLogFormatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss"); |
| | | |
| | | |
| | |
| | | throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"通量数据状态不能为空"); |
| | | Boolean push = false; |
| | | List<String> descs = new ArrayList<>(); |
| | | if (reqDTO.getHardwareState().size() > 1){ |
| | | if (!(reqDTO.getHardwareState().size() == 1 && reqDTO.getHardwareState().get(0) == 0)){ |
| | | push = true; |
| | | for (int i = 0; i < reqDTO.getHardwareState().size(); i++) { |
| | | descs.add(HardwareStateEnum.getValue(reqDTO.getHardwareState().get(i))); |
| | |
| | | String execInfo = JSON.toJSONString(descs); |
| | | logger.info("【警告】设备异常,异常原因: "+ execInfo); |
| | | DeviceExceptionLog log = new DeviceExceptionLog(); |
| | | log.setTime(LocalDateTime.now()); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | String content = MessageFormat.format(deviceExcLogFormat,deviceExcLogFormatter.format(now)); |
| | | log.setContent(content); |
| | | log.setTime(now); |
| | | log.setExecDesc(execInfo); |
| | | DeviceExceptionLog save = deviceExceptionLogService.save(log); |
| | | if (save == null) |