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/domain/repository/SceneInfoRep.kt | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/repository/SceneInfoRep.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/SceneInfoRep.kt
index e38cd28..5ebde44 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/repository/SceneInfoRep.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/repository/SceneInfoRep.kt
@@ -1,5 +1,6 @@
package com.flightfeather.uav.domain.repository
+import com.flightfeather.uav.common.utils.MapUtil
import com.flightfeather.uav.domain.entity.SceneInfo
import com.flightfeather.uav.domain.mapper.SceneInfoMapper
import com.flightfeather.uav.lightshare.bean.AreaVo
@@ -41,4 +42,30 @@
.andLessThanOrEqualTo("latitude", range[3])
})
}
+
+ /**
+ * 鏍规嵁澶氳竟褰㈢瓫閫夊満鏅�
+ * @param polygon 澶氳竟褰㈠潗鏍囧垪琛紝椤哄簭涓洪『鏃堕拡鎴栭�嗘椂閽�(瑕佹眰浣跨敤鐏槦鍧愭爣绯�)
+ * @return 澶氳竟褰㈠唴鐨勫満鏅垪琛�
+ */
+ fun findByPolygon(polygon: List<Pair<Double, Double>>): List<SceneInfo?> {
+ // 璁$畻澶氳竟褰㈠洓鑷宠寖鍥�
+ val bounds = MapUtil.calFourBoundaries(polygon)
+ val sceneList = findByCoordinateRange(bounds)
+ // 绛涢�夋槸鍚﹀湪鍙嶅悜婧簮鍖哄煙澶氳竟褰㈠唴閮�
+ return sceneList.filter { scene ->
+ scene ?: false
+ val point = scene!!.longitude.toDouble() to scene.latitude.toDouble()
+ MapUtil.isPointInPolygon(point, polygon)
+ }
+ }
+
+ fun findBySceneTypes(sceneTypes: List<Int>): List<SceneInfo?> {
+ if (sceneTypes.isEmpty()){
+ return emptyList()
+ }
+ return sceneInfoMapper.selectByExample(Example(SceneInfo::class.java).apply {
+ createCriteria().andIn("typeId", sceneTypes)
+ })
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3