工作流怎么获取下一个节点task
答案:1 悬赏:30 手机版
解决时间 2021-11-27 20:30
- 提问者网友:精神病院里
- 2021-11-27 02:28
工作流怎么获取下一个节点task
最佳答案
- 五星知识达人网友:罪歌
- 2021-11-27 02:36
public TaskDefinition nextTaskDefinition(String procInstId){
//流程标示
String processDefinitionId = historyService.createHistoricProcessInstanceQuery().processInstanceId(procInstId).singleResult().getProcessDefinitionId();
ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition(processDefinitionId);
//执行实例
ExecutionEntity execution = (ExecutionEntity) runtimeService.createProcessInstanceQuery().processInstanceId(procInstId).singleResult();
//当前实例的执行到哪个节点
String activitiId = execution.getActivityId();
//获得当前任务的所有节点
List activitiList = def.getActivities();
String id = null;
for(ActivityImpl activityImpl:activitiList){
id = activityImpl.getId();
if(activitiId.equals(id)){
System.out.println("当前任务:"+activityImpl.getProperty("name"));
return nextTaskDefinition(activityImpl, activityImpl.getId(),"${iscorrect==1}");
// System.out.println(taskDefinition.getCandidateGroupIdExpressions().toArray()[0]);
// return taskDefinition;
}
}
return null;
}
private TaskDefinition nextTaskDefinition(ActivityImpl activityImpl, String activityId, String elString){
if("userTask".equals(activityImpl.getProperty("type")) && !activityId.equals(activityImpl.getId())){
TaskDefinition taskDefinition = ((UserTaskActivityBehavior)activityImpl.getActivityBehavior()).getTaskDefinition();
// taskDefinition.getCandidateGroupIdExpressions().toArray();
return taskDefinition;
}else{
List
List
for(PvmTransition tr:outTransitions){
PvmActivity ac = tr.getDestination(); //获取线路的终点节点
if("exclusiveGateway".equals(ac.getProperty("type"))){
outTransitionsTemp = ac.getOutgoingTransitions();
if(outTransitionsTemp.size() == 1){
return nextTaskDefinition((ActivityImpl)outTransitionsTemp.get(0).getDestination(), activityId, elString);
}else if(outTransitionsTemp.size() > 1){
for(PvmTransition tr1 : outTransitionsTemp){
Object s = tr1.getProperty("conditionText");
if(elString.equals(StrUtils.trim(s.toString()))){
return nextTaskDefinition((ActivityImpl)tr1.getDestination(), activityId, elString);
}
}
}
}else if("userTask".equals(ac.getProperty("type"))){
return ((UserTaskActivityBehavior)((ActivityImpl)ac).getActivityBehavior()).getTaskDefinition();
}else{
logger.debug(ac.getProperty("type"));
}
}
return null;
}
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯