Merge branch 'script_gj' into 'master'

Script gj

See merge request !1092
This commit is contained in:
2025-03-20 09:35:45 +08:00
@@ -25,27 +25,35 @@ class AutoAddOfficeBatch extends BaseBatch{
@Override @Override
void process(Object args) { void process(Object args) {
// def pattern = /[A-Z]座|[0-9a-z]栋|[A-Z]栋|·|\(建设中\)|/ // def pattern = /[A-Z0-9]座|[0-9a-z]栋|[A-Z]栋|·|\(建设中\)|[0-9]号楼|\(装修中\)|[A-Z]楼|[0-9]幢/
// println "开放广场商务写字楼C栋".replaceAll(pattern, "") // def newName = "开放广场".replaceAll(pattern, "")
// println newName
def citys = ["临沂"]//CommonDatautils.findAllCity() def citys = CommonDatautils.findAllCity()
def allAddOffices = []
allAddOffices << ["地图ID","省","市","区","写字楼名称","地址","经度","纬度","匹配城市","匹配区域","匹配名称","匹配方式"]
for(def c : citys){ for(def c : citys){
def cityObj = fullCityMap.get(c) def cityObj = fullCityMap.get(c)
if(cityObj){ if(cityObj){
def officeMaps = CommonDatautils.findOfficeByMap(cityObj.city, "商务写字楼") def officeMaps = CommonDatautils.findOfficeByMap(cityObj.city, "商务写字楼")
officeMaps = filterOffice(officeMaps) officeMaps = filterOffice(officeMaps)
def offices = matchOffice(officeMaps) if(officeMaps){
ExcelUtils.write("D:\\数据\\高德写字楼.xlsx", offices, "数据") def offices = matchOffice(officeMaps)
allAddOffices.addAll(offices)
}
} }
} }
ExcelUtils.write("D:\\数据\\高德写字楼.xlsx", allAddOffices, "数据")
} }
def filterOffice(officeMaps){ def filterOffice(officeMaps){
def offices = [] def offices = []
def keys = [] def keys = []
for(def o : officeMaps){ for(def o : officeMaps){
println o.map_id if(!o){
if(o.name.startsWith("写字楼") || o.name.startsWith("综合楼") || o.name.contains("销售") || o.name.startsWith("办公楼") || o.name.startsWith("公务楼") || o.name.startsWith("行政楼") || o.name.startsWith("商务办公楼") || o.name.contains("综合办公楼")){ continue
}
if(o.name.startsWith("写字楼") || o.name.startsWith("综合楼") || o.name.contains("销售") || o.name.startsWith("办公楼") || o.name.startsWith("公务楼") || o.name.startsWith("行政楼") || o.name.startsWith("商务办公楼") || o.name.startsWith("综合办公楼")){
println "[ 过滤 ] "+o.city+" "+o.name println "[ 过滤 ] "+o.city+" "+o.name
continue continue
} }
@@ -54,9 +62,9 @@ class AutoAddOfficeBatch extends BaseBatch{
continue continue
} }
def pattern = /[A-Z0-9]座|[0-9a-z]栋|[A-Z]栋|·|\(建设中\)|[0-9]号楼|\(装修中\)|.|[A-Z]楼|[0-9]幢/ def pattern = /[A-Z0-9]座|[0-9a-z]栋|[A-Z]栋|·|\(建设中\)|[0-9]号楼|\(装修中\)|[A-Z]楼|[0-9]幢/
o.name = o.name.replaceAll(pattern, "") def newName = o.name.replaceAll(pattern, "")
o.name = newName
def keyName = o.city +"#"+o.district+"#"+o.name def keyName = o.city +"#"+o.district+"#"+o.name
if(!keys.contains(keyName)){ if(!keys.contains(keyName)){
offices << o offices << o
@@ -68,12 +76,12 @@ class AutoAddOfficeBatch extends BaseBatch{
} }
def matchOffice(offices){ def matchOffice(offices){
def totalCount = new AtomicLong()
def addCount = new AtomicLong() def addCount = new AtomicLong()
final CountDownLatch latch = new CountDownLatch(offices.size()) final CountDownLatch latch = new CountDownLatch(offices.size())
def total = offices.size() def total = offices.size()
def rets = new CopyOnWriteArrayList() def rets = new CopyOnWriteArrayList()
rets << ["地图ID","省","市","区","写字楼名称","地址","经度","纬度","匹配城市","匹配区域","匹配名称","匹配方式"]
for(def i=0;i<offices.size();i++){ for(def i=0;i<offices.size();i++){
final def nmd = offices[i] final def nmd = offices[i]
fixedThreadPool.execute(new Runnable() { fixedThreadPool.execute(new Runnable() {