+35
-14
@@ -32,11 +32,11 @@ class PoiWash {
|
||||
static main(args) {
|
||||
def task = new PoiWash()
|
||||
// task.updateId()
|
||||
task.run()
|
||||
// task.run()
|
||||
// task.synch()
|
||||
task.check()
|
||||
// task.check()
|
||||
|
||||
// task.checkSpecialSymbols()
|
||||
task.checkSpecialSymbols()
|
||||
}
|
||||
|
||||
def updateId(){
|
||||
@@ -98,7 +98,19 @@ class PoiWash {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
def checkSpecialSymbols(){
|
||||
//"三明市","宁德市","泉州市","厦门市","福州市","漳州市","南平市","龙岩市","莆田市",
|
||||
def citys = ["重庆市","三明市","上海市","深圳市","北京市","广州市","杭州市","苏州市","成都市"]
|
||||
for(def city : citys){
|
||||
def datas = findAllFieldPois(city)
|
||||
specialSymbols(city, datas)
|
||||
println city +" 完成"
|
||||
}
|
||||
}
|
||||
|
||||
def specialSymbols(city, results){
|
||||
def totalCount = new AtomicLong()
|
||||
def updateTotalCount = new AtomicLong()
|
||||
final CountDownLatch latch = new CountDownLatch(results.size())
|
||||
@@ -106,25 +118,34 @@ class PoiWash {
|
||||
def count = results.size()
|
||||
for(def i=0;i<results.size();i++){
|
||||
def map = results[i]
|
||||
// fixedThreadPool.execute(new Runnable() {
|
||||
// void run() {
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
void run() {
|
||||
try{
|
||||
totalCount.addAndGet(1)
|
||||
def newAddr = washing(map)
|
||||
if(map.address!=newAddr){
|
||||
updateTotalCount.addAndGet(1)
|
||||
def udata = new BasicDBObject()
|
||||
udata.put("address", newAddr)
|
||||
MAPPOI_CONN.update(new BasicDBObject('_id',map.id),new BasicDBObject('$set', udata))
|
||||
|
||||
def columns = ["province","city","district","name","address","cat","business_area","fjw_province","fjw_city","type","secondary_type","small_type","township", "fjw_district","spell_name"]
|
||||
|
||||
def udata = new BasicDBObject()
|
||||
map.each{k,v->
|
||||
if(columns.contains(k)){
|
||||
if(v instanceof Double){
|
||||
udata.put(k, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
println updateTotalCount.get()+" / "+totalCount.get()+" "+count +" "+city
|
||||
if(udata){
|
||||
updateTotalCount.addAndGet(1)
|
||||
MAPPOI_CONN.update(new BasicDBObject('_id',map.id),new BasicDBObject('$set', udata))
|
||||
println updateTotalCount.get()+" / "+totalCount.get()+" "+count +" "+city
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
latch.await()
|
||||
|
||||
Reference in New Issue
Block a user