From 70acfc7ca7547155981c779abb6e754157dd0987 Mon Sep 17 00:00:00 2001 From: 648540858 <456panlinlin> Date: Tue, 29 Mar 2022 10:04:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BA=A7=E8=81=94=E7=9A=84?= =?UTF-8?q?=E5=9B=BD=E6=A0=87=E9=80=9A=E9=81=93=E6=97=A0=E7=BB=8F=E7=BA=AC?= =?UTF-8?q?=E5=BA=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/bean/DeviceChannelInPlatform.java | 23 +++++++++++++++++++ .../cmd/CatalogNotifyMessageHandler.java | 16 ++++++------- .../query/cmd/CatalogQueryMessageHandler.java | 16 ++++++------- .../vmp/storager/IVideoManagerStorager.java | 2 +- .../vmp/storager/dao/DeviceChannelMapper.java | 12 +++------- .../impl/VideoManagerStoragerImpl.java | 4 ++-- 6 files changed, 45 insertions(+), 28 deletions(-) create mode 100644 src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannelInPlatform.java diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannelInPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannelInPlatform.java new file mode 100644 index 00000000..c61bb088 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java index 9550266b..a77179c7 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java +++ b/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 channelReduces = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); + List deviceChannels = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); // 查询关联的直播通道 List gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); - int size = channelReduces.size() + gbStreams.size(); + int size = deviceChannels.size() + gbStreams.size(); // 回复目录信息 List 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); // 防止发送过快 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java index 959432ce..40e5297b 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java +++ b/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 channelReduces = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); + List deviceChannelInPlatforms = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); // 查询关联的直播通道 List gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); // 回复目录信息 List 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); // 防止发送过快 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java b/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java index 710219ef..abbe2033 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java @@ -245,7 +245,7 @@ public interface IVideoManagerStorager { /** * 查询设备的通道信息 */ - List queryChannelListInParentPlatform(String platformId); + List queryChannelListInParentPlatform(String platformId); /** diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java index f04b7c0a..e1327997 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java +++ b/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 = {" "}) - List queryChannelByPlatformId(String platformId); + List queryChannelByPlatformId(String platformId); @Select("SELECT * FROM device_channel WHERE channelId=#{channelId}") diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java index 1f492c4b..cd8141fb 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java @@ -612,9 +612,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { } @Override - public List queryChannelListInParentPlatform(String platformId) { + public List queryChannelListInParentPlatform(String platformId) { - return deviceChannelMapper.queryChannelByPlatformId( platformId); + return deviceChannelMapper.queryChannelByPlatformId(platformId); } @Override