Merge branch 'master' of http://gitlab.fangjia.com/dev0/main into open_bohai

This commit is contained in:
2022-06-15 15:38:39 +08:00
95 changed files with 7887 additions and 708 deletions
@@ -31,12 +31,15 @@ import javax.validation.Valid;
import com.fangjia.core.util.*;
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.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;
@@ -175,6 +178,9 @@ public class PropertyController {
private SeawaterDao seawaterDao;
private SeawaterService seawaterService;
private SqmetreRentService sqmetreRentService;
private CommunityPoiService communityPoiService;
private CommunityBasePriceService communityBasePriceService;
private EvaluateFactorService evaluateFactorService;
private FileDao fileDao = FileDao.getInstance();
private static final int DEFAULT_PAGE_SIZE = 20;
@@ -390,10 +396,31 @@ public class PropertyController {
put("5000", "five");// 五线
}
};
/**
* 第三方均价映射
*/
private static final Map<String, String> OTHER_PRICE_MAP = new HashMap<String, String>() {
{
put("zhuge_price", "诸葛找房");
put("anjuke_price", "安居客");
put("fang_price", "房天下");
put("lianjia_price", "链家");
put("cityhouse_price", "禧泰数据");
put("maitian_price", "麦田");
put("ke_price", "贝壳");
put("taofang_price", "淘房365");
put("zhongyuan_price", "中原");
put("tbs_price", "兔博士");
put("qfang_price", "Q房");
put("fangtan_price", "房探");
put("fangduoduo_price", "房多多");
put("wiwj_price", "我爱我家");
}
};
/**
* 利用百度API把GPS转换成Google经纬度
*
*
* @param lng
* @param lat
* @return
@@ -415,7 +442,7 @@ public class PropertyController {
/**
* 利用算法模板把GPS转换成Google经纬度
*
*
* @param lng
* @param lat
* @return
@@ -607,7 +634,7 @@ public class PropertyController {
/**
* 判断小区是否有经纬度
*
*
* @param district
* @return
*/
@@ -618,7 +645,7 @@ public class PropertyController {
/**
* 调用匹配接口匹配小区
*
*
* @param city
* @param address
* @param region
@@ -992,6 +1019,32 @@ public class PropertyController {
}
}
// 调整面积不同面积价格
try {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district));
int orgAvgPrice = 0;
if (districtStatBo != null) {
if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) {
orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice();
} else if (districtStatBo.getDistrictStat() != null) {
orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice();
}
}
if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) {
int factorPrice = evaluation.getAvgPrice();
int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice);
Integer minPrice = (int)(evaluation.getAvgPrice() * 0.95);
Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.05);
// 偏离度超过5%不进行调整
if (minPrice <= avgPrice && avgPrice <= maxPrice) {
evaluation.setAvgPrice(avgPrice);
evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea()));
}
}
} catch (Exception ex) {
}
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0
&& (cityPriceCredit == null || evaluation.getCredit() >= cityPriceCredit)) {
Map<String, Object> districtPriceMap = new HashMap<String, Object>();
@@ -1162,19 +1215,52 @@ public class PropertyController {
evaluationService.remove(evaluation.getId());
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData());
return mav;
}
// 调整面积不同面积价格
try {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district));
int orgAvgPrice = 0;
if (districtStatBo != null) {
if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) {
orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice();
} else if (districtStatBo.getDistrictStat() != null) {
orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice();
}
}
if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) {
int factorPrice = evaluation.getAvgPrice();
int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice);
Integer minPrice = (int)(evaluation.getAvgPrice() * 0.95);
Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.05);
// 偏离度超过5%不进行调整
if (minPrice <= avgPrice && avgPrice <= maxPrice) {
evaluation.setAvgPrice(avgPrice);
evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea()));
}
}
} catch (Exception ex) {
}
Map<String, Object> districtPriceMap = new LinkedHashMap<String, Object>();
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()));
}
// 取消系数下调
// 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());
// 新增置信度
CommunityBasePrice communityBasePrice = communityBasePriceService.getById(district.getId());
if (communityBasePrice != null) {
districtPriceMap.put("credit", communityBasePrice.getCredit());
} else {
districtPriceMap.put("credit", evaluation.getCredit());
}
List<String> names = new ArrayList<String>();
names.add(district.getName());
if(district.getAlias() != null){
@@ -1186,6 +1272,31 @@ public class PropertyController {
}
Integer minPrice = (int)(evaluation.getAvgPrice() * 0.8);
Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.2);
Integer min10Price = (int)(evaluation.getAvgPrice() * 0.9);
Integer max10Price = (int)(evaluation.getAvgPrice() * 1.1);
// 新增第三方均价
try {
double dCredit = 0.61;
Map<String, Object> rMap = getLastEvaluationPrice(district, evaluation, dCredit);
if (null != rMap) {
if (rMap.containsKey("other_price")) {
Map<String, Integer> otherPriceMap = (Map<String, Integer>) rMap.get("other_price");
Map<String, Integer> priceResultMap = new HashMap<String, Integer>();
for (String key : otherPriceMap.keySet()) {
Integer price = otherPriceMap.get(key);
// 剔除偏差大于10的
if (min10Price <= price && max10Price >= price) {
if (OTHER_PRICE_MAP.containsKey(key)) {
priceResultMap.put(OTHER_PRICE_MAP.get(key), price);
}
}
}
districtPriceMap.put("otherPrice", priceResultMap);
}
}
} catch (Exception ex) {
}
List<Seawater> houses = seawaterDao.findHouses(district.getCity(), district.getRegion(), names,minPrice, maxPrice, 20);
if(houses.size() > 3){
districtPriceMap.put("calcType", 1);
@@ -1214,7 +1325,7 @@ public class PropertyController {
}else if(district.getLng() != null && district.getLng() > 0){
double lng = DataUtil.roundDouble(district.getLng() / 10000000000.0,6);
double lat = DataUtil.roundDouble(district.getLat() / 10000000000.0, 6);
List<District> districts = districtService.findNearestDistrict(district.getEstateType2(), lng, lat, 1000 * 3 , 4, null);
List<District> districts = districtService.findNearestDistrict(district.getEstateType2(), lng, lat, 1000 * 3 , 6, null);
if(districts.size() < 2){
evaluationService.remove(evaluation.getId());
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData());
@@ -1252,9 +1363,15 @@ public class PropertyController {
districtDto.append("buildYear", String.valueOf(buildYear));
}
districtAnalyData = districtAnalyDataService.findByDistrictKey(new DistrictKey(d));
if(districtAnalyData != null && districtAnalyData.getHalfYearMarkup() != null){
districtDto.append("halfYearMarkup",DataUtil.roundDouble( districtAnalyData.getHalfYearMarkup() * 100 ,2));
if(districtAnalyData != null){
if (districtAnalyData.getHalfYearMarkup() != null) {
districtDto.append("halfYearMarkup", DataUtil.roundDouble(districtAnalyData.getHalfYearMarkup() * 100, 2));
}
if (districtAnalyData.getAvgPrice() != null && minPrice <= districtAnalyData.getAvgPrice() && maxPrice >= districtAnalyData.getAvgPrice()) {
districtDto.append("avgPrice", districtAnalyData.getAvgPrice());
}
}
nearCommunityDtos.add(districtDto);
}
Integer buildYear = districtService.getBuildYear(district);
@@ -1262,6 +1379,18 @@ public class PropertyController {
modelFeaturesFto.put("buildYear", String.valueOf(buildYear));
}
modelFeaturesFto.append("nearCommunity", nearCommunityDtos);
// 模型特征新增周边数量
CommunityPoi communityPoi = communityPoiService.getById(district.getId());
if (communityPoi != null) {
modelFeaturesFto.put("subway", communityPoi.getSubway());
modelFeaturesFto.put("traffic", communityPoi.getTraffic());
modelFeaturesFto.put("bank", communityPoi.getBank());
modelFeaturesFto.put("primary", communityPoi.getPrimary());
modelFeaturesFto.put("hospital", communityPoi.getHospital());
modelFeaturesFto.put("junior", communityPoi.getJunior());
modelFeaturesFto.put("funeral", communityPoi.getFuneral());
}
districtPriceMap.put("modelFeatures", modelFeaturesFto);
}
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
@@ -1469,7 +1598,7 @@ public class PropertyController {
return mav;
}
}
/**
* 四川锦程 定制接口 多建筑年代
* @param model
@@ -1581,7 +1710,7 @@ public class PropertyController {
districtPriceMap.put("buildYear", matcher3.group());
}
}
// 根据城市等 级设置D级可信度
ApiUserAuthority apiUserAuthority = apiUserAuthorityService
@@ -2094,7 +2223,7 @@ public class PropertyController {
/**
* 小区租金查询接口
*
*
* @param model
* @return
*/
@@ -2573,7 +2702,7 @@ public class PropertyController {
/**
* 批量获取小区的均价,均价走势数据
*
*
* @param request
* @return
*/
@@ -2715,7 +2844,7 @@ public class PropertyController {
/**
* 批量获取小区的配套数据,最多12个小区
*
*
* @param request
* @return
*/
@@ -2860,7 +2989,7 @@ public class PropertyController {
/**
* 获取JSON参数中的num参数值
*
*
* @param jo
* @return
*/
@@ -2885,7 +3014,7 @@ public class PropertyController {
/**
* 获取JSON参数中的radius值
*
*
* @param jo
* @return
*/
@@ -3693,7 +3822,7 @@ public class PropertyController {
/**
* 解析出关键字中的小区名
*
*
* @param keyword
* @return
*/
@@ -3810,7 +3939,7 @@ public class PropertyController {
/**
* 小区统计分析接口
*
*
* @param model
* @return
*/
@@ -3895,7 +4024,7 @@ public class PropertyController {
/**
* 小区交通接口
*
*
* @param model
* @return
*/
@@ -3953,7 +4082,7 @@ public class PropertyController {
/**
* 小区周边接口
*
*
* @param model
* @return
*/
@@ -4012,7 +4141,7 @@ public class PropertyController {
/**
* 相同小区相似户型房源挂牌量接口<br>
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源
*
*
* @author yinjihuan
* @date 2016年9月1日
* @param city
@@ -4052,7 +4181,7 @@ public class PropertyController {
/**
* 周边小区相似户型挂牌量接口<br>
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源
*
*
* @author yinjihuan
* @date 2016年9月1日
* @param city
@@ -4103,7 +4232,7 @@ public class PropertyController {
/**
* 小区周边一公里均价
*
*
* @author wenyan
* @param model
* @return
@@ -4126,7 +4255,7 @@ public class PropertyController {
/**
* 相同小区相似户型租金范围查询接口
*
*
* @param model
* @return
*/
@@ -4169,7 +4298,7 @@ public class PropertyController {
/**
* 周边小区相似户型租金范围查询接口
*
*
* @param model
* @return
*/
@@ -4232,7 +4361,7 @@ public class PropertyController {
/**
* 室号查询接口
*
*
* @param model
* @return
*/
@@ -4268,7 +4397,7 @@ public class PropertyController {
/**
* 楼栋楼层信息查询接口
*
*
* @param model
* @return
*/
@@ -4293,7 +4422,7 @@ public class PropertyController {
/**
* 楼栋查询接口
*
*
* @param model
* @return
*/
@@ -4338,7 +4467,7 @@ public class PropertyController {
/**
* 楼栋查询接口
*
*
* @param model
* @return
*/
@@ -4791,7 +4920,7 @@ public class PropertyController {
/**
* 房产交易记录查询
*
*
* @param model
* @return
*/
@@ -4851,7 +4980,7 @@ public class PropertyController {
/**
* 房产拍卖记录
*
*
* @param model
* @return
*/
@@ -4912,7 +5041,7 @@ public class PropertyController {
/**
* 房产近期评估次数
*
*
* @param model
* @return
*/
@@ -5627,4 +5756,16 @@ public class PropertyController {
public void setRentDealPriceService(RentDealPriceService rentDealPriceService) {
this.rentDealPriceService = rentDealPriceService;
}
public void setCommunityPoiService(CommunityPoiService communityPoiService) {
this.communityPoiService = communityPoiService;
}
public void setEvaluateFactorService(EvaluateFactorService evaluateFactorService) {
this.evaluateFactorService = evaluateFactorService;
}
public void setCommunityBasePriceService(CommunityBasePriceService communityBasePriceService) {
this.communityBasePriceService = communityBasePriceService;
}
}
@@ -75,8 +75,8 @@ public class AnalyticsFilter implements Filter {
if ("1".equals(request.getParameter("__refresh_cache"))) {
threadLocalData.put(ThreadLocalKey.DisableCache, "1");
}
createUID(request, response);
createSID(request, response);
//createUID(request, response);
//createSID(request, response);
response.addHeader("Access-Control-Allow-Origin", "*");
response.addHeader("Access-Control-Allow-Methods", "*");
chain.doFilter(request, response);