提交 0e1ef7f3 authored 作者: xuxueli's avatar xuxueli

调度报表优化,支持时间区间筛选;

上级 9e97ae2f
...@@ -1057,6 +1057,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段 ...@@ -1057,6 +1057,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 9、任务注解调整为 “@JobHandler”,与任务注解统一; - 9、任务注解调整为 “@JobHandler”,与任务注解统一;
- 10、执行器端口支持随机生成(小于等于0时),避免端口定义冲突; - 10、执行器端口支持随机生成(小于等于0时),避免端口定义冲突;
- 11、任务Cron长度扩展支持至128位; - 11、任务Cron长度扩展支持至128位;
- 12、调度报表优化,支持时间区间筛选;
### TODO LIST ### TODO LIST
- 1、任务权限管理:执行器为粒度分配权限,核心操作校验权限; - 1、任务权限管理:执行器为粒度分配权限,核心操作校验权限;
...@@ -1075,11 +1076,10 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段 ...@@ -1075,11 +1076,10 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 14、脚本任务 Shell、Python和Nodejs,如何友好获取分片参数; - 14、脚本任务 Shell、Python和Nodejs,如何友好获取分片参数;
- 15、Bean模式任务,JobHandler自动从执行器中查询展示为下拉框,选择后自动填充任务名称等属性; - 15、Bean模式任务,JobHandler自动从执行器中查询展示为下拉框,选择后自动填充任务名称等属性;
- 16、任务告警邮件优化,调整为表格形式; - 16、任务告警邮件优化,调整为表格形式;
- 17、任务报表,支持时间筛选; - 17、JobHandler提供 init/destroy 方法,支持自定义任务线程销毁逻辑;
- 18、JobHandler提供 init/destroy 方法,支持自定义任务线程销毁逻辑; - 18、cron表达式的最大长度调整,兼容复杂类型cron;
- 19、cron表达式的最大长度调整,兼容复杂类型cron; - 19、执行器回调地址/日志地址格式兼容,是否已"/"结尾均支持;
- 20、执行器回调地址/日志地址格式兼容,是否已"/"结尾均支持; - 20、任务单机多线程:提升任务单机并行处理能力;
- 21、任务单机多线程:提升任务单机并行处理能力;
## 七、其他 ## 七、其他
......
...@@ -6,8 +6,11 @@ import com.xxl.job.admin.core.util.PropertiesUtil; ...@@ -6,8 +6,11 @@ import com.xxl.job.admin.core.util.PropertiesUtil;
import com.xxl.job.admin.service.XxlJobService; import com.xxl.job.admin.service.XxlJobService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.propertyeditors.CustomDateEditor;
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.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -15,6 +18,8 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -15,6 +18,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map; import java.util.Map;
/** /**
...@@ -38,8 +43,8 @@ public class IndexController { ...@@ -38,8 +43,8 @@ public class IndexController {
@RequestMapping("/triggerChartDate") @RequestMapping("/triggerChartDate")
@ResponseBody @ResponseBody
public ReturnT<Map<String, Object>> triggerChartDate() { public ReturnT<Map<String, Object>> triggerChartDate(Date startDate, Date endDate) {
ReturnT<Map<String, Object>> triggerChartDate = xxlJobService.triggerChartDate(); ReturnT<Map<String, Object>> triggerChartDate = xxlJobService.triggerChartDate(startDate, endDate);
return triggerChartDate; return triggerChartDate;
} }
...@@ -91,5 +96,12 @@ public class IndexController { ...@@ -91,5 +96,12 @@ public class IndexController {
return "help"; return "help";
} }
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
} }
...@@ -4,6 +4,7 @@ package com.xxl.job.admin.service; ...@@ -4,6 +4,7 @@ package com.xxl.job.admin.service;
import com.xxl.job.admin.core.model.XxlJobInfo; import com.xxl.job.admin.core.model.XxlJobInfo;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import java.util.Date;
import java.util.Map; import java.util.Map;
/** /**
...@@ -29,6 +30,6 @@ public interface XxlJobService { ...@@ -29,6 +30,6 @@ public interface XxlJobService {
public Map<String,Object> dashboardInfo(); public Map<String,Object> dashboardInfo();
public ReturnT<Map<String,Object>> triggerChartDate(); public ReturnT<Map<String,Object>> triggerChartDate(Date startDate, Date endDate);
} }
...@@ -310,18 +310,15 @@ public class XxlJobServiceImpl implements XxlJobService { ...@@ -310,18 +310,15 @@ public class XxlJobServiceImpl implements XxlJobService {
} }
@Override @Override
public ReturnT<Map<String, Object>> triggerChartDate() { public ReturnT<Map<String, Object>> triggerChartDate(Date startDate, Date endDate) {
Date from = DateUtils.addDays(new Date(), -30);
Date to = new Date();
List<String> triggerDayList = new ArrayList<String>(); List<String> triggerDayList = new ArrayList<String>();
List<Integer> triggerDayCountSucList = new ArrayList<Integer>(); List<Integer> triggerDayCountSucList = new ArrayList<Integer>();
List<Integer> triggerDayCountFailList = new ArrayList<Integer>(); List<Integer> triggerDayCountFailList = new ArrayList<Integer>();
int triggerCountSucTotal = 0; int triggerCountSucTotal = 0;
int triggerCountFailTotal = 0; int triggerCountFailTotal = 0;
List<Map<String, Object>> triggerCountMapAll = xxlJobLogDao.triggerCountByDay(from, to, -1); List<Map<String, Object>> triggerCountMapAll = xxlJobLogDao.triggerCountByDay(startDate, endDate, -1);
List<Map<String, Object>> triggerCountMapSuc = xxlJobLogDao.triggerCountByDay(from, to, ReturnT.SUCCESS_CODE); List<Map<String, Object>> triggerCountMapSuc = xxlJobLogDao.triggerCountByDay(startDate, endDate, ReturnT.SUCCESS_CODE);
if (CollectionUtils.isNotEmpty(triggerCountMapAll)) { if (CollectionUtils.isNotEmpty(triggerCountMapAll)) {
for (Map<String, Object> item: triggerCountMapAll) { for (Map<String, Object> item: triggerCountMapAll) {
String day = String.valueOf(item.get("triggerDay")); String day = String.valueOf(item.get("triggerDay"));
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
<title>任务调度中心</title> <title>任务调度中心</title>
<#import "/common/common.macro.ftl" as netCommon> <#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle /> <@netCommon.commonStyle />
<!-- daterangepicker -->
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.css">
</head> </head>
<body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> "> <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
<div class="wrapper"> <div class="wrapper">
...@@ -43,7 +45,7 @@ ...@@ -43,7 +45,7 @@
<div class="progress"> <div class="progress">
<div class="progress-bar" style="width: 100%"></div> <div class="progress-bar" style="width: 100%"></div>
</div> </div>
<span class="progress-description">系统中配置的任务数量</span> <span class="progress-description">调度中心运行的任务数量</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -82,7 +84,7 @@ ...@@ -82,7 +84,7 @@
<div class="progress"> <div class="progress">
<div class="progress-bar" style="width: 100%"></div> <div class="progress-bar" style="width: 100%"></div>
</div> </div>
<span class="progress-description">心跳检测成功的执行器机器数量</span> <span class="progress-description">调度中心注册发现的执行器机器数量</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -94,8 +96,20 @@ ...@@ -94,8 +96,20 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">调度报表(一月之内)</h3> <h3 class="box-title">调度报表</h3>
<#--<input type="text" class="form-control" id="filterTime" readonly >--> <#--<input type="text" class="form-control" id="filterTime" readonly >-->
<!-- tools box -->
<div class="pull-right box-tools">
<button type="button" class="btn btn-primary btn-sm daterange pull-right" data-toggle="tooltip" id="filterTime" >
<i class="fa fa-calendar"></i>
</button>
<#--<button type="button" class="btn btn-primary btn-sm pull-right" data-widget="collapse" data-toggle="tooltip" title="" style="margin-right: 5px;" data-original-title="Collapse">
<i class="fa fa-minus"></i>
</button>-->
</div>
<!-- /. tools -->
</div> </div>
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="row">
...@@ -113,7 +127,6 @@ ...@@ -113,7 +127,6 @@
</div> </div>
</div> </div>
</section> </section>
<!-- /.content --> <!-- /.content -->
</div> </div>
...@@ -123,10 +136,11 @@ ...@@ -123,10 +136,11 @@
<@netCommon.commonFooter /> <@netCommon.commonFooter />
</div> </div>
<@netCommon.commonScript /> <@netCommon.commonScript />
<#--<script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/moment.min.js"></script> <!-- daterangepicker -->
<script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.js"></script>--> <script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/moment.min.js"></script>
<script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.js"></script>
<#-- echarts -->
<script src="${request.contextPath}/static/plugins/echarts/echarts.common.min.js"></script> <script src="${request.contextPath}/static/plugins/echarts/echarts.common.min.js"></script>
<script src="${request.contextPath}/static/js/index.js"></script> <script src="${request.contextPath}/static/js/index.js"></script>
</body> </body>
</html> </html>
...@@ -5,29 +5,74 @@ ...@@ -5,29 +5,74 @@
$(function () { $(function () {
// 过滤时间
var _startDate = moment().subtract(1, 'months');
var _endDate = moment();
$('#filterTime').daterangepicker({
autoApply:false,
singleDatePicker:false,
showDropdowns:false, // 是否显示年月选择条件
timePicker: true, // 是否显示小时和分钟选择条件
timePickerIncrement: 10, // 时间的增量,单位为分钟
timePicker24Hour : true,
opens : 'left', //日期选择框的弹出位置
ranges: {
//'最近1小时': [moment().subtract(1, 'hours'), moment()],
'今日': [moment().startOf('day'), moment().endOf('day')],
'昨日': [moment().subtract(1, 'days').startOf('day'), moment().subtract(1, 'days').endOf('day')],
'最近7日': [moment().subtract(7, 'days'), moment()],
'最近30日': [moment().subtract(1, 'months'), moment()],
'本月': [moment().startOf('month'), moment().endOf('month')],
'上个月': [moment().subtract(1, 'months').startOf('month'), moment().subtract(1, 'months').endOf('month')]
},
locale : {
format: 'YYYY-MM-DD HH:mm:ss',
separator : ' - ',
customRangeLabel : '自定义',
applyLabel : '确定',
cancelLabel : '取消',
fromLabel : '起始时间',
toLabel : '结束时间',
daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月' ],
firstDay : 1
},
startDate:_startDate,
endDate: _endDate
}, function (start, end, label) {
freshChartDate(start, end);
});
freshChartDate(_startDate, _endDate);
/** /**
* 刷新报表
* *
* @param startDate
* @param endDate
*/ */
$.ajax({ function freshChartDate(startDate, endDate) {
type : 'POST', $.ajax({
url : base_url + '/triggerChartDate', type : 'POST',
data : { }, url : base_url + '/triggerChartDate',
dataType : "json", data : {
success : function(data){ 'startDate':startDate.format('YYYY-MM-DD HH:mm:ss'),
if (data.code == 200) { 'endDate':endDate.format('YYYY-MM-DD HH:mm:ss')
lineChartInit(data) },
pieChartInit(data); dataType : "json",
} else { success : function(data){
layer.open({ if (data.code == 200) {
title: '系统提示', lineChartInit(data)
content: (data.msg || '调度报表数据加载异常'), pieChartInit(data);
icon: '2' } else {
}); layer.open({
title: '系统提示',
content: (data.msg || '调度报表数据加载异常'),
icon: '2'
});
}
} }
} });
}); }
/** /**
* 折线图 * 折线图
...@@ -151,38 +196,4 @@ $(function () { ...@@ -151,38 +196,4 @@ $(function () {
pieChart.setOption(option); pieChart.setOption(option);
} }
// 过滤时间
/*$('#filterTime').daterangepicker({
autoApply:false,
singleDatePicker:false,
showDropdowns:false, // 是否显示年月选择条件
timePicker: true, // 是否显示小时和分钟选择条件
timePickerIncrement: 10, // 时间的增量,单位为分钟
timePicker24Hour : true,
opens : 'left', //日期选择框的弹出位置
ranges: {
'最近1小时': [moment().subtract(1, 'hours'), moment()],
'今日': [moment().startOf('day'), moment().endOf('day')],
'昨日': [moment().subtract(1, 'days').startOf('day'), moment().subtract(1, 'days').endOf('day')],
'最近7日': [moment().subtract(6, 'days'), moment()],
'最近30日': [moment().subtract(29, 'days'), moment()],
'本月': [moment().startOf('month'), moment().endOf('month')],
'上个月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
locale : {
format: 'YYYY-MM-DD HH:mm:ss',
separator : ' - ',
customRangeLabel : '自定义',
applyLabel : '确定',
cancelLabel : '取消',
fromLabel : '起始时间',
toLabel : '结束时间',
daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月' ],
firstDay : 1,
startDate: moment().startOf('day'),
endDate: moment().endOf('day')
}
});*/
}); });
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论