完善分组通道管理

This commit is contained in:
648540858
2024-08-07 17:12:39 +08:00
parent a3f7753b84
commit 5abf5012eb
10 changed files with 122 additions and 50 deletions

View File

@@ -399,4 +399,19 @@ public interface CommonGBChannelMapper {
int updateGroup(@Param("parentId") String parentId, @Param("businessGroup") String businessGroup,
List<CommonGBChannel> channelList);
@Select("<script>" +
" select " +
" coalesce(gb_device_id, device_id) as id," +
" coalesce(gb_name, name) as label, " +
" id as db_id, " +
" gb_parent_id as parent_device_id," +
" gb_business_group_id as business_group," +
" 1 as type, " +
" true as is_leaf " +
" from wvp_device_channel " +
" where gb_parent_id = #{parent} " +
" <if test='query != null'> AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') " +
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))</if> " +
" </script>")
List<GroupTree> queryForGroupTreeByParentId(@Param("query") String query, @Param("parent") String parent);
}

View File

@@ -142,7 +142,7 @@ public class ChannelProvider {
public String queryByGbDeviceIds(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql());
sqlBuild.append("where device_db_id in ( ");
sqlBuild.append("where id in ( ");
Collection<Integer> ids = (Collection<Integer>)params.get("deviceIds");
boolean first = true;
@@ -208,7 +208,7 @@ public class ChannelProvider {
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql());
sqlBuild.append(" where gb_business_group_id in ( ");
sqlBuild.append(" where gb_parent_id in ( ");
Collection<Group> ids = (Collection<Group>)params.get("groupList");
boolean first = true;
for (Group group : ids) {

View File

@@ -531,11 +531,16 @@ public class GbChannelServiceImpl implements IGbChannelService {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
}
for (CommonGBChannel channel : channelList) {
channel.setGbCivilCode(civilCode);
channel.setGbParentId(parentId);
channel.setGbBusinessGroupId(businessGroup);
}
int result = commonGBChannelMapper.updateRegion(civilCode, channelList);
int result = commonGBChannelMapper.updateGroup(parentId, businessGroup, channelList);
// 发送通知
if (result > 0) {
for (CommonGBChannel channel : channelList) {
channel.setGbBusinessGroupId(businessGroup);
channel.setGbParentId(parentId);
}
try {
// 发送catalog
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
@@ -547,6 +552,10 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public void deleteChannelToGroupByGbDevice(List<Integer> deviceIds) {
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
if (channelList.isEmpty()) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
}
commonGBChannelMapper.removeParentIdByChannels(channelList);
}
}

View File

@@ -1,9 +1,6 @@
package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.GbCode;
import com.genersoft.iot.vmp.gb28181.bean.Group;
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
@@ -182,7 +179,16 @@ public class GroupServiceImpl implements IGroupService {
if (gbCode.getTypeCode().equals("215")) {
return groupManager.queryForTreeByBusinessGroup(query, parent, platformId);
}else {
return groupManager.queryForTree(query, parent, platformId);
// 查询业务分组以及所属的通道
List<GroupTree> groupTrees = groupManager.queryForTree(query, parent, platformId);
if (platformId == null) {
List<GroupTree> channelList = commonGBChannelMapper.queryForGroupTreeByParentId(query, parent);
groupTrees.addAll(channelList);
}else {
// TODO 查询平台独属的关联通道
}
return groupTrees;
}
}

View File

@@ -143,7 +143,7 @@ public class ZLMHttpHookListener {
}
if (param.getSchema().equalsIgnoreCase("rtsp")) {
if (param.isRegist()) {
logger.info("[ZLM HOOK] 流注册, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
log.info("[ZLM HOOK] 流注册, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
String queryParams = param.getParams();
if (queryParams == null) {
try {