优化成交
This commit is contained in:
@@ -187,7 +187,7 @@ public class District implements SeaweedEntity {
|
||||
private double score;
|
||||
// 小区性质
|
||||
private String landProperty;
|
||||
private String masterDistrictNname;
|
||||
private String masterDistrictName;
|
||||
private String ip;
|
||||
private String addrType;
|
||||
private boolean selected;
|
||||
@@ -309,12 +309,12 @@ public class District implements SeaweedEntity {
|
||||
}
|
||||
|
||||
@Column(name = "master_district_name")
|
||||
public String getMasterDistrictNname() {
|
||||
return masterDistrictNname;
|
||||
public String getMasterDistrictName() {
|
||||
return masterDistrictName;
|
||||
}
|
||||
|
||||
public void setMasterDistrictNname(String masterDistrictNname) {
|
||||
this.masterDistrictNname = masterDistrictNname;
|
||||
public void setMasterDistrictName(String masterDistrictName) {
|
||||
this.masterDistrictName = masterDistrictName;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
|
||||
+54
-15
@@ -2524,14 +2524,32 @@ public class PropertyController {
|
||||
if (district.getAlias() != null) {
|
||||
districtNames.addAll(district.getAlias());
|
||||
}
|
||||
}
|
||||
List<DealPrice> dealPrices = null;
|
||||
for (String name : districtNames) {
|
||||
dealPrices = findDealPricesByName(model.getCity(), model.getDistrict(), name, model.getMax() * 5, model);
|
||||
if (!dealPrices.isEmpty()) {
|
||||
break;
|
||||
final String masterDistrictName = district.getMasterDistrictName();
|
||||
if (StringUtils.isNotBlank(masterDistrictName)) {
|
||||
List<District> districts;
|
||||
if ("master".equals(masterDistrictName)) {
|
||||
// 所有的分期数据
|
||||
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) {
|
||||
Collections.sort(dealPrices, new Comparator<DealPrice>() {
|
||||
@Override
|
||||
@@ -2580,15 +2598,9 @@ public class PropertyController {
|
||||
}
|
||||
deal = new LinkedHashMap<String, Object>();
|
||||
dealPrice.setId(null);
|
||||
if (district != null) {
|
||||
deal.put("city", district.getCity());
|
||||
deal.put("district", district.getRegion());
|
||||
deal.put("name", district.getName());
|
||||
} else {
|
||||
deal.put("city", dealPrice.getCity());
|
||||
deal.put("district", dealPrice.getRegion());
|
||||
deal.put("name", dealPrice.getDistrictName());
|
||||
}
|
||||
deal.put("city", dealPrice.getCity());
|
||||
deal.put("district", dealPrice.getRegion());
|
||||
deal.put("name", dealPrice.getDistrictName());
|
||||
if (dealPrice.getArea() == null) {
|
||||
deal.put("size", "");
|
||||
} else {
|
||||
@@ -3501,6 +3513,33 @@ public class PropertyController {
|
||||
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,
|
||||
DealPriceModel model) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
|
||||
+2
-2
@@ -540,10 +540,10 @@ public interface DistrictService extends ModeService<DistrictKey, DistrictBo> {
|
||||
*
|
||||
* @param city
|
||||
* @param region
|
||||
* @param masterDistrictNname
|
||||
* @param masterDistrictName
|
||||
* @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
|
||||
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>();
|
||||
params.add(new QueryParam("visible", 0));
|
||||
params.add(new QueryParam("city", city));
|
||||
params.add(new QueryParam("region", region));
|
||||
params.add(new QueryParam("masterDistrictNname", masterDistrictNname));
|
||||
params.add(new QueryParam("masterDistrictName", masterDistrictName));
|
||||
return districtDao.findAllByParams(params);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user