Commit d516d987 by huangfusuper

补批及sql传参功能修改

parent ce13150e
package com.byit.service.mapservice.impl; package com.byit.service.mapservice.impl;
import com.byit.job.utils.PlaceholderUtils;
import com.byit.model.JobTask; import com.byit.model.JobTask;
import com.byit.model.JobTaskRunLogWithBLOBs; import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.service.JobTaskRunLogService; import com.byit.service.JobTaskRunLogService;
import com.byit.service.JobTaskService; import com.byit.service.JobTaskService;
import com.byit.service.mapservice.TaskAndLogServer; import com.byit.service.mapservice.TaskAndLogServer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -34,6 +36,13 @@ public class TaskAndLogServerImpl implements TaskAndLogServer { ...@@ -34,6 +36,13 @@ public class TaskAndLogServerImpl implements TaskAndLogServer {
jobTaskService.removeMythJobTaskById(jobTask.getId()); jobTaskService.removeMythJobTaskById(jobTask.getId());
//添加任务日志 //添加任务日志
JobTaskRunLogWithBLOBs jobTaskRunLog = new JobTaskRunLogWithBLOBs(); JobTaskRunLogWithBLOBs jobTaskRunLog = new JobTaskRunLogWithBLOBs();
//执行快速失败时 将参数替换强行替换进去
String runParam = jobTask.getRunParam();
if (StringUtils.isNotBlank(runParam)) {
String newParam = PlaceholderUtils.formatParam(runParam);
jobTaskRunLog.setRunParams(newParam);
}
BeanUtils.copyProperties(jobTask, jobTaskRunLog); BeanUtils.copyProperties(jobTask, jobTaskRunLog);
jobTaskRunLog.setRunId(jobTask.getRunId()); jobTaskRunLog.setRunId(jobTask.getRunId());
jobTaskRunLog.setNodeId(jobTask.getNodeId()); jobTaskRunLog.setNodeId(jobTask.getNodeId());
......
...@@ -2,8 +2,10 @@ package com.byit.thread.helper; ...@@ -2,8 +2,10 @@ package com.byit.thread.helper;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.byit.enums.NodeTypeEnum; import com.byit.enums.NodeTypeEnum;
import com.byit.enums.PlaceholderEnum;
import com.byit.enums.ScheduleTypeEnum; import com.byit.enums.ScheduleTypeEnum;
import com.byit.job.WorkRoulette; import com.byit.job.WorkRoulette;
import com.byit.job.utils.DateUtil;
import com.byit.job.utils.PlaceholderUtils; import com.byit.job.utils.PlaceholderUtils;
import com.byit.model.JobTaskRunLogWithBLOBs; import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.model.JobTaskSchedule; import com.byit.model.JobTaskSchedule;
...@@ -19,6 +21,7 @@ import org.springframework.beans.BeanUtils; ...@@ -19,6 +21,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -54,8 +57,10 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper { ...@@ -54,8 +57,10 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper {
if (ScheduleTypeEnum.NORMAL.getCode().equals(mythJobTaskSchedule.getScheduleType())) { if (ScheduleTypeEnum.NORMAL.getCode().equals(mythJobTaskSchedule.getScheduleType())) {
mythJobTaskSchedule.setRunParam(PlaceholderUtils.formatParam(mythJobTaskSchedule.getRunParam())); mythJobTaskSchedule.setRunParam(PlaceholderUtils.formatParam(mythJobTaskSchedule.getRunParam()));
} }
String command = mythJobTaskSchedule.getRunCommand();
assert command != null;
command.replace("${"+ PlaceholderEnum.DATE_PLACEHOLDER.getName()+"}", DateUtil.dateLessDayStr(new Date(),"yyyyMMdd",1));
mythJobTaskSchedule.setRunCommand(command);
Long triggerTime = mythJobTaskSchedule.getTriggerTime(); Long triggerTime = mythJobTaskSchedule.getTriggerTime();
TimerTask timerTask = null; TimerTask timerTask = null;
if (NodeTypeEnum.JAVA.getType().equals(mythJobTaskSchedule.getJobType())) { if (NodeTypeEnum.JAVA.getType().equals(mythJobTaskSchedule.getJobType())) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment