一、开始流程
identityService.setAuthenticatedUserId(userId);
try {
runtimeService.startProcessInstanceById(processDefinitionId, businessKey, variables);
} catch (Exception e) {
e.printStackTrace();
throw new FlowableException("流程启动失败," + e.getMessage());
} finally {
identityService.setAuthenticatedUserId(null);
}
二、流程操作
runtimeService.suspendProcessInstanceById(processInstanceId);
runtimeService.activateProcessInstanceById(processInstanceId);
taskService.claim(taskId, userId);
taskService.complete(taskId, variables);
taskService.setOwner(taskId, userId);
taskService.setAssignee(taskId, assigneeUserId);