CsdnSchedule.java 2.0 KB
Newer Older
1 2
package com.kwan.springbootkwan.schedule;

3
import com.kwan.springbootkwan.service.CsdnAutoReplyService;
4
import com.kwan.springbootkwan.service.CsdnService;
5
import com.kwan.springbootkwan.service.CsdnTripletDayInfoService;
6
import com.kwan.springbootkwan.service.CsdnUserInfoService;
7 8 9 10 11 12
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
13
@Component
14 15 16 17
public class CsdnSchedule {

    @Autowired
    private CsdnService csdnService;
18 19
    @Autowired
    private CsdnUserInfoService csdnUserInfoService;
20 21 22 23
    @Autowired
    private CsdnAutoReplyService csdnAutoReplyService;
    @Autowired
    private CsdnTripletDayInfoService csdnTripletDayInfoService;
24

25
    @Scheduled(cron = "0 0 8,10,12,14,16,18,20 * * ?")
26
    public void execute() {
27
        log.info("execute task is running ... ...");
28
        csdnService.multiTriplet();
29 30 31
        log.info("execute task is finish ... ...");
    }

32
    @Scheduled(cron = "0 0/50 0 * * ?")
33 34
    public void executeReply() {
        log.info("executeReply task is running ... ...");
35
        csdnAutoReplyService.commentSelf();
36 37 38
        log.info("executeReply task is finish ... ...");
    }

39
    @Scheduled(cron = "0 0/30 * * * ?")
40
    public void resetAllCurrentStatus() {
41
        log.info("executeInit task is running ... ...");
42
        csdnUserInfoService.resetAllCurrentStatus();
43
        log.info("executeInit task is finish ... ...");
44 45
    }

46 47 48 49 50 51 52
    @Scheduled(cron = "0 0 2 * * ?")
    public void resetUserDayStatus() {
        log.info("executeInit task is running ... ...");
        csdnUserInfoService.resetUserDayStatus();
        log.info("executeInit task is finish ... ...");
    }

53 54 55 56 57 58 59 60
    @Scheduled(cron = "0 0 1 * * ?")
    public void resetTripletDayInfo() {
        log.info("resetTripletDayInfo task is running ... ...");
        //新增当前天的新的一条数据
        csdnTripletDayInfoService.todayInfo();
        log.info("resetTripletDayInfo task is finish ... ...");
    }
}