Activiti并行节点驳回实现,会签节点并行已审核人判断

landi爱豆 发布于 2018/03/30 13:03
阅读 2K+
收藏 1

 

网上找过很多Activiti驳回的例子,但是实际使用过程中,并行节点驳回的时候会出现节点错乱的情况,或者是驳回到并行节点。

节点跳转:

public class JumpTaskCmd implements Command<Comment> {  
    protected String executionId;
    protected String activityId;

    public JumpTaskCmd(String executionId, String activityId) {
        this.executionId = executionId;
        this.activityId = activityId;
    }

    public Comment execute(CommandContext commandContext) {
        for (TaskEntity taskEntity : Context.getCommandContext().getTaskEntityManager().findTasksByExecutionId(executionId)) {
            Context.getCommandContext().getTaskEntityManager()
                    .deleteTask(taskEntity, "jump", false);
        }
        ExecutionEntity executionEntity = Context.getCommandContext()
                .getExecutionEntityManager().findExecutionById(executionId);
        ProcessDefinitionImpl processDefinition = executionEntity
                .getProcessDefinition();
        ActivityImpl activity = processDefinition.findActivity(activityId);
        executionEntity.executeActivity(activity);
        return null;
    }
}

 

对并行节点驳回时的补充:

并行节点驳回时,会同时出现多个目标节点造成流程错乱,删除多余的节点,暂时没有判断目标节点类型:

public class RemoveTaskCmd implements Command<Comment>  {

    protected String procInstId;

    public RemoveTaskCmd(String procInstId){
        this.procInstId = procInstId;
    }

    @Override
    public Comment execute(CommandContext commandContext) {
        List<TaskEntity> te = Context.getCommandContext().
                getTaskEntityManager().
                findTasksByProcessInstanceId(this.procInstId);
        te.remove(0);
        for (TaskEntity taskEntity : te){
            Context.getCommandContext().getTaskEntityManager()
            .deleteTask(taskEntity, "jump", false);
        }
        return null;
    }

}

 

会签节点并行已审核人的判断,之前是用ExecutionId来确认,在历史节点中查找,后来发现会签节点只有在串行的时候,实例的ExecutionId是一致的。

第一次发帖,希望能得到大家的回答。。。。。

加载中
返回顶部
顶部