From 41fdb9d13f4cc8babe42be0ab79b5ffd5f5088d1 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期一, 18 十二月 2023 15:41:39 +0800 Subject: [PATCH] Merge branch 'wvp-28181-record' into feature/record --- src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java | 37 ++++++++++++++++++++----------------- 1 files changed, 20 insertions(+), 17 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 f53af02..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); @@ -223,11 +231,6 @@ // 绉婚櫎璁㈤槄 removeCatalogSubscribe(device); removeMobilePositionSubscribe(device); - if (userSetting.getDeviceStatusNotify()) { - // 鍙戦�乺edis娑堟伅 - redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), null, false); - } - } @Override -- Gitblit v1.8.0