activiti 用戶任務多實例

一.任務說明

1.三我的會籤, 2我的經過,則經過java

二.流程xml

這裏使用 {nrOfCompletedInstances/nrOfInstances >= 0.6 結束任務,  在activit變量表中能夠找到這個參數,  處理人個數, 已處理個數,剩餘處理個數.oop

<process id="test_many_instance" name="單任務多實例" isExecutable="true">
<startEvent id="startevent1" name="啓動流程"/>
<userTask id="usertask1" name="多人並行會籤" activiti:assignee="${user}">
<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${users}" activiti:elementVariable="user">
<completionCondition>${nrOfCompletedInstances/nrOfInstances >= 0.6 }</completionCondition>
</multiInstanceLoopCharacteristics>
</userTask>
<endEvent id="endevent1" name="結束流程"/>
<parallelGateway id="bingxingwang1" name="並行網關"/>
<parallelGateway id="bingxingwangguan2" name="並行網關2"/>
<userTask id="usertaskone" name="管理員任務" activiti:assignee="thinkgem"/>
<sequenceFlow id="flow21" sourceRef="bingxingwang1" targetRef="usertaskone"/>
<sequenceFlow id="flow22" sourceRef="usertaskone" targetRef="bingxingwangguan2"/>
<sequenceFlow id="flow1" name="多人會籤flow" sourceRef="startevent1" targetRef="bingxingwang1"/>
<sequenceFlow id="flow2" sourceRef="bingxingwang1" targetRef="usertask1"/>
<sequenceFlow id="flow3" name="結束flow" sourceRef="usertask1" targetRef="bingxingwangguan2"/>
<sequenceFlow id="flow4" sourceRef="bingxingwangguan2" targetRef="endevent1"/>
</process>

 三.java 啓動代碼spa

Pubform  bean=new Pubform();
		bean.setContent("頭痛");
		pubformService.save(bean);
		
		Map<String, Object> variables=new HashMap<String, Object>();
		String businessKey = bean.getId().toString();
		variables.put("type", "pubForm流程");
		variables.put("busId", bean.getId());
		List<String>  users=Arrays.asList("sd_zhb","sd_zhb2","thinkgem");  //
		variables.put("users", users) ;
		//  2.啓動流程
	    String	processDefinitionKey=rmap.get("processDefinitionKey");
		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinitionKey, businessKey, variables);
		
		bean.setProcessInstanceId(processInstance.getId());
		
		pubformService.save(bean);
相關文章
相關標籤/搜索