feat: 提交人权限-允许撤销审批中的申请

This commit is contained in:
Lesan 2025-01-19 16:42:21 +08:00
parent 25c86c05b3
commit 68b7a9a954
4 changed files with 17 additions and 0 deletions

View File

@ -38,6 +38,7 @@ public interface ErrorCodeConstants {
ErrorCode PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG = new ErrorCode(1_009_004_003, "任务({})的候选人未配置");
ErrorCode PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_EXISTS = new ErrorCode(1_009_004_004, "任务({})的候选人({})不存在");
ErrorCode PROCESS_INSTANCE_START_USER_CAN_START = new ErrorCode(1_009_004_005, "发起流程失败,你没有权限发起该流程");
ErrorCode PROCESS_INSTANCE_CANCEL_FAIL_NOT_ALLOW = new ErrorCode(1_009_004_005, "流程取消失败,该流程不允许取消");
// ========== 流程任务 1-009-005-000 ==========
ErrorCode TASK_OPERATE_FAIL_ASSIGN_NOT_SELF = new ErrorCode(1_009_005_001, "操作失败,原因:该任务的审批人不是你");

View File

@ -62,4 +62,7 @@ public class BpmModelMetaInfoVO {
@Schema(description = "排序", example = "1")
private Long sort; // 创建时后端自动生成
@Schema(description = "允许撤销审批中的申请")
private Boolean allowCancelRunningProcess;
}

View File

@ -150,4 +150,10 @@ public class BpmProcessDefinitionInfoDO extends BaseDO {
@TableField(typeHandler = StringListTypeHandler.class) // 为了可以使用 find_in_set 进行过滤
private List<Long> managerUserIds;
/**
* 允许撤销审批中的申请
* TODO @芋艿 需要同步修改数据库字段
*/
private Boolean allowCancelRunningProcess;
}

View File

@ -642,6 +642,13 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
if (!Objects.equals(instance.getStartUserId(), String.valueOf(userId))) {
throw exception(PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF);
}
// 1.3 校验允许撤销审批中的申请
BpmProcessDefinitionInfoDO processDefinitionInfo = processDefinitionService.getProcessDefinitionInfo(instance.getProcessDefinitionId());
Assert.notNull(processDefinitionInfo, "流程定义({})不存在", processDefinitionInfo);
if (processDefinitionInfo.getAllowCancelRunningProcess() != null // 防止未配置 AllowCancelRunningProcess , 默认为可取消
&& !processDefinitionInfo.getAllowCancelRunningProcess()) {
throw exception(PROCESS_INSTANCE_CANCEL_FAIL_NOT_ALLOW);
}
// 2. 取消流程
updateProcessInstanceCancel(cancelReqVO.getId(),