From a34db2ee8bf66b1c00a2ea185955a625d9e9aefb Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 21 Sep 2023 21:34:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=B9=E6=8D=AE=E5=9B=BD?= =?UTF-8?q?=E6=A0=87=E7=BC=96=E5=8F=B7=E6=B7=BB=E5=8A=A0=E5=9B=BD=E6=A0=87?= =?UTF-8?q?=E7=BA=A7=E8=81=94=E9=80=9A=E9=81=93=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/service/IGbStreamService.java | 2 ++ .../vmp/service/impl/GbStreamServiceImpl.java | 5 ++++ .../service/impl/StreamProxyServiceImpl.java | 6 +++-- .../gb28181/gbStream/GbStreamController.java | 23 ++++++++++++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) 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 314a3890..43f1a8a6 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java @@ -69,4 +69,6 @@ public interface IGbStreamService { * @param catalogId */ void delAllPlatformInfo(String platformId, String catalogId); + + List getGbChannelWithGbid(String gbId); } 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 b3f4d7db..054b6ffd 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java @@ -263,4 +263,9 @@ public class GbStreamServiceImpl implements IGbStreamService { eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL); } } + + @Override + public List getGbChannelWithGbid(String gbId) { + return gbStreamMapper.selectByGBId(gbId); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java index d699bbcd..a4e00ad4 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java @@ -341,14 +341,16 @@ public class StreamProxyServiceImpl implements IStreamProxyService { StreamProxyItem streamProxyItem = videoManagerStorager.queryStreamProxy(app, stream); if (streamProxyItem != null) { gbStreamService.sendCatalogMsg(streamProxyItem, CatalogEvent.DEL); - videoManagerStorager.deleteStreamProxy(app, stream); + JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyItem); if (jsonObject != null && jsonObject.getInteger("code") == 0) { // 如果关联了国标那么移除关联 + int i = platformGbStreamMapper.delByAppAndStream(app, stream); gbStreamMapper.del(app, stream); - platformGbStreamMapper.delByAppAndStream(app, stream); + System.out.println(); // TODO 如果关联的推流, 那么状态设置为离线 } + videoManagerStorager.deleteStreamProxy(app, stream); redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PULL", app, stream); } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java index 5e673729..3bdee76e 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java @@ -1,8 +1,12 @@ package com.genersoft.iot.vmp.vmanager.gb28181.gbStream; +import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.gb28181.bean.GbStream; +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.service.IGbStreamService; +import com.genersoft.iot.vmp.service.IPlatformService; import com.genersoft.iot.vmp.storager.IVideoManagerStorage; +import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; @@ -14,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; @Tag(name = "视频流关联到级联平台") @@ -28,7 +33,7 @@ public class GbStreamController { private IGbStreamService gbStreamService; @Autowired - private IVideoManagerStorage storager; + private IPlatformService platformService; /** @@ -107,4 +112,20 @@ public class GbStreamController { gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); } } + + /** + * 保存国标关联 + * @param gbId + * @return + */ + @Operation(summary = "保存国标关联") + @GetMapping(value = "/addWithGbid") + @ResponseBody + public void add(String gbId, String platformGbId, @RequestParam(required = false) String catalogGbId){ + List gbStreams = gbStreamService.getGbChannelWithGbid(gbId); + if (gbStreams.isEmpty()) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "gbId的信息未找到"); + } + gbStreamService.addPlatformInfo(gbStreams, platformGbId, catalogGbId); + } }