File tree Expand file tree Collapse file tree 2 files changed +26
-6
lines changed
main/java/org/bitlap/geocoding/core/impl
test/java/org/bitlap/geocoding Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -384,15 +384,19 @@ open class RegionInterpreterVisitor (
384384 }
385385 }
386386
387- private fun updateCityAndProvince (distinct : RegionEntity ? ) {
388- if (distinct == null ) return
387+ private fun updateCityAndProvince (district : RegionEntity ? ) {
388+ if (district == null ) return
389389 if (! curDivision.hasCity()) {
390- curDivision.city = persister.getRegion(distinct.parentId)?.also { city ->
391- if (! curDivision.hasProvince()) {
392- curDivision.province = persister.getRegion(city.parentId)
393- }
390+ // CityLevelDistrict类型的parent是省级因此直接赋值city
391+ if (district.type == CityLevelDistrict ) {
392+ curDivision.city = district
393+ } else {
394+ curDivision.city = persister.getRegion(district.parentId)
394395 }
395396 }
397+ if (! curDivision.hasProvince() && curDivision.hasCity()) {
398+ curDivision.province = persister.getRegion(curDivision.city!! .parentId)
399+ }
396400 }
397401
398402 /* *
Original file line number Diff line number Diff line change @@ -516,6 +516,22 @@ class TestNormalizing {
516516 " 绿地城润园"
517517 )
518518 )
519+ // fix CityLevelDistrict 识别错误
520+ assertEquals(
521+ Geocoding .normalizing(" 陈场镇绿地城润园" ),
522+ Address (
523+ 420000000000 , " 湖北省" ,
524+ 429004000000 , " 仙桃市" ,
525+ 429004000000 , " 仙桃市" ,
526+ 429004114000 , " 陈场镇" ,
527+ 429004114000 , " 陈场镇" ,
528+ null , null ,
529+ null ,
530+ null ,
531+ null ,
532+ " 绿地城润园"
533+ )
534+ )
519535 }
520536
521537
You can’t perform that action at this time.
0 commit comments