mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-17 16:28:41 +08:00
update 会员累计充值金额
This commit is contained in:
@@ -337,16 +337,14 @@ public class MemberService {
|
|||||||
// 用户未注册小程序
|
// 用户未注册小程序
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_AUTHENTICATION_ERROR);
|
throw new BusinessException(ReturnCodeEnum.CODE_AUTHENTICATION_ERROR);
|
||||||
}
|
}
|
||||||
// 本金
|
// 本金 sql处理为空返回0
|
||||||
BigDecimal principalBalance = memberWalletVO.getPrincipalBalance();
|
vo.setPrincipalBalance(memberWalletVO.getPrincipalBalance());
|
||||||
vo.setPrincipalBalance(principalBalance);
|
// 赠金 sql处理为空返回0
|
||||||
// 赠金
|
vo.setGiftBalance(memberWalletVO.getGiftBalance());
|
||||||
BigDecimal giftBalance = memberWalletVO.getGiftBalance();
|
|
||||||
vo.setGiftBalance(giftBalance);
|
|
||||||
// 当前余额
|
// 当前余额
|
||||||
vo.setCurrentBalance(principalBalance.add(giftBalance));
|
vo.setCurrentBalance(vo.getPrincipalBalance().add(vo.getGiftBalance()));
|
||||||
// 累计充值金额
|
// 累计充值本金
|
||||||
vo.setAccumulatedRechargeAmount(memberWalletVO.getAccumulatedRechargeAmount());
|
vo.setAccumulatedRechargePrincipal(memberWalletVO.getAccumulatedRechargePrincipal());
|
||||||
// 累计赠送金额
|
// 累计赠送金额
|
||||||
vo.setAccumulatedRechargeGift(memberWalletVO.getAccumulatedRechargeGift());
|
vo.setAccumulatedRechargeGift(memberWalletVO.getAccumulatedRechargeGift());
|
||||||
// 累计消费金额
|
// 累计消费金额
|
||||||
|
|||||||
@@ -95,12 +95,15 @@ public class MemberWalletInfoServiceImpl implements MemberWalletInfoService {
|
|||||||
@Override
|
@Override
|
||||||
public MemberWalletVO selectMemberWalletInfo(String walletCode) {
|
public MemberWalletVO selectMemberWalletInfo(String walletCode) {
|
||||||
MemberWalletVO memberWalletVO = memberWalletInfoMapper.selectMemberWalletInfo(walletCode);
|
MemberWalletVO memberWalletVO = memberWalletInfoMapper.selectMemberWalletInfo(walletCode);
|
||||||
|
// 总充值金额 = 累计本金充值 + 累计赠送金额
|
||||||
|
memberWalletVO.setTotalRechargeAmount(memberWalletVO.getAccumulatedRechargePrincipal().add(memberWalletVO.getAccumulatedRechargeGift()));
|
||||||
|
|
||||||
// 累计消费金额 = 累计充值 + 累计赠送 - 本金余额 - 赠送金余额
|
// 累计消费金额 = 累计充值 + 累计赠送 - 本金余额 - 赠送金余额
|
||||||
BigDecimal accumulatedConsumptionAmount = memberWalletVO.getAccumulatedRechargeAmount()
|
BigDecimal accumulatedConsumptionAmount = memberWalletVO.getTotalRechargeAmount()
|
||||||
.add(memberWalletVO.getAccumulatedRechargeGift())
|
|
||||||
.subtract(memberWalletVO.getPrincipalBalance())
|
.subtract(memberWalletVO.getPrincipalBalance())
|
||||||
.subtract(memberWalletVO.getGiftBalance());
|
.subtract(memberWalletVO.getGiftBalance());
|
||||||
memberWalletVO.setAccumulatedConsumptionAmount(accumulatedConsumptionAmount);
|
memberWalletVO.setAccumulatedConsumptionAmount(accumulatedConsumptionAmount);
|
||||||
|
|
||||||
return memberWalletVO;
|
return memberWalletVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,13 +46,18 @@ public class MemberWalletVO {
|
|||||||
/**
|
/**
|
||||||
* 累计本金充值
|
* 累计本金充值
|
||||||
*/
|
*/
|
||||||
private BigDecimal accumulatedRechargeAmount;
|
private BigDecimal accumulatedRechargePrincipal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 累计赠送金额
|
* 累计赠送金额
|
||||||
*/
|
*/
|
||||||
private BigDecimal accumulatedRechargeGift;
|
private BigDecimal accumulatedRechargeGift;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总充值金额 = 累计本金充值 + 累计赠送金额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalRechargeAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 累计消费
|
* 累计消费
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ public class MemberWalletInfoVO {
|
|||||||
private BigDecimal giftBalance;
|
private BigDecimal giftBalance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 累计充值
|
* 累计充值本金
|
||||||
*/
|
*/
|
||||||
private BigDecimal accumulatedRechargeAmount;
|
private BigDecimal accumulatedRechargePrincipal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 累计赠送金额
|
* 累计赠送金额
|
||||||
|
|||||||
@@ -203,15 +203,15 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMemberWalletInfo" resultType="com.jsowell.pile.vo.base.MemberWalletVO">
|
<select id="selectMemberWalletInfo" resultType="com.jsowell.pile.vo.base.MemberWalletVO">
|
||||||
SELECT t1.member_id as memberId,
|
SELECT t1.member_id as memberId,
|
||||||
t1.wallet_code as walletCode,
|
t1.wallet_code as walletCode,
|
||||||
t1.merchant_id as merchantId,
|
t1.merchant_id as merchantId,
|
||||||
ifnull(t1.principal_balance, 0) as principalBalance,
|
ifnull(t1.principal_balance, 0) as principalBalance,
|
||||||
ifnull(t1.gift_balance, 0) as giftBalance,
|
ifnull(t1.gift_balance, 0) as giftBalance,
|
||||||
ifnull(t2.accumulatedRechargeAmount, 0) as accumulatedRechargeAmount,
|
ifnull(t2.accumulatedRechargePrincipal, 0) as accumulatedRechargePrincipal,
|
||||||
ifnull(t3.accumulatedRechargeGift, 0) as accumulatedRechargeGift
|
ifnull(t3.accumulatedRechargeGift, 0) as accumulatedRechargeGift
|
||||||
from member_wallet_info t1
|
from member_wallet_info t1
|
||||||
left join (select wallet_code, sum(amount) as accumulatedRechargeAmount
|
left join (select wallet_code, sum(amount) as accumulatedRechargePrincipal
|
||||||
from `member_wallet_log`
|
from `member_wallet_log`
|
||||||
WHERE `wallet_code` = #{walletCode,jdbcType=VARCHAR}
|
WHERE `wallet_code` = #{walletCode,jdbcType=VARCHAR}
|
||||||
and type = '1'
|
and type = '1'
|
||||||
|
|||||||
Reference in New Issue
Block a user