From 8652e69d17ab0c1a5884c662a9f3f950ddf57948 Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期二, 15 七月 2025 16:16:11 +0800 Subject: [PATCH] 优化 和修改bug --- springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/utils/BaiduMapUtil.java | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/utils/BaiduMapUtil.java b/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/utils/BaiduMapUtil.java index 3039ec7..a329abc 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/utils/BaiduMapUtil.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/utils/BaiduMapUtil.java @@ -10,6 +10,7 @@ import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; +import java.net.URLEncoder; import java.util.LinkedHashMap; import java.util.Map; @@ -36,6 +37,8 @@ // // //requestGetAK(URL, params); + JSONArray jsonArray = searchLocation("天安门", "39.909,116.39742"); + System.out.println(jsonArray.size()); System.out.println(geoconv("116.390838,39.916245").toJSONString()); } @@ -57,7 +60,7 @@ for (Map.Entry<?, ?> pair : param.entrySet()) { queryString.append(pair.getKey() + "="); // 第一种方式使用的 jdk 自带的转码方式 第二种方式使用的 spring 的转码方法 两种均可 - // queryString.append(URLEncoder.encode((String) pair.getValue(), "UTF-8").replace("+", "%20") + "&"); +// queryString.append(URLEncoder.encode((String) pair.getValue(), "UTF-8").replace("+", "%20") + "&"); queryString.append(UriUtils.encode((String) pair.getValue(), "UTF-8") + "&"); } @@ -104,6 +107,9 @@ } return jsonArray; } + + + public static JSONObject requestGetAKObject(String strUrl, Map<String, String> param) throws Exception { if (strUrl == null || strUrl.length() <= 0 || param == null || param.size() <= 0) { return new JSONObject(); -- Gitblit v1.7.1