Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LFFZC
xxl-job
提交
5c1bba33
X
xxl-job
项目概览
LFFZC
/
xxl-job
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
xxl-job
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5c1bba33
编写于
5月 19, 2016
作者:
X
xueli.xue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
V1.3版本,阶段A:GLUE模式开关
上级
e6c239ec
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
143 addition
and
22 deletion
+143
-22
doc/db/tables_xxl_job.sql
doc/db/tables_xxl_job.sql
+15
-4
xxl-job-admin/src/main/java/com/xxl/job/controller/JobInfoController.java
...c/main/java/com/xxl/job/controller/JobInfoController.java
+8
-4
xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobInfo.java
...dmin/src/main/java/com/xxl/job/core/model/XxlJobInfo.java
+31
-2
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml
...in/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml
+20
-4
xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/index.ftl
...-admin/src/main/webapp/WEB-INF/template/jobinfo/index.ftl
+15
-2
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js
+2
-1
xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
+52
-5
未找到文件。
doc/db/tables_xxl_job.sql
浏览文件 @
5c1bba33
#
DROP
TABLE
IF
EXISTS
XXL_JOB_QRTZ_FIRED_TRIGGERS
;
#
DROP
TABLE
IF
EXISTS
XXL_JOB_QRTZ_PAUSED_TRIGGER_GRPS
;
#
DROP
TABLE
IF
EXISTS
XXL_JOB_QRTZ_SCHEDULER_STATE
;
#
DROP
TABLE
IF
EXISTS
XXL_JOB_QRTZ_LOCKS
;
CREATE
TABLE
XXL_JOB_QRTZ_JOB_DETAILS
(
...
...
@@ -160,6 +156,9 @@ CREATE TABLE `xxl_job_qrtz_trigger_info` (
`author`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'作者'
,
`alarm_email`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'报警邮件'
,
`alarm_threshold`
int
(
11
)
DEFAULT
NULL
COMMENT
'报警阀值(连续失败次数)'
,
`glue_switch`
int
(
11
)
DEFAULT
'0'
COMMENT
'GLUE模式开关:0-否,1-是'
,
`glue_source`
text
COMMENT
'GLUE源代码'
,
`glue_remark`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'GLUE备注'
,
PRIMARY
KEY
(
`id`
)
);
...
...
@@ -180,5 +179,17 @@ CREATE TABLE `xxl_job_qrtz_trigger_log` (
PRIMARY
KEY
(
`id`
)
);
CREATE
TABLE
`xxl_job_qrtz_trigger_logglue`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`job_group`
varchar
(
255
)
NOT
NULL
,
`job_name`
varchar
(
255
)
NOT
NULL
,
`glue_source`
text
,
`glue_remark`
varchar
(
128
)
NOT
NULL
,
`add_time`
timestamp
NULL
DEFAULT
NULL
,
`update_time`
timestamp
NULL
DEFAULT
NULL
ON
UPDATE
CURRENT_TIMESTAMP
,
PRIMARY
KEY
(
`id`
)
)
;
commit
;
xxl-job-admin/src/main/java/com/xxl/job/controller/JobInfoController.java
浏览文件 @
5c1bba33
...
...
@@ -70,7 +70,7 @@ public class JobInfoController {
@ResponseBody
public
ReturnT
<
String
>
add
(
String
jobGroup
,
String
jobName
,
String
jobCron
,
String
jobDesc
,
String
handler_address
,
String
handler_name
,
String
handler_params
,
String
author
,
String
alarmEmail
,
int
alarmThreshold
)
{
String
author
,
String
alarmEmail
,
int
alarmThreshold
,
int
glueSwitch
)
{
// valid
if
(
JobGroupEnum
.
match
(
jobGroup
)
==
null
)
{
...
...
@@ -88,7 +88,7 @@ public class JobInfoController {
if
(
StringUtils
.
isBlank
(
handler_address
))
{
return
new
ReturnT
<
String
>(
500
,
"请输入“机器地址”"
);
}
if
(
StringUtils
.
isBlank
(
handler_name
))
{
if
(
glueSwitch
==
0
&&
StringUtils
.
isBlank
(
handler_name
))
{
return
new
ReturnT
<
String
>(
500
,
"请输入“执行器”"
);
}
if
(
StringUtils
.
isBlank
(
author
))
{
...
...
@@ -127,6 +127,9 @@ public class JobInfoController {
jobInfo
.
setAuthor
(
author
);
jobInfo
.
setAlarmEmail
(
alarmEmail
);
jobInfo
.
setAlarmThreshold
(
alarmThreshold
);
jobInfo
.
setGlueSwitch
(
glueSwitch
);
jobInfo
.
setGlueSource
(
null
);
jobInfo
.
setGlueRemark
(
null
);
xxlJobInfoDao
.
save
(
jobInfo
);
try
{
...
...
@@ -148,7 +151,7 @@ public class JobInfoController {
@ResponseBody
public
ReturnT
<
String
>
reschedule
(
String
jobGroup
,
String
jobName
,
String
jobCron
,
String
jobDesc
,
String
handler_address
,
String
handler_name
,
String
handler_params
,
String
author
,
String
alarmEmail
,
int
alarmThreshold
)
{
String
author
,
String
alarmEmail
,
int
alarmThreshold
,
int
glueSwitch
)
{
// valid
if
(
JobGroupEnum
.
match
(
jobGroup
)
==
null
)
{
...
...
@@ -166,7 +169,7 @@ public class JobInfoController {
if
(
StringUtils
.
isBlank
(
handler_address
))
{
return
new
ReturnT
<
String
>(
500
,
"请输入“机器地址”"
);
}
if
(
StringUtils
.
isBlank
(
handler_name
))
{
if
(
glueSwitch
==
0
&&
StringUtils
.
isBlank
(
handler_name
))
{
return
new
ReturnT
<
String
>(
500
,
"请输入“执行器”"
);
}
if
(
StringUtils
.
isBlank
(
author
))
{
...
...
@@ -192,6 +195,7 @@ public class JobInfoController {
jobInfo
.
setAuthor
(
author
);
jobInfo
.
setAlarmEmail
(
alarmEmail
);
jobInfo
.
setAlarmThreshold
(
alarmThreshold
);
jobInfo
.
setGlueSwitch
(
glueSwitch
);
try
{
// fresh quartz
...
...
xxl-job-admin/src/main/java/com/xxl/job/core/model/XxlJobInfo.java
浏览文件 @
5c1bba33
...
...
@@ -24,6 +24,10 @@ public class XxlJobInfo {
private
String
alarmEmail
;
// 报警邮件
private
int
alarmThreshold
;
// 报警阀值
private
int
glueSwitch
;
// GLUE模式开关:0-否,1-是
private
String
glueSource
;
// GLUE源代码
private
String
glueRemark
;
// GLUE备注
// copy from quartz
private
String
jobStatus
;
// 任务状态 【base on quartz】
...
...
@@ -131,12 +135,37 @@ public class XxlJobInfo {
this
.
jobStatus
=
jobStatus
;
}
public
int
getGlueSwitch
()
{
return
glueSwitch
;
}
public
void
setGlueSwitch
(
int
glueSwitch
)
{
this
.
glueSwitch
=
glueSwitch
;
}
public
String
getGlueSource
()
{
return
glueSource
;
}
public
void
setGlueSource
(
String
glueSource
)
{
this
.
glueSource
=
glueSource
;
}
public
String
getGlueRemark
()
{
return
glueRemark
;
}
public
void
setGlueRemark
(
String
glueRemark
)
{
this
.
glueRemark
=
glueRemark
;
}
@Override
public
String
toString
()
{
return
"XxlJobInfo [id="
+
id
+
", jobGroup="
+
jobGroup
+
", jobName="
+
jobName
+
", jobCron="
+
jobCron
+
", jobDesc="
+
jobDesc
+
", jobClass="
+
jobClass
+
", jobData="
+
jobData
+
", addTime="
+
addTime
+
", updateTime="
+
updateTime
+
", author="
+
author
+
", alarmEmail="
+
alarmEmail
+
", alarmThreshold="
+
alarmThreshold
+
", jobStatus="
+
jobStatus
+
"]"
;
+
", alarmThreshold="
+
alarmThreshold
+
", glueSwitch="
+
glueSwitch
+
", glueSource="
+
glueSource
+
", glueRemark="
+
glueRemark
+
", jobStatus="
+
jobStatus
+
"]"
;
}
}
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml
浏览文件 @
5c1bba33
...
...
@@ -19,6 +19,10 @@
<result
column=
"author"
property=
"author"
/>
<result
column=
"alarm_email"
property=
"alarmEmail"
/>
<result
column=
"alarm_threshold"
property=
"alarmThreshold"
/>
<result
column=
"glue_switch"
property=
"glueSwitch"
/>
<result
column=
"glue_source"
property=
"glueSource"
/>
<result
column=
"glue_remark"
property=
"glueRemark"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
...
...
@@ -33,7 +37,10 @@
t.update_time,
t.author,
t.alarm_email,
t.alarm_threshold
t.alarm_threshold,
t.glue_switch,
t.glue_source,
t.glue_remark
</sql>
<select
id=
"pageList"
parameterType=
"java.util.HashMap"
resultMap=
"XxlJobInfo"
>
...
...
@@ -76,7 +83,10 @@
update_time,
author,
alarm_email,
alarm_threshold
alarm_threshold,
glue_switch,
glue_source,
glue_remark
) VALUES (
#{jobGroup},
#{jobName},
...
...
@@ -88,7 +98,10 @@
NOW(),
#{author},
#{alarmEmail},
#{alarmThreshold}
#{alarmThreshold},
#{glueSwitch},
#{glueSource},
#{glueRemark}
);
<selectKey
resultType=
"java.lang.Integer"
order=
"AFTER"
keyProperty=
"id"
>
SELECT LAST_INSERT_ID()
...
...
@@ -111,7 +124,10 @@
update_time = NOW(),
author = #{author},
alarm_email = #{alarmEmail},
alarm_threshold = #{alarmThreshold}
alarm_threshold = #{alarmThreshold},
glue_switch = #{glueSwitch},
glue_source = #{glueSource},
glue_remark = #{glueRemark}
WHERE job_group = #{jobGroup}
AND job_name = #{jobName}
</update>
...
...
xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/index.ftl
浏览文件 @
5c1bba33
...
...
@@ -78,6 +78,7 @@
<th
name=
"author"
>
负责人
</th>
<th
name=
"alarmEmail"
>
报警邮件
</th>
<th
name=
"alarmThreshold"
>
报警阀值
</th>
<th
name=
"glueSwitch"
>
GLUE模式
</th>
<th
name=
"jobStatus"
>
状态
</th>
<th>
操作
</th>
</tr>
...
...
@@ -142,10 +143,16 @@
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"alarmThreshold"
placeholder=
"请输入“报警阈值”"
maxlength=
"200"
></div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-3 col-sm-
9
"
>
<div
class=
"col-sm-offset-3 col-sm-
6
"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
保存
</button>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
取消
</button>
</div>
<div
class=
"col-sm-3"
>
<div
class=
"checkbox"
>
<label><input
type=
"checkbox"
class=
"ifGLUE"
>
开启GLUE模式
<font
color=
"black"
>
*
</font></label>
<input
type=
"hidden"
name=
"glueSwitch"
value=
"0"
>
</div>
</div>
</div>
</form>
</div>
...
...
@@ -194,10 +201,16 @@
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"alarmThreshold"
placeholder=
"请输入“报警阈值”"
maxlength=
"200"
></div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-3 col-sm-
9
"
>
<div
class=
"col-sm-offset-3 col-sm-
6
"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
保存
</button>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
取消
</button>
</div>
<div
class=
"col-sm-3"
>
<div
class=
"checkbox"
>
<label><input
type=
"checkbox"
class=
"ifGLUE"
>
开启GLUE模式
<font
color=
"black"
>
*
</font></label>
<input
type=
"hidden"
name=
"glueSwitch"
value=
"0"
>
</div>
</div>
</div>
</form>
</div>
...
...
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js
浏览文件 @
5c1bba33
...
...
@@ -8,10 +8,11 @@ $(function() {
});
codeEditor
.
setValue
(
$
(
"
#demoCode
"
).
val
()
);
// editor height
var
height
=
Math
.
max
(
document
.
documentElement
.
clientHeight
,
document
.
body
.
offsetHeight
);
$
(
"
.CodeMirror
"
).
attr
(
'
style
'
,
'
height:
'
+
height
+
'
px
'
);
// code source save
$
(
"
#save
"
).
click
(
function
()
{
var
codeSource
=
codeEditor
.
getValue
();
var
codeRemark
=
$
(
"
#codeRemark
"
).
val
();
...
...
xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
浏览文件 @
5c1bba33
...
...
@@ -61,6 +61,7 @@ $(function() {
{
"
data
"
:
'
author
'
,
"
visible
"
:
true
},
{
"
data
"
:
'
alarmEmail
'
,
"
visible
"
:
false
},
{
"
data
"
:
'
alarmThreshold
'
,
"
visible
"
:
false
},
{
"
data
"
:
'
glueSwitch
'
,
"
visible
"
:
false
},
{
"
data
"
:
'
jobStatus
'
,
"
visible
"
:
true
,
...
...
@@ -87,8 +88,13 @@ $(function() {
}
// log url
var
logUrl
=
base_url
+
'
/joblog?jobGroup=
'
+
row
.
jobGroup
+
'
&jobName=
'
+
row
.
jobName
;
// log url
var
codeUrl
=
base_url
+
'
/jobcode?id=
'
+
row
.
id
;
var
codeHtml
=
""
;
if
(
row
.
glueSwitch
!=
0
){
var
codeUrl
=
base_url
+
'
/jobcode?id=
'
+
row
.
id
;
codeHtml
=
'
<button class="btn btn-warning btn-xs" type="button" onclick="javascript:window.open(
\'
'
+
codeUrl
+
'
\'
)" >GLUE</button>
'
}
// job data
var
jobDataMap
=
eval
(
'
(
'
+
row
.
jobData
+
'
)
'
);
...
...
@@ -100,18 +106,19 @@ $(function() {
'
jobDesc="
'
+
row
.
jobDesc
+
'
"
'
+
'
jobClass="
'
+
row
.
jobClass
+
'
"
'
+
'
jobData="
'
+
row
.
jobData
+
'
"
'
+
'
author="
'
+
row
.
author
+
'
"
'
+
'
alarmEmail="
'
+
row
.
alarmEmail
+
'
"
'
+
'
alarmThreshold="
'
+
row
.
alarmThreshold
+
'
"
'
+
'
handler_params="
'
+
jobDataMap
.
handler_params
+
'
"
'
+
'
handler_address="
'
+
jobDataMap
.
handler_address
+
'
"
'
+
'
handler_name="
'
+
jobDataMap
.
handler_name
+
'
"
'
+
'
author="
'
+
row
.
author
+
'
"
'
+
'
alarmEmail="
'
+
row
.
alarmEmail
+
'
"
'
+
'
alarmThreshold="
'
+
row
.
alarmThreshold
+
'
"
'
+
'
glueSwitch="
'
+
row
.
glueSwitch
+
'
"
'
+
'
>
'
+
'
<button class="btn btn-primary btn-xs job_operate" type="job_trigger" type="button">执行</button>
'
+
pause_resume
+
'
<button class="btn btn-primary btn-xs" type="job_del" type="button" onclick="javascript:window.open(
\'
'
+
logUrl
+
'
\'
)" >日志</button><br>
'
+
'
<button class="btn btn-warning btn-xs update" type="button">编辑</button>
'
+
'
<button class="btn btn-warning btn-xs" type="button" onclick="javascript:window.open(
\'
'
+
codeUrl
+
'
\'
)" >GLUE</button>
'
+
codeHtml
+
'
<button class="btn btn-danger btn-xs job_operate" type="job_del" type="button">删除</button>
'
+
'
</p>
'
;
...
...
@@ -318,6 +325,34 @@ $(function() {
$
(
"
.remote_panel
"
).
show
();
// remote
});
// GLUE模式开启
$
(
"
#addModal .form .ifGLUE
"
).
click
(
function
(){
var
ifGLUE
=
$
(
this
).
is
(
'
:checked
'
);
var
$handler_name
=
$
(
"
#addModal .form input[name='handler_name']
"
);
var
$glueSwitch
=
$
(
"
#addModal .form input[name='glueSwitch']
"
);
if
(
ifGLUE
)
{
$handler_name
.
val
(
""
);
$handler_name
.
attr
(
"
readonly
"
,
"
readonly
"
);
$glueSwitch
.
val
(
1
);
}
else
{
$handler_name
.
removeAttr
(
"
readonly
"
);
$glueSwitch
.
val
(
0
);
}
});
$
(
"
#updateModal .form .ifGLUE
"
).
click
(
function
(){
var
ifGLUE
=
$
(
this
).
is
(
'
:checked
'
);
var
$handler_name
=
$
(
"
#updateModal .form input[name='handler_name']
"
);
var
$glueSwitch
=
$
(
"
#updateModal .form input[name='glueSwitch']
"
);
if
(
ifGLUE
)
{
$handler_name
.
val
(
""
);
$handler_name
.
attr
(
"
readonly
"
,
"
readonly
"
);
$glueSwitch
.
val
(
1
);
}
else
{
$handler_name
.
removeAttr
(
"
readonly
"
);
$glueSwitch
.
val
(
0
);
}
});
// 更新
$
(
"
#job_list
"
).
on
(
'
click
'
,
'
.update
'
,
function
()
{
$
(
"
#updateModal .form input[name='jobGroup']
"
).
val
(
$
(
this
).
parent
(
'
p
'
).
attr
(
"
jobGroup
"
));
...
...
@@ -330,6 +365,18 @@ $(function() {
$
(
"
#updateModal .form input[name='author']
"
).
val
(
$
(
this
).
parent
(
'
p
'
).
attr
(
"
author
"
));
$
(
"
#updateModal .form input[name='alarmEmail']
"
).
val
(
$
(
this
).
parent
(
'
p
'
).
attr
(
"
alarmEmail
"
));
$
(
"
#updateModal .form input[name='alarmThreshold']
"
).
val
(
$
(
this
).
parent
(
'
p
'
).
attr
(
"
alarmThreshold
"
));
$
(
"
#updateModal .form input[name='glueSwitch']
"
).
val
(
$
(
this
).
parent
(
'
p
'
).
attr
(
"
glueSwitch
"
));
// GLUE check
var
$glueSwitch
=
$
(
"
#updateModal .form input[name='glueSwitch']
"
);
var
$handler_name
=
$
(
"
#updateModal .form input[name='handler_name']
"
);
if
(
$glueSwitch
.
val
()
!=
0
)
{
$handler_name
.
attr
(
"
readonly
"
,
"
readonly
"
);
$
(
"
#updateModal .form .ifGLUE
"
).
attr
(
"
checked
"
,
true
);
}
else
{
$handler_name
.
removeAttr
(
"
readonly
"
);
$
(
"
#updateModal .form .ifGLUE
"
).
attr
(
"
checked
"
,
false
);
}
$
(
'
#updateModal
'
).
modal
({
backdrop
:
false
,
keyboard
:
false
}).
modal
(
'
show
'
);
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录