获取具备审核权限人员时支持过滤已加入审核组人员

This commit is contained in:
wangliwen 2022-12-14 10:48:01 +08:00
parent d177a351ac
commit f7e739ea7d
11 changed files with 56 additions and 14 deletions

View File

@ -195,7 +195,7 @@ public class ActTaskController {
taskQuery.taskAssignee(SecurityUser.getUserId().toString()); taskQuery.taskAssignee(SecurityUser.getUserId().toString());
taskQuery.active(); taskQuery.active();
if (auditteam) { // 允许流程审核协作时 if (auditteam) { // 允许流程审核协作时
List<SysAuditTeamDTO> sysAuditTeamDTOS = sysAuditTeamService.selectByMemberOne(userId); List<SysAuditTeamDTO> sysAuditTeamDTOS = sysAuditTeamService.selectByMemberOne(Long.parseLong(userId));
List<String> groupUserId = sysAuditTeamDTOS List<String> groupUserId = sysAuditTeamDTOS
.stream() .stream()
.map(index_ -> index_.getMember()) .map(index_ -> index_.getMember())

View File

@ -146,7 +146,7 @@ public class ActTaskService extends BaseServiceImpl {
List<String> groupUserId = new ArrayList<>(); List<String> groupUserId = new ArrayList<>();
List<SysAuditTeamDTO> sysAuditTeamDTOS = new ArrayList<>(); List<SysAuditTeamDTO> sysAuditTeamDTOS = new ArrayList<>();
if (auditteam) { if (auditteam) {
sysAuditTeamDTOS = sysAuditTeamService.selectByMemberOne(userId); sysAuditTeamDTOS = sysAuditTeamService.selectByMemberOne(Long.parseLong(userId));
groupUserId = sysAuditTeamDTOS groupUserId = sysAuditTeamDTOS
.stream() .stream()
.map(index -> index.getMember()) .map(index -> index.getMember())

View File

@ -81,6 +81,7 @@ public class SysAuditTeamController {
dto.setIndex(CommonUtils.getPinYinHeadChar(dto.getName())); // 索引设置为名称拼音 dto.setIndex(CommonUtils.getPinYinHeadChar(dto.getName())); // 索引设置为名称拼音
dto.setMember(dto.getMember().stream().map(index -> { dto.setMember(dto.getMember().stream().map(index -> {
Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(Long.parseLong((String) index.get("id")))); Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(Long.parseLong((String) index.get("id"))));
index.put("id", Long.parseLong((String) index.get("id")));
if (sysUserDTO.isPresent()) { if (sysUserDTO.isPresent()) {
index.put("name", sysUserDTO.get().getRealName()); index.put("name", sysUserDTO.get().getRealName());
index.put("dept_name", sysUserDTO.get().getDeptName()); index.put("dept_name", sysUserDTO.get().getDeptName());
@ -100,7 +101,8 @@ public class SysAuditTeamController {
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
dto.setIndex(CommonUtils.getPinYinHeadChar(dto.getName())); // 索引设置为名称拼音 dto.setIndex(CommonUtils.getPinYinHeadChar(dto.getName())); // 索引设置为名称拼音
dto.setMember(dto.getMember().stream().map(index -> { dto.setMember(dto.getMember().stream().map(index -> {
Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(Long.parseLong(index.get("id").toString()))); Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(Long.parseLong((String) index.get("id"))));
index.put("id", Long.parseLong((String) index.get("id")));
if (sysUserDTO.isPresent()) { if (sysUserDTO.isPresent()) {
index.put("name", sysUserDTO.get().getRealName()); index.put("name", sysUserDTO.get().getRealName());
index.put("dept_name", sysUserDTO.get().getDeptName()); index.put("dept_name", sysUserDTO.get().getDeptName());

View File

@ -23,5 +23,5 @@ public interface SysAuditTeamDao extends BaseDao<SysAuditTeamEntity> {
* @param member * @param member
* @return * @return
*/ */
List<SysAuditTeamDTO> selectByMemberOne(@Param("member") String member); List<SysAuditTeamDTO> selectByMemberOne(@Param("member") Long member);
} }

View File

@ -13,5 +13,5 @@ import java.util.List;
* @since 1.0 2022-12-12 * @since 1.0 2022-12-12
*/ */
public interface SysAuditTeamService extends CrudService<SysAuditTeamEntity, SysAuditTeamDTO> { public interface SysAuditTeamService extends CrudService<SysAuditTeamEntity, SysAuditTeamDTO> {
List<SysAuditTeamDTO> selectByMemberOne(String member); List<SysAuditTeamDTO> selectByMemberOne(Long member);
} }

View File

@ -38,7 +38,7 @@ public class SysAuditTeamServiceImpl extends CrudServiceImpl<SysAuditTeamDao, Sy
@Override @Override
public List<SysAuditTeamDTO> selectByMemberOne(String member) { public List<SysAuditTeamDTO> selectByMemberOne(Long member) {
return baseDao.selectByMemberOne(member); return baseDao.selectByMemberOne(member);
} }
} }

View File

@ -255,6 +255,7 @@ public class SysUserController {
//分页参数 //分页参数
long curPage = 1; long curPage = 1;
long limit = 10; long limit = 10;
boolean filterAuditTeam = Boolean.parseBoolean(params.getOrDefault("filter", "false").toString());
if (params.get(Constant.PAGE) != null) { if (params.get(Constant.PAGE) != null) {
curPage = Long.parseLong((String) params.get(Constant.PAGE)); curPage = Long.parseLong((String) params.get(Constant.PAGE));
@ -277,9 +278,9 @@ public class SysUserController {
} }
add(Long.parseLong(defaultAssigneeRoleId)); add(Long.parseLong(defaultAssigneeRoleId));
}}; }};
List<Map> temp = sysUserService.getUserByRoleList(roleId, (int) curPage, (int) limit); List<Map> temp = sysUserService.getUserByRoleList(roleId, (int) curPage, (int) limit, filterAuditTeam);
temp = temp.stream().map(index -> { temp = temp.stream().map(index -> {
List<SysAuditTeamDTO> sysAuditTeamDTOList = sysAuditTeamService.selectByMemberOne(index.get("id").toString()); List<SysAuditTeamDTO> sysAuditTeamDTOList = sysAuditTeamService.selectByMemberOne(Long.parseLong(index.get("id").toString()));
index.put("inAuditTeam", !sysAuditTeamDTOList.isEmpty()); index.put("inAuditTeam", !sysAuditTeamDTOList.isEmpty());
index.put("auditTeamName", sysAuditTeamDTOList.stream().findFirst().isPresent() ? sysAuditTeamDTOList.stream().findFirst().get().getName() : ""); index.put("auditTeamName", sysAuditTeamDTOList.stream().findFirst().isPresent() ? sysAuditTeamDTOList.stream().findFirst().get().getName() : "");
return index; return index;

View File

@ -57,7 +57,7 @@ public interface SysUserDao extends BaseDao<SysUserEntity> {
Integer getApproverUnconfiguredRegionCount(); Integer getApproverUnconfiguredRegionCount();
List<Map> getUserByRoleList(@Param("roleIds") List<Long> roleIds, @Param("pageNum") int pageNum, @Param("pageSize") int pageSize); List<Map> getUserByRoleList(@Param("roleIds") List<Long> roleIds, @Param("pageNum") int pageNum, @Param("pageSize") int pageSize, @Param("filter") boolean filter);
Long getUserByRoleListCount(@Param("roleIds") List<Long> roleIds); Long getUserByRoleListCount(@Param("roleIds") List<Long> roleIds);
} }

View File

@ -72,7 +72,7 @@ public interface SysUserService extends BaseService<SysUserEntity> {
* @param roleIds * @param roleIds
* @return * @return
*/ */
List<Map> getUserByRoleList(List<Long> roleIds, int pageNum, int pageSize); List<Map> getUserByRoleList(List<Long> roleIds, int pageNum, int pageSize, boolean filter);
Long getUserByRoleListCount(List<Long> roleIds); Long getUserByRoleListCount(List<Long> roleIds);
} }

View File

@ -563,8 +563,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
* @return * @return
*/ */
@Override @Override
public List<Map> getUserByRoleList(List<Long> roleIds, int pageNum, int pageSize) { public List<Map> getUserByRoleList(List<Long> roleIds, int pageNum, int pageSize, boolean filter) {
return baseDao.getUserByRoleList(roleIds, (pageNum - 1) * pageSize, pageSize); return baseDao.getUserByRoleList(roleIds, (pageNum - 1) * pageSize, pageSize, filter);
} }
@Override @Override

View File

@ -199,8 +199,32 @@
</select> </select>
<select id="getUserByRoleList" resultType="java.util.Map"> <select id="getUserByRoleList" resultType="java.util.Map">
<!-- SELECT-->
<!-- DISTINCT-->
<!-- sys_user.id,-->
<!-- sys_user.username,-->
<!-- sys_user.real_name,-->
<!-- sys_dept.`name`-->
<!-- FROM-->
<!-- sys_role_user-->
<!-- LEFT JOIN sys_user ON sys_user.id = sys_role_user.user_id-->
<!-- LEFT JOIN sys_dept ON sys_dept.id = sys_user.dept_id-->
<!-- WHERE-->
<!-- 1 = 1-->
<!-- AND sys_role_user.del_flag = 0-->
<!-- AND sys_user.id IS NOT NULL-->
<!-- <if test="null != roleIds">-->
<!-- AND sys_role_user.role_id IN-->
<!-- <foreach item="roleId" collection="roleIds" open="(" separator="," close=")">-->
<!-- #{roleId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- LIMIT ${pageNum}, ${pageSize} -->
SELECT SELECT
DISTINCT temp.*
FROM
(
SELECT DISTINCT
sys_user.id, sys_user.id,
sys_user.username, sys_user.username,
sys_user.real_name, sys_user.real_name,
@ -212,13 +236,28 @@
WHERE WHERE
1 = 1 1 = 1
AND sys_role_user.del_flag = 0 AND sys_role_user.del_flag = 0
AND sys_user.id IS NOT NULL
<if test="null != roleIds"> <if test="null != roleIds">
AND sys_role_user.role_id IN AND sys_role_user.role_id IN
<foreach item="roleId" collection="roleIds" open="(" separator="," close=")"> <foreach item="roleId" collection="roleIds" open="(" separator="," close=")">
#{roleId} #{roleId}
</foreach> </foreach>
</if> </if>
AND sys_user.id IS NOT NULL
) temp
WHERE
1 = 1
<if test="filter">
AND NOT EXISTS (
SELECT
1
FROM
sys_audit_team
WHERE
JSON_CONTAINS(
sys_audit_team.member,
JSON_OBJECT( "id", temp.id ))
)
</if>
LIMIT ${pageNum}, ${pageSize} LIMIT ${pageNum}, ${pageSize}
</select> </select>
<select id="getUserByRoleListCount" resultType="java.lang.Long"> <select id="getUserByRoleListCount" resultType="java.lang.Long">