查询登录用户权限信息,使用UserUtils

This commit is contained in:
2023-11-11 16:47:20 +08:00
parent 659705e70d
commit 4fd28a156b
3 changed files with 32 additions and 24 deletions

View File

@@ -28,4 +28,6 @@ public class QueryMemberInfoDTO {
private List<String> merchantDeptIds; private List<String> merchantDeptIds;
private String vinCode; private String vinCode;
private List<String> firstMerchantIds;
} }

View File

@@ -4,12 +4,14 @@ 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.vo.AuthorizedDeptVO;
import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.MemberWalletEnum; import com.jsowell.common.enums.MemberWalletEnum;
import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.domain.MemberPlateNumberRelation;
import com.jsowell.pile.domain.MemberWalletInfo;
import com.jsowell.pile.domain.MemberWalletLog;
import com.jsowell.pile.dto.PlatformTesterDTO; import com.jsowell.pile.dto.PlatformTesterDTO;
import com.jsowell.pile.dto.QueryMemberInfoDTO; import com.jsowell.pile.dto.QueryMemberInfoDTO;
import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO; import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
@@ -19,6 +21,7 @@ import com.jsowell.pile.mapper.MemberWalletInfoMapper;
import com.jsowell.pile.mapper.MemberWalletLogMapper; import com.jsowell.pile.mapper.MemberWalletLogMapper;
import com.jsowell.pile.service.*; import com.jsowell.pile.service.*;
import com.jsowell.pile.util.UserUtils; import com.jsowell.pile.util.UserUtils;
import com.jsowell.pile.vo.base.LoginUserDetailVO;
import com.jsowell.pile.vo.uniapp.MemberBalanceVO; import com.jsowell.pile.vo.uniapp.MemberBalanceVO;
import com.jsowell.pile.vo.uniapp.MemberVO; import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO; import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
@@ -29,7 +32,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
@@ -317,35 +319,33 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
*/ */
@Override @Override
public List<MemberVO> selectMemberList(QueryMemberInfoDTO dto) { public List<MemberVO> selectMemberList(QueryMemberInfoDTO dto) {
StopWatch sw = new StopWatch("查询会员列表");
sw.start("获取登录账号信息");
// 获取登录账号信息 // 获取登录账号信息
// AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap(); // AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap(); // AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
if (authorizedMap == null) { // if (authorizedMap == null) {
return new ArrayList<>(); // return new ArrayList<>();
} // }
List<String> merchantDeptIds = authorizedMap.getMerchantDeptIds(); // List<String> merchantDeptIds = authorizedMap.getMerchantDeptIds();
if (CollectionUtils.isNotEmpty(merchantDeptIds)) { // if (CollectionUtils.isNotEmpty(merchantDeptIds)) {
dto.setMerchantDeptIds(merchantDeptIds); // dto.setMerchantDeptIds(merchantDeptIds);
} // }
sw.stop();
sw.start("获取一级运营商信息"); // PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(authorizedMap.getDeptId());
PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(authorizedMap.getDeptId()); // if (pileMerchantInfo != null) {
if (pileMerchantInfo != null) { // String id = pileMerchantInfoService.getFirstLevelMerchantIdByMerchantId(pileMerchantInfo.getId() + "");
String id = pileMerchantInfoService.getFirstLevelMerchantIdByMerchantId(pileMerchantInfo.getId() + ""); // dto.setMerchantId(id);
dto.setMerchantId(id); // }
}
sw.stop(); LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail();
List<String> firstMerchantIdList = loginUserDetail.getFirstMerchantIdList();
if (CollectionUtils.isNotEmpty(firstMerchantIdList)) {
dto.setFirstMerchantIds(firstMerchantIdList);
}
sw.start("查询数据库会员信息");
PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
List<MemberVO> memberVOS = memberBasicInfoMapper.selectMemberList(dto); List<MemberVO> memberVOS = memberBasicInfoMapper.selectMemberList(dto);
sw.stop();
log.info("查询耗时:{}", sw.prettyPrint());
return memberVOS; return memberVOS;
} }

View File

@@ -228,6 +228,12 @@
<if test="dto.vinCode != null"> <if test="dto.vinCode != null">
and t4.vin_code like '%${dto.vinCode}%' and t4.vin_code like '%${dto.vinCode}%'
</if> </if>
<if test="dto.firstMerchantIds != null and dto.firstMerchantIds.size() != 0">
and t1.merchant_id in
<foreach collection="dto.firstMerchantIds" item="firstMerchantId" open="(" separator="," close=")">
#{firstMerchantId,jdbcType=VARCHAR}
</foreach>
</if>
GROUP BY (t1.member_id) GROUP BY (t1.member_id)
</select> </select>