|
@@ -1,5 +1,6 @@
|
|
|
package vip.xiaonuo.coldchain.core.renke.listener;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import rk.netDevice.sdk.p2.*;
|
|
@@ -29,26 +30,36 @@ public class JfcloudColdChainRenKeDefaultDataListener implements IDataListener {
|
|
|
|
|
|
@Override
|
|
|
public void receiveTimmingAck(TimmingAck data) {
|
|
|
+ log.info("================================================================");
|
|
|
log.info("接收到校时应答: 设备ID = {}", data.getDeviceId());
|
|
|
+ log.info("*************************************************************************");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void receiveTelecontrolAck(TelecontrolAck data) {
|
|
|
+ log.info("================================================================");
|
|
|
log.info("接收到遥控指令应答: 设备ID = {}", data.getDeviceId());
|
|
|
+ log.info("*************************************************************************");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void receiveStoreData(StoreData data) {
|
|
|
+ log.info("======================== 设备ID: {} ========================================", data.getDeviceId());
|
|
|
log.info("接收到存储数据: 设备ID = {}", data.getDeviceId());
|
|
|
+
|
|
|
data.getNodeList().forEach(nodeData -> log.info("记录ID: {}, 记录时间: {}, 温度: {}, 湿度: {}", nodeData.getNodeId(), nodeData.getRecordTime(), nodeData.getTem(), nodeData.getHum()));
|
|
|
- log.info("================================================================");
|
|
|
+ log.info("*************************************************************************");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void receiveRealtimeData(RealTimeData data) {
|
|
|
- log.info("接收到实时数据: 设备ID = {}", data.getDeviceId());
|
|
|
- data.getNodeList().forEach(nodeData -> log.info("记录ID: {}, 记录时间: {}, 温度: {}, 湿度: {}", nodeData.getNodeId(), nodeData.getRecordTime(), nodeData.getTem(), nodeData.getHum()));
|
|
|
- log.info("================================================================");
|
|
|
+ log.info("======================== 设备ID: {} ========================================", data.getDeviceId());
|
|
|
+ log.info("接收到实时数据: 设备ID = {},时间: {}", data.getDeviceId(), DateUtil.now());
|
|
|
+ data.getNodeList().forEach(nodeData -> {
|
|
|
+ log.info("记录ID: {}, 记录时间: {}, 温度: {}°C, 湿度: {}%", nodeData.getNodeId(), nodeData.getRecordTime(), nodeData.getTem(), nodeData.getHum());
|
|
|
+ });
|
|
|
+ log.info("*************************************************************************");
|
|
|
+
|
|
|
RenKeColdChainMessageData renKeColdChainMessageData = new RenKeColdChainMessageData();
|
|
|
renKeColdChainMessageData.setRealTimeData(data);
|
|
|
renKeColdChainDataHandler.handleRealTimeData(renKeColdChainMessageData);
|
|
@@ -56,7 +67,9 @@ public class JfcloudColdChainRenKeDefaultDataListener implements IDataListener {
|
|
|
|
|
|
@Override
|
|
|
public void receiveLoginData(LoginData data) {
|
|
|
+ log.info("======================== 设备ID: {} ========================================", data.getDeviceId());
|
|
|
log.info("接收到设备登录信息: 设备ID = {}\n{}", data.getDeviceId(), JSONUtil.toJsonStr(data));
|
|
|
+ log.info("*************************************************************************");
|
|
|
RenKeColdChainMessageData renKeColdChainMessageData = new RenKeColdChainMessageData();
|
|
|
renKeColdChainMessageData.setDeviceId(data.getDeviceId());
|
|
|
renKeColdChainDataHandler.login(renKeColdChainMessageData);
|
|
@@ -64,31 +77,41 @@ public class JfcloudColdChainRenKeDefaultDataListener implements IDataListener {
|
|
|
|
|
|
@Override
|
|
|
public void receiveParamIds(ParamIdsData data) {
|
|
|
+ log.info("======================== 设备ID: {} ========================================", data.getDeviceId());
|
|
|
log.info("接收到设备参数【编号】信息{}", JSONUtil.toJsonStr(data));
|
|
|
+ log.info("*************************************************************************");
|
|
|
// 更新设备编号参数
|
|
|
monitorDeviceService.updateParamIds(data);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void receiveParam(ParamData data) {
|
|
|
+ log.info("======================== 设备ID: {} ========================================", data.getDeviceId());
|
|
|
log.info("接收到设备参数【配置项目】信息: {}", JSONUtil.toJsonStr(data));
|
|
|
+ log.info("*************************************************************************");
|
|
|
// 更新设备参数
|
|
|
monitorDeviceService.updateParameters(data);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void receiveWriteParamAck(WriteParamAck data) {
|
|
|
- log.info("接收到参数下载应答:{}", data);
|
|
|
+ log.info("======================== 设备ID: {} ========================================", data.getDeviceId());
|
|
|
+ log.info("接收到参数下载应答:{}", JSONUtil.toJsonStr(data));
|
|
|
+ log.info("*************************************************************************");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void receiveTransDataAck(TransDataAck data) {
|
|
|
- log.info("接收到透传数据应答:{}", data);
|
|
|
+ log.info("======================== 设备ID: {} ========================================", data.getDeviceId());
|
|
|
+ log.info("接收到透传数据应答:{}", JSONUtil.toJsonStr(data));
|
|
|
+ log.info("*************************************************************************");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void receiveHeartbeatData(HeartbeatData heartbeatData) {
|
|
|
- log.info("接收到心跳包: 设备ID = {}", heartbeatData.getDeviceId());
|
|
|
+ log.info("======================== 设备ID: {} ========================================", heartbeatData.getDeviceId());
|
|
|
+ log.info("接收到心跳包: 设备ID = {}", JSONUtil.toJsonStr(heartbeatData));
|
|
|
+ log.info("*************************************************************************");
|
|
|
RenKeColdChainMessageData renKeColdChainMessageData = new RenKeColdChainMessageData();
|
|
|
renKeColdChainMessageData.setDeviceId(heartbeatData.getDeviceId());
|
|
|
renKeColdChainDataHandler.login(renKeColdChainMessageData);
|