From b52d29b99c0808b23a6f07bdc87db31e5ba11a31 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Mon, 13 May 2024 10:10:15 +0800
Subject: [PATCH] 新合约

---
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
index f20f10d..763df18 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
@@ -6,6 +6,7 @@
 import cc.mrbird.febs.common.enumerates.MoneyFlowTypeNewEnum;
 import cc.mrbird.febs.common.enumerates.ProductEnum;
 import cc.mrbird.febs.common.exception.FebsException;
+import cc.mrbird.febs.common.utils.AppContants;
 import cc.mrbird.febs.common.utils.LoginUserUtil;
 import cc.mrbird.febs.common.utils.MallUtils;
 import cc.mrbird.febs.mall.dto.*;
@@ -153,6 +154,8 @@
         mallProductBuy.setMateState(ProductEnum.PRODUCT_BUY_MATE_STATE_FAIL.getValue());
         mallProductBuy.setNftTotal(mallProductNft.getPriceNft());
         mallProductBuy.setNftAva(mallProductNft.getPriceNft());
+        mallProductBuy.setCycle(mallProductNft.getCycle());
+        mallProductBuy.setProfit(mallProductNft.getProfit());
 //        mallProductBuy.setNftAva(BigDecimal.ZERO);
         mallProductBuyMapper.insert(mallProductBuy);
         //令牌 可用减少,冻结增加
@@ -209,7 +212,7 @@
         DataDictionaryCustom fcmPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                 DataDictionaryEnum.FCM_PRICE.getType(),
                 DataDictionaryEnum.FCM_PRICE.getCode());
-        BigDecimal fcmPrice = ObjectUtil.isEmpty(fcmPriceDic) ? new BigDecimal(2) : new BigDecimal(fcmPriceDic.getValue());
+        BigDecimal fcmPrice = ObjectUtil.isEmpty(fcmPriceDic) ? new BigDecimal(8) : new BigDecimal(fcmPriceDic.getValue());
         //手续费
         DataDictionaryCustom outFcmFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                 DataDictionaryEnum.OUT_FCM_FEE.getType(),
@@ -573,6 +576,25 @@
         mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_CONFIRM.getValue());
         mallProductSellRecordMapper.updateById(mallProductSellRecord);
 
+        DataDictionaryCustom gsdInDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+                DataDictionaryEnum.FCM_GSD_IN.getType(),
+                DataDictionaryEnum.FCM_GSD_IN.getCode()
+        );
+        BigDecimal gsdInPercent = new BigDecimal(gsdInDic.getValue()).multiply(AppContants.BASIC_PERCENT);
+        BigDecimal gsdIn = gsdInPercent.multiply(mallProductSellRecord.getNftCnt()).setScale(2,BigDecimal.ROUND_DOWN);
+        MallMemberAmount mallMemberAmount = mallMemberAmountMapper.selectByMemberId(memberId);
+        mallMemberAmount.setGsd(mallMemberAmount.getGsd().add(gsdIn));
+        mallMemberAmountMapper.updateGsdById(mallMemberAmount);
+
+        iMallMoneyFlowService.addMoneyFlow(
+                memberId,
+                gsdIn,
+                MoneyFlowTypeNewEnum.NFT_TRANS_GFD.getValue(),
+                null,
+                mallMember.getId(),
+                FlowTypeNewEnum.GSD.getValue(),
+                MoneyFlowTypeNewEnum.NFT_TRANS_GFD.getDescrition());
+
         agentProducer.sendFcmOrderSellInsureMsg(sellRecordId);
         return new FebsResponse().success();
     }

--
Gitblit v1.9.1