coding snapshot

v1.4
xueli.xue 9 years ago
parent 20ab6b1460
commit 8a8d7a5caf

@ -251,11 +251,21 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件通过重写L
- 2、执行器异步回调执行日志
- 3、【重要】在 “调度中心” 支持HA的基础上扩展执行器的Failover支持支持配置多执行期地址
#### 4.6 版本 V1.4.0 新特性
- 1、任务依赖: 通过事件触发方式实现, 任务执行成功并回调SUCCESS时, 会主动触发一次依赖任务的调度;
- 2、调度中心任务属性调整: jobName改为系统生成, 新增任务时不需要指定;
- 3、问题修复:
- 1.1、执行器jetty关闭优化,解决一处可能导致jetty无法关闭的问题;
- 1.2、执行器任务终止时,执行队列回调优化,解决一处导致任务无法回调的问题;
- 1.3、调度中心中列表分页参数优化,解决一处因服务器限制post长度而引起的问题;
- 1.4、执行器Jobhandler注解优化,解决一处因事务代理导致的容器无法加载JobHandler的问题;
- 1.5、远程调度优化,禁用retry策略,解决一处可能导致重复调用的问题;
#### 规划中
- 1、任务终止时任务队列中调度回调通过被终止的接口
- 2、任务执行规则自定义假如前一个任务正在执行后续调度执行规则支持自定义
串行(默认,当前逻辑):后续调度入调度队列;
并行:后续调度并行执行;
Pass后续调度被Pass
- 3、兼容oracle
- 4、任务依赖

@ -143,7 +143,9 @@ CREATE TABLE XXL_JOB_QRTZ_LOCKS
PRIMARY KEY (SCHED_NAME,LOCK_NAME)
);
CREATE TABLE `xxl_job_qrtz_trigger_info` (
CREATE TABLE XXL_JOB_QRTZ_TRIGGER_INFO (
`id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` varchar(255) NOT NULL COMMENT '任务组',
`job_name` varchar(255) NOT NULL COMMENT '任务名',
@ -162,9 +164,9 @@ CREATE TABLE `xxl_job_qrtz_trigger_info` (
`glue_source` text COMMENT 'GLUE源代码',
`glue_remark` varchar(128) DEFAULT NULL COMMENT 'GLUE备注',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `xxl_job_qrtz_trigger_log` (
CREATE TABLE XXL_JOB_QRTZ_TRIGGER_LOG (
`id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` varchar(255) NOT NULL COMMENT '任务组',
`job_name` varchar(255) NOT NULL COMMENT '任务名',
@ -181,9 +183,9 @@ CREATE TABLE `xxl_job_qrtz_trigger_log` (
`handle_status` varchar(255) DEFAULT NULL COMMENT '执行-状态',
`handle_msg` varchar(2048) DEFAULT NULL COMMENT '执行-日志',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `xxl_job_qrtz_trigger_logglue` (
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,
@ -192,7 +194,7 @@ CREATE TABLE `xxl_job_qrtz_trigger_logglue` (
`add_time` timestamp NULL DEFAULT NULL,
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

@ -35,9 +35,9 @@ public class JobInfoController {
@ResponseBody
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start,
@RequestParam(required = false, defaultValue = "10") int length,
String jobGroup, String jobName, String filterTime) {
String jobGroup, String jobDesc, String filterTime) {
return xxlJobService.pageList(start, length, jobGroup, jobName, filterTime);
return xxlJobService.pageList(start, length, jobGroup, jobDesc, filterTime);
}
@RequestMapping("/add")
@ -47,7 +47,7 @@ public class JobInfoController {
String author, String alarmEmail, int alarmThreshold,
int glueSwitch, String glueSource, String glueRemark) {
return xxlJobService.add(jobGroup, jobName, jobCron, jobDesc, executorAddress, executorHandler, executorParam,
return xxlJobService.add(jobGroup, jobCron, jobDesc, executorAddress, executorHandler, executorParam,
author, alarmEmail, alarmThreshold, glueSwitch, glueSource, glueRemark);
}

@ -47,6 +47,13 @@ public class JobLogController {
model.addAttribute("JobGroupList", JobGroupEnum.values());
return "joblog/joblog.index";
}
@RequestMapping("/getJobsByGroup")
@ResponseBody
public ReturnT<List<XxlJobLog>> listJobByGroup(String jobGroup){
List<XxlJobLog> list = xxlJobInfoDao.getJobsByGroup(jobGroup);
return new ReturnT<List<XxlJobLog>>(list);
}
@RequestMapping("/pageList")
@ResponseBody

@ -7,9 +7,9 @@ package com.xxl.job.admin.core.constant;
public class Constants {
public enum JobGroupEnum{
DEFAULT("默认"),
WAIMAI("外卖"),
MOVIE("电影");
defaults("默认"),
waimai("外卖"),
movie("电影");
private String desc;
private JobGroupEnum(String desc){
this.desc = desc;

@ -3,6 +3,7 @@ package com.xxl.job.admin.dao;
import java.util.List;
import com.xxl.job.admin.core.model.XxlJobInfo;
import com.xxl.job.admin.core.model.XxlJobLog;
/**
@ -11,8 +12,8 @@ import com.xxl.job.admin.core.model.XxlJobInfo;
*/
public interface IXxlJobInfoDao {
public List<XxlJobInfo> pageList(int offset, int pagesize, String jobGroup, String jobName);
public int pageListCount(int offset, int pagesize, String jobGroup, String jobName);
public List<XxlJobInfo> pageList(int offset, int pagesize, String jobGroup, String jobDesc);
public int pageListCount(int offset, int pagesize, String jobGroup, String jobDesc);
public int save(XxlJobInfo info);
@ -21,5 +22,6 @@ public interface IXxlJobInfoDao {
public int update(XxlJobInfo item);
public int delete(String jobGroup, String jobName);
public List<XxlJobLog> getJobsByGroup(String jobGroup);
}

@ -5,6 +5,7 @@ import java.util.List;
import javax.annotation.Resource;
import com.xxl.job.admin.core.model.XxlJobLog;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;
@ -22,23 +23,23 @@ public class XxlJobInfoDaoImpl implements IXxlJobInfoDao {
public SqlSessionTemplate sqlSessionTemplate;
@Override
public List<XxlJobInfo> pageList(int offset, int pagesize, String jobGroup, String jobName) {
public List<XxlJobInfo> pageList(int offset, int pagesize, String jobGroup, String jobDesc) {
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("offset", offset);
params.put("pagesize", pagesize);
params.put("jobGroup", jobGroup);
params.put("jobName", jobName);
params.put("jobDesc", jobDesc);
return sqlSessionTemplate.selectList("XxlJobInfoMapper.pageList", params);
}
@Override
public int pageListCount(int offset, int pagesize, String jobGroup, String jobName) {
public int pageListCount(int offset, int pagesize, String jobGroup, String jobDesc) {
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("offset", offset);
params.put("pagesize", pagesize);
params.put("jobGroup", jobGroup);
params.put("jobName", jobName);
params.put("jobDesc", jobDesc);
return sqlSessionTemplate.selectOne("XxlJobInfoMapper.pageListCount", params);
}
@ -70,5 +71,10 @@ public class XxlJobInfoDaoImpl implements IXxlJobInfoDao {
return sqlSessionTemplate.update("XxlJobInfoMapper.delete", params);
}
@Override
public List<XxlJobLog> getJobsByGroup(String jobGroup) {
return sqlSessionTemplate.selectList("XxlJobInfoMapper.getJobsByGroup", jobGroup);
}
}

@ -11,9 +11,9 @@ import com.xxl.job.admin.core.model.ReturnT;
*/
public interface IXxlJobService {
public Map<String, Object> pageList(int start, int length, String jobGroup, String jobName, String filterTime);
public Map<String, Object> pageList(int start, int length, String jobGroup, String jobDesc, String filterTime);
public ReturnT<String> add(String jobGroup, String jobName, String jobCron, String jobDesc,
public ReturnT<String> add(String jobGroup, String jobCron, String jobDesc,
String executorAddress, String executorHandler, String executorParam,
String author, String alarmEmail, int alarmThreshold,
int glueSwitch, String glueSource, String glueRemark);

@ -3,6 +3,7 @@ package com.xxl.job.admin.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.annotation.Resource;
@ -36,11 +37,11 @@ public class XxlJobServiceImpl implements IXxlJobService {
private IXxlJobLogGlueDao xxlJobLogGlueDao;
@Override
public Map<String, Object> pageList(int start, int length, String jobGroup, String jobName, String filterTime) {
public Map<String, Object> pageList(int start, int length, String jobGroup, String jobDesc, String filterTime) {
// page list
List<XxlJobInfo> list = xxlJobInfoDao.pageList(start, length, jobGroup, jobName);
int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, jobName);
List<XxlJobInfo> list = xxlJobInfoDao.pageList(start, length, jobGroup, jobDesc);
int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, jobDesc);
// fill job info
if (list!=null && list.size()>0) {
@ -58,7 +59,7 @@ public class XxlJobServiceImpl implements IXxlJobService {
}
@Override
public ReturnT<String> add(String jobGroup, String jobName, String jobCron, String jobDesc,
public ReturnT<String> add(String jobGroup, String jobCron, String jobDesc,
String executorAddress, String executorHandler, String executorParam,
String author, String alarmEmail, int alarmThreshold,
int glueSwitch, String glueSource, String glueRemark) {
@ -66,9 +67,6 @@ public class XxlJobServiceImpl implements IXxlJobService {
if (JobGroupEnum.match(jobGroup) == null) {
return new ReturnT<String>(500, "请选择“任务组”");
}
if (StringUtils.isBlank(jobName)) {
return new ReturnT<String>(500, "请输入“任务名”");
}
if (!CronExpression.isValidExpression(jobCron)) {
return new ReturnT<String>(500, "请输入格式正确的“Cron”");
}
@ -90,7 +88,9 @@ public class XxlJobServiceImpl implements IXxlJobService {
if (alarmThreshold < 0) {
alarmThreshold = 0;
}
// generate jobName
String jobName = UUID.randomUUID().toString();
try {
if (DynamicSchedulerUtil.checkExists(jobName, jobGroup)) {
return new ReturnT<String>(500, "此任务已存在,请更换任务组或任务名");
@ -99,7 +99,7 @@ public class XxlJobServiceImpl implements IXxlJobService {
e1.printStackTrace();
return new ReturnT<String>(500, "此任务已存在,请更换任务组或任务名");
}
// Backup to the database
XxlJobInfo jobInfo = new XxlJobInfo();
jobInfo.setJobGroup(jobGroup);
@ -117,7 +117,7 @@ public class XxlJobServiceImpl implements IXxlJobService {
jobInfo.setExecutorHandler(executorHandler);
jobInfo.setExecutorParam(executorParam);
xxlJobInfoDao.save(jobInfo);
try {
// add job 2 quartz
boolean result = DynamicSchedulerUtil.addJob(jobInfo);
@ -168,8 +168,8 @@ public class XxlJobServiceImpl implements IXxlJobService {
}
XxlJobInfo jobInfo = xxlJobInfoDao.load(jobGroup, jobName);
jobInfo.setJobCron(jobCron);
jobInfo.setJobDesc(jobDesc);
jobInfo.setJobCron(jobCron);
jobInfo.setAuthor(author);
jobInfo.setAlarmEmail(alarmEmail);
jobInfo.setAlarmThreshold(alarmThreshold);

@ -5,6 +5,6 @@ log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d - xxl-job-admin - %p [%c] - <%m>%n
log4j.appender.logFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logFile.File=${catalina.base}/logs/xxl-job-admin.log
log4j.appender.logFile.File=/data/applogs/xxl-job/xxl-job-admin.log
log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
log4j.appender.logFile.layout.ConversionPattern=%d - xxl-job-admin - %p [%c] - <%m>%n

@ -50,13 +50,13 @@
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
SELECT <include refid="Base_Column_List" />
FROM xxl_job_qrtz_trigger_info AS t
FROM XXL_JOB_QRTZ_TRIGGER_INFO AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobGroup != null and jobGroup != ''">
AND t.job_group = #{jobGroup}
</if>
<if test="jobName != null and jobName != ''">
AND t.job_name like CONCAT(CONCAT('%', #{jobName}), '%')
<if test="jobDesc != null and jobDesc != ''">
AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
</if>
</trim>
ORDER BY id DESC
@ -65,19 +65,19 @@
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
SELECT count(1)
FROM xxl_job_qrtz_trigger_info AS t
FROM XXL_JOB_QRTZ_TRIGGER_INFO AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobGroup != null and jobGroup != ''">
AND t.job_group = #{jobGroup}
</if>
<if test="jobName != null and jobName != ''">
AND t.job_name like CONCAT(CONCAT('%', #{jobName}), '%')
<if test="jobDesc != null and jobDesc != ''">
AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc}), '%')
</if>
</trim>
</select>
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO `xxl_job_qrtz_trigger_info` (
INSERT INTO XXL_JOB_QRTZ_TRIGGER_INFO (
job_group,
job_name,
job_cron,
@ -119,13 +119,13 @@
<select id="load" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
SELECT <include refid="Base_Column_List" />
FROM xxl_job_qrtz_trigger_info AS t
FROM XXL_JOB_QRTZ_TRIGGER_INFO AS t
WHERE t.job_group = #{jobGroup}
AND t.job_name = #{jobName}
</select>
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
UPDATE `xxl_job_qrtz_trigger_info`
UPDATE XXL_JOB_QRTZ_TRIGGER_INFO
SET
job_cron = #{jobCron},
job_desc = #{jobDesc},
@ -146,10 +146,16 @@
<delete id="delete" parameterType="java.lang.String">
DELETE
FROM
xxl_job_qrtz_trigger_info
XXL_JOB_QRTZ_TRIGGER_INFO
WHERE
job_group = #{jobGroup}
AND job_name = #{jobName}
</delete>
<select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_QRTZ_TRIGGER_INFO AS t
WHERE t.job_group = #{jobGroup}
</select>
</mapper>

@ -46,7 +46,7 @@
<select id="selectList" parameterType="java.util.HashMap" resultMap="XxlJobLogGlue">
SELECT <include refid="Base_Column_List" />
FROM xxl_job_qrtz_trigger_logglue AS t
FROM XXL_JOB_QRTZ_TRIGGER_LOGGLUE AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobGroup != null and jobGroup != ''">
AND t.job_group = #{jobGroup}
@ -59,10 +59,10 @@
</select>
<delete id="removeOld" parameterType="java.util.HashMap" >
DELETE FROM xxl_job_qrtz_trigger_logglue
DELETE FROM XXL_JOB_QRTZ_TRIGGER_LOGGLUE
WHERE id NOT in(
SELECT id FROM(
SELECT id FROM xxl_job_qrtz_trigger_logglue
SELECT id FROM XXL_JOB_QRTZ_TRIGGER_LOGGLUE
WHERE `job_group` = #{jobGroup} and `job_name` = #{jobName}
ORDER BY update_time desc
LIMIT 0, #{limit}
@ -71,7 +71,7 @@
</delete>
<delete id="delete" parameterType="java.util.HashMap" >
DELETE FROM xxl_job_qrtz_trigger_logglue
DELETE FROM XXL_JOB_QRTZ_TRIGGER_LOGGLUE
WHERE job_group = #{jobGroup} and job_name = #{jobName}
</delete>

@ -67,7 +67,7 @@
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
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" >
<if test="jobGroup != null and jobGroup != ''">
AND t.job_group = #{jobGroup}
@ -86,19 +86,19 @@
<select id="load" parameterType="java.lang.Integer" resultMap="XxlJobLog">
SELECT <include refid="Base_Column_List" />
FROM xxl_job_qrtz_trigger_log AS t
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
WHERE t.id = #{id}
</select>
<select id="loadByGroupAndName" parameterType="java.util.HashMap" resultMap="XxlJobLog">
SELECT <include refid="Base_Column_List" />
FROM xxl_job_qrtz_trigger_log AS t
FROM XXL_JOB_QRTZ_TRIGGER_LOG AS t
WHERE t.job_group = #{jobGroup}
AND t.job_name = #{jobName}
</select>
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO `xxl_job_qrtz_trigger_log` (
INSERT INTO XXL_JOB_QRTZ_TRIGGER_LOG (
`job_group`,
`job_name`,
`job_cron`,
@ -123,7 +123,7 @@
</insert>
<update id="updateTriggerInfo">
UPDATE `xxl_job_qrtz_trigger_log`
UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
SET
`trigger_time`= #{triggerTime},
`trigger_status`= #{triggerStatus},
@ -135,7 +135,7 @@
</update>
<update id="updateHandleInfo">
UPDATE `xxl_job_qrtz_trigger_log`
UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
SET
`handle_time`= #{handleTime},
`handle_status`= #{handleStatus},
@ -144,7 +144,7 @@
</update>
<delete id="delete">
delete from `xxl_job_qrtz_trigger_log`
delete from XXL_JOB_QRTZ_TRIGGER_LOG
WHERE job_group = #{jobGroup}
AND job_name = #{jobName}
</delete>

@ -34,7 +34,7 @@
<div class="row">
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon">任务组</span>
<span class="input-group-addon">组</span>
<select class="form-control" id="jobGroup" >
<#list JobGroupList as group>
<option value="${group}" >${group.desc}</option>
@ -44,8 +44,8 @@
</div>
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon">任务名</span>
<input type="text" class="form-control" id="jobName" value="${jobName}" autocomplete="on" >
<span class="input-group-addon">名</span>
<input type="text" class="form-control" id="jobDesc" value="${jobName}" autocomplete="on" >
</div>
</div>
<div class="col-xs-2">
@ -67,9 +67,9 @@
<thead>
<tr>
<th name="id" >id</th>
<th name="jobGroup" >任务组</th>
<th name="jobName" >任务名</th>
<th name="jobDesc" >描述</th>
<th name="jobGroup" >jobGroup</th>
<th name="jobName" >jobName</th>
<th name="jobDesc" >名称</th>
<th name="jobCron" >Cron</th>
<th name="jobClass" >JobBean</th>
<th name="executorAddress" >执行器地址</th>
@ -104,12 +104,12 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" >新增任务调度信息</h4>
<h4 class="modal-title" >新增任务</h4>
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">任务组<font color="red">*</font></label>
<label for="firstname" class="col-sm-2 control-label">组<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="jobGroup" >
<#list JobGroupList as group>
@ -117,33 +117,31 @@
</#list>
</select>
</div>
<label for="firstname" class="col-sm-2 control-label">任务名<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobName" placeholder="请输入“任务名”" minlength="4" maxlength="100" ></div>
<label for="lastname" class="col-sm-2 control-label">名<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobDesc" placeholder="请输入“描述”" maxlength="50" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">Cron<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobCron" placeholder="请输入“Cron”" maxlength="100" ></div>
<label for="lastname" class="col-sm-2 control-label">描述<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobDesc" placeholder="请输入“描述”" maxlength="200" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">执行器地址<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorAddress" placeholder="请输入“执行器地址”,多个地址逗号分隔" maxlength="200" ></div>
<label for="lastname" class="col-sm-2 control-label">jobHandler<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorHandler" placeholder="请输入“jobHandler”" maxlength="200" ></div>
<label for="lastname" class="col-sm-2 control-label">Cron<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobCron" placeholder="请输入“Cron”" maxlength="20" ></div>
<label for="lastname" class="col-sm-2 control-label">执行器地址<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorAddress" placeholder="请输入“执行器地址”,多个地址逗号分隔" maxlength="50" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">执行参数<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorParam" placeholder="请输入“执行参数”" maxlength="100" ></div>
<label for="lastname" class="col-sm-2 control-label">负责人<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="请输入“负责人”" maxlength="200" ></div>
<label for="lastname" class="col-sm-2 control-label">JobHandler<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorHandler" placeholder="请输入“jobHandler”" maxlength="50" ></div>
<label for="firstname" class="col-sm-2 control-label">执行参数<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorParam" placeholder="请输入“执行参数”" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">报警邮件<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="请输入“报警邮件”,多个邮件地址逗号分隔" maxlength="200" ></div>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="请输入“报警邮件”,多个邮件地址逗号分隔" maxlength="100" ></div>
<label for="lastname" class="col-sm-2 control-label">报警阈值<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmThreshold" placeholder="请输入“报警阈值”" maxlength="200" ></div>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmThreshold" placeholder="请输入“报警阈值”" maxlength="5" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">负责人<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="请输入“负责人”" maxlength="50" ></div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button type="submit" class="btn btn-primary" >保存</button>
@ -190,41 +188,47 @@ public class DemoJobHandler extends IJobHandler {
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" >更新任务调度信息</h4>
<h4 class="modal-title" >更新任务</h4>
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">任务组<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobGroup" placeholder="请输入“任务组”" minlength="4" maxlength="100" readonly ></div>
<label for="firstname" class="col-sm-2 control-label">任务名<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobName" placeholder="请输入“任务名”" minlength="4" maxlength="100" readonly ></div>
<label for="firstname" class="col-sm-2 control-label">分组<font color="red">*</font></label>
<div class="col-sm-4">
<select class="form-control" name="jobGroupTitle" disabled>
<#list JobGroupList as group>
<option value="${group}" >${group.desc}</option>
</#list>
</select>
<input type="hidden" name="jobGroup" >
<input type="hidden" name="jobName" >
</div>
<label for="lastname" class="col-sm-2 control-label">名称<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobDesc" placeholder="请输入“描述”" maxlength="50" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">Cron<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobCron" placeholder="请输入“Cron”" maxlength="100" ></div>
<label for="lastname" class="col-sm-2 control-label">描述<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="jobDesc" placeholder="请输入“描述”" maxlength="200" ></div>
<div class="col-sm-4"><input type="text" class="form-control" name="jobCron" placeholder="请输入“Cron”" maxlength="20" ></div>
<label for="lastname" class="col-sm-2 control-label">执行器地址<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorAddress" placeholder="请输入“执行器地址”,多个地址逗号分隔" maxlength="50" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">执行器地址<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorAddress" placeholder="请输入“执行器地址”,多个地址逗号分隔" maxlength="200" ></div>
<label for="lastname" class="col-sm-2 control-label">jobHandler<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorHandler" placeholder="请输入“jobHandler”" maxlength="200" ></div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">执行参数<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorParam" placeholder="请输入“执行参数”" maxlength="100" ></div>
<label for="lastname" class="col-sm-2 control-label">负责人<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="请输入“负责人”" maxlength="200" ></div>
<label for="lastname" class="col-sm-2 control-label">JobHandler<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorHandler" placeholder="请输入“jobHandler”" maxlength="50" ></div>
<label for="firstname" class="col-sm-2 control-label">执行参数<font color="black">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="executorParam" placeholder="请输入“执行参数”" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">报警邮件<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="请输入“报警邮件”,多个邮件地址逗号分隔" maxlength="200" ></div>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="请输入“报警邮件”,多个邮件地址逗号分隔" maxlength="100" ></div>
<label for="lastname" class="col-sm-2 control-label">报警阈值<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmThreshold" placeholder="请输入“报警阈值”" maxlength="200" ></div>
<div class="col-sm-4"><input type="text" class="form-control" name="alarmThreshold" placeholder="请输入“报警阈值”" maxlength="5" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">负责人<font color="red">*</font></label>
<div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="请输入“负责人”" maxlength="50" ></div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button type="submit" class="btn btn-primary" >保存</button>

@ -34,18 +34,21 @@
<div class="row">
<div class="col-xs-3">
<div class="input-group">
<span class="input-group-addon">任务组</span>
<select class="form-control" id="jobGroup" >
<span class="input-group-addon">分组</span>
<select class="form-control" id="jobGroup" paramVal="${jobGroup}" >
<option value="" selected>请选择</option>
<#list JobGroupList as group>
<option value="${group}" <#if jobGroup == group>selected</#if> >${group.desc}</option>
<option value="${group}" <#if jobGroup == group && false>selected</#if> >${group.desc}</option>
</#list>
</select>
</div>
</div>
<div class="col-xs-3">
<div class="input-group">
<span class="input-group-addon">任务名</span>
<input type="text" class="form-control" id="jobName" value="${jobName}" autocomplete="on" >
<span class="input-group-addon">名称</span>
<select class="form-control" id="jobName" paramVal="${jobName}" >
<option value="" >请选择</option>
</select>
</div>
</div>
<div class="col-xs-4">

@ -6,10 +6,11 @@ $(function() {
"serverSide": true,
"ajax": {
url: base_url + "/jobinfo/pageList",
type:"post",
data : function ( d ) {
var obj = {};
obj.jobGroup = $('#jobGroup').val();
obj.jobName = $('#jobName').val();
obj.jobDesc = $('#jobDesc').val();
obj.start = d.start;
obj.length = d.length;
return obj;
@ -33,7 +34,7 @@ $(function() {
return data;
}
},
{ "data": 'jobName'},
{ "data": 'jobName', "visible" : false},
{ "data": 'jobDesc', "visible" : true},
{ "data": 'jobCron', "visible" : true},
{ "data": 'jobClass', "visible" : false},
@ -98,7 +99,6 @@ $(function() {
' jobCron="'+ row.jobCron +'" '+
' jobDesc="'+ row.jobDesc +'" '+
' jobClass="'+ row.jobClass +'" '+
' jobData="'+ row.jobData +'" '+
' executorAddress="'+row.executorAddress +'" '+
' executorHandler="'+ row.executorHandler +'" '+
' executorParam="'+ row.executorParam +'" '+
@ -214,77 +214,55 @@ $(function() {
errorElement : 'span',
errorClass : 'help-block',
focusInvalid : true,
rules : {
jobName : {
required : true ,
minlength: 4,
maxlength: 100,
myValid01:true
},
jobCron : {
required : true ,
maxlength: 100
},
jobDesc : {
required : true ,
maxlength: 200
rules : {
jobDesc : {
required : true,
maxlength: 50
},
jobCron : {
required : true
},
executorAddress : {
required : true ,
maxlength: 200
required : true
},
executorHandler : {
required : true ,
maxlength: 200
},
author : {
required : true ,
maxlength: 200
required : true
},
alarmEmail : {
required : true ,
maxlength: 200
required : true
},
alarmThreshold : {
required : true ,
digits:true
}
},
author : {
required : true
}
},
messages : {
jobName : {
required :"请输入“任务名”" ,
minlength:"“任务名”长度不应低于4位",
maxlength:"“任务名”长度不应超过100位"
},
jobCron : {
required :"请输入“Cron”." ,
maxlength:"“Cron”长度不应超过100位"
},
jobDesc : {
required :"请输入“任务描述”." ,
maxlength:"“任务描述”长度不应超过200位"
},
required :"请输入“名称”."
},
jobCron : {
required :"请输入“Cron”."
},
executorAddress : {
required :"请输入“执行器地址”." ,
maxlength:"“执行器地址”长度不应超过200位"
required :"请输入“执行器地址”."
},
executorHandler : {
required : "请输入“jobHandler”." ,
maxlength: "“jobHandler”长度不应超过200位"
},
author : {
required : "请输入“负责人”." ,
maxlength: "“负责人”长度不应超过50位"
required : "请输入“JobHandler”."
},
alarmEmail : {
required : "请输入“报警邮件”." ,
maxlength: "“报警邮件”长度不应超过200位"
required : "请输入“报警邮件”."
},
alarmThreshold : {
required : "请输入“报警阈值”." ,
digits:"阀值应该为整数."
},
author : {
required : "请输入“负责人”."
}
},
},
highlight : function(element) {
$(element).closest('.form-group').addClass('has-error');
},
@ -348,10 +326,13 @@ $(function() {
// 更新
$("#job_list").on('click', '.update',function() {
// base data
$("#updateModal .form input[name='jobGroupTitle']").find("option[value='" + $(this).parent('p').attr("jobGroup") + "']").attr("selected",true);
$("#updateModal .form input[name='jobGroup']").val($(this).parent('p').attr("jobGroup"));
$("#updateModal .form input[name='jobName']").val($(this).parent('p').attr("jobName"));
$("#updateModal .form input[name='jobCron']").val($(this).parent('p').attr("jobCron"));
$("#updateModal .form input[name='jobDesc']").val($(this).parent('p').attr("jobDesc"));
$("#updateModal .form input[name='jobCron']").val($(this).parent('p').attr("jobCron"));
$("#updateModal .form input[name='executorAddress']").val($(this).parent('p').attr("executorAddress"));
$("#updateModal .form input[name='executorHandler']").val($(this).parent('p').attr("executorHandler"));
$("#updateModal .form input[name='executorParam']").val($(this).parent('p').attr("executorParam"));
@ -359,7 +340,7 @@ $(function() {
$("#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 $executorHandler = $("#updateModal .form input[name='executorHandler']");
@ -376,68 +357,58 @@ $(function() {
var updateModalValidate = $("#updateModal .form").validate({
errorElement : 'span',
errorClass : 'help-block',
focusInvalid : true,
rules : {
jobCron : {
required : true ,
maxlength: 100
},
jobDesc : {
required : true ,
maxlength: 200
},
executorAddress : {
required : true ,
maxlength: 200
},
executorHandler : {
required : true ,
maxlength: 200
},
author : {
required : true ,
maxlength: 200
},
alarmEmail : {
required : true ,
maxlength: 200
},
alarmThreshold : {
required : true ,
digits:true
}
},
messages : {
jobCron : {
required :"请输入“Cron”." ,
maxlength:"“Cron”长度不应超过100位"
},
jobDesc : {
required :"请输入“任务描述”." ,
maxlength:"“任务描述”长度不应超过200位"
},
executorAddress : {
required :"请输入“执行器地址”." ,
maxlength:"“执行器地址”长度不应超过200位"
},
executorHandler : {
required : "请输入“jobHandler”." ,
maxlength: "“jobHandler”长度不应超过200位"
},
author : {
required : "请输入“负责人”." ,
maxlength: "“负责人”长度不应超过50位"
},
alarmEmail : {
required : "请输入“报警邮件”." ,
maxlength: "“报警邮件”长度不应超过200位"
},
alarmThreshold : {
required : "请输入“报警阈值”." ,
digits:"阀值应该为整数."
}
},
highlight : function(element) {
focusInvalid : true,
rules : {
jobDesc : {
required : true,
maxlength: 50
},
jobCron : {
required : true
},
executorAddress : {
required : true
},
executorHandler : {
required : true
},
alarmEmail : {
required : true
},
alarmThreshold : {
required : true ,
digits:true
},
author : {
required : true
}
},
messages : {
jobDesc : {
required :"请输入“名称”."
},
jobCron : {
required :"请输入“Cron”."
},
executorAddress : {
required :"请输入“执行器地址”."
},
executorHandler : {
required : "请输入“JobHandler”."
},
alarmEmail : {
required : "请输入“报警邮件”."
},
alarmThreshold : {
required : "请输入“报警阈值”." ,
digits:"阀值应该为整数."
},
author : {
required : "请输入“负责人”."
}
},
highlight : function(element) {
$(element).closest('.form-group').addClass('has-error');
},
success : function(label) {

@ -1,5 +1,37 @@
$(function() {
// 分组列表选中, 任务列表初始化和选中
var ifParam = true;
$("#jobGroup").on("change", function () {
var jobGroup = $(this).children('option:selected').val();
$.ajax({
type : 'POST',
async: false, // async, avoid js invoke pagelist before jobName data init
url : base_url + '/joblog/getJobsByGroup',
data : {"jobGroup":jobGroup},
dataType : "json",
success : function(data){
if (data.code == 200) {
$("#jobName").html('<option value="" >请选择</option>');
$.each(data.content, function (n, value) {
$("#jobName").append('<option value="' + value.jobName + '" >' + value.jobDesc + '</option>');
});
if ($("#jobName").attr("paramVal")){
$("#jobName").find("option[value='" + $("#jobName").attr("paramVal") + "']").attr("selected",true);
$("#jobName").attr("paramVal")
}
} else {
ComAlertTec.show(data.msg);
}
},
});
});
if ($("#jobGroup").attr("paramVal")){
$("#jobGroup").find("option[value='" + $("#jobGroup").attr("paramVal") + "']").attr("selected",true);
$("#jobGroup").change();
$("#jobGroup").attr("")
}
// 过滤时间
$('#filterTime').daterangepicker({
timePicker: true, //是否显示小时和分钟

@ -10,7 +10,7 @@
</appender>
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="file" value="/logs/xxl-job-client-demo.log"/>
<param name="file" value="/data/applogs/xxl-job/xxl-job-executor-example.log"/>
<param name="append" value="true"/>
<param name="encoding" value="UTF-8"/>
<layout class="org.apache.log4j.PatternLayout">
@ -19,7 +19,7 @@
</appender>
<appender name="xxl-job" class="com.xxl.job.core.log.XxlJobFileAppender">
<param name="filePath" value="/logs/xxl-job/"/>
<param name="filePath" value="/data/applogs/xxl-job/jobhandler/"/>
<param name="append" value="true"/>
<param name="encoding" value="UTF-8"/>
<layout class="org.apache.log4j.PatternLayout">

@ -17,7 +17,7 @@
<select id="load" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
SELECT <include refid="Base_Column_List" />
FROM xxl_job_qrtz_trigger_info AS t
FROM XXL_JOB_QRTZ_TRIGGER_INFO AS t
WHERE t.job_group = #{jobGroup}
AND t.job_name = #{jobName}
</select>

Loading…
Cancel
Save