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 25a3df37..e92fceb0 100755 --- 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 @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd; +import com.genersoft.iot.vmp.common.CommonGbChannel; import com.genersoft.iot.vmp.conf.SipConfig; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; @@ -9,6 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; +import com.genersoft.iot.vmp.service.IPlatformChannelService; import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import gov.nist.javax.sip.message.SIPRequest; import org.dom4j.Element; @@ -43,7 +45,7 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem private SIPCommanderFroPlatform cmderFroPlatform; @Autowired - private SipConfig config; + private IPlatformChannelService platformChannelService; @Autowired private EventPublisher publisher; @@ -74,33 +76,11 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem Element snElement = rootElement.element("SN"); String sn = snElement.getText(); // 准备回复通道信息 - List deviceChannelInPlatforms = storager.queryChannelWithCatalog(parentPlatform.getServerGBId()); - // 查询关联的直播通道 - List gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); - // 回复目录信息 - List catalogs = storager.queryCatalogInPlatform(parentPlatform.getServerGBId()); + List commonGbChannelList = platformChannelService.queryChannelList(parentPlatform); - List allChannels = new ArrayList<>(); - - // 回复平台 -// DeviceChannel deviceChannel = getChannelForPlatform(parentPlatform); -// allChannels.add(deviceChannel); - - // 回复目录 - if (catalogs.size() > 0) { - allChannels.addAll(catalogs); - } - // 回复级联的通道 - if (deviceChannelInPlatforms.size() > 0) { - allChannels.addAll(deviceChannelInPlatforms); - } - // 回复直播的通道 - if (gbStreams.size() > 0) { - allChannels.addAll(gbStreams); - } try { - if (allChannels.size() > 0) { - cmderFroPlatform.catalogQuery(allChannels, parentPlatform, sn, fromHeader.getTag()); + if (commonGbChannelList.size() > 0) { + cmderFroPlatform.catalogQuery(commonGbChannelList, parentPlatform, sn, fromHeader.getTag()); }else { // 回复无通道 cmderFroPlatform.catalogQuery(null, parentPlatform, sn, fromHeader.getTag(), 0); diff --git a/src/main/java/com/genersoft/iot/vmp/service/IPlatformChannelService.java b/src/main/java/com/genersoft/iot/vmp/service/IPlatformChannelService.java index e18e1407..5a1e4638 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/IPlatformChannelService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IPlatformChannelService.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.service; +import com.genersoft.iot.vmp.common.CommonGbChannel; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import java.util.List; @@ -24,4 +25,9 @@ public interface IPlatformChannelService { * 在一个给定的范围内查出分享了这个通道的上级平台 */ List querySharePlatformListByChannelId(int commonGbId, List platforms); + + /** + * 查询关联了上级平台的所有通道 + */ + List queryChannelList(ParentPlatform platform); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java index 1e60c42f..7771e422 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java @@ -17,6 +17,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.List; /** @@ -123,4 +124,30 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { public List querySharePlatformListByChannelId(int commonGbId, List platforms) { return platformChannelMapper.querySharePlatformListByChannelId(); } + + @Override + public List queryChannelList(ParentPlatform platform) { + List result = new ArrayList<>(); + if (platform.isShareAllChannel()) { + // 获取所有通道 + List allChannelList = commonGbChannelMapper.getAll(); + if (!allChannelList.isEmpty()) { + result.addAll(allChannelList); + // 获取所有分组 + + // 获取所有地区 + } + }else { + // 查询所有关联了的国标通道 + if (platform.isShareGroup()) { + // 获取相关分组 + } + if (platform.isShareRegion()) { + + } + } + + + return null; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonChannelMapper.java index 1f712d31..4f0435f8 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonChannelMapper.java @@ -600,4 +600,10 @@ public interface CommonChannelMapper { " #{item}" + "") void deleteByIdList(List commonChannelIdList); + + @Select("") + List getAll(); + }