| | |
| | | package com.sandu.ximon.admin.manager.iot.amqp.processor; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightErrorCodeReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightHeartbeatReportInnerFrame; |
| | |
| | | import com.sandu.ximon.admin.service.LightReportDataService; |
| | | import com.sandu.ximon.admin.service.LightReportErrorService; |
| | | import com.sandu.ximon.admin.service.LightService; |
| | | import com.sandu.ximon.dao.domain.LightReportError; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | |
| | | log.info("心跳相应"); |
| | | A5LightHeartbeatReportInnerFrame heartbeatReportInnerFrame = new A5LightHeartbeatReportInnerFrame().transformFrame(frame.getPayload()); |
| | | |
| | | System.out.println("心跳包: " + JSON.toJSONString(heartbeatReportInnerFrame)); |
| | | |
| | | if (heartbeatReportInnerFrame.isValidate()) { |
| | | SpringContextHolder.getBean(LightReportDataService.class).saveReportData(deviceName, heartbeatReportInnerFrame.getHeartBeatDataPackage()); |
| | | //心跳包上报不保存硬件设备信息 |
| | | // SpringContextHolder.getBean(LightService.class).saveLight(deviceName, heartbeatReportInnerFrame.getHeartBeatDataPackage()); |
| | | SpringContextHolder.getBean(LightService.class).saveLight(deviceName, heartbeatReportInnerFrame.getHeartBeatDataPackage()); |
| | | } |
| | | |
| | | } else if (A5LightReportEnum.Time_Synchronized.getCode().equals(functionCode)) { |
| | |
| | | A5LightErrorCodeReportInnerFrame codeRespInnerFrame = new A5LightErrorCodeReportInnerFrame().transformFrame(frame.getPayload()); |
| | | log.info(codeRespInnerFrame.isValidate() + "是否通过校验"); |
| | | log.info(codeRespInnerFrame.getErrorCode() + "故障码"); |
| | | if (codeRespInnerFrame.isValidate() && (codeRespInnerFrame.getErrorCode() != 0)) { |
| | | if (codeRespInnerFrame.isValidate()) { |
| | | SpringContextHolder.getBean(LightReportErrorService.class).saveReportError(deviceName, codeRespInnerFrame); |
| | | } |
| | | //0000 表示没有故障,发送清除故障指令 |
| | | if (codeRespInnerFrame.getErrorCode() == 0) { |
| | | System.out.println("清除故障操作!"); |
| | | SpringContextHolder.getBean(LightReportErrorService.class).cleanErrorCode(deviceName, codeRespInnerFrame.getDestinationAddress()); |
| | | } |
| | | } |
| | | } |
| | | } |