package com.dsh.course.util; import com.dsh.course.service.ICoursePackageSchedulingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; /** * @author zhibing.pu * @Date 2023/8/11 15:01 */ @Component public class TaskUtil { @Autowired private ICoursePackageSchedulingService coursePackageSchedulingService; /** * 每隔一分钟去处理的定时任务 */ @Scheduled(fixedRate = 60000) public void taskMinute(){ try { //定时修改排课状态 coursePackageSchedulingService.taskSetStatus(); } catch (Exception e) { e.printStackTrace(); } } /** * 零时任务 */ @Scheduled(cron = "0 0 0 * * *") public void zeroTask(){ //定时添加排课数据 coursePackageSchedulingService.taskAddData(); } }