已办、待办 拥有运维管理员权限用户才返回会客厅相关数据

This commit is contained in:
wangliwen 2022-12-13 11:33:00 +08:00
parent fafd6f48cd
commit 7418814fbd
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,6 +139,8 @@ public class ActTaskController {
* 当未指定流程类型时 补充一下会客厅的待办
*/
if (!(params.containsKey("processDefinitionKey") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("processDefinitionKey").toString()))) {
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;
@ -162,6 +171,7 @@ public class ActTaskController {
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,7 +140,9 @@ 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()))) {
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;
@ -163,6 +173,7 @@ public class HistoryController {
page.setList(temp);
}
}
}
setExtraProcessProperties(Optional.ofNullable(page.getList()).orElse(new ArrayList<>()));
return new Result().ok(page);
}