From 66aac4526b8fc63912e0015ff2fdfeabcec015ce Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期二, 15 三月 2022 17:45:55 +0800 Subject: [PATCH] 修复推流关联平台的bug --- src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java | 43 ++++++++++++++++++++++++++++++++----------- 1 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java index ce45088..e1ccf9a 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java @@ -42,7 +42,7 @@ @Component public class VideoManagerStoragerImpl implements IVideoManagerStorager { - private Logger logger = LoggerFactory.getLogger(VideoManagerStoragerImpl.class); + private final Logger logger = LoggerFactory.getLogger(VideoManagerStoragerImpl.class); @Autowired EventPublisher eventPublisher; @@ -171,6 +171,7 @@ }else { deviceChannelMapper.update(channel); } + deviceChannelMapper.updateChannelSubCount(deviceId,channel.getParentId()); } @Override @@ -542,7 +543,7 @@ if (parentPlatformCatch == null) { // serverGBId 宸插彉鍖� ParentPlatform parentPlatById = platformMapper.getParentPlatById(parentPlatform.getId()); // 浣跨敤鏃х殑鏌ュ嚭缂撳瓨ID - parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatById.getServerGBId()); + parentPlatformCatch = new ParentPlatformCatch(); parentPlatformCatch.setId(parentPlatform.getServerGBId()); redisCatchStorage.delPlatformCatchInfo(parentPlatById.getServerGBId()); } @@ -662,8 +663,16 @@ @Override public DeviceChannel queryChannelInParentPlatform(String platformId, String channelId) { - DeviceChannel channel = platformChannelMapper.queryChannelInParentPlatform(platformId, channelId); - return channel; + List<DeviceChannel> channels = platformChannelMapper.queryChannelInParentPlatform(platformId, channelId); + if (channels.size() > 1) { + // 鍑虹幇闀垮害澶т簬0鐨勬椂鍊欒偗瀹氭槸鍥芥爣閫氶亾鐨処D閲嶅浜� + logger.warn("鍥芥爣ID瀛樺湪閲嶅锛歿}", channelId); + } + if (channels.size() == 0) { + return null; + }else { + return channels.get(0); + } } @Override @@ -680,8 +689,18 @@ @Override public Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId) { - Device device = platformChannelMapper.queryVideoDeviceByPlatformIdAndChannelId(platformId, channelId); - return device; + List<Device> devices = platformChannelMapper.queryVideoDeviceByPlatformIdAndChannelId(platformId, channelId); + if (devices.size() > 1) { + // 鍑虹幇闀垮害澶т簬0鐨勬椂鍊欒偗瀹氭槸鍥芥爣閫氶亾鐨処D閲嶅浜� + logger.warn("鍥芥爣ID瀛樺湪閲嶅锛歿}", channelId); + } + if (devices.size() == 0) { + return null; + }else { + return devices.get(0); + } + + } /** @@ -866,12 +885,11 @@ List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); if (parentPlatforms.size() > 0) { for (ParentPlatform parentPlatform : parentPlatforms) { - streamPushItem.setCatalogId(parentPlatform.getCatalogId()); - streamPushItem.setPlatformId(parentPlatform.getServerGBId()); - String stream = streamPushItem.getStream(); - StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(streamPushItem.getApp(), stream, + StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(streamPushItem.getApp(), streamPushItem.getStream(), parentPlatform.getServerGBId()); - if (streamProxyItems == null) { + if (streamProxyItem == null) { + streamPushItem.setCatalogId(parentPlatform.getCatalogId()); + streamPushItem.setPlatformId(parentPlatform.getServerGBId()); platformGbStreamMapper.add(streamPushItem); eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), streamPushItem, CatalogEvent.ADD); } @@ -1083,6 +1101,9 @@ @Override public List<ParentPlatform> queryPlatFormListForStreamWithGBId(String app, String stream, List<String> platforms) { + if (platforms == null || platforms.size() == 0) { + return new ArrayList<>(); + } return platformGbStreamMapper.queryPlatFormListForGBWithGBId(app, stream, platforms); } -- Gitblit v1.8.0