activiti 设置流程变量

流程变量

在启动节点设置流程变量

在启动时直接在启动的方法中将流程变量设置,这时候在正在运行的表中是有保存流程变量的,而在历史变量表中同样也会有存在变量

    Map<String,Object> map = new HashMap();

        map.put("applyUserId","qwer");

        map.put("applyTitle","test_请假申请流程");

        map.put("applyTime","7");

        map.put("applyCtreateTime",new Date());

        map.put("applyReason","结婚");

runtimeService.startProcessInstanceByKey("deploy_classpath",map);

流程启动后在数据表中以下表会自动保存流程变量




在任务中设置变量

完成任务的时候将变量保存,在流程任务节点办理完成是设置流程变量在act_ru_variable表中是不会存在变量的,而在历史变量表中是存在的

    @Test

    public void test_completeTask(){

       

        RepositoryServicerepositoryService =   processEngine().getRepositoryService();

       

        Map<String,Object>varlues = new HashMap();

        varlues.put("applyTitle","test_请假申请流程");

        varlues.put("applyTime","7");

        varlues.put("applyReason","结婚");

        TaskServicetaskService =processEngine().getTaskService();

        taskService.complete("5005",varlues);

}

历史流程变量表:



猜你喜欢

转载自blog.csdn.net/qi95719/article/details/66002497