From e86396c095d9600bfdc20837f2276eac8fad0f7f Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 31 五月 2023 11:08:16 +0800
Subject: [PATCH] 提交
---
ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java | 33 +++++++++++++++------------------
1 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java
index c2faf7b..29bca25 100644
--- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java
@@ -14,7 +14,7 @@
import com.ruoyi.device.hiksdk.util.hikSdkUtil.GisUtil;
import com.ruoyi.device.hiksdk.util.hikSdkUtil.HCNetSDK;
import com.ruoyi.device.hiksdk.service.IHikClientService;
-import com.ruoyi.device.hiksdk.util.minioUtil.MinioUtil;
+import com.ruoyi.device.hiksdk.util.minio.MinioUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import com.sun.jna.Native;
import com.sun.jna.Platform;
@@ -47,9 +47,6 @@
public class HikClientServiceImpl implements IHikClientService {
@Resource
- private MinioUtil minioUtil;
-
- @Resource
ArdCamerasMapper ardCamerasMapper;
@Resource
@@ -75,20 +72,20 @@
//璁剧疆HCNetSDKCom缁勪欢搴撴墍鍦ㄨ矾寰�
//libhcnetsdk.so
String strPathCom = "/home/hiklib";
- HCNetSDK.NET_DVR_LOCAL_SDK_PATH struComPath = new HCNetSDK.NET_DVR_LOCAL_SDK_PATH();
+ NET_DVR_LOCAL_SDK_PATH struComPath = new NET_DVR_LOCAL_SDK_PATH();
System.arraycopy(strPathCom.getBytes(), 0, struComPath.sPath, 0, strPathCom.length());
struComPath.write();
hCNetSDK.NET_DVR_SetSDKInitCfg(2, struComPath.getPointer());
//璁剧疆libcrypto.so鎵�鍦ㄨ矾寰�
- HCNetSDK.BYTE_ARRAY ptrByteArrayCrypto = new HCNetSDK.BYTE_ARRAY(256);
+ BYTE_ARRAY ptrByteArrayCrypto = new BYTE_ARRAY(256);
String strPathCrypto = "/home/hiklib/libcrypto.so.1.1";
System.arraycopy(strPathCrypto.getBytes(), 0, ptrByteArrayCrypto.byValue, 0, strPathCrypto.length());
ptrByteArrayCrypto.write();
hCNetSDK.NET_DVR_SetSDKInitCfg(3, ptrByteArrayCrypto.getPointer());
//璁剧疆libssl.so鎵�鍦ㄨ矾寰�
- HCNetSDK.BYTE_ARRAY ptrByteArraySsl = new HCNetSDK.BYTE_ARRAY(256);
+ BYTE_ARRAY ptrByteArraySsl = new BYTE_ARRAY(256);
String strPathSsl = "/home/hiklib/libssl.so.1.1";
System.arraycopy(strPathSsl.getBytes(), 0, ptrByteArraySsl.byValue, 0, strPathSsl.length());
ptrByteArraySsl.write();
@@ -128,7 +125,7 @@
hCNetSDK.NET_DVR_SetConnectTime(2000, 1);
hCNetSDK.NET_DVR_SetReconnect(100000, true);
//璁惧淇℃伅, 杈撳嚭鍙傛暟
- HCNetSDK.NET_DVR_DEVICEINFO_V30 m_strDeviceInfo = new HCNetSDK.NET_DVR_DEVICEINFO_V30();
+ NET_DVR_DEVICEINFO_V30 m_strDeviceInfo = new NET_DVR_DEVICEINFO_V30();
int lUserID = hCNetSDK.NET_DVR_Login_V30(m_sDeviceIP, m_sPort, m_sUsername, m_sPassword, m_strDeviceInfo);
if (lUserID < 0) {
//閲婃斁SDK璧勬簮
@@ -440,7 +437,7 @@
Integer userId = globalVariable.loginMap.get(cameraId);
String ResResolution = "";
- HCNetSDK.NET_DVR_COMPRESSIONCFG_V30 resolution = new HCNetSDK.NET_DVR_COMPRESSIONCFG_V30();
+ NET_DVR_COMPRESSIONCFG_V30 resolution = new NET_DVR_COMPRESSIONCFG_V30();
resolution.write();
Pointer pioint = resolution.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
@@ -545,7 +542,7 @@
}
Integer userId = globalVariable.loginMap.get(cameraId);
- HCNetSDK.NET_DVR_PTZPOS m_ptzPosCurrent = new HCNetSDK.NET_DVR_PTZPOS();
+ NET_DVR_PTZPOS m_ptzPosCurrent = new NET_DVR_PTZPOS();
Pointer pioint = m_ptzPosCurrent.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
m_ptzPosCurrent.write();
@@ -596,7 +593,7 @@
return false;
}
Integer userId = globalVariable.loginMap.get(cameraId);
- HCNetSDK.NET_DVR_PTZPOS m_ptzPosCurrent = new HCNetSDK.NET_DVR_PTZPOS();
+ NET_DVR_PTZPOS m_ptzPosCurrent = new NET_DVR_PTZPOS();
m_ptzPosCurrent.wAction = 1;
try {
String p = String.valueOf((int) ((double) ptz.get("p") * 10));
@@ -628,7 +625,7 @@
return false;
}
Integer userId = globalVariable.loginMap.get(cameraId);
- HCNetSDK.NET_DVR_PTZPOS m_ptzPosCurrent = new HCNetSDK.NET_DVR_PTZPOS();
+ NET_DVR_PTZPOS m_ptzPosCurrent = new NET_DVR_PTZPOS();
m_ptzPosCurrent.wAction = 1;
try {
double[] cameraPositon = cmd.getCamPosition();
@@ -775,7 +772,7 @@
return false;
}
Integer userId = globalVariable.loginMap.get(cameraId);
- HCNetSDK.NET_DVR_INITIALPOSITIONCTRL initialpositionctrl = new HCNetSDK.NET_DVR_INITIALPOSITIONCTRL();
+ NET_DVR_INITIALPOSITIONCTRL initialpositionctrl = new NET_DVR_INITIALPOSITIONCTRL();
initialpositionctrl.dwSize = initialpositionctrl.size();
initialpositionctrl.byWorkMode = 0;
@@ -1175,9 +1172,9 @@
InputStream input = new ByteArrayInputStream(array);
String url = "";
try {
- boolean b = minioUtil.putObject(BucketName, ObjectName, input, input.available(), ContentType);
+ boolean b = MinioUtils.uploadObject(BucketName, ObjectName, input, input.available(), ContentType);
if (b) {
- url = minioUtil.presignedGetObject(BucketName, ObjectName, 5);
+ url = MinioUtils.getBucketObjectUrl(BucketName, ObjectName);
log.info("涓婁紶鏂囦欢鎴愬姛!" + url);
}
} catch (IOException ex) {
@@ -1272,7 +1269,7 @@
String BucketName = "record";
String uuid = UUID.randomUUID().toString().replace("-", "");
String time = new SimpleDateFormat("yyyyMMdd").format(new Date());
- String ObjectName = time + "/" + uuid + ".mp4";
+ String ObjectName = cameraId + "/" + time + "/" + uuid + ".mp4";
String ContentType = "video/MP4";
FileInputStream stream = null;
try {
@@ -1282,9 +1279,9 @@
}
String url = "";
try {
- boolean b = minioUtil.putObject(BucketName, ObjectName, stream, stream.available(), ContentType);
+ boolean b = MinioUtils.uploadObject(BucketName, ObjectName, stream, stream.available(), ContentType);
if (b) {
- url = minioUtil.presignedGetObject(BucketName, ObjectName, 5);
+ url = MinioUtils.getBucketObjectUrl(BucketName, ObjectName);
log.info("涓婁紶鏂囦欢鎴愬姛!" + url);
}
} catch (IOException ex) {
--
Gitblit v1.9.3