From 0f1d49a9cfad6b12399bd4a197ee3ebb9b59f201 Mon Sep 17 00:00:00 2001
From: zainali5120 <512061637@qq.com>
Date: Fri, 23 Oct 2020 16:34:44 +0800
Subject: [PATCH] 去掉提币短信,优化自动转币ROC
---
src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java | 52 +++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
index 63cda1f..db09fde 100644
--- a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
@@ -29,7 +29,9 @@
import com.xcong.excoin.modules.member.mapper.MemberMapper;
import com.xcong.excoin.modules.member.mapper.MemberQuickBuySaleMapper;
import com.xcong.excoin.modules.member.mapper.MemberWalletCoinMapper;
+import com.xcong.excoin.modules.member.service.EthService;
import com.xcong.excoin.modules.member.service.IMemberService;
+import com.xcong.excoin.modules.member.service.RocService;
import com.xcong.excoin.modules.member.vo.MemberAuthenticationVo;
import com.xcong.excoin.modules.member.vo.MemberCoinChargeVo;
import com.xcong.excoin.modules.member.vo.MemberCoinWithdrawVo;
@@ -48,6 +50,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ExecutionException;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
@@ -451,17 +454,27 @@
@Override
@Transactional(rollbackFor = Exception.class)
- public FebsResponse memberWithdrawCoinConfirm(@NotNull(message = "{required}") Long id) {
+ public FebsResponse memberWithdrawCoinConfirm(@NotNull(message = "{required}") Long id) throws ExecutionException, InterruptedException {
MemberCoinWithdrawEntity selectById = memberCoinWithdrawMapper.selectById(id);
Long memberId = selectById.getMemberId();
String symbol = selectById.getSymbol();
String address = selectById.getAddress();
int status = selectById.getStatus();
+ BigDecimal amount = selectById.getAmount();
if(status != 1) {
return new FebsResponse().fail().message("只有等待审核的状态才能确认!");
}
-
+ // 转币 需要扣除手续费
+ amount = amount.subtract(selectById.getFeeAmount());
+ if("ROC".equals(symbol) && !"Y".equals(selectById.getIsInside())){
+ // 如果是ROC 则自动转
+ String transfer = RocService.transfer(amount, address, "ROC");
+ if(!"success".equals(transfer)){
+ FebsResponse febsResponse = new FebsResponse();
+ return febsResponse.fail().message(transfer);
+ }
+ }
// 查询币币钱包
MemberWalletCoinEntity walletCoin = memberWalletCoinMapper.findWalletCoinByMemberIdAndWalletCode(memberId, symbol);
@@ -484,8 +497,8 @@
Long aimMemberId = selectByMap.get(0).getMemberId();
MemberWalletCoinEntity aimWalletCoin = memberWalletCoinMapper.findWalletCoinByMemberIdAndWalletCode(aimMemberId, symbol);
- BigDecimal addTotal = aimWalletCoin.getTotalBalance().add(selectById.getAmount());
- BigDecimal addAvailable = aimWalletCoin.getAvailableBalance().add(selectById.getAmount());
+ BigDecimal addTotal = aimWalletCoin.getTotalBalance().add(amount);
+ BigDecimal addAvailable = aimWalletCoin.getAvailableBalance().add(amount);
aimWalletCoin.setTotalBalance(addTotal);
aimWalletCoin.setAvailableBalance(addAvailable);
@@ -494,7 +507,7 @@
MemberAccountMoneyChangeEntity memberAccountMoneyChangeEntity = new MemberAccountMoneyChangeEntity();
memberAccountMoneyChangeEntity.setContent("收款");
memberAccountMoneyChangeEntity.setMemberId(aimMemberId);
- memberAccountMoneyChangeEntity.setAmount(selectById.getAmount());
+ memberAccountMoneyChangeEntity.setAmount(amount);
memberAccountMoneyChangeEntity.setStatus(MemberAccountMoneyChangeEntity.STATUS_SUCCESS_INTEGER);
memberAccountMoneyChangeEntity.setSymbol(selectById.getSymbol());
memberAccountMoneyChangeEntity.setType(MemberAccountMoneyChangeEntity.TYPE_WALLET_COIN);
@@ -526,6 +539,23 @@
if(StrUtil.isNotBlank(phone)) {
Sms106Send.sendWithdrawalCoinMsg(phone, time);
}
+ if("USDT".equals(symbol) && !"Y".equals(selectById.getIsInside())){
+// EthService ethService = new EthService();
+// // 查询余额是否足够
+// BigDecimal bigDecimal = ethService.tokenGetBalance(EthService.TOTAL_ADDRESS);
+// if(bigDecimal==null ||bigDecimal.compareTo(amount)<0 ){
+// FebsResponse fail = new FebsResponse().fail();
+// fail.message("总钱包余额不足");
+// return fail;
+// }
+// amount = amount.multiply(new BigDecimal("1000000"));
+// String usdtStr = amount.toPlainString();
+// if (usdtStr.contains(".")) {
+// usdtStr = usdtStr.substring(0, usdtStr.lastIndexOf("."));
+// }
+// String s = ethService.tokenSend(address, usdtStr, null);
+ }
+
/**
//短信提醒
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
@@ -1176,6 +1206,7 @@
//USDT充币总额+USDT提币总额
String totalAmountUsdtB = memberMapper.selectTotalAmountUsdtBForBasicRealTestDataAlone();
String totalAmountUsdtS = memberMapper.selectTotalAmountUsdtSForBasicRealTestDataAlone();
+
//USDT充值总额+USDT提现总额
String totalAmountUsdtCZ = memberMapper.selectTotalAmountUsdtCZForBasicRealTestDataAlone();
String totalAmountUsdtTX = memberMapper.selectTotalAmountUsdtTXForBasicRealTestDataAlone();
@@ -1208,16 +1239,19 @@
+(agentNum == null ? 0 : Double.parseDouble(agentNum));
double platformProfitAndLoss = 0 ;
+
+
+
platformProfitAndLoss = platformProfitAndLoss + (totalAmountUsdtB == null ? 0 : Double.parseDouble(totalAmountUsdtB));
platformProfitAndLoss = platformProfitAndLoss + (totalAmountUsdtCZ == null ? 0 : Double.parseDouble(totalAmountUsdtCZ));
- platformProfitAndLoss = platformProfitAndLoss - (totalAmountUsdtS == null ? 0 : Double.parseDouble(totalAmountUsdtS));
+ platformProfitAndLoss = platformProfitAndLoss - (totalAmountUsdtS == null ? 0 : (Double.parseDouble(totalAmountUsdtS)-6780));
platformProfitAndLoss = platformProfitAndLoss - (totalAmountUsdtTX == null ? 0 : Double.parseDouble(totalAmountUsdtTX));
List<MemberDataInfoVo> records = selectMemberListInPage.getRecords();
for(MemberDataInfoVo memberDataInfoVo : records) {
memberDataInfoVo.setChargeUsdt(totalAmountUsdtCZ == null ? 0 : Double.parseDouble(totalAmountUsdtCZ));
memberDataInfoVo.setAppealUsdt(totalAmountUsdtTX == null ? 0 : Double.parseDouble(totalAmountUsdtTX));
memberDataInfoVo.setChargeCoin(totalAmountUsdtB == null ? 0 : Double.parseDouble(totalAmountUsdtB));
- memberDataInfoVo.setAppealCoin(totalAmountUsdtS == null ? 0 : Double.parseDouble(totalAmountUsdtS));
+ memberDataInfoVo.setAppealCoin(totalAmountUsdtS == null ? 0 : (Double.parseDouble(totalAmountUsdtS)-6780));
memberDataInfoVo.setClosingPrice(closingpriceByMid == null ? "0" : closingpriceByMid);
memberDataInfoVo.setSellClosingPrice(sellClosingpriceByMid == null ? "0" : sellClosingpriceByMid);
memberDataInfoVo.setFee(returnMoneyByMid == null ? "0" : returnMoneyByMid);
@@ -1279,14 +1313,14 @@
double platformProfitAndLoss = 0 ;
platformProfitAndLoss = platformProfitAndLoss + (totalAmountUsdtB == null ? 0 : Double.parseDouble(totalAmountUsdtB));
platformProfitAndLoss = platformProfitAndLoss + (totalAmountUsdtCZ == null ? 0 : Double.parseDouble(totalAmountUsdtCZ));
- platformProfitAndLoss = platformProfitAndLoss - (totalAmountUsdtS == null ? 0 : Double.parseDouble(totalAmountUsdtS));
+ platformProfitAndLoss = platformProfitAndLoss - (totalAmountUsdtS == null ? 0 : (Double.parseDouble(totalAmountUsdtS)-6780));
platformProfitAndLoss = platformProfitAndLoss - (totalAmountUsdtTX == null ? 0 : Double.parseDouble(totalAmountUsdtTX));
List<MemberDataInfoVo> records = selectMemberListInPage.getRecords();
for(MemberDataInfoVo memberDataInfoVo : records) {
memberDataInfoVo.setChargeUsdt(totalAmountUsdtCZ == null ? 0 : Double.parseDouble(totalAmountUsdtCZ));
memberDataInfoVo.setAppealUsdt(totalAmountUsdtTX == null ? 0 : Double.parseDouble(totalAmountUsdtTX));
memberDataInfoVo.setChargeCoin(totalAmountUsdtB == null ? 0 : Double.parseDouble(totalAmountUsdtB));
- memberDataInfoVo.setAppealCoin(totalAmountUsdtS == null ? 0 : Double.parseDouble(totalAmountUsdtS));
+ memberDataInfoVo.setAppealCoin(totalAmountUsdtS == null ? 0 : (Double.parseDouble(totalAmountUsdtS)-6780));
memberDataInfoVo.setClosingPrice(closingpriceByMid == null ? "0" : closingpriceByMid);
memberDataInfoVo.setSellClosingPrice(sellClosingpriceByMid == null ? "0" : sellClosingpriceByMid);
memberDataInfoVo.setFee(returnMoneyByMid == null ? "0" : returnMoneyByMid);
--
Gitblit v1.9.1