1
This commit is contained in:
parent
0a249161dd
commit
9f72d03a38
@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.qqchen.deploy.backend.workflow.constants.WorkFlowConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.bpmn.model.ServiceTask;
|
||||
import org.flowable.engine.delegate.BpmnError;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.flowable.engine.delegate.JavaDelegate;
|
||||
@ -27,17 +28,19 @@ import java.util.Optional;
|
||||
public abstract class BaseNodeDelegate<P, L> implements JavaDelegate {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
// 字段注入,由Flowable自动设置
|
||||
protected Expression panelVariables;
|
||||
|
||||
protected Expression localVariables;
|
||||
|
||||
@Override
|
||||
public void execute(DelegateExecution execution) {
|
||||
try {
|
||||
// 在节点执行前,清除前一个节点的状态
|
||||
clearPreviousNodeStatus(execution);
|
||||
// 获取并转换Panel变量
|
||||
P panelVars = null;
|
||||
if (panelVariables != null) {
|
||||
@ -104,6 +107,15 @@ public abstract class BaseNodeDelegate<P, L> implements JavaDelegate {
|
||||
*/
|
||||
protected abstract void executeInternal(DelegateExecution execution, P panelVariables, L localVariables);
|
||||
|
||||
/**
|
||||
* 清除前一个节点的状态
|
||||
*/
|
||||
private void clearPreviousNodeStatus(DelegateExecution execution) {
|
||||
// 只有在当前节点是ServiceTask时才清除状态
|
||||
execution.removeVariable(WORKFLOW_PREVIOUS_NODE_EXECUTION_STATUS_VARIABLE_NAME);
|
||||
log.debug("Cleared previous node status for node: {}", execution.getCurrentActivityId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取执行状态
|
||||
*
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.qqchen.deploy.backend.workflow.listener.execution;
|
||||
|
||||
import com.qqchen.deploy.backend.workflow.constants.WorkFlowConstants;
|
||||
import com.qqchen.deploy.backend.workflow.enums.WorkflowNodeInstanceStatusEnums;
|
||||
import com.qqchen.deploy.backend.workflow.event.WorkflowNodeInstanceStatusChangeEvent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -52,9 +53,13 @@ public class GlobalExecutionListener implements ExecutionListener {
|
||||
.orElse(null);
|
||||
if (StringUtils.isEmpty(nodeExecutionStatus)) {
|
||||
status = WorkflowNodeInstanceStatusEnums.COMPLETED;
|
||||
} else {
|
||||
if (WorkFlowConstants.WORKFLOW_NODE_EXECUTION_STATUS_SUCCESS.equals(nodeExecutionStatus)) {
|
||||
status = WorkflowNodeInstanceStatusEnums.COMPLETED;
|
||||
} else {
|
||||
status = WorkflowNodeInstanceStatusEnums.FAILED;
|
||||
}
|
||||
}
|
||||
endTime = now;
|
||||
break;
|
||||
default:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user