|
@@ -9,7 +9,7 @@ import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
import com.qmth.sop.common.enums.JobEnum;
|
|
import com.qmth.sop.common.enums.JobEnum;
|
|
import com.qmth.sop.common.enums.JobQuartzTypeEnum;
|
|
import com.qmth.sop.common.enums.JobQuartzTypeEnum;
|
|
-import com.qmth.sop.task.job.FlowTaskQuartzJob;
|
|
|
|
|
|
+import com.qmth.sop.task.job.RemindTaskJob;
|
|
import com.qmth.sop.task.job.service.JobService;
|
|
import com.qmth.sop.task.job.service.JobService;
|
|
import com.qmth.sop.task.service.QuartzService;
|
|
import com.qmth.sop.task.service.QuartzService;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -61,17 +61,21 @@ public class JobServiceImpl implements JobService {
|
|
SysConfig sysConfigBefore = commonCacheService.addSysConfigCache(SystemConstant.FLOW_JOB_BEFORE_TIME);
|
|
SysConfig sysConfigBefore = commonCacheService.addSysConfigCache(SystemConstant.FLOW_JOB_BEFORE_TIME);
|
|
Optional.ofNullable(sysConfigBefore).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("提前提醒任务时间未设置"));
|
|
Optional.ofNullable(sysConfigBefore).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("提前提醒任务时间未设置"));
|
|
Long execTime = SystemConstant.processMiniuteMinus(t.getCreateTime(), Duration.ofMinutes(Long.parseLong(sysConfigBefore.getConfigValue())));
|
|
Long execTime = SystemConstant.processMiniuteMinus(t.getCreateTime(), Duration.ofMinutes(Long.parseLong(sysConfigBefore.getConfigValue())));
|
|
- t.setExecTime(execTime);
|
|
|
|
- this.setJobTime(execTime, t.getId().toString(), t, FlowTaskQuartzJob.class, JobEnum.FLOW_TASK_REMIND_QUARTZ_JOB_GROUP);
|
|
|
|
- tsJobRemindUpdateList.add(t);
|
|
|
|
|
|
+ if (Objects.nonNull(execTime) && execTime.longValue() < System.currentTimeMillis()) {
|
|
|
|
+ t.setExecTime(execTime);
|
|
|
|
+ this.setJobTime(execTime, t.getId().toString(), t, RemindTaskJob.class, JobEnum.REMIND_QUARTZ_JOB_GROUP);
|
|
|
|
+ tsJobRemindUpdateList.add(t);
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case AFTER://超时提醒
|
|
case AFTER://超时提醒
|
|
SysConfig sysConfigAfter = commonCacheService.addSysConfigCache(SystemConstant.FLOW_JOB_AFTER_TIME);
|
|
SysConfig sysConfigAfter = commonCacheService.addSysConfigCache(SystemConstant.FLOW_JOB_AFTER_TIME);
|
|
Optional.ofNullable(sysConfigAfter).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("超时提醒任务时间未设置"));
|
|
Optional.ofNullable(sysConfigAfter).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("超时提醒任务时间未设置"));
|
|
execTime = SystemConstant.processMiniutePlus(t.getCreateTime(), Duration.ofMinutes(Long.parseLong(sysConfigAfter.getConfigValue())));
|
|
execTime = SystemConstant.processMiniutePlus(t.getCreateTime(), Duration.ofMinutes(Long.parseLong(sysConfigAfter.getConfigValue())));
|
|
- t.setExecTime(execTime);
|
|
|
|
- this.setJobTime(execTime, t.getId().toString(), t, FlowTaskQuartzJob.class, JobEnum.FLOW_TASK_REMIND_QUARTZ_JOB_GROUP);
|
|
|
|
- tsJobRemindUpdateList.add(t);
|
|
|
|
|
|
+ if (Objects.nonNull(execTime) && execTime.longValue() > System.currentTimeMillis()) {
|
|
|
|
+ t.setExecTime(execTime);
|
|
|
|
+ this.setJobTime(execTime, t.getId().toString(), t, RemindTaskJob.class, JobEnum.REMIND_QUARTZ_JOB_GROUP);
|
|
|
|
+ tsJobRemindUpdateList.add(t);
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
@@ -81,7 +85,7 @@ public class JobServiceImpl implements JobService {
|
|
}
|
|
}
|
|
} else if (Objects.nonNull(t.getEnable()) && !t.getEnable()) {
|
|
} else if (Objects.nonNull(t.getEnable()) && !t.getEnable()) {
|
|
//禁用需删除定时任务
|
|
//禁用需删除定时任务
|
|
- quartzService.deleteJob(t.getObjId().toString(), JobEnum.FLOW_TASK_REMIND_QUARTZ_JOB_GROUP.name());
|
|
|
|
|
|
+ quartzService.deleteJob(t.getObjId().toString(), JobEnum.REMIND_QUARTZ_JOB_GROUP.name());
|
|
tsJobRemindIdList.add(t.getId());
|
|
tsJobRemindIdList.add(t.getId());
|
|
}
|
|
}
|
|
}
|
|
}
|