修复设备缓存BUG

This commit is contained in:
谷成伟 2024-12-05 11:50:17 +08:00
parent b9cf44d179
commit 144a66f47a
2 changed files with 1 additions and 24 deletions

View File

@ -87,7 +87,7 @@ public class EquipmentCacheImpl implements EquipmentCache {
}
else{
deviceInfoCaches.add(deviceInfoCache);
index = deviceInfoCaches.size();
index = deviceInfoCaches.size() - 1;
deviceCodeIndex.put(deviceInfoCache.getDeviceCode(),index);
deviceIdIndex.put(equipment.getId(),index);
}

View File

@ -35,29 +35,6 @@ public class FunctionSaveCalcData extends AbstractVariadicFunction {
return "save";
}
// @Override
// public AviatorObject call(Map<String, Object> env, AviatorObject deviceCode, AviatorObject attributes) {
// //设备Code
// String code = (String)deviceCode.getValue(env);
// DeviceInfoCache deviceInfoCache = cacheService.getDeviceInfoCache(code);
// //属性列表
// List<String> list = (List<String>)attributes.getValue(env);
// List<String> attrs = list.stream().map(String::toLowerCase).toList();
// SnapshotValueQueryParam snapshotValueQueryParam = new SnapshotValueQueryParam();
// snapshotValueQueryParam.setDeviceId(String.valueOf(deviceInfoCache.getDeviceId()));
// snapshotValueQueryParam.setAttributes(attrs);
// Map<String, Map<String, Object>> stringMapMap = dataService.querySnapshotValues(List.of(snapshotValueQueryParam));
// Map<String,Object> data = stringMapMap.get(String.valueOf(deviceInfoCache.getDeviceId()));
// log.info("{}", data);
// Map<String,Object> result = new HashMap<>(list.size());
// for (String s : list) {
// String key = s.toLowerCase();
// Object value = data.get(key);
// result.put(s, value);
// }
// return AviatorRuntimeJavaType.valueOf(result);
// }
@SneakyThrows
@Override
public AviatorObject variadicCall(Map<String, Object> env, AviatorObject... args) {