定时任务支持Class类调用&多类型参数
This commit is contained in:
@@ -14,21 +14,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">任务组名:</label>
|
||||
<label class="col-sm-3 control-label">任务分组:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="jobGroup" id="jobGroup" required>
|
||||
<select name="jobGroup" class="form-control m-b" th:with="type=${@dict.getType('sys_job_group')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">方法名称:</label>
|
||||
<label class="col-sm-3 control-label ">调用目标字符串:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="methodName" id="methodName" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">方法参数:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="methodParams" id="methodParams">
|
||||
<input class="form-control" type="text" name="invokeTarget" id="invokeTarget" required>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> Bean调用示例:ryTask.ryParams('ry')</span>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> Class类调用示例:com.ruoyi.quartz.task.RyTask.ryParams('ry')</span>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 参数说明:支持字符串,布尔类型,长整型,浮点型,整形</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@@ -18,13 +18,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">任务组名:</label>
|
||||
<label class="col-sm-3 control-label">任务分组:</label>
|
||||
<div class="form-control-static" th:text="${jobLog.jobGroup}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">任务方法:</label>
|
||||
<div class="form-control-static" th:text="${jobLog.methodName} + '(' + ${#strings.defaultString(jobLog.methodParams,'')} + ')'">
|
||||
<label class="col-sm-3 control-label">调用目标字符串:</label>
|
||||
<div class="form-control-static" th:text="${jobLog.invokeTarget}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -56,13 +56,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">任务组名:</label>
|
||||
<label class="col-sm-3 control-label">任务分组:</label>
|
||||
<div class="form-control-static" th:text="${job.jobGroup}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">任务方法:</label>
|
||||
<div class="form-control-static" th:text="${job.methodName} + '(' + ${#strings.defaultString(job.methodParams,'')} + ')'">
|
||||
<label class="col-sm-3 control-label">调用目标字符串:</label>
|
||||
<div class="form-control-static" th:text="${job.invokeTarget}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@@ -15,21 +15,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">任务组名:</label>
|
||||
<label class="col-sm-3 control-label">任务分组:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="jobGroup" id="jobGroup" th:field="*{jobGroup}" required>
|
||||
<select name="jobGroup" class="form-control m-b" th:with="type=${@dict.getType('sys_job_group')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{jobGroup}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">方法名称:</label>
|
||||
<label class="col-sm-3 control-label ">调用目标字符串:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="methodName" id="methodName" th:field="*{methodName}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">方法参数:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="methodParams" id="methodParams" th:field="*{methodParams}">
|
||||
<input class="form-control" type="text" name="invokeTarget" id="invokeTarget" th:field="*{invokeTarget}" required>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> Bean调用示例:ryTask.ryParams('ry')</span>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> Class类调用示例:com.ruoyi.quartz.task.RyTask.ryParams('ry')</span>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 参数说明:支持字符串,布尔类型,长整型,浮点型,整形</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -77,15 +76,6 @@
|
||||
$("#form-job-edit").validate({
|
||||
onkeyup: false,
|
||||
rules:{
|
||||
jobName:{
|
||||
required:true,
|
||||
},
|
||||
jobGroup:{
|
||||
required:true,
|
||||
},
|
||||
methodName:{
|
||||
required:true,
|
||||
},
|
||||
cronExpression:{
|
||||
required:true,
|
||||
remote: {
|
||||
|
@@ -14,7 +14,10 @@
|
||||
任务名称:<input type="text" name="jobName"/>
|
||||
</li>
|
||||
<li>
|
||||
方法名称:<input type="text" name="methodName"/>
|
||||
任务分组:<select name="jobGroup" th:with="type=${@dict.getType('sys_job_group')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
任务状态:<select name="status" th:with="type=${@dict.getType('sys_job_status')}">
|
||||
@@ -60,7 +63,7 @@
|
||||
var editFlag = [[${@permission.hasPermi('monitor:job:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('monitor:job:remove')}]];
|
||||
var statusFlag = [[${@permission.hasPermi('monitor:job:changeStatus')}]];
|
||||
var datas = [[${@dict.getType('sys_job_status')}]];
|
||||
var datas = [[${@dict.getType('sys_job_group')}]];
|
||||
var prefix = ctx + "monitor/job";
|
||||
|
||||
$(function() {
|
||||
@@ -84,20 +87,20 @@
|
||||
{
|
||||
field: 'jobName',
|
||||
title: '任务名称',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'jobGroup',
|
||||
title: '任务组名',
|
||||
sortable: true
|
||||
title: '任务分组',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(datas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'methodName',
|
||||
title: '方法名称'
|
||||
},
|
||||
{
|
||||
field: 'methodParams',
|
||||
title: '方法参数'
|
||||
field: 'invokeTarget',
|
||||
title: '调用目标字符串',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.tooltip(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'cronExpression',
|
||||
@@ -121,7 +124,7 @@
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-primary btn-xs ' + statusFlag + '" href="javascript:void(0)" onclick="run(\'' + row.jobId + '\')"><i class="fa fa-play-circle-o"></i> 执行一次</a> ');
|
||||
actions.push('<a class="btn btn-primary btn-xs ' + statusFlag + '" href="javascript:void(0)" onclick="run(\'' + row.jobId + '\', \'' + row.jobGroup + '\')"><i class="fa fa-play-circle-o"></i> 执行一次</a> ');
|
||||
actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.jobId + '\')"><i class="fa fa-search"></i>详细</a> ');
|
||||
return actions.join('');
|
||||
}
|
||||
@@ -133,30 +136,30 @@
|
||||
/* 调度任务状态显示 */
|
||||
function statusTools(row) {
|
||||
if (row.status == 1) {
|
||||
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="start(\'' + row.jobId + '\')"></i> ';
|
||||
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="start(\'' + row.jobId + '\', \'' + row.jobGroup + '\')"></i> ';
|
||||
} else {
|
||||
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="stop(\'' + row.jobId + '\')"></i> ';
|
||||
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="stop(\'' + row.jobId + '\', \'' + row.jobGroup + '\')"></i> ';
|
||||
}
|
||||
}
|
||||
|
||||
/* 立即执行一次 */
|
||||
function run(jobId) {
|
||||
function run(jobId, jobGroup) {
|
||||
$.modal.confirm("确认要立即执行一次任务吗?", function() {
|
||||
$.operate.post(prefix + "/run", { "jobId": jobId});
|
||||
$.operate.post(prefix + "/run", { "jobId": jobId, "jobId": jobId, "jobGroup": jobGroup});
|
||||
})
|
||||
}
|
||||
|
||||
/* 调度任务-停用 */
|
||||
function stop(jobId) {
|
||||
function stop(jobId, jobGroup) {
|
||||
$.modal.confirm("确认要停用任务吗?", function() {
|
||||
$.operate.post(prefix + "/changeStatus", { "jobId": jobId, "status": 1 });
|
||||
$.operate.post(prefix + "/changeStatus", { "jobId": jobId, "jobGroup": jobGroup, "status": 1 });
|
||||
})
|
||||
}
|
||||
|
||||
/* 调度任务-启用 */
|
||||
function start(jobId) {
|
||||
function start(jobId, jobGroup) {
|
||||
$.modal.confirm("确认要启用任务吗?", function() {
|
||||
$.operate.post(prefix + "/changeStatus", { "jobId": jobId, "status": 0 });
|
||||
$.operate.post(prefix + "/changeStatus", { "jobId": jobId, "jobGroup": jobGroup, "status": 0 });
|
||||
})
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,8 @@
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var detailFlag = [[${@permission.hasPermi('monitor:job:detail')}]];
|
||||
var datas = [[${@dict.getType('sys_common_status')}]];
|
||||
var statusDatas = [[${@dict.getType('sys_common_status')}]];
|
||||
var groupDatas = [[${@dict.getType('sys_job_group')}]];
|
||||
var prefix = ctx + "monitor/jobLog";
|
||||
|
||||
$(function() {
|
||||
@@ -80,21 +81,21 @@
|
||||
},
|
||||
{
|
||||
field: 'jobName',
|
||||
title: '任务名称',
|
||||
sortable: true
|
||||
title: '任务名称'
|
||||
},
|
||||
{
|
||||
field: 'jobGroup',
|
||||
title: '任务组名',
|
||||
sortable: true
|
||||
title: '任务分组',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(groupDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'methodName',
|
||||
title: '方法名称'
|
||||
},
|
||||
{
|
||||
field: 'methodParams',
|
||||
title: '方法参数'
|
||||
field: 'invokeTarget',
|
||||
title: '调用目标字符串',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.tooltip(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'jobMessage',
|
||||
@@ -105,7 +106,7 @@
|
||||
title: '状态',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(datas, value);
|
||||
return $.table.selectDictLabel(statusDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user