package com.peanut.modules.book.task; import com.peanut.modules.book.service.CouponHistoryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; @Configuration @EnableScheduling public class CouponsUserScheduleTask { @Autowired private CouponHistoryService couponsUserService; private static Logger log = LoggerFactory.getLogger(CouponsUserScheduleTask.class); // @Scheduled(cron = "0 0/1 * * * ?")//每3分 //crontab -e 动态代替应用命令 // public void handlerCouponsUserStatusTimeOutToExpired(){ // log.info("handlerCouponsUserStatusTimeOutToExpired start.......time={}",System.currentTimeMillis()); // Long startTime01 = System.currentTimeMillis(); // couponsUserService.runCouponsUserStatusTimeOutToExpired(); // Long endTime02 = System.currentTimeMillis(); // log.info("handlerCouponsUserStatusTimeOutToExpired end second={},mills={}",(endTime02-startTime01)/1000,(endTime02-startTime01)%1000); // } }