UFLO:3、ProcessInstance-流程实例 的操作

1、使用代码启动一个ProcessInstance(流程实例)

  在启动流程实例时发现,当调用setSequenceFlowName()代码进行参数写入时,后台会抛出异常。

	public ProcessInstance startProcessById(
			String token,
			long processId,
			String businessId
		) {
		String userId = JwtTokenUtil.getUserId(token);
		String userName = JwtTokenUtil.getRealName(token);
		
		StartProcessInfo startProcessInfo = new StartProcessInfo();
		startProcessInfo.setBusinessId(businessId);
		startProcessInfo.setCompleteStartTask(true);
		startProcessInfo.setPromoter(userName);
		startProcessInfo.setCompleteStartTaskOpinion("测试意见");
//		startProcessInfo.setSequenceFlowName("瞎写的sequenceFlowName");
		startProcessInfo.setSubject("测试主题");
		Map<String, Object> variables = new LinkedHashMap<String, Object>();
		startProcessInfo.setVariables(variables);
		
		log.debug(Json.toJsonByPretty(startProcessInfo));
		
		return processService.startProcessById(processId, startProcessInfo);
	}

  创建后的流程实例Json内容如下:

{
    "id": 5701,
    "processId": 4236,
    "parentId": 0,
    "rootId": 5701,
    "historyProcessInstanceId": 5702,
    "createDate": "2020-03-24 18:06:56",
    "state": "Start",
    "currentNode": "分析申请",
    "currentTask": "分析申请",
    "parallelInstanceCount": 0,
    "promoter": "迎学教育",
    "businessId": "C202003160003",
    "subject": "测试主题",
    "tag": null
}

2、使用一个流程实例Id获得流程实例的内容

	//processInstanceId:5701
	public ProcessInstance getProcessInstanceById(long processInstanceId) {
		// TODO Auto-generated method stub
		return processService.getProcessInstanceById(processInstanceId);
	}
processId ,4236是流程模板的编码
{
    "id": 5701,
    "processId": 4236,
    "parentId": 0,
    "rootId": 5701,
    "historyProcessInstanceId": 5702,
    "createDate": "2020-03-24 18:06:57",
    "state": "Start",
    "currentNode": "分析申请",
    "currentTask": "分析申请",
    "parallelInstanceCount": 0,
    "promoter": "迎学教育",
    "businessId": "C202003160003",
    "subject": "测试主题",
    "tag": null
}

你可能感兴趣的:(UFLO)