CsdnSchedule.java 1.7 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
        csdnAutoReplyService.commentSelf();
30
        log.info("execute task is finish ... ...");
31 32
    }

33
    @Scheduled(cron = "0 0/30 * * * ?")
34
    public void resetAllCurrentStatus() {
35
        log.info("executeInit task is running ... ...");
36
        csdnUserInfoService.resetAllCurrentStatus();
37
        log.info("executeInit task is finish ... ...");
38 39
    }

40 41 42 43
    @Scheduled(cron = "0 0 1 * * ?")
    public void resetTripletDayInfo() {
        log.info("resetTripletDayInfo task is running ... ...");
        //新增当前天的新的一条数据
44
        csdnUserInfoService.resetUserDayStatus();
45 46 47 48
        csdnTripletDayInfoService.todayInfo();
        log.info("resetTripletDayInfo task is finish ... ...");
    }
}