修复国标级联状态查询 #2040
This commit is contained in:
@@ -50,9 +50,9 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handForPlatform(RequestEvent evt, Platform parentPlatform, Element rootElement) {
|
||||
public void handForPlatform(RequestEvent evt, Platform platform, Element rootElement) {
|
||||
|
||||
log.info("接收到DeviceStatus查询消息");
|
||||
log.info("[DeviceStatus Query] \n {}", rootElement.asXML());
|
||||
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
|
||||
// 回复200 OK
|
||||
try {
|
||||
@@ -62,13 +62,22 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i
|
||||
}
|
||||
String sn = rootElement.element("SN").getText();
|
||||
String channelId = getText(rootElement, "DeviceID");
|
||||
CommonGBChannel channel= channelService.queryOneWithPlatform(parentPlatform.getId(), channelId);
|
||||
if (platform.getDeviceGBId().equals(channelId)) {
|
||||
// 上级平台查询本平台状态
|
||||
try {
|
||||
cmderFroPlatform.deviceStatusResponse(platform, channelId, sn, fromHeader.getTag(), true);
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
log.error("[命令发送失败] 国标级联 DeviceStatus查询回复: {}", e.getMessage());
|
||||
}
|
||||
return;
|
||||
}
|
||||
CommonGBChannel channel= channelService.queryOneWithPlatform(platform.getId(), channelId);
|
||||
if (channel ==null){
|
||||
log.error("[平台没有该通道的使用权限]:platformId"+parentPlatform.getServerGBId()+" deviceID:"+channelId);
|
||||
log.error("[平台没有该通道的使用权限]:platformId"+platform.getServerGBId()+" deviceID:"+channelId);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
cmderFroPlatform.deviceStatusResponse(parentPlatform, channelId, sn, fromHeader.getTag(), "ON".equalsIgnoreCase(channel.getGbStatus()));
|
||||
cmderFroPlatform.deviceStatusResponse(platform, channelId, sn, fromHeader.getTag(), "ON".equalsIgnoreCase(channel.getGbStatus()));
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
log.error("[命令发送失败] 国标级联 DeviceStatus查询回复: {}", e.getMessage());
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen
|
||||
|
||||
@Override
|
||||
public void handForDevice(RequestEvent evt, Device device, Element element) {
|
||||
log.info("接收到DeviceStatus应答消息");
|
||||
log.info("[DeviceStatus Response] \n {}", element.asXML());
|
||||
// 检查设备是否存在, 不存在则不回复
|
||||
if (device == null) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user