Merge branch 'dev'

This commit is contained in:
wangliwen 2022-12-09 10:44:22 +08:00
commit 8cac26fbc2
1 changed files with 35 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package io.renren.modules.activiti.controller; package io.renren.modules.activiti.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.annotation.LogOperation; import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant; import io.renren.common.constant.Constant;
@ -36,6 +37,7 @@ import org.activiti.engine.history.HistoricProcessInstanceQuery;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; 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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -85,6 +87,8 @@ public class HistoryController {
protected RuntimeService runtimeService; protected RuntimeService runtimeService;
@Autowired @Autowired
private SysDeptService sysDeptService; private SysDeptService sysDeptService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired @Autowired
private SysUserDao sysUserDao; private SysUserDao sysUserDao;
@ -128,6 +132,37 @@ public class HistoryController {
params.replace("processDefinitionKey", params.get("processDefinitionKey").toString() + "%"); params.replace("processDefinitionKey", params.get("processDefinitionKey").toString() + "%");
} }
PageData<ProcessActivityDTO> page = activitiService.getMyProcessInstancePage(params); PageData<ProcessActivityDTO> 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<Map<String, Object>> 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<ProcessActivityDTO> meetingroom_bookTaskDto = meetingroom_bookTask
.stream().map(index -> {
ProcessActivityDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), ProcessActivityDTO.class);
return taskDTO;
}).collect(Collectors.toList());
List<ProcessActivityDTO> temp = page.getList();
temp.addAll(meetingroom_bookTaskDto);
page.setList(temp);
}
}
setExtraProcessProperties(Optional.ofNullable(page.getList()).orElse(new ArrayList<>())); setExtraProcessProperties(Optional.ofNullable(page.getList()).orElse(new ArrayList<>()));
return new Result().ok(page); return new Result().ok(page);
} }