From 27fbde9362485b38378e5a1abcb76d3e2a2a909e Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期四, 20 二月 2025 10:17:34 +0800 Subject: [PATCH] jtt808初始化 --- server/services/src/main/java/com/doumee/core/utils/PositionUtil.java | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/server/services/src/main/java/com/doumee/core/utils/PositionUtil.java b/server/services/src/main/java/com/doumee/core/utils/PositionUtil.java index 74294d2..fdd1f5f 100644 --- a/server/services/src/main/java/com/doumee/core/utils/PositionUtil.java +++ b/server/services/src/main/java/com/doumee/core/utils/PositionUtil.java @@ -1,6 +1,7 @@ package com.doumee.core.utils; +import com.alibaba.fastjson.JSONObject; import com.doumee.dao.business.web.request.LocaltionDTO; import java.awt.geom.GeneralPath; @@ -12,7 +13,30 @@ * 璁$畻璺濈 */ public class PositionUtil { + public static String getTxMapAddrByLatAndLng(Double lat,Double lng,String host,String mapkey){ + try { + if(lat == null || lng ==null){ + return null; + } + String url =host +"/ws/geocoder/v1/?key="+mapkey+"&location="+lat+","+lng; + String res = HttpsUtil.get(url,false); + JSONObject jsonObject = JSONObject.parseObject(res ); + String r = null; + if(jsonObject.getJSONObject("result")!=null){ + if(jsonObject.getJSONObject("result").getJSONObject("formatted_addresses")!=null){ + r =jsonObject.getJSONObject("result").getJSONObject("formatted_addresses").getString("formatted_addresses"); + } + if(r!=null && !r.equals("")){ + r =jsonObject.getJSONObject("result").getString("address"); + } + } + return r; + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } /** * 鍒ゆ柇鍧愭爣鐐规槸鍚﹀湪澶氳竟褰㈠尯鍩熷唴 * -- Gitblit v1.9.3