From 221f99c764b51c3cd284c6e5a41492c26c5c7ffc Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 09 九月 2022 17:06:19 +0800
Subject: [PATCH] 优化sip消息

---
 src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 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 f719800..00e6783 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -23,6 +23,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.support.incrementer.AbstractIdentityColumnMaxValueIncrementer;
 import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
 
 import java.time.Instant;
@@ -105,6 +106,7 @@
                 redisCatchStorage.updateDevice(device);
                 commander.deviceInfoQuery(device);
                 sync(device);
+                // TODO 濡傛灉璁惧涓嬬殑閫氶亾绾ц仈鍒颁簡鍏朵粬骞冲彴锛岄偅涔堥渶瑕佸彂閫佷簨浠舵垨鑰卬otify缁欎笂绾у钩鍙�
             }else {
                 deviceMapper.update(device);
                 redisCatchStorage.updateDevice(device);
@@ -160,7 +162,7 @@
         logger.info("[娣诲姞鐩綍璁㈤槄] 璁惧{}", device.getDeviceId());
         // 娣诲姞鐩綍璁㈤槄
         CatalogSubscribeTask catalogSubscribeTask = new CatalogSubscribeTask(device, sipCommander, dynamicTask);
-        // 鎻愬墠寮�濮嬪埛鏂拌闃�
+        // 鍒锋柊璁㈤槄
         int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForCatalog(),30);
         // 璁剧疆鏈�灏忓�间负30
         dynamicTask.startCron(device.getDeviceId() + "catalog", catalogSubscribeTask, (subscribeCycleForCatalog -1) * 1000);
@@ -195,8 +197,8 @@
         MobilePositionSubscribeTask mobilePositionSubscribeTask = new MobilePositionSubscribeTask(device, sipCommander, dynamicTask);
         // 璁剧疆鏈�灏忓�间负30
         int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForMobilePosition(),30);
-        // 鎻愬墠寮�濮嬪埛鏂拌闃�
-        dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, (subscribeCycleForCatalog -1 ) * 1000);
+        // 鍒锋柊璁㈤槄
+        dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, (subscribeCycleForCatalog) * 1000);
         return true;
     }
 
@@ -281,13 +283,13 @@
             logger.warn("鏇存柊璁惧鏃舵湭鎵惧埌璁惧淇℃伅");
             return;
         }
-        if (!StringUtils.isEmpty(device.getName())) {
+        if (!ObjectUtils.isEmpty(device.getName())) {
             deviceInStore.setName(device.getName());
         }
-        if (!StringUtils.isEmpty(device.getCharset())) {
+        if (!ObjectUtils.isEmpty(device.getCharset())) {
             deviceInStore.setCharset(device.getCharset());
         }
-        if (!StringUtils.isEmpty(device.getMediaServerId())) {
+        if (!ObjectUtils.isEmpty(device.getMediaServerId())) {
             deviceInStore.setMediaServerId(device.getMediaServerId());
         }
 

--
Gitblit v1.8.0