From 94c645b49110e2829e8a5caa8c4e9aa73dbeb33c Mon Sep 17 00:00:00 2001 From: majintao Date: Sun, 27 Apr 2025 17:58:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84ApiInvokeStatistics?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hubingliang/ApiInvokeStatistics.groovy | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/ApiInvokeStatistics.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/ApiInvokeStatistics.groovy index 8a5ea5aaa..17112f274 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/ApiInvokeStatistics.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/hubingliang/ApiInvokeStatistics.groovy @@ -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) }