[ server ] [ scheduler ]- script scheduler accomplish - 1
This commit is contained in:
@@ -48,6 +48,10 @@ public class QuartzSchedulerServiceImpl implements QuartzSchedulerService {
|
||||
@Autowired
|
||||
private Scheduler scheduler;
|
||||
|
||||
/**
|
||||
* 保存 定时脚本任务的中间DTO,在Quartz框架中JobDataMap的Key名称
|
||||
*/
|
||||
public static final String SCRIPT_SCHEDULER_MISSION_KEY = "scriptSchedulerDTO";
|
||||
/**
|
||||
* --------------------------------------------------------------
|
||||
* 页面定时任务部分
|
||||
@@ -68,7 +72,7 @@ public class QuartzSchedulerServiceImpl implements QuartzSchedulerService {
|
||||
// bind job and trigger
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put(
|
||||
"scriptSchedulerDTO",
|
||||
SCRIPT_SCHEDULER_MISSION_KEY,
|
||||
scriptSchedulerDTO
|
||||
);
|
||||
this.addMission(
|
||||
@@ -83,7 +87,7 @@ public class QuartzSchedulerServiceImpl implements QuartzSchedulerService {
|
||||
dataMap
|
||||
);
|
||||
|
||||
HashMap<String, String> futureExecutionResultKey = quartzSchedulerUtils.getFutureExecutionResultKey(scriptSchedulerDTO);
|
||||
HashMap<String, String> futureExecutionResultKey = quartzSchedulerUtils.generateAndSetFutureExecutionResultKey(scriptSchedulerDTO);
|
||||
|
||||
log.info(
|
||||
"futureExecutionResultKey is => {}",
|
||||
@@ -602,6 +606,9 @@ public class QuartzSchedulerServiceImpl implements QuartzSchedulerService {
|
||||
// 该Job存在
|
||||
// 修改JobDetail信息
|
||||
ScriptSchedulerDTO scriptSchedulerDTO = validateAndConvertToScriptSchedulerDTO(scriptSchedulerVO);
|
||||
JobDataMap map = jobDetail.getJobDataMap();
|
||||
map.put(SCRIPT_SCHEDULER_MISSION_KEY,
|
||||
scriptSchedulerDTO);
|
||||
|
||||
// 修改 Mission相应的 cron时间信息
|
||||
updateMission(
|
||||
@@ -610,6 +617,9 @@ public class QuartzSchedulerServiceImpl implements QuartzSchedulerService {
|
||||
scriptSchedulerDTO.getCronExpress()
|
||||
);
|
||||
|
||||
// 修改任务计划执行时间Key
|
||||
quartzSchedulerUtils.generateAndSetFutureExecutionResultKey(scriptSchedulerDTO);
|
||||
|
||||
return jobDetail;
|
||||
}
|
||||
|
||||
@@ -670,7 +680,8 @@ public class QuartzSchedulerServiceImpl implements QuartzSchedulerService {
|
||||
|
||||
return scheduler
|
||||
.getTriggerKeys(
|
||||
GroupMatcher.groupEquals(JOB_GROUP_NAME)
|
||||
// GroupMatcher.groupEquals(JOB_GROUP_NAME)
|
||||
GroupMatcher.anyGroup()
|
||||
)
|
||||
.stream()
|
||||
.map(
|
||||
|
||||
@@ -42,7 +42,7 @@ public class AgentApplyScheduledScript {
|
||||
scriptSchedulerDTO.setResultKeyList(resultKeyList);
|
||||
|
||||
// 更新DTO中的下次执行时间 否则会出错
|
||||
HashMap<String, String> futureExecutionResultKey = quartzSchedulerUtils.getFutureExecutionResultKey(scriptSchedulerDTO);
|
||||
HashMap<String, String> futureExecutionResultKey = quartzSchedulerUtils.generateAndSetFutureExecutionResultKey(scriptSchedulerDTO);
|
||||
|
||||
log.info(
|
||||
"futureExecutionResultKey in scheduled work is => {}",
|
||||
|
||||
Reference in New Issue
Block a user