执行日志,支持根据运行 "状态" 筛选日志;

master
xuxueli 7 years ago
parent be3fc368cb
commit d46bc28a04
  1. 4
      db/tables_xxl_job.sql
  2. 6
      xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java
  3. 4
      xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobLogDao.java
  4. 6
      xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogDaoImpl.java
  5. 24
      xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml
  6. 17
      xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/joblog.index.ftl
  7. 1
      xxl-job-admin/src/main/webapp/static/js/joblog.index.1.js

@ -176,10 +176,10 @@ CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOG` (
`executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
`executor_param` varchar(255) DEFAULT NULL COMMENT 'executor_param',
`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 '调度-日志',
`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 '执行-日志',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

@ -67,7 +67,7 @@ public class JobLogController {
@ResponseBody
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start,
@RequestParam(required = false, defaultValue = "10") int length,
int jobGroup, int jobId, String filterTime) {
int jobGroup, int jobId, int logStatus, String filterTime) {
// parse param
Date triggerTimeStart = null;
@ -83,8 +83,8 @@ public class JobLogController {
}
// page query
List<XxlJobLog> list = xxlJobLogDao.pageList(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd);
int list_count = xxlJobLogDao.pageListCount(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, logStatus);
// package result
Map<String, Object> maps = new HashMap<String, Object>();

@ -12,8 +12,8 @@ import java.util.Map;
*/
public interface IXxlJobLogDao {
public List<XxlJobLog> pageList(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);
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, int logStatus);
public XxlJobLog load(int id);

@ -22,7 +22,7 @@ public class XxlJobLogDaoImpl implements IXxlJobLogDao {
public SqlSessionTemplate sqlSessionTemplate;
@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>();
params.put("offset", offset);
params.put("pagesize", pagesize);
@ -30,12 +30,13 @@ public class XxlJobLogDaoImpl implements IXxlJobLogDao {
params.put("jobId", jobId);
params.put("triggerTimeStart", triggerTimeStart);
params.put("triggerTimeEnd", triggerTimeEnd);
params.put("logStatus", logStatus);
return sqlSessionTemplate.selectList("XxlJobLogMapper.pageList", params);
}
@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>();
params.put("offset", offset);
params.put("pagesize", pagesize);
@ -43,6 +44,7 @@ public class XxlJobLogDaoImpl implements IXxlJobLogDao {
params.put("jobId", jobId);
params.put("triggerTimeStart", triggerTimeStart);
params.put("triggerTimeEnd", triggerTimeEnd);
params.put("logStatus", logStatus);
return sqlSessionTemplate.selectOne("XxlJobLogMapper.pageListCount", params);
}

@ -57,6 +57,18 @@
<if test="triggerTimeEnd != null">
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
</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>
ORDER BY id DESC
LIMIT #{offset}, #{pagesize}
@ -78,6 +90,18 @@
<if test="triggerTimeEnd != null">
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
</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>
</select>

@ -32,7 +32,7 @@
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-3">
<div class="col-xs-2">
<div class="input-group">
<span class="input-group-addon">执行器</span>
<select class="form-control" id="jobGroup" paramVal="<#if jobInfo?exists>${jobInfo.jobGroup}</#if>" >
@ -43,7 +43,7 @@
</select>
</div>
</div>
<div class="col-xs-3">
<div class="col-xs-2">
<div class="input-group">
<span class="input-group-addon">任务</span>
<select class="form-control" id="jobId" paramVal="<#if jobInfo?exists>${jobInfo.id}</#if>" >
@ -51,6 +51,19 @@
</select>
</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="input-group">
<span class="input-group-addon">

@ -78,6 +78,7 @@ $(function() {
var obj = {};
obj.jobGroup = $('#jobGroup').val();
obj.jobId = $('#jobId').val();
obj.logStatus = $('#logStatus').val();
obj.filterTime = $('#filterTime').val();
obj.start = d.start;
obj.length = d.length;

Loading…
Cancel
Save