|
@@ -344,9 +344,7 @@ public class YyskAddressStandardizationServiceImpl {
|
|
yyskAddressStandardization.setResidentialCommittee(item.getOrDefault("residentialCommittee", "").toString());
|
|
yyskAddressStandardization.setResidentialCommittee(item.getOrDefault("residentialCommittee", "").toString());
|
|
yyskAddressStandardization.setLon(item.getOrDefault("lat", "").toString());
|
|
yyskAddressStandardization.setLon(item.getOrDefault("lat", "").toString());
|
|
yyskAddressStandardization.setLat(item.getOrDefault("lon", "").toString());
|
|
yyskAddressStandardization.setLat(item.getOrDefault("lon", "").toString());
|
|
- if (!yyskAddressStandardization.getMatchLevel().contains("rule_0") && !yyskAddressStandardization.getMatchLevel().contains("异常") && !yyskAddressStandardization.getDistinguish().contains("[]")) {
|
|
|
|
- listData.add(yyskAddressStandardization);
|
|
|
|
- }
|
|
|
|
|
|
+ listData.add(yyskAddressStandardization);
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
listData = null;
|
|
listData = null;
|
|
@@ -416,6 +414,7 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 搜索主逻辑
|
|
* 搜索主逻辑
|
|
|
|
+ *
|
|
* @param listData 传入List<YyskDmdzAddressStandardization> 其中address不能为空
|
|
* @param listData 传入List<YyskDmdzAddressStandardization> 其中address不能为空
|
|
* @return 处理后的List<YyskDmdzAddressStandardization>
|
|
* @return 处理后的List<YyskDmdzAddressStandardization>
|
|
*/
|
|
*/
|
|
@@ -439,22 +438,53 @@ public class YyskAddressStandardizationServiceImpl {
|
|
boolean ifSearchTag = true;
|
|
boolean ifSearchTag = true;
|
|
// 首先判断是否为非上海市地址
|
|
// 首先判断是否为非上海市地址
|
|
String[] ams = AddressMatcher.matchProvinceAndCity(item.getAddress());
|
|
String[] ams = AddressMatcher.matchProvinceAndCity(item.getAddress());
|
|
- if(ams != null && ams[0] != null){
|
|
|
|
- if(!ams[0].equals("上海市")){
|
|
|
|
|
|
+ if (ams != null && ams[0] != null) {
|
|
|
|
+ if (!ams[0].equals("上海市")) {
|
|
item.setMatchLevel("rule_0");
|
|
item.setMatchLevel("rule_0");
|
|
item.setProvinces(ams[0]);
|
|
item.setProvinces(ams[0]);
|
|
- if(ams[1] != null){
|
|
|
|
|
|
+ if (ScheduledTasks.errorCount.containsKey("外地数据")) {
|
|
|
|
+ ScheduledTasks.errorCount.put("外地数据", ScheduledTasks.errorCount.get("外地数据") + 1);
|
|
|
|
+ } else {
|
|
|
|
+ ScheduledTasks.errorCount.put("外地数据", 1);
|
|
|
|
+ }
|
|
|
|
+ if (ams[1] != null) {
|
|
item.setMarket(ams[1]);
|
|
item.setMarket(ams[1]);
|
|
}
|
|
}
|
|
ifSearchTag = false;
|
|
ifSearchTag = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (item.getAddress().contains("http")) {
|
|
|
|
+ ifSearchTag = false;
|
|
|
|
+ item.setMatchLevel("异常");
|
|
|
|
+ if (ScheduledTasks.errorCount.containsKey("链接数据")) {
|
|
|
|
+ ScheduledTasks.errorCount.put("链接数据", ScheduledTasks.errorCount.get("链接数据") + 1);
|
|
|
|
+ } else {
|
|
|
|
+ ScheduledTasks.errorCount.put("链接数据", 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (item.getStandardAddress() != null && !item.getStandardAddress().isEmpty() && item.getProvinces().equals("上海市") && item.getStandardAddress().contains(item.getDistinguish())) {
|
|
|
|
+ ifSearchTag = false;
|
|
|
|
+ String newStandardAddress = item.getProvinces() + item.getDistinguish() + item.getStreetTown() + AddressTools.returnAddress(item.getAddress());
|
|
|
|
+ if (!item.getStandardAddress().equals(newStandardAddress)) {
|
|
|
|
+ if (ScheduledTasks.errorCount.containsKey("分词错误")) {
|
|
|
|
+ ScheduledTasks.errorCount.put("分词错误", ScheduledTasks.errorCount.get("分词错误") + 1);
|
|
|
|
+ } else {
|
|
|
|
+ ScheduledTasks.errorCount.put("分词错误", 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ item.setStandardAddress(newStandardAddress);
|
|
|
|
+ }
|
|
if (ifSearchTag) {
|
|
if (ifSearchTag) {
|
|
// TODO 开始查询
|
|
// TODO 开始查询
|
|
AddressResult addressResult = AddressQueryEngine.getInstance().commonSearchByName(addrList);
|
|
AddressResult addressResult = AddressQueryEngine.getInstance().commonSearchByName(addrList);
|
|
if (addressResult == null || addressResult.getData() == null || addressResult.getData().size() < 1) {
|
|
if (addressResult == null || addressResult.getData() == null || addressResult.getData().size() < 1) {
|
|
item.setMatchLevel("异常");
|
|
item.setMatchLevel("异常");
|
|
item.setReturnAddress("未匹配到符合规则的结果");
|
|
item.setReturnAddress("未匹配到符合规则的结果");
|
|
|
|
+ if (ScheduledTasks.errorCount.containsKey("匹配异常")) {
|
|
|
|
+ ScheduledTasks.errorCount.put("匹配异常", ScheduledTasks.errorCount.get("匹配异常") + 1);
|
|
|
|
+ } else {
|
|
|
|
+ ScheduledTasks.errorCount.put("匹配异常", 1);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
try {
|
|
try {
|
|
for (AddressResult.ContentBean contentBean : addressResult.getData()) {
|
|
for (AddressResult.ContentBean contentBean : addressResult.getData()) {
|
|
@@ -509,12 +539,22 @@ public class YyskAddressStandardizationServiceImpl {
|
|
} else {
|
|
} else {
|
|
item.setMatchLevel("异常");
|
|
item.setMatchLevel("异常");
|
|
item.setReturnAddress("查询结果处理异常");
|
|
item.setReturnAddress("查询结果处理异常");
|
|
|
|
+ if (ScheduledTasks.errorCount.containsKey("匹配异常")) {
|
|
|
|
+ ScheduledTasks.errorCount.put("匹配异常", ScheduledTasks.errorCount.get("匹配异常") + 1);
|
|
|
|
+ } else {
|
|
|
|
+ ScheduledTasks.errorCount.put("匹配异常", 1);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
item.setMatchLevel("异常");
|
|
item.setMatchLevel("异常");
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
System.err.println("查询结果处理异常:" + e);
|
|
System.err.println("查询结果处理异常:" + e);
|
|
|
|
+ if (ScheduledTasks.errorCount.containsKey("处理异常")) {
|
|
|
|
+ ScheduledTasks.errorCount.put("处理异常", ScheduledTasks.errorCount.get("处理异常") + 1);
|
|
|
|
+ } else {
|
|
|
|
+ ScheduledTasks.errorCount.put("处理异常", 1);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|