diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java index e046e710..ab3cfa93 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java @@ -1,5 +1,6 @@ package io.renren.modules.activiti.controller; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.renren.common.annotation.LogOperation; import io.renren.common.constant.Constant; @@ -36,6 +37,7 @@ import org.activiti.engine.history.HistoricProcessInstanceQuery; import org.activiti.engine.task.Task; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -85,6 +87,8 @@ public class HistoryController { protected RuntimeService runtimeService; @Autowired private SysDeptService sysDeptService; + @Autowired + private JdbcTemplate jdbcTemplate; @Autowired private SysUserDao sysUserDao; @@ -128,6 +132,37 @@ public class HistoryController { params.replace("processDefinitionKey", params.get("processDefinitionKey").toString() + "%"); } PageData page = activitiService.getMyProcessInstancePage(params); + if (!(params.containsKey("processDefinitionKey") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("processDefinitionKey").toString()))) { + int meetingroom_book = jdbcTemplate.queryForObject("SELECT COUNT(id) FROM t_meetingroom_book WHERE state = 1;", Integer.class); + page.setTotal(page.getTotal() + meetingroom_book); + Integer limit = 10; + if (params.get(Constant.LIMIT) != null) { + limit = Integer.parseInt((String) params.get(Constant.LIMIT)); + } + if (page.getList().size() < limit) { + List> meetingroom_bookTask = jdbcTemplate.queryForList("SELECT " + + " t_meetingroom_book.id AS `businessKey`, " + + " t_meetingroom_book.dept AS `startUserDeptName`, " + + " '会客厅' AS `resourceName`, " + + " '青岛市大数据发展管理局' AS `provideDept`, " + + " t_meetingroom.`name` AS `userName`, " + + " '会客厅审核' AS `processDefinitionName `, " + + " t_meetingroom.create_date AS `startTime` " + + "FROM " + + " t_meetingroom_book " + + " LEFT JOIN t_meetingroom ON t_meetingroom_book.room_id = t_meetingroom.id " + + "WHERE " + + " state = 1;"); + List meetingroom_bookTaskDto = meetingroom_bookTask + .stream().map(index -> { + ProcessActivityDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), ProcessActivityDTO.class); + return taskDTO; + }).collect(Collectors.toList()); + List temp = page.getList(); + temp.addAll(meetingroom_bookTaskDto); + page.setList(temp); + } + } setExtraProcessProperties(Optional.ofNullable(page.getList()).orElse(new ArrayList<>())); return new Result().ok(page); }