use of com.jeeagile.quartz.entity.AgileQuartzJob in project jeeagile by jeeagile.
the class AgileQuartzJobServiceImpl method selectModel.
@Override
public AgileQuartzJob selectModel(Serializable id) {
AgileQuartzJob agileQuartzJob = this.getById(id);
AgileQuartzJobInfo agileQuartzJobInfo = new AgileQuartzJobInfo();
if (agileQuartzJob != null && agileQuartzJob.isNotEmptyPk()) {
BeanUtils.copyProperties(agileQuartzJob, agileQuartzJobInfo);
agileQuartzJobInfo.setNextTime(AgileCronUtil.getNextTime(agileQuartzJob.getJobCron()));
}
return agileQuartzJobInfo;
}
use of com.jeeagile.quartz.entity.AgileQuartzJob in project jeeagile by jeeagile.
the class AgileQuartzJobServiceImpl method changeQuartzJobStatus.
@Override
public boolean changeQuartzJobStatus(AgileUpdateStatus agileUpdateStatus) {
AgileQuartzJob agileQuartzJob = this.getById(agileUpdateStatus.getId());
agileQuartzJob.setJobStatus(agileUpdateStatus.getStatus());
boolean updateFlag = this.updateById(agileQuartzJob);
if (updateFlag) {
if (AgileStatusEnum.NORMAL.getCode().equals(agileUpdateStatus.getStatus())) {
AgileScheduleUtil.resumeJob(agileQuartzJob);
} else {
AgileScheduleUtil.pauseJob(agileQuartzJob);
}
}
return updateFlag;
}
use of com.jeeagile.quartz.entity.AgileQuartzJob in project jeeagile by jeeagile.
the class AgileQuartzJobServiceImpl method updateModel.
@Override
public boolean updateModel(AgileQuartzJob agileQuartzJob) {
this.validateData(agileQuartzJob);
AgileQuartzJob oldAgileQuartzJob = this.getById(agileQuartzJob.getId());
if (this.updateById(agileQuartzJob)) {
// 删除正在执行的任务
AgileScheduleUtil.deleteScheduleJob(oldAgileQuartzJob);
AgileScheduleUtil.createScheduleJob(agileQuartzJob);
return true;
}
return false;
}
use of com.jeeagile.quartz.entity.AgileQuartzJob in project jeeagile by jeeagile.
the class AgileAbstractJob method execute.
@Override
public void execute(JobExecutionContext jobExecutionContext) {
JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();
AgileQuartzJob agileQuartzJob = (AgileQuartzJob) jobDataMap.get(AgileScheduleConstants.TASK_JOB_PROPERTIES);
Throwable throwable = null;
Date startTime = new Date();
try {
if (agileQuartzJob != null && agileQuartzJob.isNotEmptyPk()) {
doExecute(jobExecutionContext, agileQuartzJob);
} else {
throw new AgileFrameException("任务调度参数为空!");
}
} catch (Exception ex) {
log.error("任务执行异常:", ex);
throwable = ex;
} finally {
saveJobLog(agileQuartzJob, startTime, throwable);
}
}
Aggregations