package com.dsk.web.schedule;

import com.dsk.common.tenant.helper.TenantHelper;
import com.dsk.system.service.ISysTenantService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 租户相关定时任务类
 *
 * @author sxk
 * @date 2023.09.06
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class TenantTimerTask {

    private final ISysTenantService tenantService;

    //@Value("${schedule.cronExpression}")
    //private String cronExpression;

    @Scheduled(cron = "0 0 0/6 * * *")
    public void handleExpiredTenant() {
        TenantHelper.ignore(tenantService::handleExpiredTenant);
    }

}