调度报表

v1.6
xueli.xue 8 years ago
parent 6e3e24a909
commit 3f7b4d4ae9

@ -35,6 +35,12 @@ public class IndexController {
return "index";
}
@RequestMapping("/triggerChartDate")
public ReturnT<Map<String, Object>> triggerChartDate() {
ReturnT<Map<String, Object>> triggerChartDate = xxlJobService.triggerChartDate();
return triggerChartDate;
}
@RequestMapping("/toLogin")
@PermessionLimit(limit=false)

@ -4,6 +4,7 @@ import com.xxl.job.admin.core.model.XxlJobLog;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* job log
@ -24,6 +25,8 @@ public interface IXxlJobLogDao {
public int delete(int jobId);
public int findByHandleCodeCount(int handleCode);
public int triggerCountByHandleCode(int handleCode);
Map<String,Integer> triggerCountByDay(Date from, Date to);
}

@ -9,6 +9,7 @@ import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* job log
@ -78,8 +79,16 @@ public class XxlJobLogDaoImpl implements IXxlJobLogDao {
}
@Override
public int findByHandleCodeCount(int handleCode) {
return sqlSessionTemplate.selectOne("XxlJobLogMapper.findByHandleCodeCount", handleCode);
public int triggerCountByHandleCode(int handleCode) {
return sqlSessionTemplate.selectOne("XxlJobLogMapper.triggerCountByHandleCode", handleCode);
}
@Override
public Map<String, Integer> triggerCountByDay(Date from, Date to) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("from", from);
params.put("to", to);
return sqlSessionTemplate.selectOne("XxlJobLogMapper.triggerCountByDay", params);
}
}

@ -27,5 +27,8 @@ public interface IXxlJobService {
public ReturnT<String> triggerJob(int id);
Map<String,Object> dashboardInfo();
public Map<String,Object> dashboardInfo();
public ReturnT<Map<String,Object>> triggerChartDate();
}

@ -11,6 +11,7 @@ import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.registry.RegistHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.quartz.CronExpression;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
@ -260,8 +261,8 @@ public class XxlJobServiceImpl implements IXxlJobService {
public Map<String, Object> dashboardInfo() {
int jobInfoCount = xxlJobInfoDao.findAllCount();
int jobLogCount = xxlJobLogDao.findByHandleCodeCount(-1);
int jobLogSuccessCount = xxlJobLogDao.findByHandleCodeCount(ReturnT.SUCCESS_CODE);
int jobLogCount = xxlJobLogDao.triggerCountByHandleCode(-1);
int jobLogSuccessCount = xxlJobLogDao.triggerCountByHandleCode(ReturnT.SUCCESS_CODE);
// executor count
Set<String> executerAddressSet = new HashSet<String>();
@ -291,4 +292,14 @@ public class XxlJobServiceImpl implements IXxlJobService {
return dashboardMap;
}
@Override
public ReturnT<Map<String, Object>> triggerChartDate() {
Date from = DateUtils.addDays(new Date(), -30);
Date to = new Date();
Map<String, Integer> triggerCountMap = xxlJobLogDao.triggerCountByDay(from, to);
return null;
}
}

@ -124,14 +124,21 @@
WHERE job_id = #{jobId}
</delete>
<select id="findByHandleCodeCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
<select id="triggerCountByHandleCode" parameterType="java.lang.Integer" resultType="java.lang.Integer">
SELECT count(1)
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="_parameter gt 0">
<if test="_parameter
gt 0">
AND t.handle_code = #{handleCode}
</if>
</trim>
</select>
<select id="triggerCountByDay" parameterType="java.util.Map" resultType="java.util.Map" >
SELECT DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay, COUNT(id) triggerCount
FROM XXL_JOB_QRTZ_TRIGGER_LOG
GROUP BY triggerDay;
</select>
</mapper>

@ -16,7 +16,7 @@
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1><small></small></h1>
<h1><small></small></h1>
<!--
<ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i></a></li>
@ -28,7 +28,7 @@
<!-- Main content -->
<section class="content">
<!-- -->
<!-- -->
<div class="row">
<#-- -->
@ -49,7 +49,7 @@
</div>
<#-- -->
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="col-md-4 col-sm-6 col-xs-12" style="display: none;">
<div class="info-box bg-yellow">
<span class="info-box-icon"><i class="fa fa-calendar"></i></span>
@ -70,7 +70,7 @@
<#-- -->
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="info-box bg-green">
<span class="info-box-icon"><i class="fa fa-thumbs-o-up"></i></span>
<span class="info-box-icon"><i class="fa ion-ios-settings-strong"></i></span>
<div class="info-box-content">
<span class="info-box-text"></span>
@ -85,7 +85,31 @@
</div>
</div>
<!-- /.row -->
<#-- 线 + -->
<div class="row">
<div class="col-md-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"></h3>
<#--<input type="text" class="form-control" id="filterTime" readonly >-->
</div>
<div class="box-body">
<div class="row">
<#-- 线 -->
<div class="col-md-8">
<div id="lineChart" style="height: 350px;"></div>
</div>
<#-- -->
<div class="col-md-4">
<div id="pieChart" style="height: 350px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- /.content -->
@ -96,5 +120,10 @@
<@netCommon.commonFooter />
</div>
<@netCommon.commonScript />
<#--<script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/moment.min.js"></script>
<script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.js"></script>-->
<script src="${request.contextPath}/static/plugins/echarts/echarts.common.min.js"></script>
<script src="${request.contextPath}/static/js/index.js"></script>
</body>
</html>

@ -0,0 +1,157 @@
/**
* Created by xuxueli on 17/4/24.
*/
$(function () {
// lineChart
var lineChart = echarts.init(document.getElementById('lineChart'));
lineChart.setOption(lineChartDate());
function lineChartDate() {
var option = {
title: {
text: ''
},
tooltip : {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data:['','']
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'category',
boundaryGap : false,
data : ['2017-10-01','2017-10-02','2017-10-03','2017-10-04','2017-10-05','2017-10-06','2017-10-07']
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
name:'',
type:'line',
stack: '',
areaStyle: {normal: {}},
data:[820, 932, 901, 934, 1290, 1330, 1320]
},
{
name:'',
type:'line',
stack: '',
label: {
normal: {
show: true,
position: 'top'
}
},
areaStyle: {normal: {}},
data:[120, 132, 101, 134, 90, 230, 210]
}
],
color:['#00A65A', '#F39C12']
};
return option;
}
// pie chart
var pieChart = echarts.init(document.getElementById('pieChart'));
pieChart.setOption(pieChartDate());
function pieChartDate() {
option = {
title : {
text: '',
/*subtext: 'subtext',*/
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: 'vertical',
left: 'left',
data: ['','']
},
series : [
{
name: '访',
type: 'pie',
radius : '55%',
center: ['50%', '60%'],
data:[
{value:800, name:''},
{value:200, name:''}
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
],
color:['#00A65A', '#F39C12']
};
return 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')
}
});*/
});

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save