查询登录用户权限信息,使用UserUtils

This commit is contained in:
2023-11-11 16:22:01 +08:00
parent de5210d051
commit 40bf1f4a15
2 changed files with 30 additions and 14 deletions

View File

@@ -161,18 +161,18 @@ public class UserUtils {
String deptId = String.valueOf(dept.getDeptId());
List<MerchantInfoVO> merchantInfoVOList = Lists.newArrayList();
List<String> firstMerchantIdList = Lists.newArrayList();
if (Constants.ZERO.equals(deptLevel)) {
// 平台级权限 查询所有生效的运营商
if (Constants.ZERO.equals(deptLevel)) { // 平台级权限
// 查询所有生效的运营商
merchantInfoVOList = pileMerchantInfoService.selectAll();
// 获取一级运营商id
List<String> collect = merchantInfoVOList.stream()
.map(MerchantInfoVO::getMerchantLevel)
.filter("1"::equals)
.filter(x -> Constants.ONE.equals(x.getMerchantLevel()))
.map(MerchantInfoVO::getMerchantId)
.collect(Collectors.toList());
firstMerchantIdList.addAll(collect);
} else if (Constants.ONE.equals(deptLevel)) {
// 一级运营商权限 查询该一级运营商下面的所有运营商
} else if (Constants.ONE.equals(deptLevel)) { // 一级运营商权限
// 查询该一级运营商下面的所有运营商
PileMerchantInfo merchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId);
if (Objects.nonNull(merchantInfo)) {
String firstMerchantId = merchantInfo.getId().toString();
@@ -180,25 +180,38 @@ public class UserUtils {
firstMerchantIdList.add(firstMerchantId);
merchantInfoVOList = pileMerchantInfoService.selectListByFirstMerchant(firstMerchantId);
}
} else if (Constants.TWO.equals(deptLevel)) {
// 二级运营商权限 返回自身运营商
} else if (Constants.TWO.equals(deptLevel)) { // 二级运营商权限
// 返回自身运营商
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.queryMerchantInfoVOByDeptId(deptId);
if (Objects.nonNull(merchantInfoVO)) {
merchantInfoVOList.add(merchantInfoVO);
// 获取一级运营商id
PileMerchantInfo firstLevelMerchant = pileMerchantInfoService.getFirstLevelMerchantByMerchantId(merchantInfoVO.getMerchantId());
if (Objects.nonNull(firstLevelMerchant)) {
firstMerchantIdList.add(firstLevelMerchant.getId() + "");
}
}
} else if (Constants.THREE.equals(deptLevel)) {
// 站点权限 返回自身运营商
} else if (Constants.THREE.equals(deptLevel)) { // 站点权限
// 返回站点所属运营商
PileStationInfo stationInfo = pileStationInfoService.queryInfoByDeptId(deptId);
if (Objects.nonNull(stationInfo)) {
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(stationInfo.getMerchantId() + "");
String merchantId = stationInfo.getMerchantId() + "";
// 查询站点所属运营商
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId);
if (Objects.nonNull(merchantInfoVO)) {
merchantInfoVOList.add(merchantInfoVO);
}
// 获取一级运营商id
PileMerchantInfo firstLevelMerchant = pileMerchantInfoService.getFirstLevelMerchantByMerchantId(merchantId);
if (Objects.nonNull(firstLevelMerchant)) {
firstMerchantIdList.add(firstLevelMerchant.getId() + "");
}
}
}
resultVO.setMerchantInfoVOList(merchantInfoVOList);
return null;
resultVO.setFirstMerchantIdList(firstMerchantIdList);
return resultVO;
}
}