Unverified Commit 157373eb authored by lj-zhu's avatar lj-zhu Committed by GitHub
Browse files

Update ExecutionJob.java (#416)

不是子任务时,uuid是空的,需要加个判断。
parent ed715490
...@@ -54,6 +54,8 @@ public class ExecutionJob extends QuartzJobBean { ...@@ -54,6 +54,8 @@ public class ExecutionJob extends QuartzJobBean {
QuartzLogRepository quartzLogRepository = SpringContextHolder.getBean(QuartzLogRepository.class); QuartzLogRepository quartzLogRepository = SpringContextHolder.getBean(QuartzLogRepository.class);
QuartzJobService quartzJobService = SpringContextHolder.getBean(QuartzJobService.class); QuartzJobService quartzJobService = SpringContextHolder.getBean(QuartzJobService.class);
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
String uuid = quartzJob.getUuid();
QuartzLog log = new QuartzLog(); QuartzLog log = new QuartzLog();
log.setJobName(quartzJob.getJobName()); log.setJobName(quartzJob.getJobName());
...@@ -72,7 +74,9 @@ public class ExecutionJob extends QuartzJobBean { ...@@ -72,7 +74,9 @@ public class ExecutionJob extends QuartzJobBean {
future.get(); future.get();
long times = System.currentTimeMillis() - startTime; long times = System.currentTimeMillis() - startTime;
log.setTime(times); log.setTime(times);
redisUtils.set(quartzJob.getUuid(), true); if(StringUtils.isNotBlank(uuid)) {
redisUtils.set(uuid, true);
}
// 任务状态 // 任务状态
log.setIsSuccess(true); log.setIsSuccess(true);
System.out.println("任务执行完毕,任务名称:" + quartzJob.getJobName() + ", 执行时间:" + times + "毫秒"); System.out.println("任务执行完毕,任务名称:" + quartzJob.getJobName() + ", 执行时间:" + times + "毫秒");
...@@ -84,7 +88,9 @@ public class ExecutionJob extends QuartzJobBean { ...@@ -84,7 +88,9 @@ public class ExecutionJob extends QuartzJobBean {
quartzJobService.executionSubJob(tasks); quartzJobService.executionSubJob(tasks);
} }
} catch (Exception e) { } catch (Exception e) {
redisUtils.set(quartzJob.getUuid(), false); if(StringUtils.isNotBlank(uuid)) {
redisUtils.set(uuid, false);
}
System.out.println("任务执行失败,任务名称:" + quartzJob.getJobName()); System.out.println("任务执行失败,任务名称:" + quartzJob.getJobName());
System.out.println("--------------------------------------------------------------"); System.out.println("--------------------------------------------------------------");
long times = System.currentTimeMillis() - startTime; long times = System.currentTimeMillis() - startTime;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment