update 高德

This commit is contained in:
2023-06-26 15:36:05 +08:00
parent 73ccbe2c7d
commit 9711520f1e
4 changed files with 35 additions and 20 deletions

View File

@@ -25,8 +25,9 @@ public class AMapUtils {
private static String MERCHANT_PRIVATE_KEY;
private static String AMAP_PUBLIC_KEY;
private static String APP_ID;
private static String DEV_URL;
private static String PRD_URL;
// private static String DEV_URL;
// private static String PRD_URL;
private static String API_URL;
@Value("${aMap.merchantPrivateKey}")
public void setMerchantPrivateKey(String merchantPrivateKey) {
@@ -43,14 +44,19 @@ public class AMapUtils {
AMapUtils.APP_ID = appId;
}
@Value("${aMap.devUrl}")
public void setDevUrl(String devUrl) {
AMapUtils.DEV_URL = devUrl;
}
// @Value("${aMap.devUrl}")
// public void setDevUrl(String devUrl) {
// AMapUtils.DEV_URL = devUrl;
// }
@Value("${aMap.prdUrl}")
public void setPrdUrl(String prdUrl) {
AMapUtils.PRD_URL = prdUrl;
// @Value("${aMap.prdUrl}")
// public void setPrdUrl(String prdUrl) {
// AMapUtils.PRD_URL = prdUrl;
// }
@Value("${aMap.apiUrl}")
public void setApiUrl(String apiUrl) {
AMapUtils.API_URL = apiUrl;
}
/**
@@ -105,7 +111,7 @@ public class AMapUtils {
// 线上环境https://restapi.amap.com/rest/openmp/gw?key=高德云店秘钥key
// 高德云店秘钥key请登录高德云店「接入准备及配置」页面查看
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> resp = restTemplate.postForEntity(DEV_URL, entity, String.class);
ResponseEntity<String> resp = restTemplate.postForEntity(API_URL, entity, String.class);
if (resp.getBody() != null && !"".equals(resp.getBody())) {
JSONObject respObj = JSONObject.parseObject(resp.getBody());
System.out.println("高德返回结果:" + respObj);