From 40bf1f4a152ca04fe6173da35dbb9894c248c12c Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Sat, 11 Nov 2023 16:22:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=99=BB=E5=BD=95=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=9D=83=E9=99=90=E4=BF=A1=E6=81=AF=EF=BC=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8UserUtils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/MemberBasicInfoController.java | 3 ++ .../java/com/jsowell/pile/util/UserUtils.java | 41 ++++++++++++------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberBasicInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberBasicInfoController.java index 24188560d..0b696f331 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberBasicInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberBasicInfoController.java @@ -22,6 +22,7 @@ import com.jsowell.pile.service.IMemberBasicInfoService; import com.jsowell.pile.service.IMemberPlateNumberRelationService; import com.jsowell.pile.service.IMemberTransactionRecordService; 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.uniapp.MemberVO; import com.jsowell.pile.vo.uniapp.MemberWalletLogVO; @@ -77,6 +78,8 @@ public class MemberBasicInfoController extends BaseController { // List list = memberBasicInfoService.getMerchantListByAuth(deptIds); // List list = memberBasicInfoService.getMerchantListByAuth(); List list = UserUtils.getMerchantListByAuth(); + LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail(); + logger.info("获取登录用户信息:{}", JSON.toJSONString(loginUserDetail)); if (CollectionUtils.isEmpty(list)) { list = new ArrayList<>(); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/util/UserUtils.java b/jsowell-pile/src/main/java/com/jsowell/pile/util/UserUtils.java index 17727d482..9c49d2973 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/util/UserUtils.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/util/UserUtils.java @@ -161,18 +161,18 @@ public class UserUtils { String deptId = String.valueOf(dept.getDeptId()); List merchantInfoVOList = Lists.newArrayList(); List firstMerchantIdList = Lists.newArrayList(); - if (Constants.ZERO.equals(deptLevel)) { - // 平台级权限 查询所有生效的运营商 + if (Constants.ZERO.equals(deptLevel)) { // 平台级权限 + // 查询所有生效的运营商 merchantInfoVOList = pileMerchantInfoService.selectAll(); // 获取一级运营商id List 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; } } \ No newline at end of file