新详情接口
This commit is contained in:
+105
@@ -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<String, Object> 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<String, Object> resMap, String keywords, String city, String token) {
|
||||
Map<String, String> tokenMap = FangjiaApiUtil.parseToken(token);
|
||||
String userName = null;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user