|
@@ -379,10 +379,21 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
if (item.getAddress() != null && !item.getAddress().isEmpty()) {
|
|
|
addrList.add(item.getAddress());
|
|
|
}
|
|
|
+ boolean ifSearch = true;
|
|
|
+ if (item.getMatchLevel().contains("rule_0")) {
|
|
|
+ String[] addr = AddressMatcher.matchProvinceAndCity(item.getAddress());
|
|
|
+ if (addr != null && !addr[0].contains("上海")) {
|
|
|
+ if ((!addr[0].isEmpty() && (item.getAddress().contains(addr[0]) || addr[0].contains(item.getAddress()))) || (!addr[1].isEmpty() && (item.getAddress().contains(addr[1]) || addr[1].contains(item.getAddress())))) {
|
|
|
+ item.setProvinces(addr[0]);
|
|
|
+ item.setMarket(addr[1]);
|
|
|
+ ifSearch = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ;
|
|
|
// 匹配全国省名
|
|
|
// 遍历全国城市名称匹配搜索地址市名
|
|
|
- /*String[] addr = AddressMatcher.matchProvinceAndCity(item.getAddress());
|
|
|
- boolean ifSearch = true;
|
|
|
+ /*
|
|
|
if (addr != null && !addr[0].contains("上海")) {
|
|
|
addrList.add(item.getAddress());
|
|
|
item.setMatchLevel("rule_0");
|
|
@@ -395,7 +406,7 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
} else {
|
|
|
addrList.add(item.getAddress());
|
|
|
ifSearch = false;
|
|
|
-// String[] strs = AddressTools.parseAddressJZ(item.getAddress());
|
|
|
+ String[] strs = AddressTools.parseAddressJZ(item.getAddress());
|
|
|
// if (strs != null) {
|
|
|
// item.setProvinces(strs[0] == null ? "" : strs[0]);
|
|
|
// item.setMarket(strs[0] == null ? "" : strs[0]);
|
|
@@ -410,7 +421,7 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}*/
|
|
|
- if (item.getMatchLevel().contains("rule_0") && addrList.size() > 0) {
|
|
|
+ if (ifSearch && addrList.size() > 0) {
|
|
|
// TODO 开始查询
|
|
|
AddressResult addressResult = AddressQueryEngine.getInstance().commonSearchByName(addrList);
|
|
|
if (addressResult == null || addressResult.getData() == null || addressResult.getData().size() < 1) {
|
|
@@ -477,8 +488,8 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
item.setStandardAddress(item.getMarket() + item.getDistinguish() + item.getStreetTown() + AddressQueryEngine.townReplace_ct(oldAddress));
|
|
|
break;
|
|
|
} else {
|
|
|
- item.setMatchLevel("rule_0");
|
|
|
- item.setReturnAddress("");
|
|
|
+ item.setMatchLevel("异常");
|
|
|
+ item.setReturnAddress("查询结果处理异常");
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|