临时提交
This commit is contained in:
@@ -5,7 +5,9 @@ import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.IndustryCodeType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.NetworkIdentificationType;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionBYGbDeviceParam;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupByGbDeviceParam;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupParam;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionByGbDeviceParam;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionParam;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
@@ -119,16 +121,54 @@ public class CommonChannelController {
|
||||
|
||||
@Operation(summary = "通道设置行政区划-根据国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/region/device/add")
|
||||
public void addChannelToRegionBYGbDevice(@RequestBody ChannelToRegionBYGbDeviceParam param){
|
||||
public void addChannelToRegionByGbDevice(@RequestBody ChannelToRegionByGbDeviceParam param){
|
||||
Assert.notEmpty(param.getDeviceIds(),"参数异常");
|
||||
Assert.hasLength(param.getCivilCode(),"未添加行政区划");
|
||||
channelService.addChannelToRegionBYGbDevice(param.getCivilCode(), param.getDeviceIds());
|
||||
channelService.addChannelToRegionByGbDevice(param.getCivilCode(), param.getDeviceIds());
|
||||
}
|
||||
|
||||
@Operation(summary = "通道删除行政区划-根据国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/region/device/delete")
|
||||
public void deleteChannelToRegionBYGbDevice(@RequestBody ChannelToRegionBYGbDeviceParam param){
|
||||
public void deleteChannelToRegionByGbDevice(@RequestBody ChannelToRegionByGbDeviceParam param){
|
||||
Assert.notEmpty(param.getDeviceIds(),"参数异常");
|
||||
channelService.deleteChannelToRegionBYGbDevice(param.getDeviceIds());
|
||||
channelService.deleteChannelToRegionByGbDevice(param.getDeviceIds());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "通道设置业务分组", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/group/add")
|
||||
public void addChannelToGroup(@RequestBody ChannelToGroupParam param){
|
||||
Assert.notEmpty(param.getChannelIds(),"通道ID不可为空");
|
||||
Assert.hasLength(param.getParentId(),"未添加上级分组编号");
|
||||
Assert.hasLength(param.getBusinessGroup(),"未添加业务分组");
|
||||
channelService.addChannelToGroup(param.getParentId(), param.getBusinessGroup(), param.getChannelIds());
|
||||
}
|
||||
|
||||
@Operation(summary = "通道删除业务分组", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/group/delete")
|
||||
public void deleteChannelToGroup(@RequestBody ChannelToGroupParam param){
|
||||
Assert.isTrue(!param.getChannelIds().isEmpty()
|
||||
|| (!ObjectUtils.isEmpty(param.getParentId()) && !ObjectUtils.isEmpty(param.getBusinessGroup())),
|
||||
"参数异常");
|
||||
channelService.deleteChannelToGroup(param.getParentId(), param.getBusinessGroup(), param.getChannelIds());
|
||||
}
|
||||
|
||||
@Operation(summary = "通道设置业务分组-根据国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/group/device/add")
|
||||
public void addChannelToGroupByGbDevice(@RequestBody ChannelToGroupByGbDeviceParam param){
|
||||
Assert.notEmpty(param.getDeviceIds(),"参数异常");
|
||||
Assert.hasLength(param.getParentId(),"未添加上级分组编号");
|
||||
Assert.hasLength(param.getBusinessGroup(),"未添加业务分组");
|
||||
channelService.addChannelToGroupByGbDevice(param.getParentId(), param.getBusinessGroup(), param.getDeviceIds());
|
||||
}
|
||||
|
||||
@Operation(summary = "通道删除业务分组-根据国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/group/device/delete")
|
||||
public void deleteChannelToGroupByGbDevice(@RequestBody ChannelToGroupByGbDeviceParam param){
|
||||
Assert.notEmpty(param.getDeviceIds(),"参数异常");
|
||||
channelService.deleteChannelToGroupByGbDevice(param.getDeviceIds());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ public class PlatformController {
|
||||
}
|
||||
|
||||
boolean deleteResult = storager.deleteParentPlatform(parentPlatform);
|
||||
storager.delCatalogByPlatformId(parentPlatform.getServerGBId());
|
||||
// storager.delCatalogByPlatformId(parentPlatform.getServerGBId());
|
||||
storager.delRelationByPlatformId(parentPlatform.getServerGBId());
|
||||
// 停止发送位置订阅定时任务
|
||||
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_MobilePosition_" + parentPlatform.getServerGBId();
|
||||
@@ -382,124 +382,6 @@ public class PlatformController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取目录
|
||||
*
|
||||
* @param platformId 平台ID
|
||||
* @param parentId 目录父ID
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "platformId", description = "上级平台的国标编号", required = true)
|
||||
@Parameter(name = "parentId", description = "父级目录的国标编号", required = true)
|
||||
@GetMapping("/catalog")
|
||||
@ResponseBody
|
||||
public List<PlatformCatalog> getCatalogByPlatform(String platformId, String parentId) {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("查询目录,platformId: {}, parentId: {}", platformId, parentId);
|
||||
}
|
||||
ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
|
||||
if (platform == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台未找到");
|
||||
}
|
||||
// if (platformId.equals(parentId)) {
|
||||
// parentId = platform.getDeviceGBId();
|
||||
// }
|
||||
|
||||
if (platformId.equals(platform.getDeviceGBId())) {
|
||||
parentId = null;
|
||||
}
|
||||
|
||||
return storager.getChildrenCatalogByPlatform(platformId, parentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加目录
|
||||
*
|
||||
* @param platformCatalog 目录
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "添加目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/catalog/add")
|
||||
@ResponseBody
|
||||
public void addCatalog(@RequestBody PlatformCatalog platformCatalog) {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("添加目录,{}", JSON.toJSONString(platformCatalog));
|
||||
}
|
||||
PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId());
|
||||
|
||||
if (platformCatalogInStore != null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " already exists");
|
||||
}
|
||||
int addResult = storager.addCatalog(platformCatalog);
|
||||
if (addResult <= 0) {
|
||||
throw new ControllerException(ErrorCode.ERROR100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑目录
|
||||
*
|
||||
* @param platformCatalog 目录
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "编辑目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/catalog/edit")
|
||||
@ResponseBody
|
||||
public void editCatalog(@RequestBody PlatformCatalog platformCatalog) {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("编辑目录,{}", JSON.toJSONString(platformCatalog));
|
||||
}
|
||||
PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId());
|
||||
|
||||
if (platformCatalogInStore == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " not exists");
|
||||
}
|
||||
int addResult = storager.updateCatalog(platformCatalog);
|
||||
if (addResult <= 0) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "写入数据库失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除目录
|
||||
*
|
||||
* @param id 目录Id
|
||||
* @param platformId 平台Id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "id", description = "目录Id", required = true)
|
||||
@Parameter(name = "platformId", description = "平台Id", required = true)
|
||||
@DeleteMapping("/catalog/del")
|
||||
@ResponseBody
|
||||
public void delCatalog(String id, String platformId) {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("删除目录,{}", id);
|
||||
}
|
||||
|
||||
if (ObjectUtils.isEmpty(id) || ObjectUtils.isEmpty(platformId)) {
|
||||
throw new ControllerException(ErrorCode.ERROR400);
|
||||
}
|
||||
|
||||
int delResult = storager.delCatalog(platformId, id);
|
||||
// 如果删除的是默认目录则根目录设置为默认目录
|
||||
PlatformCatalog parentPlatform = storager.queryDefaultCatalogInPlatform(platformId);
|
||||
|
||||
// 默认节点被移除
|
||||
if (parentPlatform == null) {
|
||||
storager.setDefaultCatalog(platformId, platformId);
|
||||
}
|
||||
|
||||
if (delResult <= 0) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "写入数据库失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除关联
|
||||
*
|
||||
@@ -522,29 +404,4 @@ public class PlatformController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改默认目录
|
||||
*
|
||||
* @param platformId 平台Id
|
||||
* @param catalogId 目录Id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "修改默认目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "catalogId", description = "目录Id", required = true)
|
||||
@Parameter(name = "platformId", description = "平台Id", required = true)
|
||||
@PostMapping("/catalog/default/update")
|
||||
@ResponseBody
|
||||
public void setDefaultCatalog(String platformId, String catalogId) {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("修改默认目录,{},{}", platformId, catalogId);
|
||||
}
|
||||
int updateResult = storager.setDefaultCatalog(platformId, catalogId);
|
||||
|
||||
if (updateResult <= 0) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "写入数据库失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.genersoft.iot.vmp.gb28181.controller.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ChannelToGroupByGbDeviceParam {
|
||||
private List<Integer> deviceIds;
|
||||
private String parentId;
|
||||
private String businessGroup;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.genersoft.iot.vmp.gb28181.controller.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ChannelToGroupParam {
|
||||
|
||||
private String parentId;
|
||||
private String businessGroup;
|
||||
private List<Integer> channelIds;
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ChannelToRegionBYGbDeviceParam {
|
||||
public class ChannelToRegionByGbDeviceParam {
|
||||
private List<Integer> deviceIds;
|
||||
private String civilCode;
|
||||
}
|
||||
Reference in New Issue
Block a user