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