update 会员区分运营商

This commit is contained in:
Lemon
2023-08-25 13:17:30 +08:00
parent 914380b3ea
commit 454022c553
10 changed files with 622 additions and 471 deletions

View File

@@ -12,6 +12,7 @@ import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.enums.uniapp.BalanceChangesEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.domain.MemberPlateNumberRelation;
@@ -21,14 +22,17 @@ import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
import com.jsowell.pile.service.IMemberBasicInfoService;
import com.jsowell.pile.service.IMemberPlateNumberRelationService;
import com.jsowell.pile.service.IMemberTransactionRecordService;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
import com.jsowell.pile.vo.web.MemberTransactionVO;
import com.jsowell.pile.vo.web.PlatformTesterVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@@ -61,6 +65,22 @@ public class MemberBasicInfoController extends BaseController {
return getDataTable(list);
}
/**
* 获取当前会员表中存在的运营商列表
* @return
*/
@GetMapping("/getMerchantListByAuth")
public RestApiResponse<?> getMerchantListByAuth() {
RestApiResponse<?> response = null;
List<String> deptIds = getDeptIds();
List<MerchantInfoVO> list = memberBasicInfoService.getMerchantListByAuth(deptIds);
if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>();
}
response = new RestApiResponse<>(list);
return response;
}
/**
* 导出会员基础信息列表
*/

View File

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
import com.jsowell.common.constant.HttpStatus;
import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.common.core.domain.model.LoginUser;
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
import com.jsowell.common.core.page.PageDomain;
import com.jsowell.common.core.page.PageResponse;
import com.jsowell.common.core.page.TableDataInfo;
@@ -17,6 +18,7 @@ import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.sql.SqlUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
@@ -24,6 +26,7 @@ import org.springframework.web.bind.annotation.InitBinder;
import javax.servlet.http.HttpServletRequest;
import java.beans.PropertyEditorSupport;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -194,4 +197,23 @@ public class BaseController {
public String getMemberIdByAuthorization(HttpServletRequest request) {
return getMemberIdByAuthorization(request.getHeader("Authorization"));
}
/**
* 获取当前登录账号有权限的运营商部门id
*
* 平台管理员账号会返回空数组
* @return
*/
public List<String> getDeptIds() {
// 获取登录账号信息
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
if (authorizedMap == null) {
return new ArrayList<>();
}
List<String> merchantDeptIds = authorizedMap.getMerchantDeptIds();
if (CollectionUtils.isNotEmpty(merchantDeptIds)) {
return merchantDeptIds;
}
return new ArrayList<>();
}
}

View File

@@ -2,6 +2,8 @@ package com.jsowell.pile.dto;
import lombok.Data;
import java.util.List;
/**
* TODO
*
@@ -19,4 +21,8 @@ public class QueryMemberInfoDTO {
private String mobileNumber;
private String memberId;
private String merchantId;
private List<String> merchantDeptIds;
}

View File

@@ -3,6 +3,7 @@ package com.jsowell.pile.mapper;
import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.domain.PileBasicInfo;
import com.jsowell.pile.dto.QueryMemberInfoDTO;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
import org.apache.ibatis.annotations.Param;
@@ -113,4 +114,9 @@ public interface MemberBasicInfoMapper {
*/
List<MemberVO> selectMemberList(@Param("dto") QueryMemberInfoDTO dto);
/**
* 获取当前会员中的运营商列表(带权限校验)
*/
List<MerchantInfoVO> getMerchantListByAuth(@Param("deptIds") List<String> deptIds);
}

View File

@@ -4,6 +4,7 @@ import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.dto.PlatformTesterDTO;
import com.jsowell.pile.dto.QueryMemberInfoDTO;
import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.uniapp.MemberBalanceVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
@@ -146,4 +147,10 @@ public interface IMemberBasicInfoService {
* @return
*/
List<MemberBalanceVO> getMemberRefundAmount(List<String> memberIds);
/**
* 获取当前会员中的运营商列表(带权限校验)
*/
List<MerchantInfoVO> getMerchantListByAuth(List<String> deptIds);
}

View File

@@ -3,8 +3,10 @@ package com.jsowell.pile.service.impl;
import com.google.common.collect.Lists;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.domain.MemberPlateNumberRelation;
@@ -19,6 +21,7 @@ import com.jsowell.pile.mapper.MemberWalletInfoMapper;
import com.jsowell.pile.mapper.MemberWalletLogMapper;
import com.jsowell.pile.service.IMemberBasicInfoService;
import com.jsowell.pile.service.IPileBasicInfoService;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.uniapp.MemberBalanceVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
@@ -31,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -291,6 +295,15 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
*/
@Override
public List<MemberVO> selectMemberList(QueryMemberInfoDTO dto) {
// 获取登录账号信息
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
if (authorizedMap == null) {
return new ArrayList<>();
}
List<String> merchantDeptIds = authorizedMap.getMerchantDeptIds();
if (CollectionUtils.isNotEmpty(merchantDeptIds)) {
dto.setMerchantDeptIds(merchantDeptIds);
}
return memberBasicInfoMapper.selectMemberList(dto);
}
@@ -364,5 +377,13 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
return memberWalletLogMapper.getMemberRefundAmount(memberIds);
}
/**
* 获取当前会员中的运营商列表(带权限校验)
*/
@Override
public List<MerchantInfoVO> getMerchantListByAuth(List<String> deptIds) {
return memberBasicInfoMapper.getMerchantListByAuth(deptIds);
}
}

View File

@@ -24,6 +24,13 @@ public class MemberVO {
*/
private String memberId;
private String merchantId;
/**
* 运营商名称
*/
private String merchantName;
/**
* 状态
*/

View File

@@ -197,6 +197,8 @@
<select id="selectMemberList" resultType="com.jsowell.pile.vo.uniapp.MemberVO">
SELECT
t1.merchant_id as merchantId,
t3.merchant_name as merchantName,
t1.member_id as memberId,
t1.STATUS as status,
t1.nick_name as nickName,
@@ -207,12 +209,35 @@
FROM
member_basic_info t1
JOIN member_wallet_info t2 ON t1.member_id = t2.member_id and t2.del_flag = '0'
JOIN pile_merchant_info t3 ON t1.merchant_id = t3.id and t3.del_flag = '0'
where
t1.del_flag = '0'
<if test="dto.mobileNumber != null and dto.mobileNumber != ''">and t1.mobile_number like '%${dto.mobileNumber}%'</if>
<if test="dto.nickName != null and dto.nickName != ''">and t1.nick_name like '%${dto.nickName}%'</if>
<if test="dto.memberId != null and dto.memberId != ''">and t1.member_id like '%${dto.memberId}%'</if>
<if test="dto.merchantId != null and dto.merchantId != ''">and t1.merchant_id like '%${dto.merchantId}%'</if>
<if test="dto.merchantDeptIds != null and dto.merchantDeptIds.size() != 0">
and t3.dept_id in
<foreach collection="dto.merchantDeptIds" item="deptId" open="(" separator="," close=")">
#{deptId,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select id="getMerchantListByAuth" resultType="com.jsowell.pile.vo.base.MerchantInfoVO">
SELECT DISTINCT
( t1.merchant_id ) as merchantId,
t2.merchant_name as merchantName
FROM
member_basic_info t1
JOIN pile_merchant_info t2 ON t1.merchant_id = t2.id and t1.del_flag = '0'
<where>
<if test="deptIds != null and deptIds.size() != 0">
t2.dept_id in
<foreach collection="deptIds" item="deptid" open="(" separator="," close=")">
#{deptid,jdbcType=VARCHAR}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@@ -113,3 +113,11 @@ export function updatePlatformTester(data) {
data: data
})
}
// 获取运营商列表
export function getMerchantList() {
return request({
url: '/member/info/getMerchantListByAuth',
method: 'get'
})
}

View File

@@ -2,6 +2,21 @@
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="运营商" prop="merchantId">
<el-select
v-model="queryParams.merchantId"
clearable placeholder="请选择运营商"
>
<el-option
v-for="item in merchantList"
:key="item.merchantName"
:label="item.merchantName"
:value="item.merchantId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="会员id" prop="memberId">
<el-input
v-model="queryParams.memberId"
@@ -84,6 +99,7 @@
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<!--<el-table-column label="" align="center" prop="id" />-->
<el-table-column label="运营商" align="center" prop="merchantName"/>
<el-table-column label="会员id" align="center" prop="memberId"/>
<el-table-column label="昵称" align="center" prop="nickName">
<template slot-scope="scope">
@@ -206,7 +222,7 @@
</template>
<script>
import {listInfo, getInfo, delInfo, addInfo, updateInfo, updateGiftBalance} from "@/api/member/info";
import {listInfo, getInfo, delInfo, addInfo, updateInfo, updateGiftBalance, getMerchantList} from "@/api/member/info";
export default {
name: "Info",
@@ -228,6 +244,8 @@ export default {
total: 0,
// 会员基础信息表格数据
infoList: [],
// 运营商列表
merchantList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
@@ -240,6 +258,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
merchantId: null,
nickName: null,
status: null,
avatarUrl: null,
@@ -262,6 +281,8 @@ export default {
},
created() {
this.getList();
this.getMerchantList();
},
methods: {
/** 查询会员基础信息列表 */
@@ -272,7 +293,8 @@ export default {
pageSize: this.queryParams.pageSize,
memberId: this.queryParams.memberId,
nickName: this.queryParams.nickName,
mobileNumber: this.queryParams.mobileNumber
mobileNumber: this.queryParams.mobileNumber,
merchantId: this.queryParams.merchantId,
}
console.log("params", params)
listInfo(params).then(response => {
@@ -282,6 +304,13 @@ export default {
this.loading = false;
});
},
// 获取运营商列表
getMerchantList() {
getMerchantList().then((response) =>{
console.log("response", response)
this.merchantList = response.obj
})
},
// 取消按钮
cancel() {
this.open = false;