优化无样本估值

This commit is contained in:
沈健
2025-03-07 17:00:11 +08:00
parent a4947fe76c
commit 96c7f46656
3 changed files with 14 additions and 4 deletions
@@ -16,6 +16,7 @@ public class OfficeRentStat implements MongoEntity {
private Integer date; private Integer date;
private Double avgPrice; private Double avgPrice;
private String name; private String name;
private Object location;
@Id @Id
@GeneratedValue @GeneratedValue
@@ -81,4 +82,13 @@ public class OfficeRentStat implements MongoEntity {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
@Column(name = "location")
public Object getLocation() {
return location;
}
public void setLocation(Object location) {
this.location = location;
}
} }
@@ -281,7 +281,6 @@ public class OfficeController {
districtPriceMap.put("city", evaluation.getCity()); districtPriceMap.put("city", evaluation.getCity());
districtPriceMap.put("district", evaluation.getRegion()); districtPriceMap.put("district", evaluation.getRegion());
districtPriceMap.put("name", evaluation.getName()); districtPriceMap.put("name", evaluation.getName());
districtPriceMap.put("unitPrice", evaluation.getUnitPrice());
districtPriceMap.put("samples", evaluation.getSeawater()); districtPriceMap.put("samples", evaluation.getSeawater());
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap)); mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
@@ -360,6 +360,7 @@ public class OfficeServiceImpl implements OfficeService {
} }
private OfficeEvaluationDto rentEvaluateByLocation(Evaluation evaluation) { private OfficeEvaluationDto rentEvaluateByLocation(Evaluation evaluation) {
OfficeEvaluationDto officeEvaluationDto = new OfficeEvaluationDto();
if (StringUtils.isNotBlank(evaluation.getLocation())) { if (StringUtils.isNotBlank(evaluation.getLocation())) {
Double lng = Double.valueOf(evaluation.getLocation().split(",")[0]); Double lng = Double.valueOf(evaluation.getLocation().split(",")[0]);
Double lat = Double.valueOf(evaluation.getLocation().split(",")[1]); Double lat = Double.valueOf(evaluation.getLocation().split(",")[1]);
@@ -387,7 +388,7 @@ public class OfficeServiceImpl implements OfficeService {
List<SortParam> sortParams = new ArrayList<SortParam>(); List<SortParam> sortParams = new ArrayList<SortParam>();
sortParams.add(new SortParam("date", false)); sortParams.add(new SortParam("date", false));
List<OfficeRentStat> infos = officeRentStatDao.findAllByParams(params, sortParams); List<OfficeRentStat> infos = officeRentStatDao.findAllByParams(params, sortParams, 5);
if (CollectionUtils.isEmpty(infos)) { if (CollectionUtils.isEmpty(infos)) {
// 去掉类型,重新查找 // 去掉类型,重新查找
params = new ArrayList<QueryParam>(5); params = new ArrayList<QueryParam>(5);
@@ -398,7 +399,6 @@ public class OfficeServiceImpl implements OfficeService {
} }
if (CollectionUtils.isNotEmpty(infos)) { if (CollectionUtils.isNotEmpty(infos)) {
// 求均值 // 求均值
OfficeEvaluationDto officeEvaluationDto = new OfficeEvaluationDto();
Double totalPrice = 0D; Double totalPrice = 0D;
int count = 0; int count = 0;
for (OfficeRentStat officeRentStat : infos) { for (OfficeRentStat officeRentStat : infos) {
@@ -423,6 +423,7 @@ public class OfficeServiceImpl implements OfficeService {
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;
} }
// // 查询Seawater样本 // // 查询Seawater样本
@@ -456,7 +457,7 @@ public class OfficeServiceImpl implements OfficeService {
// return getOfficeEvaluationDtoWithFactor(seawaters, evaluation); // return getOfficeEvaluationDtoWithFactor(seawaters, evaluation);
// } // }
} }
return null; return officeEvaluationDto;
} }
private String getLocation(String city, String address) { private String getLocation(String city, String address) {