This commit is contained in:
2024-11-27 18:22:14 +08:00
parent 6b0c7c4b18
commit ce66ee4213
2 changed files with 123 additions and 101 deletions
@@ -4215,7 +4215,6 @@ class CommonDatautils {
ElasticUtils.executeSqlQuery(sql, { map->
// 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]
// }
})
@@ -52,11 +52,13 @@ 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()
println cityObj.province+" " +cityObj.city+" "+results.size()
if(results){
def rows = running(cityObj.city, results)
save(rows)
}
// }
}
}
@@ -91,7 +93,7 @@ class NewGaoDePoiBatch extends BaseBatch{
});
}
latch.await()
return rets;
return rets
}
def getStandardRegion(mzbRegionMap, district){
@@ -130,7 +132,38 @@ class NewGaoDePoiBatch extends BaseBatch{
}
saveObj.name = map.name
if(map.cat){
saveObj = catWash(saveObj, map)
}
def location = [:]
location.lon = DataHandleUtils.getDoubleRound(6, map.lng)
location.lat = DataHandleUtils.getDoubleRound(6, map.lat)
saveObj.location = location
saveObj.spell_name = com.fangjia.core.util.DataUtil.hanyuQuanpin(map.name, " ")
saveObj.version = version
saveObj.data_id = map.map_id
saveObj.data_source = "高德地图"
saveObj.data_source_year = "2024-11"
if(saveObj.cat && TAGS.contains(saveObj.cat)){
saveObj.status = 0
}else{
saveObj.status = 1
}
def towns = townMap.get(saveObj.district)
if(location){
saveObj = addTown(saveObj, towns, location)
}
if(map.address){
saveObj = addressWash(saveObj, map, mzbRegionMap, towns)
}
return saveObj
}
def catWash(saveObj, map){
def arrs = map.cat.split(";|:")
if(arrs.size()>=1){
saveObj.type = arrs[0]
@@ -156,26 +189,10 @@ class NewGaoDePoiBatch extends BaseBatch{
}
saveObj.cat = saveObj.type+";"+saveObj.secondary_type+";"+saveObj.small_type
}
def location = [:]
location.lon = DataHandleUtils.getDoubleRound(6, map.lng)
location.lat = DataHandleUtils.getDoubleRound(6, map.lat)
saveObj.location = location
saveObj.spell_name = com.fangjia.core.util.DataUtil.hanyuQuanpin(map.name, " ")
saveObj.version = version
saveObj.data_id = map.map_id
saveObj.data_source = "高德地图"
saveObj.data_source_year = "2024-11"
if(saveObj.cat && TAGS.contains(saveObj.cat)){
saveObj.status = 0
}else{
saveObj.status = 1
return saveObj
}
def towns = townMap.get(saveObj.district)
if(location){
def addTown(saveObj, towns, location){
if(towns){
for(def town : towns){
if(town.shape && town.shape.coordinates){
@@ -198,9 +215,10 @@ class NewGaoDePoiBatch extends BaseBatch{
// }
// }
}
return saveObj
}
if(map.address){
def addressWash(saveObj, map, mzbRegionMap, towns){
if(map.address.length()<3){
saveObj.address = ""
}else{
@@ -217,18 +235,21 @@ class NewGaoDePoiBatch extends BaseBatch{
if(address && saveObj.district){
def tjjObj = mzbRegionMap.get(saveObj.district)
if(tjjObj){
def alias = tjjObj.alias
if(!alias){
alias = []
def alias = null
if(tjjObj.alias){
alias = new CopyOnWriteArrayList<>(tjjObj.alias);
}else{
alias = new CopyOnWriteArrayList<>();
}
if(!alias.contains(saveObj.district)){
alias << saveObj.district
}
// if(alias.size()>=2){
// alias.sort(){ a, b ->
// b.length().compareTo(a.length());
// }
// }
if(alias.size()>=2){
alias = alias.sort(){ a, b ->
b.length().compareTo(a.length());
}
}
for(def regionName : alias){
if(address.startsWith(regionName) && (regionName.endsWith("区") || regionName.endsWith("县"))){
@@ -246,18 +267,21 @@ class NewGaoDePoiBatch extends BaseBatch{
if(address && towns){
for(def town : towns){
def townAlias = town.alias
if(!townAlias){
townAlias = []
def townAlias = null
if(town.alias){
townAlias = new CopyOnWriteArrayList<>(town.alias);
}else{
townAlias = new CopyOnWriteArrayList<>();
}
if(!townAlias.contains(town.street)){
townAlias << town.street
}
// if(townAlias.size()>=2){
// townAlias = townAlias.sort(){ a, b ->
// b.length().compareTo(a.length());
// }
// }
if(townAlias.size()>=2){
townAlias = townAlias.sort(){ a, b ->
b.length().compareTo(a.length());
}
}
for(def townName : townAlias){
if(address.startsWith(townName)){
@@ -278,13 +302,12 @@ class NewGaoDePoiBatch extends BaseBatch{
saveObj.address = address
}
}
}
return saveObj
}
def save(rows){
BulkRequest request = new BulkRequest();
int batchSize = 1000;
int batchSize = 2000;
int processedCount = 0;
def client = ElasticUtils89.getClient("192.168.0.89")