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/sourcetrace/model/PollutedSource.kt | 86 ++++++++++++++++++++++--------------------
1 files changed, 45 insertions(+), 41 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt
index 6d7b8f0..4b4adee 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt
@@ -45,41 +45,45 @@
// 鎸夌収鍖哄煙妫�绱㈠唴閮ㄦ薄鏌撴簮淇℃伅
var result = mutableListOf<SceneInfo>()
// 1. 棣栧厛鎸夌収鍥涜嚦鑼冨洿浠庢暟鎹簱鍒濇绛涢�夋薄鏌撴簮锛屾澶勭殑鍖哄煙鍧愭爣宸茶浆鎹负鐏槦鍧愭爣绯�
- val polygonTmp = pollutedArea.polygon!!
- val fb = MapUtil.calFourBoundaries(polygonTmp)
- val sceneList = sceneInfoRep.findByCoordinateRange(fb)
- // 2. 鍐嶇簿纭垽鏂槸鍚﹀湪鍙嶅悜婧簮鍖哄煙澶氳竟褰㈠唴閮�
- sceneList.forEach {
- val point = it!!.longitude.toDouble() to it.latitude.toDouble()
- if (MapUtil.isPointInPolygon(point, polygonTmp)) {
- result.add(it)
- }
- }
+ val polygonTmp = pollutedArea.polygon
+ this.sceneList = emptyList()
- val closePolygonTmp = pollutedArea.closePolygon!!
- val closeFb = MapUtil.calFourBoundaries(closePolygonTmp)
- val closeSceneList = sceneInfoRep.findByCoordinateRange(closeFb)
- // 2. 鍐嶇簿纭垽鏂槸鍚﹀湪鍙嶅悜婧簮鍖哄煙澶氳竟褰㈠唴閮�
- closeSceneList.forEach {
- val point = it!!.longitude.toDouble() to it.latitude.toDouble()
- if (MapUtil.isPointInPolygon(point, closePolygonTmp)) {
- result.add(it)
- }
- }
-
- // 鏍规嵁姹℃煋鍥犲瓙鐨勯噺绾э紝璁$畻涓昏鐨勬薄鏌撳満鏅被鍨嬶紝绛涢�夌粨鏋�
- val mainSceneType = calSceneType(pollutedData)
- if (mainSceneType != null) {
-// this.conclusion = mainSceneType.first
- result = result.filter {
- val r = mainSceneType.second.find { s->
- s.value == it.typeId.toInt()
+ if (polygonTmp != null) {
+ val fb = MapUtil.calFourBoundaries(polygonTmp)
+ val sceneList = sceneInfoRep.findByCoordinateRange(fb)
+ // 2. 鍐嶇簿纭垽鏂槸鍚﹀湪鍙嶅悜婧簮鍖哄煙澶氳竟褰㈠唴閮�
+ sceneList.forEach {
+ val point = it!!.longitude.toDouble() to it.latitude.toDouble()
+ if (MapUtil.isPointInPolygon(point, polygonTmp)) {
+ result.add(it)
}
- r != null
- }.toMutableList()
- }
+ }
- this.sceneList = findClosestStation(sceneInfoRep, result)
+ val closePolygonTmp = pollutedArea.closePolygon!!
+ val closeFb = MapUtil.calFourBoundaries(closePolygonTmp)
+ val closeSceneList = sceneInfoRep.findByCoordinateRange(closeFb)
+ closeSceneList.forEach {
+ val point = it!!.longitude.toDouble() to it.latitude.toDouble()
+ if (MapUtil.isPointInPolygon(point, closePolygonTmp)) {
+ result.add(it)
+ }
+ }
+ // 鍘婚噸
+ result = result.distinctBy { it.guid }.toMutableList()
+
+ // 鏍规嵁姹℃煋鍥犲瓙鐨勯噺绾э紝璁$畻涓昏鐨勬薄鏌撳満鏅被鍨嬶紝绛涢�夌粨鏋�
+ val mainSceneType = calSceneType(pollutedData)
+ if (mainSceneType != null) {
+// this.conclusion = mainSceneType.first
+ result = result.filter {
+ val r = mainSceneType.second.find { s ->
+ s.value == it.typeId.toInt()
+ }
+ r != null
+ }.toMutableList()
+ }
+ this.sceneList = findClosestStation(sceneInfoRep, result)
+ }
val txt = summaryTxt(pollutedData, this.sceneList!!)
this.conclusion = txt
@@ -97,17 +101,17 @@
// 姘哀鍖栧悎鐗╋紝涓�鑸敱浜庢満鍔ㄨ溅灏炬皵锛屽悓姝ヨ绠桟O
FactorType.NO2 -> {
val coAvg = round(pollutedData.dataList.map { it.co!! }.average()) / 1000
- "姘哀鍖栧悎鐗╁亸楂橈紝CO鐨勯噺绾т负${coAvg}mg/m鲁锛屼竴鑸敱浜庢満鍔ㄨ溅灏炬皵閫犳垚锛屾薄鏌撴簮浠ユ苯淇�佸姞娌圭珯涓轰富" to
+ "姘哀鍖栧悎鐗╁亸楂橈紝CO鐨勯噺绾т负${coAvg}mg/m鲁锛屼竴鑸敱浜庢満鍔ㄨ溅灏炬皵閫犳垚锛屾薄鏌撴簮浠ユ苯淇�佸姞娌圭珯涓轰富" to
listOf(SceneType.TYPE6, SceneType.TYPE10, SceneType.TYPE17)
}
- FactorType.CO -> null
+ FactorType.CO -> null
- FactorType.H2S -> null
+ FactorType.H2S -> null
- FactorType.SO2 -> null
+ FactorType.SO2 -> null
- FactorType.O3 -> null
+ FactorType.O3 -> null
// a) pm2.5銆乸m10鐗瑰埆楂橈紝涓よ�呭湪鍚勬儏鍐典笅鍚屾灞曠ず锛宲m2.5鍗爌m10鐨勬瘮閲嶅彉鍖栵紝姣旈噸瓒婇珮锛岃秺鏈夊彲鑳芥槸椁愰ギ
// b) pm10鐗瑰埆楂樸�乸m2.5杈冮珮锛屽ぇ棰楃矑鎵皹姹℃煋锛屽彧灞曠ずpm10锛宲m2.5鍗爌m10鐨勬瘮閲嶅彉鍖栵紝宸ュ湴涓轰富
FactorType.PM25,
@@ -121,7 +125,7 @@
}.average()
val str =
"PM2.5閲忕骇涓�${pm25Avg}渭g/m鲁锛孭M10閲忕骇涓�${pm10Avg}渭g/m鲁锛孭M2.5鍗燩M10鐨勬瘮閲嶄负${round(percentageAvg * 100)}%"
- if (percentageAvg > 0.666) {
+ if (percentageAvg > 0.666) {
"${str}锛屾瘮閲嶈緝澶э紝姹℃煋婧愪互椁愰ギ涓轰富锛屽伐鍦版涔�" to
listOf(
SceneType.TYPE1,
@@ -156,11 +160,11 @@
val pm25Avg = round(pollutedData.dataList.map { it.pm25!! }.average() * 10) / 10
val coAvg = round(pollutedData.dataList.map { it.co!! }.average()) / 1000
val o3Avg = round(pollutedData.dataList.map { it.o3!! }.average() * 10) / 10
- "VOC鍋忛珮锛屽悓鏃禤M2.5閲忕骇涓�${pm25Avg}渭g/m鲁锛孋O閲忕骇涓�${coAvg}mg/m鲁锛孫3閲忕骇涓�${o3Avg}渭g/m鲁锛屾薄鏌撴簮浠ユ苯淇�佸姞娌圭珯涓轰富" to
+ "VOC鍋忛珮锛屽悓鏃禤M2.5閲忕骇涓�${pm25Avg}渭g/m鲁锛孋O閲忕骇涓�${coAvg}mg/m鲁锛孫3閲忕骇涓�${o3Avg}渭g/m鲁锛屾薄鏌撴簮浠ユ苯淇�佸姞娌圭珯涓轰富" to
listOf(SceneType.TYPE6, SceneType.TYPE17, SceneType.TYPE12)
}
- else -> null
+ else -> null
}
des = res?.first
res?.second?.let { sceneTypes.addAll(it) }
@@ -212,7 +216,7 @@
val et = DateUtil.instance.getTime(pollutedData.endTime)
var txt =
"鍦�${st}鑷�${et}涔嬮棿锛屽嚭鐜�${pollutedData.exception}"
- pollutedData.statisticMap.entries.forEach {s ->
+ pollutedData.statisticMap.entries.forEach { s ->
txt += "锛�${s.key.des}鏈�浣庡�间负${s.value.min}渭g/m鲁锛屾渶楂樺�间负${s.value.max}渭g/m鲁锛屽潎鍊间负${s.value.avg}渭g/m鲁"
}
if (sceneList.isEmpty()) {
--
Gitblit v1.9.3