完善ApiInvokeStatistics
This commit is contained in:
+12
-6
@@ -43,8 +43,13 @@ class ApiInvokeStatistics extends BaseBatch{
|
||||
def getYestodayLog(Date today,Date yestoday){
|
||||
//Date today = getToday();
|
||||
//Date yestoday = getNextDay(today)
|
||||
def deleteQuery = new BasicDBObject("statistical_date", yestoday)
|
||||
OPEN_URI_LOG_COUNT.remove(deleteQuery)
|
||||
println "已删除 ${yestoday.format('yyyy-MM-dd')} 的旧统计数据"
|
||||
BasicDBObject query= new BasicDBObject("c_date", new BasicDBObject('$gte',yestoday).append('$lt', today))
|
||||
DBCursor dbc=OPEN_URI_LOG.find(query).batchSize(10000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
// DBCursor dbc=OPEN_URI_LOG.find(query).batchSize(10000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
DBCursor dbc = OPEN_URI_LOG.find(query, new BasicDBObject("res_map", 0)).batchSize(10000).addOption(Bytes.QUERYOPTION_NOTIMEOUT)
|
||||
|
||||
def results = [:]
|
||||
int c = 0
|
||||
dbc.each {BasicDBObject log->
|
||||
@@ -103,11 +108,12 @@ class ApiInvokeStatistics extends BaseBatch{
|
||||
obj.append("total_time",total_time)
|
||||
obj.append("statistical_date",yestoday)
|
||||
obj.append("user_name",companyName)
|
||||
DBObject qu = new BasicDBObject();
|
||||
qu.append("user_id", userIDStr);
|
||||
qu.append("request_uri", uri);
|
||||
qu.append("statistical_date", yestoday)
|
||||
OPEN_URI_LOG_COUNT.update(qu, new BasicDBObject('$set', obj), true, true);
|
||||
// DBObject qu = new BasicDBObject();
|
||||
// qu.append("user_id", userIDStr);
|
||||
// qu.append("request_uri", uri);
|
||||
// qu.append("statistical_date", yestoday)
|
||||
// OPEN_URI_LOG_COUNT.update(qu, new BasicDBObject('$set', obj), true, true);
|
||||
OPEN_URI_LOG_COUNT.insert(obj)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user