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.SecurityUser;
import io.renren.modules.security.user.UserDetail; import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dto.SysUserDTO; import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysRoleUserService;
import io.renren.modules.sys.service.SysUserService; import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -29,8 +30,8 @@ import org.activiti.engine.task.TaskQuery;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -73,6 +74,12 @@ public class ActTaskController {
@Value("#{new Boolean(${auditteam.enable})}") @Value("#{new Boolean(${auditteam.enable})}")
private Boolean auditteam; // 是否进行审核组 private Boolean auditteam; // 是否进行审核组
@Value("${big_date.assignee_meet_role_id}")
private String defaultAssigneeRoleId; // 会客厅审核人角色
@Autowired
private SysRoleUserService sysRoleUserService;
private JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate(); 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()))) { 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); List<Long> useIds = sysRoleUserService.getUserIdListByRoleId(Long.parseLong(defaultAssigneeRoleId));
page.setTotal(page.getTotal() + meetingroom_book); if (useIds.stream().filter(index -> index == SecurityUser.getUserId()).findFirst().isPresent()) { // 拥有会客厅审核权限
Integer limit = 10; int meetingroom_book = jdbcTemplate.queryForObject("SELECT COUNT(id) FROM t_meetingroom_book WHERE state = 1;", Integer.class);
if (params.get(Constant.LIMIT) != null) { page.setTotal(page.getTotal() + meetingroom_book);
limit = Integer.parseInt((String) params.get(Constant.LIMIT)); Integer limit = 10;
} if (params.get(Constant.LIMIT) != null) {
if (page.getList().size() < limit) { limit = Integer.parseInt((String) params.get(Constant.LIMIT));
List<Map<String, Object>> meetingroom_bookTask = jdbcTemplate.queryForList("SELECT " + }
" t_meetingroom_book.id AS `taskId`, " + if (page.getList().size() < limit) {
" t_meetingroom_book.dept AS `userDeptName`, " + List<Map<String, Object>> meetingroom_bookTask = jdbcTemplate.queryForList("SELECT " +
" '会客厅' AS `resourceType`, " + " t_meetingroom_book.id AS `taskId`, " +
" '青岛市大数据发展管理局' AS `provideDept`, " + " t_meetingroom_book.dept AS `userDeptName`, " +
" t_meetingroom.`name` AS `userName`, " + " '会客厅' AS `resourceType`, " +
" '会客厅审核' AS `taskName `, " + " '青岛市大数据发展管理局' AS `provideDept`, " +
" t_meetingroom.create_date AS `createTime` " + " t_meetingroom.`name` AS `userName`, " +
"FROM " + " '会客厅审核' AS `taskName `, " +
" t_meetingroom_book " + " t_meetingroom.create_date AS `createTime` " +
" LEFT JOIN t_meetingroom ON t_meetingroom_book.room_id = t_meetingroom.id " + "FROM " +
"WHERE " + " t_meetingroom_book " +
" state = 1;"); " LEFT JOIN t_meetingroom ON t_meetingroom_book.room_id = t_meetingroom.id " +
List<TaskDTO> meetingroom_bookTaskDto = meetingroom_bookTask "WHERE " +
.stream().map(index -> { " state = 1;");
TaskDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), TaskDTO.class); List<TaskDTO> meetingroom_bookTaskDto = meetingroom_bookTask
return taskDTO; .stream().map(index -> {
}).collect(Collectors.toList()); TaskDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), TaskDTO.class);
List<TaskDTO> temp = page.getList(); return taskDTO;
temp.addAll(meetingroom_bookTaskDto); }).collect(Collectors.toList());
page.setList(temp); List<TaskDTO> temp = page.getList();
temp.addAll(meetingroom_bookTaskDto);
page.setList(temp);
}
} }
} }
return new Result<PageData<TaskDTO>>().ok(page); 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.resource.service.ResourceService;
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; 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.dao.SysUserDao;
import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysUserDTO; import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysRoleUserService;
import io.renren.modules.sys.service.SysUserService; import io.renren.modules.sys.service.SysUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -37,6 +39,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.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate; 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;
@ -89,10 +92,15 @@ public class HistoryController {
private SysDeptService sysDeptService; private SysDeptService sysDeptService;
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private SysRoleUserService sysRoleUserService;
@Autowired @Autowired
private SysUserDao sysUserDao; private SysUserDao sysUserDao;
@Value("${big_date.assignee_meet_role_id}")
private String defaultAssigneeRoleId; // 会客厅审核人角色
@GetMapping("getInstImage") @GetMapping("getInstImage")
@ApiOperation(value = "获取流程活动图", produces = "application/octet-stream") @ApiOperation(value = "获取流程活动图", produces = "application/octet-stream")
@LogOperation("获取流程活动图") @LogOperation("获取流程活动图")
@ -132,35 +140,38 @@ 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);
List<Long> useIds = sysRoleUserService.getUserIdListByRoleId(Long.parseLong(defaultAssigneeRoleId));
if (!(params.containsKey("processDefinitionKey") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("processDefinitionKey").toString()))) { 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); if (useIds.stream().filter(index -> index == SecurityUser.getUserId()).findFirst().isPresent()) { // 拥有会客厅审核权限
page.setTotal(page.getTotal() + meetingroom_book); int meetingroom_book = jdbcTemplate.queryForObject("SELECT COUNT(id) FROM t_meetingroom_book WHERE state != 1;", Integer.class);
Integer limit = 10; page.setTotal(page.getTotal() + meetingroom_book);
if (params.get(Constant.LIMIT) != null) { Integer limit = 10;
limit = Integer.parseInt((String) params.get(Constant.LIMIT)); 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 " + if (page.getList().size() < limit) {
" t_meetingroom_book.id AS `businessKey`, " + List<Map<String, Object>> meetingroom_bookTask = jdbcTemplate.queryForList("SELECT " +
" t_meetingroom_book.dept AS `startUserDeptName`, " + " t_meetingroom_book.id AS `businessKey`, " +
" '会客厅' AS `resourceName`, " + " t_meetingroom_book.dept AS `startUserDeptName`, " +
" '青岛市大数据发展管理局' AS `provideDept`, " + " '会客厅' AS `resourceName`, " +
" t_meetingroom.`name` AS `userName`, " + " '青岛市大数据发展管理局' AS `provideDept`, " +
" '会客厅审核' AS `processDefinitionName `, " + " t_meetingroom.`name` AS `userName`, " +
" t_meetingroom.create_date AS `startTime` " + " '会客厅审核' AS `processDefinitionName `, " +
"FROM " + " t_meetingroom.create_date AS `startTime` " +
" t_meetingroom_book " + "FROM " +
" LEFT JOIN t_meetingroom ON t_meetingroom_book.room_id = t_meetingroom.id " + " t_meetingroom_book " +
"WHERE " + " LEFT JOIN t_meetingroom ON t_meetingroom_book.room_id = t_meetingroom.id " +
" state != 1 ;"); "WHERE " +
List<ProcessActivityDTO> meetingroom_bookTaskDto = meetingroom_bookTask " state != 1 ;");
.stream().map(index -> { List<ProcessActivityDTO> meetingroom_bookTaskDto = meetingroom_bookTask
ProcessActivityDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), ProcessActivityDTO.class); .stream().map(index -> {
return taskDTO; ProcessActivityDTO taskDTO = JSON.parseObject(JSON.toJSONString(index), ProcessActivityDTO.class);
}).collect(Collectors.toList()); return taskDTO;
List<ProcessActivityDTO> temp = page.getList(); }).collect(Collectors.toList());
temp.addAll(meetingroom_bookTaskDto); List<ProcessActivityDTO> temp = page.getList();
page.setList(temp); temp.addAll(meetingroom_bookTaskDto);
page.setList(temp);
}
} }
} }
setExtraProcessProperties(Optional.ofNullable(page.getList()).orElse(new ArrayList<>())); setExtraProcessProperties(Optional.ofNullable(page.getList()).orElse(new ArrayList<>()));