From 335916f1f15eb9d0b34dea38cacee2300eac0606 Mon Sep 17 00:00:00 2001 From: 李防 <liguofang0703@126.com> Date: 星期一, 07 三月 2022 14:20:27 +0800 Subject: [PATCH] InviteRequestProcessor类中,channelid从invite消息的header subject获取,不再从第一行request line获取。原因是和第三方平台对接时,发送的invite消息第一行为国标平台编码而不是设备通道编码,导致报错通道不存在,返回404。 --- src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java | 41 ++++++++++++++++++++++++++++------------- 1 files changed, 28 insertions(+), 13 deletions(-) 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 1d04c82..5e6410b 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 @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.storager.impl; +import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.conf.SipConfig; import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.event.EventPublisher; @@ -13,6 +14,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorager; import com.genersoft.iot.vmp.storager.dao.*; +import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; import com.genersoft.iot.vmp.utils.node.ForestNodeMerger; import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; @@ -156,7 +158,10 @@ public synchronized void updateChannel(String deviceId, DeviceChannel channel) { String channelId = channel.getChannelId(); channel.setDeviceId(deviceId); - channel.setStreamId(streamSession.getStreamId(deviceId, channel.getChannelId())); + StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId); + if (streamInfo != null) { + channel.setStreamId(streamInfo.getStream()); + } String now = this.format.format(System.currentTimeMillis()); channel.setUpdateTime(now); DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId); @@ -178,7 +183,10 @@ if (channelList.size() == 0) { for (DeviceChannel channel : channels) { channel.setDeviceId(deviceId); - channel.setStreamId(streamSession.getStreamId(deviceId, channel.getChannelId())); + StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channel.getChannelId()); + if (streamInfo != null) { + channel.setStreamId(streamInfo.getStream()); + } String now = this.format.format(System.currentTimeMillis()); channel.setUpdateTime(now); channel.setCreateTime(now); @@ -189,9 +197,11 @@ channelsInStore.put(deviceChannel.getChannelId(), deviceChannel); } for (DeviceChannel channel : channels) { - String channelId = channel.getChannelId(); channel.setDeviceId(deviceId); - channel.setStreamId(streamSession.getStreamId(deviceId, channel.getChannelId())); + StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channel.getChannelId()); + if (streamInfo != null) { + channel.setStreamId(streamInfo.getStream()); + } String now = this.format.format(System.currentTimeMillis()); channel.setUpdateTime(now); if (channelsInStore.get(channel.getChannelId()) != null) { @@ -607,19 +617,19 @@ @Override public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId) { - Map<String, ChannelReduce> deviceAndChannels = new HashMap<>(); + Map<Integer, ChannelReduce> deviceAndChannels = new HashMap<>(); for (ChannelReduce channelReduce : channelReduces) { channelReduce.setCatalogId(catalogId); - deviceAndChannels.put(channelReduce.getDeviceId() + "_" + channelReduce.getChannelId(), channelReduce); + deviceAndChannels.put(channelReduce.getId(), channelReduce); } - List<String> deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet()); + List<Integer> deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet()); // 鏌ヨ褰撳墠宸茬粡瀛樺湪鐨� - List<String> relatedPlatformchannels = platformChannelMapper.findChannelRelatedPlatform(platformId, deviceAndChannelList); - if (relatedPlatformchannels != null) { - deviceAndChannelList.removeAll(relatedPlatformchannels); + List<Integer> channelIds = platformChannelMapper.findChannelRelatedPlatform(platformId, channelReduces); + if (deviceAndChannelList != null) { + deviceAndChannelList.removeAll(channelIds); } - for (String relatedPlatformchannel : relatedPlatformchannels) { - deviceAndChannels.remove(relatedPlatformchannel); + for (Integer channelId : channelIds) { + deviceAndChannels.remove(channelId); } List<ChannelReduce> channelReducesToAdd = new ArrayList<>(deviceAndChannels.values()); // 瀵瑰墿涓嬬殑鏁版嵁杩涜瀛樺偍 @@ -707,7 +717,7 @@ try { if (streamProxyMapper.add(streamProxyItem) > 0) { if (!StringUtils.isEmpty(streamProxyItem.getGbId())) { - if (gbStreamMapper.add(streamProxyItem) > 0) { + if (gbStreamMapper.add(streamProxyItem) < 0) { //浜嬪姟鍥炴粴 dataSourceTransactionManager.rollback(transactionStatus); return false; @@ -1095,4 +1105,9 @@ public PlatformCatalog queryDefaultCatalogInPlatform(String platformId) { return catalogMapper.selectDefaultByPlatFormId(platformId); } + + @Override + public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) { + return platformMapper.getChannelSource(platformId, gbId); + } } -- Gitblit v1.8.0