模拟数据上报修改

This commit is contained in:
huguanghan 2024-12-11 10:22:39 +08:00
parent 3eb790acdb
commit 8187ffe3a5

View File

@ -238,6 +238,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
@Override @Override
public void handleData(TerminalMessage data) { public void handleData(TerminalMessage data) {
JsonNode jsonNode = data.getData(); JsonNode jsonNode = data.getData();
log.info("收到消息:{}",data.getData());
String deviceId = jsonNode.get("deviceId").asText(); String deviceId = jsonNode.get("deviceId").asText();
JsonNode values = jsonNode.get("values"); JsonNode values = jsonNode.get("values");
JsonNode archiveValues = jsonNode.get("archiveValues"); JsonNode archiveValues = jsonNode.get("archiveValues");
@ -256,6 +257,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase()); String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
keyValueMap.put(key, values.get(fieldName)); keyValueMap.put(key, values.get(fieldName));
} }
log.info("values解析成功");
Iterator<String> archiveKeys = archiveValues.fieldNames(); Iterator<String> archiveKeys = archiveValues.fieldNames();
while (archiveKeys.hasNext()) { while (archiveKeys.hasNext()) {
String fieldName = archiveKeys.next(); String fieldName = archiveKeys.next();
@ -268,6 +270,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
lowSpeedValueMap.put(fieldName, values.get(fieldName)); lowSpeedValueMap.put(fieldName, values.get(fieldName));
} }
} }
log.info("archive解析成功");
//更新td //更新td
if (!highSpeedValueMap.isEmpty()) { if (!highSpeedValueMap.isEmpty()) {
List<RTData> highSpeedData = new ArrayList<>(); List<RTData> highSpeedData = new ArrayList<>();