mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 09:35:29 +08:00
Pre Merge pull request !861 from 描述不符/5.X
This commit is contained in:
commit
bf3ec966d1
@ -38,6 +38,7 @@ import org.dromara.warm.flow.core.enums.UserType;
|
|||||||
import org.dromara.warm.flow.core.service.*;
|
import org.dromara.warm.flow.core.service.*;
|
||||||
import org.dromara.warm.flow.core.utils.ExpressionUtil;
|
import org.dromara.warm.flow.core.utils.ExpressionUtil;
|
||||||
import org.dromara.warm.flow.core.utils.MapUtil;
|
import org.dromara.warm.flow.core.utils.MapUtil;
|
||||||
|
import org.dromara.warm.flow.core.constant.ExceptionCons;
|
||||||
import org.dromara.warm.flow.orm.entity.*;
|
import org.dromara.warm.flow.orm.entity.*;
|
||||||
import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper;
|
import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper;
|
||||||
import org.dromara.warm.flow.orm.mapper.FlowInstanceMapper;
|
import org.dromara.warm.flow.orm.mapper.FlowInstanceMapper;
|
||||||
@ -46,6 +47,7 @@ import org.dromara.warm.flow.orm.mapper.FlowTaskMapper;
|
|||||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
import org.dromara.workflow.common.enums.TaskAssigneeType;
|
import org.dromara.workflow.common.enums.TaskAssigneeType;
|
||||||
import org.dromara.workflow.common.enums.TaskOperationEnum;
|
import org.dromara.workflow.common.enums.TaskOperationEnum;
|
||||||
|
import org.dromara.warm.flow.core.exception.FlowException;
|
||||||
import org.dromara.workflow.common.enums.TaskStatusEnum;
|
import org.dromara.workflow.common.enums.TaskStatusEnum;
|
||||||
import org.dromara.workflow.domain.FlowInstanceBizExt;
|
import org.dromara.workflow.domain.FlowInstanceBizExt;
|
||||||
import org.dromara.workflow.domain.bo.*;
|
import org.dromara.workflow.domain.bo.*;
|
||||||
@ -64,6 +66,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 +547,34 @@ 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(FlowException e){
|
||||||
|
// 仅放行条件缺失异常
|
||||||
|
if(!ExceptionCons.NULL_CONDITION_VALUE.equals(e.getMessage())){
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 终止任务
|
* 终止任务
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user