Commit 650f89ac by RuoYi

任务日志新增详细

parent 1292dcf5
......@@ -4,7 +4,9 @@ import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -12,10 +14,10 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.quartz.domain.SysJobLog;
import com.ruoyi.quartz.service.ISysJobLogService;
import com.ruoyi.framework.web.base.BaseController;
/**
* 调度日志操作处理
......@@ -68,6 +70,14 @@ public class SysJobLogController extends BaseController
return toAjax(jobLogService.deleteJobLogByIds(ids));
}
@RequiresPermissions("monitor:job:detail")
@GetMapping("/detail/{jobLogId}")
public String detail(@PathVariable("jobLogId") Long jobLogId, ModelMap mmap)
{
mmap.put("jobLog", jobLogService.selectJobLogById(jobLogId));
return prefix + "/detail";
}
@Log(title = "调度日志", businessType = BusinessType.CLEAN)
@RequiresPermissions("monitor:job:remove")
@PostMapping("/clean")
......
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<div class="form-group">
<label class="col-sm-2 control-label">日志序号:</label>
<div class="form-control-static" th:text="${jobLog.jobLogId}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">任务名称:</label>
<div class="form-control-static" th:text="${jobLog.jobName}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">任务组名:</label>
<div class="form-control-static" th:text="${jobLog.jobGroup}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">任务方法:</label>
<div class="form-control-static" th:text="${jobLog.methodName} + '(' + ${jobLog.methodParams} + ')'">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">日志信息:</label>
<div class="form-control-static" th:text="${jobLog.jobMessage}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">执行状态:</label>
<div class="form-control-static" th:class="${jobLog.status == '0' ? 'label label-primary' : 'label label-danger'}" th:text="${jobLog.status == '0' ? '正常' : '失败'}">
</div>
</div>
<div class="form-group" th:style="'display:' + ${jobLog.status == '0' ? 'none' : 'block'}">
<label class="col-sm-2 control-label">异常信息:</label>
<div class="form-control-static" th:text="${jobLog.exceptionInfo}">
</div>
</div>
</form>
</div>
<div th:include="include :: footer"></div>
</script>
</body>
</html>
\ No newline at end of file
......@@ -57,7 +57,7 @@
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var removeFlag = [[${@permission.hasPermi('monitor:job:remove')}]];
var detailFlag = [[${@permission.hasPermi('monitor:job:detail')}]];
var datas = [[${@dict.getType('sys_common_status')}]];
var prefix = ctx + "monitor/jobLog";
......@@ -65,6 +65,7 @@
var options = {
url: prefix + "/list",
cleanUrl: prefix + "/clean",
detailUrl: prefix + "/detail/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
sortName: "createTime",
......@@ -119,7 +120,7 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.jobLogId + '\')"><i class="fa fa-remove"></i>删除</a>');
actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="#" onclick="$.operate.detail(\'' + row.jobLogId + '\')"><i class="fa fa-search"></i>详细</a>');
return actions.join('');
}
}]
......
......@@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.ScheduleConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.quartz.domain.SysJob;
import com.ruoyi.quartz.domain.SysJobLog;
......@@ -67,7 +68,7 @@ public class ScheduleJob extends QuartzJobBean
jobLog.setJobMessage(job.getJobName() + " 总共耗时:" + times + "毫秒");
// 任务状态 0:成功 1:失败
jobLog.setStatus(Constants.FAIL);
jobLog.setExceptionInfo(e.toString());
jobLog.setExceptionInfo(StringUtils.substring(e.getMessage(), 0, 2000));
}
finally
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment