/**
* 查询当前个人待执行的任务
*/
@Test
public void testFindPersonalTaskList() {
// 任务负责人
String assignee = "worker";
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 创建TaskService
TaskService taskService = processEngine.getTaskService();
// 根据流程key 和 任务负责人 查询任务
List<Task> list = taskService.createTaskQuery()
.processDefinitionKey("myLeave") //流程Key
.taskAssignee(assignee)//只查询该任务负责人的任务
.list();
for (Task task : list) {
System.out.println("流程实例id:" + task.getProcessInstanceId());
System.out.println("任务id:" + task.getId());
System.out.println("任务负责人:" + task.getAssignee());
System.out.println("任务名称:" + task.getName());
}
}
com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.roy.ActivitiDemo,testFindPersonalTaskList
2023-06-02 22:14:56,401 0 [ main] INFO activiti.engine.ProcessEngines - Initializing process engine using configuration 'file:/D:/workspace/20210614/ActivitiDemo/BasicDemo/target/classes/activiti.cfg.xml'
2023-06-02 22:14:56,403 2 [ main] INFO activiti.engine.ProcessEngines - initializing process engine for resource file:/D:/workspace/20210614/ActivitiDemo/BasicDemo/target/classes/activiti.cfg.xml
2023-06-02 22:14:56,680 279 [ main] DEBUG ry.xml.XmlBeanDefinitionReader - Loaded 2 bean definitions from InputStream resource [resource loaded through InputStream]
2023-06-02 22:14:56,682 281 [ main] DEBUG ort.DefaultListableBeanFactory - Creating shared instance of singleton bean 'processEngineConfiguration'
2023-06-02 22:14:56,931 530 [ main] DEBUG ort.DefaultListableBeanFactory - Creating shared instance of singleton bean 'dataSource'
2023-06-02 22:14:59,045 2644 [ main] DEBUG ProcessEngineConfigurationImpl - database product name: 'MySQL'
2023-06-02 22:14:59,045 2644 [ main] DEBUG ProcessEngineConfigurationImpl - using database type: mysql
2023-06-02 22:14:59,159 2758 [ main] DEBUG ache.ibatis.logging.LogFactory - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/D:/studysoftware/mavenRepository-gpidea/org/mybatis/mybatis/3.4.5/mybatis-3.4.5.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.apache.ibatis.reflection.Reflector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2023-06-02 22:15:00,051 3650 [ main] DEBUG mpl.interceptor.LogInterceptor -
2023-06-02 22:15:00,051 3650 [ main] DEBUG mpl.interceptor.LogInterceptor - --- starting SchemaOperationsProcessEngineBuild --------------------------------------------------------
2023-06-02 22:15:00,055 3654 [ main] DEBUG da.DefaultActivitiEngineAgenda - Operation class org.activiti.engine.impl.interceptor.CommandInvoker$1 added to agenda
2023-06-02 22:15:00,063 3662 [ main] DEBUG ti.engine.impl.db.DbSqlSession - Executing performSchemaOperationsProcessEngineBuild with setting true
2023-06-02 22:15:00,063 3662 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Opening JDBC Connection
2023-06-02 22:15:00,074 3673 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Setting autocommit to false on JDBC Connection [jdbc:mysql://localhost:3306/activiti?serverTimezone=GMT%2B8, UserName=root@localhost, MySQL Connector/J]
2023-06-02 22:15:00,115 3714 [ main] DEBUG pertyEntityImpl.selectProperty - ==> Preparing: select * from ACT_GE_PROPERTY where NAME_ = ?
2023-06-02 22:15:00,141 3740 [ main] DEBUG pertyEntityImpl.selectProperty - ==> Parameters: schema.version(String)
2023-06-02 22:15:00,174 3773 [ main] DEBUG pertyEntityImpl.selectProperty - <== Total: 1
2023-06-02 22:15:00,193 3792 [ main] DEBUG ti.engine.impl.db.DbSqlSession - Flushing dbSqlSession
2023-06-02 22:15:00,193 3792 [ main] DEBUG ti.engine.impl.db.DbSqlSession - flush summary: 0 insert, 0 update, 0 delete.
2023-06-02 22:15:00,193 3792 [ main] DEBUG ti.engine.impl.db.DbSqlSession - now executing flush...
2023-06-02 22:15:00,193 3792 [ main] DEBUG aloneMybatisTransactionContext - firing event committing...
2023-06-02 22:15:00,194 3793 [ main] DEBUG aloneMybatisTransactionContext - committing the ibatis sql session...
2023-06-02 22:15:00,194 3793 [ main] DEBUG aloneMybatisTransactionContext - firing event committed...
2023-06-02 22:15:00,195 3794 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Resetting autocommit to true on JDBC Connection [jdbc:mysql://localhost:3306/activiti?serverTimezone=GMT%2B8, UserName=root@localhost, MySQL Connector/J]
2023-06-02 22:15:00,196 3795 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Closing JDBC Connection [jdbc:mysql://localhost:3306/activiti?serverTimezone=GMT%2B8, UserName=root@localhost, MySQL Connector/J]
2023-06-02 22:15:00,196 3795 [ main] DEBUG mpl.interceptor.LogInterceptor - --- SchemaOperationsProcessEngineBuild finished --------------------------------------------------------
2023-06-02 22:15:00,197 3796 [ main] DEBUG mpl.interceptor.LogInterceptor -
2023-06-02 22:15:00,197 3796 [ main] INFO .engine.impl.ProcessEngineImpl - ProcessEngine default created
2023-06-02 22:15:00,204 3803 [ main] DEBUG mpl.interceptor.LogInterceptor -
2023-06-02 22:15:00,204 3803 [ main] DEBUG mpl.interceptor.LogInterceptor - --- starting ValidateExecutionRelatedEntityCountCfgCmd --------------------------------------------------------
2023-06-02 22:15:00,204 3803 [ main] DEBUG da.DefaultActivitiEngineAgenda - Operation class org.activiti.engine.impl.interceptor.CommandInvoker$1 added to agenda
2023-06-02 22:15:00,204 3803 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Opening JDBC Connection
2023-06-02 22:15:00,205 3804 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Setting autocommit to false on JDBC Connection [jdbc:mysql://localhost:3306/activiti?serverTimezone=GMT%2B8, UserName=root@localhost, MySQL Connector/J]
2023-06-02 22:15:00,205 3804 [ main] DEBUG pertyEntityImpl.selectProperty - ==> Preparing: select * from ACT_GE_PROPERTY where NAME_ = ?
2023-06-02 22:15:00,206 3805 [ main] DEBUG pertyEntityImpl.selectProperty - ==> Parameters: cfg.execution-related-entities-count(String)
2023-06-02 22:15:00,207 3806 [ main] DEBUG pertyEntityImpl.selectProperty - <== Total: 1
2023-06-02 22:15:00,208 3807 [ main] DEBUG ti.engine.impl.db.DbSqlSession - Flushing dbSqlSession
2023-06-02 22:15:00,208 3807 [ main] DEBUG ti.engine.impl.db.DbSqlSession - flush summary: 0 insert, 0 update, 0 delete.
2023-06-02 22:15:00,208 3807 [ main] DEBUG ti.engine.impl.db.DbSqlSession - now executing flush...
2023-06-02 22:15:00,208 3807 [ main] DEBUG aloneMybatisTransactionContext - firing event committing...
2023-06-02 22:15:00,208 3807 [ main] DEBUG aloneMybatisTransactionContext - committing the ibatis sql session...
2023-06-02 22:15:00,208 3807 [ main] DEBUG aloneMybatisTransactionContext - firing event committed...
2023-06-02 22:15:00,209 3808 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Resetting autocommit to true on JDBC Connection [jdbc:mysql://localhost:3306/activiti?serverTimezone=GMT%2B8, UserName=root@localhost, MySQL Connector/J]
2023-06-02 22:15:00,210 3809 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Closing JDBC Connection [jdbc:mysql://localhost:3306/activiti?serverTimezone=GMT%2B8, UserName=root@localhost, MySQL Connector/J]
2023-06-02 22:15:00,210 3809 [ main] DEBUG mpl.interceptor.LogInterceptor - --- ValidateExecutionRelatedEntityCountCfgCmd finished --------------------------------------------------------
2023-06-02 22:15:00,210 3809 [ main] DEBUG mpl.interceptor.LogInterceptor -
2023-06-02 22:15:00,210 3809 [ main] INFO activiti.engine.ProcessEngines - initialised process engine default
2023-06-02 22:15:00,212 3811 [ main] DEBUG mpl.interceptor.LogInterceptor -
2023-06-02 22:15:00,212 3811 [ main] DEBUG mpl.interceptor.LogInterceptor - --- starting TaskQueryImpl --------------------------------------------------------
2023-06-02 22:15:00,212 3811 [ main] DEBUG da.DefaultActivitiEngineAgenda - Operation class org.activiti.engine.impl.interceptor.CommandInvoker$1 added to agenda
2023-06-02 22:15:00,261 3860 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Opening JDBC Connection
2023-06-02 22:15:00,262 3861 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Setting autocommit to false on JDBC Connection [jdbc:mysql://localhost:3306/activiti?serverTimezone=GMT%2B8, UserName=root@localhost, MySQL Connector/J]
2023-06-02 22:15:00,263 3862 [ main] DEBUG Impl.selectTaskByQueryCriteria - ==> Preparing: select distinct RES.* from ACT_RU_TASK RES inner join ACT_RE_PROCDEF D on RES.PROC_DEF_ID_ = D.ID_ WHERE RES.ASSIGNEE_ = ? and D.KEY_ = ? order by RES.ID_ asc LIMIT ? OFFSET ?
2023-06-02 22:15:00,263 3862 [ main] DEBUG Impl.selectTaskByQueryCriteria - ==> Parameters: worker(String), myLeave(String), 2147483647(Integer), 0(Integer)
2023-06-02 22:15:00,276 3875 [ main] DEBUG Impl.selectTaskByQueryCriteria - <== Total: 3
2023-06-02 22:15:00,277 3876 [ main] DEBUG ti.engine.impl.db.DbSqlSession - Flushing dbSqlSession
2023-06-02 22:15:00,277 3876 [ main] DEBUG ti.engine.impl.db.DbSqlSession - flush summary: 0 insert, 0 update, 0 delete.
2023-06-02 22:15:00,277 3876 [ main] DEBUG ti.engine.impl.db.DbSqlSession - now executing flush...
2023-06-02 22:15:00,277 3876 [ main] DEBUG aloneMybatisTransactionContext - firing event committing...
2023-06-02 22:15:00,277 3876 [ main] DEBUG aloneMybatisTransactionContext - committing the ibatis sql session...
2023-06-02 22:15:00,277 3876 [ main] DEBUG aloneMybatisTransactionContext - firing event committed...
2023-06-02 22:15:00,279 3878 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Resetting autocommit to true on JDBC Connection [jdbc:mysql://localhost:3306/activiti?serverTimezone=GMT%2B8, UserName=root@localhost, MySQL Connector/J]
2023-06-02 22:15:00,280 3879 [ main] DEBUG ansaction.jdbc.JdbcTransaction - Closing JDBC Connection [jdbc:mysql://localhost:3306/activiti?serverTimezone=GMT%2B8, UserName=root@localhost, MySQL Connector/J]
2023-06-02 22:15:00,280 3879 [ main] DEBUG mpl.interceptor.LogInterceptor - --- TaskQueryImpl finished --------------------------------------------------------
2023-06-02 22:15:00,280 3879 [ main] DEBUG mpl.interceptor.LogInterceptor -
流程实例id:65001
任务id:65005
任务负责人:worker
任务名称:??????
流程实例id:75001
任务id:75005
任务负责人:worker
任务名称:??????
流程实例id:eeed7990-aea5-11ec-91a2-1062e56c337d
任务id:eef0d4f4-aea5-11ec-91a2-1062e56c337d
任务负责人:worker
任务名称:提交请假申请
Process finished with exit code 0