package com.fs.task;

import com.fs.store.service.IFsCouponScheduleService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 优惠券定时任务
 */
@RequiredArgsConstructor
@Service("couponTask")
@Slf4j
public class CouponTask {

    private final IFsCouponScheduleService fsCouponScheduleService;
    /**
     * 发放优惠券
     */
    public void issueCoupon(){
        log.info("开始执行发放优惠券定时任务");
        long startTime = System.currentTimeMillis();
        fsCouponScheduleService.issueCoupon();
        long endTime = System.currentTimeMillis();
        log.info("发放优惠券定时任务执行完成，耗时：{}毫秒", endTime - startTime);
    }

}
