|
@@ -1,6 +1,7 @@
|
|
package com.zfire.jiasm.syncdata.service.impl;
|
|
package com.zfire.jiasm.syncdata.service.impl;
|
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
+import cn.hutool.json.JSONArray;
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
@@ -838,6 +839,24 @@ public class PublicServiceImpl implements PublicService {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 根据地址反查经纬度
|
|
|
|
+ @Override
|
|
|
|
+ public String getLocationByAddress(String address){
|
|
|
|
+ String url = "https://restapi.amap.com/v3/geocode/geo?key="+lbsWebKey+"&address="+address;
|
|
|
|
+ String s = HttpUtil.get(url);
|
|
|
|
+ JSONObject jsonObject = new JSONObject(s);
|
|
|
|
+ String status = jsonObject.getStr("status");
|
|
|
|
+ if(!status.equals("1")){
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ JSONArray geocodes = jsonObject.getJSONArray("geocodes");
|
|
|
|
+ if(org.springframework.util.CollectionUtils.isEmpty(geocodes))
|
|
|
|
+ return null;
|
|
|
|
+ Map<String, Object> map = (Map<String, Object>) geocodes.get(0);
|
|
|
|
+ String location = (String)map.get("location");
|
|
|
|
+ return location;
|
|
|
|
+ }
|
|
|
|
+
|
|
// 获取gpsaddress
|
|
// 获取gpsaddress
|
|
@Override
|
|
@Override
|
|
public String getGpsaddress(String lng, String lat){
|
|
public String getGpsaddress(String lng, String lat){
|