临时提交

This commit is contained in:
648540858
2024-07-30 17:58:18 +08:00
parent 112cb2dfd8
commit 3ce973d2ee
17 changed files with 237 additions and 46 deletions

View File

@@ -5,6 +5,7 @@ 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.ChannelToRegionParam;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
@@ -15,6 +16,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
@@ -97,4 +99,19 @@ public class CommonChannelController {
}
return channelService.queryList(page, count, query, online, hasCivilCode);
}
@Operation(summary = "通道设置行政区划", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/region/add")
public void addChannelToRegion(@RequestBody ChannelToRegionParam param){
Assert.notEmpty(param.getChannelIds(),"通道ID不可为空");
Assert.hasLength(param.getCivilCode(),"未添加行政区划");
channelService.addChannelToRegion(param.getCivilCode(), param.getChannelIds());
}
@Operation(summary = "通道删除行政区划", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/region/delete")
public void deleteChannelToRegion(@RequestBody ChannelToRegionParam param){
Assert.isTrue(param.getChannelIds().isEmpty() && ObjectUtils.isEmpty(param.getCivilCode()),"参数异常");
channelService.deleteChannelToRegion(param.getCivilCode(), param.getChannelIds());
}
}

View File

@@ -12,6 +12,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
@@ -76,11 +77,11 @@ public class RegionController {
}
@Operation(summary = "删除区域")
@Parameter(name = "regionDeviceId", description = "区域编码", required = true)
@Parameter(name = "deviceId", description = "区域编码", required = true)
@ResponseBody
@DeleteMapping("/delete")
public void delete(String deviceId){
assert !ObjectUtils.isEmpty(deviceId);
Assert.hasLength(deviceId, "区域编码deviceId不需要存在");
boolean result = regionService.deleteByDeviceId(deviceId);
if (!result) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "移除失败");

View File

@@ -0,0 +1,13 @@
package com.genersoft.iot.vmp.gb28181.controller.bean;
import lombok.Data;
import java.util.List;
@Data
public class ChannelToRegionParam {
private String civilCode;
private List<Integer> channelIds;
}