执行日志,支持根据运行 "状态" 筛选日志;
This commit is contained in:
parent
be3fc368cb
commit
d46bc28a04
|
@ -176,10 +176,10 @@ CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOG` (
|
||||||
`executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
|
`executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
|
||||||
`executor_param` varchar(255) DEFAULT NULL COMMENT 'executor_param',
|
`executor_param` varchar(255) DEFAULT NULL COMMENT 'executor_param',
|
||||||
`trigger_time` datetime DEFAULT NULL COMMENT '调度-时间',
|
`trigger_time` datetime DEFAULT NULL COMMENT '调度-时间',
|
||||||
`trigger_code` varchar(255) DEFAULT NULL COMMENT '调度-结果',
|
`trigger_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '调度-结果',
|
||||||
`trigger_msg` varchar(2048) DEFAULT NULL COMMENT '调度-日志',
|
`trigger_msg` varchar(2048) DEFAULT NULL COMMENT '调度-日志',
|
||||||
`handle_time` datetime DEFAULT NULL COMMENT '执行-时间',
|
`handle_time` datetime DEFAULT NULL COMMENT '执行-时间',
|
||||||
`handle_code` varchar(255) DEFAULT NULL COMMENT '执行-状态',
|
`handle_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '执行-状态',
|
||||||
`handle_msg` varchar(2048) DEFAULT NULL COMMENT '执行-日志',
|
`handle_msg` varchar(2048) DEFAULT NULL COMMENT '执行-日志',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class JobLogController {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start,
|
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start,
|
||||||
@RequestParam(required = false, defaultValue = "10") int length,
|
@RequestParam(required = false, defaultValue = "10") int length,
|
||||||
int jobGroup, int jobId, String filterTime) {
|
int jobGroup, int jobId, int logStatus, String filterTime) {
|
||||||
|
|
||||||
// parse param
|
// parse param
|
||||||
Date triggerTimeStart = null;
|
Date triggerTimeStart = null;
|
||||||
|
@ -83,8 +83,8 @@ public class JobLogController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// page query
|
// page query
|
||||||
List<XxlJobLog> list = xxlJobLogDao.pageList(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd);
|
List<XxlJobLog> list = xxlJobLogDao.pageList(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
|
||||||
int list_count = xxlJobLogDao.pageListCount(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd);
|
int list_count = xxlJobLogDao.pageListCount(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd, logStatus);
|
||||||
|
|
||||||
// package result
|
// package result
|
||||||
Map<String, Object> maps = new HashMap<String, Object>();
|
Map<String, Object> maps = new HashMap<String, Object>();
|
||||||
|
|
|
@ -12,8 +12,8 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public interface IXxlJobLogDao {
|
public interface IXxlJobLogDao {
|
||||||
|
|
||||||
public List<XxlJobLog> pageList(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd);
|
public List<XxlJobLog> pageList(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd, int logStatus);
|
||||||
public int pageListCount(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd);
|
public int pageListCount(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd, int logStatus);
|
||||||
|
|
||||||
public XxlJobLog load(int id);
|
public XxlJobLog load(int id);
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class XxlJobLogDaoImpl implements IXxlJobLogDao {
|
||||||
public SqlSessionTemplate sqlSessionTemplate;
|
public SqlSessionTemplate sqlSessionTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<XxlJobLog> pageList(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd) {
|
public List<XxlJobLog> pageList(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd, int logStatus) {
|
||||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("offset", offset);
|
params.put("offset", offset);
|
||||||
params.put("pagesize", pagesize);
|
params.put("pagesize", pagesize);
|
||||||
|
@ -30,12 +30,13 @@ public class XxlJobLogDaoImpl implements IXxlJobLogDao {
|
||||||
params.put("jobId", jobId);
|
params.put("jobId", jobId);
|
||||||
params.put("triggerTimeStart", triggerTimeStart);
|
params.put("triggerTimeStart", triggerTimeStart);
|
||||||
params.put("triggerTimeEnd", triggerTimeEnd);
|
params.put("triggerTimeEnd", triggerTimeEnd);
|
||||||
|
params.put("logStatus", logStatus);
|
||||||
|
|
||||||
return sqlSessionTemplate.selectList("XxlJobLogMapper.pageList", params);
|
return sqlSessionTemplate.selectList("XxlJobLogMapper.pageList", params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int pageListCount(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd) {
|
public int pageListCount(int offset, int pagesize, int jobGroup, int jobId, Date triggerTimeStart, Date triggerTimeEnd, int logStatus) {
|
||||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
HashMap<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("offset", offset);
|
params.put("offset", offset);
|
||||||
params.put("pagesize", pagesize);
|
params.put("pagesize", pagesize);
|
||||||
|
@ -43,6 +44,7 @@ public class XxlJobLogDaoImpl implements IXxlJobLogDao {
|
||||||
params.put("jobId", jobId);
|
params.put("jobId", jobId);
|
||||||
params.put("triggerTimeStart", triggerTimeStart);
|
params.put("triggerTimeStart", triggerTimeStart);
|
||||||
params.put("triggerTimeEnd", triggerTimeEnd);
|
params.put("triggerTimeEnd", triggerTimeEnd);
|
||||||
|
params.put("logStatus", logStatus);
|
||||||
|
|
||||||
return sqlSessionTemplate.selectOne("XxlJobLogMapper.pageListCount", params);
|
return sqlSessionTemplate.selectOne("XxlJobLogMapper.pageListCount", params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,18 @@
|
||||||
<if test="triggerTimeEnd != null">
|
<if test="triggerTimeEnd != null">
|
||||||
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="logStatus == 1" >
|
||||||
|
AND t.handle_code = 200
|
||||||
|
</if>
|
||||||
|
<if test="logStatus == 2" >
|
||||||
|
AND (
|
||||||
|
(t.trigger_code <![CDATA[ > ]]> 0 AND t.trigger_code!=200) ||
|
||||||
|
(t.handle_code <![CDATA[ > ]]> 0 AND t.handle_code!=200)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="logStatus == 3" >
|
||||||
|
AND (t.trigger_code = 200 AND t.handle_code=0)
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY id DESC
|
ORDER BY id DESC
|
||||||
LIMIT #{offset}, #{pagesize}
|
LIMIT #{offset}, #{pagesize}
|
||||||
|
@ -78,6 +90,18 @@
|
||||||
<if test="triggerTimeEnd != null">
|
<if test="triggerTimeEnd != null">
|
||||||
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="logStatus == 1" >
|
||||||
|
AND t.handle_code = 200
|
||||||
|
</if>
|
||||||
|
<if test="logStatus == 2" >
|
||||||
|
AND (
|
||||||
|
(t.trigger_code <![CDATA[ > ]]> 0 AND t.trigger_code!=200) ||
|
||||||
|
(t.handle_code <![CDATA[ > ]]> 0 AND t.handle_code!=200)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="logStatus == 3" >
|
||||||
|
AND (t.trigger_code = 200 AND t.handle_code=0)
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<!-- Main content -->
|
<!-- Main content -->
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-3">
|
<div class="col-xs-2">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon">执行器</span>
|
<span class="input-group-addon">执行器</span>
|
||||||
<select class="form-control" id="jobGroup" paramVal="<#if jobInfo?exists>${jobInfo.jobGroup}</#if>" >
|
<select class="form-control" id="jobGroup" paramVal="<#if jobInfo?exists>${jobInfo.jobGroup}</#if>" >
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-3">
|
<div class="col-xs-2">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon">任务</span>
|
<span class="input-group-addon">任务</span>
|
||||||
<select class="form-control" id="jobId" paramVal="<#if jobInfo?exists>${jobInfo.id}</#if>" >
|
<select class="form-control" id="jobId" paramVal="<#if jobInfo?exists>${jobInfo.id}</#if>" >
|
||||||
|
@ -51,6 +51,19 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-addon">状态</span>
|
||||||
|
<select class="form-control" id="logStatus" >
|
||||||
|
<option value="-1" >全部</option>
|
||||||
|
<option value="1" >成功</option>
|
||||||
|
<option value="2" >失败</option>
|
||||||
|
<option value="3" >进行中</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-xs-4">
|
<div class="col-xs-4">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon">
|
<span class="input-group-addon">
|
||||||
|
|
|
@ -78,6 +78,7 @@ $(function() {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj.jobGroup = $('#jobGroup').val();
|
obj.jobGroup = $('#jobGroup').val();
|
||||||
obj.jobId = $('#jobId').val();
|
obj.jobId = $('#jobId').val();
|
||||||
|
obj.logStatus = $('#logStatus').val();
|
||||||
obj.filterTime = $('#filterTime').val();
|
obj.filterTime = $('#filterTime').val();
|
||||||
obj.start = d.start;
|
obj.start = d.start;
|
||||||
obj.length = d.length;
|
obj.length = d.length;
|
||||||
|
|
Loading…
Reference in New Issue