, I just need to get the number of cc, don't need to look at other, this can be done code
0 Answer
, I just need to get the number of cc, don't need to look at other, this can be done code
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
这家伙很懒,什么都没留下...