Activiti判斷流程是否結束

wlj030341發表於2020-12-23

Activiti判斷流程是否結束

public String checkProcessOver(String processInstanceId) {

    //先查歷史表
    HistoricProcessInstance historicProcessInstance =historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
    if(Objects.isNull(historicProcessInstance))
    {
        return "processInstance is not exsits";
    }
    //查詢正在執行的流程
    Execution execution = runtimeService.createExecutionQuery().processInstanceId(processInstanceId).singleResult();
    if(Objects.isNull(execution))
    {
        return "over";
    }
    else
    {
        return "not over";
    }
}

相關文章