!1234 BPM-办理人

Merge pull request !1234 from Lesan/feature/bpm-办理人
This commit is contained in:
芋道源码 2025-02-15 00:37:30 +00:00 committed by Gitee
commit 04fc7404e1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 38 additions and 3 deletions

View File

@ -85,6 +85,9 @@ public class BpmTaskRespVO {
@Schema(description = "是否填写审批意见", example = "false")
private Boolean reasonRequire;
@Schema(description = "节点类型", example = "10") // 只有Simple设计器的场景下才会使用此字段
private Integer nodeType;
@Data
@Schema(description = "流程实例")
public static class ProcessInstance {

View File

@ -129,4 +129,9 @@ public interface BpmnModelConstants {
*/
String REASON_REQUIRE = "reasonRequire";
/**
* 节点类型
*/
String NODE_TYPE = "nodeType";
}

View File

@ -410,6 +410,26 @@ public class BpmnModelUtils {
return parseExtensionElement(flowElement, TRIGGER_PARAM);
}
/**
* 给节点添加节点类型
*
* @param nodeType 节点类型
* @param flowElement 节点
*/
public static void addNodeType(Integer nodeType, FlowElement flowElement) {
addExtensionElement(flowElement, BpmnModelConstants.NODE_TYPE, nodeType);
}
/**
* 解析节点类型
*
* @param flowElement 节点
* @return 节点类型
*/
public static Integer parseNodeType(FlowElement flowElement) {
return NumberUtils.parseInt(parseExtensionElement(flowElement, BpmnModelConstants.NODE_TYPE));
}
// ========== BPM 简单查找相关的方法 ==========
/**

View File

@ -445,6 +445,8 @@ public class SimpleModelUtils {
addSignEnable(node.getSignEnable(), userTask);
// 审批意见
addReasonRequire(node.getReasonRequire(), userTask);
// 节点类型
addNodeType(node.getType(), userTask);
return userTask;
}

View File

@ -67,6 +67,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
import static cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO.ActivityNode;
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID;
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseNodeType;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.flowable.bpmn.constants.BpmnXMLConstants.*;
@ -325,7 +326,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
ActivityNode activityNode = new ActivityNode().setId(task.getTaskDefinitionKey()).setName(task.getName())
.setNodeType(START_USER_NODE_ID.equals(task.getTaskDefinitionKey())
? BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType()
: BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType())
: ObjectUtil.isNull(parseNodeType(flowNode)) ?
BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType() : parseNodeType(flowNode))
.setStatus(FlowableUtils.getTaskStatus(task))
.setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode))
.setStartTime(DateUtils.of(task.getCreateTime())).setEndTime(DateUtils.of(task.getEndTime()))
@ -402,7 +404,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
HistoricActivityInstance firstActivity = CollUtil.getFirst(taskActivities); // 取第一个任务会签/或签的任务开始时间相同
ActivityNode activityNode = new ActivityNode().setId(firstActivity.getActivityId())
.setName(firstActivity.getActivityName())
.setNodeType(BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType())
.setNodeType(ObjectUtil.isNull(parseNodeType(flowNode)) ?
BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType() : parseNodeType(flowNode))
.setStatus(BpmTaskStatusEnum.RUNNING.getStatus())
.setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode))
.setStartTime(DateUtils.of(CollUtil.getFirst(taskActivities).getStartTime()))

View File

@ -162,6 +162,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
bpmnModel, todoTask.getTaskDefinitionKey());
Boolean signEnable = parseSignEnable(bpmnModel, todoTask.getTaskDefinitionKey());
Boolean reasonRequire = parseReasonRequire(bpmnModel, todoTask.getTaskDefinitionKey());
Integer nodeType = parseNodeType(BpmnModelUtils.getFlowElementById(bpmnModel, todoTask.getTaskDefinitionKey()));
// 4. 任务表单
BpmFormDO taskForm = null;
@ -171,7 +172,8 @@ public class BpmTaskServiceImpl implements BpmTaskService {
return BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm)
.setSignEnable(signEnable)
.setReasonRequire(reasonRequire);
.setReasonRequire(reasonRequire)
.setNodeType(nodeType);
}
@Override