update 批量查询枪口列表

This commit is contained in:
Lemon
2024-11-06 13:41:06 +08:00
parent 8704b54fa3
commit bad30f2847

View File

@@ -510,7 +510,7 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
} }
// 先将已经有数据的stationId进行收集 // 先将已经有数据的stationId进行收集
List<String> hasDataStationIds = new ArrayList<>(map.keySet()); List<String> hasDataStationIds = new ArrayList<>(map.keySet());
Collection<List<ConnectorInfoVO>> values = map.values(); List<List<ConnectorInfoVO>> values = new ArrayList<>(map.values());
// 筛选出没有数据的stationIds // 筛选出没有数据的stationIds
List<String> noDataStationIds = stationIds.stream() List<String> noDataStationIds = stationIds.stream()
.filter(x -> !hasDataStationIds.contains(x)) .filter(x -> !hasDataStationIds.contains(x))
@@ -520,7 +520,7 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
// 通过stationIds批量查询数据库 // 通过stationIds批量查询数据库
List<ConnectorInfoVO> newConnectorInfoList = pileConnectorInfoMapper.batchSelectConnectorList(noDataStationIds); List<ConnectorInfoVO> newConnectorInfoList = pileConnectorInfoMapper.batchSelectConnectorList(noDataStationIds);
if (CollectionUtils.isEmpty(values)) { if (CollectionUtils.isEmpty(values)) {
values = new ArrayList<>(); values = Lists.newArrayList();
} }
values.add(newConnectorInfoList); values.add(newConnectorInfoList);
@@ -534,7 +534,8 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
List<ConnectorInfoVO> voList = entry.getValue(); List<ConnectorInfoVO> voList = entry.getValue();
String redisKey = baseRedisKey + stationId; String redisKey = baseRedisKey + stationId;
redisCache.setCacheObject(redisKey, voList, CacheConstants.cache_expire_time_1h); redisCache.setCacheList(redisKey, voList);
redisCache.expire(redisKey, CacheConstants.cache_expire_time_1h);
} }
} }