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

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

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

    @Autowired
    private CsdnService csdnService;
19
    @Autowired
20 21
    private CsdnCommentService csdnCommentService;
    @Autowired
22
    private CsdnUserInfoService csdnUserInfoService;
23 24 25 26
    @Autowired
    private CsdnAutoReplyService csdnAutoReplyService;
    @Autowired
    private CsdnTripletDayInfoService csdnTripletDayInfoService;
27

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

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

42
    @Scheduled(cron = "0 0/30 * * * ?")
43 44
    public void executeInit() {
        log.info("executeInit task is running ... ...");
45
        csdnUserInfoService.resetCurrentStatus();
46
        log.info("executeInit task is finish ... ...");
47 48
    }

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