mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-02-03 04:04:58 +08:00
【文案修改】工作流:“回退”统一改成“退回”,和飞书保持一致
This commit is contained in:
parent
8a8544b3bd
commit
206b3ea9d2
@ -44,7 +44,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode TASK_NOT_EXISTS = new ErrorCode(1_009_005_002, "流程任务不存在");
|
||||
ErrorCode TASK_IS_PENDING = new ErrorCode(1_009_005_003, "当前任务处于挂起状态,不能操作");
|
||||
ErrorCode TASK_TARGET_NODE_NOT_EXISTS = new ErrorCode(1_009_005_004, " 目标节点不存在");
|
||||
ErrorCode TASK_RETURN_FAIL_SOURCE_TARGET_ERROR = new ErrorCode(1_009_005_006, "回退任务失败,目标节点是在并行网关上或非同一路线上,不可跳转");
|
||||
ErrorCode TASK_RETURN_FAIL_SOURCE_TARGET_ERROR = new ErrorCode(1_009_005_006, "退回任务失败,目标节点是在并行网关上或非同一路线上,不可跳转");
|
||||
ErrorCode TASK_DELEGATE_FAIL_USER_REPEAT = new ErrorCode(1_009_005_007, "任务委派失败,委派人和当前审批人为同一人");
|
||||
ErrorCode TASK_DELEGATE_FAIL_USER_NOT_EXISTS = new ErrorCode(1_009_005_008, "任务委派失败,被委派人不存在");
|
||||
ErrorCode TASK_SIGN_CREATE_USER_NOT_EXIST = new ErrorCode(1_009_005_009, "任务加签:选择的用户不存在");
|
||||
|
@ -158,7 +158,7 @@ public class BpmTaskController {
|
||||
}
|
||||
|
||||
@GetMapping("/list-by-return")
|
||||
@Operation(summary = "获取所有可回退的节点", description = "用于【流程详情】的【回退】按钮")
|
||||
@Operation(summary = "获取所有可退回的节点", description = "用于【流程详情】的【退回】按钮")
|
||||
@Parameter(name = "taskId", description = "当前任务ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('bpm:task:update')")
|
||||
public CommonResult<List<BpmTaskRespVO>> getTaskListByReturn(@RequestParam("id") String id) {
|
||||
@ -168,7 +168,7 @@ public class BpmTaskController {
|
||||
}
|
||||
|
||||
@PutMapping("/return")
|
||||
@Operation(summary = "回退任务", description = "用于【流程详情】的【回退】按钮")
|
||||
@Operation(summary = "退回任务", description = "用于【流程详情】的【退回】按钮")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:task:update')")
|
||||
public CommonResult<Boolean> returnTask(@Valid @RequestBody BpmTaskReturnReqVO reqVO) {
|
||||
taskService.returnTask(getLoginUserId(), reqVO);
|
||||
|
@ -10,19 +10,18 @@ import lombok.Data;
|
||||
@Data
|
||||
public class BpmApprovalDetailReqVO {
|
||||
|
||||
// TODO @jason:这里要不注释说明下,什么情况下,使用 processDefinitionId、processInstanceId、activityId、taskId。
|
||||
|
||||
@Schema(description = "流程定义的编号", example = "1024")
|
||||
private String processDefinitionId; // 发起流程的时候传流程定义 Id
|
||||
private String processDefinitionId; // 发起流程的时候传流程定义 ID
|
||||
|
||||
@Schema(description = "流程实例的编号", example = "1024")
|
||||
private String processInstanceId; // 流程已发起时候传流程实例 Id
|
||||
private String processInstanceId; // 流程已发起时候传流程实例 ID
|
||||
|
||||
@Schema(description = "流程活动编号", example = "StartUserNode")
|
||||
private String activityId; // 用于获取表单权限。 发起流程时, 传‘发起人节点’ activityId 可获取发起人的表单权限
|
||||
// TODO @芋艿:如果未来 BPMN 增加流程图,它没有发起人节点,会有问题。
|
||||
@Schema(description = "流程活动编号", example = "StartUserNode")
|
||||
private String activityId; // 用于获取表单权限。1)发起流程时,传“发起人节点” activityId 可获取发起人的表单权限;2)从抄送列表界面进来时,传抄送的 activityId 可获取抄送人的表单权限;
|
||||
|
||||
@Schema(description = "流程任务编号", example = "95f2f08b-621b-11ef-bf39-00ff4722db8b")
|
||||
private String taskId; // 用于获取表单权限。流程已发起时,传任务 Id, 获取任务节点的变得权限
|
||||
private String taskId; // 用于获取表单权限。1)从待审批/已审批界面进来时,传递 taskId 任务编号,可获取任务节点的变得权限
|
||||
|
||||
@AssertTrue(message = "流程定义的编号和流程实例的编号不能同时为空")
|
||||
@JsonIgnore
|
||||
|
@ -5,7 +5,7 @@ import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
@Schema(description = "管理后台 - 回退流程任务的 Request VO")
|
||||
@Schema(description = "管理后台 - 退回流程任务的 Request VO")
|
||||
@Data
|
||||
public class BpmTaskReturnReqVO {
|
||||
|
||||
@ -13,12 +13,12 @@ public class BpmTaskReturnReqVO {
|
||||
@NotEmpty(message = "任务编号不能为空")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "回退到的任务 Key", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "回退到的任务 Key 不能为空")
|
||||
@Schema(description = "退回到的任务 Key", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "退回到的任务 Key 不能为空")
|
||||
private String targetTaskDefinitionKey;
|
||||
|
||||
@Schema(description = "回退意见", requiredMode = Schema.RequiredMode.REQUIRED, example = "我就是想驳回")
|
||||
@NotEmpty(message = "回退意见不能为空")
|
||||
@Schema(description = "退回意见", requiredMode = Schema.RequiredMode.REQUIRED, example = "我就是想驳回")
|
||||
@NotEmpty(message = "退回意见不能为空")
|
||||
private String reason;
|
||||
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public interface BpmnModelConstants {
|
||||
*/
|
||||
String USER_TASK_REJECT_HANDLER_TYPE = "rejectHandlerType";
|
||||
/**
|
||||
* BPMN ExtensionElement 的扩展属性,用于标记用户任务拒绝后的回退的任务 Id
|
||||
* BPMN ExtensionElement 的扩展属性,用于标记用户任务拒绝后的退回的任务 Id
|
||||
*/
|
||||
String USER_TASK_REJECT_RETURN_TASK_ID = "rejectReturnTaskId";
|
||||
|
||||
|
@ -538,7 +538,7 @@ public class BpmnModelUtils {
|
||||
|
||||
/**
|
||||
* 迭代从后向前扫描,判断目标节点相对于当前节点是否是串行
|
||||
* 不存在直接回退到子流程中的情况,但存在从子流程出去到父流程情况
|
||||
* 不存在直接退回到子流程中的情况,但存在从子流程出去到父流程情况
|
||||
*
|
||||
* @param source 起始节点
|
||||
* @param target 目标节点
|
||||
|
File diff suppressed because one or more lines are too long
@ -123,10 +123,10 @@ public interface BpmTaskService {
|
||||
String taskDefineKey);
|
||||
|
||||
/**
|
||||
* 获取当前任务的可回退的 UserTask 集合
|
||||
* 获取当前任务的可退回的 UserTask 集合
|
||||
*
|
||||
* @param id 当前的任务 ID
|
||||
* @return 可以回退的节点列表
|
||||
* @return 可以退回的节点列表
|
||||
*/
|
||||
List<UserTask> getUserTaskListByReturn(String id);
|
||||
|
||||
@ -180,10 +180,10 @@ public interface BpmTaskService {
|
||||
void moveTaskToEnd(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 将任务回退到指定的 targetDefinitionKey 位置
|
||||
* 将任务退回到指定的 targetDefinitionKey 位置
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param reqVO 回退的任务key和当前所在的任务ID
|
||||
* @param reqVO 退回的任务key和当前所在的任务ID
|
||||
*/
|
||||
void returnTask(Long userId, BpmTaskReturnReqVO reqVO);
|
||||
|
||||
|
@ -328,7 +328,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
if (CollUtil.isEmpty(previousUserList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 2.2 过滤:只有串行可到达的节点,才可以回退。类似非串行、子流程无法退回
|
||||
// 2.2 过滤:只有串行可到达的节点,才可以退回。类似非串行、子流程无法退回
|
||||
previousUserList.removeIf(userTask -> !BpmnModelUtils.isSequentialReachable(source, userTask, null));
|
||||
return previousUserList;
|
||||
}
|
||||
@ -588,7 +588,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
BpmUserTaskRejectHandlerType userTaskRejectHandlerType = BpmnModelUtils.parseRejectHandlerType(userTaskElement);
|
||||
if (userTaskRejectHandlerType == BpmUserTaskRejectHandlerType.RETURN_USER_TASK) {
|
||||
String returnTaskId = BpmnModelUtils.parseReturnTaskId(userTaskElement);
|
||||
Assert.notNull(returnTaskId, "回退的节点不能为空");
|
||||
Assert.notNull(returnTaskId, "退回的节点不能为空");
|
||||
returnTask(userId, new BpmTaskReturnReqVO().setId(task.getId())
|
||||
.setTargetTaskDefinitionKey(returnTaskId).setReason(reqVO.getReason()));
|
||||
return;
|
||||
@ -632,12 +632,12 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
FlowElement targetElement = validateTargetTaskCanReturn(task.getTaskDefinitionKey(),
|
||||
reqVO.getTargetTaskDefinitionKey(), task.getProcessDefinitionId());
|
||||
|
||||
// 2. 调用 Flowable 框架的回退逻辑
|
||||
// 2. 调用 Flowable 框架的退回逻辑
|
||||
returnTask(task, targetElement, reqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 回退流程节点时,校验目标任务节点是否可回退
|
||||
* 退回流程节点时,校验目标任务节点是否可退回
|
||||
*
|
||||
* @param sourceKey 当前任务节点 Key
|
||||
* @param targetKey 目标任务节点 key
|
||||
@ -655,7 +655,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
throw exception(TASK_TARGET_NODE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 2.2 只有串行可到达的节点,才可以回退。类似非串行、子流程无法退回
|
||||
// 2.2 只有串行可到达的节点,才可以退回。类似非串行、子流程无法退回
|
||||
if (!BpmnModelUtils.isSequentialReachable(source, target, null)) {
|
||||
throw exception(TASK_RETURN_FAIL_SOURCE_TARGET_ERROR);
|
||||
}
|
||||
@ -663,10 +663,10 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行回退逻辑
|
||||
* 执行退回逻辑
|
||||
*
|
||||
* @param currentTask 当前回退的任务
|
||||
* @param targetElement 需要回退到的目标任务
|
||||
* @param currentTask 当前退回的任务
|
||||
* @param targetElement 需要退回到的目标任务
|
||||
* @param reqVO 前端参数封装
|
||||
*/
|
||||
public void returnTask(Task currentTask, FlowElement targetElement, BpmTaskReturnReqVO reqVO) {
|
||||
@ -679,9 +679,9 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
List<UserTask> returnUserTaskList = BpmnModelUtils.iteratorFindChildUserTasks(targetElement, runTaskKeyList, null, null);
|
||||
List<String> returnTaskKeyList = convertList(returnUserTaskList, UserTask::getId);
|
||||
|
||||
// 2. 给当前要被回退的 task 数组,设置回退意见
|
||||
// 2. 给当前要被退回的 task 数组,设置退回意见
|
||||
taskList.forEach(task -> {
|
||||
// 需要排除掉,不需要设置回退意见的任务
|
||||
// 需要排除掉,不需要设置退回意见的任务
|
||||
if (!returnTaskKeyList.contains(task.getTaskDefinitionKey())) {
|
||||
return;
|
||||
}
|
||||
@ -1061,7 +1061,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
}
|
||||
// 审批人与提交人为同一人时,根据 BpmUserTaskAssignStartUserHandlerTypeEnum 策略进行处理
|
||||
if (StrUtil.equals(task.getAssignee(), processInstance.getStartUserId())) {
|
||||
// 判断是否为回退或者驳回:如果是回退或者驳回不走这个策略
|
||||
// 判断是否为退回或者驳回:如果是退回或者驳回不走这个策略
|
||||
// TODO 芋艿:【优化】未来有没更好的判断方式?!另外,还要考虑清理机制。就是说,下次处理了之后,就移除这个标识
|
||||
Boolean returnTaskFlag = runtimeService.getVariable(processInstance.getProcessInstanceId(),
|
||||
String.format(PROCESS_INSTANCE_VARIABLE_RETURN_FLAG, task.getTaskDefinitionKey()), Boolean.class);
|
||||
|
Loading…
Reference in New Issue
Block a user