mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
fix:更新获取可驳回的前置节点,根据流程变量过滤
This commit is contained in:
parent
8136a0191a
commit
c7c0a3d6bc
@ -64,6 +64,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.dromara.workflow.common.constant.FlowConstant.*;
|
import static org.dromara.workflow.common.constant.FlowConstant.*;
|
||||||
|
|
||||||
@ -544,27 +545,31 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
|||||||
return nodeService.getByNodeCodes(Collections.singletonList(node.getAnyNodeSkip()), task.getDefinitionId());
|
return nodeService.getByNodeCodes(Collections.singletonList(node.getAnyNodeSkip()), task.getDefinitionId());
|
||||||
}
|
}
|
||||||
//获取可驳回的前置节点
|
//获取可驳回的前置节点
|
||||||
List<Node> nodes = nodeService.previousNodeList(task.getDefinitionId(), nowNodeCode);
|
Instance instance = insService.getById(task.getInstanceId());
|
||||||
List<HisTask> hisTaskList = hisTaskService.getByInsId(task.getInstanceId());
|
List<Node> allPreNodes = nodeService.previousNodeList(task.getDefinitionId(), nowNodeCode);
|
||||||
|
Node startNode = nodeService.getStartNode(task.getDefinitionId());
|
||||||
|
List<Node> allPreNodes2 = new ArrayList<>();
|
||||||
|
getBackTaskNodes(allPreNodes2, instance, CollUtil.toList(startNode));
|
||||||
|
List<Node> nodes = allPreNodes.stream().filter(allPreNodes2::contains).collect(Collectors.toList());
|
||||||
|
|
||||||
Map<String, Node> nodeMap = StreamUtils.toIdentityMap(nodes, Node::getNodeCode);
|
if (CollUtil.isNotEmpty(nodes)) {
|
||||||
Set<String> added = new HashSet<>();
|
return StreamUtils.filter(nodes, e -> NodeType.BETWEEN.getKey().equals(e.getNodeType()));
|
||||||
List<Node> backNodeList = new ArrayList<>();
|
|
||||||
for (HisTask hisTask : hisTaskList) {
|
|
||||||
Node nodeValue = nodeMap.get(hisTask.getNodeCode());
|
|
||||||
if (nodeValue != null
|
|
||||||
&& NodeType.BETWEEN.getKey().equals(nodeValue.getNodeType())
|
|
||||||
&& added.add(nodeValue.getNodeCode())) {
|
|
||||||
backNodeList.add(nodeValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (CollUtil.isNotEmpty(backNodeList)) {
|
|
||||||
Collections.reverse(backNodeList);
|
|
||||||
return backNodeList;
|
|
||||||
}
|
}
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getBackTaskNodes(List<Node> nodes, Instance instance, List<Node> startNodes) {
|
||||||
|
nodes.addAll(startNodes);
|
||||||
|
for (Node startNode : startNodes) {
|
||||||
|
try {
|
||||||
|
List<Node> temp = nodeService.getNextNodeList(instance.getDefinitionId(), startNode.getNodeCode(), null, SkipType.PASS.getKey(), instance.getVariableMap());
|
||||||
|
getBackTaskNodes(nodes, instance, temp);
|
||||||
|
}catch(Exception e){
|
||||||
|
// log.info();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 终止任务
|
* 终止任务
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user