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

@@ -73,7 +73,8 @@ public class MemberBasicInfoController extends BaseController {
public RestApiResponse<?> getMerchantListByAuth() { public RestApiResponse<?> getMerchantListByAuth() {
RestApiResponse<?> response = null; RestApiResponse<?> response = null;
List<String> deptIds = getDeptIds(); List<String> deptIds = getDeptIds();
List<MerchantInfoVO> list = memberBasicInfoService.getMerchantListByAuthV2(deptIds); // List<MerchantInfoVO> list = memberBasicInfoService.getMerchantListByAuth(deptIds);
List<MerchantInfoVO> list = memberBasicInfoService.getMerchantListByAuthV2();
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>(); list = new ArrayList<>();
} }

View File

@@ -112,4 +112,11 @@ public interface PileMerchantInfoMapper {
* @return * @return
*/ */
List<MerchantSettleInfoVO> queryMerchantSettleInfoList(@Param("dto") QueryMerchantInfoDTO dto); 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> getMerchantListByAuth(List<String> deptIds);
List<MerchantInfoVO> getMerchantListByAuthV2(List<String> deptIds); List<MerchantInfoVO> getMerchantListByAuthV2();
} }

View File

@@ -122,4 +122,10 @@ public interface IPileMerchantInfoService {
* 通过merchantId获取一级运营商id * 通过merchantId获取一级运营商id
*/ */
String getFirstLevelMerchantIdByMerchantId(String merchantId); 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.google.common.collect.Lists;
import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants; 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.entity.SysUser;
import com.jsowell.common.core.domain.model.LoginUser; import com.jsowell.common.core.domain.model.LoginUser;
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
@@ -434,7 +435,7 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
* 获取当前会员中的运营商列表(带权限校验) * 获取当前会员中的运营商列表(带权限校验)
*/ */
@Override @Override
public List<MerchantInfoVO> getMerchantListByAuthV2(List<String> deptIds) { public List<MerchantInfoVO> getMerchantListByAuthV2() {
List<MerchantInfoVO> resultList = Lists.newArrayList(); List<MerchantInfoVO> resultList = Lists.newArrayList();
// 获取登录用户 所有有权限运营商 // 获取登录用户 所有有权限运营商
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
@@ -447,14 +448,24 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
return resultList; return resultList;
} }
// 获取所属部门id // 获取所属部门id
Long deptId = user.getDeptId(); SysDept dept = user.getDept();
if (Objects.isNull(deptId)) { if (Objects.isNull(dept)) {
return resultList; return resultList;
} }
// 根据部门id查询对应的运营商 String deptLevel = dept.getDeptLevel();
PileMerchantInfo merchantInfo = pileMerchantInfoService.queryInfoByDeptId(String.valueOf(deptId)); if (Constants.ZERO.equals(deptLevel)) {
PileStationInfo stationInfo = pileStationInfoService.queryInfoByDeptId(String.valueOf(deptId)); // 平台级权限 查询所有生效的运营商
return null; 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) { if (pileMerchantInfo == null) {
return 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() MerchantInfoVO vo = MerchantInfoVO.builder()
.merchantId(merchantId) .merchantId(String.valueOf(pileMerchantInfo.getId()))
.merchantName(pileMerchantInfo.getMerchantName()) .merchantName(pileMerchantInfo.getMerchantName())
.merchantTel(pileMerchantInfo.getServicePhone()) .merchantTel(pileMerchantInfo.getServicePhone())
.organizationCode(pileMerchantInfo.getOrganizationCode()) .organizationCode(pileMerchantInfo.getOrganizationCode())
@@ -498,4 +514,32 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
return null; 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;
}
} }

View File

@@ -50,13 +50,14 @@
<sql id="selectPileMerchantInfoVo"> <sql id="selectPileMerchantInfoVo">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from pile_merchant_info t from pile_merchant_info
</sql> </sql>
<select id="selectPileMerchantInfoList" parameterType="com.jsowell.pile.domain.PileMerchantInfo" <select id="selectPileMerchantInfoList" parameterType="com.jsowell.pile.domain.PileMerchantInfo"
resultMap="PileMerchantInfoResult"> resultMap="PileMerchantInfoResult">
<include refid="selectPileMerchantInfoVo"/> <include refid="selectPileMerchantInfoVo"/>
<where> <where>
del_flag = '0'
<if test="merchantName != null and merchantName != ''"> <if test="merchantName != null and merchantName != ''">
and merchant_name like concat('%', #{merchantName}, '%') and merchant_name like concat('%', #{merchantName}, '%')
</if> </if>
@@ -408,4 +409,11 @@
and t1.manager_phone = #{dto.managerPhone,jdbcType=VARCHAR} and t1.manager_phone = #{dto.managerPhone,jdbcType=VARCHAR}
</if> </if>
</select> </select>
<select id="selectListByFirstMerchant" resultMap="PileMerchantInfoResult">
select <include refid="Base_Column_List"/>
from pile_merchant_info
where del_flag = '0'
and (parent_id = #{firstMerchantId,jdbcType=VARCHAR} or id = #{firstMerchantId,jdbcType=VARCHAR})
</select>
</mapper> </mapper>