From 13e7349e643408a1d1cb6f820ae629400d0efa58 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 09 Dec 2022 09:38:18 +0800
Subject: [PATCH] 20221130

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/ApiIgtOnHookPlanServiceImpl.java |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 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..6c4b75f 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,13 @@
         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;
+            planAmount = BigDecimal.ZERO;
+        }
 
         String refererIds = dappMemberEntity.getRefererIds();
         List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true);
@@ -209,10 +216,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 +229,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 +585,13 @@
         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;
+            planAmount = BigDecimal.ZERO;
+        }
 
 //        BigDecimal totalProfit = planAmount.multiply(hangingRevenueLevel).setScale(4,BigDecimal.ROUND_DOWN);
 
@@ -605,10 +625,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 +643,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