Esempio n. 1
0
 /**
  * @param businessKey
  * @return
  */
 @Override
 public List<ProcessInstance> queryProcessInstancesSuspendedByBusinessKey(String businessKey) {
   ProcessInstanceQuery query =
       runtimeService
           .createProcessInstanceQuery()
           .processInstanceBusinessKey(businessKey)
           .suspended()
           .orderByProcessInstanceId()
           .desc();
   List<ProcessInstance> list = query.listPage(0, 100);
   return list;
 }
Esempio n. 2
0
  /**
   * @param tasks
   * @return
   */
  public List<TaskVo> buildTaskVos(List<Task> tasks) {
    List<TaskVo> taskRtn = new ArrayList<>();

    if (null != tasks && !tasks.isEmpty()) {
      // 根据流程的业务ID查询实体并关联
      for (Task task : tasks) {

        String processInstanceId = task.getProcessInstanceId();
        ProcessInstance processInstance =
            runtimeService
                .createProcessInstanceQuery()
                .processInstanceId(processInstanceId)
                .active()
                .singleResult();
        String businessName = (String) task.getTaskLocalVariables().get(WebConstants.BUSINESS_NAME);
        String taskId = task.getId();
        String businessKey = processInstance.getBusinessKey();

        if (StringUtils.isBlank(businessKey)) {
          continue;
        }
        if (StringUtils.isBlank(businessName)) {
          businessName = getBusinessName(taskId, businessKey);
        }

        ProcessDefinition processDefinition =
            getProcessDefinition(processInstance.getProcessDefinitionId());
        int version = processDefinition.getVersion();
        String taskName = task.getName();
        String createTime =
            DateUtils.SINGLETONE.format(task.getCreateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
        String assignee = task.getAssignee();
        boolean suspended = task.isSuspended();

        String processDefinitionId = processInstance.getProcessDefinitionId();

        TaskVo taskInfo = new TaskVo();
        taskInfo.setProcessInstanceId(processInstanceId);
        taskInfo.setBusinessKey(businessKey);
        taskInfo.setProcessDefinitionId(processDefinitionId);
        taskInfo.setId(taskId);
        taskInfo.setName(taskName);
        taskInfo.setCreateTime(createTime);
        taskInfo.setAssignee(assignee);
        taskInfo.setSuspended(suspended);
        taskInfo.setVersion(version);
        taskInfo.setBusinessName(businessName);
        taskRtn.add(taskInfo);
      }
    }
    return taskRtn;
  }
Esempio n. 3
0
 /**
  * @param businessKey
  * @return
  */
 @Override
 public List<ProcessInstance> queryProcessInstancesActiveByBusinessKey(
     String businessKey, String processDefinitionKey) {
   ProcessInstanceQuery query =
       runtimeService
           .createProcessInstanceQuery()
           .processInstanceBusinessKey(businessKey, processDefinitionKey)
           .active()
           .orderByProcessInstanceId()
           .desc();
   List<ProcessInstance> list = query.listPage(0, 100);
   return list;
 }
Esempio n. 4
0
 @Override
 public ProcessInstance startProcessInstanceByBussKey(String businessKey, String businessName) {
   return runtimeService.startProcessInstanceById(businessKey);
 }
Esempio n. 5
0
 /** @param processInstanceId */
 public void suspendProcessInstanceById(String processInstanceId) {
   runtimeService.suspendProcessInstanceById(processInstanceId);
 }