From 408df377b760766a2b140f5c70f2f44f854b39af Mon Sep 17 00:00:00 2001
From: 64850858 <648540858@qq.com>
Date: 星期一, 26 七月 2021 17:51:02 +0800
Subject: [PATCH] 添加user-agent,修复deviceINfo查询设备名称

---
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 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 70e64a5..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
@@ -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