Commit 7419a00f by chenweisong

更新

parent 1e7adaf5
......@@ -347,20 +347,49 @@ public class TaskController {
Page<Process> page = processService.findAll(pageNo, pageSize, orderBy, propBy);
List<Process> processes = page.getContent();
List<Map> list = new ArrayList<>();
processes.forEach(process -> {
Map map = new HashMap();
map.put("id", process.getId());
try {
processes.forEach(process -> {
Map map = new HashMap();
map.put("id", process.getId());
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(process.getProcessId()).singleResult();
int total = 0;
int completed = 0;
String status = "已完成";
if (historicProcessInstance.getEndTime() == null) {
List<Task> taskList = taskService.createTaskQuery().processInstanceId(process.getProcessId()).list();
if (taskList.size() > 0) {
Task task = taskList.get(0);
if (task.getTaskDefinitionKey().equals(CommonConstant.MISSION_KEY_MANAGER_AUDIT)) {
total = process.getDataInfoList().size();
completed = process.getDataInfoList().size();
status = "待确认";
} else if (task.getTaskDefinitionKey().equals(CommonConstant.MISSION_KEY_DATA_AUDIT)
|| task.getTaskDefinitionKey().equals(CommonConstant.MISSION_KEY_DATA_ENTER)) {
int nrOfInstances = Integer.parseInt(runtimeService.getVariable(taskList.get(0).getExecutionId(), "nrOfInstances").toString());
// 当前获取的会签任务数量
int nrOfActiveInstances = Integer.parseInt(runtimeService.getVariable(taskList.get(0).getExecutionId(), "nrOfActiveInstances").toString());
// 已经完成的会签任务数量
int nrOfCompletedInstances = Integer.parseInt(runtimeService.getVariable(taskList.get(0).getExecutionId(), "nrOfCompletedInstances").toString());
total = nrOfInstances;
completed = nrOfCompletedInstances;
status = "补录中";
}
}
} else {
total = process.getDataInfoList().size();
completed = process.getDataInfoList().size();
HistoricProcessInstance historicActivityInstances = historyService.createHistoricProcessInstanceQuery().processInstanceId(process.getProcessId()).singleResult();
}
// int nrOfInstances = Integer.parseInt(runtimeService.getVariable(historicActivityInstances.getProcessVariables(), "nrOfInstances").toString());
// // 当前获取的会签任务数量
// int nrOfActiveInstances = Integer.parseInt(runtimeService.getVariable(historicActivityInstances.getExecutionId(), "nrOfActiveInstances").toString());
// // 已经完成的会签任务数量
// int nrOfCompletedInstances = Integer.parseInt(runtimeService.getVariable(historicActivityInstances.getExecutionId(), "nrOfCompletedInstances").toString());
// System.out.println(nrOfInstances + "*" + nrOfActiveInstances + "*" + nrOfCompletedInstances);
map.put("status", status);
map.put("total", total);
map.put("completed", completed);
list.add(map);
});
});
} catch (Exception e) {
e.printStackTrace();
}
return SimplePage.of(page, list);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment