新增系数
This commit is contained in:
@@ -122,6 +122,26 @@ public class Evaluation implements MongoEntity {
|
||||
private int statusCha;
|
||||
|
||||
private Double unitPrice;
|
||||
|
||||
/**
|
||||
* 写字楼类型:1:标准写字楼;2:创意园区;3:商住两用;4:综合体
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 写字楼等级 1:甲级;2:乙级;3:丙级
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 免租期(月)
|
||||
*/
|
||||
private Integer rentFreePeriod;
|
||||
|
||||
/**
|
||||
* 物业费(元/m?/月)
|
||||
*/
|
||||
private Double propertyManagementFee;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Column(name = "_id")
|
||||
@@ -998,4 +1018,40 @@ public class Evaluation implements MongoEntity {
|
||||
public void setUnitPrice(Double unitPrice) {
|
||||
this.unitPrice = unitPrice;
|
||||
}
|
||||
|
||||
@Column(name = "type")
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Column(name = "level")
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@Column(name = "rent_free_period")
|
||||
public Integer getRentFreePeriod() {
|
||||
return rentFreePeriod;
|
||||
}
|
||||
|
||||
public void setRentFreePeriod(Integer rentFreePeriod) {
|
||||
this.rentFreePeriod = rentFreePeriod;
|
||||
}
|
||||
|
||||
@Column(name = "property_management_fee")
|
||||
public Double getPropertyManagementFee() {
|
||||
return propertyManagementFee;
|
||||
}
|
||||
|
||||
public void setPropertyManagementFee(Double propertyManagementFee) {
|
||||
this.propertyManagementFee = propertyManagementFee;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -346,13 +346,15 @@ public class OfficeController {
|
||||
*/
|
||||
private Evaluation buildEvaluation(PropertyEvaluationModel model, HttpServletRequest request) {
|
||||
Evaluation evaluation = new Evaluation();
|
||||
evaluation.setLevel(model.getLevel());
|
||||
evaluation.setFitment(model.getFitment());
|
||||
evaluation.setType(model.getType());
|
||||
|
||||
evaluation.setCity(model.getCity());
|
||||
evaluation.setRegion(model.getRegion());
|
||||
evaluation.setDistrictName(model.getName());
|
||||
evaluation.setAddress(model.getAddress());
|
||||
evaluation.setDirection(DIRECTION.get(model.getDirection()));
|
||||
evaluation.setFitment(EVALUATION_MODEL_FITMENT.get(FITMENT.get(StringUtils.isNotBlank(model.getDecoration()) ?
|
||||
model.getDecoration() : model.getFitment())));
|
||||
evaluation.setNoise(NOISE.get(model.getNoise()));
|
||||
evaluation.setEstateType(PROPERTY_TYPES.get(model.getPropertyType()));
|
||||
evaluation.setSight(SIGHT.get(model.getView()));
|
||||
|
||||
+18
-2
@@ -1,7 +1,5 @@
|
||||
package com.fangjia.open.model;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import java.util.Date;
|
||||
|
||||
public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
@@ -291,6 +289,8 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
|
||||
private Integer avgPrice;
|
||||
|
||||
private Integer level;
|
||||
private Integer type;
|
||||
|
||||
public void setDecorationAge(int decorationAge) {
|
||||
this.decorationAge = decorationAge;
|
||||
@@ -926,4 +926,20 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
+147
-9
@@ -19,9 +19,7 @@ import org.sothis.core.util.CollectionUtils;
|
||||
import org.sothis.core.util.Pager;
|
||||
import weiboclient4j.utils.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 写字楼相关服务类
|
||||
@@ -79,7 +77,7 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
seawaters = seawaterService.findSeawatersByQuery(query);
|
||||
}
|
||||
if (seawaters.size() > 0) {
|
||||
unitPrice = this.calcRent(seawaters);
|
||||
unitPrice = this.calcRent(seawaters, evaluation);
|
||||
} else if (StringUtils.isNotBlank(evaluation.getLocation())) {
|
||||
unitPrice = rentEvaluateByLocation(evaluation);
|
||||
}
|
||||
@@ -88,11 +86,151 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
return evaluation;
|
||||
}
|
||||
|
||||
public Double calcRent(List<Seawater> seawaters) {
|
||||
// 所在楼层
|
||||
// 总楼层
|
||||
private static final Map<String, String> FITMENT_MAP = new HashMap<String, String>() {
|
||||
{
|
||||
put("1", "毛坯");
|
||||
put("2", "简装");
|
||||
put("3", "精装");
|
||||
put("4", "豪装");
|
||||
}
|
||||
};
|
||||
private static final Map<Integer, String> LEVEL_MAP = new HashMap<Integer, String>() {
|
||||
{
|
||||
put(1, "甲级");
|
||||
put(2, "乙级");
|
||||
put(3, "丙级");
|
||||
}
|
||||
};
|
||||
private static final Map<Integer, String> TYPE_MAP = new HashMap<Integer, String>() {
|
||||
{
|
||||
put(1, "标准写字楼");
|
||||
put(2, "创意园区");
|
||||
put(3, "商住两用");
|
||||
put(4, "综合体");
|
||||
}
|
||||
};
|
||||
public Double calcRent(List<Seawater> seawaters, Evaluation evaluation) {
|
||||
// 计算平均值
|
||||
Double sum = 0.0;
|
||||
Double size = 0.0;
|
||||
Double unitPrice = null;
|
||||
Double factor = 1.0;
|
||||
// 按写字楼类型过滤
|
||||
List<Seawater> filterWithType = new ArrayList<Seawater>();
|
||||
if (evaluation.getType() != null) {
|
||||
if (TYPE_MAP.get(evaluation.getFitment()) != null) {
|
||||
for (Seawater seawater : seawaters) {
|
||||
if (TYPE_MAP.get(evaluation.getType()).equals(seawater.getEstateType())) {
|
||||
filterWithType.add(seawater);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果样本数量大于5,则按装修过滤
|
||||
if (filterWithType.size() > 5) {
|
||||
seawaters = filterWithType;
|
||||
} else {
|
||||
// TODO 按照写字楼类型进行调整,1:标准写字楼;2:创意园区;3:商住两用;4:综合体
|
||||
// 拍脑袋
|
||||
if (evaluation.getType() == 1) {
|
||||
factor *= 1.0;
|
||||
} else if (evaluation.getType() == 2) {
|
||||
factor *= 0.98;
|
||||
} else if (evaluation.getType() == 3) {
|
||||
factor *= 0.97;
|
||||
} else if (evaluation.getType() == 4) {
|
||||
factor *= 0.96;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 按写字楼等级过滤
|
||||
List<Seawater> filterWithGrade = new ArrayList<Seawater>();
|
||||
if (evaluation.getLevel() != null) {
|
||||
if (LEVEL_MAP.get(evaluation.getFitment()) != null) {
|
||||
for (Seawater seawater : seawaters) {
|
||||
if (LEVEL_MAP.get(evaluation.getLevel()).equals(seawater.getLevel())) {
|
||||
filterWithGrade.add(seawater);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果样本数量大于5,则按装修过滤
|
||||
if (filterWithGrade.size() > 5) {
|
||||
seawaters = filterWithGrade;
|
||||
} else {
|
||||
// TODO 按照写字楼等级进行调整,1:甲级;2:乙级;3:丙级
|
||||
// 拍脑袋
|
||||
if (evaluation.getLevel() == 1) {
|
||||
factor *= 1.2;
|
||||
} else if (evaluation.getLevel() == 2) {
|
||||
factor *= 1.0;
|
||||
} else if (evaluation.getLevel() == 3) {
|
||||
factor *= 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 按楼层过滤
|
||||
List<Seawater> filterWithFloor = new ArrayList<Seawater>();
|
||||
if (evaluation.getFloor() != null && evaluation.getHeight() != null) {
|
||||
Double floorInfo = evaluation.getFloor() * 1.0 / evaluation.getHeight();
|
||||
String floorDesc = "中层";
|
||||
if (floorInfo <= 0.33) {
|
||||
floorDesc = "低层";
|
||||
} else if (floorInfo > 0.66) {
|
||||
floorDesc = "高层";
|
||||
}
|
||||
if (LEVEL_MAP.get(evaluation.getFitment()) != null) {
|
||||
for (Seawater seawater : seawaters) {
|
||||
if (seawater.getFloorInfo() != null && seawater.getFloorInfo().contains(floorDesc)) {
|
||||
filterWithFloor.add(seawater);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果样本数量大于5,则按装修过滤
|
||||
if (filterWithFloor.size() > 5) {
|
||||
seawaters = filterWithGrade;
|
||||
} else {
|
||||
// TODO 按照写字楼楼层进行调整,高层 中层 低层
|
||||
// 拍脑袋
|
||||
if (floorDesc.equals("高层")) {
|
||||
factor *= 1.2;
|
||||
} else if (floorDesc.equals("中层")) {
|
||||
factor *= 1.0;
|
||||
} else if (floorDesc.equals("低层")) {
|
||||
factor *= 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 按装修过滤
|
||||
List<Seawater> filterWithFitment = new ArrayList<Seawater>();
|
||||
|
||||
if (evaluation.getFitment() != null) {
|
||||
if (FITMENT_MAP.get(evaluation.getFitment()) != null) {
|
||||
for (Seawater seawater : seawaters) {
|
||||
if (FITMENT_MAP.get(evaluation.getFitment()).equals(seawater.getFitment())) {
|
||||
filterWithFitment.add(seawater);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果样本数量大于5,则按装修过滤
|
||||
if (filterWithFitment.size() > 5) {
|
||||
seawaters = filterWithFitment;
|
||||
} else {
|
||||
// TODO 按照装修系数进行调整,如1: 毛坯,2: 简装,3: 精装,4: 豪装
|
||||
// 拍脑袋
|
||||
if (evaluation.getFitment().equals(1)) {
|
||||
factor *= 0.8;
|
||||
} else if (evaluation.getFitment().equals(2)) {
|
||||
factor *= 1.0;
|
||||
} else if (evaluation.getFitment().equals(3)) {
|
||||
factor *= 1.2;
|
||||
} else if (evaluation.getFitment().equals(4)) {
|
||||
factor *= 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO 3.4免租期factor*调整因子:factory - 免租期/最低起租期
|
||||
// TODO 物业费因子
|
||||
for (Seawater seawater : seawaters) {
|
||||
if (seawater.getTotalPrice() != null && seawater.getArea() != null && seawater.getTotalPrice() / seawater.getArea() / 30 > 0 && seawater.getTotalPrice() / seawater.getArea() / 30 < 30) {
|
||||
sum += seawater.getTotalPrice();
|
||||
@@ -100,9 +238,9 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
}
|
||||
}
|
||||
if (size > 0) {
|
||||
unitPrice = DataUtil.roundDouble(sum / size / 30, 2);
|
||||
unitPrice = DataUtil.roundDouble(sum / size / 30 * factor, 2);
|
||||
}
|
||||
return unitPrice;
|
||||
return unitPrice ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,7 +280,7 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
query.setCityDisplay(evaluation.getCity());
|
||||
Pager pager = new Pager();
|
||||
pager.setStartRow(0);
|
||||
pager.setPageSize(5);
|
||||
pager.setPageSize(10);
|
||||
query.setPager(pager);
|
||||
query.setTable("latest_seawater");
|
||||
seawaters = seawaterService.findSeawatersByQuery(query);
|
||||
@@ -153,7 +291,7 @@ public class OfficeServiceImpl implements OfficeService {
|
||||
seawaters = seawaterService.findSeawatersByQuery(query);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(seawaters)) {
|
||||
return calcRent(seawaters);
|
||||
return calcRent(seawaters, evaluation);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user