| 12345678910111213141516171819202122232425262728293031 |
- package com.goafanti.common.task;
- import javax.annotation.Resource;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Component;
- import com.goafanti.common.utils.LoggerUtils;
- import com.goafanti.order.service.OrderReportService;
- @Component
- public class MonthReportTask {
- @Resource
- private OrderReportService orderReportServiceImpl;
-
- Logger logger = LoggerFactory.getLogger(MonthReportTask.class);
- /**
- * 每月1号7点15分钟执行任务
- */
- @Scheduled(cron = "0 0 7 1 * ?")
- //@Scheduled(cron = "0 3 18 * * ?")
- public void testTask(){
- //新增月数据
- int count = orderReportServiceImpl.insertOrderStatisticsByMonthTask();
- //更新年数据
- LoggerUtils.debug(logger, "统计上月订单【%s】条。", count);
- }
- }
|