Bladeren bron

调度日志

xueli.xue 9 jaren geleden
bovenliggende
commit
670f71e557

+ 3 - 10
xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java Bestand weergeven

@@ -1,14 +1,9 @@
1 1
 package com.xxl.job.controller;
2 2
 
3
-import java.util.List;
4
-import java.util.Map;
5
-
6 3
 import org.springframework.stereotype.Controller;
7 4
 import org.springframework.ui.Model;
8 5
 import org.springframework.web.bind.annotation.RequestMapping;
9 6
 
10
-import com.xxl.job.core.util.DynamicSchedulerUtil;
11
-
12 7
 /**
13 8
  * index controller
14 9
  * @author xuxueli 2015-12-19 16:13:16
@@ -16,16 +11,14 @@ import com.xxl.job.core.util.DynamicSchedulerUtil;
16 11
 @Controller
17 12
 public class IndexController {
18 13
 
19
-	@RequestMapping("")
14
+	@RequestMapping("/")
20 15
 	public String index(Model model) {
21
-		List<Map<String, Object>> jobList = DynamicSchedulerUtil.getJobList();
22
-		model.addAttribute("jobList", jobList);
23
-		return "job/index";
16
+		return "redirect:job";
24 17
 	}
25 18
 	
26 19
 	@RequestMapping("/help")
27 20
 	public String help(Model model) {
28
-		return "job/help";
21
+		return "help";
29 22
 	}
30 23
 	
31 24
 }

+ 9 - 0
xxl-job-admin/src/main/java/com/xxl/job/controller/JobController.java Bestand weergeven

@@ -2,6 +2,7 @@ package com.xxl.job.controller;
2 2
 
3 3
 import java.io.UnsupportedEncodingException;
4 4
 import java.util.HashMap;
5
+import java.util.List;
5 6
 import java.util.Map;
6 7
 import java.util.Map.Entry;
7 8
 import java.util.Set;
@@ -13,6 +14,7 @@ import org.quartz.CronExpression;
13 14
 import org.quartz.Job;
14 15
 import org.quartz.SchedulerException;
15 16
 import org.springframework.stereotype.Controller;
17
+import org.springframework.ui.Model;
16 18
 import org.springframework.web.bind.annotation.RequestMapping;
17 19
 import org.springframework.web.bind.annotation.ResponseBody;
18 20
 
@@ -29,6 +31,13 @@ import com.xxl.job.service.job.HttpJobBean;
29 31
 @RequestMapping("/job")
30 32
 public class JobController {
31 33
 	
34
+	@RequestMapping
35
+	public String index(Model model) {
36
+		List<Map<String, Object>> jobList = DynamicSchedulerUtil.getJobList();
37
+		model.addAttribute("jobList", jobList);
38
+		return "job/index";
39
+	}
40
+	
32 41
 	@RequestMapping("/add")
33 42
 	@ResponseBody
34 43
 	public ReturnT<String> add(HttpServletRequest request) {

+ 31 - 0
xxl-job-admin/src/main/java/com/xxl/job/controller/JobLogController.java Bestand weergeven

@@ -1,11 +1,16 @@
1 1
 package com.xxl.job.controller;
2 2
 
3 3
 import java.util.Date;
4
+import java.util.HashMap;
5
+import java.util.List;
6
+import java.util.Map;
4 7
 
5 8
 import javax.annotation.Resource;
6 9
 
7 10
 import org.springframework.stereotype.Controller;
11
+import org.springframework.ui.Model;
8 12
 import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestParam;
9 14
 import org.springframework.web.bind.annotation.ResponseBody;
10 15
 
11 16
 import com.xxl.job.core.model.ReturnT;
@@ -37,4 +42,30 @@ public class JobLogController {
37 42
 		return ReturnT.FAIL;
38 43
 	}
39 44
 	
45
+	@RequestMapping("/")
46
+	public String index(Model model) {
47
+		return "joblog/index";
48
+	}
49
+	
50
+	@RequestMapping("/pageList")
51
+	@ResponseBody
52
+	public Map<String, Object> pageList(@RequestParam(required = false) String jobName,  
53
+		      @RequestParam(required = false, defaultValue = "0") int start,  
54
+		      @RequestParam(required = false, defaultValue = "10") int length) {
55
+		
56
+		System.out.println(start);
57
+		System.out.println(length);
58
+		System.out.println(jobName);
59
+		
60
+		List<XxlJobLog> list = xxlJobLogDao.pageList(start, length, jobName);
61
+		int list_count = xxlJobLogDao.pageListCount(start, length, jobName);
62
+		
63
+		Map<String, Object> maps = new HashMap<String, Object>();
64
+		maps.put("draw", list_count);			// 请求次数
65
+	    maps.put("recordsTotal", list_count);	// 总记录数
66
+	    maps.put("recordsFiltered", list_count);// 过滤后的总记录数
67
+	    maps.put("data", list);  				// 分页列表
68
+		return maps;
69
+	}
70
+	
40 71
 }

+ 1 - 0
xxl-job-admin/src/main/java/com/xxl/job/core/model/mapper/XxlJobLogMapper.xml Bestand weergeven

@@ -81,6 +81,7 @@
81 81
 		<if test="jobName != null and jobName!=''">
82 82
 			WHERE t.job_name = #{jobName}
83 83
 		</if>
84
+		ORDER BY id DESC
84 85
 		LIMIT #{offset}, #{pagesize}
85 86
 	</select>
86 87
 	

+ 2 - 1
xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.macro.ftl Bestand weergeven

@@ -64,7 +64,8 @@
64 64
 			<!-- sidebar menu: : style can be found in sidebar.less -->
65 65
 			<ul class="sidebar-menu">
66 66
 				<li class="header">常用模块</li>
67
-				<li class="nav-click" ><a href="${request.contextPath}//"><i class="fa fa-circle-o text-red"></i> <span>调度中心</span></a></li>
67
+				<li class="nav-click" ><a href="${request.contextPath}/job/"><i class="fa fa-circle-o text-red"></i> <span>调度管理</span></a></li>
68
+				<li class="nav-click" ><a href="${request.contextPath}/joblog/"><i class="fa fa-circle-o text-yellow"></i><span>调度日志</span></a></li>
68 69
 				<li class="nav-click" ><a href="${request.contextPath}/help"><i class="fa fa-circle-o text-yellow"></i><span>使用教程</span></a></li>
69 70
 			</ul>
70 71
 		</section>

xxl-job-admin/src/main/webapp/WEB-INF/template/job/help.ftl → xxl-job-admin/src/main/webapp/WEB-INF/template/help.ftl Bestand weergeven


+ 3 - 3
xxl-job-admin/src/main/webapp/WEB-INF/template/job/index.ftl Bestand weergeven

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

+ 89 - 0
xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/index.ftl Bestand weergeven

@@ -0,0 +1,89 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+  	<title>调度日志</title>
5
+  	<#import "/common/common.macro.ftl" as netCommon>
6
+	<@netCommon.commonStyle />
7
+	<!-- DataTables -->
8
+  	<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
9
+  
10
+	<!-- DataTables CSS -->
11
+	<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.css">
12
+	<!-- jQuery -->
13
+	<script type="text/javascript" charset="utf8" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
14
+	<!-- DataTables -->
15
+	<script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/1.10.7/js/jquery.dataTables.js"></script>
16
+  
17
+</head>
18
+<body class="hold-transition skin-blue sidebar-mini">
19
+<div class="wrapper">
20
+	<!-- header -->
21
+	<@netCommon.commonHeader />
22
+	<!-- left -->
23
+	<@netCommon.commonLeft />
24
+	
25
+	<!-- Content Wrapper. Contains page content -->
26
+	<div class="content-wrapper">
27
+		<!-- Content Header (Page header) -->
28
+		<section class="content-header">
29
+			<h1>调度日志<small>调度中心</small></h1>
30
+			<ol class="breadcrumb">
31
+				<li><a><i class="fa fa-dashboard"></i>调度日志</a></li>
32
+				<li class="active">调度管理</li>
33
+			</ol>
34
+		</section>
35
+		
36
+		<!-- Main content -->
37
+	    <section class="content">
38
+			<div class="row">
39
+				<div class="col-xs-12">
40
+					<div class="box">
41
+			            <div class="box-header">
42
+			            	<h3 class="box-title">调度列表</h3>
43
+			            </div>
44
+			            <div class="box-body">
45
+			              	<table id="joblog_list" class="table table-bordered table-striped display">
46
+				                <thead>
47
+					            	<tr>
48
+					                	<th>id</th>
49
+					                  	<th>jobName</th>
50
+					                  	<th>jobCron</th>
51
+					                  	<th>jobClass</th>
52
+					                  	<th>handleTime</th>
53
+					                  	<th>handleStatus</th>
54
+					                </tr>
55
+				                </thead>
56
+				                <tbody></tbody>
57
+				                <tfoot>
58
+					            	<tr>
59
+					                  	<th>id</th>
60
+					                  	<th>jobName</th>
61
+					                  	<th>jobCron</th>
62
+					                  	<th>jobClass</th>
63
+					                  	<th>handleTime</th>
64
+					                  	<th>handleStatus</th>
65
+					                </tr>
66
+				                </tfoot>
67
+							</table>
68
+						</div>
69
+					</div>
70
+				</div>
71
+			</div>
72
+	    </section>
73
+	</div>
74
+	
75
+	<!-- footer -->
76
+	<@netCommon.commonFooter />
77
+	<!-- control -->
78
+	<@netCommon.commonControl />
79
+</div>
80
+
81
+<@netCommon.commonScript />
82
+<@netCommon.comAlert />
83
+<!-- DataTables -->
84
+<script src="${request.contextPath}/static/adminlte/plugins/datatables/jquery.dataTables.min.js"></script>
85
+<script src="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.min.js"></script>
86
+<script>var base_url = '${request.contextPath}';</script>
87
+<script src="${request.contextPath}/static/js/joblog.index.1.js"></script>
88
+</body>
89
+</html>

+ 44 - 0
xxl-job-admin/src/main/webapp/static/js/joblog.index.1.js Bestand weergeven

@@ -0,0 +1,44 @@
1
+$(function() {
2
+	// init date tables
3
+	$("#joblog_list").dataTable({
4
+		"serverSide": true,
5
+		"ajax": {
6
+	        url: base_url + "/joblog/pageList"
7
+	    },
8
+	    "processing" : true, 
9
+	    "deferRender": true,
10
+	    "columns": [
11
+	                { "data": 'id', "bSortable": false, "visible" : true},
12
+	                { "data": 'jobName', "bSortable": false},
13
+	                { "data": 'jobCron', "bSortable": false},
14
+	                { "data": 'jobClass', "bSortable": false},
15
+	                { "data": 'handleTime',"bSortable": false},
16
+	                { "data": 'handleStatus' , "bSortable": false}
17
+	            ],
18
+		"language" : {
19
+			"sProcessing" : "处理中...",
20
+			"sLengthMenu" : "每页 _MENU_ 条记录",
21
+			"sZeroRecords" : "没有匹配结果",
22
+			"sInfo" : "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
23
+			"sInfoEmpty" : "无记录",
24
+			"sInfoFiltered" : "(由 _MAX_ 项结果过滤)",
25
+			"sInfoPostFix" : "",
26
+			"sSearch" : "搜索:",
27
+			"sUrl" : "",
28
+			"sEmptyTable" : "表中数据为空",
29
+			"sLoadingRecords" : "载入中...",
30
+			"sInfoThousands" : ",",
31
+			"oPaginate" : {
32
+				"sFirst" : "首页",
33
+				"sPrevious" : "上页",
34
+				"sNext" : "下页",
35
+				"sLast" : "末页"
36
+			},
37
+			"oAria" : {
38
+				"sSortAscending" : ": 以升序排列此列",
39
+				"sSortDescending" : ": 以降序排列此列"
40
+			}
41
+		}
42
+	});
43
+	
44
+});