From 9775ffc356e1ed822f7367619ce7a9907cb49bc0 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期六, 13 一月 2024 14:08:12 +0800
Subject: [PATCH] 融云token获取改为异步 setptz改为大光电用高精度setptz其他用普通setptz
---
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java | 10 +++++++++-
ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java | 6 ++++--
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java | 2 ++
ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java | 2 +-
ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDK.java | 5 ++++-
ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java | 7 ++++++-
6 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDK.java b/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDK.java
index 9bbcc39..6def333 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDK.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/factory/CameraSDK.java
@@ -76,7 +76,10 @@
//鑾峰彇ptz鑼冨洿
Map<String, Object> getPtzScope(CameraCmd cmd);
- //璁剧疆ptz
+ //璁剧疆ptz1(涓嶆敮鎸�2閫氶亾鐨刏鍊艰缃拰鑾峰彇)
+ boolean setPtz1(CameraCmd cmd);
+
+ //璁剧疆ptz(楂樼簿搴tz璁剧疆)
boolean setPtz(CameraCmd cmd);
//璁剧疆闆舵柟浣嶈
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java
index ef9e57d..55f8e45 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/CameraSdkServiceImpl.java
@@ -426,7 +426,15 @@
if (ardCamera != null) {
String factory = ardCamera.getFactory();
CameraSDK cameraSDK = cameraSDKFactory.createCameraSDK(factory);
- result = cameraSDK.setPtz(cmd);
+ String gdtype = ardCamera.getGdtype();
+ if(gdtype.equals("1")) {
+ //澶у厜鐢典娇鐢ㄩ珮绮惧害ptz璁剧疆
+ result = cameraSDK.setPtz(cmd);
+ }else
+ {
+ result = cameraSDK.setPtz1(cmd);
+ }
+
}
} catch (Exception ex) {
log.error("璁剧疆ptz寮傚父锛�" + ex.getMessage());
diff --git a/ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java b/ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java
index b28a33b..fe2595e 100644
--- a/ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/rongcloud/service/Impl/RongCloudServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.rongcloud.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.dtflys.forest.exceptions.ForestRuntimeException;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache;
@@ -61,8 +62,9 @@
Map<String, Object> map = rongCloudClient.getToken(getRongCloudHead(), param);
token = (String) map.get("token");
log.debug("鐢ㄦ埛" + userId + "鑾峰彇鍒拌瀺浜憈oken:" + token);
- } catch (Exception ex) {
- log.error("鑾峰彇token寮傚父:" + ex.getMessage());
+ }catch(ForestRuntimeException ex)
+ {
+ log.error("鑾峰彇铻嶄簯token寮傚父:" + ex.getMessage());
}
return token;
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java b/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java
index 2eb90d2..de60871 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java
@@ -426,6 +426,11 @@
return null;
}
+ @Override
+ public boolean setPtz1(CameraCmd cmd) {
+ return false;
+ }
+
/**
* @鎻忚堪 璁剧疆ptz淇℃伅
* @鍙傛暟 [userId, channelNum]
@@ -1083,4 +1088,4 @@
}
}
-}
\ No newline at end of file
+}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java b/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java
index 55f7de1..ff42951 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java
@@ -988,7 +988,7 @@
* @鍒涘缓鏃堕棿 2023/1/17 16:36
* @淇敼浜哄拰鍏跺畠淇℃伅 娉ㄦ剰淇话瑙掑害璐熷�奸渶瑕佸姞涓�360寰楀埌鐨勬鍊艰繘琛岃缃�
*/
-
+ @Override
public boolean setPtz1(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
Integer channelNum = cmd.getChanNo();
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
index 7e23657..aa97e37 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
@@ -4,6 +4,7 @@
import com.ruoyi.rongcloud.service.RongCloudService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -151,6 +152,7 @@
*
* @param loginUser 鐧诲綍鐢ㄦ埛
*/
+ @Async
public String getRongCloudToken(LoginUser loginUser) {
try {
String userId = loginUser.getUserId();
--
Gitblit v1.9.3