|
@@ -119,6 +119,40 @@ public class TransfromDataTool {
|
|
result.setCode(AddressResultEnum.RESULT_NULL);
|
|
result.setCode(AddressResultEnum.RESULT_NULL);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // TODO 将请求返回的市中心结果入库到pgsql中
|
|
|
|
+ List<AmapAddressV3> amapAddressV3List = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
|
+ JSONObject item = array.getJSONObject(i);
|
|
|
|
+ AmapAddressV3 amapAddressV3 = new AmapAddressV3();
|
|
|
|
+ amapAddressV3.setId(UUID.randomUUID().toString());
|
|
|
|
+ amapAddressV3.setName(item.get("name").toString());
|
|
|
|
+ amapAddressV3.setType("测绘院结果");
|
|
|
|
+ amapAddressV3.setAddress(item.get("address").toString());
|
|
|
|
+ JSONObject localtion = item.getJSONObject("location");
|
|
|
|
+ Double wgs84Lng = localtion.getDouble("lng");
|
|
|
|
+ Double wgs84Lat = localtion.getDouble("lat");
|
|
|
|
+ double[] points2 = CoordTransform2.getInstance().wgs84ToShcj(wgs84Lng, wgs84Lat);
|
|
|
|
+ double[] points = CoordTransform2.getInstance().wgs84_to_gcj02(wgs84Lng, wgs84Lat);
|
|
|
|
+ amapAddressV3.setLocation(points[0] + "," + points[1]);
|
|
|
|
+ amapAddressV3.setLon(String.valueOf(points2[0]));
|
|
|
|
+ amapAddressV3.setLat(String.valueOf(points2[1]));
|
|
|
|
+ amapAddressV3.setCreateTime(new Date());
|
|
|
|
+ if (item.containsKey("ext_data")) {
|
|
|
|
+ JSONObject ext_data = item.getJSONObject("ext_data");
|
|
|
|
+ if (!ext_data.get("region_ss").toString().isEmpty()) {
|
|
|
|
+ amapAddressV3.setPname(ext_data.get("region_ss").toString());
|
|
|
|
+ amapAddressV3.setCityname(ext_data.get("region_ss").toString());
|
|
|
|
+ amapAddressV3.setAdname(item.get("region_qx").toString());
|
|
|
|
+ amapAddressV3.setStreetTTown(item.get("region_jd").toString());
|
|
|
|
+ amapAddressV3.setResidentialCommittee(item.get("region_jw").toString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ amapAddressV3List.add(amapAddressV3);
|
|
|
|
+ }
|
|
|
|
+ if (amapAddressV3List.size() > 0) {
|
|
|
|
+ AreaService.getInstance().saveAmapAddressV3(amapAddressV3List);
|
|
|
|
+ }
|
|
JSONObject jsonObject = com.skyversation.poiaddr.util.AddressTools.getInstance().findBestMatch(searchAddress, array, "address");
|
|
JSONObject jsonObject = com.skyversation.poiaddr.util.AddressTools.getInstance().findBestMatch(searchAddress, array, "address");
|
|
if (jsonObject.containsKey("总分") && jsonObject.get("总分") != null && !jsonObject.getString("总分").isEmpty()) {
|
|
if (jsonObject.containsKey("总分") && jsonObject.get("总分") != null && !jsonObject.getString("总分").isEmpty()) {
|
|
AddressResult.ContentBean content = new AddressResult.ContentBean();
|
|
AddressResult.ContentBean content = new AddressResult.ContentBean();
|