优化成交
This commit is contained in:
@@ -187,7 +187,7 @@ public class District implements SeaweedEntity {
|
|||||||
private double score;
|
private double score;
|
||||||
// 小区性质
|
// 小区性质
|
||||||
private String landProperty;
|
private String landProperty;
|
||||||
private String masterDistrictNname;
|
private String masterDistrictName;
|
||||||
private String ip;
|
private String ip;
|
||||||
private String addrType;
|
private String addrType;
|
||||||
private boolean selected;
|
private boolean selected;
|
||||||
@@ -309,12 +309,12 @@ public class District implements SeaweedEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Column(name = "master_district_name")
|
@Column(name = "master_district_name")
|
||||||
public String getMasterDistrictNname() {
|
public String getMasterDistrictName() {
|
||||||
return masterDistrictNname;
|
return masterDistrictName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMasterDistrictNname(String masterDistrictNname) {
|
public void setMasterDistrictName(String masterDistrictName) {
|
||||||
this.masterDistrictNname = masterDistrictNname;
|
this.masterDistrictName = masterDistrictName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCategory(String category) {
|
public void setCategory(String category) {
|
||||||
|
|||||||
+54
-15
@@ -2524,14 +2524,32 @@ public class PropertyController {
|
|||||||
if (district.getAlias() != null) {
|
if (district.getAlias() != null) {
|
||||||
districtNames.addAll(district.getAlias());
|
districtNames.addAll(district.getAlias());
|
||||||
}
|
}
|
||||||
}
|
final String masterDistrictName = district.getMasterDistrictName();
|
||||||
List<DealPrice> dealPrices = null;
|
if (StringUtils.isNotBlank(masterDistrictName)) {
|
||||||
for (String name : districtNames) {
|
List<District> districts;
|
||||||
dealPrices = findDealPricesByName(model.getCity(), model.getDistrict(), name, model.getMax() * 5, model);
|
if ("master".equals(masterDistrictName)) {
|
||||||
if (!dealPrices.isEmpty()) {
|
// 所有的分期数据
|
||||||
break;
|
districts = districtService.findSlaves(model.getCity(), model.getDistrict(), model.getName());
|
||||||
|
} else {
|
||||||
|
// 根据主小区名查询所有名称
|
||||||
|
districts = districtService.findSlaves(model.getCity(), model.getDistrict(), masterDistrictName);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(districts)) {
|
||||||
|
for (District districtTemp : districts) {
|
||||||
|
districtNames.add(districtTemp.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// List<DealPrice> dealPrices = new ArrayList<DealPrice>();
|
||||||
|
// 将主名与映射别名查得成交加入 存在不能查出最新成交问题
|
||||||
|
// for (String name : districtNames) {
|
||||||
|
// List<DealPrice> dealPricesTempList = findDealPricesByName(model.getCity(), model.getDistrict(), name, model.getMax() * 5, model);
|
||||||
|
// if (CollectionUtils.isNotEmpty(dealPricesTempList)) {
|
||||||
|
// dealPrices.addAll(dealPricesTempList);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
List<DealPrice> dealPrices = findDealPricesByNames(model.getCity(), model.getDistrict(), districtNames, model.getMax() * 5, model);
|
||||||
if (model.getSize() != null) {
|
if (model.getSize() != null) {
|
||||||
Collections.sort(dealPrices, new Comparator<DealPrice>() {
|
Collections.sort(dealPrices, new Comparator<DealPrice>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -2580,15 +2598,9 @@ public class PropertyController {
|
|||||||
}
|
}
|
||||||
deal = new LinkedHashMap<String, Object>();
|
deal = new LinkedHashMap<String, Object>();
|
||||||
dealPrice.setId(null);
|
dealPrice.setId(null);
|
||||||
if (district != null) {
|
deal.put("city", dealPrice.getCity());
|
||||||
deal.put("city", district.getCity());
|
deal.put("district", dealPrice.getRegion());
|
||||||
deal.put("district", district.getRegion());
|
deal.put("name", dealPrice.getDistrictName());
|
||||||
deal.put("name", district.getName());
|
|
||||||
} else {
|
|
||||||
deal.put("city", dealPrice.getCity());
|
|
||||||
deal.put("district", dealPrice.getRegion());
|
|
||||||
deal.put("name", dealPrice.getDistrictName());
|
|
||||||
}
|
|
||||||
if (dealPrice.getArea() == null) {
|
if (dealPrice.getArea() == null) {
|
||||||
deal.put("size", "");
|
deal.put("size", "");
|
||||||
} else {
|
} else {
|
||||||
@@ -3501,6 +3513,33 @@ public class PropertyController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<DealPrice> findDealPricesByNames(String city, String region, List<String> names, int max,
|
||||||
|
DealPriceModel model) {
|
||||||
|
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||||
|
params.add(new QueryParam("city", city));
|
||||||
|
params.add(new QueryParam("region", region));
|
||||||
|
params.add(new QueryParam("districtName", QueryParam.IN_OPERATOR, names));
|
||||||
|
if (model.getRoom() != null) {
|
||||||
|
params.add(new QueryParam("room", model.getRoom()));
|
||||||
|
}
|
||||||
|
if (model.getHall() != null) {
|
||||||
|
params.add(new QueryParam("hall", model.getHall()));
|
||||||
|
}
|
||||||
|
// 18年之后抓住的数据没有score字段
|
||||||
|
// params.add(new QueryParam("score", QueryParam.GREATER_THAN_OPERATOR, 200000000000l));
|
||||||
|
List<DealPrice> dealPrices = dealPriceService.findDealPrices(params, max);
|
||||||
|
List<DealPrice> distinctDealPrices = new ArrayList<DealPrice>();
|
||||||
|
for (DealPrice dealPrice : dealPrices) {
|
||||||
|
if (dealPrice.getAvgPrice() == null) {
|
||||||
|
dealPrice.setAvgPrice((int) (dealPrice.getTotalPrice() / dealPrice.getArea()));
|
||||||
|
}
|
||||||
|
if (!checkExists(distinctDealPrices, dealPrice)) {
|
||||||
|
distinctDealPrices.add(dealPrice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return distinctDealPrices;
|
||||||
|
}
|
||||||
|
|
||||||
private List<DealPrice> findDealPricesByName(String city, String region, String name, int max,
|
private List<DealPrice> findDealPricesByName(String city, String region, String name, int max,
|
||||||
DealPriceModel model) {
|
DealPriceModel model) {
|
||||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||||
|
|||||||
+2
-2
@@ -540,10 +540,10 @@ public interface DistrictService extends ModeService<DistrictKey, DistrictBo> {
|
|||||||
*
|
*
|
||||||
* @param city
|
* @param city
|
||||||
* @param region
|
* @param region
|
||||||
* @param masterDistrictNname
|
* @param masterDistrictName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<District> findSlaves(String city, String region, String masterDistrictNname);
|
List<District> findSlaves(String city, String region, String masterDistrictName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分期操作时设置此小区为人工操作标识
|
* 分期操作时设置此小区为人工操作标识
|
||||||
|
|||||||
+2
-2
@@ -2717,12 +2717,12 @@ public class DistrictServiceImpl implements DistrictService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<District> findSlaves(String city, String region, String masterDistrictNname) {
|
public List<District> findSlaves(String city, String region, String masterDistrictName) {
|
||||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||||
params.add(new QueryParam("visible", 0));
|
params.add(new QueryParam("visible", 0));
|
||||||
params.add(new QueryParam("city", city));
|
params.add(new QueryParam("city", city));
|
||||||
params.add(new QueryParam("region", region));
|
params.add(new QueryParam("region", region));
|
||||||
params.add(new QueryParam("masterDistrictNname", masterDistrictNname));
|
params.add(new QueryParam("masterDistrictName", masterDistrictName));
|
||||||
return districtDao.findAllByParams(params);
|
return districtDao.findAllByParams(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user