From a845352eacdba8a8d05bb0e693e02c104b5abf98 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期四, 02 十一月 2023 10:32:41 +0800
Subject: [PATCH] 接收解析告警前端发送的强制引导信息并进行引导
---
ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java | 73 ++++++++++++++++++++++++++++++++++++
ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java | 5 ++
ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumerCallback.java | 6 +++
3 files changed, 84 insertions(+), 0 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
new file mode 100644
index 0000000..1e51b9f
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java
@@ -0,0 +1,5 @@
+package com.ruoyi.alarm.radar.service;
+
+public interface ArdRadarService {
+ void forceGuide(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
new file mode 100644
index 0000000..8abcf5c
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java
@@ -0,0 +1,73 @@
+package com.ruoyi.alarm.radar.service.impl;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.alarm.radar.service.ArdRadarService;
+import com.ruoyi.common.utils.StringUtils;
+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 lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description: 闆疯揪涓氬姟
+ * @ClassName: ArdRadarServiceImpl
+ * @Author: 鍒樿嫃涔�
+ * @Date: 2023骞�11鏈�02鏃�9:00:08
+ **/
+@Slf4j(topic = "guideQueue")
+@Service
+public class ArdRadarServiceImpl implements ArdRadarService {
+ @Resource
+ ICameraSdkService iCameraSdkService;
+ @Resource
+ ArdEquipRadarMapper ardEquipRadarMapper;
+
+ /**
+ * 寮傛鎵ц寮哄埗寮曞
+ * 鍒樿嫃涔�
+ * 2023/11/2 9:00:55
+ */
+ @Override
+ @Async
+ public void forceGuide(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());
+ Double z = Double.parseDouble(msgMap.get("z").toString());
+ String radarId = msgMap.get("radarId").toString();
+ //鑾峰彇闆疯揪鎵�鍦ㄥ涓婄殑澶у厜鐢�
+ String cameraIdWithTower = ardEquipRadarMapper.getCameraByRadar(radarId);
+ if (StringUtils.isNotNull(cameraIdWithTower) && StringUtils.isNotEmpty(cameraIdWithTower)) {
+ log.debug("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:" + cameraIdWithTower);
+ //濡傛灉闆疯揪濉斾笂鏈夊厜鐢�
+ CameraCmd cmd = new CameraCmd(cameraIdWithTower, 1);
+ cmd.setOperator("sys_radar_force");
+ Map<String, Double> ptzMap = new HashMap<>();
+ ptzMap.put("p", p);
+ ptzMap.put("t", t);
+ ptzMap.put("z", z);
+ 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());
+ }
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumerCallback.java b/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumerCallback.java
index 7e2a2d3..29965fa 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumerCallback.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumerCallback.java
@@ -1,6 +1,7 @@
package com.ruoyi.utils.mqtt;
import com.ruoyi.alarm.global.service.impl.GlobalAlarmServiceImpl;
+import com.ruoyi.alarm.radar.service.ArdRadarService;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.statistical.service.StatisticalService;
import com.ruoyi.storage.minio.service.IStorageMinioEventService;
@@ -85,6 +86,11 @@
StatisticalService statisticalService = SpringUtils.getBean(StatisticalService.class);
statisticalService.data(new String(message.getPayload(), StandardCharsets.UTF_8));
}
+ if (topic.equals("radarForceGuide"))
+ {
+ ArdRadarService ardRadarService = SpringUtils.getBean(ArdRadarService.class);
+ ardRadarService.forceGuide(new String(message.getPayload(), StandardCharsets.UTF_8));
+ }
} catch (Exception e) {
log.debug("澶勭悊mqtt娑堟伅寮傚父:" + e);
}
--
Gitblit v1.9.3