From 74e6993aee71c84dce965bdd6428b0cff5bda57f Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 08 Dec 2022 17:58:30 +0800
Subject: [PATCH] 20221130

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/ApiIgtOnHookPlanServiceImpl.java |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/ApiIgtOnHookPlanServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/ApiIgtOnHookPlanServiceImpl.java
index 5e7f173..d728856 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/ApiIgtOnHookPlanServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/ApiIgtOnHookPlanServiceImpl.java
@@ -178,6 +178,12 @@
         if(multiply.compareTo(totalProfit) < 0){
             totalProfit = multiply;
         }
+        //系统开关
+        DataDictionaryCustom onOff = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.ON_OFF.getType(), DataDictionaryEnum.ON_OFF.getCode());
+        String onOffStr = onOff.getValue() == null ? "OFF":onOff.getValue();
+        if("ON".equals(onOffStr)){
+            totalProfit = BigDecimal.ZERO;
+        }
 
         String refererIds = dappMemberEntity.getRefererIds();
         List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true);
@@ -209,10 +215,12 @@
         }
         //生成流水佣金和盈利分成和流水记录,返回剩余盈利
         BigDecimal profitSharingTotal = dappWalletService.updateLSYJ(refererIdLisstUp, totalProfit,igtOnHookPlanOrder.getId());
-        BigDecimal profitFlowTotal = dappWalletService.updateYLFC(refererIdLisstUp, totalProfit,igtOnHookPlanOrder.getId());
+//        BigDecimal profitFlowTotal = dappWalletService.updateYLFC(refererIdLisstUp, totalProfit,igtOnHookPlanOrder.getId());
+        BigDecimal profitFlowTotal = dappWalletService.updateYLFC(refererIdLisstUp, planAmount,igtOnHookPlanOrder.getId());
         //平台分成
         //平台拿走35%盈利分成和流水佣金剩下的全部
-        BigDecimal systemAdd = totalProfit.multiply(new BigDecimal(0.4)).subtract(profitSharingTotal).subtract(profitFlowTotal);
+//        BigDecimal systemAdd = totalProfit.multiply(new BigDecimal(0.4)).subtract(profitSharingTotal).subtract(profitFlowTotal);
+        BigDecimal systemAdd = totalProfit.multiply(new BigDecimal(0.4)).subtract(profitSharingTotal);
         BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,systemAdd,igtOnHookPlanOrder.getId());
         //个人固定拿走60%
         totalProfit = totalProfit.multiply(new BigDecimal(0.6));
@@ -220,6 +228,10 @@
         igtOnHookPlanOrderDao.updateById(igtOnHookPlanOrder);
 
         BigDecimal totalMoney = planAmount.add(totalProfit);
+
+        if("ON".equals(onOffStr)){
+            totalMoney = BigDecimal.ZERO;
+        }
         DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId);
         dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntity.getId(),totalMoney);
 
@@ -572,6 +584,12 @@
         if(multiply.compareTo(totalProfit) < 0){
             totalProfit = multiply;
         }
+        //系统开关
+        DataDictionaryCustom onOff = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.ON_OFF.getType(), DataDictionaryEnum.ON_OFF.getCode());
+        String onOffStr = onOff.getValue() == null ? "OFF":onOff.getValue();
+        if("ON".equals(onOffStr)){
+            totalProfit = BigDecimal.ZERO;
+        }
 
 //        BigDecimal totalProfit = planAmount.multiply(hangingRevenueLevel).setScale(4,BigDecimal.ROUND_DOWN);
 
@@ -605,10 +623,12 @@
         }
         //生成流水佣金和盈利分成和流水记录,返回剩余盈利
         BigDecimal profitSharingTotal = dappWalletService.updateLSYJ(refererIdLisstUp, totalProfit,igtOnHookPlanOrder.getId());
-        BigDecimal profitFlowTotal = dappWalletService.updateYLFC(refererIdLisstUp, totalProfit,igtOnHookPlanOrder.getId());
+//        BigDecimal profitFlowTotal = dappWalletService.updateYLFC(refererIdLisstUp, totalProfit,igtOnHookPlanOrder.getId());
+        BigDecimal profitFlowTotal = dappWalletService.updateYLFC(refererIdLisstUp, planAmount,igtOnHookPlanOrder.getId());
         //平台分成
         //平台拿走40% - 盈利分成和流水佣金剩下的全部
-        BigDecimal systemAdd = totalProfit.multiply(new BigDecimal(0.4)).subtract(profitSharingTotal).subtract(profitFlowTotal);
+//        BigDecimal systemAdd = totalProfit.multiply(new BigDecimal(0.4)).subtract(profitSharingTotal).subtract(profitFlowTotal);
+        BigDecimal systemAdd = totalProfit.multiply(new BigDecimal(0.4)).subtract(profitSharingTotal);
         BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,systemAdd,igtOnHookPlanOrder.getId());
         //个人固定拿走60%
         totalProfit = totalProfit.multiply(new BigDecimal(0.6));
@@ -621,6 +641,9 @@
         dappMemberEntity.setIsOnHook(3);
         dappMemberDao.updateById(dappMemberEntity);
 
+        if("ON".equals(onOffStr)){
+            totalMoney = BigDecimal.ZERO;
+        }
         DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId);
         BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount();
         dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntity.getId(),totalMoney);

--
Gitblit v1.9.1