优化匹配接口

This commit is contained in:
2024-11-08 18:52:03 +08:00
parent 009c2b79b6
commit 284d1f1802
4 changed files with 28 additions and 128 deletions
@@ -228,6 +228,10 @@ public class ComprehensiveQueryController {
String cityStr = model.getCity();
if (StringUtils.isNotBlank(cityStr) && cityStr.matches("\\d+")) {
AdministrativeDivision administrativeDivision = administrativeDivisionService.findcityByCode(cityStr);
if(administrativeDivision == null){
mav.setModel(BasicModel.buildBadRequestModel("城市代码错误"));
return mav;
}
String city = administrativeDivision.getCityShort();
if (StringUtils.isBlank(city)) {
mav.setModel(BasicModel.buildBadRequestModel("城市代码错误"));
@@ -242,7 +246,7 @@ public class ComprehensiveQueryController {
communityAvgPriceParams.put("city", model.getCity());
communityAvgPriceParams.put("address", model.getAddress());
communityAvgPriceParams.put("category", model.getCategory());
// communityAvgPriceParams.put("useMap", String.valueOf(model.isUseMap()));
communityAvgPriceParams.put("useMap", "true");
communityAvgPriceParams.put("suggestName", String.valueOf(model.getName()));
communityAvgPriceParams.put("preciseLevel", "strict");
communityAvgPriceParams.put("propertyType", model.getPropertyType());
@@ -284,13 +288,17 @@ public class ComprehensiveQueryController {
// }
// return mav;
// }
String id = matchResponse.getJSONObject("result").getString("id");
JSONObject result = matchResponse.getJSONObject("result");
if(!result.containsKey("id")){
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
return mav;
}
String id = matchResponse.getJSONObject("result") .getString("id");
District district = districtService.findById(id);
if (district == null) {
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
return mav;
}
MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, matchResponse.getJSONObject("result"));
DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(district));
if (null != statBo) {
@@ -1606,6 +1606,7 @@ public class PropertyController {
params.put("suggestName", model.getName());
}
params.put("category", "district");
params.put("propertyType", model.getPropertyType());
String result = addressMatchProxyService.parser(params);
if (result != null) {
JSONObject json = JSONObject.fromObject(result);