zhanghan 5 月之前
父节点
当前提交
4a81246c60
共有 41 个文件被更改,包括 2261 次插入39 次删除
  1. 7 1
      pom.xml
  2. 1 1
      src/main/java/com/skyversation/poiaddr/PoiAddrApplication.java
  3. 204 0
      src/main/java/com/skyversation/poiaddr/addquery/AddressQueryEngine.java
  4. 76 0
      src/main/java/com/skyversation/poiaddr/addquery/AddressTools.java
  5. 34 0
      src/main/java/com/skyversation/poiaddr/addquery/Constant.java
  6. 136 0
      src/main/java/com/skyversation/poiaddr/addquery/TransfromDataTool.java
  7. 59 0
      src/main/java/com/skyversation/poiaddr/bean/AddressResult.java
  8. 26 0
      src/main/java/com/skyversation/poiaddr/bean/GeoJsonBean.java
  9. 54 0
      src/main/java/com/skyversation/poiaddr/bean/Village.java
  10. 31 0
      src/main/java/com/skyversation/poiaddr/bean/WDToken.java
  11. 330 0
      src/main/java/com/skyversation/poiaddr/bean/Zerenwangluo.java
  12. 9 0
      src/main/java/com/skyversation/poiaddr/callback/AddressQueryCallBack.java
  13. 8 9
      src/main/java/com/skyversation/poiaddr/controller/PoiAddressController.java
  14. 2 2
      src/main/java/com/skyversation/poiaddr/dao/PoiAddressRepository.java
  15. 1 1
      src/main/java/com/skyversation/poiaddr/entity/FeatureDiy.java
  16. 1 1
      src/main/java/com/skyversation/poiaddr/entity/FileDataDto.java
  17. 1 1
      src/main/java/com/skyversation/poiaddr/entity/GeometryDiy.java
  18. 1 1
      src/main/java/com/skyversation/poiaddr/entity/PoiAddress.java
  19. 369 0
      src/main/java/com/skyversation/poiaddr/service/AreaService.java
  20. 2 2
      src/main/java/com/skyversation/poiaddr/service/PoiAddressService.java
  21. 4 4
      src/main/java/com/skyversation/poiaddr/service/impl/PoiAddressServiceImpl.java
  22. 1 1
      src/main/java/com/skyversation/poiaddr/util/CoordTransform.java
  23. 796 0
      src/main/java/com/skyversation/poiaddr/util/CoordTransform2.java
  24. 1 1
      src/main/java/com/skyversation/poiaddr/util/Coordinate.java
  25. 1 1
      src/main/java/com/skyversation/poiaddr/util/ExcelReaderUtils.java
  26. 1 1
      src/main/java/com/skyversation/poiaddr/util/RequestUtils.java
  27. 2 3
      src/main/java/com/skyversation/poiaddr/util/dms/login.java
  28. 3 3
      src/main/java/com/skyversation/poiaddr/util/fileTools/ReadFileData.java
  29. 1 1
      src/main/java/com/skyversation/poiaddr/util/geotools/GeoHelpScript.java
  30. 1 1
      src/main/java/com/skyversation/poiaddr/util/geotools/GeoJsonPointInRegion.java
  31. 1 1
      src/main/java/com/skyversation/poiaddr/util/geotools/GeometryIntersectionAndDisjoint.java
  32. 68 0
      src/main/java/com/skyversation/poiaddr/util/net/AddressNetTools.java
  33. 12 0
      src/main/java/com/skyversation/poiaddr/util/status/AddressLevel.java
  34. 14 0
      src/main/java/com/skyversation/poiaddr/util/status/AddressResultEnum.java
  35. 1 1
      src/main/java/com/skyversation/poiaddr/util/zipunit/CompressUtil.java
  36. 1 1
      src/main/java/com/skyversation/poiaddr/util/zipunit/FileInfo.java
  37. 0 0
      src/main/resources/geojson/qp_cunju.geojson
  38. 0 0
      src/main/resources/geojson/zerenwangluo.json
  39. 0 0
      src/main/resources/geojson/责任网格-wgs84.geojson
  40. 0 0
      src/main/resources/geojson/青浦区微网格-wgs84.geojson
  41. 1 1
      src/test/java/com/skyversation/poiaddr/PoiAddrApplicationTests.java

+ 7 - 1
pom.xml

@@ -8,7 +8,7 @@
         <version>2.5.2</version>
         <relativePath/> <!-- lookup parent from repository -->
     </parent>
-    <groupId>com.example</groupId>
+    <groupId>com.skyversation</groupId>
     <artifactId>place_name_search</artifactId>
     <version>0.0.1-SNAPSHOT</version>
     <name>place_name_search</name>
@@ -94,6 +94,7 @@
             <artifactId>jts-core</artifactId>
             <version>1.19.0</version>
         </dependency>
+        <!--        空间地理信息工具类-->
         <dependency>
             <groupId>org.geotools</groupId>
             <artifactId>gt-geojson</artifactId>
@@ -119,6 +120,11 @@
             <artifactId>gt-metadata</artifactId>
             <version>${geotools.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.geotools</groupId>
+            <artifactId>gt-referencing</artifactId>
+            <version>${geotools.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>

+ 1 - 1
src/main/java/com/example/poiaddr/PoiAddrApplication.java → src/main/java/com/skyversation/poiaddr/PoiAddrApplication.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr;
+package com.skyversation.poiaddr;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;

+ 204 - 0
src/main/java/com/skyversation/poiaddr/addquery/AddressQueryEngine.java

@@ -0,0 +1,204 @@
+package com.skyversation.poiaddr.addquery;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.skyversation.poiaddr.bean.AddressResult;
+import com.skyversation.poiaddr.bean.GeoJsonBean;
+import com.skyversation.poiaddr.bean.WDToken;
+import com.skyversation.poiaddr.service.AreaService;
+import com.skyversation.poiaddr.util.net.AddressNetTools;
+import com.skyversation.poiaddr.util.status.AddressLevel;
+import com.skyversation.poiaddr.util.status.AddressResultEnum;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+import java.util.Map;
+
+public class AddressQueryEngine {
+
+    private static AddressQueryEngine instance = new AddressQueryEngine();
+    private AddressQueryEngine(){}
+    public synchronized static AddressQueryEngine getInstance(){
+        if(instance == null){
+            instance = new AddressQueryEngine();
+        }
+        return instance;
+    }
+
+    private WDToken wdToken = null;
+
+    public static void main(String[] args) {
+
+        AddressQueryEngine.getInstance().gdV3SearchByName("上海市青浦区徐泾镇尚茂路226弄通用昱慧苑");
+    }
+
+    /***
+     * 单条地名搜索通用方法,搜索顺序  1. 武大吉奥; 2. 市四中心; 3. 高德搜索; 4. 高德高级搜索;
+     * @param addrs
+     * @param level 搜索等级:
+     *              1. 搜索到结果就返回第一个;
+     *              2. 搜索到结果去除行政区划后,存在包含关系,则使用;
+     *              3. 搜索到结果,数字进行分词,数字匹配则使用;
+     *              4. 搜索到结果,数字与文本均匹配,则使用;
+     *              5. 结果与基准数据完全一致,则使用。
+     * @return
+     */
+    public AddressResult commonSearchByName(String[] addrs, AddressLevel level){
+        if(addrs == null || addrs.length < 1){
+            return null;
+        }
+        for(String addr : addrs){
+            verificaData(wdjaSearchByName(addr), level);
+        }
+    }
+
+    /***
+     * 武大吉奥单条地名搜索
+     * @param address
+     */
+    public AddressResult wdjaSearchByName(String address){
+        System.out.println("<<<<<<<<<<----------开始武大吉奥地名地址搜索------------>>>>>>>>>>>>>");
+        if(wdToken == null || System.currentTimeMillis() - wdToken.getTime() > 36000000){
+            wdToken = AddressTools.getInstance().getWDToken(Constant.WD_USER_NAME, Constant.WD_USER_PWD);
+            wdToken.setTime(System.currentTimeMillis());
+        }
+        if(wdToken == null)
+            return AddressTools.getInstance().faildQuery(AddressResultEnum.NO_TOKEN, "token获取失败");
+        String token = wdToken.getToken();
+
+        String url = Constant.GET_ADDRESS_MEG_URL + "?token=" + token + "&addr=" + address;
+        String body = null;
+        try {
+            body = AddressNetTools.getInstance().wdSendGetRequest(url);
+        } catch (Exception e) {
+            e.toString();
+        }
+        if(body == null || body.equals("null") || !StringUtils.hasText(body))
+            return AddressTools.getInstance().faildQuery(AddressResultEnum.RESULT_NULL, "搜索无结果");
+        try {
+            JSONObject json = JSONObject.parseObject(body);
+            return TransfromDataTool.wdResultToResult(json);
+        } catch (Exception e){
+            return AddressTools.getInstance().faildQuery(AddressResultEnum.DATA_FROMAT_FAILD, "格式化失败");
+        }
+    }
+
+    /***
+     * 市四中心地名搜索
+     * @param address
+     * @return
+     */
+    public AddressResult szxSearchByName(String address){
+        ResponseEntity response = AddressNetTools.getInstance().requestGet(Constant.SZX_URL + address, null, null);
+        String body = response.getBody() + "";
+        if(!StringUtils.hasText(body))
+            return AddressTools.getInstance().faildQuery(AddressResultEnum.RESULT_NULL, "搜索无结果");
+        try {
+            JSONObject json = JSONObject.parseObject(body);
+            return TransfromDataTool.szxResultToResult(json);
+        } catch (Exception e){
+            return AddressTools.getInstance().faildQuery(AddressResultEnum.DATA_FROMAT_FAILD, "格式化失败");
+        }
+    }
+
+    /***
+     * 高德普通地名搜索
+     * @param address
+     * @return
+     */
+    public AddressResult gdSearchByName(String address){
+        String geoUrl = Constant.AMAP_GEO_URL + "?key=" + Constant.AMAP_KEY + "&address=" + address + "&city=" + Constant.AMAP_CITY_CODE + "&output=JSON";
+        ResponseEntity response = AddressNetTools.getInstance().requestGet(geoUrl, null, null);
+        String body = response.getBody() + "";
+        if(!StringUtils.hasText(body))
+            return AddressTools.getInstance().faildQuery(AddressResultEnum.RESULT_NULL, "搜索无结果");
+        JSONObject json = JSONObject.parseObject(body);
+        return TransfromDataTool.gdResultToResult(json);
+    }
+
+    /***
+     * 高德高级地名搜索
+     * @param address
+     * @return
+     */
+    public AddressResult gdV3SearchByName(String address){
+        String geoUrl =
+                Constant.AMAP_SEARCH_NAME_V3 + "?key=" + Constant.AMAP_KEY + "&types=" + Constant.AMAP_SEARCH_TYPES +
+                        "&keywords=" + address + "&city=" + Constant.AMAP_CITY_CODE + "&offset=20";
+        System.out.println("geoUrl:" + geoUrl);
+        String body = null;
+        body = AddressNetTools.getInstance().requestGet(geoUrl,null, null).getBody() + "";
+        if(!StringUtils.hasText(body)){
+            return AddressTools.getInstance().faildQuery(AddressResultEnum.RESULT_NULL, "搜索无结果");
+        }
+        JSONArray pois = new JSONArray();
+        JSONObject json = JSONObject.parseObject(body);
+        pois.addAll(json.getJSONArray("pois"));
+
+        int count = Integer.valueOf(json.get("count") + "");
+        if(count > 20){
+            for(int i = 2; i < (count % 20 + 1); i ++){
+                geoUrl =
+                        Constant.AMAP_SEARCH_NAME_V3 + "?key=" + Constant.AMAP_KEY + "&types=" + Constant.AMAP_SEARCH_TYPES +
+                                "&keywords=" + address + "&city=" + Constant.AMAP_CITY_CODE + "&offset=20&page=" + i;
+                body = AddressNetTools.getInstance().requestGet(geoUrl,null, null).getBody() + "";
+                if(!StringUtils.hasText(body)){
+                    return AddressTools.getInstance().faildQuery(AddressResultEnum.RESULT_AGAIN_NULL, "多次搜索无结果");
+                }
+                pois.addAll(JSONObject.parseObject(body).getJSONArray("pois"));
+            }
+        }
+        return TransfromDataTool.gdV3ResultToResult(pois);
+    }
+
+
+    /***
+     * 根据搜索地址,赋值村居、网格、微格网信息
+     * @param result
+     * @return
+     */
+    public AddressResult getCjWgWgwByLoc(AddressResult result){
+        if(result == null || result.getData() == null || result.getData().size() < 1){
+            return result;
+        } else {
+            for(AddressResult.ContentBean content : result.getData()){
+                GeoJsonBean cjBean = AreaService.getInstance().isInCJPolygon(content.getLon(), content.getLat());
+                content.setCjJson(cjBean == null ? new JSONObject() : cjBean.getProperties());
+                GeoJsonBean gridBean = AreaService.getInstance().isInGridPolygon(content.getLon(), content.getLat());
+                content.setWgwJson(gridBean == null ? new JSONObject() : gridBean.getProperties());
+                GeoJsonBean wgridBean = AreaService.getInstance().isInWGridPolygon(content.getLon(), content.getLat());
+                content.setWgwJson(wgridBean == null ? new JSONObject() : wgridBean.getProperties());
+            }
+            return result;
+        }
+    }
+
+    public AddressResult.ContentBean verificaData(AddressResult result, AddressLevel level){
+        switch (level){
+            case LEVEL_1 -> {
+                if(result != null && result.getData() != null && result.getData().size() > 0){
+                    return result.getData().get(0);
+                } else {
+                    return null;
+                }
+            }
+            case LEVEL_CONTAINS_2 -> {
+
+            }
+            case LEVLE_NUMBER_3 -> {
+
+            }
+            case LEVEL_NUMBER_TEXT_4 -> {
+
+            }
+            case LEVEL_TOTAL_CONTAINS_5 -> {
+
+            }
+            default -> {
+                return null;
+            }
+        }
+    }
+
+}

+ 76 - 0
src/main/java/com/skyversation/poiaddr/addquery/AddressTools.java

@@ -0,0 +1,76 @@
+package com.skyversation.poiaddr.addquery;
+
+import com.alibaba.fastjson.JSONObject;
+import com.skyversation.poiaddr.bean.WDToken;
+import com.skyversation.poiaddr.util.net.AddressNetTools;
+import com.skyversation.poiaddr.bean.AddressResult;
+import com.skyversation.poiaddr.util.status.AddressResultEnum;
+import org.springframework.http.ResponseEntity;
+
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class AddressTools {
+
+    private static AddressTools instance = new AddressTools();
+    private AddressTools(){}
+    public synchronized static AddressTools getInstance(){
+        if(instance == null){
+            instance = new AddressTools();
+        }
+        return instance;
+    }
+
+    public WDToken getWDToken(String userName, String pwd){
+        long time = System.currentTimeMillis() / 1000;
+        System.out.println("当前时间为:" + time);
+        String secret = time + pwd;
+        System.out.println("当前secret为:" + secret);
+        secret = md5_32(secret);
+        System.out.println("加密后secret为:" + secret);
+
+        String param = "?user=" + userName + "&secret=" + secret + "&time=" + time;
+        System.out.println("准备获取token,获取地址为:" + Constant.GET_TOKEN_URL + param);
+        String body = AddressNetTools.getInstance().requestGet(Constant.GET_TOKEN_URL + param, null, null).getBody() + "";
+        WDToken wdToken = JSONObject.parseObject(body, WDToken.class);
+        System.out.println("获取token完成,返回信息为:" + body);
+        return wdToken;
+    }
+
+    private String md5_32(String msg){
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            byte[] messageDigest = md.digest(msg.getBytes());
+            BigInteger no = new BigInteger(1, messageDigest);
+            String hashtext = no.toString(16);
+            while (hashtext.length() < 32) {
+                hashtext = "0" + hashtext;
+            }
+            return hashtext;
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public static JSONObject agineGetAddress(String address) {
+        for (int i = 0; i < 10; i++) {
+            ResponseEntity response = AddressNetTools.getInstance().requestGet(Constant.SZX_URL + address, null, null);
+            if (response != null) {
+                JSONObject json = null;
+                try {
+                    json = JSONObject.parseObject(response.getBody() + "");
+                    return json;
+                } catch (Exception e) {
+                    e.toString();
+                }
+            }
+        }
+        return null;
+    }
+
+    public AddressResult faildQuery(AddressResultEnum code, String message){
+        return new AddressResult(code, message);
+    }
+
+}

+ 34 - 0
src/main/java/com/skyversation/poiaddr/addquery/Constant.java

@@ -0,0 +1,34 @@
+package com.skyversation.poiaddr.addquery;
+
+import org.springframework.beans.factory.annotation.Value;
+
+public class Constant {
+    public static Constant instance = new Constant();
+
+    private Constant(){};
+
+    public static Constant getInstance(){
+        if(instance == null)
+            instance = new Constant();
+        return instance;
+    }
+
+    public static final String WD_USER_NAME = "yuanyi";
+    public static final String WD_USER_PWD = "yuanyi@123";
+    public static final String GET_TOKEN_URL = "http://10.235.245.226:7010/addrMatch/auth/getToken";
+    public static final String GET_ADDRESS_MEG_URL = "http://10.235.245.226:7010/addrMatch/addrApi/searchAddr";
+    public static final String SZX_URL = "https://service-api.onemap.sh.gov.cn/data-service-manage-service/MapProxyApi/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBsaWNhdGlvbl9pZCI6NjEsImFwcGxpY2F0aW9uX25hbWUiOiLpnZLmtabkuozkuInnu7TmnI3liqHns7vnu58iLCJleHAiOjIwNDY2Nzg0MDN9.IKUMdjUX4U1jncIUNren-iotL7duXI90aLECMjpvUX8/address_search/MapServer?region=310000&page_num=1&page_size=10&query=";
+
+    public static String AMAP_GEO_URL = "https://restapi.amap.com/v3/geocode/geo";
+    public static String AMAP_REGEO_URL = "https://restapi.amap.com/v3/geocode/regeo";
+    public static String AMAP_SEARCH_NAME_V3 = "https://restapi.amap" +
+            ".com/v3/place/text";
+    public static String AMAP_SEARCH_TYPES = "010000|020000|030000|040000|050000|060000|070000|080000|090000" +
+            "|100000|110000|120000|130000|140000|150000|160000|170000|180000|190000|200000|220000|970000|980000|990000";
+
+    @Value("${amap_key}")
+    public static  String AMAP_KEY = "161e0c673807a9586ba5a115da2a0112";
+    @Value("${amap_city_code}")
+    public static  String AMAP_CITY_CODE = "310118";
+
+}

+ 136 - 0
src/main/java/com/skyversation/poiaddr/addquery/TransfromDataTool.java

@@ -0,0 +1,136 @@
+package com.skyversation.poiaddr.addquery;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.skyversation.poiaddr.bean.AddressResult;
+import com.skyversation.poiaddr.util.CoordTransform2;
+import com.skyversation.poiaddr.util.status.AddressResultEnum;
+
+import java.util.ArrayList;
+
+public class TransfromDataTool {
+
+    public static AddressResult wdResultToResult(JSONObject json){
+        AddressResult result = new AddressResult();
+        JSONArray array = json.getJSONObject("data").getJSONArray("addrList");
+        if(array == null || array.size() < 1){
+            result.setCode(AddressResultEnum.RESULT_NULL);
+            return result;
+        }
+        for(int i = 0;i < array.size(); i ++){
+            JSONObject jsonObject = array.getJSONObject(i);
+            AddressResult.ContentBean content = new AddressResult.ContentBean();
+            content.setPname(jsonObject.getString("city"));
+            content.setCityname(jsonObject.getString("city"));
+            content.setAdname(jsonObject.getString("town"));
+            content.setCommunity(jsonObject.getString("community"));
+            content.setCommunityCode(jsonObject.getString("communitycode"));
+            content.setType(jsonObject.getString("datasource"));
+            content.setAddress(jsonObject.getString("addr"));
+            content.setDistance(jsonObject.getString("lv"));
+            content.setName(jsonObject.getString("addr"));
+            double[] points = CoordTransform2.getInstance().shcj_to_wgs84(
+                    Double.valueOf(jsonObject.getString("x")), Double.valueOf(jsonObject.getString("y")));
+            content.setLocation(points[0] + "," + points[1]);
+            content.setLon(points[0]);
+            content.setLat(points[1]);
+            if(result.getData() == null){
+                result.setData(new ArrayList<>());
+            }
+            result.getData().add(content);
+        }
+        result.setCode(AddressResultEnum.WDJA_SUCCESS);
+        return result;
+    }
+
+    public static AddressResult szxResultToResult(JSONObject json){
+        AddressResult result = new AddressResult();
+        JSONArray array = json.getJSONArray("result");
+        if(array == null || array.size() < 1){
+            result.setCode(AddressResultEnum.RESULT_NULL);
+            return result;
+        }
+        for(int i = 0;i < array.size(); i ++){
+            JSONObject jsonObject = array.getJSONObject(i);
+            AddressResult.ContentBean content = new AddressResult.ContentBean();
+            content.setType(jsonObject.getString("type_name"));
+            content.setAddress(jsonObject.getString("address"));
+            content.setName(jsonObject.getString("name"));
+            double[] points = new double[]{jsonObject.getJSONObject("location").getDouble("lng"),
+                    jsonObject.getJSONObject("location").getDouble("lat")};
+            content.setLocation(points[0] + "," + points[1]);
+            content.setLon(points[0]);
+            content.setLat(points[1]);
+            if(result.getData() == null){
+                result.setData(new ArrayList<>());
+            }
+            result.getData().add(content);
+        }
+        result.setCode(AddressResultEnum.SZX_SUCCESS);
+        return result;
+    }
+
+    public static AddressResult gdResultToResult(JSONObject json){
+        AddressResult result = new AddressResult();
+        JSONArray array = json.getJSONArray("geocodes");
+        if(array == null || array.size() < 1){
+            result.setCode(AddressResultEnum.RESULT_NULL);
+            return result;
+        }
+        for(int i = 0;i < array.size(); i ++){
+            JSONObject jsonObject = array.getJSONObject(i);
+            AddressResult.ContentBean content = new AddressResult.ContentBean();
+            content.setPname(jsonObject.getString("city"));
+            content.setCityname(jsonObject.getString("city"));
+            content.setAdname(jsonObject.getString("district"));
+            content.setType(jsonObject.getString("level"));
+            content.setAddress(jsonObject.getString("formatted_address"));
+            content.setName(jsonObject.getString("street"));
+            String[] loc = jsonObject.getString("location").split(",");
+            double[] points = CoordTransform2.getInstance().gcj02_to_wgs84(
+                    Double.valueOf(loc[0]), Double.valueOf(loc[1]));
+            content.setLocation(points[0] + "," + points[1]);
+            content.setLon(points[0]);
+            content.setLat(points[1]);
+            if(result.getData() == null){
+                result.setData(new ArrayList<>());
+            }
+            result.getData().add(content);
+        }
+        result.setCode(AddressResultEnum.GD_SUCCESS);
+        return result;
+    }
+
+    public static AddressResult gdV3ResultToResult(JSONArray array){
+        AddressResult result = new AddressResult();
+        if(array == null || array.size() < 1){
+            result.setCode(AddressResultEnum.RESULT_NULL);
+            return result;
+        }
+        for(int i = 0;i < array.size(); i ++){
+            JSONObject jsonObject = array.getJSONObject(i);
+            AddressResult.ContentBean content = new AddressResult.ContentBean();
+            content.setPname(jsonObject.getString("pname"));
+            content.setCityname(jsonObject.getString("cityname"));
+            content.setAdname(jsonObject.getString("adname"));
+            content.setType(jsonObject.getString("type"));
+            content.setAddress(content.getCityname() + content.getAdname() + jsonObject.getString("address"));
+            content.setName(jsonObject.getString("name"));
+            String[] loc = jsonObject.getString("location").split(",");
+            double[] points = CoordTransform2.getInstance().gcj02_to_wgs84(
+                    Double.valueOf(loc[0]), Double.valueOf(loc[1]));
+            content.setLocation(points[0] + "," + points[1]);
+            content.setLon(points[0]);
+            content.setLat(points[1]);
+            if(result.getData() == null){
+                result.setData(new ArrayList<>());
+            }
+            result.getData().add(content);
+        }
+        result.setCode(AddressResultEnum.WDJA_SUCCESS);
+
+        result.setCode(AddressResultEnum.GDV3_SUCCESS);
+        return result;
+    }
+
+}

+ 59 - 0
src/main/java/com/skyversation/poiaddr/bean/AddressResult.java

@@ -0,0 +1,59 @@
+package com.skyversation.poiaddr.bean;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.skyversation.poiaddr.util.status.AddressResultEnum;
+
+import java.io.Serializable;
+import java.util.List;
+
+@lombok.Data
+public class AddressResult {
+
+    public AddressResult(){};
+    public AddressResult(AddressResultEnum code, String message){
+        this.code = code;
+        this.message = message;
+    };
+
+    // 查询结果码 -1 token获取失败; 0 成功;
+    private AddressResultEnum code;
+    // 查询状态信息
+    private String message;
+
+    private List<ContentBean> data;
+    @lombok.Data
+    public static class ContentBean implements Serializable {
+        // 省份名称
+        private String pname;
+        // 城市名称
+        private String cityname;
+        // 街镇名称
+        private String adname;
+        // 居委
+        private String community;
+        // 居委编码
+        private String communityCode;
+        // 结果类型
+        private String type;
+        // 地址
+        private String address;
+        // 距离
+        private String distance;
+        // 地址名称
+        private String name;
+        // 经纬度
+        private String location;
+        // 纬度
+        private Double lat;
+        // 经度
+        private Double lon;
+        // 村居信息
+        private JSONObject cjJson;
+        // 网格信息
+        private JSONObject wgJson;
+        // 微格网信息
+        private JSONObject wgwJson;
+    }
+
+}

+ 26 - 0
src/main/java/com/skyversation/poiaddr/bean/GeoJsonBean.java

@@ -0,0 +1,26 @@
+package com.skyversation.poiaddr.bean;
+
+import com.alibaba.fastjson.JSONObject;
+import org.locationtech.jts.geom.MultiPolygon;
+
+public class GeoJsonBean {
+
+    private MultiPolygon multiPolygon;
+    private JSONObject properties;
+
+    public MultiPolygon getMultiPolygon() {
+        return multiPolygon;
+    }
+
+    public void setMultiPolygon(MultiPolygon multiPolygon) {
+        this.multiPolygon = multiPolygon;
+    }
+
+    public JSONObject getProperties() {
+        return properties;
+    }
+
+    public void setProperties(JSONObject properties) {
+        this.properties = properties;
+    }
+}

+ 54 - 0
src/main/java/com/skyversation/poiaddr/bean/Village.java

@@ -0,0 +1,54 @@
+package com.skyversation.poiaddr.bean;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class Village implements Serializable {
+
+    /**
+     * cartodb_id : 367
+     * _ : 5658
+     * objectid : 370
+     * __12 : 18020
+     * __11 : 第三责任网格
+     * __10 : 1810
+     * __9 : null
+     * __8 : 0.8平方公里
+     * __7 : 白鹤镇
+     * __6 : null
+     * __5 : 青浦区
+     * __4 : 赵屯居委
+     * __3 : 181006
+     * __2 : 23年2月修改
+     * y : 2375.26864868131
+     * x : -37029.1538419498
+     * __1 : 东至赵江路、南至梅桥村、西至西大盈港、北至赵屯村
+     * __13 : 473690.980837
+     * shape_leng : 7072.837333
+     * shape_area : 473690.983617
+     */
+
+    private int cartodb_id;
+    private int _;
+    private int objectid;
+    private String __12;
+    private String __11;
+    private String __10;
+    private Object __9;
+    private String __8;
+    private String __7;
+    private Object __6;
+    private String __5;
+    private String __4;
+    private String __3;
+    private String __2;
+    private String y;
+    private String x;
+    private String __1;
+    private double __13;
+    private double shape_leng;
+    private double shape_area;
+
+}

+ 31 - 0
src/main/java/com/skyversation/poiaddr/bean/WDToken.java

@@ -0,0 +1,31 @@
+package com.skyversation.poiaddr.bean;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@Data
+public class WDToken {
+
+    @JsonProperty("msg")
+    private String msg;
+    @JsonProperty("code")
+    private Integer code;
+    @JsonProperty("data")
+    private DataDTO data;
+    @JsonProperty("success")
+    private Boolean success;
+    private Long time;
+
+    @NoArgsConstructor
+    @Data
+    public static class DataDTO {
+        @JsonProperty("token")
+        private String token;
+    }
+
+    public String getToken(){
+        return data.getToken();
+    }
+}

+ 330 - 0
src/main/java/com/skyversation/poiaddr/bean/Zerenwangluo.java

@@ -0,0 +1,330 @@
+package com.skyversation.poiaddr.bean;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@NoArgsConstructor
+@Data
+public class Zerenwangluo {
+
+
+    @JsonProperty("objectIdFieldName")
+    private String objectIdFieldName;
+    @JsonProperty("displayField")
+    private String displayField;
+    @JsonProperty("globalIdFieldName")
+    private String globalIdFieldName;
+    @JsonProperty("geometryType")
+    private String geometryType;
+    @JsonProperty("geometry")
+    private String geometry;
+    @JsonProperty("spatialReference")
+    private SpatialReferenceDTO spatialReference;
+    @JsonProperty("fields")
+    private List<FieldsDTO> fields;
+    @JsonProperty("features")
+    private List<FeaturesDTO> features;
+    @JsonProperty("baseLayerInfo")
+    private BaseLayerInfoDTO baseLayerInfo;
+    @JsonProperty("geosceneVersion")
+    private String geosceneVersion;
+
+    @NoArgsConstructor
+    @Data
+    public static class SpatialReferenceDTO {
+        @JsonProperty("wkid")
+        private Integer wkid;
+        @JsonProperty("latestWkid")
+        private Integer latestWkid;
+    }
+
+    @NoArgsConstructor
+    @Data
+    public static class BaseLayerInfoDTO {
+        @JsonProperty("id")
+        private Integer id;
+        @JsonProperty("name")
+        private String name;
+        @JsonProperty("currentVersion")
+        private String currentVersion;
+        @JsonProperty("cimVersion")
+        private String cimVersion;
+        @JsonProperty("type")
+        private String type;
+        @JsonProperty("parentLayer")
+        private ParentLayerDTO parentLayer;
+        @JsonProperty("defaultVisibility")
+        private Boolean defaultVisibility;
+        @JsonProperty("minScale")
+        private Integer minScale;
+        @JsonProperty("maxScale")
+        private Integer maxScale;
+        @JsonProperty("canScaleSymbols")
+        private Boolean canScaleSymbols;
+        @JsonProperty("geometryType")
+        private String geometryType;
+        @JsonProperty("description")
+        private String description;
+        @JsonProperty("copyrightText")
+        private String copyrightText;
+        @JsonProperty("relationships")
+        private List<?> relationships;
+        @JsonProperty("dataVersioned")
+        private Boolean dataVersioned;
+        @JsonProperty("isDataArchived")
+        private Boolean isDataArchived;
+        @JsonProperty("archivingInfo")
+        private ArchivingInfoDTO archivingInfo;
+        @JsonProperty("supportsStatistics")
+        private Boolean supportsStatistics;
+        @JsonProperty("supportsAdvancedQueries")
+        private Boolean supportsAdvancedQueries;
+        @JsonProperty("supportsCoordinatesQuantization")
+        private Boolean supportsCoordinatesQuantization;
+        @JsonProperty("supportsDatumTransformation")
+        private Boolean supportsDatumTransformation;
+        @JsonProperty("hasMetadata")
+        private Boolean hasMetadata;
+        @JsonProperty("extent")
+        private ExtentDTO extent;
+        @JsonProperty("sourceSpatialReference")
+        private SourceSpatialReferenceDTO sourceSpatialReference;
+        @JsonProperty("drawingInfo")
+        private DrawingInfoDTO drawingInfo;
+        @JsonProperty("hasAttachments")
+        private Boolean hasAttachments;
+        @JsonProperty("htmlPopupType")
+        private String htmlPopupType;
+        @JsonProperty("displayField")
+        private String displayField;
+        @JsonProperty("typeIdField")
+        private String typeIdField;
+        @JsonProperty("subtypeField")
+        private String subtypeField;
+        @JsonProperty("maxRecordCount")
+        private Integer maxRecordCount;
+        @JsonProperty("supportedQueryFormats")
+        private String supportedQueryFormats;
+        @JsonProperty("capabilities")
+        private String capabilities;
+        @JsonProperty("useStandardizedQueries")
+        private Boolean useStandardizedQueries;
+        @JsonProperty("geosceneVersion")
+        private String geosceneVersion;
+        @JsonProperty("objectIdField")
+        private String objectIdField;
+        @JsonProperty("geometryField")
+        private GeometryFieldDTO geometryField;
+        @JsonProperty("fields")
+        private List<FieldsDTO> fields;
+
+        @NoArgsConstructor
+        @Data
+        public static class ParentLayerDTO {
+            @JsonProperty("id")
+            private Integer id;
+            @JsonProperty("name")
+            private String name;
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class ArchivingInfoDTO {
+            @JsonProperty("supportsQueryWithHistoricMoment")
+            private Boolean supportsQueryWithHistoricMoment;
+            @JsonProperty("startArchivingMoment")
+            private Integer startArchivingMoment;
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class ExtentDTO {
+            @JsonProperty("spatialReference")
+            private SpatialReferenceDTO spatialReference;
+            @JsonProperty("xmin")
+            private Double xmin;
+            @JsonProperty("ymin")
+            private Double ymin;
+            @JsonProperty("xmax")
+            private Double xmax;
+            @JsonProperty("ymax")
+            private Double ymax;
+
+            @NoArgsConstructor
+            @Data
+            public static class SpatialReferenceDTO {
+                @JsonProperty("wkid")
+                private Integer wkid;
+                @JsonProperty("latestWkid")
+                private Integer latestWkid;
+            }
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class SourceSpatialReferenceDTO {
+            @JsonProperty("wkid")
+            private Integer wkid;
+            @JsonProperty("latestWkid")
+            private Integer latestWkid;
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class DrawingInfoDTO {
+            @JsonProperty("renderer")
+            private RendererDTO renderer;
+            @JsonProperty("scaleSymbols")
+            private Boolean scaleSymbols;
+            @JsonProperty("transparency")
+            private Integer transparency;
+            @JsonProperty("labelingInfo")
+            private List<LabelingInfoDTO> labelingInfo;
+
+            @NoArgsConstructor
+            @Data
+            public static class RendererDTO {
+                @JsonProperty("type")
+                private String type;
+                @JsonProperty("symbol")
+                private SymbolDTO symbol;
+
+                @NoArgsConstructor
+                @Data
+                public static class SymbolDTO {
+                    @JsonProperty("type")
+                    private String type;
+                    @JsonProperty("style")
+                    private String style;
+                    @JsonProperty("color")
+                    private List<Integer> color;
+                    @JsonProperty("outline")
+                    private OutlineDTO outline;
+
+                    @NoArgsConstructor
+                    @Data
+                    public static class OutlineDTO {
+                        @JsonProperty("type")
+                        private String type;
+                        @JsonProperty("style")
+                        private String style;
+                        @JsonProperty("color")
+                        private List<Integer> color;
+                        @JsonProperty("width")
+                        private Double width;
+                    }
+                }
+            }
+
+            @NoArgsConstructor
+            @Data
+            public static class LabelingInfoDTO {
+                @JsonProperty("expression")
+                private String expression;
+            }
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class GeometryFieldDTO {
+            @JsonProperty("domain")
+            private Object domain;
+            @JsonProperty("length")
+            private Integer length;
+            @JsonProperty("name")
+            private String name;
+            @JsonProperty("alias")
+            private Object alias;
+            @JsonProperty("type")
+            private String type;
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class FieldsDTO {
+            @JsonProperty("domain")
+            private Object domain;
+            @JsonProperty("length")
+            private Integer length;
+            @JsonProperty("name")
+            private String name;
+            @JsonProperty("alias")
+            private Object alias;
+            @JsonProperty("type")
+            private String type;
+        }
+    }
+
+    @NoArgsConstructor
+    @Data
+    public static class FieldsDTO {
+        @JsonProperty("length")
+        private Integer length;
+        @JsonProperty("name")
+        private String name;
+        @JsonProperty("alias")
+        private Object alias;
+        @JsonProperty("type")
+        private String type;
+    }
+
+    @NoArgsConstructor
+    @Data
+    public static class FeaturesDTO {
+        @JsonProperty("attributes")
+        private AttributesDTO attributes;
+        @JsonProperty("geometry")
+        private GeometryDTO geometry;
+
+        @NoArgsConstructor
+        @Data
+        public static class AttributesDTO {
+            @JsonProperty("工作站联系人")
+            private String 工作站联系人;
+            @JsonProperty("网格编码")
+            private String 网格编码;
+            @JsonProperty("特注")
+            private Object 特注;
+            @JsonProperty("Shape__Length")
+            private Double shapeLength;
+//            @JsonProperty("备注")
+//            private String 备注;
+//            @JsonProperty("所属区县")
+//            private String 所属区县;
+//            @JsonProperty("所属街道")
+//            private String 所属街道;
+            @JsonProperty("所属大居")
+            private Object 所属大居;
+//            @JsonProperty("坐标x")
+//            private String 坐标x;
+//            @JsonProperty("坐标y")
+//            private String 坐标y;
+            @JsonProperty("联系电话")
+            private String 联系电话;
+            @JsonProperty("Shape__Area")
+            private Double shapeArea;
+            @JsonProperty("地址")
+            private String 地址;
+            @JsonProperty("四至范围")
+            private String 四至范围;
+            @JsonProperty("街道代码")
+            private String 街道代码;
+//            @JsonProperty("objectid")
+//            private Integer objectid;
+            @JsonProperty("面积")
+            private Double 面积;
+            @JsonProperty("网格名称")
+            private String 网格名称;
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class GeometryDTO {
+            @JsonProperty("rings")
+            private List<List<List<Double>>> rings;
+        }
+    }
+}

+ 9 - 0
src/main/java/com/skyversation/poiaddr/callback/AddressQueryCallBack.java

@@ -0,0 +1,9 @@
+package com.skyversation.poiaddr.callback;
+
+public interface AddressQueryCallBack {
+
+    public void start();
+
+    public void done();
+
+}

+ 8 - 9
src/main/java/com/example/poiaddr/controller/PoiAddressController.java → src/main/java/com/skyversation/poiaddr/controller/PoiAddressController.java

@@ -1,11 +1,10 @@
-package com.example.poiaddr.controller;
+package com.skyversation.poiaddr.controller;
 
-import com.example.poiaddr.entity.FileDataDto;
-import com.example.poiaddr.entity.PoiAddress;
-import com.example.poiaddr.service.PoiAddressService;
-import com.example.poiaddr.util.CoordTransform;
-import com.example.poiaddr.util.RequestUtils;
-import com.example.poiaddr.util.fileTools.ReadFileData;
+import com.skyversation.poiaddr.entity.FileDataDto;
+import com.skyversation.poiaddr.entity.PoiAddress;
+import com.skyversation.poiaddr.service.PoiAddressService;
+import com.skyversation.poiaddr.util.RequestUtils;
+import com.skyversation.poiaddr.util.fileTools.ReadFileData;
 import lombok.extern.slf4j.Slf4j;
 import org.locationtech.jts.geom.Coordinate;
 import org.locationtech.jts.geom.GeometryFactory;
@@ -191,14 +190,14 @@ public class PoiAddressController {
             }
             for(FileDataDto fileDataDto:fileDataDtoList){
                 if(fileDataDto.getLat() != null && fileDataDto.getLon() != null){
-                    double[] lonLat = com.example.poiaddr.util.Coordinate.transformationCoordinateByCoordinate(fileDataDto.getLat(),fileDataDto.getLon(),inCoordinate,outCoordinate);
+                    double[] lonLat = com.skyversation.poiaddr.util.Coordinate.transformationCoordinateByCoordinate(fileDataDto.getLat(),fileDataDto.getLon(),inCoordinate,outCoordinate);
                     fileDataDto.setLat(lonLat[1]);
                     fileDataDto.setLon(lonLat[0]);
                 }
                 //          TODO 距离计算
                 if(matchingDistance != null){
                     if(fileDataDto.getResultLat() != null && fileDataDto.getResultLon() != null && fileDataDto.getLat() != null && fileDataDto.getLon() != null){
-                        double distance = com.example.poiaddr.util.Coordinate.calculateDistance(fileDataDto.getResultLat(),fileDataDto.getResultLon(),fileDataDto.getLat(),fileDataDto.getLon());
+                        double distance = com.skyversation.poiaddr.util.Coordinate.calculateDistance(fileDataDto.getResultLat(),fileDataDto.getResultLon(),fileDataDto.getLat(),fileDataDto.getLon());
                         fileDataDto.setMatchingDistance(distance);
                         double matchingDistanceDb = Double.parseDouble(matchingDistance.toString());
                         if(distance < matchingDistanceDb){

+ 2 - 2
src/main/java/com/example/poiaddr/dao/PoiAddressRepository.java → src/main/java/com/skyversation/poiaddr/dao/PoiAddressRepository.java

@@ -1,6 +1,6 @@
-package com.example.poiaddr.dao;
+package com.skyversation.poiaddr.dao;
 
-import com.example.poiaddr.entity.PoiAddress;
+import com.skyversation.poiaddr.entity.PoiAddress;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Service;
 

+ 1 - 1
src/main/java/com/example/poiaddr/entity/FeatureDiy.java → src/main/java/com/skyversation/poiaddr/entity/FeatureDiy.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.entity;
+package com.skyversation.poiaddr.entity;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;

+ 1 - 1
src/main/java/com/example/poiaddr/entity/FileDataDto.java → src/main/java/com/skyversation/poiaddr/entity/FileDataDto.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.entity;
+package com.skyversation.poiaddr.entity;
 
 
 import lombok.AllArgsConstructor;

+ 1 - 1
src/main/java/com/example/poiaddr/entity/GeometryDiy.java → src/main/java/com/skyversation/poiaddr/entity/GeometryDiy.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.entity;
+package com.skyversation.poiaddr.entity;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.AllArgsConstructor;

+ 1 - 1
src/main/java/com/example/poiaddr/entity/PoiAddress.java → src/main/java/com/skyversation/poiaddr/entity/PoiAddress.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.entity;
+package com.skyversation.poiaddr.entity;
 
 import lombok.AllArgsConstructor;
 import lombok.Data;

+ 369 - 0
src/main/java/com/skyversation/poiaddr/service/AreaService.java

@@ -0,0 +1,369 @@
+package com.skyversation.poiaddr.service;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.skyversation.poiaddr.bean.GeoJsonBean;
+import com.skyversation.poiaddr.bean.Village;
+import com.skyversation.poiaddr.bean.Zerenwangluo;
+import com.skyversation.poiaddr.util.CoordTransform;
+import org.geotools.geojson.geom.GeometryJSON;
+import org.geotools.geometry.jts.JTSFactoryFinder;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.geom.MultiPolygon;
+import org.locationtech.jts.io.ParseException;
+import org.locationtech.jts.io.WKTReader;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ResourceUtils;
+
+import javax.annotation.PostConstruct;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class AreaService {
+
+    private static AreaService instance;
+    public static AreaService getInstance(){
+        return instance;
+    }
+
+
+    WKTReader reader = new WKTReader(JTSFactoryFinder.getGeometryFactory());
+    List<JSONObject> featureList = new ArrayList<>();
+    List<Village> propertiList = new ArrayList<>();
+    List<MultiPolygon> mulPolygonList = new ArrayList<>();
+    Zerenwangluo zrwl = null;
+    List<Zerenwangluo.FeaturesDTO> zrwlFeatures = null;
+    List<Zerenwangluo.FeaturesDTO.AttributesDTO> zrwlProperties = new ArrayList<>();
+    List<MultiPolygon> zrwlMulPolygonList = new ArrayList<>();
+
+    public List<GeoJsonBean> cjPolygonList = new ArrayList<>();
+    public List<GeoJsonBean> wGridPolygonList = new ArrayList<>();
+    public List<GeoJsonBean> gridPolygonList = new ArrayList<>();
+
+    @PostConstruct
+    public void initGeoData(){
+        System.out.println("<<<<<<<<------AreaService>initGeoData------>>>>>>>>>");
+        instance = this;
+        new Thread(()->runGeoData()).start();
+        new Thread(()->runZEWLData()).start();
+        new Thread(()->initPolygons()).start();
+    }
+
+    public void initPolygons(){
+        List<List<GeoJsonBean>> lis = new ArrayList<>();
+        lis.add(cjPolygonList);
+        lis.add(wGridPolygonList);
+        lis.add(gridPolygonList);
+        String[] path = new String[]{"classpath:geojson/qp_cunju.geojson", "classpath:geojson/青浦区微网格-wgs84.geojson",
+                "classpath:geojson/责任网格-wgs84.geojson"};
+
+        for(int j = 0; j < path.length; j ++){
+            BufferedReader br = null;
+            try {
+                File file = ResourceUtils.getFile(path[j]);
+                br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
+                String line = br.readLine();
+                StringBuilder sb = new StringBuilder();
+                while (line != null) {
+                    sb.append(line + "\r\n");
+                    line = br.readLine();
+                }
+                JSONObject json = JSONObject.parseObject(sb.toString());
+
+                JSONArray featrues = json.getJSONArray("features");
+
+                for(int i = 0; i < featrues.size(); i ++){
+                    JSONObject properties = featrues.getJSONObject(i).getJSONObject("properties");
+                    JSONObject geoJson = new JSONObject();
+                    geoJson.put("type", "MultiPolygon");
+                    geoJson.put("coordinates",
+                            featrues.getJSONObject(i).getJSONObject("geometry").getJSONArray("coordinates"));
+
+                    GeometryJSON geometryJSON = new GeometryJSON();
+                    MultiPolygon multiPolygon = geometryJSON.readMultiPolygon(geoJson.toJSONString());
+                    GeoJsonBean geoJsonBean = new GeoJsonBean();
+                    if(file.getName().contains("cunju")){
+                        JSONObject resultProp = new JSONObject();
+                        resultProp.put("网格名称", properties.getString("__11"));
+                        resultProp.put("shape_leng", properties.getString("shape_leng"));
+                        resultProp.put("范围信息", properties.getString("__1"));
+                        resultProp.put("村居代码", properties.getString("__3"));
+                        resultProp.put("街道代码", properties.getString("__10"));
+                        resultProp.put("更新时间", properties.getString("__2"));
+                        resultProp.put("shape_area", properties.getString("shape_area"));
+                        resultProp.put("所属区县", properties.getString("__5"));
+                        resultProp.put("所属居委", properties.getString("__4"));
+                        resultProp.put("所属街道", properties.getString("__7"));
+                        resultProp.put("面积", properties.getString("__8"));
+                        resultProp.put("objectid", properties.getString("objectid"));
+                        geoJsonBean.setProperties(resultProp);
+                    } else if(file.getName().contains("微网格")){
+                        JSONObject resultProp = new JSONObject();
+                        resultProp.put("objectid", properties.getString("OBJECTID"));
+                        resultProp.put("所属街道", properties.getString("æ\u0089\u0080å±\u009Eè¡\u0097"));
+                        resultProp.put("Shape_Leng", properties.getString("Shape_Leng"));
+                        resultProp.put("微格网代码", properties.getString("å¾®ç½\u0091æ ¼"));
+                        resultProp.put("所属区县", properties.getString("æ\u0089\u0080å±\u009Eå\u008Cº"));
+                        resultProp.put("Shape_Area", properties.getString("Shape_Area"));
+                        resultProp.put("微格网名称", properties.getString("å¾®ç½\u0091_1"));
+                        geoJsonBean.setProperties(resultProp);
+                    } else if(file.getName().contains("责任网格")){
+                        geoJsonBean.setProperties(properties);
+                    }
+                    geoJsonBean.setMultiPolygon(multiPolygon);
+                    lis.get(j).add(geoJsonBean);
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+                System.out.println("<<<<<<<<------run geo data error------>>>>>>>>>");
+            }
+        }
+
+        System.out.println("<<<<<<<<------run geo data complete------>>>>>>>>>");
+    }
+
+
+    public GeoJsonBean isInGridPolygon(double lon, double lat){
+        Geometry point = null;
+        try {
+            point = reader.read("POINT (" + lon + " " + lat + ")");
+        } catch (ParseException e) {
+            throw new RuntimeException(e);
+        }
+
+        for(GeoJsonBean bean : gridPolygonList){
+            try{
+                if(bean.getMultiPolygon().contains(point)){
+                    return bean;
+                }
+            } catch (Exception e){
+
+            }
+        }
+        return null;
+    }
+
+    public GeoJsonBean isInWGridPolygon(double lon, double lat){
+        Geometry point = null;
+        try {
+            point = reader.read("POINT (" + lon + " " + lat + ")");
+        } catch (ParseException e) {
+            throw new RuntimeException(e);
+        }
+
+        for(GeoJsonBean bean : wGridPolygonList){
+            if(bean.getMultiPolygon().contains(point)){
+                return bean;
+            }
+        }
+        return null;
+    }
+
+    public GeoJsonBean isInCJPolygon(double lon, double lat){
+        Geometry point = null;
+        try {
+            point = reader.read("POINT (" + lon + " " + lat + ")");
+        } catch (ParseException e) {
+            throw new RuntimeException(e);
+        }
+
+        for(GeoJsonBean bean : cjPolygonList){
+            if(bean.getMultiPolygon().contains(point)){
+                return bean;
+            }
+        }
+        return null;
+    }
+
+
+    /** 初始化责任网络数据 **/
+    public void runZEWLData(){
+        JSONArray jsonArray = new JSONArray();
+        BufferedReader br = null;
+        try {
+            File file = ResourceUtils.getFile("classpath:geojson/zerenwangluo.json");
+            br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
+            String line = br.readLine();
+            StringBuilder sb = new StringBuilder();
+            while (line != null) {
+                sb.append(line + "\r\n");
+                line = br.readLine();
+            }
+            zrwl = JSONObject.parseObject(sb.toString(), Zerenwangluo.class);
+            zrwlFeatures = zrwl.getFeatures();
+            for(int i = 0; i < zrwlFeatures.size(); i ++) {
+
+                Zerenwangluo.FeaturesDTO.AttributesDTO attributes = zrwlFeatures.get(i).getAttributes();
+                zrwlProperties.add(attributes);
+                Zerenwangluo.FeaturesDTO.GeometryDTO geometry = zrwlFeatures.get(i).getGeometry();
+
+                JSONArray coordinates = new JSONArray();
+                JSONArray coordinates1 = new JSONArray();
+
+                for(List<List<Double>> rings : geometry.getRings()){
+                    JSONArray coordinates2 = new JSONArray();
+                    for(List<Double> ring : rings){
+                        JSONArray coordinates3 = new JSONArray();
+                        double x = ring.get(0);
+                        double y = ring.get(1);
+                        double[] dou = CoordTransform.getInstance().SH2000ToWGS84(x, y);
+                        coordinates3.add(dou[0]);
+                        coordinates3.add(dou[1]);
+                        coordinates2.add(coordinates3);
+                    }
+                    coordinates1.add(coordinates2);
+                }
+                coordinates.add(coordinates1);
+
+                JSONObject geoJson = new JSONObject();
+                geoJson.put("type", "MultiPolygon");
+                geoJson.put("coordinates", coordinates);
+
+                GeometryJSON geometryJSON = new GeometryJSON();
+                MultiPolygon multiPolygon = geometryJSON.readMultiPolygon(geoJson.toJSONString());
+
+                zrwlMulPolygonList.add(multiPolygon);
+
+            }
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            System.out.println("<<<<<<<<------run geo data error------>>>>>>>>>");
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        System.out.println("<<<<<<<<------run geo data complete------>>>>>>>>>");
+    }
+
+
+
+    public JSONObject getLiabilityGridByLatlon(double lat, double lon){
+        Zerenwangluo.FeaturesDTO.AttributesDTO attribute = null;
+        try {
+            Geometry point = reader.read("POINT (" + lon + " " + lat + ")");
+            boolean done = false;
+            for(int i = 0; i < zrwlMulPolygonList.size(); i ++){
+                if(done){
+                    break;
+                }
+                MultiPolygon multiPolygon = zrwlMulPolygonList.get(i);
+                String wktStr = multiPolygon.toString();
+                if(wktStr.contains("), (")){// 如果是多面,则拆分成单面再重新比对
+                    String[] wktStrs = wktStr.split("\\), \\(");
+                    List<MultiPolygon> polygons = new ArrayList<>();
+                    for(int j = 0; j < wktStrs.length; j ++){
+                        if(j == 0){
+                            MultiPolygon polygon1 = (MultiPolygon) reader.read(wktStrs[0] + ")))");
+                            polygons.add(polygon1);
+                        } else if(j == wktStrs.length - 1){
+                            MultiPolygon polygon2 = (MultiPolygon) reader.read("MULTIPOLYGON (((" + wktStrs[j]);
+                            polygons.add(polygon2);
+                        } else {
+                            MultiPolygon polygon3 = (MultiPolygon) reader.read("MULTIPOLYGON (((" + wktStrs[j] + ")))");
+                            polygons.add(polygon3);
+                        }
+                    }
+                    for(MultiPolygon polygon : polygons){
+                        if(polygon.contains(point)){
+                            attribute = zrwlProperties.get(i);
+                            done = true;
+                            break;
+                        }
+                    }
+                } else {// 如果是单面,则直接比对
+                    if(multiPolygon.contains(point)){
+                        attribute = zrwlProperties.get(i);
+                        break;
+                    }
+                }
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+
+        return JSONObject.parseObject(JSON.toJSONString(attribute));
+    }
+
+    /** 初始化村居数据 **/
+    public void runGeoData(){
+        BufferedReader br = null;
+        try {
+            File file = ResourceUtils.getFile("classpath:geojson/qp_cunju.geojson");
+            br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
+            String line = br.readLine();
+            StringBuilder sb = new StringBuilder();
+            while (line != null) {
+                sb.append(line + "\r\n");
+                line = br.readLine();
+            }
+
+            JSONObject json = JSONObject.parseObject(sb.toString());
+            JSONArray features = json.getJSONArray("features");
+            for(int i = 0; i < features.size(); i ++) {
+
+                JSONObject feature = features.getJSONObject(i);
+                JSONObject geometry = feature.getJSONObject("geometry");
+
+                GeometryJSON geometryJSON = new GeometryJSON();
+                MultiPolygon multiPolygon = geometryJSON.readMultiPolygon(geometry.toJSONString());
+
+                featureList.add(feature);
+                propertiList.add(JSONObject.parseObject(feature.getJSONObject("properties").toJSONString(), Village.class));
+                mulPolygonList.add(multiPolygon);
+
+            }
+
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            System.out.println("<<<<<<<<------run geo data error------>>>>>>>>>");
+        } catch (IOException e) {
+            e.printStackTrace();
+            System.out.println("<<<<<<<<------run geo data error------>>>>>>>>>");
+        } catch (Exception e){
+            e.printStackTrace();
+            System.out.println("<<<<<<<<------run geo data error------>>>>>>>>>");
+        }
+        System.out.println("<<<<<<<<------run geo data complete------>>>>>>>>>");
+    }
+
+    public Village getAreaCodeByLatlon(double lat, double lon){
+        Village geoAC = null;
+        try {
+            Geometry point = reader.read("POINT (" + lon + " " + lat + ")");
+            for(int i = 0; i < mulPolygonList.size(); i ++){
+                if(mulPolygonList.get(i).contains(point)){
+                    geoAC = propertiList.get(i);
+                    break;
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+        return geoAC;
+    }
+
+    public List<Village> getAreaCodeByLatlons(JSONArray locations){
+        if(locations == null || locations.size() < 1){
+            return null;
+        } else {
+            List<Village> result = new ArrayList<>();
+            try {
+                for(int i = 0; i < locations.size(); i ++){
+                    JSONObject jsonObject = locations.getJSONObject(i);
+                    Village geoAreaCode = getAreaCodeByLatlon(jsonObject.getDouble("lat"), jsonObject.getDouble("lon"));
+                    result.add(geoAreaCode);
+                }
+                return result;
+            } catch (Exception e){
+                return null;
+            }
+        }
+    }
+
+}

+ 2 - 2
src/main/java/com/example/poiaddr/service/PoiAddressService.java → src/main/java/com/skyversation/poiaddr/service/PoiAddressService.java

@@ -1,6 +1,6 @@
-package com.example.poiaddr.service;
+package com.skyversation.poiaddr.service;
 
-import com.example.poiaddr.entity.PoiAddress;
+import com.skyversation.poiaddr.entity.PoiAddress;
 
 import java.util.List;
 

+ 4 - 4
src/main/java/com/example/poiaddr/service/impl/PoiAddressServiceImpl.java → src/main/java/com/skyversation/poiaddr/service/impl/PoiAddressServiceImpl.java

@@ -1,8 +1,8 @@
-package com.example.poiaddr.service.impl;
+package com.skyversation.poiaddr.service.impl;
 
-import com.example.poiaddr.dao.PoiAddressRepository;
-import com.example.poiaddr.entity.PoiAddress;
-import com.example.poiaddr.service.PoiAddressService;
+import com.skyversation.poiaddr.dao.PoiAddressRepository;
+import com.skyversation.poiaddr.entity.PoiAddress;
+import com.skyversation.poiaddr.service.PoiAddressService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;

+ 1 - 1
src/main/java/com/example/poiaddr/util/CoordTransform.java → src/main/java/com/skyversation/poiaddr/util/CoordTransform.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.util;
+package com.skyversation.poiaddr.util;
 
 import org.opengis.referencing.operation.Projection;
 import org.osgeo.proj4j.*;

+ 796 - 0
src/main/java/com/skyversation/poiaddr/util/CoordTransform2.java

@@ -0,0 +1,796 @@
+package com.skyversation.poiaddr.util;
+
+import org.opengis.referencing.operation.Projection;
+import org.osgeo.proj4j.*;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CoordTransform2 {
+
+    private final double x_PI = (Math.PI * 3000.0) / 180.0;
+    private final double ee = 0.00669342162296594323;
+    private final double a = 6378245.0;
+
+
+    private final double BD_FACTOR = (3.14159265358979324 * 3000.0) / 180.0;
+    private final double PI = Math.PI;
+    private final double RADIUS = 6378245.0;
+    private final double EE = 0.00669342162296594323;
+
+
+    // 定义常量
+    private final double A = 6378245.0;
+
+    public enum Projs {
+        WGS84, GCJ02, BD09, UTM4, SHCJ, METER, DEGREE
+    }
+
+    public enum EPSG {
+        WGS84("+proj=longlat +datum=WGS84 +no_defs"),
+        MERCATOR("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs"),
+        GAUSS_KRUGER("+proj=tmerc +lat_0=0 +lon_0=120 +k=1 +x_0=40500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
+
+        private final String projString;
+
+        EPSG(String projString) {
+            this.projString = projString;
+        }
+
+        public String getProjString() {
+            return projString;
+        }
+    }
+
+    public static boolean outOfSh(double lng, double lat){
+        lat += lat;
+        lng +=lng;
+        return !(lng > 115.487 && lng < 123.696 && lat > 28.260 && lat < 33.521);
+    }
+
+    private static CoordTransform2 instance = new CoordTransform2();
+    private CoordTransform2(){}
+    public static CoordTransform2 getInstance(){
+        if(instance == null) {
+            instance = new CoordTransform2();
+        }
+        return instance;
+    }
+
+
+    // 定义投影字典
+    private static final List<Projection> projs = new ArrayList<>();
+
+    // 定义坐标转换方法
+    public double[] wgs84ToShcj(double x, double y) {
+        if (outOfChina(x, y)) {
+            return new double[]{x, y};
+        } else {
+            double[] dlatLng = transformLatLng(x - 105.0, y - 35.0);
+            double radLat = (y / 180.0) * PI;
+            double magic = Math.sin(radLat);
+            magic = 1 - ee * magic * magic;
+            double sqrtMagic = Math.sqrt(magic);
+            dlatLng[0] = (dlatLng[0] * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * PI);
+            dlatLng[1] = (dlatLng[1] * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * PI);
+            double mglat = y + dlatLng[0];
+            double mglng = x + dlatLng[1];
+            return new double[]{mglng, mglat};
+        }
+    }
+
+    // 定义坐标转换方法
+    public double[] gcj02ToWgs84(double x, double y) {
+        if (outOfChina(x, y)) {
+            return new double[]{x, y};
+        } else {
+            double[] dlatLng = transformLatLng(x - 105.0, y - 35.0);
+            double radLat = (y / 180.0) * PI;
+            double magic = Math.sin(radLat);
+            magic = 1 - ee * magic * magic;
+            double sqrtMagic = Math.sqrt(magic);
+            dlatLng[0] = (dlatLng[0] * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * PI);
+            dlatLng[1] = (dlatLng[1] * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * PI);
+            double mglat = y + dlatLng[0];
+            double mglng = x + dlatLng[1];
+            return new double[]{x * 2 - mglng, y * 2 - mglat};
+        }
+    }
+
+    // 定义判断是否在中国境内的方法
+    public boolean outOfChina(double x, double y) {
+        // 纬度 3.86~53.55,经度 73.66~135.05
+        return!(x > 73.66 && x < 135.05 && y > 3.86 && y < 53.55);
+    }
+
+    // 定义坐标转换方法
+    public double[] transformLatLng(double x, double y) {
+        double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
+        ret += ((20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0) / 3.0;
+        ret += ((20.0 * Math.sin(y * PI) + 40.0 * Math.sin((y / 3.0) * PI)) * 2.0) / 3.0;
+        ret += ((160.0 * Math.sin((y / 12.0) * PI) + 320 * Math.sin((y * PI) / 30.0)) * 2.0) / 3.0;
+        return new double[]{ret, ret};
+    }
+
+    // 定义经纬度转米的方法
+    public double[] degreeToMeter(double x, double y) {
+        double lon = (x * 20037508.34) / 180;
+        double lat = Math.log(Math.tan(((90 + y) * PI) / 360)) / (PI / 180);
+        lat = (lat * 20037508.34) / 180;
+        return new double[]{lon, lat};
+    }
+
+    // 定义米转经纬度的方法
+    public double[] meterToDegree(double x, double y) {
+        double lon = (x / 20037508.34) * 180;
+        double lat = (y / 20037508.34) * 180;
+        lat = (180 / PI) * (2 * Math.atan(Math.exp((lat * PI) / 180)) - PI / 2);
+        return new double[]{lon, lat};
+    }
+
+    // 定义 WGS84 坐标转上海城建的方法
+    public double[] wgs84ToShcj2(double x, double y) {
+        double[] xy = shcjGetUTMFromWGS(x, y);
+        return utmToShcj4(xy[0], xy[1]);
+    }
+
+    // 定义 UTM 转上海城建的方法
+    public double[] utmToShcj4(double x, double y) {
+        double DX = -500199.29965;
+        double DY = -3457078.805985;
+        double T = 0.0000001755;
+        double K = 1.0004000106;
+        return covertByFourParm(x, y, DX, DY, T, K);
+    }
+
+    // 定义上海城建坐标转 UTM 的方法
+    public double[] shcjGetUTMFromWGS(double lon, double lat) {
+        double a = 6378137;
+        double b = 6356752.3142451;
+        double f = (a - b) / a;
+
+        double eSquare = 2 * f - f * f;
+        double k0 = 0.9996;
+        double lonOrigin = 121.46714714;
+        double FN = 0;
+        // # 确保 longtitude 位于-180.00----179.9 之间
+        double lonTemp = lon + 180 - Math.floor((lon + 180) / 360) * 360 - 180;
+        double latRad = (lat * PI) / 180;
+        double lonRad = (lonTemp * PI) / 180;
+        double lonOriginRad = (lonOrigin * PI) / 180;
+        double e2Square = eSquare / (1 - eSquare);
+
+        double V = a / Math.sqrt(1 - eSquare * Math.pow(Math.sin(latRad), 2));
+        double T = Math.pow(Math.tan(latRad), 2);
+        double C = e2Square * Math.pow(Math.cos(latRad), 2);
+        double A = Math.cos(latRad) * (lonRad - lonOriginRad);
+        double M = a * ((1 - eSquare / 4 - (3 * Math.pow(eSquare, 2)) / 64 - (5 * Math.pow(eSquare, 3)) / 256) * latRad - ((3 * eSquare) / 8 + (3 * Math.pow(eSquare, 2)) / 32 + (45 * Math.pow(eSquare, 3)) / 1024) * Math.sin(2 * latRad) + ((15 * Math.pow(eSquare, 2)) / 256 + (45 * Math.pow(eSquare, 3)) / 1024) * Math.sin(4 * latRad) - ((35 * Math.pow(eSquare, 3)) / 3072) * Math.sin(6 * latRad));
+
+        // # x
+        double UTMEasting = k0 * V * (A + ((1 - T + C) * Math.pow(A, 3)) / 6 + ((5 - 18 * T + Math.pow(T, 2) + 72 * C - 58 * e2Square) * Math.pow(A, 5)) / 120) + 500000.0;
+        //  # y
+        double UTMNorthing = k0 * (M + V * Math.tan(latRad) * (Math.pow(A, 2) / 2 + ((5 - T + 9 * C + 4 * Math.pow(C, 2)) * Math.pow(A, 4)) / 24 + ((61 - 58 * T + Math.pow(T, 2) + 600 * C - 330 * e2Square) * Math.pow(A, 6)) / 720));
+        //# 南半球纬度起点为 10000000.0m
+        UTMNorthing += FN;
+        double[] xy = new double[2];
+        xy[0] = UTMEasting;
+        xy[1] = UTMNorthing;
+        return xy;
+    }
+
+    // 定义上海城建坐标转 WGS84 的方法
+    public double[] shcjToWgs84(double x, double y) {
+        double[] xy = shcjToUtm4(x, y);
+        return shcjGetWGSFromUTM(xy[0], xy[1]);
+    }
+
+    // 定义上海城建坐标转 UTM 的方法
+    public double[] shcjToUtm4(double x, double y) {
+        double DX = 499999.90104;
+        double DY = 3455696.403019;
+        double T = -0.0000001755;
+        double K = 0.999600149344;
+        return covertByFourParm(x, y, DX, DY, T, K);
+    }
+
+    // 定义四参数公式
+    public double[] covertByFourParm(double x, double y, double dx, double dy, double a, double k) {
+        double px = 0;
+        double py = 0;
+        px = x * k * Math.cos(a) - y * k * Math.sin(a) + dx;
+        py = x * k * Math.sin(a) + y * k * Math.cos(a) + dy;
+        double[] xy = new double[2];
+        xy[0] = px;
+        xy[1] = py;
+        return xy;
+    }
+
+    // 定义上海城建坐标转 WGS84 的方法
+    public double[] shcjGetWGSFromUTM(double x, double y) {
+        // WGS84
+        double a = 6378137; // 椭球体长半轴
+        double b = 6356752.3142451; // 椭球体短半轴
+        x = 500000 - x;
+        double k0 = 0.9996;
+        double e = Math.sqrt(1 - Math.pow(b, 2) / Math.pow(a, 2));
+        // # calculate the meridional arc
+        double M = y / k0;
+        //# calculate footprint latitude
+        double mu = M / (a * (1 - Math.pow(e, 2) / 4 - (3 * Math.pow(e, 4)) / 64 - (5 * Math.pow(e, 6)) / 256));
+        double e1 = (1 - Math.pow(1 - Math.pow(e, 2), 1.0 / 2)) / (1 + Math.pow(1 - Math.pow(e, 2), 1.0 / 2));
+        double J1 = (3 * e1) / 2 - (27 * Math.pow(e1, 3)) / 32;
+        double J2 = (21 * Math.pow(e1, 2)) / 16 - (55 * Math.pow(e1, 4)) / 32;
+        double J3 = (151 * Math.pow(e1, 3)) / 96;
+        double J4 = (1097 * Math.pow(e1, 4)) / 512;
+        double fp = mu + J1 * Math.sin(2 * mu) + J2 * Math.sin(4 * mu) + J3 * Math.sin(6 * mu) + J4 * Math.sin(8 * mu);
+        // # Calculate Latitude and Longitude
+        double e2 = Math.pow(e, 2) / (1 - Math.pow(e, 2));
+        double C1 = e2 * Math.pow(Math.cos(fp), 2);
+        double T1 = Math.pow(Math.tan(fp), 2);
+        double R1 = (a * (1 - Math.pow(e, 2))) / Math.pow(1 - Math.pow(e * Math.sin(fp), 2), 3.0 / 2);
+        //# This is the same as rho in the forward conversion formulas above, but calculated for fp instead of lat.
+        double N1 = a / Math.pow(1 - Math.pow(e * Math.sin(fp), 2), 1.0 / 2);
+        //# This is the same as nu in the forward conversion formulas above, but calculated for fp instead of lat.
+        double D = x / (N1 * k0);
+        double Q1 = (N1 * Math.tan(fp)) / R1;
+        double Q2 = Math.pow(D, 2) / 2;
+        double Q3 = ((5 + 3 * T1 + 10 * C1 - 4 * Math.pow(C1, 2) - 9 * e2) * Math.pow(D, 4)) / 24;
+        double Q4 = ((61 + 90 * T1 + 298 * C1 + 45 * Math.pow(T1, 2) - 3 * Math.pow(C1, 2) - 252 * e2) * Math.pow(D, 6)) / 720;
+        double lat = ((fp - Q1 * (Q2 - Q3 + Q4)) * 180) / PI;
+        // System.out.println("lat===="+Math.toRadians(fp - Q1*(Q2 - Q3 + Q4)));
+        double Q5 = D;
+        double Q6 = ((1 + 2 * T1 + C1) * Math.pow(D, 3)) / 6;
+        double Q7 = ((5 - 2 * C1 + 28 * T1 - 3 * Math.pow(C1, 2) + 8 * e2 + 24 * Math.pow(T1, 2)) * Math.pow(D, 5)) / 120;
+        double lonMid = 121.46714714;
+        double lon = lonMid - (((Q5 - Q6 + Q7) / Math.cos(fp)) * 180) / PI;
+        double[] xy = new double[2];
+        xy[0] = lon;
+        xy[1] = lat;
+        return xy;
+    }
+
+    /***
+     *  计算两个经纬度之间的距离,返回单位米
+     * @param lat1
+     * @param lon1
+     * @param lat2
+     * @param lon2
+     * @return
+     */
+    public double calculateDistance(double lat1, double lon1, double lat2, double lon2) {
+        // 将经纬度转换为弧度
+        double lat1Rad = Math.toRadians(lat1);
+        double lon1Rad = Math.toRadians(lon1);
+        double lat2Rad = Math.toRadians(lat2);
+        double lon2Rad = Math.toRadians(lon2);
+
+//        // 地球半径(单位:千米)
+//        double earthRadius = 6371.0;
+
+        // Haversine公式计算两点之间的距离
+        double dLat = lat2Rad - lat1Rad;
+        double dLon = lon2Rad - lon1Rad;
+        double a = Math.pow(Math.sin(dLat / 2), 2) + Math.cos(lat1Rad) * Math.cos(lat2Rad) * Math.pow(Math.sin(dLon / 2), 2);
+        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
+        double distance = RADIUS * c;
+
+        return distance;
+    }
+
+    public boolean checkLatlon(double lat, double lon){
+        if(lat >85 || lat < -85|| lon >180 || lon < -180){
+            return false;
+        }
+        return true;
+    }
+
+    public double[] bd09_to_gcj02(double bd_lon, double bd_lat) {
+        double x = bd_lon - 0.0065;
+        double y = bd_lat - 0.006;
+        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_PI);
+        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_PI);
+        double gg_lng = z * Math.cos(theta);
+        double gg_lat = z * Math.sin(theta);
+        return new double[]{gg_lng, gg_lat};
+    }
+
+    public double[] gcj02_to_bd09(double lng, double lat) {
+        double z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_PI);
+        double theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_PI);
+        double bd_lng = z * Math.cos(theta) + 0.0065;
+        double bd_lat = z * Math.sin(theta) + 0.006;
+        return new double[]{bd_lng, bd_lat};
+    }
+
+    public double[] wgs84_to_gcj02(double lng, double lat) {
+        if (out_of_china(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double dlat = transformlat(lng - 105.0, lat - 35.0);
+            double dlng = transformlng(lng - 105.0, lat - 35.0);
+            double radlat = (lat / 180.0) * PI;
+            double magic = Math.sin(radlat);
+            magic = 1 - ee * magic * magic;
+            double sqrtmagic = Math.sqrt(magic);
+            dlat = (dlat * 180.0) / (((a * (1 - ee)) / (magic * sqrtmagic)) * PI);
+            dlng = (dlng * 180.0) / ((a / sqrtmagic) * Math.cos(radlat) * PI);
+            double mglat = lat + dlat;
+            double mglng = lng + dlng;
+            return new double[]{mglng, mglat};
+        }
+    }
+
+//    public double[] gcj02_to_wgs84(double lng, double lat) {
+//        if (out_of_china(lng, lat)) {
+//            return new double[]{lng, lat};
+//        } else {
+//            double dlat = transformlat(lng - 105.0, lat - 35.0);
+//            double dlng = transformlng(lng - 105.0, lat - 35.0);
+//            double radlat = (lat / 180.0) * PI;
+//            double magic = Math.sin(radlat);
+//            magic = 1 - ee * magic * magic;
+//            double sqrtmagic = Math.sqrt(magic);
+//            dlat = (dlat * 180.0) / (((a * (1 - ee)) / (magic * sqrtmagic)) * PI);
+//            dlng = (dlng * 180.0) / ((a / sqrtmagic) * Math.cos(radlat) * PI);
+//            double mglat = lat + dlat;
+//            double mglng = lng + dlng;
+//            return new double[]{lng * 2 - mglng, lat * 2 - mglat};
+//        }
+//    }
+
+//    public boolean out_of_china(double lng, double lat) {
+//        return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55);
+//    }
+
+//    public double transformlat(double lng, double lat) {
+//        double ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
+//        ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0;
+//        ret += ((20.0 * Math.sin(lat * PI) + 40.0 * Math.sin((lat / 3.0) * PI)) * 2.0) / 3.0;
+//        ret += ((160.0 * Math.sin((lat / 12.0) * PI) + 320 * Math.sin((lat * PI) / 30.0)) * 2.0) / 3.0;
+//        return ret;
+//    }
+//
+//    public double transformlng(double lng, double lat) {
+//        double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
+//        ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0;
+//        ret += ((20.0 * Math.sin(lng * PI) + 40.0 * Math.sin((lng / 3.0) * PI)) * 2.0) / 3.0;
+//        ret += ((150.0 * Math.sin((lng / 12.0) * PI) + 300.0 * Math.sin((lng / 30.0) * PI)) * 2.0) / 3.0;
+//        return ret;
+//    }
+
+    public double[] degree_to_meter(double lng, double lat) {
+        double x = (lng * 20037508.34) / 180;
+        double y = Math.log(Math.tan(((90 + lat) * PI) / 360)) / (PI / 180);
+        y = (y * 20037508.34) / 180;
+        return new double[]{x, y};
+    }
+
+    public double[] meter_to_degree(double x, double y) {
+        double lon = (x / 20037508.34) * 180;
+        double lat = (y / 20037508.34) * 180;
+        lat = (180 / PI) * (2 * Math.atan(Math.exp((lat * PI) / 180)) - PI / 2);
+        return new double[]{lon, lat};
+    }
+
+//    public double[] wgs84_to_shcj(double x, double y) {
+//        double[] xy = new double[2];
+//        xy = shcj_get_UTM_from_WGS(x, y);
+//        return utm_to_shcj4(xy[0], xy[1]);
+//    }
+
+    public double[] utm_to_shcj4(double x, double y) {
+        double DX = -500199.29965;
+        double DY = -3457078.805985;
+        double T = 0.0000001755;
+        double K = 1.0004000106;
+        return covert_by_four_parm(x, y, DX, DY, T, K);
+    }
+
+    public double[] shcj_get_UTM_from_WGS(double lon, double lat) {
+        double a = 6378137;
+        double b = 6356752.3142451;
+        double f = (a - b) / a;
+        double eSquare = 2 * f - f * f;
+        double k0 = 0.9996;
+        double lonOrigin = 121.46714714;
+        double FN = 0;
+        double lonTemp = lon + 180 - Math.floor((lon + 180) / 360) * 360 - 180;
+        double latRad = (lat * PI) / 180;
+        double lonRad = (lonTemp * PI) / 180;
+        double lonOriginRad = (lonOrigin * PI) / 180;
+        double e2Square = eSquare / (1 - eSquare);
+        double V = a / Math.sqrt(1 - eSquare * Math.pow(Math.sin(latRad), 2));
+        double T = Math.pow(Math.tan(latRad), 2);
+        double C = e2Square * Math.pow(Math.cos(latRad), 2);
+        double A = Math.cos(latRad) * (lonRad - lonOriginRad);
+        double M = a * ((1 - eSquare / 4 - (3 * Math.pow(eSquare, 2)) / 64 - (5 * Math.pow(eSquare, 3)) / 256) * latRad -
+                ((3 * eSquare) / 8 + (3 * Math.pow(eSquare, 2)) / 32 + (45 * Math.pow(eSquare, 3)) / 1024) *
+                        Math.sin(2 * latRad) +
+                ((15 * Math.pow(eSquare, 2)) / 256 + (45 * Math.pow(eSquare, 3)) / 1024) *
+                        Math.sin(4 * latRad) -
+                ((35 * Math.pow(eSquare, 3)) / 3072) * Math.sin(6 * latRad));
+        double UTMEasting = k0 * V * (A + ((1 - T + C) * Math.pow(A, 3)) / 6 +
+                ((5 - 18 * T + Math.pow(T, 2) + 72 * C - 58 * e2Square) * Math.pow(A, 5)) / 120) + 500000.0;
+        double UTMNorthing = k0 * (M + V * Math.tan(latRad) * (Math.pow(A, 2) / 2 +
+                ((5 - T + 9 * C + 4 * Math.pow(C, 2)) * Math.pow(A, 4)) / 24 +
+                ((61 - 58 * T + Math.pow(T, 2) + 600 * C - 330 * e2Square) * Math.pow(A, 6)) / 720));
+        UTMNorthing += FN;
+        return new double[]{UTMEasting, UTMNorthing};
+    }
+
+    public double[] shcj_to_wgs84(double x, double y) {
+        double[] xy = new double[2];
+        xy = shcj_to_utm4(x, y);
+        return shcj_get_WGS_from_UTM(xy[0], xy[1]);
+    }
+
+    public double[] shcj_to_utm4(double x, double y) {
+        double DX = 499999.90104;
+        double DY = 3455696.403019;
+        double T = -0.0000001755;
+        double K = 0.999600149344;
+        return covert_by_four_parm(x, y, DX, DY, T, K);
+    }
+
+    public double[] covert_by_four_parm(double x, double y, double dx, double dy, double a, double k) {
+        double px = x * k * Math.cos(a) - y * k * Math.sin(a) + dx;
+        double py = x * k * Math.sin(a) + y * k * Math.cos(a) + dy;
+        return new double[]{px, py};
+    }
+
+    public double[] shcj_get_WGS_from_UTM(double x, double y) {
+        double a = 6378137;
+        double b = 6356752.3142451;
+        x = 500000 - x;
+        double k0 = 0.9996;
+        double e = Math.sqrt(1 - Math.pow(b, 2) / Math.pow(a, 2));
+        double M = y / k0;
+        double mu = M / (a * (1 - Math.pow(e, 2) / 4 - (3 * Math.pow(e, 4)) / 64 - (5 * Math.pow(e, 6)) / 256));
+        double e1 = (1 - Math.pow(1 - Math.pow(e, 2), 1.0 / 2)) / (1 + Math.pow(1 - Math.pow(e, 2), 1.0 / 2));
+        double J1 = (3 * e1) / 2 - (27 * Math.pow(e1, 3)) / 32;
+        double J2 = (21 * Math.pow(e1, 2)) / 16 - (55 * Math.pow(e1, 4)) / 32;
+        double J3 = (151 * Math.pow(e1, 3)) / 96;
+        double J4 = (1097 * Math.pow(e1, 4)) / 512;
+        double fp = mu + J1 * Math.sin(2 * mu) + J2 * Math.sin(4 * mu) + J3 * Math.sin(6 * mu) + J4 * Math.sin(8 * mu);
+        double e2 = Math.pow(e, 2) / (1 - Math.pow(e, 2));
+        double C1 = e2 * Math.pow(Math.cos(fp), 2);
+        double T1 = Math.pow(Math.tan(fp), 2);
+        double R1 = (a * (1 - Math.pow(e, 2))) / Math.pow(1 - Math.pow(e * Math.sin(fp), 2), 3.0 / 2);
+        double N1 = a / Math.pow(1 - Math.pow(e * Math.sin(fp), 2), 1.0 / 2);
+        double D = x / (N1 * k0);
+        double Q1 = (N1 * Math.tan(fp)) / R1;
+        double Q2 = Math.pow(D, 2) / 2;
+        double Q3 = ((5 + 3 * T1 + 10 * C1 - 4 * Math.pow(C1, 2) - 9 * e2) * Math.pow(D, 4)) / 24;
+        double Q4 = ((61 + 90 * T1 + 298 * C1 + 45 * Math.pow(T1, 2) - 3 * Math.pow(C1, 2) - 252 * e2) * Math.pow(D, 6)) / 720;
+        double lat = ((fp - Q1 * (Q2 - Q3 + Q4)) * 180) / PI;
+        double Q5 = D;
+        double Q6 = ((1 + 2 * T1 + C1) * Math.pow(D, 3)) / 6;
+        double Q7 = ((5 - 2 * C1 + 28 * T1 - 3 * Math.pow(C1, 2) + 8 * e2 + 24 * Math.pow(T1, 2)) * Math.pow(D, 5)) / 120;
+        double lonmid = 121.46714714;
+        double lon = lonmid - (((Q5 - Q6 + Q7) / Math.cos(fp)) * 180) / PI;
+        return new double[]{lon, lat};
+    }
+
+    public double[] wgs84_to_bd09(double x, double y) {
+        double[] ll = wgs84_to_gcj02(x, y);
+        ll = gcj02_to_bd09(ll[0], ll[1]);
+        return ll;
+    }
+
+    public double[] bd09_to_wgs84(double x, double y) {
+        double[] ll = bd09_to_gcj02(x, y);
+        ll = gcj02_to_wgs84(ll[0], ll[1]);
+        return ll;
+    }
+
+    public double[] gcj02_to_shcj(double x, double y) {
+        double[] ll = gcj02_to_wgs84(x, y);
+        ll = wgs84_to_shcj(ll[0], ll[1]);
+        return ll;
+    }
+
+    public double[] shcj_to_gcj02(double x, double y) {
+        double[] ll = shcj_to_wgs84(x, y);
+        ll = wgs84_to_gcj02(ll[0], ll[1]);
+        return ll;
+    }
+
+    public double[] convert_proj_from_to(Projs from, Projs to, double[] xy) {
+        if (from == to) {
+            return xy;
+        } else {
+            String fromProj = from.toString().toLowerCase();
+            String toProj = to.toString().toLowerCase();
+            String targetMethod = fromProj + "_to_" + toProj;
+            try {
+                return (double[]) this.getClass().getMethod(targetMethod, double.class, double.class).invoke(this, xy[0], xy[1]);
+            } catch (IllegalAccessException e) {
+                throw new RuntimeException(e);
+            } catch (InvocationTargetException e) {
+                throw new RuntimeException(e);
+            } catch (NoSuchMethodException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    public double[] WGS84ToSH2000(double lng, double lat) {
+        if (out_of_sh(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double[] templatlng = wgs84_to_shcj(lng, lat);
+            templatlng = meter_to_degree(templatlng[0], templatlng[1]);
+            return new double[]{templatlng[0], templatlng[1]};
+        }
+    }
+
+    public double[] SH2000ToWGS84(double x, double y) {
+        double[] templatlng = meter_to_degree(x, y);
+        if (out_of_sh2000(templatlng[0], templatlng[1])) {
+            return new double[]{x, y};
+        } else {
+            templatlng = shcj_to_wgs84(x, y);
+            return templatlng;
+        }
+    }
+
+    public double[] SH2000lnglatToWGS84(double lng, double lat) {
+        if (out_of_sh2000(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double[] templatlng = degree_to_meter(lng, lat);
+            templatlng = shcj_to_wgs84(templatlng[0], templatlng[1]);
+            return templatlng;
+        }
+    }
+
+    private boolean out_of_sh(double lng, double lat) {
+        // 实现out_of_sh方法
+        return false;
+    }
+
+    private boolean out_of_sh2000(double lng, double lat) {
+        // 实现out_of_sh2000方法
+        return false;
+    }
+
+    public double[] wgs84_to_shcj(double x, double y) {
+        double[] xy = new double[2];
+        xy = shcj_get_UTM_from_WGS(x, y);
+        return utm_to_shcj4(xy[0], xy[1]);
+    }
+
+
+    public double[] BD09ToGCJ02(double lng, double lat) {
+        double x = lng - 0.0065;
+        double y = lat - 0.006;
+        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * BD_FACTOR);
+        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * BD_FACTOR);
+        double gg_lng = z * Math.cos(theta);
+        double gg_lat = z * Math.sin(theta);
+        return new double[]{gg_lng, gg_lat};
+    }
+
+    public double[] GCJ02ToBD09(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        double z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * BD_FACTOR);
+        double theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * BD_FACTOR);
+        double bd_lng = z * Math.cos(theta) + 0.0065;
+        double bd_lat = z * Math.sin(theta) + 0.006;
+        return new double[]{bd_lng, bd_lat};
+    }
+
+    public double[] WGS84ToBD09(double lng, double lat) {
+        double[] GCJ02latlng = WGS84ToGCJ02(lng, lat);
+        double[] BD09latlng = GCJ02ToBD09(GCJ02latlng[0], GCJ02latlng[1]);
+        return BD09latlng;
+    }
+
+    public double[] BD09ToWGS84(double lng, double lat) {
+        double[] GCJ02latlng = BD09ToGCJ02(lng, lat);
+        double[] wgslatlng = GCJ02ToWGS84(GCJ02latlng[0], GCJ02latlng[1]);
+        return wgslatlng;
+    }
+
+    public double[] WGS84ToGCJ02(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        if (out_of_china(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double[] d = delta(lng, lat);
+            return new double[]{lng + d[0], lat + d[1]};
+        }
+    }
+
+    public double[] GCJ02ToWGS84(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        if (out_of_china(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double[] d = delta(lng, lat);
+            double mgLng = lng + d[0];
+            double mgLat = lat + d[1];
+            return new double[]{lng * 2 - mgLng, lat * 2 - mgLat};
+        }
+    }
+
+    private double[] delta(double lng, double lat) {
+        double dLng = transformLng(lng - 105, lat - 35);
+        double dLat = transformLat(lng - 105, lat - 35);
+        double radLat = (lat / 180) * PI;
+        double magic = Math.sin(radLat);
+        magic = 1 - EE * magic * magic;
+        double sqrtMagic = Math.sqrt(magic);
+        dLng = (dLng * 180) / ((RADIUS / sqrtMagic) * Math.cos(radLat) * PI);
+        dLat = (dLat * 180) / (((RADIUS * (1 - EE)) / (magic * sqrtMagic)) * PI);
+        return new double[]{dLng, dLat};
+    }
+
+    private double transformLng(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
+        ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0;
+        ret += ((20.0 * Math.sin(lng * PI) + 40.0 * Math.sin((lng / 3.0) * PI)) * 2.0) / 3.0;
+        ret += ((150.0 * Math.sin((lng / 12.0) * PI) + 300.0 * Math.sin((lng / 30.0) * PI)) * 2.0) / 3.0;
+        return ret;
+    }
+
+    private double transformLat(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        double ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
+        ret += ((20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0) / 3.0;
+        ret += ((20.0 * Math.sin(lat * PI) + 40.0 * Math.sin((lat / 3.0) * PI)) * 2.0) / 3.0;
+        ret += ((160.0 * Math.sin((lat / 12.0) * PI) + 320 * Math.sin((lat * PI) / 30.0)) * 2.0) / 3.0;
+        return ret;
+    }
+
+    private boolean out_of_china(double lng, double lat) {
+        lat = +lat;
+        lng = +lng;
+        return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55);
+    }
+
+    private CRSFactory crsFactory = new CRSFactory();
+
+    // 定义84坐标系
+    private String wgs84Str = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
+//    private CoordinateReferenceSystem wgs84 = crsFactory.createFromParameters(
+//            "WGS84", wgs84Str);
+    private CoordinateReferenceSystem wgs84 =
+            crsFactory.createFromName("EPSG:4326");
+
+    // 定义CGCS2000坐标系
+    private String cgcs2000Str = "+proj=utm +zone=50 +ellps=GRS80 +units=m +no_defs";
+//    private CoordinateReferenceSystem cgcs2000 = crsFactory.createFromParameters(
+//            "CGCS2000", cgcs2000Str);
+    private CoordinateReferenceSystem cgcs2000 =
+            crsFactory.createFromName("EPSG:4490");
+
+    public double[] gcj02_to_wgs84(double lng, double lat) {
+        if (out_of_china(lng, lat)) {
+            return new double[]{lng, lat};
+        } else {
+            double dlat = transformlat(lng - 105.0, lat - 35.0);
+            double dlng = transformlng(lng - 105.0, lat - 35.0);
+            double radlat = (lat / 180.0) * Math.PI;
+            double magic = Math.sin(radlat);
+            magic = 1 - EE * magic * magic;
+            double sqrtmagic = Math.sqrt(magic);
+            dlat = (dlat * 180.0) / (((A * (1 - EE)) / (magic * sqrtmagic)) * Math.PI);
+            dlng = (dlng * 180.0) / ((A / sqrtmagic) * Math.cos(radlat) * Math.PI);
+            double mglat = lat + dlat;
+            double mglng = lng + dlng;
+            return new double[]{lng * 2 - mglng, lat * 2 - mglat};
+        }
+    }
+
+    public double transformlng(double lng, double lat) {
+        double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
+        ret += ((20.0 * Math.sin(6.0 * lng * Math.PI) + 20.0 * Math.sin(2.0 * lng * Math.PI)) * 2.0) / 3.0;
+        ret += ((20.0 * Math.sin(lng * Math.PI) + 40.0 * Math.sin((lng / 3.0) * Math.PI)) * 2.0) / 3.0;
+        ret += ((150.0 * Math.sin((lng / 12.0) * Math.PI) + 300.0 * Math.sin((lng / 30.0) * Math.PI)) * 2.0) / 3.0;
+        return ret;
+    }
+
+    public double transformlat(double lng, double lat) {
+        double ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
+        ret += ((20.0 * Math.sin(6.0 * lng * Math.PI) + 20.0 * Math.sin(2.0 * lng * Math.PI)) * 2.0) / 3.0;
+        ret += ((20.0 * Math.sin(lat * Math.PI) + 40.0 * Math.sin((lat / 3.0) * Math.PI)) * 2.0) / 3.0;
+        ret += ((160.0 * Math.sin((lat / 12.0) * Math.PI) + 320 * Math.sin((lat * Math.PI) / 30.0)) * 2.0) / 3.0;
+        return ret;
+    }
+
+    public double[] wgs84ToCGCS2000(double lng, double lat) {
+
+        // 定义WGS84坐标点
+        ProjCoordinate wgs84Point = new ProjCoordinate(lng, lat);
+
+        // 将WGS84坐标点转换为CGCS2000坐标点
+        ProjCoordinate cgcs2000Point = new ProjCoordinate();
+
+        // 创建坐标转换器
+        CoordinateTransformFactory ctf = new CoordinateTransformFactory();
+        CoordinateTransform transform = ctf.createTransform(wgs84, cgcs2000);
+
+        transform.transform(wgs84Point, cgcs2000Point);
+        System.out.println(cgcs2000Point.x + "," + cgcs2000Point.y);
+        return new double[]{cgcs2000Point.x, cgcs2000Point.y};
+    }
+
+    public double[] cgcs2000ToWGS84(double lng, double lat) {
+        // 定义CGCS2000坐标点
+        ProjCoordinate cgcs2000Point = new ProjCoordinate(lng, lat);
+
+        // 将CGCS2000坐标点转换为WGS84坐标点
+        ProjCoordinate wgs84Point = new ProjCoordinate();
+
+        // 创建坐标转换器
+        CoordinateTransformFactory ctf = new CoordinateTransformFactory();
+        CoordinateTransform transform = ctf.createTransform(cgcs2000, wgs84);
+
+        transform.transform(cgcs2000Point, wgs84Point);
+        System.out.println(wgs84Point.x + "," + wgs84Point.y);
+        return new double[]{wgs84Point.x, wgs84Point.y};
+    }
+
+
+    public static double[] convertCGCS2000ToWGS84(double X, double Y) {
+        double x,y,L0 = 0,B,L;
+        x = X;
+        y = Y;
+        double p=206264.80625;
+        for (int i = 1; Y/i >=10; i = i * 10)//对Y坐标处理并求出中央子午线经度
+        {
+            y = Y - (int)(Y / i) * i-500000;
+            L0 =120;//中央经线,请完善代码去计算,这里处理浙江东阳的数据,偷懒直接指定了
+        }
+        //按6°带克氏椭球反算
+//        double bt = x / 6367558.4969*p;
+//        double BT = x / 6367558.4969;
+//        double c3=Math.cos(BT)*Math.cos(BT);
+//        double c4=Math.sin(BT)*Math.cos(BT);
+//        double Bf=(bt+(50221746+(293622+(2350+22*c3)*c3)*c3)*c4*Math.pow(10,-10)*p)/p;
+//        double c5=Math.pow(Math.cos(Bf),2);
+//        double c6=Math.sin(Bf)*Math.cos(Bf);
+//        double Nf=6399698.902-(21562.267-(108.973-0.612*c5)*c5)*c5;
+//        double Z=y/(Nf*Math.cos(Bf));
+//        double b2 = (0.5 + 0.003369 * c5) * c6;
+//        double b3 = 0.333333 - (0.166667 - 0.001123 * c5) * c5;
+//        double b4 = 0.25 + (0.16161 + 0.00562 * c5) * c5;
+//        double b5=0.2-(0.1667-0.0088*c5)*c5;
+//        double z2=Math.pow(Z,2);
+//        B = (Bf*p - (1 - (b4 - 0.12 *z2) * z2) * z2 * b2 * p)/3600.0;
+//        L = L0+((1 - (b3 - b5 * z2) * z2) * Z * p)/3600.0;
+//        System.out.println("纬度:"+B+"    经度:"+L+"    中央子午线:"+L0);
+
+        // 按 3°带克氏椭球反算
+        double bt = x / 6367558.4969 * p;
+        double BT = x / 6367558.4969;
+        double c3 = Math.cos(BT) * Math.cos(BT);
+        double c4 = Math.sin(BT) * Math.cos(BT);
+        double Bf = (bt + (50221746 + (293622 + (2350 + 22 * c3) * c3) * c3) * c4 * Math.pow(10, -10) * p) / p;
+        double c5 = Math.pow(Math.cos(Bf), 2);
+        double c6 = Math.sin(Bf) * Math.cos(Bf);
+        double Nf = 6399698.902 - (21562.267 - (108.973 - 0.612 * c5) * c5) * c5;
+        double Z = y / (Nf * Math.cos(Bf));
+        double b2 = (0.5 + 0.003369 * c5) * c6;
+        double b3 = 0.333333 - (0.166667 - 0.001123 * c5) * c5;
+        double b4 = 0.25 + (0.16161 + 0.00562 * c5) * c5;
+        double b5 = 0.2 - (0.1667 - 0.0088 * c5) * c5;
+        double z2 = Math.pow(Z, 2);
+        // 3 度带中央子午线计算公式与 6 度带不同
+        double L0ThreeDegree = ((int)(L0 / 3) + 1) * 3 - 3;
+        B = (Bf * p - (1 - (b4 - 0.12 * z2) * z2) * z2 * b2 * p) / 3600.0;
+        L = L0ThreeDegree + ((1 - (b3 - b5 * z2) * z2) * Z * p) / 3600.0;
+//        System.out.println("纬度:" + B + "    经度:" + L + "    中央子午线:" + L0ThreeDegree);
+        return new double[]{L, B};
+    }
+
+
+}

+ 1 - 1
src/main/java/com/example/poiaddr/util/Coordinate.java → src/main/java/com/skyversation/poiaddr/util/Coordinate.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.util;
+package com.skyversation.poiaddr.util;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;

+ 1 - 1
src/main/java/com/example/poiaddr/util/ExcelReaderUtils.java → src/main/java/com/skyversation/poiaddr/util/ExcelReaderUtils.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.util;
+package com.skyversation.poiaddr.util;
 
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.*;

+ 1 - 1
src/main/java/com/example/poiaddr/util/RequestUtils.java → src/main/java/com/skyversation/poiaddr/util/RequestUtils.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.util;
+package com.skyversation.poiaddr.util;
 
 import org.apache.http.HttpEntity;
 import org.apache.http.NameValuePair;

+ 2 - 3
src/main/java/com/example/poiaddr/util/dms/login.java → src/main/java/com/skyversation/poiaddr/util/dms/login.java

@@ -1,10 +1,9 @@
-package com.example.poiaddr.util.dms;
+package com.skyversation.poiaddr.util.dms;
 
-import com.example.poiaddr.util.RequestUtils;
+import com.skyversation.poiaddr.util.RequestUtils;
 import org.json.simple.JSONObject;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 public class login {

+ 3 - 3
src/main/java/com/example/poiaddr/util/fileTools/ReadFileData.java → src/main/java/com/skyversation/poiaddr/util/fileTools/ReadFileData.java

@@ -1,7 +1,7 @@
-package com.example.poiaddr.util.fileTools;
+package com.skyversation.poiaddr.util.fileTools;
 
-import com.example.poiaddr.entity.FeatureDiy;
-import com.example.poiaddr.entity.FileDataDto;
+import com.skyversation.poiaddr.entity.FeatureDiy;
+import com.skyversation.poiaddr.entity.FileDataDto;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.opencsv.CSVReader;

+ 1 - 1
src/main/java/com/example/poiaddr/util/geotools/GeoHelpScript.java → src/main/java/com/skyversation/poiaddr/util/geotools/GeoHelpScript.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.util.geotools;
+package com.skyversation.poiaddr.util.geotools;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;

+ 1 - 1
src/main/java/com/example/poiaddr/util/geotools/GeoJsonPointInRegion.java → src/main/java/com/skyversation/poiaddr/util/geotools/GeoJsonPointInRegion.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.util.geotools;import com.fasterxml.jackson.databind.ObjectMapper;
+package com.skyversation.poiaddr.util.geotools;import com.fasterxml.jackson.databind.ObjectMapper;
 import org.locationtech.jts.geom.Coordinate;
 import org.locationtech.jts.geom.Geometry;
 import org.locationtech.jts.geom.GeometryFactory;

+ 1 - 1
src/main/java/com/example/poiaddr/util/geotools/GeometryIntersectionAndDisjoint.java → src/main/java/com/skyversation/poiaddr/util/geotools/GeometryIntersectionAndDisjoint.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.util.geotools;
+package com.skyversation.poiaddr.util.geotools;
 import org.locationtech.jts.geom.Geometry;
 import org.locationtech.jts.geom.GeometryFactory;
 import org.locationtech.jts.io.ParseException;

+ 68 - 0
src/main/java/com/skyversation/poiaddr/util/net/AddressNetTools.java

@@ -0,0 +1,68 @@
+package com.skyversation.poiaddr.util.net;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+import java.util.Set;
+
+public class AddressNetTools {
+
+    private static AddressNetTools instance = new AddressNetTools();
+    private AddressNetTools(){}
+    public synchronized static AddressNetTools getInstance(){
+        if(instance == null){
+            instance = new AddressNetTools();
+        }
+        return instance;
+    }
+
+    public String wdSendGetRequest(String urlString) throws Exception {
+        HttpClient httpClient = HttpClients.createDefault();
+        HttpGet httpGet = new HttpGet(urlString);
+        HttpResponse response = httpClient.execute(httpGet);
+        HttpEntity entity = response.getEntity();
+        return EntityUtils.toString(entity);
+    }
+
+    public ResponseEntity requestGet(String url, MultiValueMap<String, String> params, Map<String, String> headerMap){
+        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+        requestFactory.setConnectTimeout(30*1000);
+        requestFactory.setReadTimeout(30*1000);
+        RestTemplate client = new RestTemplate(requestFactory);
+        client.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
+
+        HttpHeaders headers = new HttpHeaders();
+        //请勿轻易改变此提交方式,大部分的情况下,提交方式都是表单提交
+        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+        if(headerMap != null){
+            Set<String> sets = headerMap.keySet();
+            for (String key : sets) {
+                headers.add(key, headerMap.get(key));
+            }
+        }
+
+        org.springframework.http.HttpEntity<MultiValueMap<String, String>> requestEntity = new org.springframework.http.HttpEntity<>(params, headers);//执行HTTP请求
+        ResponseEntity<String> response = null;
+        try {
+            response = client.exchange(url, HttpMethod.GET, requestEntity, String.class);
+        } catch (Exception e){
+            e.toString();
+        }
+
+        return response;
+    }
+}

+ 12 - 0
src/main/java/com/skyversation/poiaddr/util/status/AddressLevel.java

@@ -0,0 +1,12 @@
+package com.skyversation.poiaddr.util.status;
+
+public enum AddressLevel {
+
+    LEVEL_1,// 有结果就用
+    LEVEL_CONTAINS_2,// 有包含关系就用
+    LEVLE_NUMBER_3,//数字匹配则使用
+    LEVEL_NUMBER_TEXT_4,// 文字与数字均包含
+    LEVEL_TOTAL_CONTAINS_5;// 完全匹配正确则使用
+
+
+}

+ 14 - 0
src/main/java/com/skyversation/poiaddr/util/status/AddressResultEnum.java

@@ -0,0 +1,14 @@
+package com.skyversation.poiaddr.util.status;
+
+public enum AddressResultEnum {
+
+    NO_TOKEN,// 无token
+    RESULT_NULL,// 返回数据为空
+    RESULT_AGAIN_NULL,// 高德V3分页查询无结果
+    DATA_FROMAT_FAILD,// 数据转换错误
+    WDJA_SUCCESS,// 武大吉奥成功
+    SZX_SUCCESS,// 市四中心成功
+    GD_SUCCESS,// 高德成功
+    GDV3_SUCCESS;// 高德v3成功
+
+}

+ 1 - 1
src/main/java/com/example/poiaddr/util/ZipUnit/CompressUtil.java → src/main/java/com/skyversation/poiaddr/util/zipunit/CompressUtil.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.util.ZipUnit;
+package com.skyversation.poiaddr.util.zipunit;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;

+ 1 - 1
src/main/java/com/example/poiaddr/util/ZipUnit/FileInfo.java → src/main/java/com/skyversation/poiaddr/util/zipunit/FileInfo.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr.util.ZipUnit;
+package com.skyversation.poiaddr.util.zipunit;
 
 import lombok.Data;
 

文件差异内容过多而无法显示
+ 0 - 0
src/main/resources/geojson/qp_cunju.geojson


文件差异内容过多而无法显示
+ 0 - 0
src/main/resources/geojson/zerenwangluo.json


文件差异内容过多而无法显示
+ 0 - 0
src/main/resources/geojson/责任网格-wgs84.geojson


文件差异内容过多而无法显示
+ 0 - 0
src/main/resources/geojson/青浦区微网格-wgs84.geojson


+ 1 - 1
src/test/java/com/example/poiaddr/PoiAddrApplicationTests.java → src/test/java/com/skyversation/poiaddr/PoiAddrApplicationTests.java

@@ -1,4 +1,4 @@
-package com.example.poiaddr;
+package com.skyversation.poiaddr;
 
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;

部分文件因为文件数量过多而无法显示