优化级联选择通道逻辑
parent
b90969f180
commit
385fdb95f1
|
@ -59,6 +59,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
Map<String, List<ParentPlatform>> parentPlatformMap = new HashMap<>();
|
Map<String, List<ParentPlatform>> parentPlatformMap = new HashMap<>();
|
||||||
if (event.getPlatformId() != null) {
|
if (event.getPlatformId() != null) {
|
||||||
parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId());
|
parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId());
|
||||||
|
if (!parentPlatform.isStatus())return;
|
||||||
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId();
|
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId();
|
||||||
subscribe = redisCatchStorage.getSubscribe(key);
|
subscribe = redisCatchStorage.getSubscribe(key);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -17,7 +17,7 @@ public interface IGbStreamService {
|
||||||
* @param count
|
* @param count
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
PageInfo<GbStream> getAll(Integer page, Integer count);
|
PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,9 +51,9 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
||||||
private EventPublisher eventPublisher;
|
private EventPublisher eventPublisher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<GbStream> getAll(Integer page, Integer count) {
|
public PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId) {
|
||||||
PageHelper.startPage(page, count);
|
PageHelper.startPage(page, count);
|
||||||
List<GbStream> all = gbStreamMapper.selectAll();
|
List<GbStream> all = gbStreamMapper.selectAll(platFormId);
|
||||||
return new PageInfo<>(all);
|
return new PageInfo<>(all);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,10 @@ public interface GbStreamMapper {
|
||||||
@Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
|
@Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
|
||||||
int del(String app, String 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")
|
@Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs " +
|
||||||
List<GbStream> selectAll();
|
"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<GbStream> selectAll(String platformId);
|
||||||
|
|
||||||
@Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
|
@Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
|
||||||
StreamProxyItem selectOne(String app, String stream);
|
StreamProxyItem selectOne(String app, String stream);
|
||||||
|
|
|
@ -24,7 +24,9 @@ public interface PlatformCatalogMapper {
|
||||||
@Delete("DELETE FROM platform_catalog WHERE platformId=#{platformId}")
|
@Delete("DELETE FROM platform_catalog WHERE platformId=#{platformId}")
|
||||||
int delByPlatformId(String 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<PlatformCatalog> selectByParentId(String platformId, String parentId);
|
List<PlatformCatalog> 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}")
|
@Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.id=#{id}")
|
||||||
|
|
|
@ -83,7 +83,7 @@ public interface PlatformChannelMapper {
|
||||||
"left join platform_gb_channel pgc on " +
|
"left join platform_gb_channel pgc on " +
|
||||||
"pp.serverGBId = pgc.platformId " +
|
"pp.serverGBId = pgc.platformId " +
|
||||||
"WHERE " +
|
"WHERE " +
|
||||||
"pgc.channelId = #{channelId} " +
|
"pgc.channelId = #{channelId} pp.status = true " +
|
||||||
"AND pp.serverGBId IN" +
|
"AND pp.serverGBId IN" +
|
||||||
"<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
"<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||||
"</script> ")
|
"</script> ")
|
||||||
|
|
|
@ -52,8 +52,8 @@ public interface PlatformGbStreamMapper {
|
||||||
"from gb_stream gs\n" +
|
"from gb_stream gs\n" +
|
||||||
" left join platform_gb_stream pgs\n" +
|
" left join platform_gb_stream pgs\n" +
|
||||||
" on gs.app = pgs.app and gs.stream = pgs.stream\n" +
|
" on gs.app = pgs.app and gs.stream = pgs.stream\n" +
|
||||||
"where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}")
|
"where and pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}")
|
||||||
List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatlog(String platformId, String catalogId);
|
List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId);
|
||||||
|
|
||||||
@Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}")
|
@Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}")
|
||||||
int delByCatalogId(String id);
|
int delByCatalogId(String id);
|
||||||
|
|
|
@ -639,7 +639,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId) {
|
public List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId) {
|
||||||
List<PlatformCatalog> catalogs = platformGbStreamMapper.queryChannelInParentPlatformAndCatalogForCatlog(platformId, catalogId);
|
List<PlatformCatalog> catalogs = platformGbStreamMapper.queryChannelInParentPlatformAndCatalogForCatalog(platformId, catalogId);
|
||||||
return catalogs;
|
return catalogs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,19 +33,22 @@ public class GbStreamController {
|
||||||
* 查询国标通道
|
* 查询国标通道
|
||||||
* @param page 当前页
|
* @param page 当前页
|
||||||
* @param count 每页条数
|
* @param count 每页条数
|
||||||
|
* @param platformId 平台ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation("查询国标通道")
|
@ApiOperation("查询国标通道")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "page", value = "当前页", required = true , dataTypeClass = Integer.class),
|
@ApiImplicitParam(name = "page", value = "当前页", required = true , dataTypeClass = Integer.class),
|
||||||
@ApiImplicitParam(name = "count", 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")
|
@GetMapping(value = "/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public PageInfo<GbStream> list(@RequestParam(required = false)Integer page,
|
public PageInfo<GbStream> list(@RequestParam(required = true)Integer page,
|
||||||
@RequestParam(required = false)Integer count){
|
@RequestParam(required = true)Integer count,
|
||||||
|
@RequestParam(required = true)String platformId){
|
||||||
|
|
||||||
return gbStreamService.getAll(page, count);
|
return gbStreamService.getAll(page, count, platformId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -307,6 +307,7 @@ public class PlatformController {
|
||||||
List<PlatformCatalog> platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId);
|
List<PlatformCatalog> platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId);
|
||||||
// 查询下属的国标通道
|
// 查询下属的国标通道
|
||||||
List<PlatformCatalog> catalogsForChannel = storager.queryChannelInParentPlatformAndCatalog(platformId, parentId);
|
List<PlatformCatalog> catalogsForChannel = storager.queryChannelInParentPlatformAndCatalog(platformId, parentId);
|
||||||
|
// 查询下属的直播流通道
|
||||||
List<PlatformCatalog> catalogsForStream = storager.queryStreamInParentPlatformAndCatalog(platformId, parentId);
|
List<PlatformCatalog> catalogsForStream = storager.queryStreamInParentPlatformAndCatalog(platformId, parentId);
|
||||||
platformCatalogList.addAll(catalogsForChannel);
|
platformCatalogList.addAll(catalogsForChannel);
|
||||||
platformCatalogList.addAll(catalogsForStream);
|
platformCatalogList.addAll(catalogsForStream);
|
||||||
|
|
|
@ -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<GbStream> list(@RequestParam(required = false)Integer page,
|
|
||||||
@RequestParam(required = false)Integer count){
|
|
||||||
|
|
||||||
return gbStreamService.getAll(page, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue