bpm:code review 指定审批人

plp
YunaiV 2 years ago
parent 6fd8d0095c
commit 7f75f0abfc

@ -36,4 +36,5 @@ public class FlowableContextHolder {
public static void setAssignee(Map<String, List<Long>> assignee) { public static void setAssignee(Map<String, List<Long>> assignee) {
ASSIGNEE.set(assignee); ASSIGNEE.set(assignee);
} }
} }

@ -32,9 +32,14 @@ public class BpmProcessInstanceCreateReqDTO {
@NotEmpty(message = "业务的唯一标识") @NotEmpty(message = "业务的唯一标识")
private String businessKey; private String businessKey;
// TODO @haiassignees 复数
/** /**
* *
* { taskKey1 :[1,2] } taskKey1 userId 1,2 *
* keytaskKey
* value
* { taskKey1 :[1, 2] } taskKey1 userId 1,2
*/ */
private Map<String, List<Long>> assignee; private Map<String, List<Long>> assignee;
} }

@ -18,7 +18,8 @@ public class BpmProcessInstanceCreateReqVO {
@Schema(description = "变量实例") @Schema(description = "变量实例")
private Map<String, Object> variables; private Map<String, Object> variables;
@Schema(description = "提前指派的审批人", requiredMode = Schema.RequiredMode.REQUIRED, example = "{taskKey1:[1,2]}") // TODO @haiassignees 复数
@Schema(description = "提前指派的审批人", requiredMode = Schema.RequiredMode.REQUIRED, example = "{taskKey1: [1, 2]}")
private Map<String, List<Long>> assignee; private Map<String, List<Long>> assignee;
} }

@ -88,9 +88,11 @@ public class BpmProcessInstanceExtDO extends BaseDO {
@TableField(typeHandler = JacksonTypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private Map<String, Object> formVariables; private Map<String, Object> formVariables;
// TODO @haiassignees 复数
/** /**
* *
*/ */
@TableField(typeHandler = JacksonTypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class, exist = false) // TODO 芋艿:临时 exist = false避免 db 报错;
private Map<String, List<Long>> assignee; private Map<String, List<Long>> assignee;
} }

@ -239,12 +239,14 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService {
@Override @Override
@DataPermission(enable = false) // 忽略数据权限,不然分配会存在问题 @DataPermission(enable = false) // 忽略数据权限,不然分配会存在问题
public Set<Long> calculateTaskCandidateUsers(DelegateExecution execution) { public Set<Long> calculateTaskCandidateUsers(DelegateExecution execution) {
//1. 先从提前选好的审批人中获取 // 1. 先从提前选好的审批人中获取
List<Long> assignee = processInstanceService.getAssigneeByProcessInstanceIdAndTaskDefinitionKey(execution.getProcessInstanceId(), execution.getCurrentActivityId()); List<Long> assignee = processInstanceService.getAssigneeByProcessInstanceIdAndTaskDefinitionKey(
if(CollUtil.isNotEmpty(assignee)){ execution.getProcessInstanceId(), execution.getCurrentActivityId());
if (CollUtil.isNotEmpty(assignee)) {
// TODO @hainew HashSet 即可
return convertSet(assignee, Function.identity()); return convertSet(assignee, Function.identity());
} }
//2. 通过分配规则,计算审批人 // 2. 通过分配规则,计算审批人
BpmTaskAssignRuleDO rule = getTaskRule(execution); BpmTaskAssignRuleDO rule = getTaskRule(execution);
return calculateTaskCandidateUsers(execution, rule); return calculateTaskCandidateUsers(execution, rule);
} }

@ -145,12 +145,14 @@ public interface BpmProcessInstanceService {
*/ */
void updateProcessInstanceExtReject(String id, String reason); void updateProcessInstanceExtReject(String id, String reason);
// TODO @hai改成 getProcessInstanceAssigneesByTaskDefinitionKey(String id, String taskDefinitionKey)
/** /**
* *
* *
* @param processInstanceId * @param processInstanceId
* @param taskDefinitionKey key * @param taskDefinitionKey key
* @return * @return
*/ */
List<Long> getAssigneeByProcessInstanceIdAndTaskDefinitionKey(String processInstanceId, String taskDefinitionKey); List<Long> getAssigneeByProcessInstanceIdAndTaskDefinitionKey(String processInstanceId, String taskDefinitionKey);
} }

Loading…
Cancel
Save