fix: 添加节点类型以区分不同节点
This commit is contained in:
parent
e5aede6265
commit
7cf55c5300
|
@ -129,4 +129,9 @@ public interface BpmnModelConstants {
|
||||||
*/
|
*/
|
||||||
String REASON_REQUIRE = "reasonRequire";
|
String REASON_REQUIRE = "reasonRequire";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点类型
|
||||||
|
*/
|
||||||
|
String NODE_TYPE = "nodeType";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,6 +410,26 @@ public class BpmnModelUtils {
|
||||||
return parseExtensionElement(flowElement, TRIGGER_PARAM);
|
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 简单查找相关的方法 ==========
|
// ========== BPM 简单查找相关的方法 ==========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -445,6 +445,8 @@ public class SimpleModelUtils {
|
||||||
addSignEnable(node.getSignEnable(), userTask);
|
addSignEnable(node.getSignEnable(), userTask);
|
||||||
// 审批意见
|
// 审批意见
|
||||||
addReasonRequire(node.getReasonRequire(), userTask);
|
addReasonRequire(node.getReasonRequire(), userTask);
|
||||||
|
// 节点类型
|
||||||
|
addNodeType(node.getType(), userTask);
|
||||||
return userTask;
|
return userTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.controller.admin.task.vo.instance.BpmApprovalDetailRespVO.ActivityNode;
|
||||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
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.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.Arrays.asList;
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
import static org.flowable.bpmn.constants.BpmnXMLConstants.*;
|
import static org.flowable.bpmn.constants.BpmnXMLConstants.*;
|
||||||
|
@ -325,7 +326,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
||||||
ActivityNode activityNode = new ActivityNode().setId(task.getTaskDefinitionKey()).setName(task.getName())
|
ActivityNode activityNode = new ActivityNode().setId(task.getTaskDefinitionKey()).setName(task.getName())
|
||||||
.setNodeType(START_USER_NODE_ID.equals(task.getTaskDefinitionKey())
|
.setNodeType(START_USER_NODE_ID.equals(task.getTaskDefinitionKey())
|
||||||
? BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType()
|
? BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType()
|
||||||
: BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType())
|
: parseNodeType(flowNode))
|
||||||
.setStatus(FlowableUtils.getTaskStatus(task))
|
.setStatus(FlowableUtils.getTaskStatus(task))
|
||||||
.setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode))
|
.setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode))
|
||||||
.setStartTime(DateUtils.of(task.getCreateTime())).setEndTime(DateUtils.of(task.getEndTime()))
|
.setStartTime(DateUtils.of(task.getCreateTime())).setEndTime(DateUtils.of(task.getEndTime()))
|
||||||
|
@ -402,7 +403,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
||||||
HistoricActivityInstance firstActivity = CollUtil.getFirst(taskActivities); // 取第一个任务,会签/或签的任务,开始时间相同
|
HistoricActivityInstance firstActivity = CollUtil.getFirst(taskActivities); // 取第一个任务,会签/或签的任务,开始时间相同
|
||||||
ActivityNode activityNode = new ActivityNode().setId(firstActivity.getActivityId())
|
ActivityNode activityNode = new ActivityNode().setId(firstActivity.getActivityId())
|
||||||
.setName(firstActivity.getActivityName())
|
.setName(firstActivity.getActivityName())
|
||||||
.setNodeType(BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType())
|
.setNodeType(parseNodeType(flowNode))
|
||||||
.setStatus(BpmTaskStatusEnum.RUNNING.getStatus())
|
.setStatus(BpmTaskStatusEnum.RUNNING.getStatus())
|
||||||
.setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode))
|
.setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode))
|
||||||
.setStartTime(DateUtils.of(CollUtil.getFirst(taskActivities).getStartTime()))
|
.setStartTime(DateUtils.of(CollUtil.getFirst(taskActivities).getStartTime()))
|
||||||
|
|
Loading…
Reference in New Issue