From c96fbe6b0aeb413a17c429133ee6d81d138144b9 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 09 六月 2026 10:58:52 +0800
Subject: [PATCH] Merge branch '1.0' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi into 1.0
---
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/GaodeMapService.java | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/GaodeMapService.java b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/GaodeMapService.java
index 2fd921e..ff54db8 100644
--- a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/GaodeMapService.java
+++ b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/GaodeMapService.java
@@ -2,26 +2,29 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.xiaopeng.map.config.MapApiConfigHolder;
+import com.xiaopeng.map.config.MapApiProperties;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
-import org.springframework.beans.factory.annotation.Value;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
public class GaodeMapService {
-
- // 高德地图API基础URL
- private static final String WALKING_API_URL = "https://restapi.amap.com/v3/direction/walking";
-
- // 你的高德地图API Key
-// @Value("${map.apikey}")
- private String apiKey="66ae577f63898dae3016d599fda57221";
-
+
+ private final String walkingApiUrl;
+
+ private final String apiKey;
+
+ public GaodeMapService() {
+ MapApiProperties properties = MapApiConfigHolder.getProperties();
+ this.walkingApiUrl = properties.getUrls().getWalking();
+ this.apiKey = properties.getApiKey();
+ }
/**
* 获取步行路径规划
@@ -55,7 +58,7 @@
*/
private String buildWalkingUrl(String origin, String destination) {
return String.format("%s?origin=%s&destination=%s&key=%s",
- WALKING_API_URL,
+ walkingApiUrl,
origin,
destination,
apiKey);
@@ -112,4 +115,4 @@
return result;
}
-}
\ No newline at end of file
+}
--
Gitblit v1.7.1