diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java index 4cbe5fbb..ad1fa51d 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java @@ -59,6 +59,7 @@ public class CatalogEventLister implements ApplicationListener { Map> parentPlatformMap = new HashMap<>(); if (event.getPlatformId() != null) { parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId()); + if (!parentPlatform.isStatus())return; String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId(); subscribe = redisCatchStorage.getSubscribe(key); }else { 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 3bb964b6..a48bfb50 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java @@ -17,7 +17,7 @@ public interface IGbStreamService { * @param count * @return */ - PageInfo getAll(Integer page, Integer count); + PageInfo getAll(Integer page, Integer count, String platFormId); /** 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 35c262fe..79e0b7ab 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 @@ -51,9 +51,9 @@ public class GbStreamServiceImpl implements IGbStreamService { private EventPublisher eventPublisher; @Override - public PageInfo getAll(Integer page, Integer count) { + public PageInfo getAll(Integer page, Integer count, String platFormId) { PageHelper.startPage(page, count); - List all = gbStreamMapper.selectAll(); + List all = gbStreamMapper.selectAll(platFormId); return new PageInfo<>(all); } 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 15bb0f5d..ce6ac9ef 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 @@ -37,8 +37,10 @@ public interface GbStreamMapper { @Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}") int del(String app, String stream); - @Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream") - List selectAll(); + @Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs " + + "LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " + + "WHERE pgs.platformId is null OR pgs.platformId = #{platformId}") + List selectAll(String platformId); @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") StreamProxyItem selectOne(String app, String stream); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java index 03c66d44..59ecdbcb 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java @@ -24,7 +24,9 @@ public interface PlatformCatalogMapper { @Delete("DELETE FROM platform_catalog WHERE platformId=#{platformId}") int delByPlatformId(String platformId); - @Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id AND platformId=#{platformId}) as childrenCount FROM platform_catalog pc WHERE parentId=#{parentId} AND platformId=#{platformId}") + @Select("SELECT pc.*, count(pc2.id) as childrenCount FROM platform_catalog pc " + + "left join platform_catalog pc2 on pc.id = pc2.parentId " + + "WHERE pc.parentId=#{parentId} AND pc.platformId=#{platformId} group by pc.id") List selectByParentId(String platformId, String parentId); @Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.id=#{id}") diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java index a9e2c626..81f869c6 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java @@ -83,7 +83,7 @@ public interface PlatformChannelMapper { "left join platform_gb_channel pgc on " + "pp.serverGBId = pgc.platformId " + "WHERE " + - "pgc.channelId = #{channelId} " + + "pgc.channelId = #{channelId} pp.status = true " + "AND pp.serverGBId IN" + " #{item}" + " ") diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java index 248b37a0..d9eafa0e 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java @@ -52,8 +52,8 @@ public interface PlatformGbStreamMapper { "from gb_stream gs\n" + " left join platform_gb_stream pgs\n" + " on gs.app = pgs.app and gs.stream = pgs.stream\n" + - "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") - List queryChannelInParentPlatformAndCatalogForCatlog(String platformId, String catalogId); + "where and pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") + List queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); @Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}") int delByCatalogId(String id); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java index e0b955ff..369b659d 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java @@ -639,7 +639,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { @Override public List queryStreamInParentPlatformAndCatalog(String platformId, String catalogId) { - List catalogs = platformGbStreamMapper.queryChannelInParentPlatformAndCatalogForCatlog(platformId, catalogId); + List catalogs = platformGbStreamMapper.queryChannelInParentPlatformAndCatalogForCatalog(platformId, catalogId); return catalogs; } 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 a2fcf15f..981c3ccb 100644 --- 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 @@ -33,19 +33,22 @@ public class GbStreamController { * 查询国标通道 * @param page 当前页 * @param count 每页条数 + * @param platformId 平台ID * @return */ @ApiOperation("查询国标通道") @ApiImplicitParams({ @ApiImplicitParam(name = "page", value = "当前页", required = true , dataTypeClass = Integer.class), @ApiImplicitParam(name = "count", value = "每页条数", required = true , dataTypeClass = Integer.class), + @ApiImplicitParam(name = "platformId", value = "平台ID", required = true , dataTypeClass = Integer.class), }) @GetMapping(value = "/list") @ResponseBody - public PageInfo list(@RequestParam(required = false)Integer page, - @RequestParam(required = false)Integer count){ + public PageInfo list(@RequestParam(required = true)Integer page, + @RequestParam(required = true)Integer count, + @RequestParam(required = true)String platformId){ - return gbStreamService.getAll(page, count); + return gbStreamService.getAll(page, count, platformId); } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java index 0dc172f5..69ea9731 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java @@ -307,6 +307,7 @@ public class PlatformController { List platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId); // 查询下属的国标通道 List catalogsForChannel = storager.queryChannelInParentPlatformAndCatalog(platformId, parentId); + // 查询下属的直播流通道 List catalogsForStream = storager.queryStreamInParentPlatformAndCatalog(platformId, parentId); platformCatalogList.addAll(catalogsForChannel); platformCatalogList.addAll(catalogsForStream); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java deleted file mode 100644 index 0eeea8b8..00000000 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.genersoft.iot.vmp.vmanager.gb28181.platformGbStream; - -import com.genersoft.iot.vmp.gb28181.bean.GbStream; -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; -import com.genersoft.iot.vmp.service.IGbStreamService; -import com.github.pagehelper.PageInfo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -@Api(tags = "级联平台关联视频流") -@CrossOrigin -@RestController -@RequestMapping("/api/platform_gb_stream") -public class PlatformGbStreamController { - - private final static Logger logger = LoggerFactory.getLogger(PlatformGbStreamController.class); - - @Autowired - private IGbStreamService gbStreamService; - - @Autowired - private IVideoManagerStorager storager; - - @ApiOperation("分页查询级联平台关联的视频流") - @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class), - }) - @GetMapping(value = "/list") - @ResponseBody - public PageInfo list(@RequestParam(required = false)Integer page, - @RequestParam(required = false)Integer count){ - - return gbStreamService.getAll(page, count); - } - - -}