From 9e397ba9f6a967e147d7c994a0ab82c8fc58e9be Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Tue, 19 Jul 2022 17:46:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=85=B1=E4=BA=AB=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=9B=B4=E6=92=AD=E6=B5=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql.sql | 1 - sql/update.sql | 3 ++ .../iot/vmp/gb28181/bean/ParentPlatform.java | 14 ------ .../vmp/media/zlm/ZLMMediaListManager.java | 28 +---------- .../iot/vmp/media/zlm/dto/StreamPushItem.java | 13 +++++ .../service/impl/StreamProxyServiceImpl.java | 18 ------- .../service/impl/StreamPushServiceImpl.java | 48 ------------------- .../storager/dao/ParentPlatformMapper.java | 8 +--- .../vmp/storager/dao/StreamPushMapper.java | 15 ++++-- .../impl/VideoManagerStorageImpl.java | 32 ------------- web_src/src/components/PushVideoList.vue | 7 ++- .../src/components/dialog/platformEdit.vue | 4 -- 12 files changed, 36 insertions(+), 155 deletions(-) diff --git a/sql/mysql.sql b/sql/mysql.sql index 71d4ac5d..7d0996f6 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -328,7 +328,6 @@ CREATE TABLE `parent_platform` ( `ptz` int DEFAULT NULL, `rtcp` int DEFAULT NULL, `status` bit(1) DEFAULT NULL, - `shareAllLiveStream` int DEFAULT NULL, `startOfflinePush` int DEFAULT '0', `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `catalogGroup` int DEFAULT '1', diff --git a/sql/update.sql b/sql/update.sql index dd41e978..91f725ec 100644 --- a/sql/update.sql +++ b/sql/update.sql @@ -55,6 +55,8 @@ alter table stream_push add status int DEFAULT NULL; alter table stream_push add updateTime varchar(50) default null; +alter table stream_push + add pushIng int DEFAULT NULL; alter table stream_push change createStamp createTime varchar(50) default null; @@ -68,6 +70,7 @@ update user set pushKey='453df297a57a5a7438934sda801fc3' where id=1; alter table parent_platform add treeType varchar(50) not null; update parent_platform set parent_platform.treeType='BusinessGroup'; +alter table parent_platform drop shareAllLiveStream; alter table platform_catalog add civilCode varchar(50) default null; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java index 6dcf0dfc..61e777ad 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java @@ -104,11 +104,6 @@ public class ParentPlatform { */ private int channelCount; - /** - * 共享所有的直播流 - */ - private boolean shareAllLiveStream; - /** * 默认目录Id,自动添加的通道多放在这个目录下 */ @@ -319,15 +314,6 @@ public class ParentPlatform { this.channelCount = channelCount; } - - public boolean isShareAllLiveStream() { - return shareAllLiveStream; - } - - public void setShareAllLiveStream(boolean shareAllLiveStream) { - this.shareAllLiveStream = shareAllLiveStream; - } - public String getCatalogId() { return catalogId; } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java index 693dda16..3d9b7cbf 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java @@ -116,6 +116,7 @@ public class ZLMMediaListManager { // 查找此直播流是否存在redis预设gbId StreamPushItem transform = streamPushService.transform(mediaItem); StreamPushItem pushInDb = streamPushService.getPush(mediaItem.getApp(), mediaItem.getStream()); + transform.setPushIng(true); transform.setUpdateTime(DateUtil.getNow()); transform.setPushTime(DateUtil.getNow()); if (pushInDb == null) { @@ -123,34 +124,7 @@ public class ZLMMediaListManager { streamPushMapper.add(transform); }else { streamPushMapper.update(transform); - - -// if (!StringUtils.isEmpty(pushInDb.getGbId())) { -// List gbStreamList = gbStreamMapper.selectByGBId(transform.getGbId()); -// if (gbStreamList != null && gbStreamList.size() == 1) { -// transform.setGbStreamId(gbStreamList.get(0).getGbStreamId()); -// transform.setPlatformId(gbStreamList.get(0).getPlatformId()); -// transform.setCatalogId(gbStreamList.get(0).getCatalogId()); -// transform.setGbId(gbStreamList.get(0).getGbId()); -// gbStreamMapper.update(transform); -// streamPushMapper.del(gbStreamList.get(0).getApp(), gbStreamList.get(0).getStream()); -// }else { -// transform.setCreateTime(DateUtil.getNow()); -// transform.setUpdateTime(DateUtil.getNow()); -// gbStreamMapper.add(transform); -// } - // 通知通道上线 -// if (transform != null) { -// if (channelOnlineEvents.get(transform.getGbId()) != null) { -// channelOnlineEvents.get(transform.getGbId()).run(transform.getApp(), transform.getStream(), transform.getServerId()); -// channelOnlineEvents.remove(transform.getGbId()); -// } -// } -// } } - - - return transform; } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java index 91fa6198..d5830060 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java @@ -103,6 +103,11 @@ public class StreamPushItem extends GbStream implements Comparable parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); - if (parentPlatforms.size() > 0) { - for (ParentPlatform parentPlatform : parentPlatforms) { - param.setPlatformId(parentPlatform.getServerGBId()); - param.setCatalogId(parentPlatform.getCatalogId()); - - String stream = param.getStream(); - StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(param.getApp(), stream, parentPlatform.getServerGBId()); - if (streamProxyItems == null) { - platformGbStreamMapper.add(param); - eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), param, CatalogEvent.ADD); - } - } - } - } - wvpResult.setMsg(result.toString()); return wvpResult; } 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 faac5c92..62cf20fa 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java @@ -134,29 +134,6 @@ public class StreamPushServiceImpl implements IStreamPushService { stream.setStatus(true); stream.setCreateTime(DateUtil.getNow()); int add = gbStreamMapper.add(stream); - - // 查找开启了全部直播流共享的上级平台 - List parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); - if (parentPlatforms.size() > 0) { - for (ParentPlatform parentPlatform : parentPlatforms) { - stream.setCatalogId(parentPlatform.getCatalogId()); - stream.setPlatformId(parentPlatform.getServerGBId()); - String streamId = stream.getStream(); - StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(stream.getApp(), streamId, parentPlatform.getServerGBId()); - if (streamProxyItem == null) { - platformGbStreamMapper.add(stream); - eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD); - }else { - if (!streamProxyItem.getGbId().equals(stream.getGbId())) { - // 此流使用另一个国标Id已经与该平台关联,移除此记录 - platformGbStreamMapper.delByAppAndStreamAndPlatform(stream.getApp(), streamId, parentPlatform.getServerGBId()); - platformGbStreamMapper.add(stream); - eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD); - } - } - } - } - return add > 0; } @@ -345,31 +322,6 @@ public class StreamPushServiceImpl implements IStreamPushService { public void batchAdd(List streamPushItems) { streamPushMapper.addAll(streamPushItems); gbStreamMapper.batchAdd(streamPushItems); - // 查找开启了全部直播流共享的上级平台 - List parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); - if (parentPlatforms.size() > 0) { - for (StreamPushItem stream : streamPushItems) { - for (ParentPlatform parentPlatform : parentPlatforms) { - stream.setCatalogId(parentPlatform.getCatalogId()); - stream.setPlatformId(parentPlatform.getServerGBId()); - String streamId = stream.getStream(); - StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(stream.getApp(), streamId, parentPlatform.getServerGBId()); - if (streamProxyItem == null) { - platformGbStreamMapper.add(stream); - eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD); - }else { - if (!streamProxyItem.getGbId().equals(stream.getGbId())) { - // 此流使用另一个国标Id已经与该平台关联,移除此记录 - platformGbStreamMapper.delByAppAndStreamAndPlatform(stream.getApp(), streamId, parentPlatform.getServerGBId()); - platformGbStreamMapper.add(stream); - eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD); - stream.setGbId(streamProxyItem.getGbId()); - eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.DEL); - } - } - } - } - } } @Override diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java index 0db6498a..554354a8 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java @@ -16,10 +16,10 @@ public interface ParentPlatformMapper { @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + - " status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " + + " status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " + " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " + " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " + - " ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") + " ${status}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") int addParentPlatform(ParentPlatform parentPlatform); @Update("UPDATE parent_platform " + @@ -41,7 +41,6 @@ public interface ParentPlatformMapper { "ptz=#{ptz}, " + "rtcp=#{rtcp}, " + "status=#{status}, " + - "shareAllLiveStream=#{shareAllLiveStream}, " + "startOfflinePush=${startOfflinePush}, " + "catalogGroup=#{catalogGroup}, " + "administrativeDivision=#{administrativeDivision}, " + @@ -84,9 +83,6 @@ public interface ParentPlatformMapper { @Update("UPDATE parent_platform SET status=#{online} WHERE serverGBId=#{platformGbID}" ) int updateParentPlatformStatus(String platformGbID, boolean online); - @Select("SELECT * FROM parent_platform WHERE shareAllLiveStream=true") - List selectAllAhareAllLiveStream(); - @Update(value = {" "}) int update(StreamPushItem streamPushItem); @@ -88,10 +89,11 @@ public interface StreamPushMapper { @Insert("") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") @@ -114,6 +116,11 @@ public interface StreamPushMapper { "WHERE app=#{app} AND stream=#{stream}") int updateStatus(String app, String stream, boolean status); + @Update("UPDATE stream_push " + + "SET pushIng=${pushIng} " + + "WHERE app=#{app} AND stream=#{stream}") + int updatePushStatus(String app, String stream, boolean status); + @Update("UPDATE stream_push " + "SET status=#{status} " + "WHERE mediaServerId=#{mediaServerId}") diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java index a839f729..c18c5d2e 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java @@ -443,20 +443,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { // 更新缓存 parentPlatformCatch.setParentPlatform(parentPlatform); redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch); - if (parentPlatform.isEnable()) { - // 共享所有视频流,需要将现有视频流添加到此平台 - List gbStreams = gbStreamMapper.queryStreamNotInPlatform(); - if (gbStreams.size() > 0) { - for (GbStream gbStream : gbStreams) { - gbStream.setCatalogId(parentPlatform.getCatalogId()); - } - if (parentPlatform.isShareAllLiveStream()) { - gbStreamService.addPlatformInfo(gbStreams, parentPlatform.getServerGBId(), parentPlatform.getCatalogId()); - }else { - gbStreamService.delPlatformInfo(parentPlatform.getServerGBId(), gbStreams); - } - } - } return result > 0; } @@ -673,24 +659,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream()); streamPushMapper.add(streamPushItem); mediaOffline(streamPushItem.getApp(), streamPushItem.getStream()); - - if(!StringUtils.isEmpty(streamPushItem.getGbId() )){ - // 查找开启了全部直播流共享的上级平台 - List parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); - if (parentPlatforms.size() > 0) { - for (ParentPlatform parentPlatform : parentPlatforms) { - StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(streamPushItem.getApp(), streamPushItem.getStream(), - parentPlatform.getServerGBId()); - if (streamProxyItem == null) { - streamPushItem.setCatalogId(parentPlatform.getCatalogId()); - streamPushItem.setPlatformId(parentPlatform.getServerGBId()); - platformGbStreamMapper.add(streamPushItem); - eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), streamPushItem, CatalogEvent.ADD); - } - } - } - } - } @Override diff --git a/web_src/src/components/PushVideoList.vue b/web_src/src/components/PushVideoList.vue index d8d3aca7..58ce8a21 100644 --- a/web_src/src/components/PushVideoList.vue +++ b/web_src/src/components/PushVideoList.vue @@ -62,7 +62,12 @@ + + + diff --git a/web_src/src/components/dialog/platformEdit.vue b/web_src/src/components/dialog/platformEdit.vue index 512f00ad..819c002e 100644 --- a/web_src/src/components/dialog/platformEdit.vue +++ b/web_src/src/components/dialog/platformEdit.vue @@ -97,7 +97,6 @@ - @@ -159,7 +158,6 @@ export default { keepTimeout: 60, transport: "UDP", characterSet: "GB2312", - shareAllLiveStream: false, startOfflinePush: false, catalogGroup: 1, administrativeDivision: null, @@ -225,7 +223,6 @@ export default { this.platform.keepTimeout = platform.keepTimeout; this.platform.transport = platform.transport; this.platform.characterSet = platform.characterSet; - this.platform.shareAllLiveStream = platform.shareAllLiveStream; this.platform.catalogId = platform.catalogId; this.platform.startOfflinePush = platform.startOfflinePush; this.platform.catalogGroup = platform.catalogGroup; @@ -320,7 +317,6 @@ export default { transport: "UDP", characterSet: "GB2312", treeType: "BusinessGroup", - shareAllLiveStream: false, startOfflinePush: false, catalogGroup: 1, }