pageIndex = Integer.valueOf(pageI);
}
if(StringUtil.isNotEmpty(rowI)){
rowNum = Integer.valueOf(rowI);
}
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
if(StringUtil.isNotEmpty(processDefinitionKey))
processInstanceQuery.processDefinitionKey(processDefinitionKey);
if(StringUtil.isNotEmpty(processInstanceId))
processInstanceQuery.processInstanceId(processInstanceId);
if(StringUtil.isNotEmpty(title))
processInstanceQuery.subjectLike(title);
if(StringUtil.isNotEmpty(bizKey))
processInstanceQuery.processInstanceBusinessKeyLike(bizKey);
if(processInstanceStatus !=null){
processInstanceQuery.processInstanceStatus(processInstanceStatus);
}
if(StringUtil.isNotEmpty(initor))
processInstanceQuery.initiator(initor);
if(StringUtil.isNotEmpty(processType)){
if(processType.equals("initor"))
processInstanceQuery.initiator(userId);
else
processInstanceQuery.taskParticipants(userId);
}
String processDefinitionName = StringUtil.getString(filter.get("processDefinitionName"));
if(StringUtil.isNotEmpty(processDefinitionName))
processInstanceQuery.processDefinitionNameLike(processDefinitionName);
processInstanceQuery.orderByUpdateTime().desc();
Date dates = null;
Date datee = null;
String dss = StringUtil.getString(filter.get("startTimeS"));
String dse = StringUtil.getString(filter.get("startTimeE"));
if(StringUtil.isNotEmpty(dss)){
dates = DateUtil.stringToDate(dss,"yyyy-MM-dd");
}
if(StringUtil.isNotEmpty(dse)){
String endTime = "235959999";
dse += endTime;
datee = DateUtil.stringToDate(dse,"yyyy-MM-ddHHmmssSSS");
}
if(dates!=null)
processInstanceQuery.startTimeBefore(dates);
if(datee!=null)
processInstanceQuery.startTimeAfter(datee);
List<ProcessInstance> processInstances = processInstanceQuery.listPagination(pageIndex, rowNum);
List<Map<String,Object>> instanceMaps = new ArrayList<Map<String,Object>>();
for(ProcessInstance tmp: processInstances){
Map<String, Object> persistentState = tmp.getPersistentState();
String processDefinitionId = tmp.getProcessDefinitionId();
ProcessDefinitionBehavior processDefinitionBehavior = engine.getModelService().getProcessDefinition(processDefinitionId);
String processDefinitionName1 = processDefinitionBehavior.getName();
persistentState.put("processDefinitionName", processDefinitionName1);
String nowNodeInfo = flowUtil.getShareTaskNowNodeInfo(tmp.getId());
persistentState.put("nowNodeInfo", nowNodeInfo);
UserTo user = identityService.getUserTo(tmp.getStartAuthor());
if(user !=null){
persistentState.put("startAuthorName", user.getUserName());
}else{
persistentState.put("startAuthorName", tmp.getStartAuthor());
}
instanceMaps.add(persistentState);
}
Long count = processInstanceQuery.count();
Pagination page = new Pagination(pageIndex,rowNum);
page.setTotal(count.intValue());
resultMap.put("dataList", instanceMaps);
resultMap.put("pageInfo", page);
}finally{