update 查询运营商列表

This commit is contained in:
2023-11-10 17:13:27 +08:00
parent 140726f388
commit 84b93e9a3c
7 changed files with 88 additions and 11 deletions

View File

@@ -112,4 +112,11 @@ public interface PileMerchantInfoMapper {
* @return
*/
List<MerchantSettleInfoVO> queryMerchantSettleInfoList(@Param("dto") QueryMerchantInfoDTO dto);
/**
* 根据一级运营商id查询自身信息以及下属二级运营商信息
* @param firstMerchantId 一级运营商id
* @return
*/
List<PileMerchantInfo> selectListByFirstMerchant(@Param("firstMerchantId") String firstMerchantId);
}

View File

@@ -154,5 +154,5 @@ public interface IMemberBasicInfoService {
*/
List<MerchantInfoVO> getMerchantListByAuth(List<String> deptIds);
List<MerchantInfoVO> getMerchantListByAuthV2(List<String> deptIds);
List<MerchantInfoVO> getMerchantListByAuthV2();
}

View File

@@ -122,4 +122,10 @@ public interface IPileMerchantInfoService {
* 通过merchantId获取一级运营商id
*/
String getFirstLevelMerchantIdByMerchantId(String merchantId);
// 查询全部生效的运营商
List<MerchantInfoVO> selectAll();
// 查询一级运营商下属的二级运营商
List<MerchantInfoVO> selectListByFirstMerchant(String firstMerchantId);
}

View File

@@ -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<MerchantInfoVO> getMerchantListByAuthV2(List<String> deptIds) {
public List<MerchantInfoVO> getMerchantListByAuthV2() {
List<MerchantInfoVO> 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;
}

View File

@@ -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<MerchantInfoVO> selectAll() {
List<MerchantInfoVO> resultList = Lists.newArrayList();
List<PileMerchantInfo> pileMerchantInfos = pileMerchantInfoMapper.selectPileMerchantInfoList(null);
for (PileMerchantInfo pileMerchantInfo : pileMerchantInfos) {
resultList.add(conversion2MerchantInfoVO(pileMerchantInfo));
}
return resultList;
}
@Override
public List<MerchantInfoVO> selectListByFirstMerchant(String firstMerchantId) {
List<MerchantInfoVO> resultList = Lists.newArrayList();
// 查询运营商下属的二级运营商
List<PileMerchantInfo> pileMerchantInfos = pileMerchantInfoMapper.selectListByFirstMerchant(firstMerchantId);
if (CollectionUtils.isEmpty(pileMerchantInfos)) {
return resultList;
}
for (PileMerchantInfo pileMerchantInfo : pileMerchantInfos) {
resultList.add(conversion2MerchantInfoVO(pileMerchantInfo));
}
return resultList;
}
}