From b6d1603cb25dfca500e4257b446e454c3e694669 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 11 Apr 2023 17:12:20 +0800
Subject: [PATCH] 后台修改

---
 src/main/java/cc/mrbird/febs/mall/vo/ApiScoreVoucherInfoVo.java                   |    5 +++++
 src/main/java/cc/mrbird/febs/mall/mapper/MallMemberWalletMapper.java              |    2 ++
 src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java |    8 +++++---
 src/main/resources/mapper/modules/MallMemberWalletMapper.xml                      |   11 +++++++++++
 src/main/java/cc/mrbird/febs/mall/service/impl/ScoreServiceImpl.java              |    5 ++++-
 src/main/java/cc/mrbird/febs/mall/entity/MallMemberWallet.java                    |    5 +++++
 src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java    |    2 +-
 7 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallMemberWallet.java b/src/main/java/cc/mrbird/febs/mall/entity/MallMemberWallet.java
index bf21ddc..dc39be3 100644
--- a/src/main/java/cc/mrbird/febs/mall/entity/MallMemberWallet.java
+++ b/src/main/java/cc/mrbird/febs/mall/entity/MallMemberWallet.java
@@ -55,6 +55,11 @@
     private BigDecimal voucherCnt;
 
     /**
+     * 凭证燃烧值数量
+     */
+    private BigDecimal voucherFireCnt;
+
+    /**
      * 凭证金额
      */
     private BigDecimal voucherAmount;
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberWalletMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberWalletMapper.java
index 54108b4..67bc322 100644
--- a/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberWalletMapper.java
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberWalletMapper.java
@@ -49,4 +49,6 @@
     List<MallMemberWallet> selectStar();
 
     void addVorCherAmountAndCntById(@Param("voucherAmount")BigDecimal voucherAmountAdd,@Param("voucherCnt")BigDecimal voucherCnt, @Param("id")Long id);
+
+    void addVorCherFireCntByMemberId(@Param("voucherFireCnt")BigDecimal voucherFireCnt, @Param("memberId")Long memberId);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
index 0fa3510..4890199 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -237,7 +237,7 @@
         }
         if(AppContants.MEMBER_WITHDRAW_VOUCHER.equals(mallMemberWithdraw.getRemark())){
             iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"balance");
-            iApiMallMemberWalletService.add(mallMemberWithdraw.getAmountFee(),mallMemberWithdraw.getMemberId(),"voucherCnt");
+            iApiMallMemberWalletService.add(mallMemberWithdraw.getAmountFee(),mallMemberWithdraw.getMemberId(),"voucherFireCnt");
         }
         if(AppContants.MEMBER_WITHDRAW_VOUCHER_AMOUNT.equals(mallMemberWithdraw.getRemark())){
             iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"voucherAmount");
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
index 1f3041f..ceb4d6c 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
@@ -109,12 +109,14 @@
                 BigDecimal voucherPercent = new BigDecimal(voucherPercentDic.getValue() == null ? "0" : voucherPercentDic.getValue()).multiply(new BigDecimal(0.01));
                 BigDecimal voucherPercentNeed = withdrawalDto.getAmount().multiply(voucherPercent).setScale(2,BigDecimal.ROUND_DOWN);
 
-                BigDecimal voucherCnt = wallet.getVoucherCnt();
-                if(voucherCnt.compareTo(voucherPercentNeed) < 0){
+//                BigDecimal voucherCnt = wallet.getVoucherCnt();
+                BigDecimal voucherFireCnt = wallet.getVoucherFireCnt();
+                if(voucherFireCnt.compareTo(voucherPercentNeed) < 0){
                     throw new FebsException("红豆不足");
                 }
 
-                walletService.reduce(voucherCntDto, memberId, "voucherCnt");
+//                walletService.reduce(voucherCntDto, memberId, "voucherCnt");
+                walletService.reduce(voucherCntDto, memberId, "voucherFireCnt");
                 serviceFee = voucherCntDto;
                 remark = AppContants.MEMBER_WITHDRAW_VOUCHER;
             }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ScoreServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ScoreServiceImpl.java
index 78626ce..ee22034 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ScoreServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ScoreServiceImpl.java
@@ -108,6 +108,7 @@
         MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(member.getId());
         apiScoreVoucherInfoVo.setVoucherCnt(mallMemberWallet.getVoucherCnt().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : mallMemberWallet.getVoucherCnt());
         apiScoreVoucherInfoVo.setVoucherAmount(mallMemberWallet.getVoucherAmount().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : mallMemberWallet.getVoucherAmount());
+        apiScoreVoucherInfoVo.setVoucherFireCnt(mallMemberWallet.getVoucherFireCnt().compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : mallMemberWallet.getVoucherFireCnt());
         DataDictionaryCustom scorePriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                 GreenScoreEnum.SCORE_PRICE.getType(),
                 GreenScoreEnum.SCORE_PRICE.getCode());
@@ -173,7 +174,9 @@
         scorePoolCntDic.setValue(scorePoolCnt.toString());
         dataDictionaryCustomMapper.updateById(scorePoolCntDic);
         //增加凭证数量
-        mallMemberWalletMapper.addVorCherCntByMemberId(voucherCnt,memberId);
+//        mallMemberWalletMapper.addVorCherCntByMemberId(voucherCnt,memberId);
+        //增加凭证燃烧值数量
+        mallMemberWalletMapper.addVorCherFireCntByMemberId(voucherCnt,memberId);
         //增加购买记录
         String voucherNo = MallUtils.getOrderNum("VB");
         MallScoreVoucher mallScoreVoucher = new MallScoreVoucher();
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ApiScoreVoucherInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ApiScoreVoucherInfoVo.java
index 9f1fd42..b963d24 100644
--- a/src/main/java/cc/mrbird/febs/mall/vo/ApiScoreVoucherInfoVo.java
+++ b/src/main/java/cc/mrbird/febs/mall/vo/ApiScoreVoucherInfoVo.java
@@ -13,6 +13,11 @@
 
     @ApiModelProperty(value = "绿色积分")
     private BigDecimal voucherCnt;
+    /**
+     * 数量
+     */
+    @ApiModelProperty(value = "燃烧值数量")
+    private BigDecimal voucherFireCnt;
 
     @ApiModelProperty(value = "现金元")
     private BigDecimal voucherAmount;
diff --git a/src/main/resources/mapper/modules/MallMemberWalletMapper.xml b/src/main/resources/mapper/modules/MallMemberWalletMapper.xml
index 82ffddc..189bcc1 100644
--- a/src/main/resources/mapper/modules/MallMemberWalletMapper.xml
+++ b/src/main/resources/mapper/modules/MallMemberWalletMapper.xml
@@ -51,6 +51,9 @@
         <if test="record.voucherCnt != null">
             , voucher_cnt = #{record.voucherCnt}
         </if>
+        <if test="record.voucherFireCnt != null">
+            , voucher_fire_cnt = #{record.voucherFireCnt}
+        </if>
         <if test="record.voucherAmount != null">
             , voucher_amount = #{record.voucherAmount}
         </if>
@@ -159,5 +162,13 @@
         WHERE id =  #{id}
     </update>
 
+    <update id="addVorCherFireCntByMemberId">
+        update mall_member_wallet
+        <set>
+            voucher_fire_cnt = voucher_fire_cnt + #{voucherFireCnt},
+        </set>
+        WHERE member_id =  #{memberId}
+    </update>
+
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1