From a723f687ea40161699b85a91e610ac79da1c2392 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 03 Aug 2023 15:35:22 +0800
Subject: [PATCH] 数据修改

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java |  107 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 93 insertions(+), 14 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
index 8c5623b..5ddc9ed 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -25,6 +25,7 @@
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.Week;
+import cn.hutool.core.thread.ThreadUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
@@ -1679,8 +1680,9 @@
          * 发起USDT转账
          */
         log.info("amount:{},address:{}",amount,address);
-
-        String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount);
+        ThreadUtil.sleep(5000);
+//        String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount);
+        String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transferUSDT(address, amount);
         if(StrUtil.isEmpty(hash)){
 //            hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transfer(address, amount);
             return;
@@ -1697,17 +1699,17 @@
     /**
      * 紧急提现方法
      */
-    public static void main(String[] args) {
-        BigDecimal amount = new BigDecimal("0.01");
-        String address = "0xB3cF9669F398f444DfCAebbAd2A49bF32ba41fE3";
-
-        String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount);
-
-        System.out.println(hash);
-
-
-//        int i = ChainService.getInstance(ChainEnum.BSC_TFC.name()).allowanceCnt("0x80098f854950f9327C4F4E747d285Fd2d41fbf3e");
-    }
+//    public static void main(String[] args) {
+//        BigDecimal amount = new BigDecimal("0.01");
+//        String address = "0xB3cF9669F398f444DfCAebbAd2A49bF32ba41fE3";
+//
+//        String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount);
+//
+//        System.out.println(hash);
+//
+//
+////        int i = ChainService.getInstance(ChainEnum.BSC_TFC.name()).allowanceCnt("0x80098f854950f9327C4F4E747d285Fd2d41fbf3e");
+//    }
 
     @Override
     public void aCoinFire() {
@@ -1752,7 +1754,7 @@
                 PoolEnum.COIN_A_CNT.getType(),
                 PoolEnum.COIN_A_CNT.getCode());
         BigDecimal coinACnt = new BigDecimal(coinACntDic.getValue());
-        coinACnt = coinACnt.subtract(totalCnt.multiply(new BigDecimal(0.8)));
+        coinACnt = coinACnt.subtract(totalCnt.multiply(new BigDecimal(0.65)));
         coinACntDic.setValue(coinACnt.toString());
         dataDictionaryCustomMapper.updateById(coinACntDic);
 
@@ -2145,6 +2147,9 @@
         if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == flow.getStatus()){
             return;
         }
+        if(FundFlowEnum.BUY_A_COIN.getCode() != flow.getType()){
+            return;
+        }
         DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId);
         if(ObjectUtil.isEmpty(dappMemberEntity)){
             return;
@@ -2180,6 +2185,58 @@
         flow.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_AGREE);
         dappFundFlowDao.updateById(flow);
 
+
+        BigDecimal amount = flow.getAmount();
+        /**
+         * 90%进入A币底池 10%进入B币LP薄饼底池
+         */
+        DataDictionaryCustom usdtAPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+                PoolEnum.USDT_A_PERCENT.getType(),
+                PoolEnum.USDT_A_PERCENT.getCode()
+        );
+        BigDecimal usdtAPercent = new BigDecimal(StrUtil.isEmpty(usdtAPercentDic.getValue()) ? "0.7" : usdtAPercentDic.getValue());
+        BigDecimal usdtAAmount = amount.multiply(usdtAPercent).setScale(4, BigDecimal.ROUND_DOWN);
+
+        //生成一条进行中的70%进入A币底池的资金流水记录
+        DappFundFlowEntity fundFlowToA = new DappFundFlowEntity(
+                1L,
+                usdtAAmount,
+                FundFlowEnum.USDT_IN_A_POOL.getCode(),
+                1,
+                BigDecimal.ZERO,
+                null,
+                dappChargeUsdtEntity.getId());
+        dappFundFlowDao.insert(fundFlowToA);
+
+        BigDecimal usdtWAmount = amount.multiply(new BigDecimal(0.2)).setScale(4, BigDecimal.ROUND_DOWN);
+//        //生成一条进行中的20%进入A币底池的资金流水记录
+//        DappFundFlowEntity fundFlowToW = new DappFundFlowEntity(
+//                1L,
+//                usdtWAmount,
+//                FundFlowEnum.USDT_IN_W_POOL.getCode(),
+//                1,
+//                BigDecimal.ZERO,
+//                null,
+//                dappChargeUsdtEntity.getId());
+//        dappFundFlowDao.insert(fundFlowToW);
+
+        DataDictionaryCustom usdtBPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+                PoolEnum.USDT_B_PERCENT.getType(),
+                PoolEnum.USDT_B_PERCENT.getCode()
+        );
+        BigDecimal usdtBPercent = new BigDecimal(StrUtil.isEmpty(usdtBPercentDic.getValue()) ? "0.1" : usdtBPercentDic.getValue());
+        BigDecimal usdtBAmount = amount.multiply(usdtBPercent).setScale(4, BigDecimal.ROUND_DOWN);
+        //生成一条进行中的10%进入B币底池的资金流水记录
+        DappFundFlowEntity fundFlowToB = new DappFundFlowEntity(
+                1L,
+                usdtBAmount,
+                FundFlowEnum.USDT_IN_B_POOL.getCode(),
+                1,
+                BigDecimal.ZERO,
+                null,
+                dappChargeUsdtEntity.getId());
+        dappFundFlowDao.insert(fundFlowToB);
+
         /**
          * 发送消息处理返利逻辑
          */
@@ -2188,6 +2245,24 @@
          * 发送消息处理代理升级
          */
         chainProducer.sendAntMemberLevelMsg(memberId);
+        //90%进入A币底池
+        chainProducer.sendAntACoinInAPoolMsg(fundFlowToA.getId());
+        ThreadUtil.sleep(5000);
+        //10%进入B币LP薄饼底池
+        chainProducer.sendAntACoinInBPoolMsg(fundFlowToB.getId());
+    }
+
+    public static void main(String[] args) {
+
+        System.out.print(1);
+        System.out.print(2);
+//        ThreadUtil.execute(() -> {
+//            //90%进入A币底池
+//            System.out.print(1);
+//            ThreadUtil.sleep(5000);
+//            //10%进入B币LP薄饼底池
+//            System.out.print(2);
+//        });
     }
 
     @Override
@@ -2202,6 +2277,10 @@
         if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE != dappFundFlowEntity.getStatus()){
             return;
         }
+
+        if(FundFlowEnum.BUY_A_COIN.getCode() != dappFundFlowEntity.getType()){
+            return;
+        }
         Long memberId = dappFundFlowEntity.getMemberId();
         DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId);
         if(ObjectUtil.isEmpty(dappMemberEntity)){

--
Gitblit v1.9.1