From 2dc82639ec241aa69f75f7fa6dce5df4942a5665 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 15 十二月 2023 13:34:12 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java | 64 +++++++++-
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java | 259 ++++++++++++++++++++++++------------------
2 files changed, 203 insertions(+), 120 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
index db7b2d9..a17c4b9 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
@@ -1059,8 +1059,6 @@
break;
case "radar":
//region 澶勭悊闆疯揪鎶ヨ
- String mergeTime = ConfigUtils.getConfigValue("radarMergeTime");
- Integer radarMergeTime = mergeTime == null || "".equals(mergeTime) ? 10 : Integer.valueOf(mergeTime);
RadarAlarmData radarAlarmData = JSONObject.parseObject(message, RadarAlarmData.class);
List<ArdAlarmRadar> ardAlarmRadars = radarAlarmData.getArdAlarmRadars();
for (ArdAlarmRadar ardAlarmRadar : ardAlarmRadars) {
@@ -1096,47 +1094,8 @@
ardAlarmRadarMove.setUpdateTime(radarAlarmData.getAlarmTime());
ardAlarmRadarMove.setRadarId(radarId);
ardAlarmRadarMove.setGuidePTZ(guidePTZ);
- Date alarmTime = ardAlarmRadarMove.getAlarmTime();
- //鑾峰彇褰撳墠鍏磋叮鐐瑰綋鍓嶉浄杈剧殑涓婁竴鏉℃暟鎹�
- ArdAlarmRadarMove lastMoveData = ardAlarmRadarMoveMapper.selectArdAlarmRadarLastData(ardAlarmRadarMove.getName());
- if (lastMoveData == null) {
- //鍏ュ簱
- ardAlarmRadarMove.setGuideTime(alarmTime);
- ardAlarmRadarMoveMapper.insertArdAlarmRadarMove(ardAlarmRadarMove);
- radarMoveGuide(ardAlarmRadarMove);//寮曞
- } else {
- //鍚﹀垯姣斿鏇存柊鏃堕棿
- Date lastUpdateTime = lastMoveData.getUpdateTime();
- Date lastGuideTime = lastMoveData.getGuideTime();
- long secDatePoor = DateUtils.getSecDatePoor(alarmTime, lastUpdateTime);
- if (secDatePoor <= radarMergeTime) {
- //灏忎簬10绉掔殑鏂版暟鎹紝鏇存柊涓婁竴鏉�
- ArdAlarmRadarMove updateData = new ArdAlarmRadarMove();
- updateData.setId(lastMoveData.getId());
- updateData.setUpdateTime(alarmTime);
-
- //鍒ゆ柇寮曞鏃堕棿瓒呰繃5鍒嗛挓鍐嶆寮曞
- long secDatePoorGuide = DateUtils.getSecDatePoor(alarmTime, lastGuideTime);
- if (secDatePoorGuide >= 300) {
- updateData.setGuideTime(alarmTime);
- radarMoveGuide(ardAlarmRadarMove);//寮曞
- }
- ardAlarmRadarMoveMapper.updateArdAlarmRadarMove(updateData);
- } else {
- //瓒呰繃10绉掔殑鏁版嵁,鍏ュ簱
- ardAlarmRadarMove.setGuideTime(alarmTime);
- ardAlarmRadarMoveMapper.insertArdAlarmRadarMove(ardAlarmRadarMove);
- radarMoveGuide(ardAlarmRadarMove);//寮曞
- }
- }
- //鍏ョ紦瀛�
- //String key = "radar_alarm:" + DateUtils.getDate();
- //if (redisCache.hasKey(key)) {
- // redisCache.setCacheList(key, ardAlarmRadarMove, -1, TimeUnit.HOURS);
- //} else {
- // Integer expiryTimeInSeconds = DateUtils.getDayRemainingTime(ardAlarmRadarMove.getCreateTime());
- // redisCache.setCacheList(key, ardAlarmRadarMove, expiryTimeInSeconds, TimeUnit.SECONDS);
- //}
+ //
+ ardAlarmRadarMoveHandler(ardAlarmRadarMove);
break;
case "鐑簮妫�娴�":
ArdAlarmRadarFire ardAlarmRadarFire = new ArdAlarmRadarFire();
@@ -1152,38 +1111,7 @@
ardAlarmRadarFire.setRadarId(radarId);
ardAlarmRadarFire.setUpdateTime(radarAlarmData.getAlarmTime());
//
- ArdAlarmRadarFire lastFireData = ardAlarmRadarFireMapper.selectArdAlarmRadarLastData(ardAlarmRadarFire.getName());
- alarmTime = ardAlarmRadarFire.getAlarmTime();
- if (lastFireData == null) {
- //鍏ュ簱
- ardAlarmRadarFire.setGuideTime(alarmTime);
- ardAlarmRadarFireMapper.insertArdAlarmRadarFire(ardAlarmRadarFire);
- radarFireGuide(ardAlarmRadarFire);//寮曞
- } else {
- //鍚﹀垯姣斿鏇存柊鏃堕棿
- Date lastUpdateTime = lastFireData.getUpdateTime();
- Date lastGuideTime = lastFireData.getGuideTime();
- long secDatePoor = DateUtils.getSecDatePoor(alarmTime, lastUpdateTime);
- if (secDatePoor <= radarMergeTime) {
- //灏忎簬10绉掔殑鏂版暟鎹紝鏇存柊涓婁竴鏉�
- ArdAlarmRadarFire updateData = new ArdAlarmRadarFire();
- updateData.setId(lastFireData.getId());
- updateData.setUpdateTime(alarmTime);
-
- //鍒ゆ柇寮曞鏃堕棿瓒呰繃5鍒嗛挓鍐嶆寮曞
- long secDatePoorGuide = DateUtils.getSecDatePoor(alarmTime, lastGuideTime);
- if (secDatePoorGuide >= 300) {
- updateData.setGuideTime(alarmTime);
- radarFireGuide(ardAlarmRadarFire);//寮曞
- }
- ardAlarmRadarFireMapper.updateArdAlarmRadarFire(updateData);
- } else {
- //瓒呰繃10绉掔殑鏁版嵁,鍏ュ簱
- ardAlarmRadarFire.setGuideTime(alarmTime);
- ardAlarmRadarFireMapper.insertArdAlarmRadarFire(ardAlarmRadarFire);
- radarFireGuide(ardAlarmRadarFire);//寮曞
- }
- }
+ ardAlarmRadarFireHandler(ardAlarmRadarFire);
break;
case "闆疯揪鎶芥补鏈哄仠鏈�":
ArdAlarmRadarPump ardAlarmRadarPump = new ArdAlarmRadarPump();
@@ -1195,41 +1123,11 @@
ardAlarmRadarPump.setName(ardAlarmRadar.getName() + "(" + radarAlarmData.getRadarName() + ")");
ardAlarmRadarPump.setAlarmType("闆疯揪鎶芥补鏈哄仠鏈�");
ardAlarmRadarPump.setUpdateTime(radarAlarmData.getAlarmTime());
- alarmTime = ardAlarmRadarPump.getAlarmTime();
ardAlarmRadarPump.setLongitude(well.getLongitude());
ardAlarmRadarPump.setLatitude(well.getLatitude());
ardAlarmRadarPump.setGuidePTZ(guidePTZ);
//
- ArdAlarmRadarPump lastPumpData = ardAlarmRadarPumpMapper.selectArdAlarmRadarLastData(ardAlarmRadarPump.getName());
- if (lastPumpData == null) {
- //鍏ュ簱
- ardAlarmRadarPump.setGuideTime(alarmTime);
- ardAlarmRadarPumpMapper.insertArdAlarmRadarPump(ardAlarmRadarPump);
- radarPumpGuide(ardAlarmRadarPump);//寮曞
- } else {
- //鍚﹀垯姣斿鏇存柊鏃堕棿
- Date lastUpdateTime = lastPumpData.getUpdateTime();
- Date lastGuideTime = lastPumpData.getGuideTime();
- long secDatePoor = DateUtils.getSecDatePoor(alarmTime, lastUpdateTime);
- if (secDatePoor <= radarMergeTime) {
- //灏忎簬10绉掔殑鏂版暟鎹紝鏇存柊涓婁竴鏉�
- ArdAlarmRadarPump updateData = new ArdAlarmRadarPump();
- updateData.setId(lastPumpData.getId());
- updateData.setUpdateTime(alarmTime);
- //鍒ゆ柇寮曞鏃堕棿瓒呰繃5鍒嗛挓鍐嶆寮曞
- long secDatePoorGuide = DateUtils.getSecDatePoor(alarmTime, lastGuideTime);
- if (secDatePoorGuide >= 300) {
- radarPumpGuide(ardAlarmRadarPump);//寮曞
- updateData.setGuideTime(alarmTime);
- }
- ardAlarmRadarPumpMapper.updateArdAlarmRadarPump(updateData);
- } else {
- //瓒呰繃10绉掔殑鏁版嵁,鍏ュ簱
- ardAlarmRadarPump.setGuideTime(alarmTime);
- ardAlarmRadarPumpMapper.insertArdAlarmRadarPump(ardAlarmRadarPump);
- radarPumpGuide(ardAlarmRadarPump);//寮曞
- }
- }
+ ardAlarmRadarPumpHandler(ardAlarmRadarPump);
break;
}
}
@@ -1392,7 +1290,7 @@
Integer chanNo = ArdTool.getChannelBydayNightTime(redisCache.getCacheObject("sys_config:dayNightTime"));
guideTask.setChanNo(chanNo);//閫氶亾(閫氳繃鏃ュ鏃堕棿鐮斿垽)
guideTask.setAlarmId(guideDataDto.getAlarmId()); //鎶ヨID
- guideTask.setReceiveTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS_MS,guideDataDto.getReceiveTime()));//鎺ユ敹鏃堕棿
+ guideTask.setReceiveTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS_MS, guideDataDto.getReceiveTime()));//鎺ユ敹鏃堕棿
//鎶ヨ浼樺厛绾�(閫氳繃浼樺厛绾у瓧鍏�)
String priority = DictUtils.getDictValue("cameras_priority", alarmType);
if (StringUtils.isEmpty(priority)) {
@@ -1485,7 +1383,11 @@
}
}
- //闆疯揪绉诲姩寮曞
+ /**
+ * 闆疯揪绉诲姩寮曞
+ * 鍒樿嫃涔�
+ * 2023/12/14 15:04:24
+ */
private void radarMoveGuide(ArdAlarmRadarMove ardAlarmRadarMove) {
log.debug("闆疯揪绉诲姩寮�濮嬪紩瀵�");
if (StringUtils.isNull(ardAlarmRadarMove.getLongitude()) || StringUtils.isNull(ardAlarmRadarMove.getLatitude())) {
@@ -1495,7 +1397,7 @@
double[] coordinate = new double[]{ardAlarmRadarMove.getLongitude(), ardAlarmRadarMove.getLatitude()};//鎶ヨ鍧愭爣
//寮曞鍏ラ槦
GuideDataDto guideDataDto = new GuideDataDto()
- .setRadarId( ardAlarmRadarMove.getRadarId())
+ .setRadarId(ardAlarmRadarMove.getRadarId())
.setName(ardAlarmRadarMove.getName())
.setAlarmId(ardAlarmRadarMove.getId())
.setAlarmType(ardAlarmRadarMove.getAlarmType())
@@ -1505,7 +1407,11 @@
getCameraGuideToQueue(guideDataDto);//鑾峰彇鐩告満鍏ラ槦
}
- //闆疯揪闃茬伀寮曞
+ /**
+ * 闆疯揪闃茬伀寮曞
+ * 鍒樿嫃涔�
+ * 2023/12/14 15:04:32
+ */
private void radarFireGuide(ArdAlarmRadarFire ardAlarmRadarFire) {
log.debug("闆疯揪闃茬伀寮�濮嬪紩瀵�");
if (StringUtils.isNull(ardAlarmRadarFire.getLongitude()) || StringUtils.isNull(ardAlarmRadarFire.getLatitude())) {
@@ -1515,7 +1421,7 @@
double[] coordinate = new double[]{ardAlarmRadarFire.getLongitude(), ardAlarmRadarFire.getLatitude()};//鎶ヨ鍧愭爣
//寮曞鍏ラ槦
GuideDataDto guideDataDto = new GuideDataDto()
- .setRadarId( ardAlarmRadarFire.getRadarId())
+ .setRadarId(ardAlarmRadarFire.getRadarId())
.setName(ardAlarmRadarFire.getName())
.setAlarmId(ardAlarmRadarFire.getId())
.setAlarmType(ardAlarmRadarFire.getAlarmType())
@@ -1525,7 +1431,11 @@
getCameraGuideToQueue(guideDataDto);//鑾峰彇鐩告満鍏ラ槦
}
- //闆疯揪鎶芥补鏈哄仠鏈哄紩瀵�
+ /**
+ * 闆疯揪鎶芥补鏈哄仠鏈哄紩瀵�
+ * 鍒樿嫃涔�
+ * 2023/12/14 15:04:40
+ */
private void radarPumpGuide(ArdAlarmRadarPump ardAlarmRadarPump) {
log.debug("闆疯揪鎶芥补鏈哄仠鏈哄紑濮嬪紩瀵�");
if (StringUtils.isNull(ardAlarmRadarPump.getLongitude()) || StringUtils.isNull(ardAlarmRadarPump.getLatitude())) {
@@ -1536,7 +1446,7 @@
double[] coordinate = new double[]{ardAlarmRadarPump.getLongitude(), ardAlarmRadarPump.getLatitude()};//鎶ヨ鍧愭爣
//寮曞鍏ラ槦
GuideDataDto guideDataDto = new GuideDataDto()
- .setRadarId( ardAlarmRadarPump.getRadarId())
+ .setRadarId(ardAlarmRadarPump.getRadarId())
.setName(ardAlarmRadarPump.getName())
.setAlarmId(ardAlarmRadarPump.getId())
.setAlarmType(ardAlarmRadarPump.getAlarmType())
@@ -1545,4 +1455,127 @@
.setGuidePTZ(ardAlarmRadarPump.getGuidePTZ());
getCameraGuideToQueue(guideDataDto);//鑾峰彇鐩告満鍏ラ槦
}
+
+
+ /**
+ * 闆疯揪鐩爣绉诲姩鎶ヨ澶勭悊
+ * 鍒樿嫃涔�
+ * 2023/12/14 15:03:32
+ */
+ private void ardAlarmRadarMoveHandler(ArdAlarmRadarMove ardAlarmRadarMove) {
+ String mergeTime = ConfigUtils.getConfigValue("radarMergeTime");
+ Integer radarMergeTime = mergeTime == null || "".equals(mergeTime) ? 10 : Integer.valueOf(mergeTime);
+ ArdAlarmRadarMove lastMoveData = ardAlarmRadarMoveMapper.selectArdAlarmRadarLastData(ardAlarmRadarMove.getName());
+ if (lastMoveData == null) {
+ //鍏ュ簱
+ ardAlarmRadarMove.setGuideTime(ardAlarmRadarMove.getAlarmTime());
+ ardAlarmRadarMoveMapper.insertArdAlarmRadarMove(ardAlarmRadarMove);
+ radarMoveGuide(ardAlarmRadarMove);//寮曞
+ } else {
+ //鍚﹀垯姣斿鏇存柊鏃堕棿
+ Date lastUpdateTime = lastMoveData.getUpdateTime();
+ Date lastGuideTime = lastMoveData.getGuideTime();
+ long secDatePoor = DateUtils.getSecDatePoor(ardAlarmRadarMove.getAlarmTime(), lastUpdateTime);
+ if (secDatePoor <= radarMergeTime) {
+ //灏忎簬10绉掔殑鏂版暟鎹紝鏇存柊涓婁竴鏉�
+ ArdAlarmRadarMove updateData = new ArdAlarmRadarMove();
+ updateData.setId(lastMoveData.getId());
+ updateData.setUpdateTime(ardAlarmRadarMove.getAlarmTime());
+
+ //鍒ゆ柇寮曞鏃堕棿瓒呰繃5鍒嗛挓鍐嶆寮曞
+ long secDatePoorGuide = DateUtils.getSecDatePoor(ardAlarmRadarMove.getAlarmTime(), lastGuideTime);
+ if (secDatePoorGuide >= 300) {
+ updateData.setGuideTime(ardAlarmRadarMove.getAlarmTime());
+ radarMoveGuide(ardAlarmRadarMove);//寮曞
+ }
+ ardAlarmRadarMoveMapper.updateArdAlarmRadarMove(updateData);
+ } else {
+ //瓒呰繃10绉掔殑鏁版嵁,鍏ュ簱
+ ardAlarmRadarMove.setGuideTime(ardAlarmRadarMove.getAlarmTime());
+ ardAlarmRadarMoveMapper.insertArdAlarmRadarMove(ardAlarmRadarMove);
+ radarMoveGuide(ardAlarmRadarMove);//寮曞
+ }
+ }
+ }
+
+ /**
+ * 闆疯揪绾㈠闃茬伀鎶ヨ澶勭悊
+ * 鍒樿嫃涔�
+ * 2023/12/14 15:03:23
+ */
+ private void ardAlarmRadarFireHandler(ArdAlarmRadarFire ardAlarmRadarFire) {
+ String mergeTime = ConfigUtils.getConfigValue("radarMergeTime");
+ Integer radarMergeTime = mergeTime == null || "".equals(mergeTime) ? 10 : Integer.valueOf(mergeTime);
+ ArdAlarmRadarFire lastFireData = ardAlarmRadarFireMapper.selectArdAlarmRadarLastData(ardAlarmRadarFire.getName());
+ if (lastFireData == null) {
+ //鍏ュ簱
+ ardAlarmRadarFire.setGuideTime(ardAlarmRadarFire.getAlarmTime());
+ ardAlarmRadarFireMapper.insertArdAlarmRadarFire(ardAlarmRadarFire);
+ radarFireGuide(ardAlarmRadarFire);//寮曞
+ } else {
+ //鍚﹀垯姣斿鏇存柊鏃堕棿
+ Date lastUpdateTime = lastFireData.getUpdateTime();
+ Date lastGuideTime = lastFireData.getGuideTime();
+ long secDatePoor = DateUtils.getSecDatePoor(ardAlarmRadarFire.getAlarmTime(), lastUpdateTime);
+ if (secDatePoor <= radarMergeTime) {
+ //灏忎簬10绉掔殑鏂版暟鎹紝鏇存柊涓婁竴鏉�
+ ArdAlarmRadarFire updateData = new ArdAlarmRadarFire();
+ updateData.setId(lastFireData.getId());
+ updateData.setUpdateTime(ardAlarmRadarFire.getAlarmTime());
+
+ //鍒ゆ柇寮曞鏃堕棿瓒呰繃5鍒嗛挓鍐嶆寮曞
+ long secDatePoorGuide = DateUtils.getSecDatePoor(ardAlarmRadarFire.getAlarmTime(), lastGuideTime);
+ if (secDatePoorGuide >= 300) {
+ updateData.setGuideTime(ardAlarmRadarFire.getAlarmTime());
+ radarFireGuide(ardAlarmRadarFire);//寮曞
+ }
+ ardAlarmRadarFireMapper.updateArdAlarmRadarFire(updateData);
+ } else {
+ //瓒呰繃10绉掔殑鏁版嵁,鍏ュ簱
+ ardAlarmRadarFire.setGuideTime(ardAlarmRadarFire.getAlarmTime());
+ ardAlarmRadarFireMapper.insertArdAlarmRadarFire(ardAlarmRadarFire);
+ radarFireGuide(ardAlarmRadarFire);//寮曞
+ }
+ }
+ }
+
+ /**
+ * 闆疯揪鎶芥补鏈哄仠鏈烘姤璀﹀鐞�
+ * 鍒樿嫃涔�
+ * 2023/12/14 15:03:06
+ */
+ private void ardAlarmRadarPumpHandler(ArdAlarmRadarPump ardAlarmRadarPump) {
+ String mergeTime = ConfigUtils.getConfigValue("radarMergeTime");
+ Integer radarMergeTime = mergeTime == null || "".equals(mergeTime) ? 10 : Integer.valueOf(mergeTime);
+ ArdAlarmRadarPump lastPumpData = ardAlarmRadarPumpMapper.selectArdAlarmRadarLastData(ardAlarmRadarPump.getName());
+ if (lastPumpData == null) {
+ //鍏ュ簱
+ ardAlarmRadarPump.setGuideTime(ardAlarmRadarPump.getAlarmTime());
+ ardAlarmRadarPumpMapper.insertArdAlarmRadarPump(ardAlarmRadarPump);
+ radarPumpGuide(ardAlarmRadarPump);//寮曞
+ } else {
+ //鍚﹀垯姣斿鏇存柊鏃堕棿
+ Date lastUpdateTime = lastPumpData.getUpdateTime();
+ Date lastGuideTime = lastPumpData.getGuideTime();
+ long secDatePoor = DateUtils.getSecDatePoor(ardAlarmRadarPump.getAlarmTime(), lastUpdateTime);
+ if (secDatePoor <= radarMergeTime) {
+ //灏忎簬10绉掔殑鏂版暟鎹紝鏇存柊涓婁竴鏉�
+ ArdAlarmRadarPump updateData = new ArdAlarmRadarPump();
+ updateData.setId(lastPumpData.getId());
+ updateData.setUpdateTime(ardAlarmRadarPump.getAlarmTime());
+ //鍒ゆ柇寮曞鏃堕棿瓒呰繃5鍒嗛挓鍐嶆寮曞
+ long secDatePoorGuide = DateUtils.getSecDatePoor(ardAlarmRadarPump.getAlarmTime(), lastGuideTime);
+ if (secDatePoorGuide >= 300) {
+ radarPumpGuide(ardAlarmRadarPump);//寮曞
+ updateData.setGuideTime(ardAlarmRadarPump.getAlarmTime());
+ }
+ ardAlarmRadarPumpMapper.updateArdAlarmRadarPump(updateData);
+ } else {
+ //瓒呰繃10绉掔殑鏁版嵁,鍏ュ簱
+ ardAlarmRadarPump.setGuideTime(ardAlarmRadarPump.getAlarmTime());
+ ardAlarmRadarPumpMapper.insertArdAlarmRadarPump(ardAlarmRadarPump);
+ radarPumpGuide(ardAlarmRadarPump);//寮曞
+ }
+ }
+ }
}
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 8bf60c2..55f7de1 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
@@ -57,7 +57,7 @@
@Resource
private QueueHandler queueHandler;
- public Object _lock=new Object();
+ public Object _lock = new Object();
public static HCNetSDK hCNetSDK = HCNetSDK.hCNetSDK;
private static HCNetSDK.FExceptionCallBack fExceptionCallBack;//寮傚父鍥炶皟
@@ -278,7 +278,7 @@
//鍒涘缓寮曞闃熷垪
private void createGuideQueue(ArdCameras camera) {
- if(camera.getCamAlarmGuideEnable()!=null) {
+ if (camera.getCamAlarmGuideEnable() != null) {
if (camera.getCamAlarmGuideEnable() == 1) {
if (!GuidePriorityQueue.cameraQueueMap.containsKey(camera.getId())) {
Comparator<GuideTask> comparator = GuidePriorityQueue.getComparator();
@@ -290,6 +290,7 @@
}
}
}
+
//娣诲姞鍒版祦濯掍綋
private void addVtdu(ArdCameras camera) {
try {
@@ -888,8 +889,7 @@
* @鍒涘缓鏃堕棿 2023/1/17 16:36
* @淇敼浜哄拰鍏跺畠淇℃伅
*/
- @Override
- public Map<String, Object> getPtz(CameraCmd cmd) {
+ public Map<String, Object> getPtz1(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
Integer channelNum = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
@@ -927,6 +927,57 @@
log.error("鎺у埗澶辫触,璇风◢鍚庨噸璇�" + code);
return new HashMap<>();
}
+ }
+
+ /**
+ * @鎻忚堪 鑾峰彇楂樼簿搴tz淇℃伅
+ * @鍙傛暟 [userId, chanNo]
+ * @杩斿洖鍊� boolean
+ * @鍒涘缓浜� 鍒樿嫃涔�
+ * @鍒涘缓鏃堕棿 2023/1/17 16:36
+ * @淇敼浜哄拰鍏跺畠淇℃伅
+ */
+ @Override
+ public Map<String, Object> getPtz(CameraCmd cmd) {
+ Map<String, Object> ptzMap = new HashMap<>();
+ try {
+ String cameraId = cmd.getCameraId();
+ Integer chanNo = cmd.getChanNo();
+ if (!GlobalVariable.loginMap.containsKey(cameraId)) {
+ return new HashMap<>();
+ }
+ IntByReference pchannel = new IntByReference(chanNo);
+ Pointer pChannelNum = pchannel.getPointer();
+ Integer lUserID = (Integer) GlobalVariable.loginMap.get(cameraId);
+ HCNetSDK.NET_DVR_STD_CONFIG lpConfigParam6696 = new HCNetSDK.NET_DVR_STD_CONFIG();
+ HCNetSDK.NET_DVR_PTZABSOLUTEEX_CFG lpPTZAbsoluteEX_cfg = new HCNetSDK.NET_DVR_PTZABSOLUTEEX_CFG();
+ lpConfigParam6696.lpCondBuffer = pChannelNum;
+ lpConfigParam6696.dwCondSize = 4;
+ lpConfigParam6696.lpInBuffer = null;
+ lpConfigParam6696.dwInSize = 0;
+ lpConfigParam6696.lpOutBuffer = lpPTZAbsoluteEX_cfg.getPointer();
+ lpConfigParam6696.dwOutSize = lpPTZAbsoluteEX_cfg.size();
+ lpConfigParam6696.write();
+ boolean res = hCNetSDK.NET_DVR_GetSTDConfig(lUserID, HCNetSDK.NET_DVR_GET_PTZABSOLUTEEX, lpConfigParam6696);
+ if (!res) {
+ log.error("鑾峰彇楂樼簿搴TZ缁濆浣嶇疆閰嶇疆澶辫触锛岄敊璇彿锛�" + hCNetSDK.NET_DVR_GetLastError());
+ } else {
+ lpPTZAbsoluteEX_cfg.read();
+ //log.debug("P锛�" + lpPTZAbsoluteEX_cfg.struPTZCtrl.fPan + " T锛�" + lpPTZAbsoluteEX_cfg.struPTZCtrl.fTilt + " Z锛�" + lpPTZAbsoluteEX_cfg.struPTZCtrl.fZoom
+ // + " 鑱氱劍鍙傛暟锛�" + lpPTZAbsoluteEX_cfg.struPTZCtrl.dwFocus + " 鑱氱劍鑼冨洿锛�" + lpPTZAbsoluteEX_cfg.dwFocalLen + " 姘村钩杞姩閫熷害锛�" + lpPTZAbsoluteEX_cfg.fHorizontalSpeed
+ // + " 鍨傜洿杞姩閫熷害锛�" + lpPTZAbsoluteEX_cfg.fVerticalSpeed + " 闀滃ご鍙樺�嶉厤缃被鍨嬶細" + lpPTZAbsoluteEX_cfg.byZoomType);
+ float p = lpPTZAbsoluteEX_cfg.struPTZCtrl.fPan;
+ float fTilt = lpPTZAbsoluteEX_cfg.struPTZCtrl.fTilt;
+ float t = fTilt < 0 ? fTilt + 360 : fTilt;
+ float z = lpPTZAbsoluteEX_cfg.struPTZCtrl.fZoom;
+ ptzMap.put("p", p);
+ ptzMap.put("t", t);
+ ptzMap.put("z", z);
+ }
+ } catch (Exception ex) {
+ log.error("鑾峰彇楂樼簿搴TZ缁濆浣嶇疆寮傚父:" + ex.getMessage());
+ }
+ return ptzMap;
}
/**
@@ -1021,9 +1072,8 @@
}
return bool;
- }catch (Exception ex)
- {
- log.error("璁剧疆楂樼簿搴TZ鍙傛暟寮傚父",ex);
+ } catch (Exception ex) {
+ log.error("璁剧疆楂樼簿搴TZ鍙傛暟寮傚父", ex);
return false;
}
}
--
Gitblit v1.9.3