You can create a variable "assignee" in process.
results.put("assignee", userId);
localTaskService.completeWithResults(taskId, userId, results);
you put the userId in results map, and then you can get the value of the variable "assignee" in the on-exit action of the node.
the snippet code in the on-exit action:
System.out.println("the assignee of the task node is"+assignee);