国标级联->选择通道支持移除目前下所有以及全部添加到目录下

This commit is contained in:
648540858
2022-11-22 12:55:29 +08:00
parent 8cab9f23b0
commit 1983b8b0a7
18 changed files with 234 additions and 66 deletions

View File

@@ -1,9 +1,9 @@
package com.genersoft.iot.vmp.vmanager.gb28181.gbStream;
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
import com.genersoft.iot.vmp.service.IGbStreamService;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam;
import com.genersoft.iot.vmp.service.IGbStreamService;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -12,9 +12,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Tag(name = "视频流关联到级联平台")
@CrossOrigin
@RestController
@@ -76,11 +77,14 @@ public class GbStreamController {
@Operation(summary = "移除国标关联")
@DeleteMapping(value = "/del")
@ResponseBody
public Object del(@RequestBody GbStreamParam gbStreamParam){
if (gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams())) {
return "success";
public void del(@RequestBody GbStreamParam gbStreamParam){
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) {
if (gbStreamParam.isAll()) {
gbStreamService.delAllPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
}
}else {
return "fail";
gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams());
}
}
@@ -93,11 +97,14 @@ public class GbStreamController {
@Operation(summary = "保存国标关联")
@PostMapping(value = "/add")
@ResponseBody
public Object add(@RequestBody GbStreamParam gbStreamParam){
if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId())) {
return "success";
public void add(@RequestBody GbStreamParam gbStreamParam){
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) {
if (gbStreamParam.isAll()) {
List<GbStream> allGBChannels = gbStreamService.getAllGBChannels(gbStreamParam.getPlatformId());
gbStreamService.addPlatformInfo(allGBChannels, gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
}
}else {
return "fail";
gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
}
}
}

View File

@@ -14,6 +14,9 @@ public class GbStreamParam {
@Schema(description = "目录ID")
private String catalogId;
@Schema(description = "关联所有通道")
private boolean all;
@Schema(description = "流国标信息列表")
private List<GbStream> gbStreams;
@@ -40,4 +43,12 @@ public class GbStreamParam {
public void setGbStreams(List<GbStream> gbStreams) {
this.gbStreams = gbStreams;
}
public boolean isAll() {
return all;
}
public void setAll(boolean all) {
this.all = all;
}
}

View File

@@ -10,8 +10,7 @@ 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.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.service.IPlatformChannelService;
import com.genersoft.iot.vmp.service.IPlatformService;
import com.genersoft.iot.vmp.service.*;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
@@ -72,6 +71,12 @@ public class PlatformController {
@Autowired
private IPlatformService platformService;
@Autowired
private IDeviceChannelService deviceChannelService;
@Autowired
private IGbStreamService gbStreamService;
/**
* 获取国标服务的配置
*
@@ -379,7 +384,16 @@ public class PlatformController {
if (logger.isDebugEnabled()) {
logger.debug("给上级平台添加国标通道API调用");
}
int result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId());
int result = 0;
if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
if (param.isAll()) {
logger.info("[国标级联]添加所有通道到上级平台, {}", param.getPlatformId());
List<ChannelReduce> allChannelForDevice = deviceChannelService.queryAllChannelList(param.getPlatformId());
result = platformChannelService.updateChannelForGB(param.getPlatformId(), allChannelForDevice, param.getCatalogId());
}
}else {
result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId());
}
if (result <= 0) {
throw new ControllerException(ErrorCode.ERROR100);
}
@@ -399,8 +413,15 @@ public class PlatformController {
if (logger.isDebugEnabled()) {
logger.debug("给上级平台删除国标通道API调用");
}
int result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces());
int result = 0;
if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
if (param.isAll()) {
logger.info("[国标级联]移除所有通道,上级平台, {}", param.getPlatformId());
result = platformChannelService.delAllChannelForGB(param.getPlatformId(), param.getCatalogId());
}
}else {
result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces());
}
if (result <= 0) {
throw new ControllerException(ErrorCode.ERROR100);
}

View File

@@ -17,6 +17,9 @@ public class UpdateChannelParam {
@Schema(description = "目录的国标编号")
private String catalogId;
@Schema(description = "处理所有通道")
private boolean all;
@Schema(description = "")
private List<ChannelReduce> channelReduces;
@@ -43,4 +46,12 @@ public class UpdateChannelParam {
public void setCatalogId(String catalogId) {
this.catalogId = catalogId;
}
public boolean isAll() {
return all;
}
public void setAll(boolean all) {
this.all = all;
}
}

View File

@@ -134,7 +134,6 @@ public class PlayController {
return result;
}
@Operation(summary = "停止点播")
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@@ -171,7 +170,6 @@ public class PlayController {
json.put("deviceId", deviceId);
json.put("channelId", channelId);
return json;
}
/**