fix:【BPM 工作流】修复子流程发起人为列表时实际发起人会变成主流程发起人 https://gitee.com/zhijiantianya/yudao-cloud/issues/ICNHA8

This commit is contained in:
YunaiV
2025-07-22 23:59:20 +08:00
parent 989c4e4b88
commit 376114a874
2 changed files with 11 additions and 6 deletions

View File

@@ -448,7 +448,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
.setNodeType(BpmSimpleModelNodeTypeEnum.CHILD_PROCESS.getType()).setStatus(processInstanceStatus) .setNodeType(BpmSimpleModelNodeTypeEnum.CHILD_PROCESS.getType()).setStatus(processInstanceStatus)
.setStartTime(DateUtils.of(activity.getStartTime())) .setStartTime(DateUtils.of(activity.getStartTime()))
.setEndTime(DateUtils.of(activity.getEndTime())) .setEndTime(DateUtils.of(activity.getEndTime()))
.setProcessInstanceId(activity.getProcessInstanceId()); .setProcessInstanceId(activity.getCalledProcessInstanceId());
approvalNodes.add(callActivity); approvalNodes.add(callActivity);
} }
}); });
@@ -520,7 +520,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
activityNode.setCandidateUserIds(CollUtil.sub(candidateUserIds, index + 1, candidateUserIds.size())); activityNode.setCandidateUserIds(CollUtil.sub(candidateUserIds, index + 1, candidateUserIds.size()));
} }
if (BpmSimpleModelNodeTypeEnum.CHILD_PROCESS.getType().equals(activityNode.getNodeType())) { if (BpmSimpleModelNodeTypeEnum.CHILD_PROCESS.getType().equals(activityNode.getNodeType())) {
activityNode.setProcessInstanceId(firstActivity.getProcessInstanceId()); activityNode.setProcessInstanceId(firstActivity.getCalledProcessInstanceId());
} }
return activityNode; return activityNode;
}); });

View File

@@ -85,10 +85,15 @@ public class BpmCallActivityListener implements ExecutionListener {
// 2.2 使用表单值,并兜底字符串转 Long 失败时使用主流程发起人 // 2.2 使用表单值,并兜底字符串转 Long 失败时使用主流程发起人
try { try {
FlowableUtils.setAuthenticatedUserId(Long.parseLong(formFieldValue)); FlowableUtils.setAuthenticatedUserId(Long.parseLong(formFieldValue));
} catch (Exception e) { } catch (NumberFormatException ex) {
log.error("[notify][监听器:{},子流程监听器设置流程的发起人字符串转 Long 失败,字符串:{}]", try {
DELEGATE_EXPRESSION, formFieldValue); List<Long> formFieldValues = JsonUtils.parseArray(formFieldValue, Long.class);
FlowableUtils.setAuthenticatedUserId(Long.parseLong(processInstance.getStartUserId())); FlowableUtils.setAuthenticatedUserId(formFieldValues.get(0));
} catch (Exception e) {
log.error("[notify][监听器:{},子流程监听器设置流程的发起人字符串转 Long 失败,字符串:{}]",
DELEGATE_EXPRESSION, formFieldValue);
FlowableUtils.setAuthenticatedUserId(Long.parseLong(processInstance.getStartUserId()));
}
} }
} }
} }