调度报表
This commit is contained in:
parent
3f7b4d4ae9
commit
6574d7f9de
|
@ -37,6 +37,7 @@ public class IndexController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/triggerChartDate")
|
@RequestMapping("/triggerChartDate")
|
||||||
|
@ResponseBody
|
||||||
public ReturnT<Map<String, Object>> triggerChartDate() {
|
public ReturnT<Map<String, Object>> triggerChartDate() {
|
||||||
ReturnT<Map<String, Object>> triggerChartDate = xxlJobService.triggerChartDate();
|
ReturnT<Map<String, Object>> triggerChartDate = xxlJobService.triggerChartDate();
|
||||||
return triggerChartDate;
|
return triggerChartDate;
|
||||||
|
|
|
@ -27,6 +27,6 @@ public interface IXxlJobLogDao {
|
||||||
|
|
||||||
public int triggerCountByHandleCode(int handleCode);
|
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
|
@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>();
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("from", from);
|
params.put("from", from);
|
||||||
params.put("to", to);
|
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 from = DateUtils.addDays(new Date(), -30);
|
||||||
Date to = new Date();
|
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)
|
SELECT count(1)
|
||||||
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
|
||||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||||
<if test="_parameter
|
<if test="_parameter gt 0">
|
||||||
gt 0">
|
|
||||||
AND t.handle_code = #{handleCode}
|
AND t.handle_code = #{handleCode}
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
|
@ -138,6 +137,10 @@
|
||||||
<select id="triggerCountByDay" parameterType="java.util.Map" resultType="java.util.Map" >
|
<select id="triggerCountByDay" parameterType="java.util.Map" resultType="java.util.Map" >
|
||||||
SELECT DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay, COUNT(id) triggerCount
|
SELECT DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay, COUNT(id) triggerCount
|
||||||
FROM XXL_JOB_QRTZ_TRIGGER_LOG
|
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;
|
GROUP BY triggerDay;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
</div>
|
</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">
|
<div class="info-box bg-yellow">
|
||||||
<span class="info-box-icon"><i class="fa fa-calendar"></i></span>
|
<span class="info-box-icon"><i class="fa fa-calendar"></i></span>
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
<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 >-->
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
|
|
|
@ -5,11 +5,30 @@
|
||||||
|
|
||||||
$(function () {
|
$(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 = {
|
var option = {
|
||||||
title: {
|
title: {
|
||||||
text: '日期分布图'
|
text: '日期分布图'
|
||||||
|
@ -73,15 +92,16 @@ $(function () {
|
||||||
],
|
],
|
||||||
color:['#00A65A', '#F39C12']
|
color:['#00A65A', '#F39C12']
|
||||||
};
|
};
|
||||||
return option;
|
|
||||||
|
var lineChart = echarts.init(document.getElementById('lineChart'));
|
||||||
|
lineChart.setOption(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pie chart
|
/**
|
||||||
var pieChart = echarts.init(document.getElementById('pieChart'));
|
* 饼图
|
||||||
pieChart.setOption(pieChartDate());
|
*/
|
||||||
|
function pieChartInit(data) {
|
||||||
function pieChartDate() {
|
var option = {
|
||||||
option = {
|
|
||||||
title : {
|
title : {
|
||||||
text: '调度总次数',
|
text: '调度总次数',
|
||||||
/*subtext: 'subtext',*/
|
/*subtext: 'subtext',*/
|
||||||
|
@ -103,8 +123,14 @@ $(function () {
|
||||||
radius : '55%',
|
radius : '55%',
|
||||||
center: ['50%', '60%'],
|
center: ['50%', '60%'],
|
||||||
data:[
|
data:[
|
||||||
{value:800, name:'成功调度次数'},
|
{
|
||||||
{value:200, name:'失败调度次数'}
|
value:data.content.triggerCountSucTotal,
|
||||||
|
name:'成功调度次数'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value:data.content.triggerCountFailTotal,
|
||||||
|
name:'失败调度次数'
|
||||||
|
}
|
||||||
],
|
],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
emphasis: {
|
emphasis: {
|
||||||
|
@ -117,7 +143,8 @@ $(function () {
|
||||||
],
|
],
|
||||||
color:['#00A65A', '#F39C12']
|
color:['#00A65A', '#F39C12']
|
||||||
};
|
};
|
||||||
return option;
|
var pieChart = echarts.init(document.getElementById('pieChart'));
|
||||||
|
pieChart.setOption(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 过滤时间
|
// 过滤时间
|
||||||
|
|
Loading…
Reference in New Issue