update 调整驳回记录

This commit is contained in:
gssong 2024-12-21 13:25:26 +08:00
parent af98c10285
commit b63231fe8c
5 changed files with 36 additions and 35 deletions

View File

@ -10,6 +10,7 @@ import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.warm.flow.core.entity.Node;
import org.dromara.warm.flow.orm.entity.FlowHisTask;
import org.dromara.workflow.domain.bo.*;
import org.dromara.workflow.domain.vo.FlowHisTaskVo;
@ -176,13 +177,14 @@ public class FlwTaskController extends BaseController {
}
/**
* 获取可驳回节点
* 获取可驳回的前置节点
*
* @param instanceId 实例id
* @param definitionId 流程定义id
* @param nowNodeCode 当前节点
*/
@GetMapping("/getBackTaskNode/{instanceId}")
public R<List<FlowHisTask>> getBackTaskNode(@PathVariable Long instanceId) {
return R.ok(flwTaskService.getBackTaskNode(instanceId));
@GetMapping("/getBackTaskNode/{definitionId}/{nowNodeCode}")
public R<List<Node>> getBackTaskNode(@PathVariable Long definitionId, @PathVariable String nowNodeCode) {
return R.ok(flwTaskService.getBackTaskNode(definitionId, nowNodeCode));
}
/**

View File

@ -3,6 +3,7 @@ package org.dromara.workflow.service;
import org.dromara.common.core.domain.dto.UserDTO;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.warm.flow.core.entity.Node;
import org.dromara.warm.flow.orm.entity.FlowHisTask;
import org.dromara.warm.flow.orm.entity.FlowTask;
import org.dromara.workflow.domain.bo.*;
@ -98,12 +99,13 @@ public interface IFlwTaskService {
boolean backProcess(BackProcessBo bo);
/**
* 获取可驳回节点
* 获取可驳回的前置节点
*
* @param instanceId 实例id
* @param definitionId 流程定义id
* @param nowNodeCode 当前节点
* @return 结果
*/
List<FlowHisTask> getBackTaskNode(Long instanceId);
List<Node> getBackTaskNode(Long definitionId, String nowNodeCode);
/**
* 终止任务

View File

@ -418,32 +418,29 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
*
* @param instanceId 实例id
*/
/**
* 获取可驳回的前置节点
*
* @param definitionId 流程定义id
* @param nowNodeCode 当前节点
*/
@Override
public List<FlowHisTask> getBackTaskNode(Long instanceId) {
//运行中的节点
List<FlowTask> flowTaskList = this.selectByInstId(instanceId);
// 创建查询条件查询历史任务记录
LambdaQueryWrapper<FlowHisTask> lw = new LambdaQueryWrapper<>(FlowHisTask.class)
.select(FlowHisTask::getNodeCode, FlowHisTask::getNodeName)
.eq(FlowHisTask::getInstanceId, instanceId)
.eq(FlowHisTask::getNodeType, NodeType.BETWEEN.getKey())
.orderByDesc(FlowHisTask::getCreateTime);
List<FlowHisTask> flowHisTasks = flowHisTaskMapper.selectList(lw);
if (CollUtil.isEmpty(flowHisTasks)) {
return Collections.emptyList();
public List<Node> getBackTaskNode(Long definitionId, String nowNodeCode) {
List<Node> nodeCodes = nodeService.getByNodeCodes(Collections.singletonList(nowNodeCode), definitionId);
if (!CollUtil.isNotEmpty(nodeCodes)) {
return nodeCodes;
}
List<FlowHisTask> flowHisTasksList = new ArrayList<>(flowHisTasks.stream()
.collect(Collectors.toMap(
FlowHisTask::getNodeCode,
task -> task,
(existing, replacement) -> existing
)).values());
if (CollUtil.isNotEmpty(flowTaskList)) {
List<String> runNode = StreamUtils.toList(flowTaskList, FlowTask::getNodeCode);
return StreamUtils.filter(flowHisTasksList, e -> !runNode.contains(e.getNodeCode()));
//判断是否配置了固定驳回节点
Node node = nodeCodes.get(0);
if (StringUtils.isNotBlank(node.getAnyNodeSkip())) {
return nodeService.getByNodeCodes(Collections.singletonList(node.getAnyNodeSkip()), definitionId);
}
return flowHisTasksList;
//获取可驳回的前置节点
List<Node> nodes = nodeService.previousNodeList(definitionId, nowNodeCode);
if (CollUtil.isNotEmpty(nodes)) {
return StreamUtils.filter(nodes, e -> NodeType.BETWEEN.getKey().equals(e.getNodeType()));
}
return nodes;
}
/**

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<definition flowCode="leave4" flowName="请假申请-会签" version="1" category="1" formCustom="N" formPath="/workflow/leaveEdit/index">
<definition flowCode="leave4" flowName="请假申请-会签" version="1" category="103" formCustom="N" formPath="/workflow/leaveEdit/index">
<node nodeType="start" nodeCode="9ce8bf00-f25b-4fc6-91b8-827082fc4876" nodeName="开始" nodeRatio="0.000" coordinate="320,240|320,240" skipAnyNode="N" formCustom="N">
<skip coordinate="340,240;410,240" skipType="PASS">e90b98ef-35b4-410c-a663-bae8b7624b9f</skip>
</node>
<node nodeType="between" nodeCode="e90b98ef-35b4-410c-a663-bae8b7624b9f" nodeName="申请人" nodeRatio="0.000" coordinate="460,240|460,240" skipAnyNode="N" formCustom="N">
<skip coordinate="510,240;590,240" skipType="PASS">768b5b1a-6726-4d67-8853-4cc70d5b1045</skip>
</node>
<node nodeType="between" nodeCode="768b5b1a-6726-4d67-8853-4cc70d5b1045" nodeName="百分之60通过" permissionFlag="${userList}" nodeRatio="60.000" coordinate="640,240|640,240" skipAnyNode="N" formCustom="N">
<node nodeType="between" nodeCode="768b5b1a-6726-4d67-8853-4cc70d5b1045" nodeName="百分之60通过" permissionFlag="${userList}" nodeRatio="60.000" coordinate="640,240|640,240" skipAnyNode="N" anyNodeSkip="e90b98ef-35b4-410c-a663-bae8b7624b9f" formCustom="N">
<skip coordinate="690,240;770,240" skipType="PASS">2f9f2e21-9bcf-42a3-a07c-13037aad22d1</skip>
</node>
<node nodeType="between" nodeCode="2f9f2e21-9bcf-42a3-a07c-13037aad22d1" nodeName="全部审批通过" permissionFlag="role:1,role:3" nodeRatio="100.000" coordinate="820,240|820,240" skipAnyNode="N" formCustom="N">

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<definition flowCode="leave5" flowName="请假申请-并行会签网关" version="1" category="100" formCustom="N" formPath="/workflow/leaveEdit/index">
<definition flowCode="leave5" flowName="请假申请-并行会签网关" version="1" category="103" formCustom="N" formPath="/workflow/leaveEdit/index">
<node nodeType="start" nodeCode="ebebaf26-9cb6-497e-8119-4c9fed4c597c" nodeName="开始" nodeRatio="0.000" coordinate="300,220|300,220" skipAnyNode="N" formCustom="N">
<skip coordinate="320,220;350,220;350,220;340,220;340,220;370,220" skipType="PASS">e1b04e96-dc81-4858-a309-2fe945d2f374</skip>
</node>
@ -21,7 +21,7 @@
<skip coordinate="1050,220;1120,220" skipType="PASS">03c4d2bc-58b5-4408-a2e4-65afb046f169</skip>
</node>
<node nodeType="end" nodeCode="03c4d2bc-58b5-4408-a2e4-65afb046f169" nodeName="结束" nodeRatio="0.000" coordinate="1140,220|1140,220" skipAnyNode="N" formCustom="N"/>
<node nodeType="between" nodeCode="1e3e8d3b-18ae-4d6c-a814-ce0d724adfa4" nodeName="百分之60票签" permissionFlag="${userList}" nodeRatio="60.000" coordinate="700,120|700,120" skipAnyNode="N" formCustom="N">
<node nodeType="between" nodeCode="1e3e8d3b-18ae-4d6c-a814-ce0d724adfa4" nodeName="百分之60票签" permissionFlag="${userList}" nodeRatio="60.000" coordinate="700,120|700,120" skipAnyNode="N" anyNodeSkip="e1b04e96-dc81-4858-a309-2fe945d2f374" formCustom="N">
<skip coordinate="750,120;860,120;860,195" skipType="PASS">1a20169e-3d82-4926-a151-e2daad28de1b</skip>
</node>
</definition>