bpm:code review 指定审批人
This commit is contained in:
parent
6fd8d0095c
commit
7f75f0abfc
@ -36,4 +36,5 @@ public class FlowableContextHolder {
|
||||
public static void setAssignee(Map<String, List<Long>> assignee) {
|
||||
ASSIGNEE.set(assignee);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,9 +32,14 @@ public class BpmProcessInstanceCreateReqDTO {
|
||||
@NotEmpty(message = "业务的唯一标识")
|
||||
private String businessKey;
|
||||
|
||||
// TODO @hai:assignees 复数
|
||||
/**
|
||||
* 提前指派的审批人
|
||||
* 例如: { taskKey1 :[1,2] },则表示 taskKey1 这个任务,提前设定了,由 userId 为 1,2 的用户进行审批
|
||||
*
|
||||
* key:taskKey 任务编码
|
||||
* value:审批人的数组
|
||||
* 例如: { taskKey1 :[1, 2] },则表示 taskKey1 这个任务,提前设定了,由 userId 为 1,2 的用户进行审批
|
||||
*/
|
||||
private Map<String, List<Long>> assignee;
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ public class BpmProcessInstanceCreateReqVO {
|
||||
@Schema(description = "变量实例")
|
||||
private Map<String, Object> variables;
|
||||
|
||||
@Schema(description = "提前指派的审批人", requiredMode = Schema.RequiredMode.REQUIRED, example = "{taskKey1:[1,2]}")
|
||||
// TODO @hai:assignees 复数
|
||||
@Schema(description = "提前指派的审批人", requiredMode = Schema.RequiredMode.REQUIRED, example = "{taskKey1: [1, 2]}")
|
||||
private Map<String, List<Long>> assignee;
|
||||
|
||||
}
|
||||
|
@ -88,9 +88,11 @@ public class BpmProcessInstanceExtDO extends BaseDO {
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private Map<String, Object> formVariables;
|
||||
|
||||
// TODO @hai:assignees 复数
|
||||
/**
|
||||
* 提前设定好的审批人
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
@TableField(typeHandler = JacksonTypeHandler.class, exist = false) // TODO 芋艿:临时 exist = false,避免 db 报错;
|
||||
private Map<String, List<Long>> assignee;
|
||||
|
||||
}
|
||||
|
@ -239,12 +239,14 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
|
||||
@Override
|
||||
@DataPermission(enable = false) // 忽略数据权限,不然分配会存在问题
|
||||
public Set<Long> calculateTaskCandidateUsers(DelegateExecution execution) {
|
||||
//1. 先从提前选好的审批人中获取
|
||||
List<Long> assignee = processInstanceService.getAssigneeByProcessInstanceIdAndTaskDefinitionKey(execution.getProcessInstanceId(), execution.getCurrentActivityId());
|
||||
if(CollUtil.isNotEmpty(assignee)){
|
||||
// 1. 先从提前选好的审批人中获取
|
||||
List<Long> assignee = processInstanceService.getAssigneeByProcessInstanceIdAndTaskDefinitionKey(
|
||||
execution.getProcessInstanceId(), execution.getCurrentActivityId());
|
||||
if (CollUtil.isNotEmpty(assignee)) {
|
||||
// TODO @hai:new HashSet 即可
|
||||
return convertSet(assignee, Function.identity());
|
||||
}
|
||||
//2. 通过分配规则,计算审批人
|
||||
// 2. 通过分配规则,计算审批人
|
||||
BpmTaskAssignRuleDO rule = getTaskRule(execution);
|
||||
return calculateTaskCandidateUsers(execution, rule);
|
||||
}
|
||||
|
@ -145,12 +145,14 @@ public interface BpmProcessInstanceService {
|
||||
*/
|
||||
void updateProcessInstanceExtReject(String id, String reason);
|
||||
|
||||
// TODO @hai:改成 getProcessInstanceAssigneesByTaskDefinitionKey(String id, String taskDefinitionKey)
|
||||
/**
|
||||
* 去流程实例扩展表中,取出指定流程任务提前指定的审批人
|
||||
* 获取流程实例中,取出指定流程任务提前指定的审批人
|
||||
*
|
||||
* @param processInstanceId 流程实例的编号
|
||||
* @param taskDefinitionKey 流程任务定义的 key
|
||||
* @return 审批人集合
|
||||
*/
|
||||
List<Long> getAssigneeByProcessInstanceIdAndTaskDefinitionKey(String processInstanceId, String taskDefinitionKey);
|
||||
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user