fix(sj_1.1.0-beta2): 修复判断节点执行执行,执行后续节点问题
This commit is contained in:
parent
d44ea2645b
commit
df420dc13c
@ -2,6 +2,8 @@ package com.aizuda.snailjob.server.common.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 决策节点配置
|
||||
*
|
||||
@ -32,4 +34,6 @@ public class DecisionConfig {
|
||||
*/
|
||||
private Integer defaultDecision;
|
||||
|
||||
private Map<String, Object> check;
|
||||
|
||||
}
|
||||
|
@ -29,8 +29,10 @@ import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_CONDITION_NODE_EXECUTION_ERROR;
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_DECISION_FAILED;
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_NODE_NO_REQUIRED;
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_SUCCESSOR_SKIP_EXECUTION;
|
||||
|
||||
/**
|
||||
* @author xiaowoniu
|
||||
@ -40,8 +42,7 @@ import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKF
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CallbackWorkflowExecutor extends AbstractWorkflowExecutor {
|
||||
private static final Set<Integer> NO_REQUIRED_CONFIG = Sets.newHashSet(WORKFLOW_NODE_NO_REQUIRED.getReason(),
|
||||
WORKFLOW_DECISION_FAILED.getReason());
|
||||
|
||||
private static final String CALLBACK_TIMEOUT = "10";
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
@ -63,7 +64,7 @@ public class CallbackWorkflowExecutor extends AbstractWorkflowExecutor {
|
||||
context.setOperationReason(JobOperationReasonEnum.NONE.getReason());
|
||||
context.setJobTaskStatus(JobTaskStatusEnum.SUCCESS.getStatus());
|
||||
|
||||
if (NO_REQUIRED_CONFIG.contains(context.getParentOperationReason())) {
|
||||
if (WORKFLOW_SUCCESSOR_SKIP_EXECUTION.contains(context.getParentOperationReason())) {
|
||||
// 针对无需处理的批次直接新增一个记录
|
||||
context.setTaskBatchStatus(JobTaskBatchStatusEnum.CANCEL.getStatus());
|
||||
context.setOperationReason(JobOperationReasonEnum.WORKFLOW_NODE_NO_REQUIRED.getReason());
|
||||
@ -164,7 +165,7 @@ public class CallbackWorkflowExecutor extends AbstractWorkflowExecutor {
|
||||
SnailJobLog.REMOTE.info("节点[{}]回调成功.\n回调参数:{} \n回调结果:[{}] <|>{}<|>",
|
||||
context.getWorkflowNodeId(), context.getWfContext(), context.getEvaluationResult(), jobLogMetaDTO);
|
||||
} else if (jobTaskBatch.getTaskBatchStatus() == JobTaskStatusEnum.CANCEL.getStatus()) {
|
||||
if (NO_REQUIRED_CONFIG.contains(context.getParentOperationReason())) {
|
||||
if (WORKFLOW_SUCCESSOR_SKIP_EXECUTION.contains(context.getParentOperationReason())) {
|
||||
SnailJobLog.REMOTE.warn("节点[{}]取消回调. 取消原因: 当前任务无需处理 <|>{}<|>",
|
||||
context.getWorkflowNodeId(), jobLogMetaDTO);
|
||||
} else {
|
||||
|
@ -28,9 +28,12 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_CONDITION_NODE_EXECUTION_ERROR;
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_DECISION_FAILED;
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_NODE_NO_REQUIRED;
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_SUCCESSOR_SKIP_EXECUTION;
|
||||
|
||||
/**
|
||||
* @author xiaowoniu
|
||||
@ -63,7 +66,7 @@ public class DecisionWorkflowExecutor extends AbstractWorkflowExecutor {
|
||||
|
||||
Boolean result = (Boolean) Optional.ofNullable(context.getEvaluationResult()).orElse(Boolean.FALSE);
|
||||
|
||||
if (result || (Sets.newHashSet(WORKFLOW_NODE_NO_REQUIRED.getReason(), WORKFLOW_DECISION_FAILED.getReason()).contains( context.getParentOperationReason()))) {
|
||||
if (result || (WORKFLOW_SUCCESSOR_SKIP_EXECUTION.contains( context.getParentOperationReason()))) {
|
||||
// 多个条件节点直接是或的关系,只要一个成功其他节点就取消且是无需处理状态
|
||||
taskBatchStatus = JobTaskBatchStatusEnum.CANCEL.getStatus();
|
||||
jobTaskStatus = JobTaskStatusEnum.CANCEL.getStatus();
|
||||
|
@ -17,6 +17,7 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_CONDITION_NODE_EXECUTION_ERROR;
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_DECISION_FAILED;
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_NODE_CLOSED_SKIP_EXECUTION;
|
||||
import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKFLOW_NODE_NO_REQUIRED;
|
||||
@ -31,8 +32,6 @@ import static com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum.WORKF
|
||||
@RequiredArgsConstructor
|
||||
public class JobTaskWorkflowExecutor extends AbstractWorkflowExecutor {
|
||||
|
||||
private static final Set<Integer> NO_REQUIRED_CONFIG = Sets.newHashSet(WORKFLOW_NODE_NO_REQUIRED.getReason(),
|
||||
WORKFLOW_DECISION_FAILED.getReason());
|
||||
|
||||
@Override
|
||||
public WorkflowNodeTypeEnum getWorkflowNodeType() {
|
||||
@ -57,7 +56,7 @@ public class JobTaskWorkflowExecutor extends AbstractWorkflowExecutor {
|
||||
@Override
|
||||
protected void doExecute(WorkflowExecutorContext context) {
|
||||
|
||||
if (NO_REQUIRED_CONFIG.contains(context.getParentOperationReason())) {
|
||||
if (WORKFLOW_SUCCESSOR_SKIP_EXECUTION.contains(context.getParentOperationReason())) {
|
||||
// 针对无需处理的批次直接新增一个记录
|
||||
context.setTaskBatchStatus(JobTaskBatchStatusEnum.CANCEL.getStatus());
|
||||
context.setOperationReason(JobOperationReasonEnum.WORKFLOW_NODE_NO_REQUIRED.getReason());
|
||||
|
Loading…
Reference in New Issue
Block a user