+15
-12
@@ -26,18 +26,21 @@ class SynchDealPriceToEs {
|
||||
def run(){
|
||||
def batchsize = 2000
|
||||
def citys = getCityCount()
|
||||
citys.each{city,count->
|
||||
for(def year = 1999;year<=2025;year++){
|
||||
def q = new BasicDBObject("city", city)
|
||||
q.put("trade_date", new BasicDBObject('$gte', DateUtils.parseFromTightByPattern(year+"-01-01", "yyyy-MM-dd")).append('$lte', DateUtils.parseFromTightByPattern(year+1+"-01-01", "yyyy-MM-dd")))
|
||||
def dbcursor = dealPriceConn.find(q).batchSize(batchsize)
|
||||
println city +" "+ dbcursor.count()
|
||||
def ret = []
|
||||
for(def o : dbcursor){
|
||||
ret << o
|
||||
}
|
||||
save(ret)
|
||||
}
|
||||
citys.each{city,count->
|
||||
if(city instanceof String){
|
||||
for(def year = 1999;year<=2025;year++){
|
||||
def q = new BasicDBObject("city", city)
|
||||
q.put("trade_date", new BasicDBObject('$gte', DateUtils.parseFromTightByPattern(year+"-01-01", "yyyy-MM-dd")).append('$lte', DateUtils.parseFromTightByPattern(year+1+"-01-01", "yyyy-MM-dd")))
|
||||
def dbcursor = dealPriceConn.find(q).batchSize(batchsize)
|
||||
println city +" "+ dbcursor.count()
|
||||
def ret = []
|
||||
for(def o : dbcursor){
|
||||
ret << o
|
||||
}
|
||||
save(ret)
|
||||
}
|
||||
}
|
||||
|
||||
// def index = 0
|
||||
// for(def d : dbcursor){
|
||||
// ret << d
|
||||
|
||||
Reference in New Issue
Block a user