|
@@ -432,6 +432,9 @@ public class ShoppingServiceImpl implements IShoppingService { |
|
@@ -432,6 +432,9 @@ public class ShoppingServiceImpl implements IShoppingService { |
432
|
|
432
|
|
433
|
}
|
433
|
}
|
434
|
|
434
|
|
|
|
435
|
+ public static final String KEY_AREA_STR = "区";
|
|
|
436
|
+
|
|
|
437
|
+ public static final String[] REPLACE_STR = {"鉴定中心", "UFO"};
|
435
|
|
438
|
|
436
|
/**
|
439
|
/**
|
437
|
* 查询并校验用户地址(left: 用户地址; right: 脱敏的用户地址)
|
440
|
* 查询并校验用户地址(left: 用户地址; right: 脱敏的用户地址)
|
|
@@ -456,9 +459,23 @@ public class ShoppingServiceImpl implements IShoppingService { |
|
@@ -456,9 +459,23 @@ public class ShoppingServiceImpl implements IShoppingService { |
456
|
|
459
|
|
457
|
// 检查地址是否是鉴定中心的地址
|
460
|
// 检查地址是否是鉴定中心的地址
|
458
|
List<AppraiseAddressResp> appraiseAddressRespList = appraiseAddressService.queryAddressInfoList();
|
461
|
List<AppraiseAddressResp> appraiseAddressRespList = appraiseAddressService.queryAddressInfoList();
|
459
|
- List<String> appraiseAddressStrList = appraiseAddressRespList.stream().map(AppraiseAddressResp::getAddress).distinct().collect(Collectors.toList());
|
462
|
+ List<String> appraiseAddressStrList = appraiseAddressRespList.stream().map(AppraiseAddressResp::getAddress).distinct().map(address->{
|
|
|
463
|
+ // 为了提高相似字符串的匹配程度,截掉区之前的字符串以及鉴定中心字符串
|
|
|
464
|
+ String str = address;
|
|
|
465
|
+ int index = str.indexOf(KEY_AREA_STR);
|
|
|
466
|
+ if (index != -1){
|
|
|
467
|
+ str = str.substring(index+1, str.length());
|
|
|
468
|
+ }
|
|
|
469
|
+
|
|
|
470
|
+ for (String replace : REPLACE_STR){
|
|
|
471
|
+ str = str.replaceAll(replace, "");
|
|
|
472
|
+ }
|
|
|
473
|
+
|
|
|
474
|
+ return str;
|
|
|
475
|
+ }).distinct().collect(Collectors.toList());
|
460
|
// 存在和鉴定中心相同的地址
|
476
|
// 存在和鉴定中心相同的地址
|
461
|
- if (appraiseAddressStrList.stream().filter(x->StringSimilarity.compute(x, addressInfo.getAddress())>0.5).findFirst().isPresent()){
|
477
|
+ if (appraiseAddressStrList.stream().filter(x->StringSimilarity.getSimilarityRatio(x, addressInfo.getAddress())>0.5).findFirst().isPresent()
|
|
|
478
|
+ || addressInfo.getAddress().contains(REPLACE_STR[0])){
|
462
|
logger.warn("submit address can not appraiseAddress, uid is {}, address is {}",shoppingRequest.getUid(), addressInfo.getAddress() );
|
479
|
logger.warn("submit address can not appraiseAddress, uid is {}, address is {}",shoppingRequest.getUid(), addressInfo.getAddress() );
|
463
|
throw new ServiceException(ServiceError.BUY_ADDRESS_CAN_NOT_APPRAISE_ADDRESS);
|
480
|
throw new ServiceException(ServiceError.BUY_ADDRESS_CAN_NOT_APPRAISE_ADDRESS);
|
464
|
}
|
481
|
}
|