From 53857f42f777e2b9753b8f00cce1a60ce3dcb8fd Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期三, 15 十月 2025 22:42:29 +0800
Subject: [PATCH] 2025.10.15 修改高德地图地理逆编码结果,让地理位置信息更加详细
---
src/main/kotlin/com/flightfeather/uav/biz/report/MissionInventory.kt | 168 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 133 insertions(+), 35 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/report/MissionInventory.kt b/src/main/kotlin/com/flightfeather/uav/biz/report/MissionInventory.kt
index cd8f696..302871e 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/report/MissionInventory.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/report/MissionInventory.kt
@@ -19,20 +19,28 @@
// 璧拌埅娓呭崟淇℃伅
class MissionInfo : Mission() {
// 棣栬姹℃煋鐗�
- var mainFactor: String? = null
+// var mainFactor: String? = null
// 鐩戞祴寮傚父鍥犲瓙
var abnormalFactors: List<FactorType>? = null
// 婧簮闂鍦烘櫙鏁�
var sceneCount: Int = 0
+
+ // 婧簮闂鍦烘櫙
+ var scenes: List<SceneInfo>? = null
+
+ // 璧拌埅娑夊強鍖哄煙
+ var keyScene: List<SceneInfo>? = null
+
+ var exceptionCount: Int = 0
}
// 璧拌埅璇︽儏淇℃伅
class MissionDetail : Mission() {
- var keyScene: List<SceneInfo>? = null
+// var keyScene: List<SceneInfo>? = null
var dataStatistics: List<FactorStatistics>? = null
- var exceptionCount: Int = 0
+// var exceptionCount: Int = 0
}
/**
@@ -48,7 +56,7 @@
var sceneCount = 0
clue.forEach {
if (it?.msgType == MsgType.PolClue.value) {
- it.pollutedData?.statisticMap?.keys?.forEach { k->
+ it.pollutedData?.statisticMap?.keys?.forEach { k ->
// 璁$畻姣忎釜璧拌埅浠诲姟鐨勬墍鏈夊紓甯稿洜瀛�
if (!abnormalFactors.contains(k)) {
abnormalFactors.add(k)
@@ -66,12 +74,93 @@
val missionInfo = MissionInfo()
BeanUtils.copyProperties(mission, missionInfo)
missionInfo.apply {
- mainFactor = factorMap.maxByOrNull { it.value }?.key?.name
+// mainFactor = factorMap.maxByOrNull { it.value }?.key?.name
this.abnormalFactors = abnormalFactors
this.sceneCount = sceneCount
}
}
return result
+ }
+
+ fun generateMissionInfo(
+ keyScenes: List<SceneInfo?>,
+ mission: Mission,
+ pollutedClues: List<PollutedClue?>,
+ data: List<BaseRealTimeData>,
+ minDis: Double = 100.0,
+ ): MissionInfo {
+ val factorMap = mutableMapOf<FactorType, Int>()
+ val abnormalFactors = mutableListOf<FactorType>()
+ var sceneCount = 0
+ val scenes = mutableListOf<SceneInfo>()
+ // 鎻愬彇閫斿緞鍏抽敭鍦烘櫙淇℃伅锛堣绠楄蛋鑸矾绾挎槸鍚︿笌鍏抽敭鍦烘櫙璺濈杈冭繎锛�
+ val relatedScenes = mutableListOf<SceneInfo>()
+ data.forEach { d ->
+ // 璺宠繃缂哄皯缁忕含搴︾殑鏁版嵁鐐�
+ if (d.longitude == null || d.latitude == null) {
+ return@forEach
+ }
+ // 杞崲涓篏CJ02鍧愭爣绯�
+ val point = MapUtil.wgs84ToGcj02(d.longitude!!.toDouble() to d.latitude!!.toDouble())
+ keyScenes.forEach ks@{ k ->
+ // 璺宠繃缂哄皯缁忕含搴︾殑鍦烘櫙
+ if (k?.longitude == null || k.latitude == null) {
+ return@ks
+ }
+ // 妫�鏌ユ槸鍚︽湭娣诲姞杩�
+ if (!relatedScenes.contains(k)) {
+ // 璁$畻璺濈
+ val distance = MapUtil.getDistance(
+ k.longitude!!.toDouble(),
+ k.latitude!!.toDouble(),
+ point.first,
+ point.second
+ )
+ // 妫�鏌ユ槸鍚﹁窛绂诲皬浜庨槇鍊�
+ if (distance < minDis) {
+ relatedScenes.add(k)
+ }
+ }
+ }
+ }
+ pollutedClues.forEach {
+ if (it?.msgType == MsgType.PolClue.value) {
+ it.pollutedData?.statisticMap?.keys?.forEach { k ->
+ // 璁$畻姣忎釜璧拌埅浠诲姟鐨勬墍鏈夊紓甯稿洜瀛�
+ if (!abnormalFactors.contains(k)) {
+ abnormalFactors.add(k)
+ }
+ // 璁$畻姣忎釜璧拌埅浠诲姟鐨勯瑕佹薄鏌撶墿
+ if (!factorMap.containsKey(k)) {
+ factorMap[k] = 0
+ }
+ factorMap[k] = factorMap[k]!! + 1
+ }
+ // 璁$畻姣忎釜璧拌埅浠诲姟鐨勬函婧愬満鏅暟閲�
+ sceneCount += it.pollutedSource?.sceneList?.size ?: 0
+ it.pollutedSource?.sceneList?.forEach { s->
+ if (scenes.find { s1 -> s1.guid == s.guid } == null) {
+ scenes.add(s)
+ }
+ }
+ }
+ }
+
+ // 寮傚父鏁版嵁鐐规暟閲忕粺璁�
+ val clues = pollutedClues.filter { it?.msgType == MsgType.PolClue.value }
+
+ val missionInfo = MissionInfo()
+ BeanUtils.copyProperties(mission, missionInfo)
+ missionInfo.apply {
+// mainFactor = factorMap.maxByOrNull { it.value }?.key?.name
+ this.abnormalFactors = abnormalFactors
+ this.sceneCount = sceneCount
+ this.scenes = scenes
+ keyScene = relatedScenes
+ exceptionCount = clues.size
+ }
+
+ return missionInfo
}
/**
@@ -93,44 +182,53 @@
mission: Mission,
pollutedClues: List<PollutedClue?>,
data: List<BaseRealTimeData>,
- minDis:Double = 100.0
+ granularity: String,
+ minDis: Double = 100.0,
): MissionDetail {
// 鍒涘缓浠诲姟璇︽儏瀵硅薄骞跺鍒跺熀鏈俊鎭�
val missionDetail = MissionDetail()
BeanUtils.copyProperties(mission, missionDetail)
-
+
// 鎻愬彇閫斿緞鍏抽敭鍦烘櫙淇℃伅锛堣绠楄蛋鑸矾绾挎槸鍚︿笌鍏抽敭鍦烘櫙璺濈杈冭繎锛�
- val relatedScenes = mutableListOf<SceneInfo>()
- data.forEach { d->
- // 璺宠繃缂哄皯缁忕含搴︾殑鏁版嵁鐐�
- if (d.longitude == null || d.latitude == null) {
- return@forEach
- }
- // 杞崲涓篏CJ02鍧愭爣绯�
- val point = MapUtil.wgs84ToGcj02(d.longitude!!.toDouble() to d.latitude!!.toDouble())
- keyScenes.forEach ks@ { k->
- // 璺宠繃缂哄皯缁忕含搴︾殑鍦烘櫙
- if (k?.longitude == null || k.latitude == null) {
- return@ks
- }
- // 璁$畻璺濈
- val distance = MapUtil.getDistance(k.longitude!!.toDouble(), k.latitude!!.toDouble(), point.first, point.second)
- // 妫�鏌ユ槸鍚﹁窛绂诲皬浜庨槇鍊间笖鏈坊鍔犺繃
- if (distance < minDis && !relatedScenes.contains(k)) {
- relatedScenes.add(k)
- }
- }
- }
+// val relatedScenes = mutableListOf<SceneInfo>()
+// data.forEach { d ->
+// // 璺宠繃缂哄皯缁忕含搴︾殑鏁版嵁鐐�
+// if (d.longitude == null || d.latitude == null) {
+// return@forEach
+// }
+// // 杞崲涓篏CJ02鍧愭爣绯�
+// val point = MapUtil.wgs84ToGcj02(d.longitude!!.toDouble() to d.latitude!!.toDouble())
+// keyScenes.forEach ks@{ k ->
+// // 璺宠繃缂哄皯缁忕含搴︾殑鍦烘櫙
+// if (k?.longitude == null || k.latitude == null) {
+// return@ks
+// }
+// // 妫�鏌ユ槸鍚︽湭娣诲姞杩�
+// if (!relatedScenes.contains(k)) {
+// // 璁$畻璺濈
+// val distance = MapUtil.getDistance(
+// k.longitude!!.toDouble(),
+// k.latitude!!.toDouble(),
+// point.first,
+// point.second
+// )
+// // 妫�鏌ユ槸鍚﹁窛绂诲皬浜庨槇鍊�
+// if (distance < minDis) {
+// relatedScenes.add(k)
+// }
+// }
+// }
+// }
// 瀛樺偍涓庝换鍔$浉鍏宠仈鐨勫叧閿満鏅俊鎭�
- missionDetail.keyScene = relatedScenes
-
+// missionDetail.keyScene = relatedScenes
+
// 璁$畻鐜鍥犲瓙缁熻鏁版嵁锛堝钩鍧囧�笺�佹渶灏忓�笺�佹渶澶у�硷級
- missionDetail.dataStatistics = data.calDataStatistics()
-
+ missionDetail.dataStatistics = data.calDataStatistics(granularity)
+
// 寮傚父鏁版嵁鐐规暟閲忕粺璁�
- val clues = pollutedClues.filter { it?.msgType == MsgType.PolClue.value }
- missionDetail.exceptionCount = clues.size
-
+// val clues = pollutedClues.filter { it?.msgType == MsgType.PolClue.value }
+// missionDetail.exceptionCount = clues.size
+
return missionDetail
}
}
\ No newline at end of file
--
Gitblit v1.9.3