当前位置:网站首页>Activiti practice

Activiti practice

2022-06-23 22:09:00 Is paidaxing there

1. actual combat

// Rendering dynamic forms 
    @GetMapping(path = "/formDataShow")
    public AjaxResponse formDataShow(String taskId) {
        try {
            if(GlobalConfig.Test){
                securityUtil.logInAs("bajie");
            }
            Task task = taskRuntime.task(taskId);
            UserTask userTask = (UserTask)repositoryService.getBpmnModel(task.getProcessDefinitionId())
                    .getFlowElement(task.getFormKey());
            List<FormProperty> formPropertiesList = userTask.getFormProperties();
            for(FormProperty formProperty:formPropertiesList){
            }
            return AjaxResponse.ajaxData(GlobalConfig.ResponseCode.SUCCESS.getCode(),
                    GlobalConfig.ResponseCode.SUCCESS.getDesc(),null);
        }catch (Exception e){
            return AjaxResponse.ajaxData(GlobalConfig.ResponseCode.ERROR.getCode()," Failed to render dynamic form !",null);
        }
    }
Task task = taskRuntime.task(taskId);
            UserTask userTask = (UserTask)repositoryService.getBpmnModel(task.getProcessDefinitionId())
                    .getFlowElement(task.getFormKey());
            List<FormProperty> formPropertiesList = userTask.getFormProperties();
            for(FormProperty formProperty:formPropertiesList){
            }

Among them, we get the task through acquisition , And then through the form key(task.getFormKey()) To get to the userTask, In theory, we should transfer the task key That is to say :

Only with this value can we get the properties of the form , But we can't get this key, So only when drawing the flow chart , We put the form key Task related key Set to consistent , In this way, we pass in the key That is, with the task key Consistent to get userTask 了 .

Let's draw the flow chart :

The executors of the two tasks are designated as bajie, Then we put the form key All assigned to task key Agreement .

Then we just add a few forms as shown in the figure , Write values casually , Then the process is downloaded and released .

Then call the interface we wrote above , View the attribute values of the form :

It seems that we haven't got any data , Just get a form type and key.

But we can use another way to get the data :

原网站

版权声明
本文为[Is paidaxing there]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/12/202112181145227257.html