@GetMapping("/tasks") @Authorize(action = Permission.ACTION_QUERY) @ApiOperation("查询当前用户的历史任务信息") public ResponseMessage<PagerResult<TaskInfo>> getHistory(QueryParamEntity query, Authentication authentication) { HistoricTaskInstanceQuery historyQuery = historyService.createHistoricTaskInstanceQuery(); historyQuery.taskAssignee(authentication.getUser().getId()); PagerResult<TaskInfo> result = QueryUtils.doQuery(historyQuery, query, TaskInfo::of, (term, q) -> { if ("status".equals(term.getColumn())) { switch (String.valueOf(term.getValue())) { case "finished": q.finished(); break; case "processFinished": q.processFinished(); break; default: break; } } }); return ResponseMessage.ok(result).exclude(query.getExcludes()).include(query.getIncludes()); }
processEngine.getTaskService().createTaskQuery().count()); metrics.put("completedTaskCount", processEngine.getHistoryService().createHistoricTaskInstanceQuery().finished().count()); processEngine.getHistoryService().createHistoricTaskInstanceQuery().finished().taskCompletedAfter( new Date(System.currentTimeMillis() - secondsForDays(1))).count());
(userId).finished().orderByTaskCreateTime().desc().list(); for (HistoricTaskInstance taskInstance : taskInstances) { processInstanceIdSet.add(taskInstance.getProcessInstanceId());
protected HistoricTaskInstanceQuery createQuery() { return historyService.createHistoricTaskInstanceQuery().taskOwner(userId).finished(); }
/** * simulate task execution * take randomly one task from the history and use its duration for simulation * */ public long simulateTaskExecution(TaskEntity execTask, Map<String, Object> variables) { List<HistoricTaskInstance> historicInstances = historyService.createHistoricTaskInstanceQuery() .taskDefinitionKey( execTask.getTaskDefinitionKey() ).finished().list(); if ( historicInstances.isEmpty() ) //use backupExecutor return backUpExecutor.simulateTaskExecution(execTask, variables); // get random historic instance HistoricTaskInstance historicTask = historicInstances.get( SimUtils.getRandomInt( historicInstances.size() )); //@TODO in version 5.12 use time spend on task return historicTask.getDurationInMillis(); }
final HistoricTaskInstance executedTask = this.historyService.createHistoricTaskInstanceQuery().finished() .taskId(taskToComplete.getId()).includeProcessVariables().includeTaskLocalVariables().singleResult(); if (executedTask == null) {
@GetMapping("/tasks") @Authorize(action = Permission.ACTION_QUERY) @ApiOperation("查询当前用户的历史任务信息") public ResponseMessage<PagerResult<TaskInfo>> getHistory(QueryParamEntity query, Authentication authentication) { HistoricTaskInstanceQuery historyQuery = historyService.createHistoricTaskInstanceQuery(); historyQuery.taskAssignee(authentication.getUser().getId()); PagerResult<TaskInfo> result = QueryUtils.doQuery(historyQuery, query, TaskInfo::of, (term, q) -> { if ("status".equals(term.getColumn())) { switch (String.valueOf(term.getValue())) { case "finished": q.finished(); break; case "processFinished": q.processFinished(); break; default: break; } } }); return ResponseMessage.ok(result).exclude(query.getExcludes()).include(query.getIncludes()); }
processEngine.getTaskService().createTaskQuery().count()); metrics.put("completedTaskCount", processEngine.getHistoryService().createHistoricTaskInstanceQuery().finished().count()); processEngine.getHistoryService().createHistoricTaskInstanceQuery().finished().taskCompletedAfter( new Date(System.currentTimeMillis() - secondsForDays(1))).count());
.taskId(taskId) .taskOwner(loggedInUserId) .finished() .count() == 1;
} else if (this.historyService.createHistoricTaskInstanceQuery().finished().processInstanceId(processInstanceId) .taskDefinitionKey(this.userTaskId).singleResult() != null) {
taskQuery.unfinished(); } else if ("1".equals(getWorkflowStatus())) { taskQuery.finished();
private HistoricTaskInstanceQuery createHistoricTaskQuery(WorkflowTaskQuery query) HistoricTaskInstanceQuery historicQuery = historyService.createHistoricTaskInstanceQuery().finished();
private HistoricTaskInstanceQuery createHistoricTaskQuery(WorkflowTaskQuery query) HistoricTaskInstanceQuery historicQuery = historyService.createHistoricTaskInstanceQuery().finished();
query.finished(); } else { query.unfinished();