From fca5172971820ea67aec4ab3156a14f9642abac8 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 15 May 2023 15:25:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/controllers/PropertyController.java | 105 ++++++++++++++++++ .../com/fangjia/open/dto/DistrictInfoDto.java | 9 ++ 2 files changed, 114 insertions(+) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java index cdaa46a50..5e3c7c3d7 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java @@ -822,6 +822,111 @@ public class PropertyController { return mav; } + + public Object detail2Action(PropertySearchModel model) { + RestfulModelAndView mav = new RestfulModelAndView(); + mav.setViewType("rest"); + if (StringUtils.isBlank(model.getId()) + && (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getDistrict()) + || StringUtils.isBlank(model.getName())) + && (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getDistrict()) + || StringUtils.isBlank(model.getAddress()))) { + mav.setModel(BasicModel.buildBadRequestModel("参数非法:请输入正确的参数组合")); + return mav; + } + + District district = null; + if (StringUtils.isNotBlank(model.getId())){ + if(ObjectId.isValid(model.getId())){ + district = districtService.findById(model.getId()); + }else{ + mav.setModel(BasicModel.buildBadRequestModel("非法的住宅ID")); + return mav; + } + } + + if (district == null && StringUtils.isNotBlank(model.getCity()) && StringUtils.isNotBlank(model.getDistrict()) + && StringUtils.isNotBlank(model.getName())) { + district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(), + "district"); + if (district != null) { + district = districtService.findById(district.getId()); + } + } + + if (district == null && StringUtils.isNotBlank(model.getCity()) && StringUtils.isNotBlank(model.getDistrict()) + && StringUtils.isNotBlank(model.getAddress())) { + Map result = addressParser.parse2(model.getCity(), model.getAddress(), "district", false); + saveAddressMatchLog(result, model.getAddress(), model.getCity(), model.getToken()); + Integer status = (Integer) result.get("status"); + Integer precise = (Integer) result.get("precise"); + if (status != null && status == 0 && precise == 0) { + String id = (String) result.get("id"); + district = districtService.findById(id); + } + } + + if (district != null) { + fieldFilterService.filterWithProcessNUll(district); + DistrictInfoDto districtInfoDto = new DistrictInfoDto(); + districtInfoDto.setId(district.getId()); + districtInfoDto.setCity(district.getCity()); + districtInfoDto.setDistrict(district.getRegion()); + districtInfoDto.setName(district.getName()); + districtInfoDto.setAlias(district.getMappingAlias()); + districtInfoDto.setAddress(district.getAddress()); + districtInfoDto.setAddressAlias(district.getAddrAlias()); + if (district.getLat2() != null && district.getLat2() != 0 && district.getLng2() != null + && district.getLng2() != 0) { + districtInfoDto.setLat(district.getLat2() / 10000000000D); + districtInfoDto.setLng(district.getLng2() / 10000000000D); + } + districtInfoDto.setPropertyType(district.getEstateType2()); + if (HouseValidator.validateBuildingType(district.getBuildType())) { + districtInfoDto.setBuildingType(district.getBuildType()); + } else { + districtInfoDto.setBuildingType(""); + } + districtInfoDto.setBlock(district.getBlock()); + districtInfoDto.setTownship(district.getTownship()); + if (district.getLoudongCount() != null && district.getLoudongCount() > 0) { + districtInfoDto.setBuildingCount(district.getLoudongCount()); + } + + if (district.getHouseholdCount() != null) { + districtInfoDto.setTotalUnitCount(SeaweedUtils.formatHouseholdCount(district.getHouseholdCount().toString())); + } else { + districtInfoDto.setTotalUnitCount(""); + } + districtInfoDto.setManagementFee(district.getEstateCharge()); + if (district.getCarSiteCount() != null) { + districtInfoDto.setParking(SeaweedUtils.formatCarSiteCount(district.getCarSiteCount().toString())); + } else { + districtInfoDto.setParking(""); + } + districtInfoDto.setOwnershipPeriod(district.getPropertyLife()); + districtInfoDto.setOwnershipType(district.getHouseProperty()); + districtInfoDto.setBuildingStructure(district.getBuildStructure()); + districtInfoDto.setLandProperty(district.getLandProperty()); + districtInfoDto.setFloorSpace(SeaweedUtils.formatAllArea(district.getAllArea())); + districtInfoDto.setConstructionSpace(district.getBuildArea()); + districtInfoDto.setPlotRatio(SeaweedUtils.formatCubagePercent(district.getCubagePercent())); + districtInfoDto.setGreenPercentage(SeaweedUtils.formatVirescencePercent(district.getVirescencePercent())); + districtInfoDto.setDeveloper(district.getDeveloper()); + districtInfoDto.setPropertyManagement(district.getEstateCompany()); + + Integer finishYear = districtService.getCreateYear(district); + if (finishYear != null) { + districtInfoDto.setFinishYear(finishYear); + } + + mav.setModel(BasicModel.buildOKModel().setResult(districtInfoDto)); + return mav; + } + mav.setModel(BasicModel.buildBadRequestModel("该小区不存在")); + return mav; + } + private void saveAddressMatchLog(Map resMap, String keywords, String city, String token) { Map tokenMap = FangjiaApiUtil.parseToken(token); String userName = null; diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/dto/DistrictInfoDto.java b/projects/fangjia-open/src/main/java/com/fangjia/open/dto/DistrictInfoDto.java index d938d3a8b..6fbca5e08 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/dto/DistrictInfoDto.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/dto/DistrictInfoDto.java @@ -100,6 +100,7 @@ public class DistrictInfoDto { private Integer buildingCount; private Integer finishYear; private String township; + private String landProperty; public String getDistrict() { @@ -827,4 +828,12 @@ public class DistrictInfoDto { public void setTownship(String township) { this.township = township; } + + public String getLandProperty() { + return landProperty; + } + + public void setLandProperty(String landProperty) { + this.landProperty = landProperty; + } }