调度报表

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

@ -37,6 +37,7 @@ public class IndexController {
}
@RequestMapping("/triggerChartDate")
@ResponseBody
public ReturnT<Map<String, Object>> triggerChartDate() {
ReturnT<Map<String, Object>> triggerChartDate = xxlJobService.triggerChartDate();
return triggerChartDate;

@ -27,6 +27,6 @@ public interface IXxlJobLogDao {
public int triggerCountByHandleCode(int handleCode);
Map<String,Integer> triggerCountByDay(Date from, Date to);
public List<Map<String, Object>> triggerCountByDay(Date from, Date to, int handleCode);
}

@ -84,11 +84,12 @@ public class XxlJobLogDaoImpl implements IXxlJobLogDao {
}
@Override
public Map<String, Integer> triggerCountByDay(Date from, Date to) {
public List<Map<String, Object>> triggerCountByDay(Date from, Date to, int handleCode) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("from", from);
params.put("to", to);
return sqlSessionTemplate.selectOne("XxlJobLogMapper.triggerCountByDay", params);
params.put("handleCode", handleCode);
return sqlSessionTemplate.selectList("XxlJobLogMapper.triggerCountByDay", params);
}
}

@ -297,9 +297,48 @@ public class XxlJobServiceImpl implements IXxlJobService {
Date from = DateUtils.addDays(new Date(), -30);
Date to = new Date();
Map<String, Integer> triggerCountMap = xxlJobLogDao.triggerCountByDay(from, to);
List<String> triggerDayList = new ArrayList<String>();
List<Integer> triggerDayCountSucList = new ArrayList<Integer>();
List<Integer> triggerDayCountFailList = new ArrayList<Integer>();
int triggerCountSucTotal = 0;
int triggerCountFailTotal = 0;
return null;
List<Map<String, Object>> triggerCountMapAll = xxlJobLogDao.triggerCountByDay(from, to, -1);
List<Map<String, Object>> triggerCountMapSuc = xxlJobLogDao.triggerCountByDay(from, to, ReturnT.SUCCESS_CODE);
if (CollectionUtils.isNotEmpty(triggerCountMapAll)) {
for (Map<String, Object> item: triggerCountMapAll) {
String day = String.valueOf(item.get("triggerDay"));
int dayAllCount = Integer.valueOf(String.valueOf(item.get("triggerCount")));
int daySucCount = 0;
int dayFailCount = dayAllCount - daySucCount;
if (CollectionUtils.isNotEmpty(triggerCountMapSuc)) {
for (Map<String, Object> sucItem: triggerCountMapSuc) {
String daySuc = String.valueOf(sucItem.get("triggerDay"));
if (day.equals(daySuc)) {
daySucCount = Integer.valueOf(String.valueOf(sucItem.get("triggerCount")));
dayFailCount = dayAllCount - daySucCount;
}
}
}
triggerDayList.add(day);
triggerDayCountSucList.add(daySucCount);
triggerDayCountFailList.add(dayFailCount);
triggerCountSucTotal += daySucCount;
triggerCountFailTotal += dayFailCount;
}
} else {
return new ReturnT<Map<String, Object>>(ReturnT.FAIL_CODE, null);
}
Map<String, Object> result = new HashMap<String, Object>();
result.put("triggerDayList", triggerDayList);
result.put("triggerDayCountSucList", triggerDayCountSucList);
result.put("triggerDayCountFailList", triggerDayCountFailList);
result.put("triggerCountSucTotal", triggerCountSucTotal);
result.put("triggerCountFailTotal", triggerCountFailTotal);
return new ReturnT<Map<String, Object>>(result);
}
}

@ -128,8 +128,7 @@
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>
@ -138,6 +137,10 @@
<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
WHERE trigger_time BETWEEN #{from} and #{to}
<if test="handleCode gt 0">
AND handle_code = #{handleCode}
</if>
GROUP BY triggerDay;
</select>

@ -49,7 +49,7 @@
</div>
<#-- -->
<div class="col-md-4 col-sm-6 col-xs-12" style="display: none;">
<div class="col-md-4 col-sm-6 col-xs-12" >
<div class="info-box bg-yellow">
<span class="info-box-icon"><i class="fa fa-calendar"></i></span>
@ -91,7 +91,7 @@
<div class="col-md-12">
<div class="box">
<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 >-->
</div>
<div class="box-body">

@ -5,11 +5,30 @@
$(function () {
// lineChart
var lineChart = echarts.init(document.getElementById('lineChart'));
lineChart.setOption(lineChartDate());
/**
*
*/
$.ajax({
type : 'POST',
url : base_url + '/triggerChartDate',
data : { },
dataType : "json",
success : function(data){
if (data.code == 200) {
lineChartInit(data)
pieChartInit(data);
} else {
ComAlert.show(2, data.msg || '' );
}
}
});
function lineChartDate() {
/**
* 线
*/
function lineChartInit(data) {
var option = {
title: {
text: ''
@ -73,15 +92,16 @@ $(function () {
],
color:['#00A65A', '#F39C12']
};
return option;
}
// pie chart
var pieChart = echarts.init(document.getElementById('pieChart'));
pieChart.setOption(pieChartDate());
var lineChart = echarts.init(document.getElementById('lineChart'));
lineChart.setOption(option);
}
function pieChartDate() {
option = {
/**
*
*/
function pieChartInit(data) {
var option = {
title : {
text: '',
/*subtext: 'subtext',*/
@ -103,8 +123,14 @@ $(function () {
radius : '55%',
center: ['50%', '60%'],
data:[
{value:800, name:''},
{value:200, name:''}
{
value:data.content.triggerCountSucTotal,
name:''
},
{
value:data.content.triggerCountFailTotal,
name:''
}
],
itemStyle: {
emphasis: {
@ -117,7 +143,8 @@ $(function () {
],
color:['#00A65A', '#F39C12']
};
return option;
var pieChart = echarts.init(document.getElementById('pieChart'));
pieChart.setOption(option);
}
// 过滤时间

Loading…
Cancel
Save