package com.matrix.system.shopXcx.quartz; import com.matrix.core.tools.LogUtil; import com.matrix.core.tools.WebUtil; import com.matrix.system.shopXcx.dao.ShopCouponDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; /** * @author kingsley * 优惠券定时任务 */ @Configuration @EnableScheduling public class ShopCouponQuartz { @Value("${scheduling.enabled}") private boolean taskSwitch; @Autowired private ShopCouponDao shopCouponDao; @Scheduled(cron = "0 */1 * * * ?") public void executeExt() { if(taskSwitch){ int i = shopCouponDao.updateAllCouponStatus(); LogUtil.info("优惠券状态更新条数:" + i); } } }