ggpx/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java

145 lines
4.5 KiB
Java
Raw Normal View History

2020-07-19 10:25:40 +08:00
package com.ruoyi.quartz.domain;
import java.util.Date;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.constant.ScheduleConstants;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.quartz.util.CronUtils;
/**
* 定时任务调度表 sys_job
*
* @author ruoyi
*/
public class SysJob extends BaseEntity {
2020-07-19 10:25:40 +08:00
private static final long serialVersionUID = 1L;
/** 任务ID */
@Excel(name = "任务序号", cellType = ColumnType.NUMERIC)
private Long jobId;
/** 任务名称 */
@Excel(name = "任务名称")
private String jobName;
/** 任务组名 */
@Excel(name = "任务组名")
private String jobGroup;
/** 调用目标字符串 */
@Excel(name = "调用目标字符串")
private String invokeTarget;
/** cron执行表达式 */
@Excel(name = "执行表达式 ")
private String cronExpression;
/** cron计划策略 */
@Excel(name = "计划策略 ", readConverterExp = "0=默认,1=立即触发执行,2=触发一次执行,3=不触发立即执行")
private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT;
/** 是否并发执行0允许 1禁止 */
@Excel(name = "并发执行", readConverterExp = "0=允许,1=禁止")
private String concurrent;
/** 任务状态0正常 1暂停 */
@Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停")
private String status;
public Long getJobId() {
2020-07-19 10:25:40 +08:00
return jobId;
}
public void setJobId(Long jobId) {
2020-07-19 10:25:40 +08:00
this.jobId = jobId;
}
@NotBlank(message = "任务名称不能为空")
@Size(min = 0, max = 64, message = "任务名称不能超过64个字符")
public String getJobName() {
2020-07-19 10:25:40 +08:00
return jobName;
}
public void setJobName(String jobName) {
2020-07-19 10:25:40 +08:00
this.jobName = jobName;
}
public String getJobGroup() {
2020-07-19 10:25:40 +08:00
return jobGroup;
}
public void setJobGroup(String jobGroup) {
2020-07-19 10:25:40 +08:00
this.jobGroup = jobGroup;
}
@NotBlank(message = "调用目标字符串不能为空")
@Size(min = 0, max = 500, message = "调用目标字符串长度不能超过500个字符")
public String getInvokeTarget() {
2020-07-19 10:25:40 +08:00
return invokeTarget;
}
public void setInvokeTarget(String invokeTarget) {
2020-07-19 10:25:40 +08:00
this.invokeTarget = invokeTarget;
}
@NotBlank(message = "Cron执行表达式不能为空")
@Size(min = 0, max = 255, message = "Cron执行表达式不能超过255个字符")
public String getCronExpression() {
2020-07-19 10:25:40 +08:00
return cronExpression;
}
public void setCronExpression(String cronExpression) {
2020-07-19 10:25:40 +08:00
this.cronExpression = cronExpression;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getNextValidTime() {
if (StringUtils.isNotEmpty(cronExpression)) {
2020-07-19 10:25:40 +08:00
return CronUtils.getNextExecution(cronExpression);
}
return null;
}
public String getMisfirePolicy() {
2020-07-19 10:25:40 +08:00
return misfirePolicy;
}
public void setMisfirePolicy(String misfirePolicy) {
2020-07-19 10:25:40 +08:00
this.misfirePolicy = misfirePolicy;
}
public String getConcurrent() {
2020-07-19 10:25:40 +08:00
return concurrent;
}
public void setConcurrent(String concurrent) {
2020-07-19 10:25:40 +08:00
this.concurrent = concurrent;
}
public String getStatus() {
2020-07-19 10:25:40 +08:00
return status;
}
public void setStatus(String status) {
2020-07-19 10:25:40 +08:00
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("jobId", getJobId())
.append("jobName", getJobName()).append("jobGroup", getJobGroup())
.append("cronExpression", getCronExpression()).append("nextValidTime", getNextValidTime())
.append("misfirePolicy", getMisfirePolicy()).append("concurrent", getConcurrent())
.append("status", getStatus()).append("createBy", getCreateBy()).append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).append("remark", getRemark())
.toString();
2020-07-19 10:25:40 +08:00
}
}