mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 12:05:05 +08:00
Merge branch 'dev_local' into dev
# Conflicts: # jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileStationInfoMapper.java # jsowell-pile/src/main/java/com/jsowell/pile/service/IPileStationInfoService.java # jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java # jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml
This commit is contained in:
@@ -28,4 +28,6 @@ public class QueryMemberInfoDTO {
|
||||
private List<String> merchantDeptIds;
|
||||
|
||||
private String vinCode;
|
||||
|
||||
private List<String> firstMerchantIds;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.MemberWalletInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface MemberWalletInfoMapper {
|
||||
/**
|
||||
* delete by primary key
|
||||
@@ -51,5 +54,13 @@ public interface MemberWalletInfoMapper {
|
||||
*/
|
||||
int updateByPrimaryKey(MemberWalletInfo record);
|
||||
|
||||
MemberWalletInfo selectByMemberId(String memberId);
|
||||
// MemberWalletInfo selectByMemberId(String memberId);
|
||||
|
||||
/**
|
||||
* 根据会员id和目标运营商id查询用户钱包信息
|
||||
* @param memberId
|
||||
* @param merchantId
|
||||
* @return
|
||||
*/
|
||||
MemberWalletInfo selectByMemberId(@Param("memberId") String memberId, @Param("merchantId") String merchantId);
|
||||
}
|
||||
@@ -5,9 +5,11 @@ import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
|
||||
import com.jsowell.pile.vo.uniapp.MemberBalanceVO;
|
||||
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface MemberWalletLogMapper {
|
||||
/**
|
||||
* delete by primary key
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -115,4 +115,6 @@ public interface PileStationInfoMapper {
|
||||
* @return
|
||||
*/
|
||||
List<NXJTStationInfoVO> NXJTQueryStationsInfo(NXJTQueryStationInfoDTO dto);
|
||||
|
||||
PileStationInfo queryInfoByDeptId(@Param("deptId") String deptId);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ 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;
|
||||
@@ -147,10 +146,4 @@ public interface IMemberBasicInfoService {
|
||||
* @return
|
||||
*/
|
||||
List<MemberBalanceVO> getMemberRefundAmount(List<String> memberIds);
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前会员中的运营商列表(带权限校验)
|
||||
*/
|
||||
List<MerchantInfoVO> getMerchantListByAuth(List<String> deptIds);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public interface IPileMerchantInfoService {
|
||||
*/
|
||||
String getFirstLevelMerchantIdByAppId(String appId);
|
||||
|
||||
MerchantInfoVO getMerchantInfo(String merchantId);
|
||||
MerchantInfoVO getMerchantInfoVO(String merchantId);
|
||||
|
||||
/**
|
||||
* 根据运营商部门ids 查询所有站点id
|
||||
@@ -87,6 +87,8 @@ public interface IPileMerchantInfoService {
|
||||
|
||||
PileMerchantInfo queryInfoByDeptId(String deptId);
|
||||
|
||||
MerchantInfoVO queryMerchantInfoVOByDeptId(String deptId);
|
||||
|
||||
/**
|
||||
* 通过ids查询信息列表
|
||||
* @param dto
|
||||
@@ -122,4 +124,10 @@ public interface IPileMerchantInfoService {
|
||||
* 通过merchantId获取一级运营商id
|
||||
*/
|
||||
String getFirstLevelMerchantIdByMerchantId(String merchantId);
|
||||
|
||||
// 查询全部生效的运营商
|
||||
List<MerchantInfoVO> selectAll();
|
||||
|
||||
// 查询一级运营商下属的二级运营商
|
||||
List<MerchantInfoVO> selectListByFirstMerchant(String firstMerchantId);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.jsowell.pile.vo.ningxiajiaotou.NXJTStationInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 充电站信息Service接口
|
||||
@@ -131,4 +130,7 @@ public interface IPileStationInfoService {
|
||||
* @return
|
||||
*/
|
||||
List<NXJTStationInfoVO> NXJTQueryStationsInfo(NXJTQueryStationInfoDTO dto);
|
||||
|
||||
PileStationInfo queryInfoByDeptId(String valueOf);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public interface MemberWalletInfoService {
|
||||
|
||||
MemberWalletInfo selectByPrimaryKey(Integer id);
|
||||
|
||||
MemberWalletInfo selectByMemberId(String memberId);
|
||||
MemberWalletInfo selectByMemberId(String memberId, String merchantId);
|
||||
|
||||
int updateByPrimaryKeySelective(MemberWalletInfo record);
|
||||
|
||||
|
||||
@@ -2,27 +2,27 @@ package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
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.enums.MemberWalletEnum;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.common.util.id.IdUtils;
|
||||
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.QueryMemberInfoDTO;
|
||||
import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
|
||||
import com.jsowell.pile.mapper.MemberBasicInfoMapper;
|
||||
import com.jsowell.pile.mapper.MemberPlateNumberRelationMapper;
|
||||
import com.jsowell.pile.mapper.MemberWalletInfoMapper;
|
||||
import com.jsowell.pile.mapper.MemberWalletLogMapper;
|
||||
import com.jsowell.pile.service.IMemberBasicInfoService;
|
||||
import com.jsowell.pile.service.IMemberTransactionRecordService;
|
||||
import com.jsowell.pile.service.IPileBasicInfoService;
|
||||
import com.jsowell.pile.service.IPileMerchantInfoService;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.service.*;
|
||||
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.MemberVO;
|
||||
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
|
||||
@@ -33,11 +33,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 会员基础信息Service业务层处理
|
||||
@@ -51,8 +51,11 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
@Autowired
|
||||
private MemberBasicInfoMapper memberBasicInfoMapper;
|
||||
|
||||
// @Autowired
|
||||
// private MemberWalletInfoMapper memberWalletInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private MemberWalletInfoMapper memberWalletInfoMapper;
|
||||
private MemberWalletInfoService memberWalletInfoService;
|
||||
|
||||
@Autowired
|
||||
private MemberWalletLogMapper memberWalletLogMapper;
|
||||
@@ -72,6 +75,9 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
@Autowired
|
||||
private IMemberTransactionRecordService memberTransactionRecordService;
|
||||
|
||||
@Autowired
|
||||
private IPileStationInfoService pileStationInfoService;
|
||||
|
||||
/**
|
||||
* 查询会员基础信息
|
||||
*
|
||||
@@ -177,10 +183,19 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
BigDecimal updatePrincipalBalance = dto.getUpdatePrincipalBalance();
|
||||
log.info("修改用户余额 memberId:{}, updatePrincipalBalance:{}, updateGiftBalance:{}", memberId, updatePrincipalBalance, updateGiftBalance);
|
||||
// 查询用户余额
|
||||
MemberWalletInfo info = memberWalletInfoMapper.selectByMemberId(memberId);
|
||||
if (info == null) {
|
||||
log.warn("根据会员id:{}, 查询会员信息为空", memberId);
|
||||
return 0;
|
||||
MemberWalletInfo walletInfo = memberWalletInfoService.selectByMemberId(memberId, dto.getTargetMerchantId());
|
||||
if (walletInfo == null) {
|
||||
log.warn("根据会员id:{}, 目标运营商id:{}, 查询会员信息为空, 新建会员钱包", memberId, dto.getTargetMerchantId());
|
||||
// 如果查询到钱包为空,就新建一个该运营商的钱包
|
||||
walletInfo = MemberWalletInfo.builder()
|
||||
.walletCode(IdUtils.get16UUID())
|
||||
.memberId(memberId)
|
||||
.merchantId(dto.getTargetMerchantId())
|
||||
.giftBalance(BigDecimal.ZERO)
|
||||
.principalBalance(BigDecimal.ZERO)
|
||||
.version(0)
|
||||
.build();
|
||||
memberWalletInfoService.insertSelective(walletInfo);
|
||||
}
|
||||
|
||||
// 记录流水
|
||||
@@ -196,9 +211,9 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
updatePrincipalBalance = updatePrincipalBalance.negate();
|
||||
}
|
||||
// 会员老的余额
|
||||
BigDecimal oldPrincipalBalance = info.getPrincipalBalance() == null
|
||||
BigDecimal oldPrincipalBalance = walletInfo.getPrincipalBalance() == null
|
||||
? BigDecimal.ZERO
|
||||
: info.getPrincipalBalance();
|
||||
: walletInfo.getPrincipalBalance();
|
||||
newPrincipalBalance = oldPrincipalBalance.add(updatePrincipalBalance);
|
||||
if (newPrincipalBalance.compareTo(BigDecimal.ZERO) < 0) {
|
||||
log.warn("变更后本金余额不能为负数");
|
||||
@@ -224,9 +239,9 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
// 扣款 转为负数
|
||||
updateGiftBalance = updateGiftBalance.negate();
|
||||
}
|
||||
BigDecimal oldGiftBalance = info.getGiftBalance() == null
|
||||
BigDecimal oldGiftBalance = walletInfo.getGiftBalance() == null
|
||||
? BigDecimal.ZERO
|
||||
: info.getGiftBalance();
|
||||
: walletInfo.getGiftBalance();
|
||||
newGiftBalance = oldGiftBalance.add(updateGiftBalance);
|
||||
// 余额不能为负数
|
||||
if (newGiftBalance.compareTo(BigDecimal.ZERO) < 0) {
|
||||
@@ -250,7 +265,7 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
// 修改数据库
|
||||
int i = 0;
|
||||
if (newPrincipalBalance != null || newGiftBalance != null) {
|
||||
i = memberBasicInfoMapper.updateMemberBalance(memberId, newPrincipalBalance, newGiftBalance, info.getVersion());
|
||||
i = memberBasicInfoMapper.updateMemberBalance(memberId, newPrincipalBalance, newGiftBalance, walletInfo.getVersion());
|
||||
if (i == 0) {
|
||||
log.warn("修改余额失败, memberId:{}", memberId);
|
||||
}
|
||||
@@ -262,6 +277,16 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
return i;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Set<String> set = Sets.newHashSet();
|
||||
for (int i = 0; i < 10000000; i++) {
|
||||
String s = IdUtils.get16UUID();
|
||||
System.out.println(s);
|
||||
set.add(s);
|
||||
}
|
||||
System.out.println("set size:" + set.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberVO queryMemberInfoByMemberId(String memberId) {
|
||||
if (StringUtils.isBlank(memberId)) {
|
||||
@@ -318,34 +343,33 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
*/
|
||||
@Override
|
||||
public List<MemberVO> selectMemberList(QueryMemberInfoDTO dto) {
|
||||
StopWatch sw = new StopWatch("查询会员列表");
|
||||
|
||||
sw.start("获取登录账号信息");
|
||||
// 获取登录账号信息
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<String> merchantDeptIds = authorizedMap.getMerchantDeptIds();
|
||||
if (CollectionUtils.isNotEmpty(merchantDeptIds)) {
|
||||
dto.setMerchantDeptIds(merchantDeptIds);
|
||||
}
|
||||
sw.stop();
|
||||
// AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
// AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
// if (authorizedMap == null) {
|
||||
// return new ArrayList<>();
|
||||
// }
|
||||
// List<String> merchantDeptIds = authorizedMap.getMerchantDeptIds();
|
||||
// if (CollectionUtils.isNotEmpty(merchantDeptIds)) {
|
||||
// dto.setMerchantDeptIds(merchantDeptIds);
|
||||
// }
|
||||
|
||||
sw.start("获取一级运营商信息");
|
||||
PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(authorizedMap.getDeptId());
|
||||
if (pileMerchantInfo != null) {
|
||||
String id = pileMerchantInfoService.getFirstLevelMerchantIdByMerchantId(pileMerchantInfo.getId() + "");
|
||||
dto.setMerchantId(id);
|
||||
}
|
||||
sw.stop();
|
||||
// PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(authorizedMap.getDeptId());
|
||||
// if (pileMerchantInfo != null) {
|
||||
// String id = pileMerchantInfoService.getFirstLevelMerchantIdByMerchantId(pileMerchantInfo.getId() + "");
|
||||
// dto.setMerchantId(id);
|
||||
// }
|
||||
|
||||
LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail();
|
||||
List<String> firstMerchantIdList = loginUserDetail.getFirstMerchantIdList();
|
||||
if (CollectionUtils.isNotEmpty(firstMerchantIdList)) {
|
||||
dto.setFirstMerchantIds(firstMerchantIdList);
|
||||
}
|
||||
|
||||
sw.start("查询数据库会员信息");
|
||||
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
|
||||
List<MemberVO> memberVOS = memberBasicInfoMapper.selectMemberList(dto);
|
||||
sw.stop();
|
||||
|
||||
log.info("查询耗时:{}", sw.prettyPrint());
|
||||
return memberVOS;
|
||||
}
|
||||
|
||||
@@ -419,13 +443,4 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
return memberWalletLogMapper.getMemberRefundAmount(memberIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会员中的运营商列表(带权限校验)
|
||||
*/
|
||||
@Override
|
||||
public List<MerchantInfoVO> getMerchantListByAuth(List<String> deptIds) {
|
||||
return memberBasicInfoMapper.getMerchantListByAuth(deptIds);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ public class MemberWalletInfoServiceImpl implements MemberWalletInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberWalletInfo selectByMemberId(String memberId) {
|
||||
return memberWalletInfoMapper.selectByMemberId(memberId);
|
||||
public MemberWalletInfo selectByMemberId(String memberId, String merchantId) {
|
||||
return memberWalletInfoMapper.selectByMemberId(memberId, merchantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,6 +48,7 @@ import com.jsowell.pile.service.orderlogic.OrderLogicFactory;
|
||||
import com.jsowell.pile.transaction.dto.ClearingBillTransactionDTO;
|
||||
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
|
||||
import com.jsowell.pile.transaction.service.TransactionService;
|
||||
import com.jsowell.pile.util.UserUtils;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
import com.jsowell.pile.vo.base.*;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
@@ -197,7 +198,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
@Override
|
||||
public List<OrderListVO> selectOrderBasicInfoListWithAuth(QueryOrderDTO dto) {
|
||||
// 权限过滤
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
// 为空表示没有权限,返回空数组
|
||||
return Lists.newArrayList();
|
||||
@@ -1935,7 +1936,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
*/
|
||||
@Override
|
||||
public List<IndexOrderInfoVO> getIndexOrderInfo(IndexQueryDTO dto) {
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.pile.domain.OrderInvoiceRecord;
|
||||
import com.jsowell.pile.dto.GetInvoiceInfoDTO;
|
||||
import com.jsowell.pile.dto.QueryInvoiceRecordDTO;
|
||||
@@ -11,6 +9,7 @@ import com.jsowell.pile.mapper.OrderInvoiceRecordMapper;
|
||||
import com.jsowell.pile.service.IMemberInvoiceTitleService;
|
||||
import com.jsowell.pile.service.IOrderBasicInfoService;
|
||||
import com.jsowell.pile.service.IOrderInvoiceRecordService;
|
||||
import com.jsowell.pile.util.UserUtils;
|
||||
import com.jsowell.pile.vo.base.OrderAmountDetailVO;
|
||||
import com.jsowell.pile.vo.uniapp.InvoiceTitleVO;
|
||||
import com.jsowell.pile.vo.web.InvoiceRecordVO;
|
||||
@@ -96,7 +95,7 @@ public class OrderInvoiceRecordServiceImpl implements IOrderInvoiceRecordService
|
||||
@Override
|
||||
public List<OrderInvoiceRecordVO> getInvoiceListWithAuth(GetInvoiceInfoDTO dto) {
|
||||
// 获取登录账号信息
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jsowell.pile.mapper.PileBasicInfoMapper;
|
||||
import com.jsowell.pile.mapper.PileMerchantInfoMapper;
|
||||
import com.jsowell.pile.mapper.PileSimInfoMapper;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.util.UserUtils;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.GroundLockInfoVO;
|
||||
@@ -326,7 +327,7 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
|
||||
*/
|
||||
@Override
|
||||
public List<PileDetailVO> queryPileInfoList(QueryPileDTO queryPileDTO) {
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
// 为空表示没有权限,返回空数组
|
||||
return Lists.newArrayList();
|
||||
@@ -422,7 +423,7 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
|
||||
.merchantId(String.valueOf(basicInfo.getMerchantId()))
|
||||
.build();
|
||||
// 查站点信息
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(basicInfo.getMerchantId()));
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(basicInfo.getMerchantId()));
|
||||
if (merchantInfo != null) {
|
||||
pileInfoVO.setMerchantName(merchantInfo.getMerchantName());
|
||||
}
|
||||
@@ -700,7 +701,7 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
|
||||
*/
|
||||
@Override
|
||||
public IndexGeneralSituationVO getGeneralSituation(IndexQueryDTO dto) {
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
return new IndexGeneralSituationVO();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -24,6 +23,7 @@ import com.jsowell.pile.service.IPileBasicInfoService;
|
||||
import com.jsowell.pile.service.IPileBillingTemplateService;
|
||||
import com.jsowell.pile.transaction.dto.BillingTemplateTransactionDTO;
|
||||
import com.jsowell.pile.transaction.service.TransactionService;
|
||||
import com.jsowell.pile.util.UserUtils;
|
||||
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails;
|
||||
import com.jsowell.pile.vo.web.BillingDetailVO;
|
||||
@@ -426,7 +426,7 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
|
||||
if (StringUtils.isBlank(stationId)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
// 为空表示没有权限,返回空数组
|
||||
return Lists.newArrayList();
|
||||
|
||||
@@ -9,13 +9,13 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.DictUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||
import com.jsowell.pile.dto.CreateMerchantDTO;
|
||||
import com.jsowell.pile.dto.QueryMerchantInfoDTO;
|
||||
import com.jsowell.pile.mapper.PileMerchantInfoMapper;
|
||||
import com.jsowell.pile.service.IPileMerchantInfoService;
|
||||
import com.jsowell.pile.util.UserUtils;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.web.MerchantSettleInfoVO;
|
||||
import com.jsowell.system.service.SysDeptService;
|
||||
@@ -74,7 +74,7 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
*/
|
||||
@Override
|
||||
public List<PileMerchantInfo> selectPileMerchantInfoListWithAuth(PileMerchantInfo pileMerchantInfo) {
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
// 为空表示没有权限,返回空数组
|
||||
return Lists.newArrayList();
|
||||
@@ -122,6 +122,7 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
dept.setDeptName(dto.getMerchantName());
|
||||
dept.setLeader(dto.getManagerName());
|
||||
dept.setPhone(dto.getManagerPhone());
|
||||
dept.setDeptLevel("2");
|
||||
dept.setStatus("0");
|
||||
sysDeptService.insertDept(dept);
|
||||
|
||||
@@ -306,17 +307,34 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantInfoVO getMerchantInfo(String merchantId) {
|
||||
public MerchantInfoVO getMerchantInfoVO(String merchantId) {
|
||||
PileMerchantInfo pileMerchantInfo = selectPileMerchantInfoById(Long.parseLong(merchantId));
|
||||
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())
|
||||
.deptId(pileMerchantInfo.getDeptId())
|
||||
.merchantLevel(pileMerchantInfo.getMerchantLevel())
|
||||
.build();
|
||||
return vo;
|
||||
}
|
||||
@@ -334,6 +352,15 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
return pileMerchantInfoMapper.queryInfoByDeptId(deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantInfoVO queryMerchantInfoVOByDeptId(String deptId) {
|
||||
PileMerchantInfo merchantInfo = queryInfoByDeptId(deptId);
|
||||
if (Objects.isNull(merchantInfo)) {
|
||||
return null;
|
||||
}
|
||||
return conversion2MerchantInfoVO(merchantInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ids查询信息列表
|
||||
* @param dto
|
||||
@@ -345,7 +372,7 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
dto.setDeptIds(Lists.newArrayList());
|
||||
}
|
||||
// 权限过滤
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
// 为空表示没有权限,返回空数组
|
||||
return new ArrayList<>();
|
||||
@@ -497,4 +524,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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.ip.AddressUtils;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
|
||||
import com.jsowell.pile.dto.FastCreateStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
@@ -27,6 +26,7 @@ import com.jsowell.pile.dto.lutongyunting.BindParkingPlatformDTO;
|
||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
|
||||
import com.jsowell.pile.mapper.PileStationInfoMapper;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.util.UserUtils;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
import com.jsowell.pile.vo.base.StationInfoVO;
|
||||
@@ -261,7 +261,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
@Override
|
||||
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
|
||||
public int fastCreateStation(FastCreateStationDTO dto) {
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(dto.getMerchantId());
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(dto.getMerchantId());
|
||||
if (merchantInfo == null) {
|
||||
return 0;
|
||||
}
|
||||
@@ -323,6 +323,8 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
sysDept.setLeader(pileStationInfo.getStationAdminName());
|
||||
sysDept.setPhone(pileStationInfo.getStationTel());
|
||||
sysDept.setUpdateTime(DateUtils.getNowDate());
|
||||
sysDept.setDeptLevel("3");
|
||||
// 修改站点对应的部门
|
||||
sysDeptService.updateDept(sysDept);
|
||||
}
|
||||
}
|
||||
@@ -353,7 +355,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
/*
|
||||
修改组织部门
|
||||
*/
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(newMerchantId);
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(newMerchantId);
|
||||
if (merchantInfo != null) {
|
||||
// 创建一个新的站点对应部门
|
||||
SysDept dept = sysDeptService.createStationDept(Long.valueOf(merchantInfo.getDeptId()),
|
||||
@@ -404,7 +406,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
@Override
|
||||
// @DataScope(deptAlias = "t3")
|
||||
public List<PileStationVO> queryStationInfos(QueryStationDTO dto) {
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
// 为空表示没有权限,返回空数组
|
||||
return Lists.newArrayList();
|
||||
@@ -564,7 +566,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
*/
|
||||
@Override
|
||||
public List<PileStationVO> getStationSelectList(QueryStationDTO dto) {
|
||||
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
|
||||
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
|
||||
if (authorizedMap == null) {
|
||||
// 为空表示没有权限,返回空数组
|
||||
return Lists.newArrayList();
|
||||
@@ -584,5 +586,14 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
public List<NXJTStationInfoVO> NXJTQueryStationsInfo(NXJTQueryStationInfoDTO dto) {
|
||||
return pileStationInfoMapper.NXJTQueryStationsInfo(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PileStationInfo queryInfoByDeptId(String deptId) {
|
||||
if (StringUtils.isBlank(deptId)) {
|
||||
return null;
|
||||
}
|
||||
return pileStationInfoMapper.queryInfoByDeptId(deptId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -180,9 +180,10 @@ public class TransactionService {
|
||||
if (Objects.nonNull(dto.getMemberBasicInfo())) {
|
||||
memberBasicInfoMapper.insertMemberBasicInfo(dto.getMemberBasicInfo());
|
||||
}
|
||||
if (Objects.nonNull(dto.getMemberWalletInfo())) {
|
||||
memberWalletInfoMapper.insertSelective(dto.getMemberWalletInfo());
|
||||
}
|
||||
// 2023年11月11日17点01分修改逻辑 新建会员的时候不用新建钱包了,由在后管充值的时候创建
|
||||
// if (Objects.nonNull(dto.getMemberWalletInfo())) {
|
||||
// memberWalletInfoMapper.insertSelective(dto.getMemberWalletInfo());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
224
jsowell-pile/src/main/java/com/jsowell/pile/util/UserUtils.java
Normal file
224
jsowell-pile/src/main/java/com/jsowell/pile/util/UserUtils.java
Normal file
@@ -0,0 +1,224 @@
|
||||
package com.jsowell.pile.util;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
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;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.service.IMemberBasicInfoService;
|
||||
import com.jsowell.pile.service.IPileMerchantInfoService;
|
||||
import com.jsowell.pile.service.IPileStationInfoService;
|
||||
import com.jsowell.pile.vo.base.LoginUserDetailVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 后管登录用户工具类
|
||||
*/
|
||||
// 1.将工具类注入到容器中
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UserUtils {
|
||||
|
||||
// 2.注入想引用的对象的静态实例
|
||||
private static IMemberBasicInfoService memberBasicInfoService;
|
||||
|
||||
private static IPileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
private static IPileStationInfoService pileStationInfoService;
|
||||
|
||||
// 3.初始化有参构造器
|
||||
@Autowired
|
||||
public UserUtils(IMemberBasicInfoService memberBasicInfoService, IPileMerchantInfoService pileMerchantInfoService,
|
||||
IPileStationInfoService pileStationInfoService) {
|
||||
UserUtils.memberBasicInfoService = memberBasicInfoService;
|
||||
UserUtils.pileMerchantInfoService = pileMerchantInfoService;
|
||||
UserUtils.pileStationInfoService = pileStationInfoService;
|
||||
}
|
||||
|
||||
// 4.使用
|
||||
// 查询登录用户权限
|
||||
public static AuthorizedDeptVO getAuthorizedMap() {
|
||||
// 登录用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser == null) {
|
||||
return null;
|
||||
}
|
||||
// 用户
|
||||
SysUser user = loginUser.getUser();
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
AuthorizedDeptVO resultVO = AuthorizedDeptVO.builder().build();
|
||||
// 登录用户所属部门(运营商或站点 根据父级id判断)
|
||||
SysDept dept = user.getDept();
|
||||
if (dept == null) {
|
||||
log.info("用户id:{}, 获取不到所属部门信息", user.getUserId());
|
||||
return null;
|
||||
}
|
||||
String deptId = String.valueOf(dept.getDeptId());
|
||||
resultVO.setDeptId(deptId);
|
||||
log.info("用户id:{}, 所属部门信息:{}", user.getUserId(), JSONObject.toJSONString(dept));
|
||||
// 登录用户角色
|
||||
Long parentId = dept.getParentId();
|
||||
resultVO.setParentId(String.valueOf(parentId));
|
||||
List<String> merchantDeptIds = Lists.newArrayList();
|
||||
List<String> stationDeptIds = Lists.newArrayList();
|
||||
if (parentId == 0L) {
|
||||
// 父级id是0,表明是该账号挂在平台下面,是系统管理员
|
||||
} else if (parentId == 100L) {
|
||||
// 父级id是100,表明是该账号挂在运营商下面,是运营商管理员
|
||||
merchantDeptIds.add(deptId);
|
||||
resultVO.setMerchantDeptIds(merchantDeptIds);
|
||||
} else {
|
||||
// 其他情况,表明是站点管理员
|
||||
stationDeptIds.add(deptId);
|
||||
resultVO.setStationDeptIds(stationDeptIds);
|
||||
}
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会员中的运营商列表(带权限校验)
|
||||
*/
|
||||
/*public static List<MerchantInfoVO> getMerchantListByAuth() {
|
||||
List<MerchantInfoVO> resultList = Lists.newArrayList();
|
||||
// 获取登录用户 所有有权限运营商
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (Objects.isNull(loginUser)) {
|
||||
return resultList;
|
||||
}
|
||||
// 获取登录用户对应的user对象
|
||||
SysUser user = loginUser.getUser();
|
||||
if (Objects.isNull(user)) {
|
||||
return resultList;
|
||||
}
|
||||
// 获取所属部门id
|
||||
SysDept dept = user.getDept();
|
||||
if (Objects.isNull(dept)) {
|
||||
return resultList;
|
||||
}
|
||||
String deptLevel = dept.getDeptLevel();
|
||||
String deptId = String.valueOf(dept.getDeptId());
|
||||
if (Constants.ZERO.equals(deptLevel)) {
|
||||
// 平台级权限 查询所有生效的运营商
|
||||
resultList = pileMerchantInfoService.selectAll();
|
||||
} else if (Constants.ONE.equals(deptLevel)) {
|
||||
// 一级运营商权限 查询该一级运营商下面的所有运营商
|
||||
PileMerchantInfo merchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId);
|
||||
resultList = pileMerchantInfoService.selectListByFirstMerchant(merchantInfo.getId() + "");
|
||||
} else if (Constants.TWO.equals(deptLevel) ) {
|
||||
// 二级运营商权限 返回自身运营商
|
||||
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.queryMerchantInfoVOByDeptId(deptId);
|
||||
if (Objects.nonNull(merchantInfoVO)) {
|
||||
resultList.add(merchantInfoVO);
|
||||
}
|
||||
} else if (Constants.THREE.equals(deptLevel)) {
|
||||
// 站点权限 返回自身运营商
|
||||
PileStationInfo stationInfo = pileStationInfoService.queryInfoByDeptId(deptId);
|
||||
if (Objects.nonNull(stationInfo)) {
|
||||
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(stationInfo.getMerchantId() + "");
|
||||
if (Objects.nonNull(merchantInfoVO)) {
|
||||
resultList.add(merchantInfoVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 获取登录用户信息
|
||||
* 返回信息包含:
|
||||
* 一级运营商idList
|
||||
* 有权限的运营商信息list
|
||||
* @return LoginUserDetailVO 登录用户详情VO
|
||||
*/
|
||||
public static LoginUserDetailVO getLoginUserDetail() {
|
||||
LoginUserDetailVO resultVO = new LoginUserDetailVO();
|
||||
|
||||
// 获取登录用户 所有有权限运营商
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (Objects.isNull(loginUser)) {
|
||||
return resultVO;
|
||||
}
|
||||
// 获取登录用户对应的user对象
|
||||
SysUser user = loginUser.getUser();
|
||||
if (Objects.isNull(user)) {
|
||||
return resultVO;
|
||||
}
|
||||
// 获取所属部门
|
||||
SysDept dept = user.getDept();
|
||||
if (Objects.isNull(dept)) {
|
||||
return resultVO;
|
||||
}
|
||||
// 所属部门等级
|
||||
String deptLevel = dept.getDeptLevel();
|
||||
// 所属部门id
|
||||
String deptId = String.valueOf(dept.getDeptId());
|
||||
List<MerchantInfoVO> merchantInfoVOList = Lists.newArrayList();
|
||||
List<String> firstMerchantIdList = Lists.newArrayList();
|
||||
if (Constants.ZERO.equals(deptLevel)) { // 平台级权限
|
||||
// 查询所有生效的运营商
|
||||
merchantInfoVOList = pileMerchantInfoService.selectAll();
|
||||
|
||||
// 获取一级运营商id
|
||||
List<String> collect = merchantInfoVOList.stream()
|
||||
.filter(x -> Constants.ONE.equals(x.getMerchantLevel()))
|
||||
.map(MerchantInfoVO::getMerchantId)
|
||||
.collect(Collectors.toList());
|
||||
firstMerchantIdList.addAll(collect);
|
||||
} else if (Constants.ONE.equals(deptLevel)) { // 一级运营商权限
|
||||
// 查询该一级运营商下面的所有运营商
|
||||
PileMerchantInfo merchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId);
|
||||
if (Objects.nonNull(merchantInfo)) {
|
||||
String firstMerchantId = merchantInfo.getId().toString();
|
||||
// 获取一级运营商id
|
||||
firstMerchantIdList.add(firstMerchantId);
|
||||
merchantInfoVOList = pileMerchantInfoService.selectListByFirstMerchant(firstMerchantId);
|
||||
}
|
||||
} else if (Constants.TWO.equals(deptLevel)) { // 二级运营商权限
|
||||
// 返回自身运营商
|
||||
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.queryMerchantInfoVOByDeptId(deptId);
|
||||
if (Objects.nonNull(merchantInfoVO)) {
|
||||
merchantInfoVOList.add(merchantInfoVO);
|
||||
|
||||
// 获取一级运营商id
|
||||
PileMerchantInfo firstLevelMerchant = pileMerchantInfoService.getFirstLevelMerchantByMerchantId(merchantInfoVO.getMerchantId());
|
||||
if (Objects.nonNull(firstLevelMerchant)) {
|
||||
firstMerchantIdList.add(firstLevelMerchant.getId() + "");
|
||||
}
|
||||
}
|
||||
} else if (Constants.THREE.equals(deptLevel)) { // 站点权限
|
||||
// 返回站点所属运营商
|
||||
PileStationInfo stationInfo = pileStationInfoService.queryInfoByDeptId(deptId);
|
||||
if (Objects.nonNull(stationInfo)) {
|
||||
String merchantId = stationInfo.getMerchantId() + "";
|
||||
// 查询站点所属运营商
|
||||
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId);
|
||||
if (Objects.nonNull(merchantInfoVO)) {
|
||||
merchantInfoVOList.add(merchantInfoVO);
|
||||
}
|
||||
|
||||
// 获取一级运营商id
|
||||
PileMerchantInfo firstLevelMerchant = pileMerchantInfoService.getFirstLevelMerchantByMerchantId(merchantId);
|
||||
if (Objects.nonNull(firstLevelMerchant)) {
|
||||
firstMerchantIdList.add(firstLevelMerchant.getId() + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
resultVO.setMerchantInfoVOList(merchantInfoVOList);
|
||||
resultVO.setFirstMerchantIdList(firstMerchantIdList);
|
||||
return resultVO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.jsowell.pile.vo.base;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 登录用户详情VO
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class LoginUserDetailVO {
|
||||
/**
|
||||
* 有权限的一级运营商idList
|
||||
* 平台级账号有多个一级运营商权限
|
||||
* 其他账号只有一个
|
||||
*/
|
||||
private List<String> firstMerchantIdList;
|
||||
|
||||
/**
|
||||
* 获取当前会员中的运营商列表
|
||||
*/
|
||||
private List<MerchantInfoVO> merchantInfoVOList;
|
||||
}
|
||||
@@ -20,6 +20,11 @@ public class MerchantInfoVO {
|
||||
*/
|
||||
private String merchantName;
|
||||
|
||||
/**
|
||||
* 运营商等级
|
||||
*/
|
||||
private String merchantLevel;
|
||||
|
||||
/**
|
||||
* 商户电话
|
||||
*/
|
||||
|
||||
@@ -48,6 +48,11 @@ public class UpdateMemberBalanceDTO {
|
||||
*/
|
||||
private String relatedOrderCode;
|
||||
|
||||
/**
|
||||
* 充值目标运营商id
|
||||
*/
|
||||
private String targetMerchantId;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
||||
|
||||
Reference in New Issue
Block a user