|
|
@@ -1,6 +1,7 @@
|
|
|
package com.x.base.core.project.schedule;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
|
import org.quartz.JobDetail;
|
|
|
@@ -8,9 +9,17 @@ import org.quartz.JobExecutionContext;
|
|
|
import org.quartz.JobExecutionException;
|
|
|
|
|
|
import com.x.base.core.project.gson.GsonPropertyObject;
|
|
|
+import com.x.base.core.project.tools.StringTools;
|
|
|
|
|
|
public class ScheduleLogRequest extends GsonPropertyObject {
|
|
|
|
|
|
+ private static final long serialVersionUID = -1472780383077011677L;
|
|
|
+
|
|
|
+ public static final String FIELDSCHEDULELOGID = "scheduleLogId";
|
|
|
+
|
|
|
+ // 新增id字段,用于保存ScheduleLog的时候覆盖自动生成的id
|
|
|
+ private String scheduleLogId;
|
|
|
+
|
|
|
private String type;
|
|
|
|
|
|
private String node;
|
|
|
@@ -27,8 +36,20 @@ public class ScheduleLogRequest extends GsonPropertyObject {
|
|
|
|
|
|
private Boolean success;
|
|
|
|
|
|
+ public ScheduleLogRequest(JobExecutionContext jobExecutionContext) {
|
|
|
+ JobDetail jobDetail = jobExecutionContext.getJobDetail();
|
|
|
+ this.scheduleLogId = StringTools.uniqueToken();
|
|
|
+ jobExecutionContext.put(FIELDSCHEDULELOGID, scheduleLogId);
|
|
|
+ this.className = jobDetail.getKey().getName();
|
|
|
+ this.application = jobDetail.getKey().getGroup();
|
|
|
+ this.node = jobDetail.getDescription();
|
|
|
+ this.type = jobExecutionContext.getTrigger().getDescription();
|
|
|
+ this.fireTime = jobExecutionContext.getFireTime();
|
|
|
+ }
|
|
|
+
|
|
|
public ScheduleLogRequest(JobExecutionContext jobExecutionContext, JobExecutionException jobExecutionException) {
|
|
|
JobDetail jobDetail = jobExecutionContext.getJobDetail();
|
|
|
+ this.scheduleLogId = Objects.toString(jobExecutionContext.get(FIELDSCHEDULELOGID));
|
|
|
this.className = jobDetail.getKey().getName();
|
|
|
this.application = jobDetail.getKey().getGroup();
|
|
|
this.node = jobDetail.getDescription();
|
|
|
@@ -107,4 +128,12 @@ public class ScheduleLogRequest extends GsonPropertyObject {
|
|
|
this.success = success;
|
|
|
}
|
|
|
|
|
|
+ public String getScheduleLogId() {
|
|
|
+ return scheduleLogId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setScheduleLogId(String scheduleLogId) {
|
|
|
+ this.scheduleLogId = scheduleLogId;
|
|
|
+ }
|
|
|
+
|
|
|
}
|