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