From c4dbb67b6045e138faf1ab8e5ccbd453bada9d66 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 29 十一月 2023 15:43:56 +0800
Subject: [PATCH] 雷达跟踪引导接收
---
ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java | 1 +
ard-work/src/main/java/com/ruoyi/device/radar/controller/ArdEquipRadarController.java | 5 +++--
3 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java b/ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java
index 1e51b9f..5ef7f8b 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java
@@ -2,4 +2,5 @@
public interface ArdRadarService {
void forceGuide(String msg);
+ void followGuide(String msg);
}
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 4735513..8d1cdf3 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
@@ -80,4 +80,52 @@
log.error("寮哄埗寮曞寮傚父:" + ex.getMessage());
}
}
+ /**
+ * 寮傛闆疯揪杩借釜寮曞
+ * 鍒樿嫃涔�
+ * 2023/11/2 9:00:55
+ */
+ @Override
+ @Async
+ public void followGuide(String msg) {
+ try {
+ Map<String, Object> msgMap = JSONObject.parseObject(msg, Map.class);
+ if (msgMap != null) {
+ Double p = Double.parseDouble(msgMap.get("p").toString());
+ Double t = Double.parseDouble(msgMap.get("t").toString());
+ Long distance = Long.parseLong(msgMap.get("distance").toString());
+ String radarId = msgMap.get("radarId").toString();
+ //鑾峰彇闆疯揪鎵�鍦ㄥ涓婄殑澶у厜鐢�
+ 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(camera.getId(), 1);
+ cmd.setOperator("sys_radar_follow");
+ Map<String, Double> ptzMap = new HashMap<>();
+ ptzMap.put("p", p);
+ ptzMap.put("t", t);
+ ptzMap.put("z", cameraPTZ[2]);
+ cmd.setPtzMap(ptzMap);
+ boolean res = iCameraSdkService.setPtz(cmd);
+ if (res) {
+ log.debug("闆疯揪杩借釜寮曞鎴愬姛");
+ } else {
+ log.debug("闆疯揪杩借釜寮曞澶辫触");
+ }
+ } else {
+ log.debug("鏈幏鍙栧埌闆疯揪濉斾笂鐨勫厜鐢�");
+ }
+ }
+ } catch (Exception ex) {
+ log.error("杈捐拷韪紩瀵煎紓甯�:" + ex.getMessage());
+ }
+ }
}
\ No newline at end of file
diff --git a/ard-work/src/main/java/com/ruoyi/device/radar/controller/ArdEquipRadarController.java b/ard-work/src/main/java/com/ruoyi/device/radar/controller/ArdEquipRadarController.java
index af3ce6b..658f2e2 100644
--- a/ard-work/src/main/java/com/ruoyi/device/radar/controller/ArdEquipRadarController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/radar/controller/ArdEquipRadarController.java
@@ -127,12 +127,13 @@
{
return radarClient.guideInfoBack(guideInfo);
}
-
+ /**
+ * 鑾峰彇閮ㄩ棬鍜岄浄杈�
+ */
@GetMapping("/getDeptAndRadar")
@ApiOperation("鑾峰彇閮ㄩ棬鍜岄浄杈�")
public AjaxResult getDeptAndCamera() {
Map deptAndCamera = ardEquipRadarService.getChildDeptAndRadar(true);
return AjaxResult.success(deptAndCamera);
}
-
}
--
Gitblit v1.9.3