package org.springblade.mdm.task; import lombok.extern.slf4j.Slf4j; import org.springblade.mdm.basesetting.machine.service.MachineService; import org.springblade.mdm.commons.service.ParamService; import org.springblade.mdm.flow.service.TaskDispatchService; import org.springblade.mdm.machinefile.service.MachineFileScanService; import org.springblade.mdm.machinefile.service.MachineFileService; import org.springblade.mdm.program.service.ProgramAnnotationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; /** * 异常任务计划清除定时任务 */ @Slf4j @Component @EnableScheduling public class ExceptionDispathCleanTask { @Autowired private TaskDispatchService taskDispatchService; @Autowired private ParamService paramService; // 每5秒执行一次 //@Scheduled(fixedRate = 1000000) //@Scheduled(cron = "0 1 0 * * ?") // 每天上午0点1分执行 //@Scheduled(cron = "0 */5 * * * ?") //@Scheduled(cron = "0 15 19 * * ?") //test @Scheduled(cron = "${task.cron.exception_dispatch_clean:0 1 * * * ?}") public void execute() { String networkType = paramService.getParamValue(ParamService.NETWORK_TYPE,ParamService.NETWORK_TYPE_SHEMI); if(ParamService.NETWORK_TYPE_SHEMI.equals(networkType)){ //涉密网,执行异常任务清理 taskDispatchService.cleanExpiredExceptionTask(); } } }