Commit e11529375ef1e52c548597d12271c7ddb9fb9437
1 parent
45a72f4c
feat: 审批时查询下一个节点的类型是否为自选审批人是否已选择了审批人,否则由前端传递
Showing
3 changed files
with
8 additions
and
4 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskApproveReqVO.java
| @@ -24,7 +24,7 @@ public class BpmTaskApproveReqVO { | @@ -24,7 +24,7 @@ public class BpmTaskApproveReqVO { | ||
| 24 | @Schema(description = "变量实例(动态表单)", requiredMode = Schema.RequiredMode.REQUIRED) | 24 | @Schema(description = "变量实例(动态表单)", requiredMode = Schema.RequiredMode.REQUIRED) |
| 25 | private Map<String, Object> variables; | 25 | private Map<String, Object> variables; |
| 26 | 26 | ||
| 27 | - @Schema(description = "节点审批人", example = "[1,2]") | ||
| 28 | - private List<Long> assignees; | 27 | + @Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}") |
| 28 | + private Map<String, List<Long>> startUserSelectAssignees; | ||
| 29 | 29 | ||
| 30 | } | 30 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/dept/BpmTaskCandidateStartUserSelectStrategy.java
| @@ -56,7 +56,7 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand | @@ -56,7 +56,7 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand | ||
| 56 | // 获得审批人,如果不存在,则直接返回空,避免类型转换异常 | 56 | // 获得审批人,如果不存在,则直接返回空,避免类型转换异常 |
| 57 | List<Long> assignees = startUserSelectAssignees.get(execution.getCurrentActivityId()); | 57 | List<Long> assignees = startUserSelectAssignees.get(execution.getCurrentActivityId()); |
| 58 | if (CollUtil.isEmpty(assignees)){ | 58 | if (CollUtil.isEmpty(assignees)){ |
| 59 | - return null; | 59 | + return Sets.newLinkedHashSet(); |
| 60 | } | 60 | } |
| 61 | return new LinkedHashSet<>(assignees); | 61 | return new LinkedHashSet<>(assignees); |
| 62 | } | 62 | } |
| @@ -74,7 +74,7 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand | @@ -74,7 +74,7 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand | ||
| 74 | // 获得审批人,如果不存在,则直接返回空,避免类型转换异常 | 74 | // 获得审批人,如果不存在,则直接返回空,避免类型转换异常 |
| 75 | List<Long> assignees = startUserSelectAssignees.get(activityId); | 75 | List<Long> assignees = startUserSelectAssignees.get(activityId); |
| 76 | if (CollUtil.isEmpty(assignees)){ | 76 | if (CollUtil.isEmpty(assignees)){ |
| 77 | - return null; | 77 | + return Sets.newLinkedHashSet(); |
| 78 | } | 78 | } |
| 79 | return new LinkedHashSet<>(assignees); | 79 | return new LinkedHashSet<>(assignees); |
| 80 | } | 80 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| @@ -520,6 +520,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -520,6 +520,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 520 | if (CollUtil.isNotEmpty(reqVO.getVariables())) { | 520 | if (CollUtil.isNotEmpty(reqVO.getVariables())) { |
| 521 | Map<String, Object> variables = FlowableUtils.filterTaskFormVariable(reqVO.getVariables()); | 521 | Map<String, Object> variables = FlowableUtils.filterTaskFormVariable(reqVO.getVariables()); |
| 522 | // 修改表单的值需要存储到 ProcessInstance 变量 | 522 | // 修改表单的值需要存储到 ProcessInstance 变量 |
| 523 | + if (CollUtil.isNotEmpty(reqVO.getStartUserSelectAssignees())) { | ||
| 524 | + variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, | ||
| 525 | + reqVO.getStartUserSelectAssignees()); | ||
| 526 | + } | ||
| 523 | runtimeService.setVariables(task.getProcessInstanceId(), variables); | 527 | runtimeService.setVariables(task.getProcessInstanceId(), variables); |
| 524 | taskService.complete(task.getId(), variables, true); | 528 | taskService.complete(task.getId(), variables, true); |
| 525 | } else { | 529 | } else { |