From 9d61a93077d22dec47760c294a8658f5a5223b67 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 03 一月 2024 15:50:47 +0800
Subject: [PATCH] 优化数据库sql文件组织方式
---
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java | 39 +++++++++++++++++++++------------------
1 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
index 79f2039..8d07aca 100755
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -155,6 +155,19 @@
sync(device);
// TODO 濡傛灉璁惧涓嬬殑閫氶亾绾ц仈鍒颁簡鍏朵粬骞冲彴锛岄偅涔堥渶瑕佸彂閫佷簨浠舵垨鑰卬otify缁欎笂绾у钩鍙�
}
+ // 涓婄嚎娣诲姞璁㈤槄
+ if (device.getSubscribeCycleForCatalog() > 0) {
+ // 鏌ヨ鍦ㄧ嚎璁惧閭d簺寮�鍚簡璁㈤槄锛屼负璁惧寮�鍚畾鏃剁殑鐩綍璁㈤槄
+ addCatalogSubscribe(device);
+ }
+ if (device.getSubscribeCycleForMobilePosition() > 0) {
+ addMobilePositionSubscribe(device);
+ }
+ if (userSetting.getDeviceStatusNotify()) {
+ // 鍙戦�乺edis娑堟伅
+ redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), null, true);
+ }
+
}else {
if (deviceChannelMapper.queryAllChannels(device.getDeviceId()).size() == 0) {
logger.info("[璁惧涓婄嚎]: {}锛岄�氶亾鏁颁负0,鏌ヨ閫氶亾淇℃伅", device.getDeviceId());
@@ -167,22 +180,10 @@
}
- // 涓婄嚎娣诲姞璁㈤槄
- if (device.getSubscribeCycleForCatalog() > 0) {
- // 鏌ヨ鍦ㄧ嚎璁惧閭d簺寮�鍚簡璁㈤槄锛屼负璁惧寮�鍚畾鏃剁殑鐩綍璁㈤槄
- addCatalogSubscribe(device);
- }
- if (device.getSubscribeCycleForMobilePosition() > 0) {
- addMobilePositionSubscribe(device);
- }
// 鍒锋柊杩囨湡浠诲姟
String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + device.getDeviceId();
// 濡傛灉绗竴娆℃敞鍐岄偅涔堝繀椤诲湪60 * 3鏃堕棿鍐呮敹鍒颁竴涓績璺筹紝鍚﹀垯璁惧绂荤嚎
dynamicTask.startDelay(registerExpireTaskKey, ()-> offline(device.getDeviceId(), "棣栨娉ㄥ唽鍚庢湭鑳芥敹鍒板績璺�"), device.getKeepaliveIntervalTime() * 1000 * 3);
- if (userSetting.getDeviceStatusNotify()) {
- // 鍙戦�乺edis娑堟伅
- redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), null, true);
- }
//
// try {
@@ -206,6 +207,13 @@
}
String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + deviceId;
dynamicTask.stop(registerExpireTaskKey);
+ if (device.isOnLine()) {
+ if (userSetting.getDeviceStatusNotify()) {
+ // 鍙戦�乺edis娑堟伅
+ redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), null, false);
+ }
+ }
+
device.setOnLine(false);
redisCatchStorage.updateDevice(device);
deviceMapper.update(device);
@@ -217,17 +225,12 @@
for (SsrcTransaction ssrcTransaction : ssrcTransactions) {
mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc());
mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());
- streamSession.remove(deviceId, ssrcTransaction.getChannelId(), ssrcTransaction.getStream());
+ streamSession.removeByCallId(deviceId, ssrcTransaction.getChannelId(), ssrcTransaction.getCallId());
}
}
// 绉婚櫎璁㈤槄
removeCatalogSubscribe(device);
removeMobilePositionSubscribe(device);
- if (userSetting.getDeviceStatusNotify()) {
- // 鍙戦�乺edis娑堟伅
- redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), null, false);
- }
-
}
@Override
--
Gitblit v1.8.0