1. 程式人生 > 其它 >flowable獲取流程發起人的三種方式

flowable獲取流程發起人的三種方式

技術標籤:flowablejava

1、方式一:

        // 流程發起人
        ProcessInstance processInstance = SpringUtil.getBean(RuntimeService.class)
                .createProcessInstanceQuery()
                .processInstanceId(execution.getProcessInstanceId())
                .singleResult();
        String startUserId = processInstance.getStartUserId();

2、方式二:

        // 獲取流程發起人
        HistoricProcessInstance hi = SpringUtil.getBean(HistoryService.class).createHistoricProcessInstanceQuery()
                .processInstanceId(execution.getProcessInstanceId())
                .singleResult();
        String startUserId = hi.getStartUserId();

3、方式三:

        HistoryService historyService = SpringUtil.getBean(HistoryService.class);
        HistoricProcessInstance hi = historyService.createHistoricProcessInstanceQuery()
                .processInstanceId(execution.getProcessInstanceId())
                .singleResult();
        Long startUserId =  Long.parseLong(hi.getStartUserId());