From 11f6a8c911c5ef241f42953976661a249aa8b83e Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 08 Aug 2023 17:18:58 +0800
Subject: [PATCH] 数据修改
---
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java | 114 +++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 79 insertions(+), 35 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 79825a1..51255f0 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;
@@ -64,7 +65,6 @@
private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
private final DappSystemProfitDao dappSystemProfitDao;
private final ChainProducer chainProducer;
- private final ContractMain contractMain;
private final DappMemberNodeMapper dappMemberNodeMapper;
private final DappChargeUsdtMapper dappChargeUsdtMapper;
@@ -1092,15 +1092,6 @@
dappFundFlowDao.updateById(dappFundFlowEntity);
}
-// public static void main(String[] args) {
-// String address = "0x7a9bfE048d110EF90a467803653f9B8666f9096C";
-// /**
-// * 发起USDT转账
-// */
-// String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, new BigDecimal("0.99"));
-// System.out.println(hash);
-// }
-
@Override
public void AntACoinBPollInMsg(Long id) {
log.info("{}",id);
@@ -1679,10 +1670,12 @@
* 发起USDT转账
*/
log.info("amount:{},address:{}",amount,address);
+ 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);
- String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount);
+ String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transfer(address, amount);
if(StrUtil.isEmpty(hash)){
-// hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transfer(address, amount);
return;
}
// if(StrUtil.isEmpty(hash)){
@@ -1697,17 +1690,14 @@
/**
* 紧急提现方法
*/
- 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 = "0xA60AaC0da34C76F3f60207ee09e9F75043319ab4";
+//
+// String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount);
+//
+// System.out.println(hash);
+// }
@Override
public void aCoinFire() {
@@ -1752,7 +1742,7 @@
PoolEnum.COIN_A_CNT.getType(),
PoolEnum.COIN_A_CNT.getCode());
BigDecimal coinACnt = new BigDecimal(coinACntDic.getValue());
- coinACnt = coinACnt.subtract(totalCnt);
+ coinACnt = coinACnt.subtract(totalCnt.multiply(new BigDecimal(0.65)));
coinACntDic.setValue(coinACnt.toString());
dataDictionaryCustomMapper.updateById(coinACntDic);
@@ -2145,6 +2135,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 +2173,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 +2233,11 @@
* 发送消息处理代理升级
*/
chainProducer.sendAntMemberLevelMsg(memberId);
+ //90%进入A币底池
+ chainProducer.sendAntACoinInAPoolMsg(fundFlowToA.getId());
+ ThreadUtil.sleep(5000);
+ //10%进入B币LP薄饼底池
+ chainProducer.sendAntACoinInBPoolMsg(fundFlowToB.getId());
}
@Override
@@ -2200,6 +2250,10 @@
return;
}
if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE != dappFundFlowEntity.getStatus()){
+ return;
+ }
+
+ if(FundFlowEnum.BUY_A_COIN.getCode() != dappFundFlowEntity.getType()){
return;
}
Long memberId = dappFundFlowEntity.getMemberId();
@@ -2304,7 +2358,7 @@
);
//A币金本位底池-usdt数量
BigDecimal coinAUsdtPriceDicCnt = new BigDecimal(coinAUsdtPriceDic.getValue());
- coinAUsdtPriceDicCnt = coinAUsdtPriceDicCnt.add(amount);
+ coinAUsdtPriceDicCnt = coinAUsdtPriceDicCnt.add(amount.multiply(new BigDecimal(0.8)));
coinAUsdtPriceDic.setValue(coinAUsdtPriceDicCnt.toString());
dataDictionaryCustomMapper.updateById(coinAUsdtPriceDic);
@@ -2533,16 +2587,6 @@
dappMemberDao.updateMemberActiveStatus(1,memberId);
}
-
- /**
- * 测试转账
- * @param args
- */
-// public static void main(String[] args) {
-// String transfer = ChainService.getInstance(ChainEnum.BSC_USDT_A_POOL.name()).transfer("0x74fC0e035f315F7BD8b7686e22581AB1afC45e97", new BigDecimal(1));
-// System.out.println(transfer);
-//
-// }
/**
* 生成当前分钟的k线数据,type为0
--
Gitblit v1.9.1