|
@@ -240,7 +240,7 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
YyskAddressStandardization yyskAddressStandardization = new YyskAddressStandardization();
|
|
|
String matchLevel = item.get("matchLevel").toString();
|
|
|
if (matchLevel != null && !matchLevel.isEmpty() && !"异常".equals(matchLevel) && !"rule_0".equals(matchLevel) && item.get("lat") != null && item.get("lon") != null) {
|
|
|
- if ("rule_2".equals(matchLevel) || "rule_4".equals(matchLevel) || Float.parseFloat(matchLevel) > 1.8) {
|
|
|
+ if ("rule_2".equals(matchLevel) || "rule_3".equals(matchLevel) || "rule_4".equals(matchLevel) || Float.parseFloat(matchLevel) > 1.8) {
|
|
|
yyskAddressStandardization.setAddress(item.get("address").toString());
|
|
|
yyskAddressStandardization.setReturnAddress(item.get("returnAddress").toString());
|
|
|
yyskAddressStandardization.setStandardAddress(item.get("standardAddress").toString());
|
|
@@ -316,8 +316,8 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
int taskId = sort * i + startFileIndex;
|
|
|
// 任务执行
|
|
|
- startMutilExecutor(taskId, fileRootPath + "datas\\yysk_dmdz_address_standardization_200000_" + taskId + ".xlsx",
|
|
|
- fileRootPath + "output\\yysk_dmdz_address_standardization_200000_" + taskId + ".xlsx");
|
|
|
+ startMutilExecutor(taskId, fileRootPath + "output\\yysk_dmdz_address_standardization_200000_" + taskId + ".xlsx",
|
|
|
+ fileRootPath + "output2\\yysk_dmdz_address_standardization_200000_" + taskId + ".xlsx");
|
|
|
/*startMutilExecutor(taskId, fileRootPath + "ziranren\\yysk_dmdz_address_standardization_10000_" + taskId + ".xlsx",
|
|
|
fileRootPath + "ziranrenOutput\\yysk_dmdz_address_standardization_10000_" + taskId + ".xlsx");*/
|
|
|
long endTime = System.currentTimeMillis();
|
|
@@ -334,8 +334,18 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
List<Map<String, Object>> fileData = ExcelReaderUtils.readExcel(filePath);
|
|
|
for (Map<String, Object> item : fileData) {
|
|
|
YyskAddressStandardization yyskAddressStandardization = new YyskAddressStandardization();
|
|
|
- yyskAddressStandardization.setAddress(item.get("address").toString());
|
|
|
- yyskAddressStandardization.setDataTag(item.get("dataTag").toString());
|
|
|
+ yyskAddressStandardization.setAddress(item.getOrDefault("address", "").toString());
|
|
|
+ yyskAddressStandardization.setDataTag(item.getOrDefault("dataTag", "").toString());
|
|
|
+ yyskAddressStandardization.setMatchLevel(item.getOrDefault("matchLevel", "").toString());
|
|
|
+ yyskAddressStandardization.setReturnAddress(item.getOrDefault("returnAddress", "").toString());
|
|
|
+ yyskAddressStandardization.setStandardAddress(item.getOrDefault("standardAddress", "").toString());
|
|
|
+ yyskAddressStandardization.setProvinces(item.getOrDefault("provinces", "").toString());
|
|
|
+ yyskAddressStandardization.setMarket(item.getOrDefault("market", "").toString());
|
|
|
+ yyskAddressStandardization.setDistinguish(item.getOrDefault("distinguish", "").toString());
|
|
|
+ yyskAddressStandardization.setStreetTown(item.getOrDefault("streetTown", "").toString());
|
|
|
+ yyskAddressStandardization.setResidentialCommittee(item.getOrDefault("residentialCommittee", "").toString());
|
|
|
+ yyskAddressStandardization.setLon(item.getOrDefault("lat", "").toString());
|
|
|
+ yyskAddressStandardization.setLat(item.getOrDefault("lon", "").toString());
|
|
|
listData.add(yyskAddressStandardization);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -356,7 +366,7 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
|
|
|
public List<YyskAddressStandardization> runExecutorService(List<YyskAddressStandardization> listData) {
|
|
|
// 创建线程池
|
|
|
- int executorSize = Runtime.getRuntime().availableProcessors() / 4;
|
|
|
+ int executorSize = Runtime.getRuntime().availableProcessors() / 2;
|
|
|
System.out.println("创建线程池个数:" + executorSize);
|
|
|
ExecutorService executorService = Executors.newFixedThreadPool(executorSize);
|
|
|
List<Future<?>> futures = new ArrayList<>();
|
|
@@ -383,7 +393,16 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
item.setStreetTown(strs[2] == null ? "" : strs[2]);
|
|
|
}
|
|
|
}
|
|
|
- if (addrList.size() > 0) {
|
|
|
+ String dbMatchLevel = item.getMatchLevel();
|
|
|
+ boolean ifSearch = true;
|
|
|
+ try {
|
|
|
+ if (dbMatchLevel.contains("rule_") || Float.parseFloat(dbMatchLevel) > 1.5) {
|
|
|
+ ifSearch = false;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if (ifSearch && addrList.size() > 0) {
|
|
|
// TODO 开始查询
|
|
|
AddressResult addressResult = AddressQueryEngine.getInstance().commonSearchByName(addrList);
|
|
|
if (addressResult == null || addressResult.getData() == null || addressResult.getData().size() < 1) {
|
|
@@ -469,8 +488,8 @@ public class YyskAddressStandardizationServiceImpl {
|
|
|
try {
|
|
|
future.get();
|
|
|
} catch (InterruptedException | ExecutionException e) {
|
|
|
- e.printStackTrace();
|
|
|
- System.err.println("线程异常:" + e);
|
|
|
+// e.printStackTrace();
|
|
|
+// System.err.println("线程异常:" + e);
|
|
|
}
|
|
|
}
|
|
|
// 关闭线程池
|