2021与蓝度共同重构项目,服务端
MercuryZ
2022-10-18 ea94079e74182be590b9fff356c97f522d9a7828
ximon-admin/src/main/java/com/sandu/ximon/admin/manager/iot/amqp/processor/LightDataProcessor.java
@@ -49,18 +49,26 @@
            }
        } else if (A5LightReportEnum.Time_Synchronized.getCode().equals(functionCode)) {
//            log.info("请求时间同步");
            log.info("请求时间同步");
            A5LightTimeSyncReportInnerFrame syncRespInnerFrame = new A5LightTimeSyncReportInnerFrame().transformFrame(frame.getPayload());
//            log.info(syncRespInnerFrame.toString());
            log.info(syncRespInnerFrame.toString());
            if (syncRespInnerFrame.isValidate()) {
                SpringContextHolder.getBean(LightService.class).timeSynchronizationInitiative(deviceName, syncRespInnerFrame.getDestinationAddress());
            }
        } else if (A5LightReportEnum.Error_Code.getCode().equals(functionCode)) {
            log.info("故障码上报");
            A5LightErrorCodeReportInnerFrame codeRespInnerFrame = new A5LightErrorCodeReportInnerFrame().transformFrame(frame.getPayload());
            System.out.println(JSON.toJSONString(codeRespInnerFrame) + "++++++++++++++++++++++++++++");
            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());
            }
        }
    }
}