mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
【代码评审】工作流:审批详情新接口的 review
This commit is contained in:
parent
abea0edf23
commit
61549f13c0
@ -15,6 +15,7 @@ import java.util.Arrays;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BpmProcessInstanceStatusEnum implements IntArrayValuable {
|
||||
|
||||
NOT_START(-1, "未开始"),
|
||||
RUNNING(1, "审批中"),
|
||||
APPROVE(2, "审批通过"),
|
||||
|
@ -11,7 +11,6 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessI
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceCopyDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceCopyService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -43,8 +42,6 @@ public class BpmProcessInstanceCopyController {
|
||||
private BpmProcessInstanceCopyService processInstanceCopyService;
|
||||
@Resource
|
||||
private BpmProcessInstanceService processInstanceService;
|
||||
@Resource
|
||||
private BpmTaskService taskService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
@ -60,9 +57,7 @@ public class BpmProcessInstanceCopyController {
|
||||
return success(new PageResult<>(pageResult.getTotal()));
|
||||
}
|
||||
|
||||
// 拼接返回 TODO @芋艿。这个 taskName 查询是不是可以不用。 保存的时候 taskName 已经存了, review 一下。 不知道有什么特殊场景
|
||||
// Map<String, String> taskNameMap = taskService.getTaskNameByTaskIds(
|
||||
// convertSet(pageResult.getList(), BpmProcessInstanceCopyDO::getTaskId));
|
||||
// 拼接返回
|
||||
Map<String, HistoricProcessInstance> processInstanceMap = processInstanceService.getHistoricProcessInstanceMap(
|
||||
convertSet(pageResult.getList(), BpmProcessInstanceCopyDO::getProcessInstanceId));
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(pageResult.getList(),
|
||||
@ -70,7 +65,6 @@ public class BpmProcessInstanceCopyController {
|
||||
return success(BeanUtils.toBean(pageResult, BpmProcessInstanceCopyRespVO.class, copyVO -> {
|
||||
MapUtils.findAndThen(userMap, Long.valueOf(copyVO.getCreator()), user -> copyVO.setCreatorName(user.getNickname()));
|
||||
MapUtils.findAndThen(userMap, copyVO.getStartUserId(), user -> copyVO.setStartUserName(user.getNickname()));
|
||||
// MapUtils.findAndThen(taskNameMap, copyVO.getTaskId(), copyVO::setTaskName);
|
||||
MapUtils.findAndThen(processInstanceMap, copyVO.getProcessInstanceId(),
|
||||
processInstance -> copyVO.setProcessInstanceStartTime(DateUtils.of(processInstance.getStartTime())));
|
||||
}));
|
||||
|
@ -42,6 +42,7 @@ public class BpmApprovalDetailRespVO {
|
||||
private List<ApprovalTaskInfo> tasks;
|
||||
|
||||
@Schema(description = "候选人用户列表")
|
||||
// TODO @jason:candidateUserList => candidateUsers,保持和 tasks 的命名风格一致哈
|
||||
private List<User> candidateUserList; // 用于未运行任务节点
|
||||
|
||||
}
|
||||
|
@ -6,9 +6,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
@Schema(description = "管理后台 - 表单字段权限 Request VO")
|
||||
@Data
|
||||
public class BpmFormFieldsPermissionReqVO {
|
||||
|
@ -102,16 +102,19 @@ public class BpmTaskCandidateInvoker {
|
||||
String param = BpmnModelUtils.parseCandidateParam(execution.getCurrentFlowElement());
|
||||
// 1.1 计算任务的候选人
|
||||
Set<Long> userIds = getCandidateStrategy(strategy).calculateUsers(execution, param);
|
||||
// 1.2 候选人为空时,根据“审批人为空”的配置补充
|
||||
removeDisableUsers(userIds);
|
||||
// 1.2 移除被禁用的用户
|
||||
removeDisableUsers(userIds);
|
||||
|
||||
// 2. 候选人为空时,根据“审批人为空”的配置补充
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
userIds = getCandidateStrategy(BpmTaskCandidateStrategyEnum.ASSIGN_EMPTY.getStrategy())
|
||||
.calculateUsers(execution, param);
|
||||
// ASSIGN_EMPTY 策略,不需要移除被禁用的用户。原因是,再移除,可能会出现更没审批人了!!!
|
||||
}
|
||||
// 1.3 移除发起人的用户
|
||||
removeStartUserIfSkip(execution, userIds);
|
||||
|
||||
// 2. 移除被禁用的用户 TODO @芋艿 移除禁用的用户是否应该放在 1.1 之后
|
||||
// removeDisableUsers(userIds); @芋艿 把这个移到了 BpmTaskCandidateStrategy 下面。 看一下是否可以
|
||||
// 3. 移除发起人的用户
|
||||
removeStartUserIfSkip(execution, userIds);
|
||||
return userIds;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,6 @@ public interface BpmTaskCandidateStrategy {
|
||||
return users;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 基于流程实例,获得任务的候选用户们
|
||||
* <p>
|
||||
@ -79,7 +78,6 @@ public interface BpmTaskCandidateStrategy {
|
||||
return users;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 移除被禁用的用户
|
||||
*
|
||||
@ -87,7 +85,4 @@ public interface BpmTaskCandidateStrategy {
|
||||
*/
|
||||
void removeDisableUsers(Set<Long> users);
|
||||
|
||||
// TODO @芋艿:后续可以抽象一个 calculateUsers(String param),默认 calculateUsers 和 calculateUsers 调用它
|
||||
// TODO @芋艿 加了, review 一下
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class BpmTaskCandidateAssignEmptyStrategy extends BpmTaskCandidateAbstrac
|
||||
// 情况一:指定人员审批
|
||||
Integer assignEmptyHandlerType = BpmnModelUtils.parseAssignEmptyHandlerType(execution.getCurrentFlowElement());
|
||||
if (Objects.equals(assignEmptyHandlerType, BpmUserTaskAssignEmptyHandlerTypeEnum.ASSIGN_USER.getType())) {
|
||||
HashSet<Long> users = new HashSet<>(BpmnModelUtils.parseAssignEmptyHandlerUserIds(execution.getCurrentFlowElement()));
|
||||
Set<Long> users = new HashSet<>(BpmnModelUtils.parseAssignEmptyHandlerUserIds(execution.getCurrentFlowElement()));
|
||||
removeDisableUsers(users);
|
||||
return users;
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ public class BpmTaskCandidateStartUserDeptLeaderMultiStrategy extends BpmTaskCan
|
||||
return new HashSet<>();
|
||||
}
|
||||
Set<Long> users = getMultiLevelDeptLeaderIds(toList(dept.getId()), Integer.valueOf(param)); // 参数是部门的层级
|
||||
// TODO @jason:这里 removeDisableUsers 的原因是啥呀?
|
||||
removeDisableUsers(users);
|
||||
return users;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public interface BpmProcessInstanceService {
|
||||
/**
|
||||
* 获取审批详情。
|
||||
* <p>
|
||||
* 可以是准备发起的流程, 进行中的流程, 已经结束的流程
|
||||
* 可以是准备发起的流程、进行中的流程、已经结束的流程
|
||||
*
|
||||
* @param loginUserId 登录人的用户编号
|
||||
* @param reqVO 请求信息
|
||||
|
File diff suppressed because one or more lines are too long
@ -27,9 +27,9 @@ public class AlreadyRunApproveNodeRespBO {
|
||||
private Set<String> runNodeIds;
|
||||
|
||||
/**
|
||||
* 正在运行的节点的审批信息 ( key: activityId. value: 审批信息 )
|
||||
* 正在运行的节点的审批信息(key: activityId, value: 审批信息)
|
||||
* <p>
|
||||
* 用于依次审批。 需要加上候选人信息
|
||||
* 用于依次审批,需要加上候选人信息
|
||||
*/
|
||||
private Map<String, ApprovalNodeInfo> runningApprovalNodes;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user