Java Code Examples for org.jeecg.modules.quartz.entity.QuartzJob#setStatus()

The following examples show how to use org.jeecg.modules.quartz.entity.QuartzJob#setStatus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuartzJobController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 暂停定时任务
 * 
 * @param jobClassName
 * @return
 */
//@RequiresRoles({"admin"})
@GetMapping(value = "/pause")
@ApiOperation(value = "暂停定时任务")
public Result<Object> pauseJob(@RequestParam(name = "jobClassName", required = true) String jobClassName) {
	QuartzJob job = null;
	try {
		job = quartzJobService.getOne(new LambdaQueryWrapper<QuartzJob>().eq(QuartzJob::getJobClassName, jobClassName));
		if (job == null) {
			return Result.error("定时任务不存在!");
		}
		scheduler.pauseJob(JobKey.jobKey(jobClassName.trim()));
	} catch (SchedulerException e) {
		throw new JeecgBootException("暂停定时任务失败");
	}
	job.setStatus(CommonConstant.STATUS_DISABLE);
	quartzJobService.updateById(job);
	return Result.ok("暂停定时任务成功");
}
 
Example 2
Source File: QuartzJobController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 暂停定时任务
 * 
 * @param job
 * @return
 */
@GetMapping(value = "/pause")
@ApiOperation(value = "暂停定时任务")
public Result<Object> pauseJob(@RequestParam(name = "jobClassName", required = true) String jobClassName) {
	QuartzJob job = null;
	try {
		job = quartzJobService.getOne(new LambdaQueryWrapper<QuartzJob>().eq(QuartzJob::getJobClassName, jobClassName));
		if (job == null) {
			return Result.error("定时任务不存在!");
		}
		scheduler.pauseJob(JobKey.jobKey(jobClassName.trim()));
	} catch (SchedulerException e) {
		throw new JeecgBootException("暂停定时任务失败");
	}
	job.setStatus(CommonConstant.STATUS_DISABLE);
	quartzJobService.updateById(job);
	return Result.ok("暂停定时任务成功");
}
 
Example 3
Source File: QuartzJobController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 暂停定时任务
 * 
 * @param jobClassName
 * @return
 */
@RequiresRoles("admin")
@GetMapping(value = "/pause")
@ApiOperation(value = "暂停定时任务")
public Result<Object> pauseJob(@RequestParam(name = "jobClassName", required = true) String jobClassName) {
	QuartzJob job = null;
	try {
		job = quartzJobService.getOne(new LambdaQueryWrapper<QuartzJob>().eq(QuartzJob::getJobClassName, jobClassName));
		if (job == null) {
			return Result.error("定时任务不存在!");
		}
		scheduler.pauseJob(JobKey.jobKey(jobClassName.trim()));
	} catch (SchedulerException e) {
		throw new JeecgBootException("暂停定时任务失败");
	}
	job.setStatus(CommonConstant.STATUS_DISABLE);
	quartzJobService.updateById(job);
	return Result.ok("暂停定时任务成功");
}
 
Example 4
Source File: QuartzJobController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 暂停定时任务
 * 
 * @param jobClassName
 * @return
 */
//@RequiresRoles({"admin"})
@GetMapping(value = "/pause")
@ApiOperation(value = "暂停定时任务")
public Result<Object> pauseJob(@RequestParam(name = "jobClassName", required = true) String jobClassName) {
	QuartzJob job = null;
	try {
		job = quartzJobService.getOne(new LambdaQueryWrapper<QuartzJob>().eq(QuartzJob::getJobClassName, jobClassName));
		if (job == null) {
			return Result.error("定时任务不存在!");
		}
		scheduler.pauseJob(JobKey.jobKey(jobClassName.trim()));
	} catch (SchedulerException e) {
		throw new JeecgBootException("暂停定时任务失败");
	}
	job.setStatus(CommonConstant.STATUS_DISABLE);
	quartzJobService.updateById(job);
	return Result.ok("暂停定时任务成功");
}
 
Example 5
Source File: QuartzJobServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 恢复定时任务
 */
@Override
public boolean resumeJob(QuartzJob quartzJob) {
	schedulerDelete(quartzJob.getJobClassName().trim());
	schedulerAdd(quartzJob.getJobClassName().trim(), quartzJob.getCronExpression().trim(), quartzJob.getParameter());
	quartzJob.setStatus(CommonConstant.STATUS_NORMAL);
	return this.updateById(quartzJob);
}
 
Example 6
Source File: QuartzJobServiceImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * 恢复定时任务
 */
@Override
public boolean resumeJob(QuartzJob quartzJob) {
	schedulerDelete(quartzJob.getJobClassName().trim());
	schedulerAdd(quartzJob.getJobClassName().trim(), quartzJob.getCronExpression().trim(), quartzJob.getParameter());
	quartzJob.setStatus(CommonConstant.STATUS_NORMAL);
	return this.updateById(quartzJob);
}
 
Example 7
Source File: QuartzJobServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 恢复定时任务
 */
@Override
public boolean resumeJob(QuartzJob quartzJob) {
	schedulerDelete(quartzJob.getJobClassName().trim());
	schedulerAdd(quartzJob.getJobClassName().trim(), quartzJob.getCronExpression().trim(), quartzJob.getParameter());
	quartzJob.setStatus(CommonConstant.STATUS_NORMAL);
	return this.updateById(quartzJob);
}
 
Example 8
Source File: QuartzJobServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 恢复定时任务
 */
@Override
public boolean resumeJob(QuartzJob quartzJob) {
	schedulerDelete(quartzJob.getJobClassName().trim());
	schedulerAdd(quartzJob.getJobClassName().trim(), quartzJob.getCronExpression().trim(), quartzJob.getParameter());
	quartzJob.setStatus(CommonConstant.STATUS_NORMAL);
	return this.updateById(quartzJob);
}