调整 EquipmentCache接口方法名称

This commit is contained in:
谷成伟 2024-11-04 16:17:35 +08:00
parent 212f453e41
commit dda74d9e65
5 changed files with 7 additions and 7 deletions

View File

@ -25,12 +25,12 @@ public interface EquipmentCache {
* @param deviceCode * @param deviceCode
* @return * @return
*/ */
DeviceInfoCache getDeviceInfoCache(String deviceCode); DeviceInfoCache getDeviceInfoCacheByCode(String deviceCode);
/** /**
* 通过设备ID获取设备缓存信息 * 通过设备ID获取设备缓存信息
* @param deviceId * @param deviceId
* @return * @return
*/ */
DeviceInfoCache getDeviceInfoCache(Long deviceId); DeviceInfoCache getDeviceInfoCacheById(Long deviceId);
} }

View File

@ -94,7 +94,7 @@ public class EquipmentCacheImpl implements EquipmentCache {
} }
@Override @Override
public DeviceInfoCache getDeviceInfoCache(String deviceCode) { public DeviceInfoCache getDeviceInfoCacheByCode(String deviceCode) {
Integer index = deviceCodeIndex.get(deviceCode); Integer index = deviceCodeIndex.get(deviceCode);
if (index != null) { if (index != null) {
return deviceInfoCaches.get(index); return deviceInfoCaches.get(index);
@ -103,7 +103,7 @@ public class EquipmentCacheImpl implements EquipmentCache {
} }
@Override @Override
public DeviceInfoCache getDeviceInfoCache(Long deviceId) { public DeviceInfoCache getDeviceInfoCacheById(Long deviceId) {
Integer index = deviceIdIndex.get(deviceId); Integer index = deviceIdIndex.get(deviceId);
if (index != null) { if (index != null) {
return deviceInfoCaches.get(index); return deviceInfoCaches.get(index);

View File

@ -37,7 +37,7 @@ public class FunctionRealData extends AbstractFunction {
public AviatorObject call(Map<String, Object> env, AviatorObject deviceCode, AviatorObject attributes) { public AviatorObject call(Map<String, Object> env, AviatorObject deviceCode, AviatorObject attributes) {
//设备Code //设备Code
String code = (String)deviceCode.getValue(env); String code = (String)deviceCode.getValue(env);
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCache(code); DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheByCode(code);
//属性列表 //属性列表
List<String> list = (List<String>)attributes.getValue(env); List<String> list = (List<String>)attributes.getValue(env);
List<String> attrs = list.stream().map(String::toLowerCase).toList(); List<String> attrs = list.stream().map(String::toLowerCase).toList();

View File

@ -62,7 +62,7 @@ public class FunctionSaveCalcData extends AbstractVariadicFunction {
if ( (args.length - 1) % 3 != 0) { return AviatorRuntimeJavaType.valueOf(1);} if ( (args.length - 1) % 3 != 0) { return AviatorRuntimeJavaType.valueOf(1);}
//deviceCode //deviceCode
String code = (String)args[0].getValue(env); String code = (String)args[0].getValue(env);
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCache(code); DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheByCode(code);
List<CalculateRTData> dataList = new ArrayList<>(); List<CalculateRTData> dataList = new ArrayList<>();
for (int i = 1; i < args.length; i+=3) { for (int i = 1; i < args.length; i+=3) {
Date date = (Date)FunctionUtils.getJavaObject(args[i], env); Date date = (Date)FunctionUtils.getJavaObject(args[i], env);

View File

@ -299,7 +299,7 @@ public class NodeMessageServiceImpl implements NodeMessageService {
}); });
log.info("消息data转化deviceVo,{}",list); log.info("消息data转化deviceVo,{}",list);
for (DeviceEventVo item : list){ for (DeviceEventVo item : list){
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCache(Long.valueOf(item.getDeviceId())); DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheById(Long.valueOf(item.getDeviceId()));
DeviceEventInfo deviceEventInfo = new DeviceEventInfo(); DeviceEventInfo deviceEventInfo = new DeviceEventInfo();
deviceEventInfo.setUpdateTime(item.getEventTime()); deviceEventInfo.setUpdateTime(item.getEventTime());
deviceEventInfo.setEventId(IdWorker.getId()); deviceEventInfo.setEventId(IdWorker.getId());