优化无样本估值

This commit is contained in:
沈健
2025-03-07 17:15:23 +08:00
parent 96c7f46656
commit d9c0dce1dc
4 changed files with 10 additions and 39 deletions
@@ -1,6 +1,7 @@
package com.fangjia.dal.mongo.model; package com.fangjia.dal.mongo.model;
import com.fangjia.dal.MongoEntity; import com.fangjia.dal.MongoEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*; import javax.persistence.*;
@@ -16,6 +17,7 @@ public class OfficeRentStat implements MongoEntity {
private Integer date; private Integer date;
private Double avgPrice; private Double avgPrice;
private String name; private String name;
@JsonIgnore
private Object location; private Object location;
@Id @Id
@@ -282,6 +282,7 @@ public class OfficeController {
districtPriceMap.put("district", evaluation.getRegion()); districtPriceMap.put("district", evaluation.getRegion());
districtPriceMap.put("name", evaluation.getName()); districtPriceMap.put("name", evaluation.getName());
districtPriceMap.put("samples", evaluation.getSeawater()); districtPriceMap.put("samples", evaluation.getSeawater());
districtPriceMap.put("refOffices", evaluation.getOffice());
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap)); mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
try { try {
@@ -354,9 +354,8 @@ public class OfficeServiceImpl implements OfficeService {
// 评估逻辑 // 评估逻辑
String location = getLocation(evaluation.getCity(), evaluation.getAddress()); String location = getLocation(evaluation.getCity(), evaluation.getAddress());
evaluation.setLocation(location); evaluation.setLocation(location);
OfficeEvaluationDto officeEvaluationDto = rentEvaluateByLocation(evaluation);
return officeEvaluationDto; return rentEvaluateByLocation(evaluation);
} }
private OfficeEvaluationDto rentEvaluateByLocation(Evaluation evaluation) { private OfficeEvaluationDto rentEvaluateByLocation(Evaluation evaluation) {
@@ -419,43 +418,12 @@ public class OfficeServiceImpl implements OfficeService {
} }
Double avgPrice = DataUtil.roundDouble(totalPrice / count * factor, 2); Double avgPrice = DataUtil.roundDouble(totalPrice / count * factor, 2);
officeEvaluationDto.setUnitPrice(avgPrice); officeEvaluationDto.setUnitPrice(avgPrice);
officeEvaluationDto.setOffices(infos); officeEvaluationDto.setOffice(infos);
officeEvaluationDto.setCity(evaluation.getCity()); officeEvaluationDto.setCity(evaluation.getCity());
officeEvaluationDto.setDistrict(evaluation.getRegion()); officeEvaluationDto.setDistrict(evaluation.getRegion());
officeEvaluationDto.setName(evaluation.getDistrictName()); officeEvaluationDto.setName(evaluation.getDistrictName());
return officeEvaluationDto; return officeEvaluationDto;
} }
// // 查询Seawater样本
// List<Seawater> seawaters;
// SeawaterQuery query = new SeawaterQuery();
// query.setLat(lat);
// query.setLng(lng);
// query.setCat("office_rent");
// query.setRadius(3000);
//
// Integer endDate = Integer.valueOf(DateUtil.formatByPattern(new Date(), "yyyyMMdd"));
// Integer startDate = Integer.valueOf(DateUtil.formatByPattern(DateUtil.addMonthToDate(new Date(), -12), "yyyyMMdd"));
// query.setStartDate(startDate);
// query.setEndDate(endDate);
// query.setEstateType(TYPE_MAP.get(evaluation.getType()));
// query.setLevel(LEVEL_MAP.get(evaluation.getLevel()));
// query.setCityDisplay(evaluation.getCity());
// Pager pager = new Pager();
// pager.setStartRow(0);
// pager.setPageSize(10);
// query.setPager(pager);
// query.setTable("latest_seawater");
// seawaters = seawaterService.findSeawatersByQuery(query);
// // 如果同等级同类型没有查到,则放开
// if (CollectionUtils.isEmpty(seawaters)) {
// query.setEstateType(null);
// query.setLevel(null);
// seawaters = seawaterService.findSeawatersByQuery(query);
// }
// if (CollectionUtils.isNotEmpty(seawaters)) {
// return getOfficeEvaluationDtoWithFactor(seawaters, evaluation);
// }
} }
return officeEvaluationDto; return officeEvaluationDto;
} }
@@ -15,7 +15,7 @@ public class OfficeEvaluationDto extends Evaluation {
private Double unitPrice; private Double unitPrice;
private List<Seawater> seawater; private List<Seawater> seawater;
private List<OfficeRentStat> offices; private List<OfficeRentStat> office;
private String district; private String district;
private String name; private String name;
@@ -52,11 +52,11 @@ public class OfficeEvaluationDto extends Evaluation {
this.name = name; this.name = name;
} }
public List<OfficeRentStat> getOffices() { public List<OfficeRentStat> getOffice() {
return offices; return office;
} }
public void setOffices(List<OfficeRentStat> offices) { public void setOffice(List<OfficeRentStat> office) {
this.offices = offices; this.office = office;
} }
} }