update
This commit is contained in:
+35
-14
@@ -32,11 +32,11 @@ class PoiWash {
|
|||||||
static main(args) {
|
static main(args) {
|
||||||
def task = new PoiWash()
|
def task = new PoiWash()
|
||||||
// task.updateId()
|
// task.updateId()
|
||||||
task.run()
|
// task.run()
|
||||||
// task.synch()
|
// task.synch()
|
||||||
task.check()
|
// task.check()
|
||||||
|
|
||||||
// task.checkSpecialSymbols()
|
task.checkSpecialSymbols()
|
||||||
}
|
}
|
||||||
|
|
||||||
def updateId(){
|
def updateId(){
|
||||||
@@ -98,7 +98,19 @@ class PoiWash {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def checkSpecialSymbols(){
|
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 totalCount = new AtomicLong()
|
||||||
def updateTotalCount = new AtomicLong()
|
def updateTotalCount = new AtomicLong()
|
||||||
final CountDownLatch latch = new CountDownLatch(results.size())
|
final CountDownLatch latch = new CountDownLatch(results.size())
|
||||||
@@ -106,25 +118,34 @@ class PoiWash {
|
|||||||
def count = results.size()
|
def count = results.size()
|
||||||
for(def i=0;i<results.size();i++){
|
for(def i=0;i<results.size();i++){
|
||||||
def map = results[i]
|
def map = results[i]
|
||||||
// fixedThreadPool.execute(new Runnable() {
|
fixedThreadPool.execute(new Runnable() {
|
||||||
// void run() {
|
void run() {
|
||||||
try{
|
try{
|
||||||
totalCount.addAndGet(1)
|
totalCount.addAndGet(1)
|
||||||
def newAddr = washing(map)
|
|
||||||
if(map.address!=newAddr){
|
def columns = ["province","city","district","name","address","cat","business_area","fjw_province","fjw_city","type","secondary_type","small_type","township", "fjw_district","spell_name"]
|
||||||
updateTotalCount.addAndGet(1)
|
|
||||||
def udata = new BasicDBObject()
|
def udata = new BasicDBObject()
|
||||||
udata.put("address", newAddr)
|
map.each{k,v->
|
||||||
MAPPOI_CONN.update(new BasicDBObject('_id',map.id),new BasicDBObject('$set', udata))
|
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) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
} finally {
|
} finally {
|
||||||
latch.countDown()
|
latch.countDown()
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
latch.await()
|
latch.await()
|
||||||
|
|||||||
Reference in New Issue
Block a user