|
@@ -47,6 +47,31 @@ public class RemoteUtil {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
|
|
|
|
|
|
|
|
|
+ MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
|
|
|
|
+ map.add("coords", lng+","+lat);
|
|
|
|
|
+ map.add("from", "1");
|
|
|
|
|
+ map.add("ak","UZyauBmbunmSuxGmKedUXmrkNjq5WVKr");
|
|
|
|
|
+
|
|
|
|
|
+ HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
|
|
|
|
|
+
|
|
|
|
|
+ String result = restTemplate.postForObject("http://api.map.baidu.com/geoconv/v1/", request, String.class);
|
|
|
|
|
+ System.out.println("result========="+result);
|
|
|
|
|
+ JSONObject json = JSONObject.parseObject(result);
|
|
|
|
|
+ if(json.containsKey("result")) {
|
|
|
|
|
+ JSONArray array = json.getJSONArray("result");
|
|
|
|
|
+ if(array.size()>0) {
|
|
|
|
|
+ JSONObject record = array.getJSONObject(0);
|
|
|
|
|
+ return record.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getBaiduPoint2(String lng,String lat) {
|
|
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
|
|
+ headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
|
|
|
|
+
|
|
|
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
|
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
|
|
map.add("coords", lng+","+lat);
|
|
map.add("coords", lng+","+lat);
|
|
|
map.add("model", "1");
|
|
map.add("model", "1");
|