|
|
@ -82,29 +82,38 @@ public class AnnualCompAwardController extends JeecgController<AnnualCompAward, |
|
|
|
// 获取当前登录用户
|
|
|
|
// 获取当前登录用户
|
|
|
|
LoginUser loginUser = (LoginUser) subject.getPrincipal(); |
|
|
|
LoginUser loginUser = (LoginUser) subject.getPrincipal(); |
|
|
|
List<SysRole> roleList = iSysUserRoleService.getUserRoleByUserId(loginUser.getId()); |
|
|
|
List<SysRole> roleList = iSysUserRoleService.getUserRoleByUserId(loginUser.getId()); |
|
|
|
Map<String, String> roleMap = Optional.ofNullable(roleList).orElse(new LinkedList<>()).stream().collect(Collectors.toMap(SysRole::getRoleCode, SysRole::getRoleCode)); |
|
|
|
// Map<String, String> roleMap = Optional.ofNullable(roleList).orElse(new LinkedList<>()).stream().collect(Collectors.toMap(SysRole::getRoleCode, SysRole::getRoleCode));
|
|
|
|
//角色编码 管理员&组委会&教务处 可以看到所有,其它用户可见到所属自己数据
|
|
|
|
//角色编码 管理员&组委会&教务处 可以看到所有,其它用户可见到所属自己数据
|
|
|
|
Map<String, String> efficientRoleMap = new LinkedHashMap<>(); |
|
|
|
Map<String, String> efficientRoleMap = new LinkedHashMap<>(); |
|
|
|
efficientRoleMap.put("admin", "admin"); |
|
|
|
efficientRoleMap.put("admin", "admin"); |
|
|
|
efficientRoleMap.put("committee", "committee"); |
|
|
|
efficientRoleMap.put("committee", "committee"); |
|
|
|
efficientRoleMap.put("superAdmin", "superAdmin"); |
|
|
|
efficientRoleMap.put("superAdmin", "superAdmin"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean containsEfficientRole = roleList.stream() |
|
|
|
|
|
|
|
.map(SysRole::getRoleCode) |
|
|
|
|
|
|
|
.anyMatch(efficientRoleMap::containsKey); |
|
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<AnnualCompAward> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
LambdaQueryWrapper<AnnualCompAward> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
Page<AnnualCompAward> page = new Page<AnnualCompAward>(pageNo, pageSize); |
|
|
|
Page<AnnualCompAward> page = new Page<AnnualCompAward>(pageNo, pageSize); |
|
|
|
// 查询所属当前登录用户数据
|
|
|
|
// 查询所属当前登录用户数据
|
|
|
|
if (!efficientRoleMap.containsValue(roleMap.get("admin")) |
|
|
|
if (containsEfficientRole) |
|
|
|
&& !efficientRoleMap.containsValue(roleMap.get("committee")) |
|
|
|
{ |
|
|
|
&& !efficientRoleMap.containsValue(roleMap.get("superAdmin"))) { |
|
|
|
//根据比赛管理员查询 对应必比赛
|
|
|
|
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompAdmin, loginUser.getUsername())); |
|
|
|
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompAdmin, loginUser.getUsername())); |
|
|
|
if (ObjectUtils.isEmpty(compList)) { |
|
|
|
if (ObjectUtils.isEmpty(compList)) { |
|
|
|
return Result.OK(page); |
|
|
|
return Result.OK(page); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//获取比赛ID
|
|
|
|
Set<String> compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet()); |
|
|
|
Set<String> compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
//根据比赛ID查询年度必死啊
|
|
|
|
List<AnnualComp> annualCompList = annualCompService.list(new LambdaQueryWrapper<AnnualComp>().in(AnnualComp::getCompid, compIds)); |
|
|
|
List<AnnualComp> annualCompList = annualCompService.list(new LambdaQueryWrapper<AnnualComp>().in(AnnualComp::getCompid, compIds)); |
|
|
|
if (!ObjectUtils.isEmpty(annualCompList)) { |
|
|
|
if (!ObjectUtils.isEmpty(annualCompList)) { |
|
|
|
|
|
|
|
//得到年度比赛ID
|
|
|
|
Set<String> annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet()); |
|
|
|
Set<String> annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
//根据年度比赛ID查询年度比赛项目
|
|
|
|
List<AnnualCompPoint> annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds)); |
|
|
|
List<AnnualCompPoint> annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds)); |
|
|
|
if (!ObjectUtils.isEmpty(annualCompPointList)) { |
|
|
|
if (!ObjectUtils.isEmpty(annualCompPointList)) { |
|
|
|
|
|
|
|
//根据年度比赛ID查询奖项ID
|
|
|
|
Set<String> annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet()); |
|
|
|
Set<String> annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet()); |
|
|
|
queryWrapper.in(AnnualCompAward::getAnnucompid, annualCompPointIds); |
|
|
|
queryWrapper.in(AnnualCompAward::getAnnucompid, annualCompPointIds); |
|
|
|
} |
|
|
|
} |
|
|
|