From b212ef0208cb094f63ea8a239a1361f8e859c839 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 08 七月 2024 17:40:39 +0800
Subject: [PATCH] 2024.7.8

---
 src/main/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearby.kt |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearby.kt b/src/main/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearby.kt
index 5719d4e..9b73da9 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearby.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearby.kt
@@ -3,12 +3,14 @@
 import cn.flightfeather.supervision.common.utils.ExcelUtil
 import cn.flightfeather.supervision.domain.ds1.entity.Scense
 import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper
+import org.springframework.stereotype.Component
 import tk.mybatis.mapper.entity.Example
 import kotlin.math.PI
 
 /**
  * 璺鍛ㄨ竟鏌ヨ
  */
+@Component
 class LocationRoadNearby(private val scenseMapper: ScenseMapper) {
 
     private val utilFile = UtilFile()
@@ -51,7 +53,27 @@
             }
             utilFile.index = 1
         }
-        utilFile.outPutToFile()
+        utilFile.outPutToFile(distance)
+    }
+
+    /**
+     * 鏍规嵁鍦嗗績鍜屽崐寰勬煡璇㈣寖鍥村唴鐩戞祴鐐癸紙褰撳墠绠�鍖栨搷浣滐紝鏀逛负浠ョ洿寰勪负杈归暱鐨勬鏂瑰舰鑼冨洿锛�
+     * @param center 鍦嗗績
+     * @param radius 鍗婂緞锛堝崟浣嶏細绫筹級
+     * @return 鍦烘櫙鍒楄〃
+     */
+    fun searchByRadius(center: Pair<Double, Double>, radius: Double): List<Scense> {
+        // 姹傜粡搴︾殑鏈�灏忓��
+        val minLng = CoordinateUtil.getPointByLen(center, radius, PI * 1.5).first
+        // 姹傜粡搴︾殑鏈�澶у��
+        val maxLng = CoordinateUtil.getPointByLen(center, radius, PI * 0.5).first
+        // 姹傜含搴︾殑鏈�灏忓��
+        val minLat = CoordinateUtil.getPointByLen(center, radius, PI).second
+        // 姹傜含搴︾殑鏈�澶у��
+        val maxLat = CoordinateUtil.getPointByLen(center, radius, .0).second
+
+        val list = listOf(minLng, maxLng, minLat, maxLat)
+        return getSceneFromDb(list)
     }
 
     /**
@@ -88,11 +110,4 @@
                 .orIsNull("extension1"))
         })
     }
-
-    /**
-     * 绮剧‘璁$畻
-     */
-//    private fun checkDistance(scense: Scense):Boolean {
-//
-//    }
 }
\ No newline at end of file

--
Gitblit v1.9.3