From d07a5680f3f25a9898a1d465d785f6c595a21005 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 7 Feb 2022 18:30:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=8E=A8=E6=B5=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=87=8F=E7=A7=BB=E9=99=A4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/service/IGbStreamService.java | 1 + .../iot/vmp/service/IStreamPushService.java | 2 + .../vmp/service/impl/GbStreamServiceImpl.java | 9 +++ .../service/impl/StreamPushServiceImpl.java | 18 +++++ .../iot/vmp/storager/dao/GbStreamMapper.java | 8 +++ .../storager/dao/PlatformGbStreamMapper.java | 8 +++ .../vmp/storager/dao/StreamPushMapper.java | 9 ++- .../vmp/vmanager/bean/BatchGBStreamParam.java | 17 +++++ .../streamPush/StreamPushController.java | 22 ++++++- web_src/src/components/PushVideoList.vue | 65 ++++++++++++++----- .../src/components/dialog/importChannel.vue | 4 +- 11 files changed, 143 insertions(+), 20 deletions(-) create mode 100644 src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java diff --git a/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java b/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java index a48bfb50..0effa431 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java @@ -43,4 +43,5 @@ public interface IGbStreamService { DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, String deviceGBId); void sendCatalogMsg(GbStream gbStream, String type); + void sendCatalogMsgs(List gbStreams, String type); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java b/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java index c52c325b..53ca6c41 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java @@ -66,4 +66,6 @@ public interface IStreamPushService { boolean saveToRandomGB(); void batchAdd(List streamPushExcelDtoList); + + boolean batchStop(List streamPushItems); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java index ee7a80b1..64f49ac6 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java @@ -20,6 +20,7 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionStatus; +import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; @@ -144,8 +145,16 @@ public class GbStreamServiceImpl implements IGbStreamService { gbStreams.add(streamProxyItem); } } + sendCatalogMsgs(gbStreams, type); + } + + @Override + public void sendCatalogMsgs(List gbStreams, String type) { if (gbStreams.size() > 0) { for (GbStream gs : gbStreams) { + if (StringUtils.isEmpty(gs.getGbId())){ + continue; + } List parentPlatforms = platformGbStreamMapper.selectByAppAndStream(gs.getApp(), gs.getStream()); if (parentPlatforms.size() > 0) { for (ParentPlatform parentPlatform : parentPlatforms) { 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 c8a4f46d..2ce9234a 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 @@ -355,8 +355,26 @@ public class StreamPushServiceImpl implements IStreamPushService { } } } + } + } + + @Override + public boolean batchStop(List gbStreams) { + if (gbStreams == null || gbStreams.size() == 0) { + return false; + } + gbStreamService.sendCatalogMsgs(gbStreams, CatalogEvent.DEL); + int delStream = streamPushMapper.delAllForGbStream(gbStreams); + gbStreamMapper.batchDelForGbStream(gbStreams); + platformGbStreamMapper.delByGbStreams(gbStreams); + if (delStream > 0) { + for (GbStream gbStream : gbStreams) { + MediaServerItem mediaServerItem = mediaServerService.getOne(gbStream.getMediaServerId()); + zlmresTfulUtils.closeStreams(mediaServerItem, gbStream.getApp(), gbStream.getStream()); + } } + return true; } } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java index fade54bb..1bcececf 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java @@ -84,6 +84,14 @@ public interface GbStreamMapper { "") void batchDel(List streamProxyItemList); + @Delete("") + void batchDelForGbStream(List gbStreams); + @Insert("") + void delByGbStreams(List gbStreams); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java index 3c43a9db..3379c9fd 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.storager.dao; +import com.genersoft.iot.vmp.gb28181.bean.GbStream; import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; @@ -48,7 +49,13 @@ public interface StreamPushMapper { "") int delAll(List streamPushItems); - + @Delete("") + int delAllForGbStream(List gbStreams); @Select(value = {"