mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
update 会员累计充值金额
This commit is contained in:
@@ -314,6 +314,35 @@ public class MemberService {
|
||||
log.info("查询用户余额信息 service方法 start");
|
||||
MemberWalletInfoVO vo = new MemberWalletInfoVO();
|
||||
vo.setMemberId(dto.getMemberId());
|
||||
|
||||
// 查询会员钱包信息表,获取 本金余额
|
||||
MemberWalletVO memberWalletVO = memberWalletInfoService.selectMemberWalletInfo(dto.getWalletCode());
|
||||
if (memberWalletVO == null) {
|
||||
// 用户未注册小程序
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_AUTHENTICATION_ERROR);
|
||||
}
|
||||
// 本金 sql处理为空返回0
|
||||
vo.setPrincipalBalance(memberWalletVO.getPrincipalBalance());
|
||||
|
||||
// 赠金 sql处理为空返回0
|
||||
vo.setGiftBalance(memberWalletVO.getGiftBalance());
|
||||
|
||||
// 当前余额
|
||||
vo.setCurrentBalance(vo.getPrincipalBalance().add(vo.getGiftBalance()));
|
||||
|
||||
// 累计充值本金
|
||||
vo.setAccumulatedRechargePrincipal(memberWalletVO.getAccumulatedRechargePrincipal());
|
||||
|
||||
// 累计赠送金额
|
||||
vo.setAccumulatedRechargeGift(memberWalletVO.getAccumulatedRechargeGift());
|
||||
|
||||
// 累计消费金额
|
||||
vo.setTotalConsumption(memberWalletVO.getAccumulatedConsumptionAmount());
|
||||
|
||||
// 总充值
|
||||
vo.setTotalRechargeAmount(memberWalletVO.getTotalRechargeAmount());
|
||||
|
||||
// 根据日期查询会员钱包变动明细 分页
|
||||
// 获取分页信息
|
||||
long pageNum = dto.getPageNum() == 0 ? 1L : dto.getPageNum();
|
||||
long pageSize = dto.getPageSize() == 0 ? 10L : dto.getPageSize();
|
||||
@@ -330,44 +359,23 @@ public class MemberService {
|
||||
lastDay = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date);
|
||||
dto.setTradeDate(tradeDate);
|
||||
dto.setEndDate(lastDay);
|
||||
|
||||
// 查询会员钱包信息表,获取 本金余额
|
||||
MemberWalletVO memberWalletVO = memberWalletInfoService.selectMemberWalletInfo(dto.getWalletCode());
|
||||
if (memberWalletVO == null) {
|
||||
// 用户未注册小程序
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_AUTHENTICATION_ERROR);
|
||||
}
|
||||
// 本金 sql处理为空返回0
|
||||
vo.setPrincipalBalance(memberWalletVO.getPrincipalBalance());
|
||||
// 赠金 sql处理为空返回0
|
||||
vo.setGiftBalance(memberWalletVO.getGiftBalance());
|
||||
// 当前余额
|
||||
vo.setCurrentBalance(vo.getPrincipalBalance().add(vo.getGiftBalance()));
|
||||
// 累计充值本金
|
||||
vo.setAccumulatedRechargePrincipal(memberWalletVO.getAccumulatedRechargePrincipal());
|
||||
// 累计赠送金额
|
||||
vo.setAccumulatedRechargeGift(memberWalletVO.getAccumulatedRechargeGift());
|
||||
// 累计消费金额
|
||||
vo.setAccumulatedConsumptionAmount(memberWalletVO.getAccumulatedConsumptionAmount());
|
||||
// 根据日期查询会员钱包变动明细
|
||||
// 分页
|
||||
// PageHelper.startPage(pageNum, pageSize);
|
||||
List<MemberWalletLogVO> list = memberBasicInfoService.getMemberWalletDetail(dto);
|
||||
|
||||
// 总支出
|
||||
BigDecimal totalConsumption = list.stream()
|
||||
.map(MemberWalletLogVO::getOrderAmount)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setTotalConsumption(totalConsumption);
|
||||
// BigDecimal totalConsumption = list.stream()
|
||||
// .map(MemberWalletLogVO::getOrderAmount)
|
||||
// .filter(Objects::nonNull)
|
||||
// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// vo.setTotalConsumption(totalConsumption);
|
||||
|
||||
// 总充值
|
||||
BigDecimal totalRechargeAmount = list.stream()
|
||||
.filter(x -> StringUtils.equals(x.getType(), "1"))
|
||||
.filter(x -> StringUtils.equals(x.getSubType(), "10") || StringUtils.equals(x.getSubType(), "11"))
|
||||
.map(MemberWalletLogVO::getAmount)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
vo.setTotalRechargeAmount(totalRechargeAmount);
|
||||
// BigDecimal totalRechargeAmount = list.stream()
|
||||
// .filter(x -> StringUtils.equals(x.getType(), "1"))
|
||||
// .filter(x -> StringUtils.equals(x.getSubType(), "10") || StringUtils.equals(x.getSubType(), "11"))
|
||||
// .map(MemberWalletLogVO::getAmount)
|
||||
// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// vo.setTotalRechargeAmount(totalRechargeAmount);
|
||||
|
||||
// PageInfo<MemberWalletLogVO> pageInfo = new PageInfo<>(list);
|
||||
// 获取 type 和 subType 的对应信息
|
||||
|
||||
Reference in New Issue
Block a user