From 8f337cb58919cabb639a752aaab9256862537f54 Mon Sep 17 00:00:00 2001 From: huguanghan Date: Fri, 3 Jan 2025 09:37:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BBdeviceEvent,hisHighSpeed,hisL?= =?UTF-8?q?owSpeed=E8=87=B3=E5=AF=B9=E5=BA=94command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/node/command/HisHighSpeedCommand.java | 13 +++++++------ .../modules/node/command/HisLowSpeedCommand.java | 13 ++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/das/src/main/java/com/das/modules/node/command/HisHighSpeedCommand.java b/das/src/main/java/com/das/modules/node/command/HisHighSpeedCommand.java index 37587dcb..4229cfe6 100644 --- a/das/src/main/java/com/das/modules/node/command/HisHighSpeedCommand.java +++ b/das/src/main/java/com/das/modules/node/command/HisHighSpeedCommand.java @@ -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 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 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()); } } diff --git a/das/src/main/java/com/das/modules/node/command/HisLowSpeedCommand.java b/das/src/main/java/com/das/modules/node/command/HisLowSpeedCommand.java index 289117fc..d21909b0 100644 --- a/das/src/main/java/com/das/modules/node/command/HisLowSpeedCommand.java +++ b/das/src/main/java/com/das/modules/node/command/HisLowSpeedCommand.java @@ -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 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 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()); } }