Merge remote-tracking branch 'origin/main'

This commit is contained in:
fengrong 2024-11-06 17:16:29 +08:00
commit 27f3163b92

View File

@ -72,7 +72,6 @@ public class DataServiceImpl implements DataService {
public Map<String, Map<String, Object>> querySnapshotValues(List<SnapshotValueQueryParam> paramList) {
long start = System.currentTimeMillis();
Map<String, Map<String, Object>> result = new HashMap<>(paramList.size());
Map<String, Map<String, Object>> finalResult = result;
ListUtil.page(paramList, COMMIT_COUNT, list -> {
List<String> keyList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
@ -99,18 +98,18 @@ public class DataServiceImpl implements DataService {
int secondColonIndex = key.indexOf(':', firstColonIndex + 1);
String deviceId = key.substring(firstColonIndex + 1, secondColonIndex);
String fieldName = key.substring(secondColonIndex + 1);
if (finalResult.get(deviceId) == null) {
if (result.get(deviceId) == null) {
Map<String, Object> valueMap = new HashMap<>();
valueMap.put(fieldName, dataList.get(i));
finalResult.put(deviceId, valueMap);
result.put(deviceId, valueMap);
} else {
finalResult.get(deviceId).put(fieldName, dataList.get(i));
result.get(deviceId).put(fieldName, dataList.get(i));
}
}
});
long end = System.currentTimeMillis();
log.debug("读取快照{}个,耗时: {}秒", paramList.size(), (end - start) / 1000.0);
return finalResult;
return result;
}
/**