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-order-boot/src/main/java/com/xiaopeng/order/utils/GDMapGeocodingUtil.java | 29 ++++++++++++-----------------
1 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/utils/GDMapGeocodingUtil.java b/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/utils/GDMapGeocodingUtil.java
index 28172c0..f618699 100644
--- a/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/utils/GDMapGeocodingUtil.java
+++ b/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/utils/GDMapGeocodingUtil.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson2.JSONObject;
import com.xiaopeng.common.core.utils.HttpUtils;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
@@ -18,23 +19,17 @@
@Lazy
public class GDMapGeocodingUtil {
- private String key = "66ae577f63898dae3016d599fda57221";
+ @Value("${map.api-key}")
+ private String key;
+ @Value("${map.urls.route-price}")
+ private String routePriceUrl;
- public static void main(String[] args) {
- String url = "https://tsapi.amap.com/v1/route/price?key=" + "66ae577f63898dae3016d599fda57221" + "&extensions=all&start=" +"113.384932" + "," + "23.155455";
- HashMap<String, Object> params = new HashMap<>();
- params.put("extensions", "all");
- params.put("start", "113.384932" + "," + "23.155455");
- params.put("end", "113.388209" + "," + "23.163455");
- params.put("routeUserType",2);
- log.info("高德地图接口:{}", url);
- log.info("高德地图参数:{}", params);
- String post = HttpUtils.post(url, JSON.toJSONString(params));
- log.info("高德地图返回结果:"+ post);
- JSONObject jsonObject = JSON.parseObject(post);
- System.out.println(jsonObject);
- }
+ @Value("${map.urls.route-query}")
+ private String routeQueryUrl;
+
+ @Value("${map.urls.reverse-geocode}")
+ private String reverseGeocodeUrl;
/**
@@ -44,7 +39,7 @@
* @return
*/
public String routed(String routeID){
- String url = "https://tsapi.amap.com/v1/route/query/routeid?key=" + key;
+ String url = routeQueryUrl + "?key=" + key;
HashMap<String, Object> params = new HashMap<>();
params.put("routeID", routeID);
params.put("sdkVersion", "9.850.152.3.532");
@@ -64,7 +59,7 @@
* @throws Exception
*/
public Map<String, String> geocode(String lon, String lan) {
- String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + key + "&location=" + lon + "," + lan;
+ String url = reverseGeocodeUrl + "?key=" + key + "&location=" + lon + "," + lan;
String forObject = HttpUtils.sendGet(url);
JSONObject jsonObject = JSON.parseObject(forObject);
Map<String, String> map = new HashMap<>();
--
Gitblit v1.7.1