地址别名处理
This commit is contained in:
+64
-24
@@ -18,11 +18,45 @@ class AddrAlaisProcess {
|
||||
static main(args) {
|
||||
def task = new AddrAlaisProcess()
|
||||
// task.run()
|
||||
// task.splitDist()
|
||||
// task.addAddr()
|
||||
task.nineApi()
|
||||
// task.createResult()
|
||||
// task.mergeResult()
|
||||
}
|
||||
|
||||
def splitDist(){
|
||||
def rows = ExcelUtils.read("D:\\数据\\数据建设\\小区\\全量小区地址及地址别名.xlsx",0,1)
|
||||
println "原始总计:"+rows.size()
|
||||
def rets = []
|
||||
for(def d : rows){
|
||||
def addr = d['F']
|
||||
if(d['G']){
|
||||
addr = addr +","+d['G']
|
||||
}
|
||||
|
||||
def addrs = addr.split(",")
|
||||
for(def s : addrs){
|
||||
rets << [d['A'], d['B'], d['C'], d['D'], d['E'], s]
|
||||
}
|
||||
}
|
||||
println "总计:"+rets.size()
|
||||
FileUtils.batchCreateFileByCustomSuffix(rets, "D:\\数据\\数据建设\\小区\\有地址小区地址标准化(一行一个地址).bat", null, "utf-8", false, " ","");
|
||||
}
|
||||
|
||||
def addAddr(){
|
||||
def fileName = "D:\\数据\\数据建设\\小区\\无地址小区.xlsx"
|
||||
ExcelUtils.multiThreadingModify(fileName,{d->
|
||||
def dist = CommonDatautils.findDistrictById(d['B'])
|
||||
if(dist){
|
||||
// d['F'] = dist.address
|
||||
if(dist.addr_alias){
|
||||
d['G'] = dist.addr_alias.join(",")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
def mergeResult(){
|
||||
def rets = ExcelUtils.read("D:\\数据\\数据建设\\小区\\ai-结果-0221.xlsx",0,1)
|
||||
@@ -66,28 +100,31 @@ class AddrAlaisProcess {
|
||||
|
||||
|
||||
def nineApi(){
|
||||
def fileName = "/home/goojia/gj/district/addr_alias.xlsx"
|
||||
if (CommonDatautils.isWindow()) {
|
||||
fileName = "D:\\数据\\数据建设\\写字楼\\写字楼待处理地址.xlsx"
|
||||
}
|
||||
|
||||
ExcelUtils.multiThreadingModify(fileName, {d->
|
||||
def obj = CommonDatautils.findDistrictById(d['A'])
|
||||
// def addrMap = nineAddrSplit(obj.city, d['B'])
|
||||
def addrList = []
|
||||
// if(addrMap && addrMap.address){
|
||||
// d['C'] = addrMap.road
|
||||
// d['D'] = addrMap.road_num
|
||||
// }
|
||||
if(d['C']){
|
||||
def data = fullCityMap.get(obj.city)
|
||||
if(data){
|
||||
def roadObj = findBaiduDatas( data.city, d['C'])
|
||||
if(roadObj){
|
||||
d['E'] = "百度存在"
|
||||
}
|
||||
}
|
||||
}
|
||||
def i = 0;
|
||||
while(i<20) {
|
||||
def fileName = "/home/goojia/gj/district/dist_addr_${i}.xlsx"
|
||||
if (CommonDatautils.isWindow()) {
|
||||
fileName = "D:\\数据\\数据建设\\小区\\dist_addr_0.xlsx"
|
||||
}
|
||||
File file=new File(fileName);
|
||||
if(file.exists()){
|
||||
ExcelUtils.multiThreadingModify(fileName, {d->
|
||||
def addrMap = nineAddrSplit(d['D'], d['G'])
|
||||
def addrList = []
|
||||
if(addrMap && addrMap.address){
|
||||
d['H'] = addrMap.road
|
||||
d['I'] = addrMap.road_num
|
||||
}
|
||||
if(d['H']){
|
||||
def data = fullCityMap.get(d['D'])
|
||||
if(data){
|
||||
def roadObj = findBaiduDatas( data.city, d['H'])
|
||||
if(roadObj){
|
||||
d['J'] = "百度存在"
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(d['F']){
|
||||
// def addrs = d['F'].split(",")
|
||||
// def addr_alias = []
|
||||
@@ -102,7 +139,10 @@ class AddrAlaisProcess {
|
||||
// }
|
||||
// d['I'] = addr_alias.join(",")
|
||||
// }
|
||||
})
|
||||
})
|
||||
println fileName +" 完成 "
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -148,7 +188,7 @@ class AddrAlaisProcess {
|
||||
def num = 0
|
||||
for(def d : districts){
|
||||
num++
|
||||
def row = [num, d.city, d.region, d.name, d.address]
|
||||
def row = [num, d._id.toString(), d.city, d.region, d.name, d.address]
|
||||
if(d.addr_alias){
|
||||
row << d.addr_alias.join(",")
|
||||
}
|
||||
@@ -156,7 +196,7 @@ class AddrAlaisProcess {
|
||||
}
|
||||
}
|
||||
// ExcelUtils.write("D:\\数据\\数据建设\\小区\\小区地址及地址别名标准化.xlsx", rows, "小区")
|
||||
FileUtils.batchCreateFileByCustomSuffix(rows, "D:\\数据\\数据建设\\小区\\小区地址及地址别名标准化.bat", null, "utf-8", false, "#","");
|
||||
FileUtils.batchCreateFileByCustomSuffix(rows, "D:\\数据\\数据建设\\小区\\小区地址及地址别名标准化-20250402.bat", null, "utf-8", false, "#","");
|
||||
}
|
||||
|
||||
def findBaiduDatas(city, name){
|
||||
|
||||
Reference in New Issue
Block a user