Преглед на файлове

修复国标设备/设备列表中业务分组的子节点查看

648540858 преди 1 година
родител
ревизия
53f2f36f37

+ 3 - 3
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<DeviceChannel> 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<String> channelIds);
+                                      @Param("businessGroupId") String businessGroupId, @Param("parentChannelId") String parentChannelId,
+                                      @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel,
+                                      @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
 
     @SelectProvider(type = DeviceChannelProvider.class, method = "queryChannelsByDeviceDbId")
     List<DeviceChannel> queryChannelsByDeviceDbId(@Param("deviceDbId") int deviceDbId);

+ 1 - 1
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" +

+ 3 - 1
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 ) {

+ 10 - 3
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<DeviceChannel> all = channelMapper.queryChannels(deviceDbId, civilCode, parentId, query, channelType, online,null);
+        List<DeviceChannel> 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<DeviceChannel> all = channelMapper.queryChannels(device.getId(), null,null, query, hasSubChannel, online,null);
+        List<DeviceChannel> all = channelMapper.queryChannels(device.getId(), null,null, null, query, hasSubChannel, online,null);
         return new PageInfo<>(all);
     }
 

+ 5 - 2
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<CommonGBChannel> 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<CommonGBChannel> 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);
         }
     }
 

+ 1 - 0
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);
                                         }

+ 0 - 16
数据库/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,