设备缓存增加iotModelCode
This commit is contained in:
parent
f9484cfce6
commit
633566bda8
@ -34,6 +34,8 @@ public class DeviceInfoCache {
|
||||
*/
|
||||
private Long iotModelId;
|
||||
|
||||
private String iotModelCode;
|
||||
|
||||
/**
|
||||
* 制造商
|
||||
*/
|
||||
|
@ -1,9 +1,11 @@
|
||||
package com.das.modules.cache.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.das.modules.cache.domain.DeviceInfoCache;
|
||||
import com.das.modules.cache.service.EquipmentCache;
|
||||
import com.das.modules.equipment.entity.SysEquipment;
|
||||
import com.das.modules.equipment.mapper.SysEquipmentMapper;
|
||||
import com.das.modules.equipment.mapper.SysIotModelMapper;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.PreDestroy;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -18,7 +20,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public class EquipmentCacheImpl implements EquipmentCache {
|
||||
@Autowired
|
||||
SysEquipmentMapper sysEquipmentMapper;
|
||||
|
||||
@Autowired
|
||||
SysIotModelMapper sysIotModelMapper;
|
||||
|
||||
/**
|
||||
* 设备CODE索引,用于通过设备CODE访问设备缓存信息
|
||||
@ -43,6 +46,10 @@ public class EquipmentCacheImpl implements EquipmentCache {
|
||||
deviceInfoCache.setMadeinFactory(equipment.getMadeinFactory());
|
||||
deviceInfoCache.setParentDeviceId(equipment.getParentEquipmentId());
|
||||
deviceInfoCache.setIotModelId(equipment.getIotModelId());
|
||||
String iotModelCode = sysIotModelMapper.getIotModel(equipment.getIotModelId());
|
||||
if (StrUtil.isNotBlank(iotModelCode)){
|
||||
deviceInfoCache.setIotModelCode(iotModelCode);
|
||||
}
|
||||
//创建Code索引
|
||||
deviceCodeIndex.put(deviceInfoCache.getDeviceCode(),deviceInfoCache);
|
||||
//创建Id索引
|
||||
|
@ -102,8 +102,8 @@ public class AnalogDataCommand implements BaseCommand {
|
||||
}
|
||||
hiSpeedData.setValues(hiSpeedValues);
|
||||
lowSpeedData.setValues(lowSpeedValues);
|
||||
tdEngineService.updateYCHighValues(List.of(hiSpeedData), dev.getModel());
|
||||
tdEngineService.updateYCLowValues(List.of(lowSpeedData), dev.getModel());
|
||||
tdEngineService.updateYCHighValues(List.of(hiSpeedData), dev.getIotModelCode());
|
||||
tdEngineService.updateYCLowValues(List.of(lowSpeedData), dev.getIotModelCode());
|
||||
}
|
||||
redisTemplate.opsForValue().multiSet(redisValues);
|
||||
}
|
||||
|
@ -86,8 +86,9 @@ public class StateDataCommand implements BaseCommand {
|
||||
}
|
||||
hiSpeedData.setValues(hiSpeedValues);
|
||||
lowSpeedData.setValues(lowSpeedValues);
|
||||
tdEngineService.updateYCHighValues(List.of(hiSpeedData), dev.getModel());
|
||||
tdEngineService.updateYCLowValues(List.of(lowSpeedData), dev.getModel());
|
||||
|
||||
tdEngineService.updateYCHighValues(List.of(hiSpeedData), dev.getIotModelCode());
|
||||
tdEngineService.updateYCLowValues(List.of(lowSpeedData),dev.getIotModelCode());
|
||||
}
|
||||
redisTemplate.opsForValue().multiSet(redisValues);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user