Commit 9f929833 by chenweisong

更新

parent b19cb9f0
...@@ -347,26 +347,34 @@ public class TaskController { ...@@ -347,26 +347,34 @@ public class TaskController {
public SimplePage viewTasksProgress(int pageNo, int pageSize) { public SimplePage viewTasksProgress(int pageNo, int pageSize) {
String orderBy = "descending"; // String orderBy = "descending"; //
String propBy = "id"; // groupBy String propBy = "id"; // groupBy
Page<Process> page = processService.findAll(pageNo, pageSize, orderBy, propBy); Page<Process> page = processService.findAllByActivityStatus(Activity.STATUS_BEGIN, pageNo, pageSize, orderBy, propBy);
List<Process> processes = page.getContent(); List<Process> processes = page.getContent();
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
processes.forEach(process -> { processes.forEach(process -> {
Map map = new HashMap(); Map map = new HashMap();
map.put("id", process.getId()); map.put("id", process.getId());
List<HistoricActivityInstance> lisst = historyService // 历史相关Service // List<HistoricActivityInstance> lisst = historyService // 历史相关Service
.createHistoricActivityInstanceQuery() // 创建历史活动实例查询 // .createHistoricActivityInstanceQuery() // 创建历史活动实例查询
.processInstanceId(process.getProcessId()) // 执行流程实例id // .processInstanceId(process.getProcessId()) // 执行流程实例id
.finished() // .finished()
.list(); // .list();
for (HistoricActivityInstance hai : lisst) { // for (HistoricActivityInstance hai : lisst) {
System.out.println("活动ID:" + hai.getId()); // System.out.println("活动ID:" + hai.getId());
} // }
List<ProcessInstance> s = runtimeService.createProcessInstanceQuery() List<ProcessInstance> s = runtimeService.createProcessInstanceQuery()
.processInstanceId(process.getProcessId()) .processInstanceId(process.getProcessId()).active()
.list(); .list();
for (ProcessInstance hai : s) { List<Task> asda = taskService.createTaskQuery()
System.out.println("活动ID:" + hai.getId()); .processInstanceId(process.getProcessId()).active()
System.out.println("流程实例ID:" + hai.getProcessInstanceId() + hai.isEnded() + hai.isSuspended()); .list();
for (Task hai : asda) {
int nrOfInstances = Integer.parseInt(runtimeService.getVariable(hai.getExecutionId(), "nrOfInstances").toString());
// 当前获取的会签任务数量
int nrOfActiveInstances = Integer.parseInt(runtimeService.getVariable(hai.getExecutionId(), "nrOfActiveInstances").toString());
// 已经完成的会签任务数量
int nrOfCompletedInstances = Integer.parseInt(runtimeService.getVariable(hai.getExecutionId(), "nrOfCompletedInstances").toString());
System.out.println(nrOfInstances + "*" + nrOfActiveInstances + "*" + nrOfCompletedInstances );
} }
}); });
return SimplePage.of(page, list); return SimplePage.of(page, list);
......
...@@ -11,4 +11,6 @@ public interface ProcessDao extends JpaRepository<Process, Long> { ...@@ -11,4 +11,6 @@ public interface ProcessDao extends JpaRepository<Process, Long> {
Page<Process> findAll(Pageable pageable); Page<Process> findAll(Pageable pageable);
Page<Process> findAllByActivity_status(int status, Pageable pageable);
} }
...@@ -32,6 +32,11 @@ public class ProcessService { ...@@ -32,6 +32,11 @@ public class ProcessService {
return processDao.findAll(pageable); return processDao.findAll(pageable);
} }
public Page<Process> findAllByActivityStatus(int status, int pageNo, int pageSize, String orderBy, String propBy) {
Pageable pageable = convert(pageNo, pageSize, orderBy, propBy);
return processDao.findAllByActivity_status(status, pageable);
}
private Pageable convert(int pageNo, int pageSize, String orderBy, String propBy) { private Pageable convert(int pageNo, int pageSize, String orderBy, String propBy) {
pageNo--; pageNo--;
if (pageNo < 0) { if (pageNo < 0) {
......
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