From 0f23c3bb46ea8b7abab986ce897ffaf223e19f6e Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 2 Feb 2024 16:11:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/service/IStreamProxyService.java | 1 + .../service/impl/StreamPushServiceImpl.java | 5 +++++ .../vmp/storager/dao/CommonChannelMapper.java | 2 +- .../vmp/storager/dao/StreamPushMapper.java | 3 +++ .../channel/CommonChannelController.java | 22 +++++++++++-------- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java b/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java index 69ac7da1..7036ec8e 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java @@ -101,4 +101,5 @@ public interface IStreamProxyService { * 根据通用通道查询拉流代理 */ StreamProxy getStreamProxyByCommonGbChannelId(int commonGbId); + } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java index 1a1a99de..a59535e8 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java @@ -552,4 +552,9 @@ public class StreamPushServiceImpl implements IStreamPushService { } } } + + @Override + public StreamPush getPushByCommonChannelId(int commonGbId) { + return streamPushMapper.getOneByCommonChannelId(commonGbId); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonChannelMapper.java index 7e74137a..4600eb29 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonChannelMapper.java @@ -660,7 +660,7 @@ public interface CommonChannelMapper { "") List getAll(); - @Select("SELECT common_gb_id FROM wvp_common_channel WHERE common_gb_id = #{commonGbChannelId}") + @Select("SELECT * FROM wvp_common_channel WHERE common_gb_id = #{commonGbChannelId}") CommonGbChannel getOne(@Param("commonGbChannelId") int commonGbChannelId); @Select("") int delAllByIds(List streamPushIdList); + + @Select("select * from wvp_stream_push where common_gb_channel_id = #{commonGbId}") + StreamPush getOneByCommonChannelId(@Param("commonGbId") int commonGbId); } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/channel/CommonChannelController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/channel/CommonChannelController.java index d1ff9f8d..0cb5976d 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/channel/CommonChannelController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/channel/CommonChannelController.java @@ -383,15 +383,19 @@ public class CommonChannelController { if (commonGbChannel == null) { throw new ControllerException(ErrorCode.ERROR100.getCode(), "通道不存在"); } - if (commonGbChannel.getType().equals(CommonGbChannelType.GB28181)) { - DeviceChannel deviceChannel = deviceChannelService.getChannelByCommonChannelId(commonGbChannel.getCommonGbId()); - resultMap.put(CommonGbChannelType.GB28181, deviceChannel); - }else if (commonGbChannel.getType().equals(CommonGbChannelType.PUSH)) { - StreamPush streamPush = streamPushService.getPushByCommonChannelId(commonGbChannel.getCommonGbId()); - resultMap.put(CommonGbChannelType.PUSH, streamPush); - }else if (commonGbChannel.getType().equals(CommonGbChannelType.PROXY)) { - StreamProxy streamProxy = streamProxyService.getProxyByCommonChnanelId(commonGbChannel.getCommonGbId()); - resultMap.put(CommonGbChannelType.PROXY, streamProxy); + switch (commonGbChannel.getType()) { + case CommonGbChannelType.GB28181: + DeviceChannel deviceChannel = deviceChannelService.getChannelByCommonChannelId(commonGbChannel.getCommonGbId()); + resultMap.put(CommonGbChannelType.GB28181, deviceChannel); + break; + case CommonGbChannelType.PUSH: + StreamPush streamPush = streamPushService.getPushByCommonChannelId(commonGbChannel.getCommonGbId()); + resultMap.put(CommonGbChannelType.PUSH, streamPush); + break; + case CommonGbChannelType.PROXY: + StreamProxy streamProxy = streamProxyService.getStreamProxyByCommonGbChannelId(commonGbChannel.getCommonGbId()); + resultMap.put(CommonGbChannelType.PROXY, streamProxy); + break; } return resultMap; }