匹配接口新增自然村匹配
This commit is contained in:
+10
-6
@@ -87,7 +87,7 @@ import com.fangjia.service.open.WaitCrawlKeywordsService;
|
|||||||
import com.fangjia.service.sql.FjtEvaluationService;
|
import com.fangjia.service.sql.FjtEvaluationService;
|
||||||
import com.fangjia.service.web.AddressService;
|
import com.fangjia.service.web.AddressService;
|
||||||
|
|
||||||
@Authority(role = Role.USER)
|
//@Authority(role = Role.USER)
|
||||||
public class AddressController {
|
public class AddressController {
|
||||||
|
|
||||||
private AddressService addressService;
|
private AddressService addressService;
|
||||||
@@ -492,7 +492,7 @@ public class AddressController {
|
|||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Authority(role = Role.USER)
|
//@Authority(role = Role.USER)
|
||||||
public Object matchV2Action(AddesssMatchModel model) {
|
public Object matchV2Action(AddesssMatchModel model) {
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
String result = addressMatchProxyService.parser(convertModelToMap(model));
|
String result = addressMatchProxyService.parser(convertModelToMap(model));
|
||||||
@@ -526,12 +526,13 @@ public class AddressController {
|
|||||||
} else if (jsonResult != null) {
|
} else if (jsonResult != null) {
|
||||||
// 判断是否为自然村
|
// 判断是否为自然村
|
||||||
boolean matchedVillage = false;
|
boolean matchedVillage = false;
|
||||||
|
try {
|
||||||
if (jsonResult.get("searchAddress") != null) {
|
if (jsonResult.get("searchAddress") != null) {
|
||||||
JSONObject searchAddress = (JSONObject) jsonResult.get("searchAddress");
|
JSONObject searchAddress = (JSONObject) jsonResult.get("searchAddress");
|
||||||
String city = searchAddress.getString("city");
|
String city = searchAddress.containsKey("city") ? searchAddress.getString("city") : null;
|
||||||
String region = searchAddress.getString("district");
|
String region = searchAddress.containsKey("district") ? searchAddress.getString("district") : null;
|
||||||
String name = searchAddress.getString("keywords");
|
String name = searchAddress.containsKey("keywords") ? searchAddress.getString("keywords") : null;
|
||||||
String township = searchAddress.getString("township");
|
String township = searchAddress.containsKey("township") ? searchAddress.getString("township") : null;
|
||||||
if (StringUtils.isNotBlank(city) && StringUtils.isNotBlank(region) && StringUtils.isNotBlank(name)) {
|
if (StringUtils.isNotBlank(city) && StringUtils.isNotBlank(region) && StringUtils.isNotBlank(name)) {
|
||||||
List<JSONObject> villages = findVillage(city, region, name);
|
List<JSONObject> villages = findVillage(city, region, name);
|
||||||
if (CollectionUtils.isNotEmpty(villages)) {
|
if (CollectionUtils.isNotEmpty(villages)) {
|
||||||
@@ -568,6 +569,9 @@ public class AddressController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
if (matchedVillage == false) {
|
if (matchedVillage == false) {
|
||||||
jsonResult.put("matchResult", new MatchDistrictResult());
|
jsonResult.put("matchResult", new MatchDistrictResult());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user