添加高德地图相关配置

This commit is contained in:
Lemon
2023-06-15 17:52:04 +08:00
parent 6dd8e2f51e
commit 011876cb7e
2 changed files with 13 additions and 6 deletions

View File

@@ -30,6 +30,12 @@ public class AMapUtils {
@Value("${aMap.appId}")
private static String APP_ID;
@Value("${aMap.devUrl}")
private static String DEV_URL;
@Value("${aMap.prdUrl}")
private static String PRD_URL;
/**
* 使用商家私钥生成签名
*
@@ -81,9 +87,8 @@ public class AMapUtils {
// 线下联调环境https://restapi.amap.com/rest/openmp/devgw?key=高德云店秘钥key
// 线上环境https://restapi.amap.com/rest/openmp/gw?key=高德云店秘钥key
// 高德云店秘钥key请登录高德云店「接入准备及配置」页面查看
String url = "https://restapi.amap.com/rest/openmp/devgw?key=77ff5350723d29901fa859515f553644";
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> resp = restTemplate.postForEntity(url, entity, String.class);
ResponseEntity<String> resp = restTemplate.postForEntity(DEV_URL, entity, String.class);
if (resp.getBody() != null && !"".equals(resp.getBody())) {
JSONObject respObj = JSONObject.parseObject(resp.getBody());
System.out.println("高德返回结果:" + respObj);