mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-17 16:56:39 +08:00
update 优化 getBackTaskNode 获取驳回节点接口 如果是委派直接返回当前节点 不允许驳回到其他节点
This commit is contained in:
parent
127eaf936c
commit
5f466fd0c4
@ -191,12 +191,12 @@ public class FlwTaskController extends BaseController {
|
||||
/**
|
||||
* 获取可驳回的前置节点
|
||||
*
|
||||
* @param definitionId 流程定义id
|
||||
* @param taskId 任务id
|
||||
* @param nowNodeCode 当前节点
|
||||
*/
|
||||
@GetMapping("/getBackTaskNode/{definitionId}/{nowNodeCode}")
|
||||
public R<List<Node>> getBackTaskNode(@PathVariable Long definitionId, @PathVariable String nowNodeCode) {
|
||||
return R.ok(flwTaskService.getBackTaskNode(definitionId, nowNodeCode));
|
||||
@GetMapping("/getBackTaskNode/{taskId}/{nowNodeCode}")
|
||||
public R<List<Node>> getBackTaskNode(@PathVariable Long taskId, @PathVariable String nowNodeCode) {
|
||||
return R.ok(flwTaskService.getBackTaskNode(taskId, nowNodeCode));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,11 +111,11 @@ public interface IFlwTaskService {
|
||||
/**
|
||||
* 获取可驳回的前置节点
|
||||
*
|
||||
* @param definitionId 流程定义id
|
||||
* @param taskId 任务id
|
||||
* @param nowNodeCode 当前节点
|
||||
* @return 结果
|
||||
*/
|
||||
List<Node> getBackTaskNode(Long definitionId, String nowNodeCode);
|
||||
List<Node> getBackTaskNode(Long taskId, String nowNodeCode);
|
||||
|
||||
/**
|
||||
* 终止任务
|
||||
|
@ -31,6 +31,7 @@ import org.dromara.warm.flow.core.dto.FlowParams;
|
||||
import org.dromara.warm.flow.core.entity.*;
|
||||
import org.dromara.warm.flow.core.enums.NodeType;
|
||||
import org.dromara.warm.flow.core.enums.SkipType;
|
||||
import org.dromara.warm.flow.core.enums.UserType;
|
||||
import org.dromara.warm.flow.core.service.*;
|
||||
import org.dromara.warm.flow.core.utils.ExpressionUtil;
|
||||
import org.dromara.warm.flow.core.utils.MapUtil;
|
||||
@ -458,22 +459,28 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
/**
|
||||
* 获取可驳回的前置节点
|
||||
*
|
||||
* @param definitionId 流程定义id
|
||||
* @param taskId 任务id
|
||||
* @param nowNodeCode 当前节点
|
||||
*/
|
||||
@Override
|
||||
public List<Node> getBackTaskNode(Long definitionId, String nowNodeCode) {
|
||||
List<Node> nodeCodes = nodeService.getByNodeCodes(Collections.singletonList(nowNodeCode), definitionId);
|
||||
public List<Node> getBackTaskNode(Long taskId, String nowNodeCode) {
|
||||
FlowTask task = flowTaskMapper.selectById(taskId);
|
||||
List<Node> nodeCodes = nodeService.getByNodeCodes(Collections.singletonList(nowNodeCode), task.getDefinitionId());
|
||||
if (!CollUtil.isNotEmpty(nodeCodes)) {
|
||||
return nodeCodes;
|
||||
}
|
||||
List<User> userList = FlowEngine.userService()
|
||||
.getByAssociateds(Collections.singletonList(task.getId()), UserType.DEPUTE.getKey());
|
||||
if (CollUtil.isNotEmpty(userList)) {
|
||||
return nodeCodes;
|
||||
}
|
||||
//判断是否配置了固定驳回节点
|
||||
Node node = nodeCodes.get(0);
|
||||
if (StringUtils.isNotBlank(node.getAnyNodeSkip())) {
|
||||
return nodeService.getByNodeCodes(Collections.singletonList(node.getAnyNodeSkip()), definitionId);
|
||||
return nodeService.getByNodeCodes(Collections.singletonList(node.getAnyNodeSkip()), task.getDefinitionId());
|
||||
}
|
||||
//获取可驳回的前置节点
|
||||
List<Node> nodes = nodeService.previousNodeList(definitionId, nowNodeCode);
|
||||
List<Node> nodes = nodeService.previousNodeList(task.getDefinitionId(), nowNodeCode);
|
||||
if (CollUtil.isNotEmpty(nodes)) {
|
||||
return StreamUtils.filter(nodes, e -> NodeType.BETWEEN.getKey().equals(e.getNodeType()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user