0
Follow
0
View

How do I check the number of approvals that someone CC me on activiti technology

donglei2860 注册会员
2023-02-27 18:29
< div class = "md_content_show e397 data - v - 3967" = "" >

, I just need to get the number of cc, don't need to look at other, this can be done code

ljliujin 注册会员
2023-02-27 18:29

Use the task query API to find out how many tasks other users have cc'd you. The taskInvolvedUser(String involvedUser) method in the TaskQuery class is used to query all the tasks associated with a particular user, including those that were copied.
You may refer to this passage:

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task;
import org.activiti.engine.task.TaskQuery;

public class CountInvolvedTasks {
    public static void main(String[] args) {
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        TaskService taskService = processEngine.getTaskService();

        String involvedUser = "exampleuser"; // 要查询的用户
        TaskQuery query = taskService.createTaskQuery().taskInvolvedUser(involvedUser);

        long count = query.count(); // 获取与特定用户相关的所有任务数量,包括被抄送的任务

        System.out.println("任务数量:" + count);
    }
}


First gets an instance of the Activiti engine and gets the TaskService instance from it. A variable named involvedUser is then defined, which contains the ID of the user to be queried. Next, a TaskQuery object is created and the taskInvolvedUser(String involvedUser) method is used to specify the user to be queried. The count() method is most called to get the number of all tasks associated with the user, including those that were copied

About the Author

Question Info

Publish Time
2023-02-27 18:29
Update Time
2023-02-27 18:29