From e6ee7fe7477b485676ce506b4e971c9a50dfa588 Mon Sep 17 00:00:00 2001
From: 648540858 <456panlinlin>
Date: 星期四, 14 四月 2022 16:52:48 +0800
Subject: [PATCH] 优化级联移动位置订阅位置更新

---
 src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java
index d3580d3..e454d49 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java
@@ -1,14 +1,13 @@
 package com.genersoft.iot.vmp.gb28181.event.online;
 
 import com.genersoft.iot.vmp.conf.SipConfig;
-import com.genersoft.iot.vmp.conf.UserSetup;
+import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.gb28181.bean.Device;
 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
 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.cmd.impl.SIPCommander;
 import com.genersoft.iot.vmp.service.IDeviceService;
-import com.genersoft.iot.vmp.storager.dao.dto.User;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,7 +15,7 @@
 import org.springframework.stereotype.Component;
 
 import com.genersoft.iot.vmp.common.VideoManagerConstants;
-import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
+import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.utils.redis.RedisUtil;
 
 import java.text.SimpleDateFormat;
@@ -35,7 +34,7 @@
 	private final static Logger logger = LoggerFactory.getLogger(OnlineEventListener.class);
 
 	@Autowired
-	private IVideoManagerStorager storager;
+	private IVideoManagerStorage storager;
 
 	@Autowired
 	private IDeviceService deviceService;
@@ -47,7 +46,7 @@
     private SipConfig sipConfig;
 
 	@Autowired
-    private UserSetup userSetup;
+    private UserSetting userSetting;
 
 	@Autowired
     private EventPublisher eventPublisher;
@@ -65,7 +64,7 @@
 		}
 		Device device = event.getDevice();
 		if (device == null) return;
-		String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + event.getDevice().getDeviceId();
+		String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + event.getDevice().getDeviceId();
 		Device deviceInStore = storager.queryVideoDevice(device.getDeviceId());
 		device.setOnline(1);
 		switch (event.getFrom()) {
@@ -98,11 +97,13 @@
 		}
 		// 澶勭悊涓婄嚎鐩戝惉
 		storager.updateDevice(device);
-		List<DeviceChannel> deviceChannelList = storager.queryOnlineChannelsByDeviceId(device.getDeviceId());
-		eventPublisher.catalogEventPublish(null, deviceChannelList, CatalogEvent.ON);
 		// 涓婄嚎娣诲姞璁㈤槄
 		if (device.getSubscribeCycleForCatalog() > 0) {
+			// 鏌ヨ鍦ㄧ嚎璁惧閭d簺寮�鍚簡璁㈤槄锛屼负璁惧寮�鍚畾鏃剁殑鐩綍璁㈤槄
 			deviceService.addCatalogSubscribe(device);
 		}
+		if (device.getSubscribeCycleForMobilePosition() > 0) {
+			deviceService.addMobilePositionSubscribe(device);
+		}
 	}
 }

--
Gitblit v1.8.0