From 24d5089c50cd73e9bd2aef9026db7acf363d5657 Mon Sep 17 00:00:00 2001 From: majintao Date: Mon, 10 Mar 2025 11:13:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=99=E5=AD=97=E6=A5=BC=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E4=BC=B0=E5=80=BC=E7=BB=93=E6=9E=9C=E5=8A=A0=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/OfficeController.java | 2 +- .../service/datastore/OfficeServiceImpl.java | 15 ++++++++++++--- .../java/com/fangjia/service/util/GeoUtils.java | 1 + .../com/fangjia/service/util/dto/GaodeDto.java | 10 ++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/OfficeController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/OfficeController.java index 1b29ffc46..8a4a2d4f3 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/OfficeController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/OfficeController.java @@ -279,7 +279,7 @@ public class OfficeController { Map districtPriceMap = new HashMap(); districtPriceMap.put("unitPrice", evaluation.getUnitPrice()); districtPriceMap.put("city", evaluation.getCity()); - districtPriceMap.put("district", evaluation.getRegion()); + districtPriceMap.put("district", evaluation.getDistrict()); districtPriceMap.put("name", evaluation.getName()); districtPriceMap.put("samples", evaluation.getSeawater()); districtPriceMap.put("refOffices", evaluation.getOffice()); diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/OfficeServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/OfficeServiceImpl.java index 1d5339786..9160da919 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/OfficeServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/OfficeServiceImpl.java @@ -352,9 +352,14 @@ public class OfficeServiceImpl implements OfficeService { evaluation.setHeight(null); } // ÆÀ¹ÀÂß¼­ - String location = getLocation(evaluation.getCity(), evaluation.getAddress()); - evaluation.setLocation(location); - +// String location = getLocation(evaluation.getCity(), evaluation.getAddress()); + GaodeDto gaodeDto = getGaodeGeo(evaluation.getCity(), evaluation.getAddress()); + if (gaodeDto.getLng() != null && gaodeDto.getLat() != null) { + evaluation.setLocation(gaodeDto.getLng() + "," + gaodeDto.getLat()); + }else { + evaluation.setLocation(""); + } + evaluation.setRegion(gaodeDto.getDistrict()); return rentEvaluateByLocation(evaluation); } @@ -435,6 +440,10 @@ public class OfficeServiceImpl implements OfficeService { } return ""; } + private GaodeDto getGaodeGeo(String city, String address) { + GaodeDto gaodeDto = GeoUtils.geo(city, address); + return gaodeDto; + } public List findOfficeRentStat(final String city, final String region, final String name, final String cat, final Integer startDate, final Integer endDate) { return CacheUtils.getValue(this.getClass(), "findOfficeRentStat", city + region + name + startDate + endDate, diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/util/GeoUtils.java b/projects/fangjia-service/src/main/java/com/fangjia/service/util/GeoUtils.java index 20846e7f4..85d968763 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/util/GeoUtils.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/util/GeoUtils.java @@ -48,6 +48,7 @@ public class GeoUtils { gaodeDto.setLevel(level); gaodeDto.setLng(lng); gaodeDto.setLat(lat); + gaodeDto.setDistrict(geocode.getString("district")); } } } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/util/dto/GaodeDto.java b/projects/fangjia-service/src/main/java/com/fangjia/service/util/dto/GaodeDto.java index 1fb150d78..9d0efe820 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/util/dto/GaodeDto.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/util/dto/GaodeDto.java @@ -13,6 +13,8 @@ public class GaodeDto { private String level; + private String district; + public Double getLng() { return lng; } @@ -36,4 +38,12 @@ public class GaodeDto { public void setLevel(String level) { this.level = level; } + + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } }