Browse Source

init: init project step4: biz code support

shc 1 year ago
parent
commit
f266d1e70b

+ 15 - 2
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/SysUserServiceImpl.java

@@ -694,7 +694,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
 
         userDTO.setUserIdList(userid);
 
-        if (SecurityUtils.getRoles().contains(1) || SecurityUtils.getRoles().contains(2) || SecurityUtils.getRoles().contains(35)) {
+        if (SecurityUtils.getRoles().contains(1)) {
+            return baseMapper.getUserVosPage(page, userDTO, new DataScope());
+        } else if (SecurityUtils.getRoles().contains(2) || SecurityUtils.getRoles().contains(35)) {
+            // 人数据权限
+            List<Integer> bcRoles = Stream.of(2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 19, 31, 35, 37, 38, 39, 40, 41, 42, 43).collect(Collectors.toList());
+            if (CollUtil.isNotEmpty(userDTO.getRole())) {
+                Collection<Integer> intersection = CollUtil.intersectionDistinct(bcRoles, userDTO.getRole());
+                if (CollUtil.isEmpty(intersection)) {
+                    return page;
+                }
+                userDTO.setRole(new ArrayList<>(intersection));
+            } else {
+                userDTO.setRole(bcRoles);
+            }
             return baseMapper.getUserVosPage(page, userDTO, new DataScope());
         } else if (SecurityUtils.getRoles().contains(19)) {
             // CSM只能查看自己维护的企业下的用户, 以及下属维护的企业下的用户
@@ -705,7 +718,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
             return baseMapper.getUserVosPage(page, userDTO, new DataScope());
         } else if (SecurityUtils.getRoles().contains(35)) {
             // BC总负责人数据权限
-            List<Integer> bcRoles = Stream.of(3, 4, 5, 6, 7, 9, 10, 11, 13, 19, 31, 35, 37).collect(Collectors.toList());
+            List<Integer> bcRoles = Stream.of(3, 4, 5, 6, 7, 9, 10, 11, 13, 19, 31, 35, 37, 38, 39, 40, 41, 42, 43).collect(Collectors.toList());
             if (CollUtil.isNotEmpty(userDTO.getRole())) {
                 Collection<Integer> intersection = CollUtil.intersectionDistinct(bcRoles, userDTO.getRole());
                 if (CollUtil.isEmpty(intersection)) {