数据上报修改

This commit is contained in:
huguanghan 2024-11-20 16:43:53 +08:00
parent 460b158654
commit 82d6c7a491
2 changed files with 5 additions and 7 deletions

View File

@ -37,7 +37,6 @@ public class DataController {
public R<Map<String,Map<String,Object>>> querySnapshotValues(@RequestBody @Valid List<SnapshotValueQueryParam> param) {
if (log.isDebugEnabled()){
log.debug("/api/rtdbsvr/snapshot is calling");
log.debug(JsonUtils.toJsonString(param));
}
return R.success(dataService.querySnapshotValues(param));
}
@ -51,7 +50,6 @@ public class DataController {
public R<Map<String, Map<String, Map<String, Object>>>> queryTimeSeriesValues(@RequestBody @Valid TSValueQueryParam param) {
if (log.isDebugEnabled()){
log.debug("/api/rtdbsvr/timeseries is calling");
log.debug(JsonUtils.toJsonString(param));
}
return R.success(dataService.queryTimeSeriesValues(param));
}

View File

@ -235,9 +235,9 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
JsonNode values = jsonNode.get("values");
Long dataTime = jsonNode.get("dataTime").asLong();
Map<String, Object> keyValueMap = new HashMap<>();
DeviceInfoCache deviceInfoCacheById = cacheService.getEquipmentCache().getDeviceInfoCacheById(Long.valueOf(deviceId));
Set<String> highKey = dataService.highIotFieldMap.get(deviceInfoCacheById.getDeviceCode()).keySet();
Set<String> lowKey = dataService.lowIotFieldMap.get(deviceInfoCacheById.getDeviceCode()).keySet();
String modelCode = dataService.deviceModelMap.get(deviceId);
Set<String> highKey = dataService.highIotFieldMap.get(modelCode).keySet();
Set<String> lowKey = dataService.lowIotFieldMap.get(modelCode).keySet();
Map<String, Object> highSpeedValueMap = new HashMap<>();
Map<String, Object> lowSpeedValueMap = new HashMap<>();
@ -261,14 +261,14 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
List<RTData> highSpeedData = new ArrayList<>();
RTData rtHighData = RTData.builder().dataTime(dataTime).deviceId(Long.valueOf(deviceId)).values(highSpeedValueMap).build();
highSpeedData.add(rtHighData);
tdEngineService.updateYCHighValues(highSpeedData,deviceInfoCacheById.getDeviceCode());
tdEngineService.updateYCHighValues(highSpeedData,modelCode);
}
if (!lowSpeedValueMap.isEmpty()){
List<RTData> lowSpeedData = new ArrayList<>();
RTData rtLowData = RTData.builder().dataTime(dataTime).deviceId(Long.valueOf(deviceId)).values(lowSpeedValueMap).build();
lowSpeedData.add(rtLowData);
tdEngineService.updateYCLowValues(lowSpeedData,deviceInfoCacheById.getDeviceCode());
tdEngineService.updateYCLowValues(lowSpeedData,modelCode);
}
}
}