111
k94314517
2025-02-20 68057e752bd9767e76c021610966719e3a227467
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;
@@ -13,6 +14,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;
    }
    /**
     * 判断坐标点是否在多边形区域内
     *