From 199861555473ab50f2fafa3d58e42e64e838c039 Mon Sep 17 00:00:00 2001 From: luofl <1442745593@qq.com> Date: 星期一, 24 二月 2025 22:47:18 +0800 Subject: [PATCH] 修改物流信息导入模板 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java | 32 +++++++++++++++++++++++++------- 1 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java index 65f5425..bdcf3dd 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java @@ -1,15 +1,17 @@ package com.ruoyi.account.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.ruoyi.other.api.enums.WithdrawalAuditStatus; import com.ruoyi.account.api.model.AppUser; +import com.ruoyi.account.api.model.BalanceChangeRecordCopy; import com.ruoyi.account.api.model.WithdrawalRequests; import com.ruoyi.account.service.AppUserService; +import com.ruoyi.account.service.BalanceChangeRecordCopyService; import com.ruoyi.account.service.WalletService; import com.ruoyi.account.service.WithdrawalRequestsService; import com.ruoyi.account.vo.WalletVO; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.VipSetting; +import com.ruoyi.other.api.enums.WithdrawalAuditStatus; import com.ruoyi.other.api.feignClient.RemoteVipSettingClient; import org.springframework.stereotype.Service; @@ -25,6 +27,9 @@ private RemoteVipSettingClient remoteVipSettingClient; @Resource private WithdrawalRequestsService withdrawalRequestsService; + @Resource + private BalanceChangeRecordCopyService balanceChangeRecordCopyService; + @Override public WalletVO getWalletByUserId(Long userId) { @@ -39,23 +44,36 @@ throw new RuntimeException("会员设置信息为空"); } + List<BalanceChangeRecordCopy> recordCopies = balanceChangeRecordCopyService.list(new LambdaQueryWrapper<BalanceChangeRecordCopy>() + .eq(BalanceChangeRecordCopy::getAppUserId, userId) + .eq(BalanceChangeRecordCopy::getChangeType, 4)); + + BigDecimal commissionAmount = recordCopies.stream() + .map(BalanceChangeRecordCopy::getChangeAmount) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + // 获取提现审核中的金额 List<WithdrawalRequests> waitAuditList = withdrawalRequestsService.list(new LambdaQueryWrapper<WithdrawalRequests>() .eq(WithdrawalRequests::getAppUserId, userId) - .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT)); + .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT.getCode())); + BigDecimal reduce = waitAuditList.stream().map(WithdrawalRequests::getWithdrawalAmount).reduce(BigDecimal.ZERO, BigDecimal::add); + WalletVO walletVO = new WalletVO(); + BigDecimal balance = appUser.getBalance(); + walletVO.setCommissionAmount(commissionAmount); walletVO.setWithdrawalAmount(appUser.getWithdrawableAmount()); - walletVO.setWithdrawnAmount(appUser.getWithdrawnAmount()); + walletVO.setWithdrawnAmount(appUser.getWithdrawnAmount().subtract(reduce)); walletVO.setVipWithdrawalMinAmount(data.getVipWithdrawalMinAmount()); walletVO.setTotalRechargeAmount(appUser.getTotalRechargeAmount()); walletVO.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount()); walletVO.setTotalDistributionAmount(appUser.getTotalDistributionAmount()); - walletVO.setAuditAmount(waitAuditList.stream() - .map(WithdrawalRequests::getWithdrawalAmount) - .reduce(BigDecimal.ZERO, BigDecimal::add)); - walletVO.setBalance(appUser.getBalance()); + walletVO.setAuditAmount(reduce); + walletVO.setBalance(balance); return walletVO; } + + } -- Gitblit v1.7.1