其中“会签”节点来实现会签功能。
具体节点配置参数如下截图:
1、多实例类型(Multi-instance-type):多人审批方式 ,paraller 并行,Sequential 串行,多实例需设置为并行
2、执行监听器(Execution-listrners):通过监听类设置Collection中集合的值
配置start,下面为类的全路径地址com.bingosoft.center.document.manager.listener.MyStartExecutionListener
类的具体内容为获取传入变量中的人员,设置为会签节点的办理人:
public class MyStartExecutionListener implements ExecutionListener { @Override public void notify(DelegateExecution delegateTask) { ExecutionEntity executionEntity = (ExecutionEntity) delegateTask; ExecutionEntity processInstance = executionEntity.getProcessInstance(); String abc = processInstance.getVariableInstance("new_property_1").getValue().toString(); List<String> candidateUsers = Arrays.asList(abc.split(",")); //设为本地变量(节点所有) delegateTask.setVariableLocal("assigneeList",candidateUsers); } }
3、集合(多实例)(Collection):审批人集合
4、元素中的变量(多实例)(Element varible):迭代集合(Collection)变量
5、完成条件(多实例)(Completion condition):完成条件(表达式)比如:${nrOfCompletedInstances/nrOfInstances >= 0.5} 。
nrOfInstances:实例总数
nrOfActiveInstances:当前活动的,还没完成的实例数量。 对于顺序执行的多实例,值一直为1。
nrOfCompletedInstances:已经完成实例的数目。
6、任务派遣(Assignents):审批人(表达式),取 Element varible的值,比如Element varible设置为assignee,Assignents就设置为${assignee}
在会签节点之前的流转方法中,要传入会签人员,如不传,也可在监听器中固定写死:
传入时,在会签节点前的complete方法前,variables中要传入监听器中所需要解析的人员字段,即例子中的new_property_1,值为String型,多个id用逗号分隔。
如不传,应在监听器中写死,或查询,例如:
public class MyStartTaskListener implements ExecutionListener { @Override public void notify(DelegateExecution arg0) { List<String> userList = new ArrayList<String>(); userList.add("A1"); userList.add("A2"); userList.add("A3"); arg0.setVariableLocal("assigneeList", userList); } }
注意监听器类不能直接注入Spring bean,如需注入,需特殊处理。