【代码评审】BPM:获取审批任务的记录列表

This commit is contained in:
YunaiV 2024-09-08 11:29:28 +08:00
parent 4d15396e36
commit d02e1e1d6b
3 changed files with 10 additions and 2 deletions

View File

@ -29,7 +29,7 @@ public enum BpmProcessNodeProgressEnum {
USER_TASK_REJECT(31, "审批不通过"), // 审批节点 USER_TASK_REJECT(31, "审批不通过"), // 审批节点
USER_TASK_RETURN(32, "已退回"), // 审批节点 USER_TASK_RETURN(32, "已退回"), // 审批节点
USER_TASK_CANCEL(34, "已取消"), // 审批节点 USER_TASK_CANCEL(34, "已取消"), // 审批节点
// 40 ~ 50 一般节点的接榫状态 // 40 ~ 50 一般节点的接榫状态 // TODO @jason接榫 是啥呀
FINISHED(41, "已结束"), // 一般节点的节点的结束状态 FINISHED(41, "已结束"), // 一般节点的节点的结束状态
SKIP(42, "跳过"); // 未执行跳过的节点 SKIP(42, "跳过"); // 未执行跳过的节点

View File

@ -32,6 +32,7 @@ public class BpmProcessInstanceProgressRespVO {
@Schema(description = "节点类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "节点类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer nodeType; // 参见 BpmSimpleModelNodeType 枚举 private Integer nodeType; // 参见 BpmSimpleModelNodeType 枚举
// TODO @jason可以复用 BpmTaskStatusEnum 非必要不加太多状态枚举哈
@Schema(description = "节点状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") @Schema(description = "节点状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
private Integer status; // 参见 BpmProcessNodeProgressEnum 枚举 private Integer status; // 参见 BpmProcessNodeProgressEnum 枚举
@ -42,6 +43,8 @@ public class BpmProcessInstanceProgressRespVO {
@Schema(description = "用户列表") @Schema(description = "用户列表")
private List<User> userList; private List<User> userList;
// TODO @jason如果条件信息怎么展示哈
@Schema(description = "分支节点") @Schema(description = "分支节点")
private List<ProcessNodeProgress> branchNodes; // 有且仅有条件并行包容节点才会有分支节点 private List<ProcessNodeProgress> branchNodes; // 有且仅有条件并行包容节点才会有分支节点
@ -62,6 +65,8 @@ public class BpmProcessInstanceProgressRespVO {
@Schema(description = "用户头像", example = "芋艿") @Schema(description = "用户头像", example = "芋艿")
private String avatar; private String avatar;
// TODO @jason是不是把 processed userTaskStatus 合并
@Schema(description = "是否已处理", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") @Schema(description = "是否已处理", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
private Boolean processed; private Boolean processed;

View File

@ -654,10 +654,11 @@ public class SimpleModelUtils {
} }
buildNodeProgress(processInstance, simpleModel, nodeProgresses, historicActivityList, activityInstanceMap, returnNodePosition); buildNodeProgress(processInstance, simpleModel, nodeProgresses, historicActivityList, activityInstanceMap, returnNodePosition);
// 如果有节点则递归处理子节点 // 如果有节点则递归处理子节点
// TODO @jason需要根据条件是否继续递归例如说一共有 3 node 2 node 审批不通过了那么第 3 node 就不用了微信讨论下
traverseNodeToBuildNodeProgress(processInstance, simpleModel.getChildNode(), historicActivityList, activityInstanceMap, nodeProgresses, returnNodePosition); traverseNodeToBuildNodeProgress(processInstance, simpleModel.getChildNode(), historicActivityList, activityInstanceMap, nodeProgresses, returnNodePosition);
} }
// TODO @芋艿重点在 review // TODO @芋艿@jason可重构优化的点SimpleModelUtils 负责提供一个遍历的方法有个 Function 进行每个节点的处理目的是把逻辑拿回到 Service 里面或者说减少 Utils 去调用 Service
private static void buildNodeProgress(HistoricProcessInstance processInstance, BpmSimpleModelNodeVO node, List<ProcessNodeProgress> nodeProgresses, private static void buildNodeProgress(HistoricProcessInstance processInstance, BpmSimpleModelNodeVO node, List<ProcessNodeProgress> nodeProgresses,
List<HistoricActivityInstance> historicActivityList, Map<String, HistoricActivityInstance> activityInstanceMap, List<Integer> returnNodePosition) { List<HistoricActivityInstance> historicActivityList, Map<String, HistoricActivityInstance> activityInstanceMap, List<Integer> returnNodePosition) {
BpmSimpleModelNodeType nodeType = BpmSimpleModelNodeType.valueOf(node.getType()); BpmSimpleModelNodeType nodeType = BpmSimpleModelNodeType.valueOf(node.getType());
@ -674,6 +675,7 @@ public class SimpleModelUtils {
// 2. 设置节点状态 // 2. 设置节点状态
nodeProgress.setStatus(activityService.getNotRunActivityProgressStatus(processInstanceStatus)); nodeProgress.setStatus(activityService.getNotRunActivityProgressStatus(processInstanceStatus));
// 3. 抄送节点, 审批节点设置用户列表 // 3. 抄送节点, 审批节点设置用户列表
// TODO @芋艿抄送节点要不要跳过不展示
if (COPY_NODE.getType().equals(node.getType()) || if (COPY_NODE.getType().equals(node.getType()) ||
(APPROVE_NODE.getType().equals(node.getType()) && USER.getType().equals(node.getApproveType()))) { (APPROVE_NODE.getType().equals(node.getType()) && USER.getType().equals(node.getApproveType()))) {
nodeProgress.setUserList(activityService.getNotRunActivityUserList(processInstance.getId() nodeProgress.setUserList(activityService.getNotRunActivityUserList(processInstance.getId()
@ -707,6 +709,7 @@ public class SimpleModelUtils {
} }
break; break;
} }
// TODO @芋艿抄送节点要不要跳过不展示
case COPY_NODE: { // 抄送节点 case COPY_NODE: { // 抄送节点
// 1. 设置节点的状态 // 1. 设置节点的状态
nodeProgress.setStatus(activityService.getHistoricActivityProgressStatus(historicActivity, false, historicActivityList)); nodeProgress.setStatus(activityService.getHistoricActivityProgressStatus(historicActivity, false, historicActivityList));