‘linchangsheng’ 1 week ago
parent
commit
b4cee654b4

+ 3 - 0
src/main/java/com/gree/mall/miniapp/bean/user/RegionBean.java

@@ -33,5 +33,8 @@ public class RegionBean {
     @ApiModelProperty(value = "街道名称")
     private String name;
 
+    @ApiModelProperty(value = "详细地址")
+    private String formattedAddress;
+
 
 }

+ 3 - 0
src/main/java/com/gree/mall/miniapp/logic/LbsAmapLogic.java

@@ -1,5 +1,6 @@
 package com.gree.mall.miniapp.logic;
 
+import cn.hutool.core.convert.Convert;
 import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
@@ -62,6 +63,7 @@ public class LbsAmapLogic {
         }
         JSONObject regeocode = jsonObject.getJSONObject("regeocode");
         JSONObject addressComponent = regeocode.getJSONObject("addressComponent");
+        Object formatted_address = regeocode.get("formatted_address");
         Map<String,String> map = new HashMap<>();
         map.put("province",addressComponent.getStr("province"));
         if(addressComponent.getStr("city").equals("[]")) {
@@ -93,6 +95,7 @@ public class LbsAmapLogic {
         regionBean.setCityName(city);
         regionBean.setAreaName(area);
         regionBean.setName(street);
+        regionBean.setFormattedAddress(Convert.toStr(formatted_address));
         return regionBean;
     }