From 6b0c7c4b1844e8e64ee7e897364701a725ead373 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Tue, 26 Nov 2024 19:01:05 +0800 Subject: [PATCH] update --- .../script/commData/CommonDatautils.groovy | 8 +- .../gj/data_handle/NewGaoDePoiBatch.groovy | 134 ++++++++++++++---- 2 files changed, 109 insertions(+), 33 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy index c3d473a3b..ed3314d22 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy @@ -4213,9 +4213,11 @@ class CommonDatautils { def rets = [] def index= 0 ElasticUtils.executeSqlQuery(sql, { map-> - index++ - println index - rets << ["map_id":map.id,"province":map.pname,"city":map.cityname, "district":map.adname, "name":map.name, "address":map.address, "cat":map.type,"lng":map.location.x, "lat":map.location.y] +// if(map.address && map.address.contains("五角场")){ + index++ + println index + rets << ["map_id":map.id,"province":map.pname,"city":map.cityname, "district":map.adname, "name":map.name, "address":map.address, "cat":map.type,"lng":map.location.x, "lat":map.location.y] +// } }) return rets; } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/NewGaoDePoiBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/NewGaoDePoiBatch.groovy index 937f4cbd0..15b8005d6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/NewGaoDePoiBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data_handle/NewGaoDePoiBatch.groovy @@ -29,6 +29,8 @@ class NewGaoDePoiBatch extends BaseBatch{ public static def version = new Date().getTime() public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) + def regionFullNameMap = com.fangjia.script.commData.CommonDatautils.queryAllRegionFullNameByCity() + public static def TAGS = [] static main(args) { @@ -50,12 +52,12 @@ class NewGaoDePoiBatch extends BaseBatch{ def cityList = CommonDatautils.findFullNameCitys().reverse() for(def cityObj : cityList){ - if(cityObj.city == "上海市"){ +// if(cityObj.city == "上海市"){ def results = CommonDatautils.findAllNewPoiDatas(cityObj.city) println cityObj.city+" "+results.size() def rows = running(cityObj.city, results) save(rows) - } +// } } } def getAllPoiType(filePath){ @@ -72,13 +74,14 @@ class NewGaoDePoiBatch extends BaseBatch{ def totalCount = new AtomicLong() final CountDownLatch latch = new CountDownLatch(results.size()) def townMap = CommonDatautils.queryTownByCity(city, ["city","district","mzb_district_name", "street", "shape","alias"]) + def mzbRegionMap = regionFullNameMap.get(city) for(def i=0;i=2){ +// alias.sort(){ a, b -> +// b.length().compareTo(a.length()); +// } +// } + + for(def regionName : alias){ + if(address.startsWith(regionName) && (regionName.endsWith("区") || regionName.endsWith("县"))){ + address = address.substring(regionName.toString().length()) + break + } + } + } } - if(address.toString().startsWith("市辖区")){ - address = address.toString().substring(0, 3) + + + if(address && address.toString().startsWith("市辖区")){ + address = address.toString().substring(3) } - if(saveObj.township && address.toString().startsWith(saveObj.township)){ - address = address.toString().substring(0, saveObj.township.toString().length()) + + if(address && towns){ + for(def town : towns){ + def townAlias = town.alias + if(!townAlias){ + townAlias = [] + } + if(!townAlias.contains(town.street)){ + townAlias << town.street + } +// if(townAlias.size()>=2){ +// townAlias = townAlias.sort(){ a, b -> +// b.length().compareTo(a.length()); +// } +// } + + for(def townName : townAlias){ + if(address.startsWith(townName)){ + address = address.substring(townName.toString().length()) +// if(!saveObj.township){ +// saveObj.township = town.street +// } + break + } + } + } } i++ } @@ -201,8 +277,6 @@ class NewGaoDePoiBatch extends BaseBatch{ }else{ saveObj.address = address } - - } } return saveObj