Merge pull request #999 from a24211317/wvp-28181-2.0

解决两个国标平台相互级联时,上级不能获取目录的问题
This commit is contained in:
648540858 2023-09-01 09:21:05 +08:00 committed by GitHub
commit cde7f6460a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message;
import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd.CatalogQueryMessageHandler;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import org.dom4j.Element; import org.dom4j.Element;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -16,6 +18,9 @@ public abstract class MessageHandlerAbstract extends SIPRequestProcessorParent i
public Map<String, IMessageHandler> messageHandlerMap = new ConcurrentHashMap<>(); public Map<String, IMessageHandler> messageHandlerMap = new ConcurrentHashMap<>();
@Autowired
private IVideoManagerStorage storage;
public void addHandler(String cmdType, IMessageHandler messageHandler) { public void addHandler(String cmdType, IMessageHandler messageHandler) {
messageHandlerMap.put(cmdType, messageHandler); messageHandlerMap.put(cmdType, messageHandler);
} }
@ -24,7 +29,15 @@ public abstract class MessageHandlerAbstract extends SIPRequestProcessorParent i
public void handForDevice(RequestEvent evt, Device device, Element element) { public void handForDevice(RequestEvent evt, Device device, Element element) {
String cmd = getText(element, "CmdType"); String cmd = getText(element, "CmdType");
IMessageHandler messageHandler = messageHandlerMap.get(cmd); IMessageHandler messageHandler = messageHandlerMap.get(cmd);
if (messageHandler != null) { if (messageHandler != null) {
//两个国标平台互相级联时由于上一步判断导致本该在平台处理的消息 放到了设备的处理逻辑
//所以对目录查询单独做了校验
if(messageHandler instanceof CatalogQueryMessageHandler){
ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(device.getDeviceId());
messageHandler.handForPlatform(evt, parentPlatform, element);
return;
}
messageHandler.handForDevice(evt, device, element); messageHandler.handForDevice(evt, device, element);
} }
} }