异常信息:

org.activiti.engine.ActivitiException: No outgoing sequence flow of the exclusive gateway 'Gateway_12b2b29' could be selected for continuing the process

	at org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior.leave(ExclusiveGatewayActivityBehavior.java:105)
	at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.execute(FlowNodeActivityBehavior.java:38)
	at org.activiti.engine.impl.agenda.ContinueProcessOperation.executeActivityBehavior(ContinueProcessOperation.java:211)
	at org.activiti.engine.impl.agenda.ContinueProcessOperation.executeSynchronous(ContinueProcessOperation.java:145)

在这里插入图片描述

出现原因:如上图,一审到二审的时候、二审到三审,完成任务代码如下,所以此时status=1

            Map<String, Object> map = new HashMap<>();
            map.put("status", 1);
            taskService.complete(task.getId(), map);

当三审的时候,想完成,得status=2完成

            Map<String, Object> map = new HashMap<>();
            map.put("status", 2);
            taskService.complete(task.getId(), map);

这时就会报上面得异常信息了,因为这时候得status=1,排他网关找不到对应得流程了

在这里插入图片描述

所以,得将status=2覆盖status=1,需要如下操作,加多个true参数,将提供的变量存储在任务本地

            Map<String, Object> map = new HashMap<>();
            map.put("status", 2);
            taskService.complete(task.getId(), map, true);
  /**
   * Called when the task is successfully executed, and the required task parameters are given by the end-user.
   * 
   * @param taskId
   *          the id of the task to complete, cannot be null.
   * @param variables
   *          task parameters. May be null or empty.
   * @param localScope 将提供的变量存储在任务本地
   *          If true, the provided variables will be stored task-local, instead of process instance wide (which is the default for {@link #complete(String, Map)}).
   * @throws ActivitiObjectNotFoundException
   *           when no task exists with the given id.
   */
  void complete(String taskId, Map<String, Object> variables, boolean localScope);
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐