Commit a34db2ee8bf66b1c00a2ea185955a625d9e9aefb
1 parent
4ba0e3c1
增加根据国标编号添加国标级联通道的接口
Showing
4 changed files
with
33 additions
and
3 deletions
src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
| ... | ... | @@ -263,4 +263,9 @@ public class GbStreamServiceImpl implements IGbStreamService { |
| 263 | 263 | eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL); |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | + | |
| 267 | + @Override | |
| 268 | + public List<GbStream> getGbChannelWithGbid(String gbId) { | |
| 269 | + return gbStreamMapper.selectByGBId(gbId); | |
| 270 | + } | |
| 266 | 271 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
| ... | ... | @@ -341,14 +341,16 @@ public class StreamProxyServiceImpl implements IStreamProxyService { |
| 341 | 341 | StreamProxyItem streamProxyItem = videoManagerStorager.queryStreamProxy(app, stream); |
| 342 | 342 | if (streamProxyItem != null) { |
| 343 | 343 | gbStreamService.sendCatalogMsg(streamProxyItem, CatalogEvent.DEL); |
| 344 | - videoManagerStorager.deleteStreamProxy(app, stream); | |
| 344 | + | |
| 345 | 345 | JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyItem); |
| 346 | 346 | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| 347 | 347 | // 如果关联了国标那么移除关联 |
| 348 | + int i = platformGbStreamMapper.delByAppAndStream(app, stream); | |
| 348 | 349 | gbStreamMapper.del(app, stream); |
| 349 | - platformGbStreamMapper.delByAppAndStream(app, stream); | |
| 350 | + System.out.println(); | |
| 350 | 351 | // TODO 如果关联的推流, 那么状态设置为离线 |
| 351 | 352 | } |
| 353 | + videoManagerStorager.deleteStreamProxy(app, stream); | |
| 352 | 354 | redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PULL", app, stream); |
| 353 | 355 | } |
| 354 | 356 | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java
| 1 | 1 | package com.genersoft.iot.vmp.vmanager.gb28181.gbStream; |
| 2 | 2 | |
| 3 | +import com.genersoft.iot.vmp.conf.exception.ControllerException; | |
| 3 | 4 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 5 | +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | |
| 4 | 6 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 7 | +import com.genersoft.iot.vmp.service.IPlatformService; | |
| 5 | 8 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 9 | +import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; | |
| 6 | 10 | import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam; |
| 7 | 11 | import com.github.pagehelper.PageInfo; |
| 8 | 12 | import io.swagger.v3.oas.annotations.Operation; |
| ... | ... | @@ -14,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 14 | 18 | import org.springframework.util.ObjectUtils; |
| 15 | 19 | import org.springframework.web.bind.annotation.*; |
| 16 | 20 | |
| 21 | +import java.util.ArrayList; | |
| 17 | 22 | import java.util.List; |
| 18 | 23 | |
| 19 | 24 | @Tag(name = "视频流关联到级联平台") |
| ... | ... | @@ -28,7 +33,7 @@ public class GbStreamController { |
| 28 | 33 | private IGbStreamService gbStreamService; |
| 29 | 34 | |
| 30 | 35 | @Autowired |
| 31 | - private IVideoManagerStorage storager; | |
| 36 | + private IPlatformService platformService; | |
| 32 | 37 | |
| 33 | 38 | |
| 34 | 39 | /** |
| ... | ... | @@ -107,4 +112,20 @@ public class GbStreamController { |
| 107 | 112 | gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); |
| 108 | 113 | } |
| 109 | 114 | } |
| 115 | + | |
| 116 | + /** | |
| 117 | + * 保存国标关联 | |
| 118 | + * @param gbId | |
| 119 | + * @return | |
| 120 | + */ | |
| 121 | + @Operation(summary = "保存国标关联") | |
| 122 | + @GetMapping(value = "/addWithGbid") | |
| 123 | + @ResponseBody | |
| 124 | + public void add(String gbId, String platformGbId, @RequestParam(required = false) String catalogGbId){ | |
| 125 | + List<GbStream> gbStreams = gbStreamService.getGbChannelWithGbid(gbId); | |
| 126 | + if (gbStreams.isEmpty()) { | |
| 127 | + throw new ControllerException(ErrorCode.ERROR100.getCode(), "gbId的信息未找到"); | |
| 128 | + } | |
| 129 | + gbStreamService.addPlatformInfo(gbStreams, platformGbId, catalogGbId); | |
| 130 | + } | |
| 110 | 131 | } | ... | ... |