activiti Candidates: (Candidate Group) Process Design:

Candidates: Multiple executions can be set, but only one is actually executed. As long as someone signs for the receipt, other people's signature tasks will not have these tasks: that is, as long as someone signs for the task, other people's tasks will be directly deleted (hidden type of deletion)

Process Design



Candidates for the approval node of the Ministry of Personnel: zzz, xxx

After deploying the process: Process Definition ID: Candidate:1:85004

Query node executors (including candidates and candidate groups): act_hi_identitylink

Startup process: 

    public voidstartprocessByKey(String key){

        Stringapplyuser ="zyq";

        identityService.setAuthenticatedUserId(applyuser);

        Map<String,Object> variables = new HashMap() ; // Set process variables

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

        variables .put( "applyTitle" , "test_leave application process " );

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

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

        variables.put ( "applyReason" , " vacation " );

        // Set up candidates: Approval by superior leaders

        Listlist =new ArrayList();

        list.add("zzz");

        list.add("xxx");

        variables.put("managerIds",list);

        ProcessInstanceprocessInstance = runtimeService.startProcessInstanceByKey(key,variables);

   

    Tasktask = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();

    System.out.println(task.getAssignee());

       

    }

 

At this time in the flow table:

Running variables:


Running tasks: (same in history table)


Query candidate tasks: taskCandidateUser/taskCandidateOrAssigned

   List<Task> list = taskService.createTaskQuery().taskCandidateUser(assignee).

                orderByTaskCreateTime().desc().list();//Query the candidate tasks you have

List<Task> list =taskService.createTaskQuery().taskCandidateOrAssigned(assignee)

                .orderByTaskCreateTime().desc().list();//Query the personal & candidate tasks owned

 

Handle candidate tasks

First get the task:

taskService.claim(taskId, assignee);

taskService.complete(taskId,variables);

 

For example: xxx has signed for it

    public void mytaskClaimAComplete(String taskId,String assignee){

        taskService.claim(taskId, assignee);

        Map<String,Object> variables = new HashMap() ; // Set process variables

        variables.put("managerCheckResult", "同意");

        variables .put( "managerCheckreason" , " Available annual leave " );

        variables.put("managerTime",new Date());

        taskService.complete(taskId,variables);

        }

History task list:

Superior leader approver: assingee: xxx

At the approval node of the personnel department, it is also necessary to sign for receipt first;

There is nothing special about the query of completed tasks, just follow the normal query


Guess you like

Origin blog.csdn.net/qi95719/article/details/66474820#comments_19868047