mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-01 00:20:03 +08:00
update 获取累计充值金额
This commit is contained in:
@@ -23,4 +23,6 @@ public interface MemberWalletInfoService {
|
||||
int updateByPrimaryKey(MemberWalletInfo record);
|
||||
|
||||
List<MemberWalletVO> selectByMemberWalletList(String memberId);
|
||||
|
||||
MemberWalletVO selectMemberWalletInfo(String walletCode);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -86,8 +87,21 @@ public class MemberWalletInfoServiceImpl implements MemberWalletInfoService {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询会员钱包信息
|
||||
* @param walletCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MemberWalletVO selectMemberWalletInfo(String walletCode) {
|
||||
return memberWalletInfoMapper.selectMemberWalletInfo(walletCode);
|
||||
MemberWalletVO memberWalletVO = memberWalletInfoMapper.selectMemberWalletInfo(walletCode);
|
||||
// 累计消费金额 = 累计充值 + 累计赠送 - 本金余额 - 赠送金余额
|
||||
BigDecimal accumulatedConsumptionAmount = memberWalletVO.getAccumulatedRechargeAmount()
|
||||
.add(memberWalletVO.getAccumulatedRechargeAmount())
|
||||
.subtract(memberWalletVO.getPrincipalBalance())
|
||||
.subtract(memberWalletVO.getGiftBalance());
|
||||
memberWalletVO.setAccumulatedConsumptionAmount(accumulatedConsumptionAmount);
|
||||
return memberWalletVO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,11 @@ public class MemberWalletInfoVO {
|
||||
*/
|
||||
private BigDecimal accumulatedRechargeAmount;
|
||||
|
||||
/**
|
||||
* 累计赠送金额
|
||||
*/
|
||||
private BigDecimal accumulatedRechargeGift;
|
||||
|
||||
/**
|
||||
* 累计消费
|
||||
*/
|
||||
|
||||
@@ -203,6 +203,24 @@
|
||||
</select>
|
||||
|
||||
<select id="selectMemberWalletInfo" resultType="com.jsowell.pile.vo.base.MemberWalletVO">
|
||||
|
||||
SELECT t1.member_id as memberId,
|
||||
t1.wallet_code as walletCode,
|
||||
t1.merchant_id as merchantId,
|
||||
t1.principal_balance as principalBalance,
|
||||
t1.gift_balance as giftBalance,
|
||||
t2.accumulatedRechargeAmount as accumulatedRechargeAmount,
|
||||
t3.accumulatedRechargeGift as accumulatedRechargeGift
|
||||
from member_wallet_info t1
|
||||
left join (select wallet_code, sum(amount) as accumulatedRechargeAmount
|
||||
from `member_wallet_log`
|
||||
WHERE `wallet_code` = #{walletCode,jdbcType=VARCHAR}
|
||||
and type = '1'
|
||||
and sub_type = '10') t2 on t2.wallet_code = t1.wallet_code
|
||||
left join (select wallet_code, sum(amount) as accumulatedRechargeGift
|
||||
from `member_wallet_log`
|
||||
WHERE `wallet_code` = #{walletCode,jdbcType=VARCHAR}
|
||||
and type = '1'
|
||||
and sub_type = '11') t3 on t3.wallet_code = t1.wallet_code
|
||||
where t1.wallet_code = #{walletCode,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user