parent
6d727a4b7a
commit
95e2330926
@ -0,0 +1,31 @@
|
|||||||
|
package au.com.royalpay.payment.manage.task;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.manage.analysis.core.WeekReporter;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by wangning on 24/01/2018.
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
|
||||||
|
public class WeekReportGenerationTask {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WeekReporter weekReporter;
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0 2 * * 1")
|
||||||
|
public void autoGenerateReport() {
|
||||||
|
Date lastweek = new Date();
|
||||||
|
lastweek = DateUtils.addDays(lastweek, -7);
|
||||||
|
weekReporter.generateReport(DateFormatUtils.format(lastweek, "yyyy-MM-dd"), true);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue