【代码评审】工作流:获得审批的进展
This commit is contained in:
parent
f03e26bc86
commit
4d15396e36
|
@ -13,6 +13,7 @@ import lombok.Getter;
|
|||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BpmProcessNodeProgressEnum {
|
||||
|
||||
// 0 未开始
|
||||
NOT_START(0,"未开始"),
|
||||
// 1 ~ 20 进行中
|
||||
|
|
|
@ -47,7 +47,6 @@ public class BpmProcessInstanceController {
|
|||
private BpmProcessInstanceService processInstanceService;
|
||||
@Resource
|
||||
private BpmTaskService taskService;
|
||||
|
||||
@Resource
|
||||
private BpmProcessDefinitionService processDefinitionService;
|
||||
@Resource
|
||||
|
|
|
@ -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<User> 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,9 @@ public interface BpmProcessInstanceCopyMapper extends BaseMapperX<BpmProcessInst
|
|||
.orderByDesc(BpmProcessInstanceCopyDO::getId));
|
||||
}
|
||||
|
||||
default List<BpmProcessInstanceCopyDO> selectListByProcInstIdAndActId(String processInstanceId, String activityId) {
|
||||
return selectList(BpmProcessInstanceCopyDO::getProcessInstanceId, processInstanceId, BpmProcessInstanceCopyDO::getActivityId, activityId);
|
||||
default List<BpmProcessInstanceCopyDO> selectListByProcessIstanceIdAndActivityId(String processInstanceId, String activityId) {
|
||||
return selectList(BpmProcessInstanceCopyDO::getProcessInstanceId, processInstanceId,
|
||||
BpmProcessInstanceCopyDO::getActivityId, activityId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,26 +29,6 @@ public interface BpmTaskCandidateStrategy {
|
|||
*/
|
||||
void validateParam(String param);
|
||||
|
||||
/**
|
||||
* 基于执行任务,获得任务的候选用户们
|
||||
*
|
||||
* @param execution 执行任务
|
||||
* @return 用户编号集合
|
||||
*/
|
||||
Set<Long> calculateUsers(DelegateExecution execution, String param);
|
||||
|
||||
|
||||
/**
|
||||
* 基于流程实例,获得任务的候选用户们。 用于获取未执行节点的候选用户们
|
||||
*
|
||||
* @param processInstanceId 流程实例
|
||||
* @param param 节点的参数
|
||||
* @return 用户编号集合
|
||||
*/
|
||||
default Set<Long> calculateUsers(String processInstanceId, String param) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否一定要输入参数
|
||||
*
|
||||
|
@ -58,4 +38,27 @@ public interface BpmTaskCandidateStrategy {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 基于执行任务,获得任务的候选用户们
|
||||
*
|
||||
* @param execution 执行任务
|
||||
* @return 用户编号集合
|
||||
*/
|
||||
Set<Long> calculateUsers(DelegateExecution execution, String param);
|
||||
|
||||
/**
|
||||
* 基于流程实例,获得任务的候选用户们
|
||||
*
|
||||
* 目的:用于获取未执行节点的候选用户们
|
||||
*
|
||||
* @param processInstanceId 流程实例编号
|
||||
* @param param 节点的参数
|
||||
* @return 用户编号集合
|
||||
*/
|
||||
default Set<Long> calculateUsers(String processInstanceId, String param) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
// TODO @芋艿:后续可以抽象一个 calculateUsers(String param),默认 calculateUsers 和 calculateUsers 调用它
|
||||
|
||||
}
|
||||
|
|
|
@ -41,16 +41,11 @@ public class BpmTaskCandidateDeptMemberStrategy implements BpmTaskCandidateStrat
|
|||
|
||||
@Override
|
||||
public Set<Long> calculateUsers(DelegateExecution execution, String param) {
|
||||
return calculateUsersByParam(param);
|
||||
return calculateUsers((String) null, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> calculateUsers(String processInstanceId, String param) {
|
||||
return calculateUsersByParam(param);
|
||||
}
|
||||
|
||||
private Set<Long> calculateUsersByParam(String param) {
|
||||
|
||||
Set<Long> deptIds = StrUtils.splitToLongSet(param);
|
||||
List<AdminUserRespDTO> users = adminUserApi.getUserListByDeptIds(deptIds);
|
||||
return convertSet(users, AdminUserRespDTO::getId);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class BpmTaskCandidateRoleStrategy implements BpmTaskCandidateStrategy {
|
|||
return calculateUsersByParam(param);
|
||||
}
|
||||
|
||||
private Set<Long> calculateUsersByParam(String param) {
|
||||
private Set<Long> calculateUsersByParam(String param) {
|
||||
Set<Long> roleIds = StrUtils.splitToLongSet(param);
|
||||
return permissionApi.getUserRoleIdListByRoleIds(roleIds);
|
||||
}
|
||||
|
|
|
@ -34,13 +34,13 @@ public class BpmTaskCandidateStartUserStrategy implements BpmTaskCandidateStrate
|
|||
public void validateParam(String param) {}
|
||||
|
||||
@Override
|
||||
public Set<Long> calculateUsers(DelegateExecution execution, String param) {
|
||||
return getStartUserOfProcessInstance(execution.getProcessInstanceId());
|
||||
public boolean isParamRequired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isParamRequired() {
|
||||
return false;
|
||||
public Set<Long> calculateUsers(DelegateExecution execution, String param) {
|
||||
return getStartUserOfProcessInstance(execution.getProcessInstanceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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<ProcessNodeProgress> nodeProgresses,
|
||||
List<HistoricActivityInstance> historicActivityList, Map<String, HistoricActivityInstance> activityInstanceMap, List<Integer> returnNodePosition) {
|
||||
BpmSimpleModelNodeType nodeType = BpmSimpleModelNodeType.valueOf(node.getType());
|
||||
|
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* 更新流程定义状态
|
||||
|
|
|
@ -29,7 +29,9 @@ public interface BpmActivityService {
|
|||
List<HistoricActivityInstance> getHistoricActivityListByExecutionId(String executionId);
|
||||
|
||||
/**
|
||||
* 获取活动的用户列表。 例如:抄送人列表。 审批人列表
|
||||
* 获取活动的用户列表。
|
||||
*
|
||||
* 例如:抄送人列表、审批人列表
|
||||
*
|
||||
* @param historicActivity 活动
|
||||
* @param isMultiInstance 是否多实例 (会签,或签 )
|
||||
|
@ -37,10 +39,11 @@ public interface BpmActivityService {
|
|||
* @return 用户列表
|
||||
*/
|
||||
List<BpmProcessInstanceProgressRespVO.User> getHistoricActivityUserList(HistoricActivityInstance historicActivity,
|
||||
Boolean isMultiInstance, List<HistoricActivityInstance> historicActivityList);
|
||||
Boolean isMultiInstance,
|
||||
List<HistoricActivityInstance> historicActivityList);
|
||||
|
||||
/**
|
||||
* 获取活动的进度状态。
|
||||
* 获取活动的进度状态
|
||||
*
|
||||
* @param historicActivity 活动
|
||||
* @param isMultiInstance 是否多实例 (会签,或签 )
|
||||
|
@ -48,11 +51,15 @@ public interface BpmActivityService {
|
|||
* @return 活动的进度状态
|
||||
*/
|
||||
Integer getHistoricActivityProgressStatus(HistoricActivityInstance historicActivity,
|
||||
Boolean isMultiInstance, List<HistoricActivityInstance> historicActivityList);
|
||||
Boolean isMultiInstance,
|
||||
List<HistoricActivityInstance> historicActivityList);
|
||||
|
||||
// TODO @jason:可以写下这 2 个方法的注释
|
||||
Integer getNotRunActivityProgressStatus(Integer processInstanceStatus);
|
||||
|
||||
List<BpmProcessInstanceProgressRespVO.User> getNotRunActivityUserList(String processInstanceId, Integer processInstanceStatus
|
||||
, Integer candidateStrategy, String candidateParam);
|
||||
List<BpmProcessInstanceProgressRespVO.User> getNotRunActivityUserList(String processInstanceId,
|
||||
Integer processInstanceStatus,
|
||||
Integer candidateStrategy,
|
||||
String candidateParam);
|
||||
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ public class BpmActivityServiceImpl implements BpmActivityService {
|
|||
return historyService.createHistoricActivityInstanceQuery().executionId(executionId).list();
|
||||
}
|
||||
|
||||
// TODO @芋艿:重点在 review 下~
|
||||
@Override
|
||||
public List<User> getHistoricActivityUserList(HistoricActivityInstance historicActivity
|
||||
, Boolean isMultiInstance, List<HistoricActivityInstance> historicActivityList) {
|
||||
|
|
|
@ -43,6 +43,7 @@ public interface BpmProcessInstanceCopyService {
|
|||
*/
|
||||
PageResult<BpmProcessInstanceCopyDO> getProcessInstanceCopyPage(Long userId,
|
||||
BpmProcessInstanceCopyPageReqVO pageReqVO);
|
||||
// TODO @芋艿:重点在 review 下
|
||||
/**
|
||||
* 通过流程实例和流程活动编号获取抄送人的 Id
|
||||
*
|
||||
|
|
|
@ -89,7 +89,7 @@ public class BpmProcessInstanceCopyServiceImpl implements BpmProcessInstanceCopy
|
|||
|
||||
@Override
|
||||
public Set<Long> getCopyUserIds(String processInstanceId, String activityId) {
|
||||
return CollectionUtils.convertSet(processInstanceCopyMapper.selectListByProcInstIdAndActId(processInstanceId, activityId),
|
||||
return CollectionUtils.convertSet(processInstanceCopyMapper.selectListByProcessIstanceIdAndActivityId(processInstanceId, activityId),
|
||||
BpmProcessInstanceCopyDO::getUserId);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ public interface BpmProcessInstanceService {
|
|||
*/
|
||||
Map<String, String> getProcessInstanceFormFieldsPermission(@Valid BpmProcessInstanceFormFieldsPermissionReqVO reqVO);
|
||||
|
||||
// TODO @芋艿:重点在 review 下
|
||||
/**
|
||||
* 获取流程实例的进度
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue