匹配接口新增自然村匹配
This commit is contained in:
+8
-4
@@ -526,12 +526,13 @@ public class AddressController {
|
||||
} else if (jsonResult != null) {
|
||||
// 判断是否为自然村
|
||||
boolean matchedVillage = false;
|
||||
try {
|
||||
if (jsonResult.get("searchAddress") != null) {
|
||||
JSONObject searchAddress = (JSONObject) jsonResult.get("searchAddress");
|
||||
String city = searchAddress.getString("city");
|
||||
String region = searchAddress.getString("district");
|
||||
String name = searchAddress.getString("keywords");
|
||||
String township = searchAddress.getString("township");
|
||||
String city = searchAddress.containsKey("city") ? searchAddress.getString("city") : null;
|
||||
String region = searchAddress.containsKey("district") ? searchAddress.getString("district") : null;
|
||||
String name = searchAddress.containsKey("keywords") ? searchAddress.getString("keywords") : null;
|
||||
String township = searchAddress.containsKey("township") ? searchAddress.getString("township") : null;
|
||||
if (StringUtils.isNotBlank(city) && StringUtils.isNotBlank(region) && StringUtils.isNotBlank(name)) {
|
||||
List<JSONObject> villages = findVillage(city, region, name);
|
||||
if (CollectionUtils.isNotEmpty(villages)) {
|
||||
@@ -568,6 +569,9 @@ public class AddressController {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
if (matchedVillage == false) {
|
||||
jsonResult.put("matchResult", new MatchDistrictResult());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user