package com.ruoyi.system.Schedules;
|
|
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.system.service.enterpriseManage.EnterpriseManageService;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
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 javax.annotation.PostConstruct;
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
@Component
|
//@ConditionalOnProperty(prefix = "safeCheckScheduling", name = "enabled", havingValue = "true")
|
public class ValidityUpadeScheduleWork {
|
|
private static SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss:sss");
|
|
private final Logger logger = LoggerFactory.getLogger(ValidityUpadeScheduleWork.class);
|
|
@Autowired
|
private EnterpriseManageService enterpriseManageService;
|
|
@Scheduled(cron = "0 0 0 * * ?") //每天的24点执行一次
|
@PostConstruct
|
public void updateValidityState() throws Exception{
|
logger.info("【每日更新许可证状态】 " + dateFormat.format(new Date())+" 开始进行企业许可证更新任务调度");
|
enterpriseManageService.ValidityStateUpdate();
|
logger.info("【每日更新许可证状态】 " + dateFormat.format(new Date())+" 许可证任务调度执行结束");
|
}
|
|
@Scheduled(cron = "0 0 3 ? * SAT") //每周六凌晨3点执行一次
|
public void createNewWorkTask() throws Exception{
|
logger.info("【每周更新许可证状态】 " + dateFormat.format(new Date())+" 开始进行企业许可证更新任务调度");
|
enterpriseManageService.ValidityStateUpdate();
|
logger.info("【每周更新许可证状态】 " + dateFormat.format(new Date())+" 许可证任务调度执行结束");
|
}
|
|
|
}
|