From 670f71e55759d665f73c571d7c9242f31a158fe0 Mon Sep 17 00:00:00 2001 From: "xueli.xue" Date: Mon, 28 Dec 2015 23:27:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E5=BA=A6=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xxl/job/controller/IndexController.java | 13 +-- .../com/xxl/job/controller/JobController.java | 9 ++ .../xxl/job/controller/JobLogController.java | 31 +++++++ .../job/core/model/mapper/XxlJobLogMapper.xml | 1 + .../WEB-INF/template/common/common.macro.ftl | 3 +- .../WEB-INF/template/{job => }/help.ftl | 0 .../webapp/WEB-INF/template/job/index.ftl | 6 +- .../webapp/WEB-INF/template/joblog/index.ftl | 89 +++++++++++++++++++ .../main/webapp/static/js/joblog.index.1.js | 44 +++++++++ 9 files changed, 182 insertions(+), 14 deletions(-) rename xxl-job-admin/src/main/webapp/WEB-INF/template/{job => }/help.ftl (100%) create mode 100644 xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/index.ftl create mode 100644 xxl-job-admin/src/main/webapp/static/js/joblog.index.1.js diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java b/xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java index 5523d54f..caffe293 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java @@ -1,14 +1,9 @@ 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> 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"; } } diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/JobController.java b/xxl-job-admin/src/main/java/com/xxl/job/controller/JobController.java index 3866ebb2..daa227c7 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/JobController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/controller/JobController.java @@ -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> jobList = DynamicSchedulerUtil.getJobList(); + model.addAttribute("jobList", jobList); + return "job/index"; + } + @RequestMapping("/add") @ResponseBody public ReturnT add(HttpServletRequest request) { diff --git a/xxl-job-admin/src/main/java/com/xxl/job/controller/JobLogController.java b/xxl-job-admin/src/main/java/com/xxl/job/controller/JobLogController.java index 8110bcbe..d82c3ab3 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/controller/JobLogController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/controller/JobLogController.java @@ -1,11 +1,16 @@ 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 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 list = xxlJobLogDao.pageList(start, length, jobName); + int list_count = xxlJobLogDao.pageListCount(start, length, jobName); + + Map maps = new HashMap(); + maps.put("draw", list_count); // 请求次数 + maps.put("recordsTotal", list_count); // 总记录数 + maps.put("recordsFiltered", list_count);// 过滤后的总记录数 + maps.put("data", list); // 分页列表 + return maps; + } + } diff --git a/xxl-job-admin/src/main/java/com/xxl/job/core/model/mapper/XxlJobLogMapper.xml b/xxl-job-admin/src/main/java/com/xxl/job/core/model/mapper/XxlJobLogMapper.xml index 283d68c3..7ce76785 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/core/model/mapper/XxlJobLogMapper.xml +++ b/xxl-job-admin/src/main/java/com/xxl/job/core/model/mapper/XxlJobLogMapper.xml @@ -81,6 +81,7 @@ WHERE t.job_name = #{jobName} + ORDER BY id DESC LIMIT #{offset}, #{pagesize} diff --git a/xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.macro.ftl b/xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.macro.ftl index bf6f235f..0876507a 100644 --- a/xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.macro.ftl +++ b/xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.macro.ftl @@ -64,7 +64,8 @@ diff --git a/xxl-job-admin/src/main/webapp/WEB-INF/template/job/help.ftl b/xxl-job-admin/src/main/webapp/WEB-INF/template/help.ftl similarity index 100% rename from xxl-job-admin/src/main/webapp/WEB-INF/template/job/help.ftl rename to xxl-job-admin/src/main/webapp/WEB-INF/template/help.ftl diff --git a/xxl-job-admin/src/main/webapp/WEB-INF/template/job/index.ftl b/xxl-job-admin/src/main/webapp/WEB-INF/template/job/index.ftl index 62c41fb5..456045fc 100644 --- a/xxl-job-admin/src/main/webapp/WEB-INF/template/job/index.ftl +++ b/xxl-job-admin/src/main/webapp/WEB-INF/template/job/index.ftl @@ -19,10 +19,10 @@
-

调度中心调度管理

+

调度管理调度中心

diff --git a/xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/index.ftl b/xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/index.ftl new file mode 100644 index 00000000..c7e1ace6 --- /dev/null +++ b/xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/index.ftl @@ -0,0 +1,89 @@ + + + + 调度日志 + <#import "/common/common.macro.ftl" as netCommon> + <@netCommon.commonStyle /> + + + + + + + + + + + + +
+ + <@netCommon.commonHeader /> + + <@netCommon.commonLeft /> + + +
+ +
+

调度日志调度中心

+ +
+ + +
+
+
+
+
+

调度列表

+
+
+ + + + + + + + + + + + + + + + + + + + + + +
idjobNamejobCronjobClasshandleTimehandleStatus
idjobNamejobCronjobClasshandleTimehandleStatus
+
+
+
+
+
+
+ + + <@netCommon.commonFooter /> + + <@netCommon.commonControl /> +
+ +<@netCommon.commonScript /> +<@netCommon.comAlert /> + + + + + + + diff --git a/xxl-job-admin/src/main/webapp/static/js/joblog.index.1.js b/xxl-job-admin/src/main/webapp/static/js/joblog.index.1.js new file mode 100644 index 00000000..efa4f0d2 --- /dev/null +++ b/xxl-job-admin/src/main/webapp/static/js/joblog.index.1.js @@ -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" : ": 以降序排列此列" + } + } + }); + +});