From 92a9dd5b695e584d16d30243d23c664ec58c3960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Mon, 8 Aug 2022 16:52:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=B7=E6=9C=AC=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E9=98=80=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InsertMonitorSquareRentCalcCommandBatch.groovy | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/averager/InsertMonitorSquareRentCalcCommandBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/averager/InsertMonitorSquareRentCalcCommandBatch.groovy index aaf5bf416..cec0e03a9 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/averager/InsertMonitorSquareRentCalcCommandBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/averager/InsertMonitorSquareRentCalcCommandBatch.groovy @@ -49,6 +49,7 @@ class InsertMonitorSquareRentCalcCommandBatch extends BaseBatch { void process(Object args) { String cityParam = System.getProperty("city"); + String calcDate = System.getProperty("calcDate"); def cities = new ArrayList() if(StringUtils.isNotBlank(cityParam)){ cities = new ArrayList() @@ -59,7 +60,7 @@ class InsertMonitorSquareRentCalcCommandBatch extends BaseBatch { cities = ServerAreaMap.findAllCities() } println cities - Date weekend = getLastDayOfMonth() + Date weekend = getLastDayOfMonth(calcDate) println weekend int cityCount = 0 int regionCount = 0 @@ -326,7 +327,13 @@ class InsertMonitorSquareRentCalcCommandBatch extends BaseBatch { } - private Date getLastDayOfMonth() { + private Date getLastDayOfMonth(String calcDateStr) { + if(StringUtils.isNotBlank(calcDateStr)){ + Date calcDate = DateUtil.parseDate(calcDateStr, "yyyyMM") + if(calcDate != null){ + return DateUtil.truncateDay(DateUtil.getLastDayOfMonth(calcDate, 0)) + } + } return DateUtil.truncateDay(DateUtil.getLastDayOfMonth(new Date(), -1)); }