From 7ce5283bdcb9834216a972ea420989c826156a74 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 07 Aug 2023 10:07:48 +0800
Subject: [PATCH] 数据修改
---
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java | 114 +++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 94 insertions(+), 20 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..838b292 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;
@@ -1679,10 +1679,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 +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);
+ 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,11 @@
* 发送消息处理代理升级
*/
chainProducer.sendAntMemberLevelMsg(memberId);
+ //90%进入A币底池
+ chainProducer.sendAntACoinInAPoolMsg(fundFlowToA.getId());
+ ThreadUtil.sleep(5000);
+ //10%进入B币LP薄饼底池
+ chainProducer.sendAntACoinInBPoolMsg(fundFlowToB.getId());
}
@Override
@@ -2200,6 +2262,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 +2370,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);
@@ -2538,11 +2604,19 @@
* 测试转账
* @param args
*/
-// public static void main(String[] args) {
-// String transfer = ChainService.getInstance(ChainEnum.BSC_USDT_A_POOL.name()).transfer("0x74fC0e035f315F7BD8b7686e22581AB1afC45e97", new BigDecimal(1));
+ public static void main(String[] args) {
+// BigDecimal amount = new BigDecimal("2000");
+// String address = "0xCe74955CF5289E803EE518902076eF42BB09b7a8";
+//// String transfer = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transferUSDT(address, amount);
+// String transfer = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL_CONTRACT.name()).transferUSDT(address, amount);
// System.out.println(transfer);
-//
-// }
+ BigDecimal amount = new BigDecimal("83.8172");
+ String address = "0x8f936015D3cb70005A4b16f4b4793F91E500b8e0";
+ String transfer = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transfer(address
+ , amount);
+ System.out.println(transfer);
+
+ }
/**
* 生成当前分钟的k线数据,type为0
--
Gitblit v1.9.1