优化Catalog查询内存占用高的问题

This commit is contained in:
648540858
2024-10-26 23:15:18 +08:00
parent 6fc8db8bd0
commit fee8d2f8cd
7 changed files with 285 additions and 220 deletions

View File

@@ -471,7 +471,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
return false;
}
List<DeviceChannel> allChannels = channelMapper.queryAllChannelsForRefresh(deviceDbId);
Map<String,DeviceChannel> allChannelMap = new ConcurrentHashMap<>();
Map<String,DeviceChannel> allChannelMap = new HashMap<>();
if (!allChannels.isEmpty()) {
for (DeviceChannel deviceChannel : allChannels) {
allChannelMap.put(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId(), deviceChannel);
@@ -486,14 +486,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
StringBuilder stringBuilder = new StringBuilder();
Map<String, Integer> subContMap = new HashMap<>();
// 数据去重
Set<String> gbIdSet = new HashSet<>();
for (DeviceChannel deviceChannel : deviceChannelList) {
if (gbIdSet.contains(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId())) {
stringBuilder.append(deviceChannel.getDeviceId()).append(",");
continue;
}
gbIdSet.add(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId());
DeviceChannel channelInDb = allChannelMap.get(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId());
if (channelInDb != null) {
deviceChannel.setStreamId(channelInDb.getStreamId());