package com.gree.mall.manager.schedule;

import com.gree.mall.manager.logic.activity.PromotionGroupLogic;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@ConditionalOnProperty(name = "schedule.enable", havingValue = "true", matchIfMissing = true)
@Slf4j
@Component
public class PromotionGroupSchedule {

    @Autowired
    PromotionGroupLogic promotionGroupLogic;

    @Transactional
    @Scheduled(fixedDelay = 10 * 1000)
    public void task(){
        promotionGroupLogic.close();
    }

}
