From 3d15669b3bbc1ec2388c7b10a734a5af80ff9ef8 Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Sat, 18 Aug 2018 20:49:20 +0800 Subject: [PATCH] =?UTF-8?q?UI=E4=BB=A5=E5=8F=8A=E5=BA=93=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=20"=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E9=87=8D=E8=AF=95=E6=AC=A1=E6=95=B0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/db/tables_xxl_job.sql | 3 ++- .../admin/controller/JobInfoController.java | 2 -- .../core/enums/ExecutorFailStrategyEnum.java | 10 +++++----- .../xxl/job/admin/core/model/XxlJobInfo.java | 9 +++++++++ .../job/admin/core/trigger/XxlJobTrigger.java | 4 ++-- .../admin/service/impl/XxlJobServiceImpl.java | 8 +------- .../main/resources/i18n/message.properties | 4 ++-- .../main/resources/i18n/message_en.properties | 4 ++-- .../mybatis-mapper/XxlJobInfoMapper.xml | 5 +++++ .../template/jobinfo/jobinfo.index.ftl | 20 ++++--------------- .../main/webapp/static/js/jobinfo.index.1.js | 17 +++++++++++++++- 11 files changed, 48 insertions(+), 38 deletions(-) diff --git a/doc/db/tables_xxl_job.sql b/doc/db/tables_xxl_job.sql index 1335d3f9..f0781af4 100644 --- a/doc/db/tables_xxl_job.sql +++ b/doc/db/tables_xxl_job.sql @@ -163,7 +163,8 @@ CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_INFO` ( `executor_param` varchar(512) DEFAULT NULL COMMENT '执行器任务参数', `executor_block_strategy` varchar(50) DEFAULT NULL COMMENT '阻塞处理策略', `executor_fail_strategy` varchar(50) DEFAULT NULL COMMENT '失败处理策略', - `executor_timeout` int(11) NOT NULL DEFAULT 0 COMMENT '任务执行超时时间,单位秒', + `executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒', + `executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '失败重试次数', `glue_type` varchar(50) NOT NULL COMMENT 'GLUE类型', `glue_source` text COMMENT 'GLUE源代码', `glue_remark` varchar(128) DEFAULT NULL COMMENT 'GLUE备注', 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 09eedb60..fefb5ab2 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,6 +1,5 @@ package com.xxl.job.admin.controller; -import com.xxl.job.admin.core.enums.ExecutorFailStrategyEnum; import com.xxl.job.admin.core.model.XxlJobGroup; import com.xxl.job.admin.core.model.XxlJobInfo; import com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum; @@ -39,7 +38,6 @@ public class JobInfoController { model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 - model.addAttribute("ExecutorFailStrategyEnum", ExecutorFailStrategyEnum.values()); // 失败处理策略-字典 // 任务组 List jobGroupList = xxlJobGroupDao.findAll(); diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/enums/ExecutorFailStrategyEnum.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/enums/ExecutorFailStrategyEnum.java index d5a4441e..c66e4488 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/enums/ExecutorFailStrategyEnum.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/enums/ExecutorFailStrategyEnum.java @@ -1,17 +1,17 @@ package com.xxl.job.admin.core.enums; -import com.xxl.job.admin.core.util.I18nUtil; - /** * Created by xuxueli on 17/5/9. */ + +@Deprecated public enum ExecutorFailStrategyEnum { - NULL(I18nUtil.getString("jobconf_fail_null")), + NULL("NULL"), - FAIL_TRIGGER_RETRY(I18nUtil.getString("jobconf_fail_trigger_retry")), + FAIL_TRIGGER_RETRY("FAIL_TRIGGER_RETRY"), - FAIL_HANDLE_RETRY(I18nUtil.getString("jobconf_fail_handle_retry")); + FAIL_HANDLE_RETRY("FAIL_HANDLE_RETRY"); private final String title; private ExecutorFailStrategyEnum(String title) { diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java index b389d20d..67a9c1fc 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java @@ -27,6 +27,7 @@ public class XxlJobInfo { private String executorBlockStrategy; // 阻塞处理策略 private String executorFailStrategy; // 失败处理策略 private int executorTimeout; // 任务执行超时时间,单位秒 + private int executorFailRetryCount; // 失败重试次数 private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum private String glueSource; // GLUE源代码 @@ -151,6 +152,14 @@ public class XxlJobInfo { this.executorTimeout = executorTimeout; } + public int getExecutorFailRetryCount() { + return executorFailRetryCount; + } + + public void setExecutorFailRetryCount(int executorFailRetryCount) { + this.executorFailRetryCount = executorFailRetryCount; + } + public String getGlueType() { return glueType; } diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java index e9e8743b..8bb73947 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java @@ -74,7 +74,7 @@ public class XxlJobTrigger { triggerMsgSb.append("
").append(I18nUtil.getString("jobconf_trigger_exe_regaddress")).append(":").append(group.getRegistryList()); triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorRouteStrategy")).append(":").append(executorRouteStrategyEnum.getTitle()).append("("+i+"/"+addressList.size()+")"); // update01 triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorBlockStrategy")).append(":").append(blockStrategy.getTitle()); - triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorFailStrategy")).append(":").append(failStrategy.getTitle()); + triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorFailRetryCount")).append(":").append(jobInfo.getExecutorFailRetryCount()); triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_timeout")).append(":").append(jobInfo.getExecutorTimeout()); // 3、trigger-valid @@ -144,7 +144,7 @@ public class XxlJobTrigger { triggerMsgSb.append("
").append(I18nUtil.getString("jobconf_trigger_exe_regaddress")).append(":").append(group.getRegistryList()); triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorRouteStrategy")).append(":").append(executorRouteStrategyEnum.getTitle()); triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorBlockStrategy")).append(":").append(blockStrategy.getTitle()); - triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorFailStrategy")).append(":").append(failStrategy.getTitle()); + triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorFailRetryCount")).append(":").append(jobInfo.getExecutorFailRetryCount()); triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_timeout")).append(":").append(jobInfo.getExecutorTimeout()); // 3、trigger-valid diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java index 6d7430eb..56b53c6f 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java @@ -1,6 +1,5 @@ package com.xxl.job.admin.service.impl; -import com.xxl.job.admin.core.enums.ExecutorFailStrategyEnum; import com.xxl.job.admin.core.model.XxlJobGroup; import com.xxl.job.admin.core.model.XxlJobInfo; import com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum; @@ -90,9 +89,6 @@ public class XxlJobServiceImpl implements XxlJobService { if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) { return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) ); } - if (ExecutorFailStrategyEnum.match(jobInfo.getExecutorFailStrategy(), null) == null) { - return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorFailStrategy")+I18nUtil.getString("system_unvalid")) ); - } if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) { return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_gluetype")+I18nUtil.getString("system_unvalid")) ); } @@ -167,9 +163,6 @@ public class XxlJobServiceImpl implements XxlJobService { if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) { return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) ); } - if (ExecutorFailStrategyEnum.match(jobInfo.getExecutorFailStrategy(), null) == null) { - return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorFailStrategy")+I18nUtil.getString("system_unvalid"))); - } // ChildJobId valid if (StringUtils.isNotBlank(jobInfo.getChildJobId())) { @@ -210,6 +203,7 @@ public class XxlJobServiceImpl implements XxlJobService { exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy()); exists_jobInfo.setExecutorFailStrategy(jobInfo.getExecutorFailStrategy()); exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout()); + exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount()); exists_jobInfo.setChildJobId(jobInfo.getChildJobId()); xxlJobInfoDao.update(exists_jobInfo); diff --git a/xxl-job-admin/src/main/resources/i18n/message.properties b/xxl-job-admin/src/main/resources/i18n/message.properties index 7e623cfa..ec71353a 100644 --- a/xxl-job-admin/src/main/resources/i18n/message.properties +++ b/xxl-job-admin/src/main/resources/i18n/message.properties @@ -116,7 +116,8 @@ jobinfo_field_childJobId=子任务ID jobinfo_field_childJobId_limit=子任务ID({0})不可与父任务重复 jobinfo_field_childJobId_placeholder=请输入子任务的任务ID,如存在多个则逗号分隔 jobinfo_field_executorBlockStrategy=阻塞处理策略 -jobinfo_field_executorFailStrategy=失败处理策略 +jobinfo_field_executorFailRetryCount=失败重试次数 +jobinfo_field_executorFailRetryCount_placeholder=失败重试次数,大于零时生效 jobinfo_script_location=脚本位置 jobinfo_shard_index=分片序号 jobinfo_shard_total=分片总数 @@ -198,7 +199,6 @@ jobgroup_del_limit_1=拒绝删除, 系统至少保留一个执行器 jobconf_block_SERIAL_EXECUTION=单机串行 jobconf_block_DISCARD_LATER=丢弃后续调度 jobconf_block_COVER_EARLY=覆盖之前调度 -jobconf_fail_null=无 jobconf_fail_trigger_retry=调度失败重试 jobconf_fail_handle_retry=执行失败重试 jobconf_route_first=第一个 diff --git a/xxl-job-admin/src/main/resources/i18n/message_en.properties b/xxl-job-admin/src/main/resources/i18n/message_en.properties index 978b7292..18ae26ce 100644 --- a/xxl-job-admin/src/main/resources/i18n/message_en.properties +++ b/xxl-job-admin/src/main/resources/i18n/message_en.properties @@ -116,7 +116,8 @@ jobinfo_field_childJobId=Child Job ID jobinfo_field_childJobId_limit=Child job ID({0}) cannot be duplicated with the parent job. jobinfo_field_childJobId_placeholder=Please enter the Child job ID, if there are more than one comma separated jobinfo_field_executorBlockStrategy=Block Strategy -jobinfo_field_executorFailStrategy=Fail Strategy +jobinfo_field_executorFailRetryCount=Fail Retry Count +jobinfo_field_executorFailRetryCount_placeholder=Fail Retry Count. effect if greater than zero jobinfo_script_location=Script location jobinfo_shard_index=Shard index jobinfo_shard_total=Shard total @@ -198,7 +199,6 @@ jobgroup_del_limit_1=Refuses to delete, the system retains at least one executor jobconf_block_SERIAL_EXECUTION=Serial execution jobconf_block_DISCARD_LATER=Discard Later jobconf_block_COVER_EARLY=Cover Early -jobconf_fail_null=Fail Alarm jobconf_fail_trigger_retry=Trigger Fail Retry jobconf_fail_handle_retry=Handle Fail Retry jobconf_route_first=First diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml index 37cf1cd6..336394ad 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml @@ -22,6 +22,7 @@ + @@ -46,6 +47,7 @@ t.executor_block_strategy, t.executor_fail_strategy, t.executor_timeout, + t.executor_fail_retry_count, t.glue_type, t.glue_source, t.glue_remark, @@ -102,6 +104,7 @@ executor_block_strategy, executor_fail_strategy, executor_timeout, + executor_fail_retry_count, glue_type, glue_source, glue_remark, @@ -121,6 +124,7 @@ #{executorBlockStrategy}, #{executorFailStrategy}, #{executorTimeout}, + #{executorFailRetryCount}, #{glueType}, #{glueSource}, #{glueRemark}, @@ -153,6 +157,7 @@ executor_block_strategy = #{executorBlockStrategy}, executor_fail_strategy = #{executorFailStrategy}, executor_timeout = ${executorTimeout}, + executor_fail_retry_count = ${executorFailRetryCount}, glue_type = #{glueType}, glue_source = #{glueSource}, glue_remark = #{glueRemark}, diff --git a/xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl b/xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl index 85001c53..6c766544 100644 --- a/xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl +++ b/xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl @@ -157,14 +157,8 @@
- -
- -
+ +
@@ -345,14 +339,8 @@ process.exit(0)
- -
- -
+ +
diff --git a/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js b/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js index 3f6b63d2..e02f7ef3 100644 --- a/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js +++ b/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js @@ -267,6 +267,9 @@ $(function() { }, executorTimeout : { digits:true + }, + executorFailRetryCount : { + digits:true } }, messages : { @@ -278,6 +281,12 @@ $(function() { }, author : { required : I18n.system_please_input + I18n.jobinfo_field_author + }, + executorTimeout : { + digits: I18n.system_please_input + I18n.system_digits + }, + executorFailRetryCount : { + digits: I18n.system_please_input + I18n.system_digits } }, highlight : function(element) { @@ -376,12 +385,12 @@ $(function() { $("#updateModal .form input[name='author']").val( row.author ); $("#updateModal .form input[name='alarmEmail']").val( row.alarmEmail ); $("#updateModal .form input[name='executorTimeout']").val( row.executorTimeout ); + $("#updateModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount ); $('#updateModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true); $("#updateModal .form input[name='executorHandler']").val( row.executorHandler ); $("#updateModal .form input[name='executorParam']").val( row.executorParam ); $("#updateModal .form input[name='childJobId']").val( row.childJobId ); $('#updateModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true); - $('#updateModal .form select[name=executorFailStrategy] option[value='+ row.executorFailStrategy +']').prop('selected', true); $('#updateModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true); $("#updateModal .form select[name=glueType]").change(); @@ -407,6 +416,9 @@ $(function() { }, executorTimeout : { digits:true + }, + executorFailRetryCount : { + digits:true } }, messages : { @@ -421,6 +433,9 @@ $(function() { }, executorTimeout : { digits: I18n.system_please_input + I18n.system_digits + }, + executorFailRetryCount : { + digits: I18n.system_please_input + I18n.system_digits } }, highlight : function(element) {