diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessNodeProgressEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessNodeProgressEnum.java index 33fa001f12..4a6f32a7e3 100644 --- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessNodeProgressEnum.java +++ b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessNodeProgressEnum.java @@ -13,6 +13,7 @@ import lombok.Getter; @Getter @AllArgsConstructor public enum BpmProcessNodeProgressEnum { + // 0 未开始 NOT_START(0,"未开始"), // 1 ~ 20 进行中 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java index 195eeabf1c..f91bf1f918 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java @@ -47,7 +47,6 @@ public class BpmProcessInstanceController { private BpmProcessInstanceService processInstanceService; @Resource private BpmTaskService taskService; - @Resource private BpmProcessDefinitionService processDefinitionService; @Resource diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceProgressRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceProgressRespVO.java index fc1b1672ee..3760234cc2 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceProgressRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceProgressRespVO.java @@ -22,17 +22,24 @@ public class BpmProcessInstanceProgressRespVO { @Schema(description = "节点编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "StartUserNode") private String id; // Bpmn XML 节点 Id + @Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "发起人") private String name; + + @Schema(description = "节点展示内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "指定成员: 芋道源码") private String displayText; + @Schema(description = "节点类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") private Integer nodeType; // 参见 BpmSimpleModelNodeType 枚举 + @Schema(description = "节点状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") private Integer status; // 参见 BpmProcessNodeProgressEnum 枚举 + @Schema(description = "节点的开始时间") private LocalDateTime startTime; @Schema(description = "节点的结束时间") private LocalDateTime endTime; + @Schema(description = "用户列表") private List userList; @Schema(description = "分支节点") @@ -48,13 +55,19 @@ public class BpmProcessInstanceProgressRespVO { @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") private Long id; + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") private String nickname; + @Schema(description = "用户头像", example = "芋艿") private String avatar; + @Schema(description = "是否已处理", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") private Boolean processed; + @Schema(description = "用户任务的处理状态", example = "1") private Integer userTaskStatus; + } + } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/task/BpmProcessInstanceCopyMapper.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/task/BpmProcessInstanceCopyMapper.java index 3605c6400a..daf93747a7 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/task/BpmProcessInstanceCopyMapper.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/task/BpmProcessInstanceCopyMapper.java @@ -20,7 +20,9 @@ public interface BpmProcessInstanceCopyMapper extends BaseMapperX selectListByProcInstIdAndActId(String processInstanceId, String activityId) { - return selectList(BpmProcessInstanceCopyDO::getProcessInstanceId, processInstanceId, BpmProcessInstanceCopyDO::getActivityId, activityId); + default List selectListByProcessIstanceIdAndActivityId(String processInstanceId, String activityId) { + return selectList(BpmProcessInstanceCopyDO::getProcessInstanceId, processInstanceId, + BpmProcessInstanceCopyDO::getActivityId, activityId); } + } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/BpmTaskCandidateStrategy.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/BpmTaskCandidateStrategy.java index 64e4328f4b..937a1a3c51 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/BpmTaskCandidateStrategy.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/BpmTaskCandidateStrategy.java @@ -29,26 +29,6 @@ public interface BpmTaskCandidateStrategy { */ void validateParam(String param); - /** - * 基于执行任务,获得任务的候选用户们 - * - * @param execution 执行任务 - * @return 用户编号集合 - */ - Set calculateUsers(DelegateExecution execution, String param); - - - /** - * 基于流程实例,获得任务的候选用户们。 用于获取未执行节点的候选用户们 - * - * @param processInstanceId 流程实例 - * @param param 节点的参数 - * @return 用户编号集合 - */ - default Set calculateUsers(String processInstanceId, String param) { - return Collections.emptySet(); - } - /** * 是否一定要输入参数 * @@ -58,4 +38,27 @@ public interface BpmTaskCandidateStrategy { return true; } + /** + * 基于执行任务,获得任务的候选用户们 + * + * @param execution 执行任务 + * @return 用户编号集合 + */ + Set calculateUsers(DelegateExecution execution, String param); + + /** + * 基于流程实例,获得任务的候选用户们 + * + * 目的:用于获取未执行节点的候选用户们 + * + * @param processInstanceId 流程实例编号 + * @param param 节点的参数 + * @return 用户编号集合 + */ + default Set calculateUsers(String processInstanceId, String param) { + return Collections.emptySet(); + } + + // TODO @芋艿:后续可以抽象一个 calculateUsers(String param),默认 calculateUsers 和 calculateUsers 调用它 + } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptMemberStrategy.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptMemberStrategy.java index 1f18c249da..21788771b9 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptMemberStrategy.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptMemberStrategy.java @@ -41,16 +41,11 @@ public class BpmTaskCandidateDeptMemberStrategy implements BpmTaskCandidateStrat @Override public Set calculateUsers(DelegateExecution execution, String param) { - return calculateUsersByParam(param); + return calculateUsers((String) null, param); } @Override public Set calculateUsers(String processInstanceId, String param) { - return calculateUsersByParam(param); - } - - private Set calculateUsersByParam(String param) { - Set deptIds = StrUtils.splitToLongSet(param); List users = adminUserApi.getUserListByDeptIds(deptIds); return convertSet(users, AdminUserRespDTO::getId); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateRoleStrategy.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateRoleStrategy.java index a05610938f..dcc1d5c0ba 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateRoleStrategy.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateRoleStrategy.java @@ -45,7 +45,7 @@ public class BpmTaskCandidateRoleStrategy implements BpmTaskCandidateStrategy { return calculateUsersByParam(param); } - private Set calculateUsersByParam(String param) { + private Set calculateUsersByParam(String param) { Set roleIds = StrUtils.splitToLongSet(param); return permissionApi.getUserRoleIdListByRoleIds(roleIds); } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateStartUserStrategy.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateStartUserStrategy.java index 33b1b26963..690885586a 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateStartUserStrategy.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateStartUserStrategy.java @@ -34,13 +34,13 @@ public class BpmTaskCandidateStartUserStrategy implements BpmTaskCandidateStrate public void validateParam(String param) {} @Override - public Set calculateUsers(DelegateExecution execution, String param) { - return getStartUserOfProcessInstance(execution.getProcessInstanceId()); + public boolean isParamRequired() { + return false; } @Override - public boolean isParamRequired() { - return false; + public Set calculateUsers(DelegateExecution execution, String param) { + return getStartUserOfProcessInstance(execution.getProcessInstanceId()); } @Override diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java index 2c794c520a..03085166a9 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java @@ -519,6 +519,7 @@ public class SimpleModelUtils { private static void processMultiInstanceLoopCharacteristics(Integer approveMethod, Integer approveRatio, UserTask userTask) { BpmUserTaskApproveMethodEnum approveMethodEnum = BpmUserTaskApproveMethodEnum.valueOf(approveMethod); + // TODO @jason:这种枚举,最终不要去掉哈 BpmUserTaskApproveMethodEnum。因为容易不经意重叠 if (approveMethodEnum == null || approveMethodEnum == RANDOM) { return; } @@ -656,7 +657,7 @@ public class SimpleModelUtils { traverseNodeToBuildNodeProgress(processInstance, simpleModel.getChildNode(), historicActivityList, activityInstanceMap, nodeProgresses, returnNodePosition); } - + // TODO @芋艿:重点在 review 下 private static void buildNodeProgress(HistoricProcessInstance processInstance, BpmSimpleModelNodeVO node, List nodeProgresses, List historicActivityList, Map activityInstanceMap, List returnNodePosition) { BpmSimpleModelNodeType nodeType = BpmSimpleModelNodeType.valueOf(node.getType()); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionService.java index 9994cd084f..c949e0a703 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionService.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionService.java @@ -48,11 +48,12 @@ public interface BpmProcessDefinitionService { * @param model 流程模型 * @param modelMetaInfo 流程模型元信息 * @param bpmnBytes BPMN XML 字节数组 - * @param simpleBytes simple model json 字节数组 + * @param simpleBytes SIMPLE Model JSON 字节数组 * @param form 表单 * @return 流程编号 */ - String createProcessDefinition(Model model, BpmModelMetaInfoVO modelMetaInfo, byte[] bpmnBytes, byte[] simpleBytes, BpmFormDO form); + String createProcessDefinition(Model model, BpmModelMetaInfoVO modelMetaInfo, + byte[] bpmnBytes, byte[] simpleBytes, BpmFormDO form); /** * 更新流程定义状态 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmActivityService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmActivityService.java index 3d6b1866ba..0934b60d6e 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmActivityService.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmActivityService.java @@ -29,7 +29,9 @@ public interface BpmActivityService { List getHistoricActivityListByExecutionId(String executionId); /** - * 获取活动的用户列表。 例如:抄送人列表。 审批人列表 + * 获取活动的用户列表。 + * + * 例如:抄送人列表、审批人列表 * * @param historicActivity 活动 * @param isMultiInstance 是否多实例 (会签,或签 ) @@ -37,10 +39,11 @@ public interface BpmActivityService { * @return 用户列表 */ List getHistoricActivityUserList(HistoricActivityInstance historicActivity, - Boolean isMultiInstance, List historicActivityList); + Boolean isMultiInstance, + List historicActivityList); /** - * 获取活动的进度状态。 + * 获取活动的进度状态 * * @param historicActivity 活动 * @param isMultiInstance 是否多实例 (会签,或签 ) @@ -48,11 +51,15 @@ public interface BpmActivityService { * @return 活动的进度状态 */ Integer getHistoricActivityProgressStatus(HistoricActivityInstance historicActivity, - Boolean isMultiInstance, List historicActivityList); + Boolean isMultiInstance, + List historicActivityList); + // TODO @jason:可以写下这 2 个方法的注释 Integer getNotRunActivityProgressStatus(Integer processInstanceStatus); - List getNotRunActivityUserList(String processInstanceId, Integer processInstanceStatus - , Integer candidateStrategy, String candidateParam); + List getNotRunActivityUserList(String processInstanceId, + Integer processInstanceStatus, + Integer candidateStrategy, + String candidateParam); } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmActivityServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmActivityServiceImpl.java index d73d5872b0..b39d3e4d6d 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmActivityServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmActivityServiceImpl.java @@ -72,6 +72,7 @@ public class BpmActivityServiceImpl implements BpmActivityService { return historyService.createHistoricActivityInstanceQuery().executionId(executionId).list(); } + // TODO @芋艿:重点在 review 下~ @Override public List getHistoricActivityUserList(HistoricActivityInstance historicActivity , Boolean isMultiInstance, List historicActivityList) { diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyService.java index 78c8f8fef8..7fd5ff361e 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyService.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyService.java @@ -43,6 +43,7 @@ public interface BpmProcessInstanceCopyService { */ PageResult getProcessInstanceCopyPage(Long userId, BpmProcessInstanceCopyPageReqVO pageReqVO); + // TODO @芋艿:重点在 review 下 /** * 通过流程实例和流程活动编号获取抄送人的 Id * diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyServiceImpl.java index b30b6c1e3e..211f508a57 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceCopyServiceImpl.java @@ -89,7 +89,7 @@ public class BpmProcessInstanceCopyServiceImpl implements BpmProcessInstanceCopy @Override public Set getCopyUserIds(String processInstanceId, String activityId) { - return CollectionUtils.convertSet(processInstanceCopyMapper.selectListByProcInstIdAndActId(processInstanceId, activityId), + return CollectionUtils.convertSet(processInstanceCopyMapper.selectListByProcessIstanceIdAndActivityId(processInstanceId, activityId), BpmProcessInstanceCopyDO::getUserId); } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceService.java index e572603129..26fde88888 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceService.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceService.java @@ -92,6 +92,7 @@ public interface BpmProcessInstanceService { */ Map getProcessInstanceFormFieldsPermission(@Valid BpmProcessInstanceFormFieldsPermissionReqVO reqVO); + // TODO @芋艿:重点在 review 下 /** * 获取流程实例的进度 *