yangys
2025-09-19 270aceade15ec4cb7715131055b53cec4ecb7d4e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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();
        }
 
    }
 
}