Merge branch 'feature_master_xh_standard' into 'master'
地址标准化优化 See merge request !12
This commit is contained in:
+11
@@ -176,6 +176,17 @@ public class AddressParserServiceImpl implements AddressParserService {
|
|||||||
addr.setKeywords(poi);
|
addr.setKeywords(poi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(StringUtils.isNotBlank(addr.getKeywords()) && addr.getOrgAddress().indexOf(addr.getKeywords())>-1){
|
||||||
|
String str = AddressParserUtil.match(Pattern.compile(".*村(.*(组|队))?\\d+(号)?$"), addr.getOrgAddress().substring(addr.getOrgAddress().indexOf(addr.getKeywords()),addr.getOrgAddress().length()));
|
||||||
|
if(StringUtils.isNotBlank(str)){
|
||||||
|
String newKeywords = AddressParserUtil.match(Pattern.compile(".*村(.*(组|队))?"), str);
|
||||||
|
if(StringUtils.isNotBlank(newKeywords)){
|
||||||
|
addr.setKeywords(newKeywords);
|
||||||
|
addr.setParsedPropertyName(newKeywords);
|
||||||
|
aliyunBo.setRoomno(str.replace(newKeywords,""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(StringUtils.isNotBlank(aliyunBo.getCity())){
|
if(StringUtils.isNotBlank(aliyunBo.getCity())){
|
||||||
addr.setSuggestCity(aliyunBo.getCity());
|
addr.setSuggestCity(aliyunBo.getCity());
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-4
@@ -63,14 +63,18 @@ public class AddressFormatterFactory {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/*人民中路123-3501 -->人民中路123号3501室*/
|
/*人民中路123-128 -->人民中路123号-3501号*/
|
||||||
formatters.add(new AbstractAddressFormatter(Pattern.compile(".*[路|弄]\\d+-\\d{3,4}$")) {
|
formatters.add(new AbstractAddressFormatter(Pattern.compile(".*(路|街|大道|巷|道|((零|一|二|三|四|五|六|七|八|九|十|东|南|西|北|复)[线环条甲])|(胡同))(交汇|.{0,3}段|.*弄)?\\d+-\\d{3,4}(号)?$")) {
|
||||||
|
|
||||||
final Pattern TARGET_PATTERN = Pattern.compile("(?<=(路|号))\\d+-\\d{3,4}$");
|
final Pattern TARGET_PATTERN = Pattern.compile("(路|街|大道|巷|道|((零|一|二|三|四|五|六|七|八|九|十|东|南|西|北|复)[线环条甲])|(胡同))(交汇|.{0,3}段|.*弄)?\\d+-\\d{3,4}(号)?$");
|
||||||
@Override
|
@Override
|
||||||
protected String doFormat(String address) {
|
protected String doFormat(String address) {
|
||||||
String targetStr = DataUtil.match(address, TARGET_PATTERN);
|
String targetStr = DataUtil.match(address, TARGET_PATTERN);
|
||||||
return address.replace(targetStr, targetStr.replace("-", "号") + "室");
|
if(targetStr.endsWith("号")){
|
||||||
|
return address.replace(targetStr, targetStr.replace("-", "号-"));
|
||||||
|
}else{
|
||||||
|
return address.replace(targetStr, targetStr.replace("-", "号-") + "号");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user