From 038d360dd4f2dd3c06f5d97dc66ed13fd78de212 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 27 六月 2022 09:38:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/rtc' into commercial
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java | 45 ++++++++++++++++++---------------------------
1 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
index 420f899..e923a54 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
@@ -5,7 +5,6 @@
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.*;
-import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
@@ -19,7 +18,6 @@
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
-import com.genersoft.iot.vmp.utils.GpsUtil;
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
import org.dom4j.DocumentException;
import org.dom4j.Element;
@@ -64,10 +62,6 @@
@Autowired
private EventPublisher publisher;
-
- @Autowired
- private DeviceOffLineDetector offLineDetector;
-
private String method = "NOTIFY";
@@ -240,7 +234,7 @@
// 鍥炲200 OK
responseAck(evt, Response.OK);
- if (offLineDetector.isOnline(deviceId)) {
+ if (redisCatchStorage.deviceIsOnline(deviceId)) {
publisher.deviceAlarmEventPublish(deviceAlarm);
}
} catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
@@ -258,14 +252,12 @@
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
- Element rootElement = getRootElement(evt);
Device device = redisCatchStorage.getDevice(deviceId);
- if (device == null) {
+ if (device == null || device.getOnline() == 0) {
+ logger.warn("[鏀跺埌 鐩綍璁㈤槄]锛歿}, 浣嗘槸璁惧宸茬粡绂荤嚎", (device != null ? device.getDeviceId():"" ));
return;
}
- if (device != null ) {
- rootElement = getRootElement(evt, device.getCharset());
- }
+ Element rootElement = getRootElement(evt, device.getCharset());
Element deviceListElement = rootElement.element("DeviceList");
if (deviceListElement == null) {
return;
@@ -285,39 +277,46 @@
channel.setDeviceId(device.getDeviceId());
logger.info("[鏀跺埌 鐩綍璁㈤槄]锛歿}/{}", device.getDeviceId(), channel.getChannelId());
switch (eventElement.getText().toUpperCase()) {
- case CatalogEvent.ON: // 涓婄嚎
+ case CatalogEvent.ON:
+ // 涓婄嚎
logger.info("鏀跺埌鏉ヨ嚜璁惧銆恵}銆戠殑閫氶亾銆恵}銆戜笂绾块�氱煡", device.getDeviceId(), channel.getChannelId());
storager.deviceChannelOnline(deviceId, channel.getChannelId());
// 鍥炲200 OK
responseAck(evt, Response.OK);
break;
- case CatalogEvent.OFF : // 绂荤嚎
+ case CatalogEvent.OFF :
+ // 绂荤嚎
logger.info("鏀跺埌鏉ヨ嚜璁惧銆恵}銆戠殑閫氶亾銆恵}銆戠绾块�氱煡", device.getDeviceId(), channel.getChannelId());
storager.deviceChannelOffline(deviceId, channel.getChannelId());
// 鍥炲200 OK
responseAck(evt, Response.OK);
break;
- case CatalogEvent.VLOST: // 瑙嗛涓㈠け
+ case CatalogEvent.VLOST:
+ // 瑙嗛涓㈠け
logger.info("鏀跺埌鏉ヨ嚜璁惧銆恵}銆戠殑閫氶亾銆恵}銆戣棰戜涪澶遍�氱煡", device.getDeviceId(), channel.getChannelId());
storager.deviceChannelOffline(deviceId, channel.getChannelId());
// 鍥炲200 OK
responseAck(evt, Response.OK);
break;
- case CatalogEvent.DEFECT: // 鏁呴殰
+ case CatalogEvent.DEFECT:
+ // 鏁呴殰
// 鍥炲200 OK
responseAck(evt, Response.OK);
break;
- case CatalogEvent.ADD: // 澧炲姞
+ case CatalogEvent.ADD:
+ // 澧炲姞
logger.info("鏀跺埌鏉ヨ嚜璁惧銆恵}銆戠殑澧炲姞閫氶亾銆恵}銆戦�氱煡", device.getDeviceId(), channel.getChannelId());
storager.updateChannel(deviceId, channel);
responseAck(evt, Response.OK);
break;
- case CatalogEvent.DEL: // 鍒犻櫎
+ case CatalogEvent.DEL:
+ // 鍒犻櫎
logger.info("鏀跺埌鏉ヨ嚜璁惧銆恵}銆戠殑鍒犻櫎閫氶亾銆恵}銆戦�氱煡", device.getDeviceId(), channel.getChannelId());
storager.delChannel(deviceId, channel.getChannelId());
responseAck(evt, Response.OK);
break;
- case CatalogEvent.UPDATE: // 鏇存柊
+ case CatalogEvent.UPDATE:
+ // 鏇存柊
logger.info("鏀跺埌鏉ヨ嚜璁惧銆恵}銆戠殑鏇存柊閫氶亾銆恵}銆戦�氱煡", device.getDeviceId(), channel.getChannelId());
storager.updateChannel(deviceId, channel);
responseAck(evt, Response.OK);
@@ -329,10 +328,6 @@
// 杞彂鍙樺寲淇℃伅
eventPublisher.catalogEventPublish(null, channel, eventElement.getText().toUpperCase());
- }
-
- if (!offLineDetector.isOnline(deviceId)) {
- publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_MESSAGE);
}
}
} catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
@@ -355,10 +350,6 @@
}
public void setDeferredResultHolder(DeferredResultHolder deferredResultHolder) {
- }
-
- public void setOffLineDetector(DeviceOffLineDetector offLineDetector) {
- this.offLineDetector = offLineDetector;
}
public IRedisCatchStorage getRedisCatchStorage() {
--
Gitblit v1.8.0