增加推流添加功能,修复级联目录推送

This commit is contained in:
648540858
2022-07-22 16:02:14 +08:00
parent eefe6f4c8d
commit e29d94c83f
12 changed files with 139 additions and 32 deletions

View File

@@ -12,6 +12,7 @@ public class WVPResult<T> {
this.data = data;
}
private int code;
private String msg;
private T data;

View File

@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
import com.genersoft.iot.vmp.gb28181.bean.TreeType;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.service.IPlatformChannelService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
@@ -463,13 +464,20 @@ public class PlatformController {
if (logger.isDebugEnabled()) {
logger.debug("查询目录,platformId: {}, parentId: {}", platformId, parentId);
}
ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
if (platform == null) {
return new ResponseEntity<>(new WVPResult<>(400, "平台未找到", null), HttpStatus.OK);
}
if (platformId.equals(parentId)) {
parentId = platform.getDeviceGBId();
}
List<PlatformCatalog> platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId);
// 查询下属的国标通道
// List<PlatformCatalog> catalogsForChannel = storager.queryChannelInParentPlatformAndCatalog(platformId, parentId);
// 查询下属的直播流通道
// List<PlatformCatalog> catalogsForStream = storager.queryStreamInParentPlatformAndCatalog(platformId, parentId);
// platformCatalogList.addAll(catalogsForChannel);
// platformCatalogList.addAll(catalogsForStream);
// if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)) {
// platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId);
// }else {
//
// }
WVPResult<List<PlatformCatalog>> result = new WVPResult<>();
result.setCode(0);
result.setMsg("success");

View File

@@ -284,5 +284,35 @@ public class StreamPushController {
return result;
}
/**
* 获取推流播放地址
* @param stream 推流信息
* @return
*/
@ApiOperation("获取推流播放地址")
@ApiImplicitParams({
@ApiImplicitParam(name = "stream", value = "推流信息", dataTypeClass = StreamPushItem.class),
})
@PostMapping(value = "/add")
@ResponseBody
public WVPResult<StreamInfo> add(@RequestBody StreamPushItem stream){
if (StringUtils.isEmpty(stream.getGbId())) {
return new WVPResult<>(400, "国标ID不可为空", null);
}
if (StringUtils.isEmpty(stream.getApp()) && StringUtils.isEmpty(stream.getStream())) {
return new WVPResult<>(400, "app或stream不可为空", null);
}
stream.setStatus(false);
stream.setPushIng(false);
stream.setAliveSecond(0L);
stream.setTotalReaderCount("0");
boolean result = streamPushService.add(stream);
if (result) {
return new WVPResult<>(0, "success", null);
}else {
return new WVPResult<>(-1, "fail", null);
}
}
}