SipRequest fromHeader 为 channelId 时无法正常查询
DeviceChannelMapper getDeviceByChannelId 查询语句错误修复
This commit is contained in:
parent
4bfe6fc17d
commit
c8a6ad283c
@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.Element;
|
||||
@ -27,6 +28,7 @@ import javax.sip.SipException;
|
||||
import javax.sip.header.CallIdHeader;
|
||||
import javax.sip.message.Response;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@ -54,6 +56,9 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
|
||||
@Autowired
|
||||
private VideoStreamSessionManager sessionManager;
|
||||
|
||||
@Autowired
|
||||
private DeviceChannelMapper deviceChannelMapper;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
// 添加消息处理的订阅
|
||||
@ -79,6 +84,15 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
|
||||
SIPRequest request = (SIPRequest) evt.getRequest();
|
||||
// 查询设备是否存在
|
||||
Device device = redisCatchStorage.getDevice(deviceId);
|
||||
|
||||
if(device == null){
|
||||
String sendBy = sipRequest.getTopmostVia().getSentBy().toString();
|
||||
List<Device> devicesByChannelId = deviceChannelMapper.getDeviceByChannelId(deviceId);
|
||||
device = devicesByChannelId.parallelStream().filter((deviceByChannelId)->{
|
||||
return deviceByChannelId.getHostAddress().equals(sendBy);
|
||||
}).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
// 查询上级平台是否存在
|
||||
ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(deviceId);
|
||||
try {
|
||||
|
@ -419,7 +419,7 @@ public interface DeviceChannelMapper {
|
||||
"and(latitude_gcj02=0 or latitude_wgs84=0 or longitude_wgs84= 0 or longitude_gcj02 = 0)")
|
||||
List<DeviceChannel> getChannelsWithoutTransform(String deviceId);
|
||||
|
||||
@Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.deviceId where dc.channel_id=#{channelId}")
|
||||
@Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.device_id where dc.channel_id=#{channelId}")
|
||||
List<Device> getDeviceByChannelId(String channelId);
|
||||
|
||||
|
||||
|
@ -36,6 +36,9 @@ spring:
|
||||
minimum-idle: 5 # 连接池最小空闲连接数
|
||||
idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位)
|
||||
max-lifetime: 1200000 # 是池中连接关闭后的最长生命周期(以毫秒为单位)
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev312
|
||||
#[可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
|
||||
server:
|
||||
port: 18978
|
||||
@ -56,7 +59,7 @@ sip:
|
||||
# 如果要监听多张网卡,可以使用逗号分隔多个IP, 例如: 192.168.1.4,10.0.0.4
|
||||
# 如果不明白,就使用0.0.0.0,大部分情况都是可以的
|
||||
# 请不要使用127.0.0.1,任何包括localhost在内的域名都是不可以的。
|
||||
ip: 192.168.1.241
|
||||
ip: 192.168.3.12
|
||||
# [可选] 28181服务监听的端口
|
||||
port: 5060
|
||||
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
|
||||
@ -116,4 +119,4 @@ user-settings:
|
||||
- http://127.0.0.1:8080
|
||||
# [可选] 日志配置, 一般不需要改
|
||||
logging:
|
||||
config: logback-spring-local.xml
|
||||
config: classpath:logback-spring-local.xml
|
@ -36,6 +36,8 @@ spring:
|
||||
minimum-idle: 5 # 连接池最小空闲连接数
|
||||
idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位)
|
||||
max-lifetime: 1200000 # 是池中连接关闭后的最长生命周期(以毫秒为单位)
|
||||
profiles:
|
||||
active: dev312
|
||||
#[可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
|
||||
server:
|
||||
port: 18978
|
||||
|
Loading…
Reference in New Issue
Block a user