|
|
@@ -10,6 +10,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
|
|
import org.springframework.util.MultiValueMap;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
|
@Component
|
|
|
@@ -42,6 +43,31 @@ public class RemoteUtil {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
+ public String getBaiduPoint(String lng,String lat) {
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
|
|
+
|
|
|
+ MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
|
|
+ map.add("coords", lng+","+lat);
|
|
|
+ map.add("model", "1");
|
|
|
+ map.add("ak","UZyauBmbunmSuxGmKedUXmrkNjq5WVKr");
|
|
|
+
|
|
|
+ HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
|
|
|
+
|
|
|
+ String result = restTemplate.postForObject("https://api.map.baidu.com/geoconv/v2/", 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 getHospitalCode(String mac) {
|
|
|
|
|
|
HttpEntity<String> request = new HttpEntity<String>(mac);
|