|
@@ -259,15 +259,6 @@ public class FlowEngineServiceImpl implements FlowEngineService {
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private List<Long> calculateSubNodeAssignees(SubNodeConfig subNode, FlowNode parentNode, ProcessInstance instance) {
|
|
|
|
|
- String assigneeValue = subNode.getAssigneeValue();
|
|
|
|
|
- if (assigneeValue == null || assigneeValue.isBlank()) {
|
|
|
|
|
- // 子节点未配置审批人时,回退到父节点配置
|
|
|
|
|
- return this.calculateAssignees(parentNode, instance);
|
|
|
|
|
- }
|
|
|
|
|
- return this.doCalculateAssignees(ASSIGNEE_TYPE_ROLE, assigneeValue, instance);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private String getSubNodeApproveMode(SubNodeConfig subNode) {
|
|
private String getSubNodeApproveMode(SubNodeConfig subNode) {
|
|
|
String mode = subNode.getApproveMode();
|
|
String mode = subNode.getApproveMode();
|
|
|
return mode != null ? mode : "or";
|
|
return mode != null ? mode : "or";
|
|
@@ -912,8 +903,24 @@ public class FlowEngineServiceImpl implements FlowEngineService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void createSubNodeTask(ProcessInstance instance, FlowNode parentNode, SubNodeConfig subNode, FlowModel model) {
|
|
private void createSubNodeTask(ProcessInstance instance, FlowNode parentNode, SubNodeConfig subNode, FlowModel model) {
|
|
|
- List<Long> assignees = this.calculateSubNodeAssignees(subNode, parentNode, instance);
|
|
|
|
|
- String taskAssigneeType = ASSIGNEE_TYPE_ROLE;
|
|
|
|
|
|
|
+ String subAssigneeType = subNode.getAssigneeType();
|
|
|
|
|
+ if (subAssigneeType == null || subAssigneeType.isBlank()) {
|
|
|
|
|
+ subAssigneeType = ASSIGNEE_TYPE_ROLE;
|
|
|
|
|
+ }
|
|
|
|
|
+ String subAssigneeValue = subNode.getAssigneeValue();
|
|
|
|
|
+ List<Long> assignees;
|
|
|
|
|
+ String taskAssigneeType;
|
|
|
|
|
+ if ("SELF".equals(subAssigneeType)) {
|
|
|
|
|
+ assignees = this.doCalculateAssignees("SELF", null, instance);
|
|
|
|
|
+ taskAssigneeType = ASSIGNEE_TYPE_USER;
|
|
|
|
|
+ } else if (subAssigneeValue != null && !subAssigneeValue.isBlank()) {
|
|
|
|
|
+ assignees = this.doCalculateAssignees(subAssigneeType, subAssigneeValue, instance);
|
|
|
|
|
+ taskAssigneeType = "USER".equals(subAssigneeType) ? ASSIGNEE_TYPE_USER : ASSIGNEE_TYPE_ROLE;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 子节点未配置审批人时,回退到父节点配置
|
|
|
|
|
+ assignees = this.calculateAssignees(parentNode, instance);
|
|
|
|
|
+ taskAssigneeType = this.getNodeAssigneeType(parentNode);
|
|
|
|
|
+ }
|
|
|
if (assignees.isEmpty()) {
|
|
if (assignees.isEmpty()) {
|
|
|
assignees = Collections.singletonList(instance.getApplicantId());
|
|
assignees = Collections.singletonList(instance.getApplicantId());
|
|
|
taskAssigneeType = ASSIGNEE_TYPE_USER;
|
|
taskAssigneeType = ASSIGNEE_TYPE_USER;
|
|
@@ -931,6 +938,16 @@ public class FlowEngineServiceImpl implements FlowEngineService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private String getNodeAssigneeType(FlowNode node) {
|
|
|
|
|
+ Map<String, Object> props = node.getProperties();
|
|
|
|
|
+ if (props == null) {
|
|
|
|
|
+ return ASSIGNEE_TYPE_ROLE;
|
|
|
|
|
+ }
|
|
|
|
|
+ Object typeObj = props.get("assigneeType");
|
|
|
|
|
+ String type = typeObj != null ? typeObj.toString() : ASSIGNEE_TYPE_ROLE;
|
|
|
|
|
+ return ("SELF".equals(type) || "USER".equals(type)) ? ASSIGNEE_TYPE_USER : ASSIGNEE_TYPE_ROLE;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 处理子节点审批通过。
|
|
* 处理子节点审批通过。
|
|
|
* 返回 true 表示父节点已可继续推进主流程;false 表示仍需等待其他子节点。
|
|
* 返回 true 表示父节点已可继续推进主流程;false 表示仍需等待其他子节点。
|