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

pull/4/head
xuxueli 7 years ago
parent 9e97ae2fdf
commit 0e1ef7f3ed

@ -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至稳定版本, 进入维护阶段
- 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;
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;
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 {
@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;
} }
@ -92,4 +97,11 @@ 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;
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 {
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 {
} }
@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 @@
<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 @@
<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 @@
<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 @@
<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 @@
</div> </div>
</div> </div>
</section> </section>
<!-- /.content --> <!-- /.content -->
</div> </div>
@ -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,13 +5,59 @@
$(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
*/ */
function freshChartDate(startDate, endDate) {
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
url : base_url + '/triggerChartDate', url : base_url + '/triggerChartDate',
data : { }, data : {
'startDate':startDate.format('YYYY-MM-DD HH:mm:ss'),
'endDate':endDate.format('YYYY-MM-DD HH:mm:ss')
},
dataType : "json", dataType : "json",
success : function(data){ success : function(data){
if (data.code == 200) { if (data.code == 200) {
@ -26,8 +72,7 @@ $(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')
}
});*/
}); });

Loading…
Cancel
Save