How can activiti check the number of tasks I transferred

duhaiyun2010 注册会员
2023-02-28 22:08
< div class = "md_content_show e397 data - v - 3967" = "" >

thank you for your bosses to reassure

deadboy0 注册会员
2023-02-28 22:08
< div class = "md_content_show e397 data - v - 3967" = "" >

if it helps Thank you also please take

cwxhxf 注册会员
2023-02-28 22:08

Another problem is that my process is not necessarily completed, it may be unfinished to reach the current user, and then the current user to someone else

a112780070 注册会员
2023-02-28 22:08

This answer quotes ChatGPT

To query the number of tasks transferred from Activiti, you can do the following:

First gets the ID of the current user, which can be done with the following code:

String userId = "current_user_id";

Then create a task query object using the createTaskQuery() method in TaskService, which can be implemented using the following code:

TaskService taskService = processEngine.getTaskService();
TaskQuery taskQuery = taskService.createTaskQuery();

Then set the search conditions. Set the task leader to the current user, set the status to Completed, and set the original task leader not to the current user. This can be implemented using the following code:

List tasks = taskQuery.taskAssignee(userId)
    .taskVariableValueNotEquals("originalAssignee", userId)

the above code USES taskVariableValueNotEquals() method to eliminate the current user is responsible for the task of original, because you are looking for has been passed on to other tasks.

Finally, the tasks.size() method can be used to get the number of qualified tasks, which is the number of tasks transferred out. This can be implemented using the following code:

int transferredTasks = tasks.size();

This way, you can use Activiti's API to query the number of tasks transferred. Please note that the above code only works with Activiti 7 and later. If you are using an older version of Activiti, you may need to use a different API.

edithnith 注册会员
2023-02-28 22:08
String assignee = "转交人的用户名";
TaskService taskService = processEngine.getTaskService();
List tasks = taskService.createTaskQuery().taskAssignee(assignee).list();
int transferredCount = 0;
for (Task task : tasks) {
    DelegationState state = task.getDelegationState();
    if (state != null && state.equals(DelegationState.PENDING)) {
System.out.println("转交出去的任务个数: " + transferredCount);

This code firstly looks up all the tasks assigned by the user via the taskAssignee method, then iterates through the task list and obtains the delegate status of the task via the getDelegationState method. If the delegate status is PENDING, it indicates that the task is transferred. Count the number of tasks transferred.

ycwc880924wc 注册会员
2023-02-28 22:08
< div class = "md_content_show e397 data - v - 3967" = "" >

thank you, just send it with the front of the current user name

About the Author

Question Info

Publish Time
2023-02-28 22:07
Update Time
2023-02-28 22:07

Related Question

How to read Nginx config files automatically?





我如何从Firebase Appcheck应用程序验证注销?

How to avoid automated action beeing executed based on condition ? - Odoo

Error: Cannot find module 'C:\Windows\System32\node_modules\@vue\cli\bin\vue.js'

能看一下怎么改吗?thank you!(就是用scanf输入一个二维数组)

ALB logs showing elb_status_code is 502