package com.kwan.springbootkwan.schedule; import com.kwan.springbootkwan.service.CsdnAutoReplyService; import com.kwan.springbootkwan.service.CsdnCommentService; import com.kwan.springbootkwan.service.CsdnService; import com.kwan.springbootkwan.service.CsdnTripletDayInfoService; import com.kwan.springbootkwan.service.CsdnUserInfoService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @Slf4j @Component public class CsdnSchedule { @Autowired private CsdnService csdnService; @Autowired private CsdnCommentService csdnCommentService; @Autowired private CsdnUserInfoService csdnUserInfoService; @Autowired private CsdnAutoReplyService csdnAutoReplyService; @Autowired private CsdnTripletDayInfoService csdnTripletDayInfoService; @Scheduled(cron = "0 0 8,10,12,14,16,18,20 * * ?") public void execute() { log.info("execute task is running ... ..."); csdnService.multiTriplet(); log.info("execute task is finish ... ..."); } @Scheduled(cron = "0 0/50 0 * * ?") public void executeReply() { log.info("executeReply task is running ... ..."); csdnAutoReplyService.commentSelf(); log.info("executeReply task is finish ... ..."); } @Scheduled(cron = "0 0/30 * * * ?") public void executeInit() { log.info("executeInit task is running ... ..."); csdnUserInfoService.resetCurrentStatus(); log.info("executeInit task is finish ... ..."); } @Scheduled(cron = "0 0 1 * * ?") public void resetTripletDayInfo() { log.info("resetTripletDayInfo task is running ... ..."); //新增当前天的新的一条数据 csdnTripletDayInfoService.todayInfo(); log.info("resetTripletDayInfo task is finish ... ..."); } }