See to-do tasks in done tasks

Describe the bug
See to-do tasks in done tasks
我在我的已办事项里看到了待办事项

Expected behavior
To-do tasks should not be included in your done list
我觉得不应该在我的已办事项里看到待办事项

Code

HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery() .includeProcessVariables() .involvedUser(SystemUtil.getStrUserId()) .orderByProcessInstanceStartTime() .desc();

Additional context
Can you show me how to modify this query to achieve my purpose
我用上面的代码来查询的已办事项,但是会把待办事项也查询出来,不知道怎么优化我的查询语句

Hi @luoxiaofeng1029

Active Tasks:

List<HistoricTaskInstance> activeTasks = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().taskInvolvedUser(SystemUtil.getStrUserId()).unfinished().orderByTaskCreateTime().desc().list();

Completed Tasks:

List<HistoricTaskInstance> completedTasks = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().taskInvolvedUser(SystemUtil.getStrUserId()).finished().orderByTaskCreateTime().desc().list();

Regards,
Simon

1 Like

Thank you for your timely reply, which successfully solved my problem. Thank you again!