北交所接口加经纬度估值

This commit is contained in:
majintao
2024-10-17 11:16:37 +08:00
parent ded32e9e8e
commit 727795a61d
@@ -78,6 +78,9 @@ public class ComprehensiveQueryController {
private static final int DEFAULT_PAGE_SIZE = 20;
private static final String[] PROPERTY_SEARCH_API_FIELDS = {"address", "city", "region", "name", "lat2", "lng2", "lat", "lng", "block", "estateType2", "addrAlias"};
private static final List<String> GAODE_LEVEL = Arrays.asList("兴趣点", "门牌号", "单元号", "楼层", "房间", "门址", "住宅区");
static final int BAI_DU_GEO = 1;// 百度系坐标
static final int GAO_DE_GEO = 2;// 高德系坐标
@@ -245,7 +248,32 @@ public class ComprehensiveQueryController {
}
if (matchResponse == null || !matchResponse.containsKey("result") || !matchResponse.getJSONObject("result").containsKey("id")) {
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
//加上高德获取经纬度 和 根据经纬度估值
Map<String, String> map = GeoUtils.parserByGaode(model.getCity(), model.getAddress());
if (map.containsKey("level") && GAODE_LEVEL.contains(map.get("level"))
&& map.containsKey("lng") && map.containsKey("lat")) {
String location = map.get("lng") + "," + map.get("lat");
JSONObject jsonResult = null;
Map<String, String> param = new HashMap<String, String>();
param.put("location", location);
param.put("area", String.valueOf(model.getSize()));
try {
jsonResult = httpRequest.getJsonContent("http://192.168.0.100:30020/avmWeb/avmAnn", param, "UTF-8");
if (jsonResult.containsKey("msg") && "成功".equals(jsonResult.getString("msg"))) {
HashMap<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("avgPrice", jsonResult.getString("unitPrice"));
resultMap.put("totalPrice", jsonResult.getString("totalPrice"));
houseValueInformation.setAddressValue(resultMap);
mav.setModel(BasicModel.buildOKModel().setResult(houseValueInformation));
} else {
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
}
} catch (HttpRequestException e) {
throw new RuntimeException(e);
}
} else {
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
}
return mav;
}
String id = matchResponse.getJSONObject("result").getString("id");
@@ -909,9 +937,9 @@ public class ComprehensiveQueryController {
otherPriceRets = new HashMap();
}
if (evaluation.getAvgPrice2b()!=null&&evaluation.getAvgPrice2b() > 0){
if (evaluation.getAvgPrice2b() != null && evaluation.getAvgPrice2b() > 0) {
otherPriceRets.put("fjw_price", evaluation.getAvgPrice2b());
}else {
} else {
otherPriceRets.put("fjw_price", evaluation.getAvgPrice());
}
Map<String, Object> levelMap = getPriceLevel(otherPriceRets, evaluation.getCredit());