liujie
2025-08-07 8ea377e0c6977ff0d97c4f2aa7986741600e4393
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/util/GDMapGeocodingUtil.java
@@ -100,6 +100,8 @@
    * @throws Exception
    */
   public static Map<String, String> geocode(String lon, String lan) throws Exception {
      System.out.println(lon+"_"+lan+"!!!!!!!!!!!!!!!!");
      String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + key + "&location=" + lon + "," + lan;
      String forObject = HttpUtils.sendGet(url);
      JSONObject jsonObject = JSON.parseObject(forObject);
@@ -116,6 +118,7 @@
         String province = addressComponent.getString("province");
         String city = addressComponent.getString("city");
         String district = addressComponent.getString("district");
         System.out.println(code+"#######################");
         map.put("province", province);
         map.put("provinceCode", code.substring(0, 2) + "0000");
         map.put("city", city);
@@ -125,4 +128,10 @@
      }
      return map;
   }
   public static void main(String[] args) throws Exception {
      Map<String, String> geocode = geocode("140.0136050", "19.51689069");
   }
}