From 6560a7ad3830f28eedaeb65c84c27e2f9289db5c Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 28 七月 2021 16:32:42 +0800
Subject: [PATCH] Merge pull request #136 from lawrencehj/wvp-28181-2.0
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java | 41 ++++++++++++++++++++++++++---------------
1 files changed, 26 insertions(+), 15 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 9d282c6..6a29652 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
@@ -282,7 +282,7 @@
//String result = XmlUtil.getText(rootElement, "Result");
// 鍥炲200 OK
responseAck(evt);
- if (rootElement.getName().equals("Response")) {//} !XmlUtil.isEmpty(result)) {
+ if (rootElement.getName().equals("Response")) {//} !StringUtils.isEmpty(result)) {
// 姝ゅ鏄鏈钩鍙板彂鍑篋eviceControl鎸囦护鐨勫簲绛�
JSONObject json = new JSONObject();
XmlUtil.node2Json(rootElement, json);
@@ -299,7 +299,7 @@
String platformId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser();
String targetGBId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser();
// 杩滅▼鍚姩鍔熻兘
- if (!XmlUtil.isEmpty(XmlUtil.getText(rootElement, "TeleBoot"))) {
+ if (!StringUtils.isEmpty(XmlUtil.getText(rootElement, "TeleBoot"))) {
if (deviceId.equals(targetGBId)) {
// 杩滅▼鍚姩鏈钩鍙帮細闇�瑕佸湪閲嶆柊鍚姩绋嬪簭鍚庡厛瀵筍ipStack瑙g粦
logger.info("鎵ц杩滅▼鍚姩鏈钩鍙板懡浠�");
@@ -337,7 +337,7 @@
}
}
// 浜戝彴/鍓嶇鎺у埗鍛戒护
- if (!XmlUtil.isEmpty(XmlUtil.getText(rootElement,"PTZCmd")) && !deviceId.equals(targetGBId)) {
+ if (!StringUtils.isEmpty(XmlUtil.getText(rootElement,"PTZCmd")) && !deviceId.equals(targetGBId)) {
String cmdString = XmlUtil.getText(rootElement,"PTZCmd");
Device device = storager.queryVideoDeviceByPlatformIdAndChannelId(platformId, deviceId);
cmder.fronEndCmd(device, deviceId, cmdString);
@@ -421,7 +421,7 @@
String deviceId = XmlUtil.getText(rootElement, "DeviceID");
// 鍥炲200 OK
responseAck(evt);
- if (rootElement.getName().equals("Response")) {// !XmlUtil.isEmpty(result)) {
+ if (rootElement.getName().equals("Response")) {// !StringUtils.isEmpty(result)) {
// 姝ゅ鏄鏈钩鍙板彂鍑篋eviceControl鎸囦护鐨勫簲绛�
JSONObject json = new JSONObject();
XmlUtil.node2Json(rootElement, json);
@@ -718,7 +718,7 @@
deviceAlarm.setLatitude(0.00);
}
- if (!XmlUtil.isEmpty(deviceAlarm.getAlarmMethod())) {
+ if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) {
if ( deviceAlarm.getAlarmMethod().equals("4")) {
MobilePosition mobilePosition = new MobilePosition();
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
@@ -756,7 +756,6 @@
deferredResultHolder.invokeResult(msg);
}
} catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
- // } catch (DocumentException e) {
e.printStackTrace();
}
}
@@ -771,19 +770,31 @@
Element rootElement = getRootElement(evt);
String deviceId = XmlUtil.getText(rootElement, "DeviceID");
Device device = storager.queryVideoDevice(deviceId);
- // 妫�鏌ヨ澶囨槸鍚﹀瓨鍦ㄥ苟鍦ㄧ嚎锛� 涓嶅瓨鍦ㄥ垯涓嶅洖澶�
- if (device != null && device.getOnline() == 1) {
+
+ // 妫�鏌ヨ澶囨槸鍚﹀瓨鍦ㄥ苟鍦ㄧ嚎锛� 涓嶅湪绾垮垯璁剧疆涓哄湪绾�
+ if (device != null ) {
// 鍥炲200 OK
responseAck(evt);
- if (offLineDetector.isOnline(deviceId)) {
- publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE);
- } else {
- }
- }else {
- logger.warn("鏀跺埌[ "+deviceId+" ]蹇冭烦淇℃伅, 浣嗘槸璁惧" + (device == null? "涓嶅瓨鍦�":"绂荤嚎") + ", 鍥炲401");
- Response response = getMessageFactory().createResponse(Response.UNAUTHORIZED, evt.getRequest());
+ publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE);
+ }else{
+ logger.warn("鏀跺埌[ "+deviceId+" ]蹇冭烦淇℃伅, 浣嗘槸璁惧涓嶅瓨鍦�, 鍥炲404");
+ Response response = getMessageFactory().createResponse(Response.NOT_FOUND, evt.getRequest());
getServerTransaction(evt).sendResponse(response);
}
+
+// if (device != null && device.getOnline() == 1) {
+//
+// if (offLineDetector.isOnline(deviceId)) {
+// publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE);
+// } else {
+// }
+// }else {
+//// logger.warn("鏀跺埌[ "+deviceId+" ]蹇冭烦淇℃伅, 浣嗘槸璁惧" + (device == null? "涓嶅瓨鍦�":"绂荤嚎") + ", 鍥炲401");
+//// Response response = getMessageFactory().createResponse(Response.UNAUTHORIZED, evt.getRequest());
+//// getServerTransaction(evt).sendResponse(response);
+// publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE);
+//
+// }
} catch (ParseException | SipException | InvalidArgumentException | DocumentException e) {
e.printStackTrace();
}
--
Gitblit v1.8.0