Ejemplo n.º 1
0
 /**
  * @Title: isJointTask @Description: 根据taskId判断是否是会签任务节点
  *
  * @param @param taskId
  * @param @return 设定文件
  * @return boolean 返回类型
  * @throws
  */
 public boolean isJointTask(String taskId) {
   Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
   if (task.getTaskLocalVariables().containsKey("nrOfInstances")) {
     return true;
   } else {
     return true;
   }
 }
Ejemplo 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;
  }