调度日志

v1.3
xueli.xue 9 years ago
parent 87ce15368e
commit 670f71e557

@ -1,14 +1,9 @@
package com.xxl.job.controller; package com.xxl.job.controller;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.xxl.job.core.util.DynamicSchedulerUtil;
/** /**
* index controller * index controller
* @author xuxueli 2015-12-19 16:13:16 * @author xuxueli 2015-12-19 16:13:16
@ -16,16 +11,14 @@ import com.xxl.job.core.util.DynamicSchedulerUtil;
@Controller @Controller
public class IndexController { public class IndexController {
@RequestMapping("") @RequestMapping("/")
public String index(Model model) { public String index(Model model) {
List<Map<String, Object>> jobList = DynamicSchedulerUtil.getJobList(); return "redirect:job";
model.addAttribute("jobList", jobList);
return "job/index";
} }
@RequestMapping("/help") @RequestMapping("/help")
public String help(Model model) { 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.io.UnsupportedEncodingException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
@ -13,6 +14,7 @@ import org.quartz.CronExpression;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.SchedulerException; import org.quartz.SchedulerException;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -29,6 +31,13 @@ import com.xxl.job.service.job.HttpJobBean;
@RequestMapping("/job") @RequestMapping("/job")
public class JobController { 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") @RequestMapping("/add")
@ResponseBody @ResponseBody
public ReturnT<String> add(HttpServletRequest request) { public ReturnT<String> add(HttpServletRequest request) {

@ -1,11 +1,16 @@
package com.xxl.job.controller; package com.xxl.job.controller;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.xxl.job.core.model.ReturnT; import com.xxl.job.core.model.ReturnT;
@ -37,4 +42,30 @@ public class JobLogController {
return ReturnT.FAIL; 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!=''"> <if test="jobName != null and jobName!=''">
WHERE t.job_name = #{jobName} WHERE t.job_name = #{jobName}
</if> </if>
ORDER BY id DESC
LIMIT #{offset}, #{pagesize} LIMIT #{offset}, #{pagesize}
</select> </select>

@ -64,7 +64,8 @@
<!-- sidebar menu: : style can be found in sidebar.less --> <!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu"> <ul class="sidebar-menu">
<li class="header">常用模块</li> <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> <li class="nav-click" ><a href="${request.contextPath}/help"><i class="fa fa-circle-o text-yellow"></i><span>使用教程</span></a></li>
</ul> </ul>
</section> </section>

@ -19,10 +19,10 @@
<div class="content-wrapper"> <div class="content-wrapper">
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<section class="content-header"> <section class="content-header">
<h1>调度中心<small>调度管理</small></h1> <h1>调度管理<small>调度中心</small></h1>
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>调度中心</a></li> <li><a><i class="fa fa-dashboard"></i>调度管理</a></li>
<li class="active">调度管理</li> <li class="active">调度中心</li>
</ol> </ol>
</section> </section>

@ -0,0 +1,89 @@
<!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>

@ -0,0 +1,44 @@
$(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" : ": 以降序排列此列"
}
}
});
});
Loading…
Cancel
Save