feat: 2.6.0
1. 修复修复回调执行失败流程阻塞问题 2. 修复条件节点判断问题
This commit is contained in:
parent
324dd3fd97
commit
9c37879386
@ -483,7 +483,7 @@ CREATE TABLE `workflow_node`
|
|||||||
`workflow_id` bigint(20) NOT NULL COMMENT '工作流ID',
|
`workflow_id` bigint(20) NOT NULL COMMENT '工作流ID',
|
||||||
`node_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1、任务节点 2、条件节点',
|
`node_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1、任务节点 2、条件节点',
|
||||||
`expression_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1、SpEl、2、Aviator 3、QL',
|
`expression_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1、SpEl、2、Aviator 3、QL',
|
||||||
`fail_strategy` tinyint(4) NOT NULL DEFAULT 0 COMMENT '失败策略 1、跳过 2、阻塞',
|
`fail_strategy` tinyint(4) NOT NULL DEFAULT 1 COMMENT '失败策略 1、跳过 2、阻塞',
|
||||||
`workflow_node_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '工作流节点状态 0、关闭、1、开启',
|
`workflow_node_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '工作流节点状态 0、关闭、1、开启',
|
||||||
`priority_level` int(11) NOT NULL DEFAULT 1 COMMENT '优先级',
|
`priority_level` int(11) NOT NULL DEFAULT 1 COMMENT '优先级',
|
||||||
`node_info` text DEFAULT NULL COMMENT '节点信息 ',
|
`node_info` text DEFAULT NULL COMMENT '节点信息 ',
|
||||||
|
@ -111,9 +111,7 @@ public class CallbackWorkflowExecutor extends AbstractWorkflowExecutor {
|
|||||||
message = throwable.getMessage();
|
message = throwable.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JobTaskBatchStatusEnum.SUCCESS.getStatus() == taskBatchStatus) {
|
workflowTaskExecutor(context);
|
||||||
workflowTaskExecutor(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.setTaskBatchStatus(taskBatchStatus);
|
context.setTaskBatchStatus(taskBatchStatus);
|
||||||
context.setOperationReason(operationReason);
|
context.setOperationReason(operationReason);
|
||||||
|
@ -66,8 +66,6 @@ public class ConditionWorkflowExecutor extends AbstractWorkflowExecutor {
|
|||||||
jobTaskStatus = JobTaskStatusEnum.CANCEL.getStatus();
|
jobTaskStatus = JobTaskStatusEnum.CANCEL.getStatus();
|
||||||
operationReason = JobOperationReasonEnum.WORKFLOW_NODE_NO_OPERATION_REQUIRED.getReason();
|
operationReason = JobOperationReasonEnum.WORKFLOW_NODE_NO_OPERATION_REQUIRED.getReason();
|
||||||
} else {
|
} else {
|
||||||
boolean tempResult = Boolean.TRUE;
|
|
||||||
|
|
||||||
DecisionConfig decisionConfig = JsonUtil.parseObject(context.getNodeInfo(), DecisionConfig.class);
|
DecisionConfig decisionConfig = JsonUtil.parseObject(context.getNodeInfo(), DecisionConfig.class);
|
||||||
if (StatusEnum.NO.getStatus().equals(decisionConfig.getDefaultDecision())) {
|
if (StatusEnum.NO.getStatus().equals(decisionConfig.getDefaultDecision())) {
|
||||||
try {
|
try {
|
||||||
@ -80,11 +78,16 @@ public class ConditionWorkflowExecutor extends AbstractWorkflowExecutor {
|
|||||||
.select(JobTask::getResultMessage)
|
.select(JobTask::getResultMessage)
|
||||||
.eq(JobTask::getTaskBatchId, context.getTaskBatchId()));
|
.eq(JobTask::getTaskBatchId, context.getTaskBatchId()));
|
||||||
|
|
||||||
|
Boolean tempResult = null;
|
||||||
List<String> taskResult = Lists.newArrayList();
|
List<String> taskResult = Lists.newArrayList();
|
||||||
for (JobTask jobTask : jobTasks) {
|
for (JobTask jobTask : jobTasks) {
|
||||||
taskResult.add(jobTask.getResultMessage());
|
taskResult.add(jobTask.getResultMessage());
|
||||||
boolean execResult = (Boolean) Optional.ofNullable(expressionEngine.eval(decisionConfig.getNodeExpression(), jobTask.getResultMessage())).orElse(Boolean.FALSE);
|
boolean execResult = (Boolean) Optional.ofNullable(expressionEngine.eval(decisionConfig.getNodeExpression(), jobTask.getResultMessage())).orElse(Boolean.FALSE);
|
||||||
|
|
||||||
|
if (Objects.isNull(tempResult)) {
|
||||||
|
tempResult = execResult;
|
||||||
|
}
|
||||||
|
|
||||||
if (Objects.equals(decisionConfig.getLogicalCondition(), LogicalConditionEnum.AND.getCode())) {
|
if (Objects.equals(decisionConfig.getLogicalCondition(), LogicalConditionEnum.AND.getCode())) {
|
||||||
tempResult = tempResult && execResult;
|
tempResult = tempResult && execResult;
|
||||||
} else {
|
} else {
|
||||||
@ -98,7 +101,7 @@ public class ConditionWorkflowExecutor extends AbstractWorkflowExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
context.setTaskResult(JsonUtil.toJsonString(taskResult));
|
context.setTaskResult(JsonUtil.toJsonString(taskResult));
|
||||||
result = tempResult;
|
result = Optional.ofNullable(tempResult).orElse(Boolean.FALSE);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("执行条件表达式解析异常. 表达式:[{}],参数: [{}]", decisionConfig.getNodeExpression(), context.getTaskResult(), e);
|
log.error("执行条件表达式解析异常. 表达式:[{}],参数: [{}]", decisionConfig.getNodeExpression(), context.getTaskResult(), e);
|
||||||
taskBatchStatus = JobTaskBatchStatusEnum.FAIL.getStatus();
|
taskBatchStatus = JobTaskBatchStatusEnum.FAIL.getStatus();
|
||||||
@ -142,11 +145,11 @@ public class ConditionWorkflowExecutor extends AbstractWorkflowExecutor {
|
|||||||
logMetaDTO.setTaskId(jobTask.getId());
|
logMetaDTO.setTaskId(jobTask.getId());
|
||||||
if (jobTaskBatch.getTaskBatchStatus() == JobTaskStatusEnum.SUCCESS.getStatus()
|
if (jobTaskBatch.getTaskBatchStatus() == JobTaskStatusEnum.SUCCESS.getStatus()
|
||||||
|| JobOperationReasonEnum.WORKFLOW_NODE_NO_OPERATION_REQUIRED.getReason() == context.getOperationReason()) {
|
|| JobOperationReasonEnum.WORKFLOW_NODE_NO_OPERATION_REQUIRED.getReason() == context.getOperationReason()) {
|
||||||
EasyRetryLog.REMOTE.info("workflowNodeId:[{}]决策完成. 决策结果:[{}] <|>{}<|>",
|
EasyRetryLog.REMOTE.info("workflowNodeId:[{}]决策完成. 上下文:[{}] 决策结果:[{}] <|>{}<|>",
|
||||||
context.getWorkflowNodeId(), context.getEvaluationResult(), logMetaDTO);
|
context.getWorkflowNodeId(), context.getTaskResult(), context.getEvaluationResult(), logMetaDTO);
|
||||||
} else {
|
} else {
|
||||||
EasyRetryLog.REMOTE.error("workflowNodeId:[{}] 决策失败. 失败原因:[{}] <|>{}<|>", context.getWorkflowNodeId(),
|
EasyRetryLog.REMOTE.error("workflowNodeId:[{}] 决策失败. 上下文:[{}] 失败原因:[{}] <|>{}<|>",
|
||||||
context.getLogMessage(), logMetaDTO);
|
context.getWorkflowNodeId(), context.getTaskResult(), context.getLogMessage(), logMetaDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user