feat:门店经纬度更新
This commit is contained in:
@@ -2,6 +2,7 @@ package com.cool.store.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -44,6 +45,7 @@ public class GeoMapUtil {
|
||||
content.append(inputLine);
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.parseObject(content.toString());
|
||||
|
||||
// 提取并构建AddressInfo对象
|
||||
AddressInfo addressInfo = extractAddressInfo(jsonObject.getJSONObject("regeocode"));
|
||||
return addressInfo;
|
||||
@@ -66,8 +68,8 @@ public class GeoMapUtil {
|
||||
if (geoJson==null){
|
||||
return new AddressInfo();
|
||||
}
|
||||
JSONObject addressComponent = geoJson.getJSONObject("addressComponent");
|
||||
try {
|
||||
JSONObject addressComponent = geoJson.getJSONObject("addressComponent");
|
||||
// 根据实际响应结构解析省市区街道信息,此处仅为示例
|
||||
String province = (String) addressComponent.get("province");
|
||||
String city = addressComponent.get("city") instanceof String?(String) addressComponent.get("city"):province;
|
||||
@@ -76,7 +78,7 @@ public class GeoMapUtil {
|
||||
String address = geoJson.getString("formatted_address");
|
||||
new AddressInfo(province, city, district, township, address);
|
||||
}catch (Exception exception){
|
||||
log.info("高德数据获取异常{}",exception.getMessage());
|
||||
log.info("高德数据获取异常{},{}", JSONObject.toJSONString(addressComponent),exception.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user