From b15115565ceaeada7c700099e06b37f1ba5ebadd Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 15 Oct 2020 17:05:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/impl/MessageRequestProcessor.java | 15 +++++++++------ src/main/resources/application.yml | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java index 927168f5..d3344bfe 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java @@ -144,9 +144,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { private void processMessageCatalogList(RequestEvent evt) { try { Element rootElement = getRootElement(evt); - String s = rootElement.toString(); Element deviceIdElement = rootElement.element("DeviceID"); - String deviceId = deviceIdElement.getText().toString(); + String deviceId = deviceIdElement.getText(); Element deviceListElement = rootElement.element("DeviceList"); if (deviceListElement == null) { return; @@ -164,9 +163,9 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { if (channelDeviceElement == null) { continue; } - String channelDeviceId = channelDeviceElement.getText().toString(); + String channelDeviceId = channelDeviceElement.getText(); Element channdelNameElement = itemDevice.element("Name"); - String channelName = channdelNameElement != null ? channdelNameElement.getText().toString() : ""; + String channelName = channdelNameElement != null ? channdelNameElement.getTextTrim().toString() : ""; Element statusElement = itemDevice.element("Status"); String status = statusElement != null ? statusElement.getText().toString() : "ON"; DeviceChannel deviceChannel = new DeviceChannel(); @@ -213,7 +212,11 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { deferredResultHolder.invokeResult(msg); // 回复200 - responseAck(evt); + if (offLineDetector.isOnline(deviceId)) { + responseAck(evt); + publisher.onlineEventPublish(deviceId, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE); + } + } } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { e.printStackTrace(); @@ -359,7 +362,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { private Element getRootElement(RequestEvent evt) throws DocumentException { Request request = evt.getRequest(); SAXReader reader = new SAXReader(); - reader.setEncoding("gbk"); +// reader.setEncoding("GB2312"); Document xml = reader.read(new ByteArrayInputStream(request.getRawContent())); return xml.getRootElement(); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index a06c19e6..f21076e6 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,7 +1,7 @@ spring: application: name: iot-vmp-vmanager - # 影子数据存储方式,支持redis、jdbc + # 影子数据存储方式,支持redis、jdbc,暂不支持mysql database: redis # 通信方式,支持kafka、http communicate: http