增加批量修改通道的业务分组以及行政区划,支持筛选业务分组和行政区划,支持抽稀还原,国标通道编辑增加表单校验

This commit is contained in:
lin
2025-10-30 15:05:50 +08:00
parent 091d6e67ee
commit fa9aaf3fa2
20 changed files with 395 additions and 104 deletions

View File

@@ -104,16 +104,26 @@ public class ChannelController {
@Parameter(name = "online", description = "是否在线")
@Parameter(name = "hasRecordPlan", description = "是否已设置录制计划")
@Parameter(name = "channelType", description = "通道类型, 0国标设备1推流设备2拉流代理")
@Parameter(name = "civilCode", description = "行政区划")
@Parameter(name = "parentDeviceId", description = "父节点编码")
@GetMapping("/list")
public PageInfo<CommonGBChannel> queryList(int page, int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean hasRecordPlan,
@RequestParam(required = false) Integer channelType){
@RequestParam(required = false) Integer channelType,
@RequestParam(required = false) String civilCode,
@RequestParam(required = false) String parentDeviceId){
if (ObjectUtils.isEmpty(query)){
query = null;
}
return channelService.queryList(page, count, query, online, hasRecordPlan, channelType);
if (ObjectUtils.isEmpty(civilCode)){
civilCode = null;
}
if (ObjectUtils.isEmpty(parentDeviceId)){
parentDeviceId = null;
}
return channelService.queryList(page, count, query, online, hasRecordPlan, channelType, civilCode, parentDeviceId);
}
@Operation(summary = "获取关联行政区划通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
@@ -481,4 +491,13 @@ public class ChannelController {
public void saveLevel(@RequestBody List<ChannelForThin> channels){
channelService.saveLevel(channels);
}
@Operation(summary = "为地图去除抽稀结果", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/map/reset-level")
public void resetLevel(){
channelService.resetLevel();
}
}

View File

@@ -474,7 +474,8 @@ public interface CommonGBChannelMapper {
@SelectProvider(type = ChannelProvider.class, method = "queryList")
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online,
@Param("hasRecordPlan") Boolean hasRecordPlan, @Param("dataType") Integer dataType);
@Param("hasRecordPlan") Boolean hasRecordPlan, @Param("dataType") Integer dataType,
@Param("civilCode") String civilCode, @Param("parentDeviceId") String parentDeviceId);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
@@ -668,4 +669,8 @@ public interface CommonGBChannelMapper {
@SelectProvider(type = ChannelProvider.class, method = "queryMeetingChannelList")
List<CameraChannel> queryMeetingChannelList(@Param("business") String business);
@Update("UPDATE wvp_device_channel SET map_level=null")
int resetLevel();
}

View File

@@ -289,6 +289,12 @@ public class ChannelProvider {
if (params.get("dataType") != null) {
sqlBuild.append(" AND data_type = #{dataType}");
}
if (params.get("civilCode") != null) {
sqlBuild.append(" AND coalesce(gb_civil_code, civil_code) = #{civilCode}");
}
if (params.get("parentDeviceId") != null) {
sqlBuild.append(" AND coalesce(gb_parent_id, parent_id) = #{parentDeviceId}");
}
return sqlBuild.toString();
}

View File

@@ -85,7 +85,7 @@ public interface IGbChannelService {
List<CommonGBChannel> queryListByStreamPushList(List<StreamPush> streamPushList);
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType);
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType, String civilCode, String parentDeviceId);
PageInfo<CommonGBChannel> queryListByCivilCodeForUnusual(int page, int count, String query, Boolean online, Integer channelType);
@@ -104,4 +104,7 @@ public interface IGbChannelService {
void saveLevel(List<ChannelForThin> channels);
CommonGBChannel queryCommonChannelByDeviceChannel(DeviceChannel channel);
void resetLevel();
}

View File

@@ -10,7 +10,6 @@ import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.RegionMapper;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.channel.ChannelEvent;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
@@ -23,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
@@ -68,9 +68,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "缺少通道数据类型或通道数据关联设备ID");
}
CommonGBChannel commonGBChannelInDb = commonGBChannelMapper.queryByDataId(commonGBChannel.getDataType(), commonGBChannel.getDataDeviceId());
if (commonGBChannelInDb != null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "此推流已经关联通道");
}
Assert.isNull(commonGBChannelInDb, "此推流已经关联通道");
// 检验国标编号是否重复
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByDeviceId(commonGBChannel.getGbDeviceId());
Assert.isTrue(channelList.isEmpty(), "国标编号已经存在");
commonGBChannel.setCreateTime(DateUtil.getNow());
commonGBChannel.setUpdateTime(DateUtil.getNow());
int result = commonGBChannelMapper.insert(commonGBChannel);
@@ -741,14 +744,15 @@ public class GbChannelServiceImpl implements IGbChannelService {
}
@Override
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType) {
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan,
Integer channelType, String civilCode, String parentDeviceId) {
PageHelper.startPage(page, count);
if (query != null) {
query = query.replaceAll("/", "//")
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
List<CommonGBChannel> all = commonGBChannelMapper.queryList(query, online, hasRecordPlan, channelType);
List<CommonGBChannel> all = commonGBChannelMapper.queryList(query, online, hasRecordPlan, channelType, civilCode, parentDeviceId);
return new PageInfo<>(all);
}
@@ -826,7 +830,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public List<CommonGBChannel> queryListForMap(String query, Boolean online, Boolean hasRecordPlan, Integer channelType) {
return commonGBChannelMapper.queryList(query, online, hasRecordPlan, channelType);
return commonGBChannelMapper.queryList(query, online, hasRecordPlan, channelType, null, null);
}
@Override
@@ -850,4 +854,9 @@ public class GbChannelServiceImpl implements IGbChannelService {
public CommonGBChannel queryCommonChannelByDeviceChannel(DeviceChannel channel) {
return commonGBChannelMapper.queryCommonChannelByDeviceChannel(channel);
}
@Override
public void resetLevel() {
commonGBChannelMapper.resetLevel();
}
}

View File

@@ -285,9 +285,9 @@ public class GroupServiceImpl implements IGroupService, CommandLineRunner {
if (group == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "虚拟组织不存在");
}
groupList.add(group);
List<Group> allParent = getAllParent(group);
groupList.addAll(allParent);
groupList.add(group);
return groupList;
}

View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.Group;
import com.genersoft.iot.vmp.gb28181.bean.RedisGroupMessage;
import com.genersoft.iot.vmp.gb28181.service.IGroupService;
@@ -163,7 +164,9 @@ public class RedisGroupMsgListener implements MessageListener {
}
}
} catch (Exception e) {
} catch (ControllerException e) {
log.warn("[REDIS消息-业务分组同步回复] 失败, \r\n{}", e.getMsg());
}catch (Exception e) {
log.warn("[REDIS消息-业务分组同步回复] 发现未处理的异常, \r\n{}", new String(msg.getBody()));
log.error("[REDIS消息-业务分组同步回复] 异常内容: ", e);
}

View File

@@ -23,6 +23,9 @@ public class CameraGroup extends Group {
}
public void addChild(CameraGroup child) {
if (child == null) {
return;
}
this.child.add(child);
if (this.parent != null) {
this.parent.addChild(child);

View File

@@ -401,23 +401,12 @@ public class CameraChannelService implements CommandLineRunner {
public CameraChannel queryOne(String deviceId, String deviceCode, String geoCoordSys) {
List<CameraChannel> cameraChannels = channelMapper.queryGbChannelByChannelDeviceIdAndGbDeviceId(deviceId, deviceCode);
Assert.isTrue(cameraChannels.isEmpty(), "通道不存在");
CameraChannel channel = cameraChannels.get(0);
if (geoCoordSys != null && channel.getGbLongitude() != null && channel.getGbLatitude() != null
&& channel.getGbLongitude() > 0 && channel.getGbLatitude() > 0) {
if (geoCoordSys.equalsIgnoreCase("GCJ02")) {
Double[] position = Coordtransform.WGS84ToGCJ02(channel.getGbLongitude(), channel.getGbLatitude());
channel.setGbLongitude(position[0]);
channel.setGbLatitude(position[1]);
}else if (geoCoordSys.equalsIgnoreCase("BD09")) {
Double[] gcj02Position = Coordtransform.WGS84ToGCJ02(channel.getGbLongitude(), channel.getGbLatitude());
Double[] position = Coordtransform.GCJ02ToBD09(gcj02Position[0], gcj02Position[1]);
channel.setGbLongitude(position[0]);
channel.setGbLatitude(position[1]);
}
}
List<CameraChannel> channels = addIconPathAndPositionForCameraChannelList(cameraChannels, geoCoordSys);
CameraChannel channel = channels.get(0);
if (deviceCode != null) {
channel.setDeviceCode(deviceCode);
}
return channel;
}