迁移deviceEvent,hisHighSpeed,hisLowSpeed至对应command
This commit is contained in:
parent
adcc19deb3
commit
8f337cb589
@ -1,7 +1,8 @@
|
|||||||
package com.das.modules.node.command;
|
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.data.service.TDEngineService;
|
||||||
import com.das.modules.equipment.mapper.SysIotModelMapper;
|
|
||||||
import com.das.modules.node.constant.NodeConstant;
|
import com.das.modules.node.constant.NodeConstant;
|
||||||
import com.das.modules.node.domain.bo.RTData;
|
import com.das.modules.node.domain.bo.RTData;
|
||||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||||
@ -21,10 +22,10 @@ public class HisHighSpeedCommand implements BaseCommand {
|
|||||||
NodeMessageService nodeMessageService;
|
NodeMessageService nodeMessageService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
SysIotModelMapper sysIotModelMapper;
|
TDEngineService tdEngineService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TDEngineService tdEngineService;
|
CacheService cacheService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doCommand(TerminalMessage data) {
|
public void doCommand(TerminalMessage data) {
|
||||||
@ -43,8 +44,8 @@ public class HisHighSpeedCommand implements BaseCommand {
|
|||||||
String deviceId = jsonNode.get("deviceId").asText();
|
String deviceId = jsonNode.get("deviceId").asText();
|
||||||
JsonNode values = jsonNode.get("values");
|
JsonNode values = jsonNode.get("values");
|
||||||
Map<String, Object> keyValueMap = new HashMap<>();
|
Map<String, Object> keyValueMap = new HashMap<>();
|
||||||
// 根据设备ID获取对应的物模型属性
|
// 根据设备ID获取对应的物模型code
|
||||||
String iotModelCode = sysIotModelMapper.getIotModel(jsonNode.get("deviceId").asLong());
|
DeviceInfoCache dev = cacheService.getEquipmentCache().getDeviceInfoCacheById(jsonNode.get("deviceId").asLong());
|
||||||
|
|
||||||
//High数据
|
//High数据
|
||||||
Iterator<String> keysHigh = values.fieldNames();
|
Iterator<String> keysHigh = values.fieldNames();
|
||||||
@ -61,6 +62,6 @@ public class HisHighSpeedCommand implements BaseCommand {
|
|||||||
.values(keyValueMap)
|
.values(keyValueMap)
|
||||||
.build();
|
.build();
|
||||||
highList.add(rtHighData);
|
highList.add(rtHighData);
|
||||||
tdEngineService.updateYCHighValues(highList, iotModelCode);
|
tdEngineService.updateYCHighValues(highList, dev.getIotModelCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.das.modules.node.command;
|
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.data.service.TDEngineService;
|
||||||
import com.das.modules.equipment.mapper.SysIotModelMapper;
|
import com.das.modules.equipment.mapper.SysIotModelMapper;
|
||||||
import com.das.modules.node.constant.NodeConstant;
|
import com.das.modules.node.constant.NodeConstant;
|
||||||
@ -17,10 +19,11 @@ import java.util.*;
|
|||||||
public class HisLowSpeedCommand implements BaseCommand {
|
public class HisLowSpeedCommand implements BaseCommand {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
SysIotModelMapper sysIotModelMapper;
|
TDEngineService tdEngineService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TDEngineService tdEngineService;
|
CacheService cacheService;
|
||||||
@Override
|
@Override
|
||||||
public void doCommand(TerminalMessage data) {
|
public void doCommand(TerminalMessage data) {
|
||||||
log.debug("收到[历史低频数据]");
|
log.debug("收到[历史低频数据]");
|
||||||
@ -38,8 +41,8 @@ public class HisLowSpeedCommand implements BaseCommand {
|
|||||||
String deviceId = jsonNode.get("deviceId").asText();
|
String deviceId = jsonNode.get("deviceId").asText();
|
||||||
JsonNode values = jsonNode.get("values");
|
JsonNode values = jsonNode.get("values");
|
||||||
Map<String, Object> keyValueMap = new HashMap<>();
|
Map<String, Object> keyValueMap = new HashMap<>();
|
||||||
// 根据设备ID获取对应的物模型属性
|
// 根据设备ID获取对应的物模型code
|
||||||
String iotModelCode = sysIotModelMapper.getIotModel(jsonNode.get("deviceId").asLong());
|
DeviceInfoCache dev = cacheService.getEquipmentCache().getDeviceInfoCacheById(jsonNode.get("deviceId").asLong());
|
||||||
|
|
||||||
//Low数据
|
//Low数据
|
||||||
Iterator<String> keysLow = values.fieldNames();
|
Iterator<String> keysLow = values.fieldNames();
|
||||||
@ -56,7 +59,7 @@ public class HisLowSpeedCommand implements BaseCommand {
|
|||||||
.values(keyValueMap)
|
.values(keyValueMap)
|
||||||
.build();
|
.build();
|
||||||
highList.add(rtHighData);
|
highList.add(rtHighData);
|
||||||
tdEngineService.updateYCLowValues(highList, iotModelCode);
|
tdEngineService.updateYCLowValues(highList, dev.getIotModelCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user