Ejemplo n.º 1
0
 // 获取实例的审批历史
 @DataProvider
 public Collection<HistoryTask> loadHistoryTask(String taskId) {
   Task task = taskClient.getTask(Long.valueOf(taskId));
   HistoryTaskQuery query = historyService.createHistoryTaskQuery();
   query.addOrderDesc("endDate");
   query.rootProcessInstanceId(task.getRootProcessInstanceId());
   return query.list();
 }
Ejemplo n.º 2
0
  // 完成任务
  @Expose
  public void completeTask(String taskId, String opinion) {
    long id = Long.valueOf(taskId);

    try {
      if (StringUtils.isNotEmpty(opinion)) {
        // 审批意见
        TaskOpinion taskOpinion = new TaskOpinion(opinion);
        // 开始任务
        taskClient.start(Long.valueOf(taskId));
        taskClient.complete(Long.valueOf(taskId), taskOpinion);

      } else {
        // 开始任务
        taskClient.start(Long.valueOf(taskId));
        taskClient.complete(Long.valueOf(taskId));
      }
    } catch (Exception e) {
      taskClient.rollback(id, "分公司计划员");
    }
  }
Ejemplo n.º 3
0
 // 撤回上一节点
 @Expose
 public String withdrawTask(String taskId, String opinion) {
   long taskId_ = Long.valueOf(taskId);
   try {
     if (StringUtils.isNotEmpty(opinion)) {
       // 审批意见
       TaskOpinion taskOpinion = new TaskOpinion(opinion);
       if (taskService.canWithdraw(taskId_)) {
         taskService.withdraw(taskId_, taskOpinion);
         return null;
       }
     } else {
       if (taskService.canWithdraw(taskId_)) {
         taskService.withdraw(taskId_);
         return null;
       }
     }
   } catch (Exception e) {
     taskClient.rollback(taskId_, "分公司计划员");
   }
   return "当前任务不可撤回";
 }