package com.stylefeng.guns.modular.system.util; import com.stylefeng.guns.modular.system.service.IUserCouponRecordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; /** * 定时任务工具类 */ @Component public class TaskUtil { @Autowired private IUserCouponRecordService userCouponRecordService; /** * 每隔一分钟去处理的定时任务 */ @Scheduled(fixedRate = 1000 * 60) public void taskMinute(){ try { //修改过期的优惠券 userCouponRecordService.updateTimeOut(); } catch (Exception e) { e.printStackTrace(); } } // /** // * 每天的凌晨执行的任务 // */ // @Scheduled(cron = "0 0 0 * * *") // public void taskDay(){ // try { // }catch (Exception e){ // e.printStackTrace(); // } // } // // /** // * 每月第一天的1点执行的任务 // */ // @Scheduled(cron = "0 0 1 1 * *") // public void taskMonth(){ // try { // // }catch (Exception e){ // e.printStackTrace(); // } // } }