diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java index 2161331f..b41f6968 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java @@ -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> 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 meetingroom_bookTaskDto = meetingroom_bookTask - .stream().map(index -> { - TaskDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), TaskDTO.class); - return taskDTO; - }).collect(Collectors.toList()); - List temp = page.getList(); - temp.addAll(meetingroom_bookTaskDto); - page.setList(temp); + List 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> 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 meetingroom_bookTaskDto = meetingroom_bookTask + .stream().map(index -> { + TaskDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), TaskDTO.class); + return taskDTO; + }).collect(Collectors.toList()); + List temp = page.getList(); + temp.addAll(meetingroom_bookTaskDto); + page.setList(temp); + } } } return new Result>().ok(page); 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 2239f181..3ca1593d 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 @@ -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 page = activitiService.getMyProcessInstancePage(params); + List 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> 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); + 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> 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<>()));