迁移deviceEvent,hisHighSpeed,hisLowSpeed至对应command

This commit is contained in:
huguanghan 2025-01-03 09:37:34 +08:00
parent adcc19deb3
commit 8f337cb589
2 changed files with 15 additions and 11 deletions

View File

@ -1,7 +1,8 @@
package com.das.modules.node.command;
import com.das.modules.cache.domain.DeviceInfoCache;
import com.das.modules.cache.service.CacheService;
import com.das.modules.data.service.TDEngineService;
import com.das.modules.equipment.mapper.SysIotModelMapper;
import com.das.modules.node.constant.NodeConstant;
import com.das.modules.node.domain.bo.RTData;
import com.das.modules.node.domain.bo.TerminalMessage;
@ -21,10 +22,10 @@ public class HisHighSpeedCommand implements BaseCommand {
NodeMessageService nodeMessageService;
@Autowired
SysIotModelMapper sysIotModelMapper;
TDEngineService tdEngineService;
@Autowired
TDEngineService tdEngineService;
CacheService cacheService;
@Override
public void doCommand(TerminalMessage data) {
@ -43,8 +44,8 @@ public class HisHighSpeedCommand implements BaseCommand {
String deviceId = jsonNode.get("deviceId").asText();
JsonNode values = jsonNode.get("values");
Map<String, Object> keyValueMap = new HashMap<>();
// 根据设备ID获取对应的物模型属性
String iotModelCode = sysIotModelMapper.getIotModel(jsonNode.get("deviceId").asLong());
// 根据设备ID获取对应的物模型code
DeviceInfoCache dev = cacheService.getEquipmentCache().getDeviceInfoCacheById(jsonNode.get("deviceId").asLong());
//High数据
Iterator<String> keysHigh = values.fieldNames();
@ -61,6 +62,6 @@ public class HisHighSpeedCommand implements BaseCommand {
.values(keyValueMap)
.build();
highList.add(rtHighData);
tdEngineService.updateYCHighValues(highList, iotModelCode);
tdEngineService.updateYCHighValues(highList, dev.getIotModelCode());
}
}

View File

@ -1,5 +1,7 @@
package com.das.modules.node.command;
import com.das.modules.cache.domain.DeviceInfoCache;
import com.das.modules.cache.service.CacheService;
import com.das.modules.data.service.TDEngineService;
import com.das.modules.equipment.mapper.SysIotModelMapper;
import com.das.modules.node.constant.NodeConstant;
@ -17,10 +19,11 @@ import java.util.*;
public class HisLowSpeedCommand implements BaseCommand {
@Autowired
SysIotModelMapper sysIotModelMapper;
TDEngineService tdEngineService;
@Autowired
TDEngineService tdEngineService;
CacheService cacheService;
@Override
public void doCommand(TerminalMessage data) {
log.debug("收到[历史低频数据]");
@ -38,8 +41,8 @@ public class HisLowSpeedCommand implements BaseCommand {
String deviceId = jsonNode.get("deviceId").asText();
JsonNode values = jsonNode.get("values");
Map<String, Object> keyValueMap = new HashMap<>();
// 根据设备ID获取对应的物模型属性
String iotModelCode = sysIotModelMapper.getIotModel(jsonNode.get("deviceId").asLong());
// 根据设备ID获取对应的物模型code
DeviceInfoCache dev = cacheService.getEquipmentCache().getDeviceInfoCacheById(jsonNode.get("deviceId").asLong());
//Low数据
Iterator<String> keysLow = values.fieldNames();
@ -56,7 +59,7 @@ public class HisLowSpeedCommand implements BaseCommand {
.values(keyValueMap)
.build();
highList.add(rtHighData);
tdEngineService.updateYCLowValues(highList, iotModelCode);
tdEngineService.updateYCLowValues(highList, dev.getIotModelCode());
}
}