Commit d516d987 by huangfusuper

补批及sql传参功能修改

parent ce13150e
package com.byit.service.mapservice.impl;
import com.byit.job.utils.PlaceholderUtils;
import com.byit.model.JobTask;
import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.service.JobTaskRunLogService;
import com.byit.service.JobTaskService;
import com.byit.service.mapservice.TaskAndLogServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -34,6 +36,13 @@ public class TaskAndLogServerImpl implements TaskAndLogServer {
jobTaskService.removeMythJobTaskById(jobTask.getId());
//添加任务日志
JobTaskRunLogWithBLOBs jobTaskRunLog = new JobTaskRunLogWithBLOBs();
//执行快速失败时 将参数替换强行替换进去
String runParam = jobTask.getRunParam();
if (StringUtils.isNotBlank(runParam)) {
String newParam = PlaceholderUtils.formatParam(runParam);
jobTaskRunLog.setRunParams(newParam);
}
BeanUtils.copyProperties(jobTask, jobTaskRunLog);
jobTaskRunLog.setRunId(jobTask.getRunId());
jobTaskRunLog.setNodeId(jobTask.getNodeId());
......
......@@ -2,8 +2,10 @@ package com.byit.thread.helper;
import cn.hutool.core.collection.CollectionUtil;
import com.byit.enums.NodeTypeEnum;
import com.byit.enums.PlaceholderEnum;
import com.byit.enums.ScheduleTypeEnum;
import com.byit.job.WorkRoulette;
import com.byit.job.utils.DateUtil;
import com.byit.job.utils.PlaceholderUtils;
import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.model.JobTaskSchedule;
......@@ -19,6 +21,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.util.Date;
import java.util.List;
/**
......@@ -54,8 +57,10 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper {
if (ScheduleTypeEnum.NORMAL.getCode().equals(mythJobTaskSchedule.getScheduleType())) {
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();
TimerTask timerTask = null;
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