新增估值系数

This commit is contained in:
Jian Shen
2022-07-27 11:45:48 +08:00
parent a39f90338c
commit d53366edc8
6 changed files with 197 additions and 9 deletions
@@ -33,13 +33,13 @@ import com.fangjia.dal.*;
import com.fangjia.dal.mongo.model.*;
import com.fangjia.dal.mongo.open.model.CommunityBasePrice;
import com.fangjia.dal.mongo.open.model.CommunityPoi;
import com.fangjia.dal.mongo.open.model.EvaluateRatio;
import com.fangjia.dal.seawater.dao.SeawaterDao;
import com.fangjia.dal.seawater.model.Seawater;
import com.fangjia.open.dto.*;
import com.fangjia.service.district.*;
import com.fangjia.service.mongo.fangjia.*;
import com.fangjia.service.open.*;
import com.fangjia.service.open.impl.CommunityPoiServiceImpl;
import com.fangjia.service.util.DistrictScoreUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -193,6 +193,7 @@ public class PropertyController {
private DistrictRoomSqmetreRentService districtRoomSqmetreRentService;
private RentDealPriceService rentDealPriceService;
private EvaluateRatioService evaluateRatioService;
private static final int EVALUATE_SHOW_DETAIL = 1;
private static final Map<String, String> PROPERTY_TYPES = new HashMap<String, String>() {
@@ -1021,6 +1022,8 @@ public class PropertyController {
} catch (IllegalAccessException e) {
e.printStackTrace();
}
this.adjustPriceByRatio(district, evaluation);
}
// 调整面积不同面积价格
@@ -1046,7 +1049,7 @@ public class PropertyController {
}
}
} catch (Exception ex) {
LOGGER.error("调整面积不同面积价格异常{}", ex.getMessage());
}
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0
@@ -1132,6 +1135,41 @@ public class PropertyController {
}
}
/**
* 系数下调
*
* @param district
* @param evaluation
*/
private void adjustPriceByRatio(District district, Evaluation evaluation) {
try {
ApiUserCfg apiUserCfg_pt = apiUserCfgService.findByUserId(Long.valueOf(evaluation.getFromUserId()), ApiUserCfg.ApiUserCfgKey.PRICE_TYPE);
if (apiUserCfg_pt != null && apiUserCfg_pt.getCfgValue() != null) {
String priceType = apiUserCfg_pt.getCfgValue().toString();
// 评估价则系数调整
if (StringUtils.isNotBlank(priceType) && "evaluate".equals(priceType)) {
EvaluateRatio evaluateRatio = null;
if (StringUtils.isNotBlank(district.getRegion())) {
evaluateRatio = evaluateRatioService.findByCityAndRegion(district.getCity(), district.getRegion());
}
if (evaluateRatio == null) {
evaluateRatio = evaluateRatioService.findByCity(district.getCity());
}
if (evaluateRatio != null) {
// 系数添加
long totalPrice = evaluation.getBigTotalPrice();
totalPrice = (long) (totalPrice * (1 + evaluateRatio.getRatio()));
evaluation.setBigTotalPrice(totalPrice);
evaluation.setAvgPrice((int) (totalPrice / evaluation.getArea()));
}
}
}
} catch (Exception ex) {
LOGGER.error("系数下调异常{}", ex.getMessage());
}
}
static final Map<String, Double> CITY_CORRECTION_FACTOR = new HashMap<String, Double>();
static {
CITY_CORRECTION_FACTOR.put("上海", 0.02);
@@ -1220,6 +1258,9 @@ public class PropertyController {
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData());
return mav;
}
this.adjustPriceByRatio(district, evaluation);
// 调整面积不同面积价格
try {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district));
@@ -1249,13 +1290,7 @@ public class PropertyController {
districtPriceMap.put("city", district.getCity());
districtPriceMap.put("district", district.getRegion());
districtPriceMap.put("name", district.getName());
long totalPrice = evaluation.getBigTotalPrice();
// 取消系数下调
// if(CITY_CORRECTION_FACTOR.containsKey(district.getCity())){
// totalPrice = (long)(totalPrice * (1 - CITY_CORRECTION_FACTOR.get(district.getCity())));
// evaluation.setBigTotalPrice(totalPrice);
// evaluation.setAvgPrice((int)(totalPrice/evaluation.getArea()));
// }
districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice());
districtPriceMap.put("unitPrice", evaluation.getAvgPrice());
// 新增置信度
@@ -5731,6 +5766,10 @@ public class PropertyController {
this.rentDealPriceService = rentDealPriceService;
}
public void setEvaluateRatioService(EvaluateRatioService evaluateRatioService) {
this.evaluateRatioService = evaluateRatioService;
}
public void setCommunityPoiService(CommunityPoiService communityPoiService) {
this.communityPoiService = communityPoiService;
}