This commit is contained in:
2025-01-07 11:02:29 +08:00
parent 96e13d215f
commit 30736280a9
@@ -2,6 +2,7 @@ package com.fangjia.script.dealPrice
import com.fangjia.core.util.MongoUtils import com.fangjia.core.util.MongoUtils
import com.fangjia.script.gj.xiamen.ElasticUtils89 import com.fangjia.script.gj.xiamen.ElasticUtils89
import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.ElasticUtils import com.fangjia.script.util.ElasticUtils
import com.mongodb.AggregationOutput import com.mongodb.AggregationOutput
import com.mongodb.BasicDBObject import com.mongodb.BasicDBObject
@@ -26,12 +27,17 @@ class SynchDealPriceToEs {
def batchsize = 2000 def batchsize = 2000
def citys = getCityCount() def citys = getCityCount()
citys.each{city,count-> citys.each{city,count->
def dbcursor = dealPriceConn.find(new BasicDBObject("city", city)).batchSize(batchsize) for(def year = 1999;year<=2025;year++){
def ret = [] def q = new BasicDBObject("city", city)
for(def o : dbcursor){ 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")))
ret << o def dbcursor = dealPriceConn.find(q).batchSize(batchsize)
} println city +" "+ dbcursor.count()
save(ret) def ret = []
for(def o : dbcursor){
ret << o
}
save(ret)
}
// def index = 0 // def index = 0
// for(def d : dbcursor){ // for(def d : dbcursor){
// ret << d // ret << d