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 42aa5f99a..bd2f0d4fd 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 @@ -73,7 +73,8 @@ public class MemberBasicInfoController extends BaseController { public RestApiResponse getMerchantListByAuth() { RestApiResponse response = null; List deptIds = getDeptIds(); - List list = memberBasicInfoService.getMerchantListByAuthV2(deptIds); + // List list = memberBasicInfoService.getMerchantListByAuth(deptIds); + List list = memberBasicInfoService.getMerchantListByAuthV2(); if (CollectionUtils.isEmpty(list)) { list = new ArrayList<>(); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileMerchantInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileMerchantInfoMapper.java index 9f490201c..128c31767 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileMerchantInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileMerchantInfoMapper.java @@ -112,4 +112,11 @@ public interface PileMerchantInfoMapper { * @return */ List queryMerchantSettleInfoList(@Param("dto") QueryMerchantInfoDTO dto); + + /** + * 根据一级运营商id查询自身信息以及下属二级运营商信息 + * @param firstMerchantId 一级运营商id + * @return + */ + List selectListByFirstMerchant(@Param("firstMerchantId") String firstMerchantId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IMemberBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IMemberBasicInfoService.java index 0c7c3b768..415c05e04 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IMemberBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IMemberBasicInfoService.java @@ -154,5 +154,5 @@ public interface IMemberBasicInfoService { */ List getMerchantListByAuth(List deptIds); - List getMerchantListByAuthV2(List deptIds); + List getMerchantListByAuthV2(); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileMerchantInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileMerchantInfoService.java index aa8a7a683..a9abebfff 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileMerchantInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileMerchantInfoService.java @@ -122,4 +122,10 @@ public interface IPileMerchantInfoService { * 通过merchantId获取一级运营商id */ String getFirstLevelMerchantIdByMerchantId(String merchantId); + + // 查询全部生效的运营商 + List selectAll(); + + // 查询一级运营商下属的二级运营商 + List selectListByFirstMerchant(String firstMerchantId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java index b4c30d17c..d6262183c 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java @@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper; import com.google.common.collect.Lists; import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.constant.Constants; +import com.jsowell.common.core.domain.entity.SysDept; import com.jsowell.common.core.domain.entity.SysUser; import com.jsowell.common.core.domain.model.LoginUser; import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; @@ -434,7 +435,7 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService { * 获取当前会员中的运营商列表(带权限校验) */ @Override - public List getMerchantListByAuthV2(List deptIds) { + public List getMerchantListByAuthV2() { List resultList = Lists.newArrayList(); // 获取登录用户 所有有权限运营商 LoginUser loginUser = SecurityUtils.getLoginUser(); @@ -447,14 +448,24 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService { return resultList; } // 获取所属部门id - Long deptId = user.getDeptId(); - if (Objects.isNull(deptId)) { + SysDept dept = user.getDept(); + if (Objects.isNull(dept)) { return resultList; } - // 根据部门id查询对应的运营商 - PileMerchantInfo merchantInfo = pileMerchantInfoService.queryInfoByDeptId(String.valueOf(deptId)); - PileStationInfo stationInfo = pileStationInfoService.queryInfoByDeptId(String.valueOf(deptId)); - return null; + String deptLevel = dept.getDeptLevel(); + if (Constants.ZERO.equals(deptLevel)) { + // 平台级权限 查询所有生效的运营商 + resultList = pileMerchantInfoService.selectAll(); + } else if (Constants.ONE.equals(deptLevel)) { + // 一级运营商权限 查询该一级运营商下面的所有运营商 + PileMerchantInfo merchantInfo = pileMerchantInfoService.queryInfoByDeptId(String.valueOf(dept.getDeptId())); + resultList = pileMerchantInfoService.selectListByFirstMerchant(merchantInfo.getId() + ""); + } else if (Constants.TWO.equals(deptLevel) ) { + // 二级运营商权限 返回自身运营商 + } else if (Constants.THREE.equals(deptLevel)) { + // 站点权限 返回自身运营商 + } + return resultList; } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java index 2253d315a..ce7e2a774 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java @@ -312,8 +312,24 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService { if (pileMerchantInfo == null) { return null; } + // MerchantInfoVO vo = MerchantInfoVO.builder() + // .merchantId(merchantId) + // .merchantName(pileMerchantInfo.getMerchantName()) + // .merchantTel(pileMerchantInfo.getServicePhone()) + // .organizationCode(pileMerchantInfo.getOrganizationCode()) + // .deptId(pileMerchantInfo.getDeptId()) + // .build(); + return conversion2MerchantInfoVO(pileMerchantInfo); + } + + /** + * PileMerchantInfo 转换为 MerchantInfoVO + * @param pileMerchantInfo + * @return + */ + private MerchantInfoVO conversion2MerchantInfoVO(PileMerchantInfo pileMerchantInfo) { MerchantInfoVO vo = MerchantInfoVO.builder() - .merchantId(merchantId) + .merchantId(String.valueOf(pileMerchantInfo.getId())) .merchantName(pileMerchantInfo.getMerchantName()) .merchantTel(pileMerchantInfo.getServicePhone()) .organizationCode(pileMerchantInfo.getOrganizationCode()) @@ -498,4 +514,32 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService { return null; } + /** + * 查询全部运营商信息 + * @return + */ + @Override + public List selectAll() { + List resultList = Lists.newArrayList(); + List pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoList(null); + for (PileMerchantInfo pileMerchantInfo : pileMerchantInfos) { + resultList.add(conversion2MerchantInfoVO(pileMerchantInfo)); + } + return resultList; + } + + @Override + public List selectListByFirstMerchant(String firstMerchantId) { + List resultList = Lists.newArrayList(); + // 查询运营商下属的二级运营商 + List pileMerchantInfos = pileMerchantInfoMapper.selectListByFirstMerchant(firstMerchantId); + if (CollectionUtils.isEmpty(pileMerchantInfos)) { + return resultList; + } + for (PileMerchantInfo pileMerchantInfo : pileMerchantInfos) { + resultList.add(conversion2MerchantInfoVO(pileMerchantInfo)); + } + return resultList; + } + } diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml index e8fbc70d1..cf6a3841f 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml @@ -50,13 +50,14 @@ select - from pile_merchant_info t + from pile_merchant_info + + \ No newline at end of file