Commit 826b2276 authored by jiawei's avatar jiawei

BUG修改====》》单位管理员可以看到平台用户、本单位人员及下属单位创建的学习内容,加上全平台

parent ad1620c4
...@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -256,7 +257,9 @@ public class LearningContentController extends BaseController { ...@@ -256,7 +257,9 @@ public class LearningContentController extends BaseController {
LambdaQueryWrapper<LearningContent> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<LearningContent> queryWrapper = new LambdaQueryWrapper<>();
List<String> curUserSubOrgIds = getCurUserSubOrgIds(); List<String> curUserSubOrgIds = getCurUserSubOrgIds();
if (!CollectionUtils.isEmpty(curUserSubOrgIds)){ if (!CollectionUtils.isEmpty(curUserSubOrgIds)){
queryWrapper.in(LearningContent::getOrganCode, curUserSubOrgIds); List<String> list = Arrays.asList("ALL_PLAT");
queryWrapper.and(s -> s.in(LearningContent::getOrganCode, curUserSubOrgIds).or()
.in(LearningContent::getApplicableScope, list));
} }
// 根据创建时间区间检索 // 根据创建时间区间检索
if (genericPageParam.getIsPublished() != null) { if (genericPageParam.getIsPublished() != null) {
...@@ -325,14 +328,15 @@ public class LearningContentController extends BaseController { ...@@ -325,14 +328,15 @@ public class LearningContentController extends BaseController {
if (tUser == null || StringUtils.isBlank(tUser.getOrgId())) { if (tUser == null || StringUtils.isBlank(tUser.getOrgId())) {
return null; return null;
} }
//平台管理员、单位管理员、学习内容管理员 //平台管理员、单位管理员、学习内容管理员 单位管理员不能看到其它非同一机构的单位管理员
List<String> roleList = tUser.getRoleList(); List<String> roleList = tUser.getRoleList();
boolean condition = !CollectionUtils.isEmpty(roleList) //不为空 boolean condition = !CollectionUtils.isEmpty(roleList) //不为空
&& roleList.contains("2") //2是单位管理员 && roleList.contains("2") //2是单位管理员
&& !roleList.contains("1") //不包含 1是平台管理员 && !roleList.contains("1") //不包含 1是平台管理员
&& !roleList.contains("8"); //不包含 8是学习内容管理员 && !roleList.contains("8"); //不包含 8是学习内容管理员
//不是这种情况查询全部 //不是只为单位管理员这种情况查询全部
// userRoleService
if (!condition) { if (!condition) {
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment