Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
熊鹏飞
/
xxljob220
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6574d7f9
authored
Apr 25, 2017
by
xueli.xue
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调度报表
parent
3f7b4d4a
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
23 deletions
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobLogDao.java
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogDaoImpl.java
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml
xxl-job-admin/src/main/webapp/WEB-INF/template/index.ftl
xxl-job-admin/src/main/webapp/static/js/index.js
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java
View file @
6574d7f9
...
@@ -37,6 +37,7 @@ public class IndexController {
...
@@ -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
;
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobLogDao.java
View file @
6574d7f9
...
@@ -27,6 +27,6 @@ public interface IXxlJobLogDao {
...
@@ -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
);
}
}
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogDaoImpl.java
View file @
6574d7f9
...
@@ -84,11 +84,12 @@ public class XxlJobLogDaoImpl implements IXxlJobLogDao {
...
@@ -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
);
}
}
}
}
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
View file @
6574d7f9
...
@@ -297,9 +297,48 @@ public class XxlJobServiceImpl implements IXxlJobService {
...
@@ -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
);
}
}
}
}
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml
View file @
6574d7f9
...
@@ -128,8 +128,7 @@
...
@@ -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 @@
...
@@ -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>
...
...
xxl-job-admin/src/main/webapp/WEB-INF/template/index.ftl
View file @
6574d7f9
...
@@ -49,7 +49,7 @@
...
@@ -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 @@
...
@@ -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"
>
...
...
xxl-job-admin/src/main/webapp/static/js/index.js
View file @
6574d7f9
...
@@ -5,11 +5,30 @@
...
@@ -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 () {
...
@@ -73,15 +92,16 @@ $(function () {
],
],
color
:[
'#00A65A'
,
'#F39C12'
]
color
:[
'#00A65A'
,
'#F39C12'
]
};
};
return
option
;
}
// pie chart
var
lineChart
=
echarts
.
init
(
document
.
getElementById
(
'lineChart'
));
var
pieChart
=
echarts
.
init
(
document
.
getElementById
(
'pieChart'
)
);
lineChart
.
setOption
(
option
);
pieChart
.
setOption
(
pieChartDate
());
}
function
pieChartDate
()
{
/**
option
=
{
* 饼图
*/
function
pieChartInit
(
data
)
{
var
option
=
{
title
:
{
title
:
{
text
:
'调度总次数'
,
text
:
'调度总次数'
,
/*subtext: 'subtext',*/
/*subtext: 'subtext',*/
...
@@ -103,8 +123,14 @@ $(function () {
...
@@ -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 () {
...
@@ -117,7 +143,8 @@ $(function () {
],
],
color
:[
'#00A65A'
,
'#F39C12'
]
color
:[
'#00A65A'
,
'#F39C12'
]
};
};
return
option
;
var
pieChart
=
echarts
.
init
(
document
.
getElementById
(
'pieChart'
));
pieChart
.
setOption
(
option
);
}
}
// 过滤时间
// 过滤时间
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment