Browse Source

修复级联的国标通道无经纬度问题

648540858 3 years ago
parent
commit
1553b39b45

+ 23 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannelInPlatform.java

@@ -0,0 +1,23 @@
+package com.genersoft.iot.vmp.gb28181.bean;
+
+public class DeviceChannelInPlatform extends DeviceChannel{
+
+	private String platFormId;
+	private String catalogId;
+
+	public String getPlatFormId() {
+		return platFormId;
+	}
+
+	public void setPlatFormId(String platFormId) {
+		this.platFormId = platFormId;
+	}
+
+	public String getCatalogId() {
+		return catalogId;
+	}
+
+	public void setCatalogId(String catalogId) {
+		this.catalogId = catalogId;
+	}
+}

+ 8 - 8
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java

@@ -64,10 +64,10 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
             Element snElement = rootElement.element("SN");
             String sn = snElement.getText();
             // 准备回复通道信息
-            List<ChannelReduce> channelReduces = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId());
+            List<DeviceChannelInPlatform> deviceChannels = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId());
             // 查询关联的直播通道
             List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId());
-            int size = channelReduces.size() + gbStreams.size();
+            int size = deviceChannels.size() + gbStreams.size();
             // 回复目录信息
             List<PlatformCatalog> catalogs =  storager.queryCatalogInPlatform(parentPlatform.getServerGBId());
             if (catalogs.size() > 0) {
@@ -96,14 +96,14 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
                 }
             }
             // 回复级联的通道
-            if (channelReduces.size() > 0) {
-                for (ChannelReduce channelReduce : channelReduces) {
-                    if (channelReduce.getCatalogId().equals(parentPlatform.getServerGBId())) {
-                        channelReduce.setCatalogId(parentPlatform.getDeviceGBId());
+            if (deviceChannels.size() > 0) {
+                for (DeviceChannelInPlatform channel : deviceChannels) {
+                    if (channel.getCatalogId().equals(parentPlatform.getServerGBId())) {
+                        channel.setCatalogId(parentPlatform.getDeviceGBId());
                     }
-                    DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
+                    DeviceChannel deviceChannel = storager.queryChannel(channel.getDeviceId(), channel.getChannelId());
                     deviceChannel.setParental(0);
-                    deviceChannel.setParentId(channelReduce.getCatalogId());
+                    deviceChannel.setParentId(channel.getCatalogId());
                     deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6));
                     cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
                     // 防止发送过快

+ 8 - 8
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java

@@ -67,12 +67,12 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
             Element snElement = rootElement.element("SN");
             String sn = snElement.getText();
             // 准备回复通道信息
-            List<ChannelReduce> channelReduces = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId());
+            List<DeviceChannelInPlatform> deviceChannelInPlatforms = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId());
             // 查询关联的直播通道
             List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId());
             // 回复目录信息
             List<PlatformCatalog> catalogs =  storager.queryCatalogInPlatform(parentPlatform.getServerGBId());
-            int size = catalogs.size() + channelReduces.size() + gbStreams.size();
+            int size = catalogs.size() + deviceChannelInPlatforms.size() + gbStreams.size();
             if (catalogs.size() > 0) {
                 for (PlatformCatalog catalog : catalogs) {
                     if (catalog.getParentId().equals(parentPlatform.getServerGBId())) {
@@ -99,14 +99,14 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
                 }
             }
             // 回复级联的通道
-            if (channelReduces.size() > 0) {
-                for (ChannelReduce channelReduce : channelReduces) {
-                    if (channelReduce.getCatalogId().equals(parentPlatform.getServerGBId())) {
-                        channelReduce.setCatalogId(parentPlatform.getDeviceGBId());
+            if (deviceChannelInPlatforms.size() > 0) {
+                for (DeviceChannelInPlatform channel : deviceChannelInPlatforms) {
+                    if (channel.getCatalogId().equals(parentPlatform.getServerGBId())) {
+                        channel.setCatalogId(parentPlatform.getDeviceGBId());
                     }
-                    DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
+                    DeviceChannel deviceChannel = storager.queryChannel(channel.getDeviceId(), channel.getChannelId());
                     deviceChannel.setParental(0);
-                    deviceChannel.setParentId(channelReduce.getCatalogId());
+                    deviceChannel.setParentId(channel.getCatalogId());
                     deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6));
                     cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
                     // 防止发送过快

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java

@@ -245,7 +245,7 @@ public interface IVideoManagerStorager {
 	/**
 	 * 查询设备的通道信息
 	 */
-	List<ChannelReduce> queryChannelListInParentPlatform(String platformId);
+	List<DeviceChannelInPlatform> queryChannelListInParentPlatform(String platformId);
 
 
 	/**

+ 3 - 9
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java

@@ -1,6 +1,7 @@
 package com.genersoft.iot.vmp.storager.dao;
 
 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
+import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
 import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
 import org.apache.ibatis.annotations.*;
@@ -114,22 +115,15 @@ public interface DeviceChannelMapper {
 
     @Select(value = {" <script>" +
             "SELECT " +
-            "    dc.id,\n" +
-            "    dc.channelId,\n" +
-            "    dc.deviceId,\n" +
-            "    dc.name,\n" +
-            "    de.manufacturer,\n" +
-            "    de.hostAddress,\n" +
-            "    dc.subCount,\n" +
+            "    dc.*,\n" +
             "    pgc.platformId as platformId,\n" +
             "    pgc.catalogId as catalogId " +
             " FROM device_channel dc " +
-            " LEFT JOIN device de ON dc.deviceId = de.deviceId " +
             " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " +
             " WHERE pgc.platformId = #{platformId} " +
             " ORDER BY dc.deviceId, dc.channelId ASC" +
             " </script>"})
-    List<ChannelReduce> queryChannelByPlatformId(String platformId);
+    List<DeviceChannelInPlatform> queryChannelByPlatformId(String platformId);
 
 
     @Select("SELECT * FROM device_channel WHERE channelId=#{channelId}")

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java

@@ -612,9 +612,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
 	}
 
 	@Override
-	public List<ChannelReduce> queryChannelListInParentPlatform(String platformId) {
+	public List<DeviceChannelInPlatform> queryChannelListInParentPlatform(String platformId) {
 
-		return deviceChannelMapper.queryChannelByPlatformId( platformId);
+		return deviceChannelMapper.queryChannelByPlatformId(platformId);
 	}
 
 	@Override