From 72906ef43acb9b3d32816ae7037753d0c14805bf Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 09 八月 2023 17:19:14 +0800
Subject: [PATCH] 修改雷达报警过滤兴趣点后引导
---
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java | 34 ++++++++++++++++++----------------
1 files changed, 18 insertions(+), 16 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 a2b42f9..c7d9fb5 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
@@ -45,6 +45,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
+
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -508,8 +509,6 @@
break;
case "radar":
//region 澶勭悊闆疯揪鎶ヨ
- // 寮�濮嬫椂闂�
- long stime = System.currentTimeMillis();
RadarAlarmData radarAlarmData = JSONObject.parseObject(message, RadarAlarmData.class);
List<ArdAlarmRadar> ardAlarmRadars = radarAlarmData.getArdAlarmRadars();
for (ArdAlarmRadar ardAlarmRadar : ardAlarmRadars) {
@@ -520,10 +519,9 @@
ardAlarmRadar.setName(ardAlarmRadar.getName() + "(" + radarAlarmData.getRadarName() + ")");//鎶ヨ鐐瑰悕绉�
ardAlarmRadar.setCreateTime(new Date());//鎺ユ敹鏃堕棿
- String alarmType = "";
switch (ardAlarmRadar.getAlarmType()) {
case "杩愬姩鐩爣妫�娴�":
- alarmType = "sys_radar_move";
+ String alarmType = "sys_radar_move";
break;
case "鐑簮妫�娴�":
alarmType = "sys_radar_fire";
@@ -537,11 +535,21 @@
}
break;
}
+ //鍏ュ簱
+ ardAlarmRadarMapper.insertArdAlarmRadar(ardAlarmRadar);
+
+ }
+ //鎸夊叴瓒g偣鍘婚噸,鐒跺悗鎸夊紩瀵奸�昏緫杩涜寮曞鍏ラ槦
+ ardAlarmRadars = ardAlarmRadars.stream()
+ .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new java.util.TreeSet<>(java.util.Comparator.comparing(ArdAlarmRadar::getName))), ArrayList::new));
+ for(ArdAlarmRadar ardAlarmRadar : ardAlarmRadars)
+ {
+ //閬嶅巻鎶ヨ鏁版嵁杩涜寮曞
if (StringUtils.isNull(ardAlarmRadar.getLongitude()) || StringUtils.isNull(ardAlarmRadar.getLatitude())) {
+ //鍧愭爣涓虹┖涓嶅紩瀵�
continue;
}
double[] coordinate = new double[]{ardAlarmRadar.getLongitude(), ardAlarmRadar.getLatitude()};//鎶ヨ鍧愭爣
-
//浠巖edis涓彇鍑哄綋鍓嶆姤璀︾偣鐨�5鍒嗛挓鍐呮槸鍚︽湁寮曞
ArdAlarmRadar AlarmRadar = redisCache.getCacheObject("global_alarm:" + ardAlarmRadar.getName());//浠巖edis涓彇鍑烘渶鏂板紩瀵肩殑鎶ヨ鏁版嵁
if (AlarmRadar == null) {
@@ -551,7 +559,7 @@
redisCache.setCacheObject("global_alarm:" + ardAlarmRadar.getName(), ardAlarmRadar, 5, TimeUnit.MINUTES);//寮曞鏁版嵁鍐欏叆redis
unGuideCountMap.put(ardAlarmRadar.getName(), 0);
//寮曞鍏ラ槦
- radarGuide(radarAlarmData.getRadarId(), alarmpointName, alarmType, ardAlarmRadar.getCreateTime(), coordinate);
+ radarGuide(radarAlarmData.getRadarId(), ardAlarmRadar.getName(), ardAlarmRadar.getAlarmType(), ardAlarmRadar.getCreateTime(), coordinate);
} else {
//5鍒嗛挓鍐卹edis涓湁鏁版嵁锛岃鏄�5鍒嗛挓鍐呮湁寮曞鏁版嵁,鑾峰彇褰撳墠鎶ヨ鐐圭殑鏈紩瀵兼鏁�
@@ -564,7 +572,7 @@
redisCache.setCacheObject("global_alarm:" + ardAlarmRadar.getName(), ardAlarmRadar, 5, TimeUnit.MINUTES);
count = 0;
//寮曞鍏ラ槦
- radarGuide(radarAlarmData.getRadarId(), alarmpointName, alarmType, ardAlarmRadar.getCreateTime(), coordinate);
+ radarGuide(radarAlarmData.getRadarId(), ardAlarmRadar.getName(), ardAlarmRadar.getAlarmType(), ardAlarmRadar.getCreateTime(), coordinate);
} else {
ardAlarmRadar.setGuideFlag(0);
count++;
@@ -574,15 +582,10 @@
count = 0;
}
unGuideCountMap.put(ardAlarmRadar.getName(), count);
+ //鏇存柊
+ ardAlarmRadarMapper.updateArdAlarmRadar(ardAlarmRadar);
}
- //鍏ュ簱
- ardAlarmRadarMapper.insertArdAlarmRadar(ardAlarmRadar);
- // 缁撴潫鏃堕棿
- long etime = System.currentTimeMillis();
- // 璁$畻鎵ц鏃堕棿
- log.debug("闆疯揪鎶ヨ澶勭悊鏃堕暱锛�" + (etime - stime) + "姣");
}
-
//endregion
break;
case "external":
@@ -692,8 +695,7 @@
guideTask.setReceiveTime(fmt.format(receiveTime));
//鎶ヨ浼樺厛绾�(閫氳繃浼樺厛绾у瓧鍏�)
String priority = DictUtils.getDictValue("cameras_priority", alarmType);
- if(StringUtils.isEmpty(priority))
- {
+ if (StringUtils.isEmpty(priority)) {
log.debug("鏈尮閰嶅埌浼樺厛绾�,璇锋鏌ヤ紭鍏堢骇瀛楀吀閰嶇疆");
return;
}
--
Gitblit v1.9.3