mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-02 04:57:57 +08:00
查询登录用户权限信息,使用UserUtils
This commit is contained in:
@@ -22,6 +22,7 @@ import com.jsowell.pile.service.IMemberBasicInfoService;
|
|||||||
import com.jsowell.pile.service.IMemberPlateNumberRelationService;
|
import com.jsowell.pile.service.IMemberPlateNumberRelationService;
|
||||||
import com.jsowell.pile.service.IMemberTransactionRecordService;
|
import com.jsowell.pile.service.IMemberTransactionRecordService;
|
||||||
import com.jsowell.pile.util.UserUtils;
|
import com.jsowell.pile.util.UserUtils;
|
||||||
|
import com.jsowell.pile.vo.base.LoginUserDetailVO;
|
||||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||||
import com.jsowell.pile.vo.uniapp.MemberVO;
|
import com.jsowell.pile.vo.uniapp.MemberVO;
|
||||||
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
|
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
|
||||||
@@ -77,6 +78,8 @@ public class MemberBasicInfoController extends BaseController {
|
|||||||
// List<MerchantInfoVO> list = memberBasicInfoService.getMerchantListByAuth(deptIds);
|
// List<MerchantInfoVO> list = memberBasicInfoService.getMerchantListByAuth(deptIds);
|
||||||
// List<MerchantInfoVO> list = memberBasicInfoService.getMerchantListByAuth();
|
// List<MerchantInfoVO> list = memberBasicInfoService.getMerchantListByAuth();
|
||||||
List<MerchantInfoVO> list = UserUtils.getMerchantListByAuth();
|
List<MerchantInfoVO> list = UserUtils.getMerchantListByAuth();
|
||||||
|
LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail();
|
||||||
|
logger.info("获取登录用户信息:{}", JSON.toJSONString(loginUserDetail));
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
list = new ArrayList<>();
|
list = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,18 +161,18 @@ public class UserUtils {
|
|||||||
String deptId = String.valueOf(dept.getDeptId());
|
String deptId = String.valueOf(dept.getDeptId());
|
||||||
List<MerchantInfoVO> merchantInfoVOList = Lists.newArrayList();
|
List<MerchantInfoVO> merchantInfoVOList = Lists.newArrayList();
|
||||||
List<String> firstMerchantIdList = Lists.newArrayList();
|
List<String> firstMerchantIdList = Lists.newArrayList();
|
||||||
if (Constants.ZERO.equals(deptLevel)) {
|
if (Constants.ZERO.equals(deptLevel)) { // 平台级权限
|
||||||
// 平台级权限 查询所有生效的运营商
|
// 查询所有生效的运营商
|
||||||
merchantInfoVOList = pileMerchantInfoService.selectAll();
|
merchantInfoVOList = pileMerchantInfoService.selectAll();
|
||||||
|
|
||||||
// 获取一级运营商id
|
// 获取一级运营商id
|
||||||
List<String> collect = merchantInfoVOList.stream()
|
List<String> collect = merchantInfoVOList.stream()
|
||||||
.map(MerchantInfoVO::getMerchantLevel)
|
.filter(x -> Constants.ONE.equals(x.getMerchantLevel()))
|
||||||
.filter("1"::equals)
|
.map(MerchantInfoVO::getMerchantId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
firstMerchantIdList.addAll(collect);
|
firstMerchantIdList.addAll(collect);
|
||||||
} else if (Constants.ONE.equals(deptLevel)) {
|
} else if (Constants.ONE.equals(deptLevel)) { // 一级运营商权限
|
||||||
// 一级运营商权限 查询该一级运营商下面的所有运营商
|
// 查询该一级运营商下面的所有运营商
|
||||||
PileMerchantInfo merchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId);
|
PileMerchantInfo merchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId);
|
||||||
if (Objects.nonNull(merchantInfo)) {
|
if (Objects.nonNull(merchantInfo)) {
|
||||||
String firstMerchantId = merchantInfo.getId().toString();
|
String firstMerchantId = merchantInfo.getId().toString();
|
||||||
@@ -180,25 +180,38 @@ public class UserUtils {
|
|||||||
firstMerchantIdList.add(firstMerchantId);
|
firstMerchantIdList.add(firstMerchantId);
|
||||||
merchantInfoVOList = pileMerchantInfoService.selectListByFirstMerchant(firstMerchantId);
|
merchantInfoVOList = pileMerchantInfoService.selectListByFirstMerchant(firstMerchantId);
|
||||||
}
|
}
|
||||||
} else if (Constants.TWO.equals(deptLevel)) {
|
} else if (Constants.TWO.equals(deptLevel)) { // 二级运营商权限
|
||||||
// 二级运营商权限 返回自身运营商
|
// 返回自身运营商
|
||||||
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.queryMerchantInfoVOByDeptId(deptId);
|
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.queryMerchantInfoVOByDeptId(deptId);
|
||||||
if (Objects.nonNull(merchantInfoVO)) {
|
if (Objects.nonNull(merchantInfoVO)) {
|
||||||
merchantInfoVOList.add(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);
|
PileStationInfo stationInfo = pileStationInfoService.queryInfoByDeptId(deptId);
|
||||||
if (Objects.nonNull(stationInfo)) {
|
if (Objects.nonNull(stationInfo)) {
|
||||||
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(stationInfo.getMerchantId() + "");
|
String merchantId = stationInfo.getMerchantId() + "";
|
||||||
|
// 查询站点所属运营商
|
||||||
|
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId);
|
||||||
if (Objects.nonNull(merchantInfoVO)) {
|
if (Objects.nonNull(merchantInfoVO)) {
|
||||||
merchantInfoVOList.add(merchantInfoVO);
|
merchantInfoVOList.add(merchantInfoVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取一级运营商id
|
||||||
|
PileMerchantInfo firstLevelMerchant = pileMerchantInfoService.getFirstLevelMerchantByMerchantId(merchantId);
|
||||||
|
if (Objects.nonNull(firstLevelMerchant)) {
|
||||||
|
firstMerchantIdList.add(firstLevelMerchant.getId() + "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resultVO.setMerchantInfoVOList(merchantInfoVOList);
|
resultVO.setMerchantInfoVOList(merchantInfoVOList);
|
||||||
|
resultVO.setFirstMerchantIdList(firstMerchantIdList);
|
||||||
|
return resultVO;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user