From 6aad85204b92b3092a09dda58e17cea316d21e28 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Thu, 01 Feb 2024 16:23:58 +0800
Subject: [PATCH] 会员列表增加波卷功能

---
 src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java |   39 +++++++++++++++++++++------------------
 1 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java
index dc5377d..0171700 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java
@@ -1115,6 +1115,18 @@
     public void fcmNFTExchangeMsg(String cnt) {
         //销毁数量
         BigDecimal destoryCnt = new BigDecimal(cnt);
+        //更新总销毁数量
+        DataDictionaryCustom fcmDestoryTotalDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+                DataDictionaryEnum.FCM_DESTORY_TOTAL.getType(),
+                DataDictionaryEnum.FCM_DESTORY_TOTAL.getCode()
+        );
+        BigDecimal fcmDestoryTotal = new BigDecimal(fcmDestoryTotalDic.getValue());
+        fcmDestoryTotal = fcmDestoryTotal.add(destoryCnt);
+        commonService.updateDataDic(
+                DataDictionaryEnum.FCM_DESTORY_TOTAL.getType(),
+                DataDictionaryEnum.FCM_DESTORY_TOTAL.getCode(),
+                fcmDestoryTotal.toString());
+
         DataDictionaryCustom fcmDestoryCntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                 DataDictionaryEnum.FCM_DESTORY_CNT.getType(),
                 DataDictionaryEnum.FCM_DESTORY_CNT.getCode()
@@ -1129,8 +1141,8 @@
         BigDecimal divide = fcmDestoryCntAdd.divide(AppContants.FCM_BASIC, 0, BigDecimal.ROUND_DOWN);
         if(BigDecimal.ZERO.compareTo(divide) == 0){
             commonService.updateDataDic(
-                    DataDictionaryEnum.BANK_TRANS_URL.getType(),
-                    DataDictionaryEnum.BANK_TRANS_URL.getCode(),
+                    DataDictionaryEnum.FCM_DESTORY_CNT.getType(),
+                    DataDictionaryEnum.FCM_DESTORY_CNT.getCode(),
                     fcmDestoryCntAdd.toString());
         }
 
@@ -1141,18 +1153,6 @@
                     DataDictionaryEnum.FCM_DESTORY_CNT.getType(),
                     DataDictionaryEnum.FCM_DESTORY_CNT.getCode(),
                     fcmDestoryCntReal.toString());
-
-            //更新总销毁数量
-            DataDictionaryCustom fcmDestoryTotalDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-                    DataDictionaryEnum.FCM_DESTORY_TOTAL.getType(),
-                    DataDictionaryEnum.FCM_DESTORY_TOTAL.getCode()
-            );
-            BigDecimal fcmDestoryTotal = new BigDecimal(fcmDestoryTotalDic.getValue());
-            fcmDestoryTotal = fcmDestoryTotal.add(destoryCnt);
-            commonService.updateDataDic(
-                    DataDictionaryEnum.FCM_DESTORY_TOTAL.getType(),
-                    DataDictionaryEnum.FCM_DESTORY_TOTAL.getCode(),
-                    fcmDestoryTotal.toString());
             //更新价格
             DataDictionaryCustom fcmPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                     DataDictionaryEnum.FCM_PRICE.getType(),
@@ -1218,11 +1218,10 @@
             BigDecimal nftCntTotalBuy = mallProductBuyRecords.stream().map(MallProductBuyRecord::getPickNftCnt).reduce(BigDecimal.ZERO, BigDecimal::add);
             MallProductBuy mallProductBuy = mallProductBuyMapper.selectById(buyId);
             if(nftCntTotalBuy.compareTo(mallProductBuy.getNftTotal()) >= 0){
-                return;
+                mallProductBuy.setState(ProductEnum.PRODUCT_BUY_SUCCESS.getValue());
+                mallProductBuy.setPayTime(DateUtil.date());
+                mallProductBuyMapper.updateById(mallProductBuy);
             }
-            mallProductBuy.setState(ProductEnum.PRODUCT_BUY_SUCCESS.getValue());
-            mallProductBuy.setPayTime(DateUtil.date());
-            mallProductBuyMapper.updateById(mallProductBuy);
         }
     }
 
@@ -1240,6 +1239,10 @@
         MallProductBuy mallProductBuy = mallProductBuyMapper.selectById(mallProductBuyRecord.getBuyId());
         mallProductBuy.setNftAva(mallProductBuy.getNftAva().add(mallProductBuyRecord.getPickNftCnt()));
         mallProductBuyMapper.updateById(mallProductBuy);
+        Long memberId = mallProductBuy.getMemberId();
+        MallMember mallMember = mallMemberMapper.selectById(memberId);
+        mallMember.setIsFrozen(ProductEnum.MEMBER_FROZEN.getValue());
+        mallMemberMapper.updateById(mallMember);
         //更新卖单子表的数据
         MallProductSellRecord mallProductSellRecord = mallProductSellRecordMapper.selectById(sellRecordId);
         mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_FAIL.getValue());

--
Gitblit v1.9.1