Java Code Examples for org.activiti.engine.history.HistoricTaskInstanceQuery#taskCompletedBefore()
The following examples show how to use
org.activiti.engine.history.HistoricTaskInstanceQuery#taskCompletedBefore() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActTaskService.java From Shop-for-JavaWeb with MIT License | 5 votes |
/** * 获取已办任务 * @param page * @param procDefKey 流程定义标识 * @return */ public Page<Act> historicList(Page<Act> page, Act act){ String userId = UserUtils.getUser().getLoginName();//ObjectUtils.toString(UserUtils.getUser().getId()); HistoricTaskInstanceQuery histTaskQuery = historyService.createHistoricTaskInstanceQuery().taskAssignee(userId).finished() .includeProcessVariables().orderByHistoricTaskInstanceEndTime().desc(); // 设置查询条件 if (StringUtils.isNotBlank(act.getProcDefKey())){ histTaskQuery.processDefinitionKey(act.getProcDefKey()); } if (act.getBeginDate() != null){ histTaskQuery.taskCompletedAfter(act.getBeginDate()); } if (act.getEndDate() != null){ histTaskQuery.taskCompletedBefore(act.getEndDate()); } // 查询总数 page.setCount(histTaskQuery.count()); // 查询列表 List<HistoricTaskInstance> histList = histTaskQuery.listPage(page.getFirstResult(), page.getMaxResults()); for (HistoricTaskInstance histTask : histList) { Act e = new Act(); e.setHistTask(histTask); e.setVars(histTask.getProcessVariables()); // e.setTaskVars(histTask.getTaskLocalVariables()); // System.out.println(histTask.getId()+" = "+histTask.getProcessVariables() + " ========== " + histTask.getTaskLocalVariables()); e.setProcDef(ProcessDefCache.get(histTask.getProcessDefinitionId())); // e.setProcIns(runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult()); // e.setProcExecUrl(ActUtils.getProcExeUrl(task.getProcessDefinitionId())); e.setStatus("finish"); page.getList().add(e); } return page; }