diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java index 8f4586d3..0bacb90c 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java @@ -86,9 +86,9 @@ public interface DeviceChannelMapper { @SelectProvider(type = DeviceChannelProvider.class, method = "queryChannels") List queryChannels(@Param("deviceDbId") int deviceDbId, @Param("civilCode") String civilCode, - @Param("parentChannelId") String parentChannelId, @Param("query") String query, - @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, - @Param("channelIds") List channelIds); + @Param("businessGroupId") String businessGroupId, @Param("parentChannelId") String parentChannelId, + @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, + @Param("online") Boolean online, @Param("channelIds") List channelIds); @SelectProvider(type = DeviceChannelProvider.class, method = "queryChannelsByDeviceDbId") List queryChannelsByDeviceDbId(@Param("deviceDbId") int deviceDbId); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java index a2b8bc9d..1c89a468 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java @@ -154,7 +154,7 @@ public interface GroupMapper { " SELECT " + " wcg.device_id as gb_device_id," + " wcg.name as gb_name," + - " wcg.business_group as gb_business_group," + + " wcg.business_group as gb_business_group_id," + " 1 as gb_parental," + " wcg.parent_device_id as gb_parent_id" + " from wvp_common_group wcg" + diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java index e96fa29c..dc29280e 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java @@ -61,7 +61,9 @@ public class DeviceChannelProvider { StringBuilder sqlBuild = new StringBuilder(); sqlBuild.append(getBaseSelectSql()); sqlBuild.append(" where dc.device_db_id = #{deviceDbId} "); - if (params.get("parentChannelId") != null ) { + if (params.get("businessGroupId") != null ) { + sqlBuild.append(" AND coalesce(dc.gb_business_group_id, dc.business_group_id)=#{businessGroupId} AND coalesce(dc.gb_parent_id, dc.parent_id) is null"); + }else if (params.get("parentChannelId") != null ) { sqlBuild.append(" AND coalesce(dc.gb_parent_id, dc.parent_id)=#{parentChannelId}"); } if (params.get("civilCode") != null ) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java index 17bdb7b1..900abb6a 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; +import com.genersoft.iot.vmp.gb28181.bean.GbCode; import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce; import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper; @@ -601,12 +602,18 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { PageHelper.startPage(page, count); String civilCode = null; String parentId = null; + String businessGroupId = null; if (channelId.length() <= 8) { civilCode = channelId; }else { - parentId = channelId; + GbCode decode = GbCode.decode(channelId); + if (Integer.parseInt(decode.getTypeCode()) == 215) { + businessGroupId = channelId; + }else { + parentId = channelId; + } } - List all = channelMapper.queryChannels(deviceDbId, civilCode, parentId, query, channelType, online,null); + List all = channelMapper.queryChannels(deviceDbId, civilCode, businessGroupId, parentId, query, channelType, online,null); return new PageInfo<>(all); } @@ -623,7 +630,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { } // 获取到所有正在播放的流 PageHelper.startPage(page, count); - List all = channelMapper.queryChannels(device.getId(), null,null, query, hasSubChannel, online,null); + List all = channelMapper.queryChannels(device.getId(), null,null, null, query, hasSubChannel, online,null); return new PageInfo<>(all); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java index 87821ab0..e0f92f33 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java @@ -222,7 +222,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform { } private void sendCatalogResponse(List channels, Platform parentPlatform, String sn, String fromTag, int index, boolean sendAfterResponse) throws SipException, InvalidArgumentException, ParseException { - if (index >= channels.size()) { + if (index > channels.size()) { return; } List deviceChannels; @@ -231,6 +231,9 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform { }else { deviceChannels = channels.subList(index, channels.size()); } + if(deviceChannels.isEmpty()) { + return; + } String catalogXml = getCatalogXml(deviceChannels, sn, parentPlatform, channels.size()); // callid CallIdHeader callIdHeader = sipSender.getNewCallIdHeader(parentPlatform.getDeviceIp(),parentPlatform.getTransport()); @@ -280,7 +283,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform { } catch (SipException | InvalidArgumentException | ParseException e) { log.error("[命令发送失败] 国标级联 目录查询回复: {}", e.getMessage()); } - }, 30); + }, 100); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java index 9fc2d99f..b0fe7144 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java @@ -140,6 +140,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp // 业务分组/虚拟组织 Group group = Group.getInstance(channel); if (group != null) { + channel.setParental(1); channel.setChannelType(2); groupList.add(group); } diff --git a/数据库/2.7.3/初始化-mysql-2.7.3.sql b/数据库/2.7.3/初始化-mysql-2.7.3.sql index 49fd0f4a..6fbb9a4e 100644 --- a/数据库/2.7.3/初始化-mysql-2.7.3.sql +++ b/数据库/2.7.3/初始化-mysql-2.7.3.sql @@ -67,22 +67,6 @@ create table wvp_device_mobile_position create_time character varying(50) ); -create table wvp_gb_stream -( - gb_stream_id serial primary key, - app character varying(255) not null, - stream character varying(255) not null, - gb_id character varying(50) not null, - name character varying(255), - longitude double precision, - latitude double precision, - stream_type character varying(50), - media_server_id character varying(50), - create_time character varying(50), - constraint uk_gb_stream_unique_gb_id unique (gb_id), - constraint uk_gb_stream_unique_app_stream unique (app, stream) -); - create table wvp_log ( id serial primary key,