Merge branch 'dev'

This commit is contained in:
wangliwen 2022-12-13 11:33:12 +08:00
commit 11ed5a0ba7
2 changed files with 78 additions and 57 deletions

View File

@ -16,6 +16,7 @@ import io.renren.modules.audit_team.service.SysAuditTeamService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysRoleUserService;
import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -29,8 +30,8 @@ import org.activiti.engine.task.TaskQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@ -73,6 +74,12 @@ public class ActTaskController {
@Value("#{new Boolean(${auditteam.enable})}")
private Boolean auditteam; // 是否进行审核组
@Value("${big_date.assignee_meet_role_id}")
private String defaultAssigneeRoleId; // 会客厅审核人角色
@Autowired
private SysRoleUserService sysRoleUserService;
private JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
/**
@ -132,34 +139,37 @@ public class ActTaskController {
* 当未指定流程类型时 补充一下会客厅的待办
*/
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 `taskId`, " +
" t_meetingroom_book.dept AS `userDeptName`, " +
" '会客厅' AS `resourceType`, " +
" '青岛市大数据发展管理局' AS `provideDept`, " +
" t_meetingroom.`name` AS `userName`, " +
" '会客厅审核' AS `taskName `, " +
" t_meetingroom.create_date AS `createTime` " +
"FROM " +
" t_meetingroom_book " +
" LEFT JOIN t_meetingroom ON t_meetingroom_book.room_id = t_meetingroom.id " +
"WHERE " +
" state = 1;");
List<TaskDTO> meetingroom_bookTaskDto = meetingroom_bookTask
.stream().map(index -> {
TaskDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), TaskDTO.class);
return taskDTO;
}).collect(Collectors.toList());
List<TaskDTO> temp = page.getList();
temp.addAll(meetingroom_bookTaskDto);
page.setList(temp);
List<Long> useIds = sysRoleUserService.getUserIdListByRoleId(Long.parseLong(defaultAssigneeRoleId));
if (useIds.stream().filter(index -> index == SecurityUser.getUserId()).findFirst().isPresent()) { // 拥有会客厅审核权限
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 `taskId`, " +
" t_meetingroom_book.dept AS `userDeptName`, " +
" '会客厅' AS `resourceType`, " +
" '青岛市大数据发展管理局' AS `provideDept`, " +
" t_meetingroom.`name` AS `userName`, " +
" '会客厅审核' AS `taskName `, " +
" t_meetingroom.create_date AS `createTime` " +
"FROM " +
" t_meetingroom_book " +
" LEFT JOIN t_meetingroom ON t_meetingroom_book.room_id = t_meetingroom.id " +
"WHERE " +
" state = 1;");
List<TaskDTO> meetingroom_bookTaskDto = meetingroom_bookTask
.stream().map(index -> {
TaskDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), TaskDTO.class);
return taskDTO;
}).collect(Collectors.toList());
List<TaskDTO> temp = page.getList();
temp.addAll(meetingroom_bookTaskDto);
page.setList(temp);
}
}
}
return new Result<PageData<TaskDTO>>().ok(page);

View File

@ -19,10 +19,12 @@ import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dao.SysUserDao;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysRoleUserService;
import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -37,6 +39,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.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -89,10 +92,15 @@ public class HistoryController {
private SysDeptService sysDeptService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private SysRoleUserService sysRoleUserService;
@Autowired
private SysUserDao sysUserDao;
@Value("${big_date.assignee_meet_role_id}")
private String defaultAssigneeRoleId; // 会客厅审核人角色
@GetMapping("getInstImage")
@ApiOperation(value = "获取流程活动图", produces = "application/octet-stream")
@LogOperation("获取流程活动图")
@ -132,35 +140,38 @@ public class HistoryController {
params.replace("processDefinitionKey", params.get("processDefinitionKey").toString() + "%");
}
PageData<ProcessActivityDTO> page = activitiService.getMyProcessInstancePage(params);
List<Long> useIds = sysRoleUserService.getUserIdListByRoleId(Long.parseLong(defaultAssigneeRoleId));
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);
if (useIds.stream().filter(index -> index == SecurityUser.getUserId()).findFirst().isPresent()) { // 拥有会客厅审核权限
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<>()));