From e020e16be81de6064bb8ead304529ae6b135dc59 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 08 十一月 2023 15:00:41 +0800
Subject: [PATCH] 雷达强制引导计算z值
---
ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java | 26 +++++++++----
ard-work/src/main/java/com/ruoyi/device/radar/mapper/ArdEquipRadarMapper.java | 5 +-
ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java | 8 ++--
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java | 13 +++---
ard-work/src/main/resources/mapper/device/ArdEquipRadarMapper.xml | 11 ++---
5 files changed, 37 insertions(+), 26 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 cbfef91..317fd15 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
@@ -39,6 +39,7 @@
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.external.domain.ArdEquipExternal;
import com.ruoyi.device.external.mapper.ArdEquipExternalMapper;
import com.ruoyi.device.radar.mapper.ArdEquipRadarMapper;
@@ -51,6 +52,7 @@
import com.ruoyi.utils.tube.GeoPoint;
import com.ruoyi.utils.tube.TubeTools;
import lombok.extern.slf4j.Slf4j;
+import org.gavaghan.geodesy.GlobalCoordinates;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -1020,7 +1022,6 @@
} else {
//鍚﹀垯姣斿鏇存柊鏃堕棿
Date lastUpdateTime = lastMoveData.getUpdateTime();
-
Date lastGuideTime = lastMoveData.getGuideTime();
long secDatePoor = DateUtils.getSecDatePoor(alarmTime,lastUpdateTime);
if (secDatePoor <= radarMergeTime) {
@@ -1374,11 +1375,11 @@
int index = name.indexOf("(");
String alarmpointName = name.substring(0, index);
//鑾峰彇闆疯揪鎵�鍦ㄥ涓婄殑澶у厜鐢�
- String cameraIdWithTower = ardEquipRadarMapper.getCameraByRadar(radarId);
- if (StringUtils.isNotNull(cameraIdWithTower) && StringUtils.isNotEmpty(cameraIdWithTower)) {
- log.debug("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:" + cameraIdWithTower);
+ ArdCameras cameraWithTower = ardEquipRadarMapper.getCameraByRadar(radarId);
+ if (StringUtils.isNotNull(cameraWithTower)) {
+ log.debug("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:" + cameraWithTower.getId());
//濡傛灉闆疯揪濉斾笂鏈夊厜鐢�
- messagesEnqueued(cameraIdWithTower, alarmId, alarmType, createTime, 1, 1, coordinate);
+ messagesEnqueued(cameraWithTower.getId(), alarmId, alarmType, createTime, 1, 1, coordinate);
} else {
log.debug("鏈幏鍙栧埌闆疯揪濉斾笂鐨勫厜鐢�,鏃犳硶寮曞");
}
@@ -1386,7 +1387,7 @@
ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(alarmpointName);
if (StringUtils.isNotNull(ardAlarmpointsWell) && StringUtils.isNotEmpty(ardAlarmpointsWell.getCameraId())) {
String cameraId = ardAlarmpointsWell.getCameraId();
- if (cameraId.equals(cameraIdWithTower)) {
+ if (cameraId.equals(cameraWithTower.getId())) {
return;
}
log.info("鑾峰彇鍒版姤璀︾偣鍏宠仈鐨勫厜鐢�:" + cameraId);
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java
index 8abcf5c..4735513 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java
@@ -3,11 +3,14 @@
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.alarm.radar.service.ArdRadarService;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.camera.service.ICameraSdkService;
import com.ruoyi.device.radar.mapper.ArdEquipRadarMapper;
import com.ruoyi.storage.minio.domain.jsonbean.JsonsRootBean;
+import com.ruoyi.utils.gis.GisUtil;
import lombok.extern.slf4j.Slf4j;
+import org.gavaghan.geodesy.GlobalCoordinates;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -42,19 +45,26 @@
if (msgMap != null) {
Double p = Double.parseDouble(msgMap.get("p").toString());
Double t = Double.parseDouble(msgMap.get("t").toString());
- Double z = Double.parseDouble(msgMap.get("z").toString());
+ Long distance = Long.parseLong(msgMap.get("distance").toString());
String radarId = msgMap.get("radarId").toString();
//鑾峰彇闆疯揪鎵�鍦ㄥ涓婄殑澶у厜鐢�
- String cameraIdWithTower = ardEquipRadarMapper.getCameraByRadar(radarId);
- if (StringUtils.isNotNull(cameraIdWithTower) && StringUtils.isNotEmpty(cameraIdWithTower)) {
- log.debug("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:" + cameraIdWithTower);
+ ArdCameras camera = ardEquipRadarMapper.getCameraByRadar(radarId);
+ if (StringUtils.isNotNull(camera)) {
+ log.debug("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:" + camera.getId());
+ //璁$畻鐩爣鐐瑰潗鏍�
+ GlobalCoordinates cameraCoordinates = new GlobalCoordinates(camera.getLatitude(), camera.getLongitude());
+ GlobalCoordinates targetCoordinates = GisUtil.getGlobalCoordinates(cameraCoordinates, p, distance);
+ //鑾峰彇ptz
+ double[] cameraPoint = new double[]{ camera.getLongitude(), camera.getLatitude(),camera.getAltitude()};
+ double[] targetPoint = new double[]{targetCoordinates.getLongitude(), targetCoordinates.getLatitude()};
+ double[] cameraPTZ = GisUtil.getCameraPTZ(cameraPoint, targetPoint, 20, 150);
//濡傛灉闆疯揪濉斾笂鏈夊厜鐢�
- CameraCmd cmd = new CameraCmd(cameraIdWithTower, 1);
+ CameraCmd cmd = new CameraCmd(camera.getId(), 1);
cmd.setOperator("sys_radar_force");
Map<String, Double> ptzMap = new HashMap<>();
ptzMap.put("p", p);
ptzMap.put("t", t);
- ptzMap.put("z", z);
+ ptzMap.put("z", cameraPTZ[2]);
cmd.setPtzMap(ptzMap);
boolean res = iCameraSdkService.setPtz(cmd);
if (res) {
@@ -67,7 +77,7 @@
}
}
} catch (Exception ex) {
- log.error("寮哄埗寮曞寮傚父:"+ ex.getMessage());
+ log.error("寮哄埗寮曞寮傚父:" + ex.getMessage());
}
}
-}
+}
\ No newline at end of file
diff --git a/ard-work/src/main/java/com/ruoyi/device/radar/mapper/ArdEquipRadarMapper.java b/ard-work/src/main/java/com/ruoyi/device/radar/mapper/ArdEquipRadarMapper.java
index 0ef2b09..4bfb025 100644
--- a/ard-work/src/main/java/com/ruoyi/device/radar/mapper/ArdEquipRadarMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/device/radar/mapper/ArdEquipRadarMapper.java
@@ -3,6 +3,7 @@
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.device.radar.domain.ArdEquipRadar;
/**
@@ -62,7 +63,7 @@
public int deleteArdEquipRadarByIds(String[] ids);
/**
- * 閫氳繃闆疯揪id鎵惧埌鍏宠仈濉斾笂鐨勫ぇ鍏夌數id
+ * 閫氳繃闆疯揪id鎵惧埌鍏宠仈濉斾笂鐨勫ぇ鍏夌數
*/
- String getCameraByRadar(String radarId);
+ ArdCameras getCameraByRadar(String radarId);
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java b/ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java
index c8ec803..276d8bc 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java
@@ -201,9 +201,9 @@
double[] ptz = GisUtil.getCameraPTZ(camera, lookAt, viewAngle, viewWidth);
System.out.println("ptz:" + Arrays.toString(ptz));*/
// double[] camera = {125.153903999999997,46.5600799999999992,258.430000000000007};
- GlobalCoordinates camera = new GlobalCoordinates(46.5600799999999992,125.153903999999997);
- double p = 212.70155;
- double distance = 4048.886568114861;
+ GlobalCoordinates camera = new GlobalCoordinates(45.755847,126.640557);
+ double p = 39.71;
+ double distance = 164;
GlobalCoordinates point = getGlobalCoordinates(camera, p, distance);
System.out.println("point:");
@@ -211,4 +211,4 @@
System.out.println("lat:"+point.getLatitude());
}
-}
+}
\ No newline at end of file
diff --git a/ard-work/src/main/resources/mapper/device/ArdEquipRadarMapper.xml b/ard-work/src/main/resources/mapper/device/ArdEquipRadarMapper.xml
index 63a35d5..f11397e 100644
--- a/ard-work/src/main/resources/mapper/device/ArdEquipRadarMapper.xml
+++ b/ard-work/src/main/resources/mapper/device/ArdEquipRadarMapper.xml
@@ -194,12 +194,11 @@
#{id}
</foreach>
</delete>
- <select id="getCameraByRadar" resultType="String">
- select ac.id
- from ard_equip_radar aer
- INNER JOIN ard_towers at
- on aer.tower_id= at.id
- INNER JOIN ard_cameras ac on aer.tower_id=ac.tower_id
+
+ <select id="getCameraByRadar" resultType="ArdCameras">
+ select ac.* from ard_equip_radar aer
+ INNER JOIN ard_towers at on aer.tower_id= at.id
+ INNER JOIN ard_cameras ac on aer.tower_id=ac.tower_id
where aer.id=#{radarId} limit 1
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3