1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package com.ylcm.sys.task;
- import java.time.LocalDate;
- import java.time.format.DateTimeFormatter;
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Component;
- import com.ylcm.sys.service.SpecialAnalysisService;
- import lombok.extern.slf4j.Slf4j;
- @Component
- @Slf4j
- public class SpecialTopTask {
- private SpecialAnalysisService specialAnalysisService;
- /**
- * 一周的每天运行 产品专题广告投放排名
- */
- @Scheduled(cron = "0 0 0/2 * * ?")
- public void topTaskWeek(){
- log.info("产品专题广告投放排名---start");
- LocalDate now = LocalDate.now();
- LocalDate day7before = now.minusDays(7);
- specialAnalysisService.specialTop(0, now.format(DateTimeFormatter.ISO_DATE), day7before.format(DateTimeFormatter.ISO_DATE));
- specialAnalysisService.specialTop(1, now.format(DateTimeFormatter.ISO_DATE), day7before.format(DateTimeFormatter.ISO_DATE));
- log.info("产品专题广告投放排名---end");
- }
-
- /**
- * 月的每天运行一次
- */
- @Scheduled(cron = "0 0 1 * * ?")
- public void topTaskMonth(){
- log.info("产品专题广告投放排名---start");
- LocalDate now = LocalDate.now();
- LocalDate day7before = now.minusDays(30);
- specialAnalysisService.specialTop(0, now.format(DateTimeFormatter.ISO_DATE), day7before.format(DateTimeFormatter.ISO_DATE));
- specialAnalysisService.specialTop(1, now.format(DateTimeFormatter.ISO_DATE), day7before.format(DateTimeFormatter.ISO_DATE));
-
- LocalDate day365before = now.minusDays(365);
- specialAnalysisService.specialTop(0, now.format(DateTimeFormatter.ISO_DATE), day365before.format(DateTimeFormatter.ISO_DATE));
- specialAnalysisService.specialTop(1, now.format(DateTimeFormatter.ISO_DATE), day365before.format(DateTimeFormatter.ISO_DATE));
-
- log.info("产品专题广告投放排名---end");
- }
-
-
-
-
- }
|