mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-30 07:06:39 +08:00
add 增加委托办理,调整流程启动
This commit is contained in:
parent
91c10d31a4
commit
7428cd42f2
@ -15,11 +15,21 @@ public interface FlowConstant {
|
||||
|
||||
String MESSAGE_CURRENT_TASK_IS_NULL = "当前任务不存在或你不是任务办理人";
|
||||
|
||||
String MESSAGE_SUSPENDED = "当前任务已";
|
||||
String MESSAGE_SUSPENDED = "当前任务已挂起";
|
||||
|
||||
/**
|
||||
* 连线
|
||||
*/
|
||||
String SEQUENCE_FLOW = "sequenceFlow";
|
||||
|
||||
/**
|
||||
* 流程委派标识
|
||||
*/
|
||||
String PENDING = "PENDING";
|
||||
|
||||
/**
|
||||
* 流程启动者
|
||||
*/
|
||||
String INITIATOR = "initiator";
|
||||
|
||||
}
|
||||
|
@ -72,10 +72,11 @@ public class ActTaskServiceImpl implements IActTaskService {
|
||||
map.put("taskId", taskResult.get(0).getId());
|
||||
return map;
|
||||
}
|
||||
// 设置启动人
|
||||
Authentication.setAuthenticatedUserId(String.valueOf(LoginHelper.getUserId()));
|
||||
// 启动流程实例(提交申请)
|
||||
Map<String, Object> variables = startProcessBo.getVariables();
|
||||
// 设置启动人
|
||||
variables.put(FlowConstant.INITIATOR, String.valueOf(LoginHelper.getUserId()));
|
||||
// 启动跳过表达式
|
||||
variables.put("_FLOWABLE_SKIP_EXPRESSION_ENABLED", true);
|
||||
ProcessInstance pi = runtimeService.startProcessInstanceByKeyAndTenantId(startProcessBo.getProcessKey(), startProcessBo.getBusinessKey(), variables, TenantHelper.getTenantId());
|
||||
@ -115,6 +116,14 @@ public class ActTaskServiceImpl implements IActTaskService {
|
||||
if (task == null) {
|
||||
throw new ServiceException(FlowConstant.MESSAGE_CURRENT_TASK_IS_NULL);
|
||||
}
|
||||
//办理委托任务
|
||||
if (ObjectUtil.isNotEmpty(task.getDelegationState()) && FlowConstant.PENDING.equals(task.getDelegationState().name())) {
|
||||
taskService.resolveTask(completeTaskBo.getTaskId());
|
||||
TaskEntity newTask = WorkflowUtils.createNewTask(task);
|
||||
taskService.addComment(newTask.getId(), task.getProcessInstanceId(), completeTaskBo.getMessage());
|
||||
taskService.complete(newTask.getId());
|
||||
return true;
|
||||
}
|
||||
//办理意见
|
||||
taskService.addComment(completeTaskBo.getTaskId(), task.getProcessInstanceId(), StringUtils.isBlank(completeTaskBo.getMessage()) ? "同意" : completeTaskBo.getMessage());
|
||||
//办理任务
|
||||
|
@ -130,6 +130,11 @@ public class WorkflowUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个新任务
|
||||
*
|
||||
* @param currentTask 参数
|
||||
*/
|
||||
public static TaskEntity createNewTask(Task currentTask) {
|
||||
TaskEntity task = null;
|
||||
if (ObjectUtil.isNotEmpty(currentTask)) {
|
||||
|
Loading…
Reference in New Issue
Block a user