提交 670f71e5 编写于 作者: X xueli.xue

调度日志

上级 87ce1536
package com.xxl.job.controller;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.xxl.job.core.util.DynamicSchedulerUtil;
/**
* index controller
* @author xuxueli 2015-12-19 16:13:16
......@@ -16,16 +11,14 @@ import com.xxl.job.core.util.DynamicSchedulerUtil;
@Controller
public class IndexController {
@RequestMapping("")
@RequestMapping("/")
public String index(Model model) {
List<Map<String, Object>> jobList = DynamicSchedulerUtil.getJobList();
model.addAttribute("jobList", jobList);
return "job/index";
return "redirect:job";
}
@RequestMapping("/help")
public String help(Model model) {
return "job/help";
return "help";
}
}
......@@ -2,6 +2,7 @@ package com.xxl.job.controller;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
......@@ -13,6 +14,7 @@ import org.quartz.CronExpression;
import org.quartz.Job;
import org.quartz.SchedulerException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -29,6 +31,13 @@ import com.xxl.job.service.job.HttpJobBean;
@RequestMapping("/job")
public class JobController {
@RequestMapping
public String index(Model model) {
List<Map<String, Object>> jobList = DynamicSchedulerUtil.getJobList();
model.addAttribute("jobList", jobList);
return "job/index";
}
@RequestMapping("/add")
@ResponseBody
public ReturnT<String> add(HttpServletRequest request) {
......
package com.xxl.job.controller;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xxl.job.core.model.ReturnT;
......@@ -37,4 +42,30 @@ public class JobLogController {
return ReturnT.FAIL;
}
@RequestMapping("/")
public String index(Model model) {
return "joblog/index";
}
@RequestMapping("/pageList")
@ResponseBody
public Map<String, Object> pageList(@RequestParam(required = false) String jobName,
@RequestParam(required = false, defaultValue = "0") int start,
@RequestParam(required = false, defaultValue = "10") int length) {
System.out.println(start);
System.out.println(length);
System.out.println(jobName);
List<XxlJobLog> list = xxlJobLogDao.pageList(start, length, jobName);
int list_count = xxlJobLogDao.pageListCount(start, length, jobName);
Map<String, Object> maps = new HashMap<String, Object>();
maps.put("draw", list_count); // 请求次数
maps.put("recordsTotal", list_count); // 总记录数
maps.put("recordsFiltered", list_count);// 过滤后的总记录数
maps.put("data", list); // 分页列表
return maps;
}
}
......@@ -81,6 +81,7 @@
<if test="jobName != null and jobName!=''">
WHERE t.job_name = #{jobName}
</if>
ORDER BY id DESC
LIMIT #{offset}, #{pagesize}
</select>
......
......@@ -64,7 +64,8 @@
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header">常用模块</li>
<li class="nav-click" ><a href="${request.contextPath}//"><i class="fa fa-circle-o text-red"></i> <span>调度中心</span></a></li>
<li class="nav-click" ><a href="${request.contextPath}/job/"><i class="fa fa-circle-o text-red"></i> <span>调度管理</span></a></li>
<li class="nav-click" ><a href="${request.contextPath}/joblog/"><i class="fa fa-circle-o text-yellow"></i><span>调度日志</span></a></li>
<li class="nav-click" ><a href="${request.contextPath}/help"><i class="fa fa-circle-o text-yellow"></i><span>使用教程</span></a></li>
</ul>
</section>
......
......@@ -19,10 +19,10 @@
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>调度中心<small>调度管理</small></h1>
<h1>调度管理<small>调度中心</small></h1>
<ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>调度中心</a></li>
<li class="active">调度管理</li>
<li><a><i class="fa fa-dashboard"></i>调度管理</a></li>
<li class="active">调度中心</li>
</ol>
</section>
......
<!DOCTYPE html>
<html>
<head>
<title>调度日志</title>
<#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle />
<!-- DataTables -->
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
<!-- DataTables CSS -->
<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.css">
<!-- jQuery -->
<script type="text/javascript" charset="utf8" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<!-- DataTables -->
<script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/1.10.7/js/jquery.dataTables.js"></script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<!-- header -->
<@netCommon.commonHeader />
<!-- left -->
<@netCommon.commonLeft />
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>调度日志<small>调度中心</small></h1>
<ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>调度日志</a></li>
<li class="active">调度管理</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">调度列表</h3>
</div>
<div class="box-body">
<table id="joblog_list" class="table table-bordered table-striped display">
<thead>
<tr>
<th>id</th>
<th>jobName</th>
<th>jobCron</th>
<th>jobClass</th>
<th>handleTime</th>
<th>handleStatus</th>
</tr>
</thead>
<tbody></tbody>
<tfoot>
<tr>
<th>id</th>
<th>jobName</th>
<th>jobCron</th>
<th>jobClass</th>
<th>handleTime</th>
<th>handleStatus</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- footer -->
<@netCommon.commonFooter />
<!-- control -->
<@netCommon.commonControl />
</div>
<@netCommon.commonScript />
<@netCommon.comAlert />
<!-- DataTables -->
<script src="${request.contextPath}/static/adminlte/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script>var base_url = '${request.contextPath}';</script>
<script src="${request.contextPath}/static/js/joblog.index.1.js"></script>
</body>
</html>
$(function() {
// init date tables
$("#joblog_list").dataTable({
"serverSide": true,
"ajax": {
url: base_url + "/joblog/pageList"
},
"processing" : true,
"deferRender": true,
"columns": [
{ "data": 'id', "bSortable": false, "visible" : true},
{ "data": 'jobName', "bSortable": false},
{ "data": 'jobCron', "bSortable": false},
{ "data": 'jobClass', "bSortable": false},
{ "data": 'handleTime',"bSortable": false},
{ "data": 'handleStatus' , "bSortable": false}
],
"language" : {
"sProcessing" : "处理中...",
"sLengthMenu" : "每页 _MENU_ 条记录",
"sZeroRecords" : "没有匹配结果",
"sInfo" : "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
"sInfoEmpty" : "无记录",
"sInfoFiltered" : "(由 _MAX_ 项结果过滤)",
"sInfoPostFix" : "",
"sSearch" : "搜索:",
"sUrl" : "",
"sEmptyTable" : "表中数据为空",
"sLoadingRecords" : "载入中...",
"sInfoThousands" : ",",
"oPaginate" : {
"sFirst" : "首页",
"sPrevious" : "上页",
"sNext" : "下页",
"sLast" : "末页"
},
"oAria" : {
"sSortAscending" : ": 以升序排列此列",
"sSortDescending" : ": 以降序排列此列"
}
}
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册