From 5d973ef2465667de0efac9f6b18a94431cebbe49 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 24 Jan 2024 19:11:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9B=BD=E6=A0=87=E7=BA=A7?= =?UTF-8?q?=E8=81=94=E9=80=9A=E9=81=93=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/common/CommonGbChannel.java | 12 +++ .../vmp/service/ICommonGbChannelService.java | 11 ++- .../impl/CommonGbChannelServiceImpl.java | 90 +++++++++++++++++++ .../impl/PlatformChannelServiceImpl.java | 64 +++++++++++-- .../vmp/storager/dao/CommonChannelMapper.java | 54 +++++++++++ .../iot/vmp/storager/dao/GroupMapper.java | 41 +++++++++ .../iot/vmp/storager/dao/RegionMapper.java | 10 +++ .../channel/CommonChannelController.java | 56 +++++++++--- .../bean/ShareCommonChannelListResult.java | 16 ++++ .../bean/ShareCommonGbChannelParam.java | 33 +++++++ .../gb28181/gbStream/GbStreamController.java | 0 11 files changed, 366 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/genersoft/iot/vmp/vmanager/channel/bean/ShareCommonChannelListResult.java create mode 100644 src/main/java/com/genersoft/iot/vmp/vmanager/channel/bean/ShareCommonGbChannelParam.java delete mode 100755 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java diff --git a/src/main/java/com/genersoft/iot/vmp/common/CommonGbChannel.java b/src/main/java/com/genersoft/iot/vmp/common/CommonGbChannel.java index fc7f066d..7d4fc560 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/CommonGbChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/common/CommonGbChannel.java @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.utils.SipUtils; import com.genersoft.iot.vmp.media.zlm.dto.StreamPush; import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy; import com.genersoft.iot.vmp.service.bean.CommonGbChannelType; +import com.genersoft.iot.vmp.service.bean.Group; import com.genersoft.iot.vmp.service.impl.CommonGbChannelServiceImpl; import com.genersoft.iot.vmp.utils.DateUtil; import io.swagger.v3.oas.annotations.media.Schema; @@ -325,6 +326,7 @@ public class CommonGbChannel { @Schema(description = "创建时间") private String createTime; + public int getCommonGbId() { return commonGbId; } @@ -794,4 +796,14 @@ public class CommonGbChannel { public void setCommonGbSVCSpaceSupportMode(Integer commonGbSVCSpaceSupportMode) { this.commonGbSVCSpaceSupportMode = commonGbSVCSpaceSupportMode; } + + public static CommonGbChannel getInstance(Group group) { + CommonGbChannel commonGbChannel = new CommonGbChannel(); + commonGbChannel.setCommonGbDeviceID(group.getCommonGroupDeviceId()); + commonGbChannel.setCommonGbName(group.getCommonGroupName()); + commonGbChannel.setCommonGbParental(1); + commonGbChannel.setCommonGbParentID(group.getCommonGroupParentId()); + commonGbChannel.setCommonGbBusinessGroupID(group.getCommonGroupTopId()); + return commonGbChannel; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/ICommonGbChannelService.java b/src/main/java/com/genersoft/iot/vmp/service/ICommonGbChannelService.java index 08bbe7d3..621e48b7 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/ICommonGbChannelService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/ICommonGbChannelService.java @@ -1,15 +1,14 @@ package com.genersoft.iot.vmp.service; import com.genersoft.iot.vmp.common.CommonGbChannel; -import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; -import com.genersoft.iot.vmp.gb28181.bean.Gb28181CodeType; import com.genersoft.iot.vmp.service.bean.*; import com.genersoft.iot.vmp.vmanager.bean.UpdateCommonChannelToGroup; import com.genersoft.iot.vmp.vmanager.bean.UpdateCommonChannelToRegion; +import com.genersoft.iot.vmp.vmanager.channel.bean.ShareCommonChannelListResult; +import com.genersoft.iot.vmp.vmanager.channel.bean.ShareCommonGbChannelParam; import com.github.pagehelper.PageInfo; -import java.util.ArrayList; import java.util.List; /** @@ -67,4 +66,10 @@ public interface ICommonGbChannelService { void offlineForList(List onlinePushers); void onlineForList(List commonChannelIdList); + + void addShareChannel(ShareCommonGbChannelParam param); + + void removeShareChannel(ShareCommonGbChannelParam param); + + PageInfo getShareChannelList(int platformId, int page, int count, String query, String type, Boolean online); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java index 1b890276..874b9416 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java @@ -14,6 +14,8 @@ import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.UpdateCommonChannelToGroup; import com.genersoft.iot.vmp.vmanager.bean.UpdateCommonChannelToRegion; +import com.genersoft.iot.vmp.vmanager.channel.bean.ShareCommonChannelListResult; +import com.genersoft.iot.vmp.vmanager.channel.bean.ShareCommonGbChannelParam; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.ObjectUtils; @@ -87,6 +89,30 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService { } } + /** + * 发送catalog消息 + */ + private void sendCatalogEvent(List channelListForShare, ParentPlatform platform, CatalogEventType catalogEventType) { + // 获取开启了目录订阅且关联了这些通道的 + SubscribeInfo catalogSubscribe = subscribeHolder.getCatalogSubscribe(platform.getId()); + if (catalogSubscribe == null) { + catalogSubscribe = SipUtils.buildVirtuallyCatalogSubSubscribe(platform); + } + // 获取关联的通道 + logger.warn("[发送Catalog事件] 类型: {}, 平台:{}, 通道个数: {}", + catalogEventType.getVal(), platform.getServerGBId(), channelListForShare.size()); + try { + if (catalogEventType.equals(CatalogEventType.ADD) || catalogEventType.equals(CatalogEventType.UPDATE)) { + sipCommanderForPlatform.sendNotifyForCatalogAddOrUpdate(catalogEventType.getVal(), platform, channelListForShare, catalogSubscribe, 0); + }else { + sipCommanderForPlatform.sendNotifyForCatalogOther(catalogEventType.getVal(), platform, channelListForShare, catalogSubscribe, 0); + } + } catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException | + IllegalAccessException e) { + throw new RuntimeException(e); + } + } + private void sendCatalogEvent(CommonGbChannel channel, CatalogEventType catalogEventType) { List commonGbChannelList = new ArrayList<>(); commonGbChannelList.add(channel); @@ -398,4 +424,68 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService { commonGbChannelMapper.channelsOnlineFromList(commonGbChannelList); sendCatalogEvent(commonGbChannelList, CatalogEventType.ON); } + + @Override + public void addShareChannel(ShareCommonGbChannelParam param) { + if (param == null || ObjectUtils.isEmpty(param.getPlatformId()) || param.getChannelIdList().isEmpty()) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "参数不全"); + } + ParentPlatform platform = platformService.query(param.getPlatformId()); + if (platform == null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台不存在"); + } + if (platform.isShareAllChannel()) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台已开启共享所有通道"); + } + // 排除参数中已经共享的数据 + List channelList = commonGbChannelMapper.getShareChannelInList( + param.getPlatformId(), param.getChannelIdList()); + if (!channelList.isEmpty()) { + for (Integer id : channelList) { + param.getChannelIdList().remove(id); + } + } + if (param.getChannelIdList().isEmpty()) { + logger.info("[添加共享通道] 移除已经共享的数据后,待加入数据为空"); + return; + } + logger.info("[添加共享通道] 平台: {}, 共{}个通道", platform.getServerGBId(), param.getChannelIdList().size()); + commonGbChannelMapper.addShareChannel(param); + // 发送ADD事件 + List commonGbChannelList = commonGbChannelMapper.queryInIdList(new ArrayList<>(param.getChannelIdList())); + sendCatalogEvent(commonGbChannelList, platform, CatalogEventType.ADD); + } + + @Override + public void removeShareChannel(ShareCommonGbChannelParam param) { + if (param == null || ObjectUtils.isEmpty(param.getPlatformId()) || param.getChannelIdList().isEmpty()) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "参数不全"); + } + ParentPlatform platform = platformService.query(param.getPlatformId()); + if (platform == null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台不存在"); + } + if (platform.isShareAllChannel()) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台已开启共享所有通道"); + } + // 获取参数中确实已经共享的数据 + List channelList = commonGbChannelMapper.getShareChannelInList( + param.getPlatformId(), param.getChannelIdList()); + if (channelList.isEmpty()) { + logger.info("[移除共享通道] 参数中确定已经共享的数据为空"); + return; + } + param.setChannelIdList(new HashSet<>(channelList)); + commonGbChannelMapper.removeShareChannel(param); + // 发送DELETE事件 + List commonGbChannelList = commonGbChannelMapper.queryInIdList(new ArrayList<>(param.getChannelIdList())); + sendCatalogEvent(commonGbChannelList, platform, CatalogEventType.DEL); + } + + @Override + public PageInfo getShareChannelList(int platformId, int page, int count, String query, String type, Boolean online) { + PageHelper.startPage(page, count); + List all = commonGbChannelMapper.getShareChannel(platformId, query, type, online); + return new PageInfo<>(all); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java index cde7ee7f..b02812fb 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.service.IPlatformChannelService; +import com.genersoft.iot.vmp.service.bean.Group; import com.genersoft.iot.vmp.storager.dao.*; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import org.slf4j.Logger; @@ -18,8 +19,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.List; +import java.util.*; /** * @author lin @@ -36,6 +36,12 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { @Autowired private CommonChannelMapper commonGbChannelMapper; + @Autowired + private RegionMapper regionMapper; + + @Autowired + private GroupMapper groupMapper; + @Autowired TransactionDefinition transactionDefinition; @@ -131,26 +137,72 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { public List queryChannelList(ParentPlatform platform) { List result = new ArrayList<>(); if (platform.isShareAllChannel()) { + // 获取所有地区 + List allRegionList = regionMapper.queryAllForCommonChannel(); + if (!allRegionList.isEmpty()) { + result.addAll(allRegionList); + } + // 获取所有分组 + List allGroupList = groupMapper.queryAllForCommonChannelByDeviceIdSet(null); + if (!allGroupList.isEmpty()) { + result.addAll(allGroupList); + } // 获取所有通道 List allChannelList = commonGbChannelMapper.getAll(); if (!allChannelList.isEmpty()) { result.addAll(allChannelList); - // 获取所有分组 - - // 获取所有地区 } }else { + List channelList = commonGbChannelMapper.getShareChannelInPLatform(platform.getId()); + if (channelList.isEmpty()) { + return result; + } // 查询所有关联了的国标通道 if (platform.isShareGroup()) { - // 获取相关分组 + Map allDependenceGroupMap = getAllDependenceGroup(channelList); + if (!allDependenceGroupMap.isEmpty()) { + for (Group group : allDependenceGroupMap.values()) { + result.add(CommonGbChannel.getInstance(group)); + } + } } if (platform.isShareRegion()) { } + + result.addAll(channelList); } return result; } + private Map getAllDependenceGroup(List commonGbChannelList) { + Map result = new HashMap<>(); + // 查询这些ID对应的分组信息 + List groupList = groupMapper.queryAllByDeviceIds(commonGbChannelList); + // 查询这些分组信息有可能涉及到的全部分组信息 + Map allGroupMap = groupMapper.queryAllByTopId(groupList); + for (Group group : groupList) { + result.put(group.getCommonGroupDeviceId(), group); + List allParentGroup = new ArrayList<>(); + getAllParentGroup(group, allGroupMap, allParentGroup); + if (!allParentGroup.isEmpty()) { + for (Group parentGroup : allParentGroup) { + result.put(parentGroup.getCommonGroupDeviceId(), parentGroup); + } + } + } + return result; + } + + private void getAllParentGroup(Group group, Map allGroupMap, List resultGroupList) { + if (Objects.equals(group.getCommonGroupDeviceId(), group.getCommonGroupTopId())) { + return; + } + Group parentGroup = allGroupMap.get(group.getCommonGroupDeviceId()); + resultGroupList.add(parentGroup); + getAllParentGroup(parentGroup, allGroupMap, resultGroupList); + } + @Override public CommonGbChannel queryChannelByPlatformIdAndChannelDeviceId(Integer platformId, String channelId) { return platformChannelMapper.queryChannelByPlatformIdAndChannelDeviceId(platformId, channelId); 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 12095141..7e74137a 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 @@ -6,11 +6,14 @@ import com.genersoft.iot.vmp.service.bean.Group; import com.genersoft.iot.vmp.service.bean.Region; import com.genersoft.iot.vmp.vmanager.bean.UpdateCommonChannelToGroup; import com.genersoft.iot.vmp.vmanager.bean.UpdateCommonChannelToRegion; +import com.genersoft.iot.vmp.vmanager.channel.bean.ShareCommonChannelListResult; +import com.genersoft.iot.vmp.vmanager.channel.bean.ShareCommonGbChannelParam; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; import java.util.List; import java.util.Map; +import java.util.Set; @Mapper @Repository @@ -665,4 +668,55 @@ public interface CommonChannelMapper { "") int getAllCount(); + @Select("") + List getShareChannelInList(@Param("platformId") Integer platformId, @Param("channelIdList") Set channelIdList); + + @Insert(value = "") + void addShareChannel(ShareCommonGbChannelParam param); + + @Delete("") + void removeShareChannel(ShareCommonGbChannelParam param); + + + @Select("" ) + List getShareChannel(@Param("platformId") int platformId, @Param("query") String query, + @Param("type") String type, @Param("online") Boolean online); + + @Select("" ) + List getShareChannelInPLatform(@Param("id") Integer id); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/GroupMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/GroupMapper.java index 9ce47e88..5a17adf2 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/GroupMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/GroupMapper.java @@ -1,11 +1,13 @@ package com.genersoft.iot.vmp.storager.dao; +import com.genersoft.iot.vmp.common.CommonGbChannel; import com.genersoft.iot.vmp.service.bean.Group; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; import java.util.List; import java.util.Map; +import java.util.Set; @Mapper @Repository @@ -168,4 +170,43 @@ public interface GroupMapper { @Select("select * from wvp_common_group") Map queryAllForMap(); + + @Select("") + List queryAllForCommonChannelByDeviceIdSet(Set groupDeviceIdSet); + + @Select("") + List queryAllByDeviceIds(List commonGbChannelList); + + @Select("") + Map queryAllByTopId(List groupList); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/RegionMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/RegionMapper.java index 8df76e38..fa753068 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/RegionMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/RegionMapper.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.storager.dao; +import com.genersoft.iot.vmp.common.CommonGbChannel; import com.genersoft.iot.vmp.service.bean.Region; import org.apache.ibatis.annotations.*; @@ -124,4 +125,13 @@ public interface RegionMapper { @MapKey("commonRegionDeviceId") @Select("select * from wvp_common_region") Map getAllForMap(); + + + @Select("select " + + "common_region_id as common_gb_id, " + + "common_region_device_id as common_gb_device_id, " + + "common_region_name as common_gb_name, " + + "from wvp_common_region") + List queryAllForCommonChannel(); + } 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 d5cda03f..5217feb5 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 @@ -2,13 +2,17 @@ package com.genersoft.iot.vmp.vmanager.channel; import com.genersoft.iot.vmp.common.CommonGbChannel; import com.genersoft.iot.vmp.conf.UserSetting; +import com.genersoft.iot.vmp.conf.security.JwtUtils; import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; import com.genersoft.iot.vmp.service.ICommonGbChannelService; import com.genersoft.iot.vmp.service.bean.*; import com.genersoft.iot.vmp.vmanager.bean.*; +import com.genersoft.iot.vmp.vmanager.channel.bean.ShareCommonChannelListResult; +import com.genersoft.iot.vmp.vmanager.channel.bean.ShareCommonGbChannelParam; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import org.apache.commons.lang3.ObjectUtils; import org.slf4j.Logger; @@ -40,7 +44,7 @@ public class CommonChannelController { private UserSetting userSetting; - @Operation(summary = "更新通道信息") + @Operation(summary = "更新通道信息", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "CommonGbChannel", description = "commonGbChannel", required = true) @ResponseBody @PostMapping("/update") @@ -52,7 +56,7 @@ public class CommonChannelController { /** * TODO 存疑 可以单独创建一个controller */ - @Operation(summary = "获取行业编码列表") + @Operation(summary = "获取行业编码列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) @ResponseBody @GetMapping("/industry/list") public List getIndustryCodeList(){ @@ -62,7 +66,7 @@ public class CommonChannelController { /** * TODO 存疑 可以单独创建一个controller */ - @Operation(summary = "获取编码列表") + @Operation(summary = "获取编码列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) @ResponseBody @GetMapping("/type/list") public List getDeviceTypeList(){ @@ -72,14 +76,14 @@ public class CommonChannelController { /** * TODO 存疑 可以单独创建一个controller */ - @Operation(summary = "获取编码列表") + @Operation(summary = "获取编码列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) @ResponseBody @GetMapping("/network/identification/list") public List getNetworkIdentificationTypeList(){ return commonGbChannelService.getNetworkIdentificationTypeList(); } - @Operation(summary = "查询分组或区域下的通道") + @Operation(summary = "查询分组或区域下的通道", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "groupDeviceId", description = "分组的编号", required = false) @Parameter(name = "regionDeviceId", description = "区域的编号", required = false) @Parameter(name = "query", description = "要搜索的内容", required = false) @@ -123,7 +127,7 @@ public class CommonChannelController { inGroup, inRegion, type, ptzType, online); } - @Operation(summary = "为区域添加分组") + @Operation(summary = "为区域添加分组", security = @SecurityRequirement(name = JwtUtils.HEADER)) @ResponseBody @PostMapping("/region/update") public void updateChannelToRegion(@RequestBody UpdateCommonChannelToRegion params){ @@ -132,7 +136,7 @@ public class CommonChannelController { commonGbChannelService.updateChannelToRegion(params); } - @Operation(summary = "从区域中移除通道") + @Operation(summary = "从区域中移除通道", security = @SecurityRequirement(name = JwtUtils.HEADER)) @ResponseBody @PostMapping("/region/remove") public void removeFromRegion(@RequestBody UpdateCommonChannelToRegion params){ @@ -140,7 +144,7 @@ public class CommonChannelController { commonGbChannelService.removeFromRegion(params); } - @Operation(summary = "为通道添加分组") + @Operation(summary = "为通道添加分组", security = @SecurityRequirement(name = JwtUtils.HEADER)) @ResponseBody @PostMapping("/group/update") public void updateChannelToGroup(@RequestBody UpdateCommonChannelToGroup params){ @@ -149,7 +153,7 @@ public class CommonChannelController { commonGbChannelService.updateChannelToGroup(params); } - @Operation(summary = "从分组中移除通道") + @Operation(summary = "从分组中移除通道", security = @SecurityRequirement(name = JwtUtils.HEADER)) @ResponseBody @PostMapping("/group/remove") public void removeFromGroup(@RequestBody UpdateCommonChannelToGroup params){ @@ -158,7 +162,7 @@ public class CommonChannelController { } - @Operation(summary = "播放通道") + @Operation(summary = "播放通道", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "channelDeviceId", description = "通道国标编号", required = true) @ResponseBody @GetMapping("/play") @@ -213,7 +217,7 @@ public class CommonChannelController { } - @Operation(summary = "停止播放通道") + @Operation(summary = "停止播放通道", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "channelDeviceId", description = "通道国标编号", required = true) @GetMapping("/stopPlay") public void playStop(String channelDeviceId) { @@ -246,8 +250,36 @@ public class CommonChannelController { } // 将通道共享到上级平台 + @Operation(summary = "添加通道共享", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "param", description = "共享通道参数", required = true) + @PostMapping("/share/add") + public void addShareChannel(@RequestBody ShareCommonGbChannelParam param) { + commonGbChannelService.addShareChannel(param); + } // 从上级平台共享中移除通道 + @Operation(summary = "移除通道共享", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "param", description = "共享通道参数", required = true) + @DeleteMapping("/share/remove") + public void removeShareChannel(@RequestBody ShareCommonGbChannelParam param) { + commonGbChannelService.removeShareChannel(param); + } - + @Operation(summary = "通道共享列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "platformId", description = "平台Id", required = true) + @GetMapping("/share/list") + public PageInfo getShareChannel(@RequestParam(required = true) Integer platformId, + @RequestParam(required = true) Integer page, + @RequestParam(required = true) Integer count, + @RequestParam(required = false) String query, + @RequestParam(required = false) String type, + @RequestParam(required = false) Boolean online) { + if (ObjectUtils.isEmpty(query)) { + query = null; + } + if (ObjectUtils.isEmpty(type)) { + type = null; + } + return commonGbChannelService.getShareChannelList(platformId, page, count, query, type, online); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/channel/bean/ShareCommonChannelListResult.java b/src/main/java/com/genersoft/iot/vmp/vmanager/channel/bean/ShareCommonChannelListResult.java new file mode 100644 index 00000000..a2b3ab7e --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/channel/bean/ShareCommonChannelListResult.java @@ -0,0 +1,16 @@ +package com.genersoft.iot.vmp.vmanager.channel.bean; + +import com.genersoft.iot.vmp.common.CommonGbChannel; + +public class ShareCommonChannelListResult extends CommonGbChannel { + + private int platformId; + + public int getPlatformId() { + return platformId; + } + + public void setPlatformId(int platformId) { + this.platformId = platformId; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/channel/bean/ShareCommonGbChannelParam.java b/src/main/java/com/genersoft/iot/vmp/vmanager/channel/bean/ShareCommonGbChannelParam.java new file mode 100644 index 00000000..5ed2d917 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/channel/bean/ShareCommonGbChannelParam.java @@ -0,0 +1,33 @@ +package com.genersoft.iot.vmp.vmanager.channel.bean; + +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.List; +import java.util.Set; + +@Schema(description = "共享通道参数") +public class ShareCommonGbChannelParam { + + @Schema(description = "通道ID列表") + private Set channelIdList; + + + @Schema(description = "平台ID") + private Integer platformId; + + public Set getChannelIdList() { + return channelIdList; + } + + public void setChannelIdList(Set channelIdList) { + this.channelIdList = channelIdList; + } + + public Integer getPlatformId() { + return platformId; + } + + public void setPlatformId(Integer platformId) { + this.platformId = platformId; + } +} 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 deleted file mode 100755 index e69de29b..00000000