From ea1314fca84f6e28b451b7690c4f48fb0859eb62 Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Mon, 21 Oct 2019 18:53:21 +0800 Subject: [PATCH] update document --- doc/XXL-JOB官方文档.md | 3 +- .../admin/controller/JobInfoController.java | 33 ++++++++++++++++--- .../resources/static/js/jobinfo.index.1.js | 2 +- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/doc/XXL-JOB官方文档.md b/doc/XXL-JOB官方文档.md index 89ecf72f..fa20a2fc 100644 --- a/doc/XXL-JOB官方文档.md +++ b/doc/XXL-JOB官方文档.md @@ -1547,7 +1547,8 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段 - 9、任务触发组件加载顺序调整,避免小概率情况下组件随机加载顺序导致的I18N的NPE问题。 - 10、项目依赖升级至较新稳定版本,如spring、spring-boot、mybatis、slf4j、groovy等等; - 11、JobThread自销毁优化,避免并发触发导致triggerQueue中任务丢失问题; -- 12、Cron在线生成工具; +- 12、Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式[ING,国际化待完善]; +- 13、Cron执行时间查询:支持通过界面在线查看后续连续5次执行时间[ING,交互待完善]; - 13、[ING]xxl-rpc服务端线程优化,降低线程内存开销; - 14、[ING]调度日志优化:支持设置日志保留天数,过期日志天维度记录报表,并清理;调度报表汇总实时数据和报表; - 15、[ING]父子任务参数传递;流程任务等,透传动态参数; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java index 5b7d71a8..c7b351e1 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java @@ -1,5 +1,6 @@ package com.xxl.job.admin.controller; +import com.xxl.job.admin.core.cron.CronExpression; import com.xxl.job.admin.core.exception.XxlJobException; import com.xxl.job.admin.core.model.XxlJobGroup; import com.xxl.job.admin.core.model.XxlJobInfo; @@ -14,6 +15,7 @@ import com.xxl.job.admin.service.XxlJobService; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.enums.ExecutorBlockStrategyEnum; import com.xxl.job.core.glue.GlueTypeEnum; +import com.xxl.job.core.util.DateUtil; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @@ -22,10 +24,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.text.ParseException; +import java.util.*; /** * index controller @@ -141,5 +141,30 @@ public class JobInfoController { JobTriggerPoolHelper.trigger(id, TriggerTypeEnum.MANUAL, -1, null, executorParam); return ReturnT.SUCCESS; } + + @RequestMapping("/nextTriggerTime") + @ResponseBody + public ReturnT> nextTriggerTime(String cron) { + List result = new ArrayList<>(); + try { + CronExpression cronExpression = new CronExpression(cron); + Date lastTime = new Date(); + for (int i = 0; i < 5; i++) { + lastTime = cronExpression.getNextValidTimeAfter(lastTime); + if (lastTime != null) { + result.add(DateUtil.formatDateTime(lastTime)); + } else { + break; + } + } + } catch (ParseException e) { + // + } + if (result!=null && result.size()>0) { + return new ReturnT>(result); + } else { + return new ReturnT>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid")); + } + } } diff --git a/xxl-job-admin/src/main/resources/static/js/jobinfo.index.1.js b/xxl-job-admin/src/main/resources/static/js/jobinfo.index.1.js index 3d0e0e17..99160b06 100644 --- a/xxl-job-admin/src/main/resources/static/js/jobinfo.index.1.js +++ b/xxl-job-admin/src/main/resources/static/js/jobinfo.index.1.js @@ -136,8 +136,8 @@ $(function() { '
  • '+ I18n.jobinfo_opt_log +'
  • \n' + '
  • ' + I18n.jobinfo_opt_registryinfo + '
  • \n' + '
  • \n' + - start_stop_div + codeBtn + + start_stop_div + '
  • '+ I18n.system_opt_edit +'
  • \n' + '
  • '+ I18n.system_opt_del +'
  • \n' + ' \n' +