添加围栏,限制匹配小区区域

This commit is contained in:
wangwenyan@fangjia.com
2022-05-18 17:58:36 +08:00
parent 40e68aa3d1
commit 4f9f044182
2 changed files with 10 additions and 10 deletions
@@ -762,10 +762,10 @@ public class AddressParserServiceImpl implements AddressParserService {
if(PreciseLevel.STRICT == address.getPreciseLevel() && !sameDistrict){
return 0;
}
//当地图解析出来的区域和用户地址中的区域一致时,只匹配指定区域下面的小区
if(address.getGeoRegion() != null && address.getGeoRegion().equals(address.getDistrict()) && !sameDistrict){
return 0;
}
// //当地图解析出来的区域和用户地址中的区域一致时,只匹配指定区域下面的小区
// if(address.getGeoRegion() != null && address.getGeoRegion().equals(address.getDistrict()) && !sameDistrict){
// return 0;
// }
Iterator<Map.Entry<String, MatchText>> addrEntrySet = metaData.getAddrePinYinMap().entrySet().iterator();
Map.Entry<String, MatchText> addrEntry;
while(addrEntrySet.hasNext()){
@@ -20,7 +20,7 @@ public class GeoProcessor extends AbstractAddressProcessor {
private static final String KEY = "4ccfe3c898a9489884bd2bcb1ef6dcde";
List<String> POI_LEVELS = Arrays.asList("村庄", "热点商圈", "兴趣点", "门牌号", "单元号", "道路交叉路口");
List<String> POI_LEVELS = Arrays.asList("村庄", "热点商圈", "兴趣点", "门牌号", "单元号", "道路交叉路口", "门牌号");
@Override
public RepeatStatus process(Address address) {
@@ -50,11 +50,11 @@ public class GeoProcessor extends AbstractAddressProcessor {
}
if(POI_LEVELS.contains(json.getString("level"))){
//对于门牌号级别的POI,formatted_address中包含|代表是推测出来的路号,重庆市巴南区凤林路|808号,|号楼
if("门牌号".equals(json.getString("level"))){
if(!(json.get("number") instanceof JSONArray) && json.getString("formatted_address").contains("|" + json.getString("number"))){
return RepeatStatus.NEXT;
}
}
// if("门牌号".equals(json.getString("level"))){
// if(!(json.get("number") instanceof JSONArray) && json.getString("formatted_address").contains("|" + json.getString("number"))){
// return RepeatStatus.NEXT;
// }
// }
String location = json.getString("location");
address.setLng(Double.valueOf(location.split(",")[0]));
address.setLat(Double.valueOf(location.split(",")[1]));