update
This commit is contained in:
+40
@@ -1556,6 +1556,32 @@ class CommonDatautils {
|
||||
}
|
||||
return rets;
|
||||
}
|
||||
|
||||
|
||||
public static def queryDistrictStatByDate(city, startDate, endDate){
|
||||
DBObject q = new BasicDBObject()
|
||||
q.put("city", city);
|
||||
q.put('weekend', new BasicDBObject('$gte', DateUtils.parseFromTightByPattern(startDate.toString(), "yyyyMMdd")).append('$lte', DateUtils.parseFromTightByPattern(endDate.toString(), "yyyyMMdd")));
|
||||
def dbcursor = DIST_STAT_COLL.find(q).batchSize(5000)
|
||||
dbcursor.setOptions(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
def districtStatMap = [:]
|
||||
for(def d : dbcursor){
|
||||
def key = d.city +"##"+d.region+"##"+d.district_name
|
||||
def prices = districtStatMap.get(key)
|
||||
if(!prices){
|
||||
prices = []
|
||||
districtStatMap.put(key, prices)
|
||||
}
|
||||
prices << d.avg_price
|
||||
}
|
||||
|
||||
def priceMap = [:]
|
||||
districtStatMap.each{k,v->
|
||||
def price = v.sum()/v.size()
|
||||
priceMap.put(k, (int)price)
|
||||
}
|
||||
return priceMap;
|
||||
}
|
||||
|
||||
|
||||
public static def queryDistrictPrice(city, region, name, weekend, cat){
|
||||
@@ -3290,6 +3316,20 @@ class CommonDatautils {
|
||||
return count;
|
||||
}
|
||||
|
||||
static def findSqmetreRentByCityAndDate(def city, def weekend){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
q.put("cat","district")
|
||||
q.put("weekend", DateUtils.parseFromTightByPattern(weekend.toString(), "yyyyMMdd"))
|
||||
def dbcursor = SQMETRE_RENT_COLL.find(q).batchSize(2000)
|
||||
dbcursor.setOptions(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
def sqmetreRentMap = [:]
|
||||
for(def d : dbcursor){
|
||||
sqmetreRentMap.put(d.city+"##"+d.region+"##"+d.district_name, d.avg_price)
|
||||
}
|
||||
return sqmetreRentMap;
|
||||
}
|
||||
|
||||
static def findNewSqmetreRent(def city, def region, def name){
|
||||
def q = new BasicDBObject()
|
||||
q.put("city", city)
|
||||
|
||||
Reference in New Issue
Block a user