From 5c53b4e1e7dc2bae956332a0dc446992725c80bb Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 14 Nov 2022 10:00:37 +0800
Subject: [PATCH] 20221114,内转改成不需要审核,通过mq处理
---
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java | 247 +++++++++++++++++++++++++++++++++----------------
1 files changed, 166 insertions(+), 81 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
index df77227..9885008 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -22,6 +22,7 @@
import cc.mrbird.febs.dapp.vo.ActiveNftListVo;
import cc.mrbird.febs.dapp.vo.ApiMemberWalletCoinVo;
import cc.mrbird.febs.dapp.vo.WalletInfoVo;
+import cc.mrbird.febs.rabbit.producer.UsdtUpdateProducer;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
@@ -69,6 +70,7 @@
private final MemberCoinWithdrawDao memberCoinWithdrawDao;
private final IgtOnHookPlanOrderItemDao igtOnHookPlanOrderItemdao;
private final DappBankDao dappBankDao;
+ private final UsdtUpdateProducer usdtUpdateProducer;
private final RedisTemplate<String, Object> redisTemplate;
@@ -538,8 +540,16 @@
}
- DappMemberEntity dappMemberEntityOut = LoginUserUtil.getAppUser();
- Long memberIdOut = dappMemberEntityOut.getId();
+// DappMemberEntity dappMemberEntityOut = LoginUserUtil.getAppUser();
+ Long memberIdOut = LoginUserUtil.getAppUser().getId();
+ //判断账户是否限制
+
+
+ DappMemberEntity dappMemberEntityOut = dappMemberDao.selectById(memberIdOut);
+ Integer withdrawAble = dappMemberEntityOut.getWithdrawAble();
+ if(2 == withdrawAble){
+ return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0017"));
+ }
//判断双方是否是会员
if(ObjectUtil.isEmpty(dappMemberEntityOut.getInviteId())){
return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_002"));
@@ -589,11 +599,11 @@
* 否则,计算收益占本金的比例。符合条件允许提现
*/
//获取用户的总收益
- BigDecimal totalProfitOut = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberIdOut,1,2);
+ BigDecimal totalProfitOut = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberIdOut,2);
if(balance.compareTo(totalProfitOut) > 0){
BigDecimal totalAmount = dappWalletCoinEntityOut.getTotalAmount();
//用户总收益率
- BigDecimal divide = totalProfitOut.divide(totalAmount);
+ BigDecimal divide = totalProfitOut.divide(totalAmount,4,BigDecimal.ROUND_DOWN);
//提现条件收益率
DataDictionaryCustom outAccountProfitDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode());
BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue());
@@ -623,6 +633,8 @@
memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_DOING);
memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_YES);
memberCoinWithdrawDao.insert(memberCoinWithdrawEntity);
+
+ usdtUpdateProducer.sendMemberCoinInside(memberCoinWithdrawEntity.getId());
return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
}
@@ -670,12 +682,24 @@
if(BigDecimal.ZERO.compareTo(balance) >= 0){
return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_001"));
}
+ DataDictionaryCustom withDrawDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WITHDRAW_MAX.getType()
+ , DataDictionaryEnum.WITHDRAW_MAX.getCode());
+ BigDecimal withDrawMax = withDrawDic.getValue() == null ? new BigDecimal("100") : new BigDecimal(withDrawDic.getValue());
+ if(withDrawMax.compareTo(balance) > 0){
+ return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_003"));
+ }
DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId);
BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount();
if(balance.compareTo(availableAmount) > 0){
return new FebsResponse().fail().message(MessageSourceUtils.getString("balance_err_002"));
}
+ DappMemberEntity dappMemberEntityOut = dappMemberDao.selectById(memberId);
+ //判断账户是否限制
+ Integer withdrawAble = dappMemberEntityOut.getWithdrawAble();
+ if(2 == withdrawAble){
+ return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0017"));
+ }
//验证资金密码
Boolean aBoolean = dappMemberService.validateTransferCode(apiTransferOutsideDto.getTransferCode(), memberId);
if(!aBoolean){
@@ -687,11 +711,11 @@
* 否则,计算收益占本金的比例。符合条件允许提现
*/
//获取用户的总收益
- BigDecimal totalProfit = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberId,1,2);
+ BigDecimal totalProfit = igtOnHookPlanOrderItemdao.selectTotalProfitByMemberIdAndStateAndIsgoal(memberId,2);
if(balance.compareTo(totalProfit) >= 0){
BigDecimal totalAmount = dappWalletCoinEntity.getTotalAmount();
//用户总收益率
- BigDecimal divide = totalProfit.divide(totalAmount);
+ BigDecimal divide = totalProfit.divide(totalAmount,4,BigDecimal.ROUND_DOWN);
//提现条件收益率
DataDictionaryCustom outAccountProfitDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode());
BigDecimal outAccountProfit = outAccountProfitDic.getValue() == null ? new BigDecimal("0.3") : new BigDecimal(outAccountProfitDic.getValue());
@@ -711,7 +735,7 @@
}
//余额减少冻结增加
- Integer count = dappWalletCoinDao.addFrozenAndDelAvailableById(memberId, balance);
+ Integer count = dappWalletCoinDao.addFrozenAndDelAvailableById(dappWalletCoinEntity.getId(), balance);
if(1 != count){
throw new FebsException(MessageSourceUtils.getString("balance_err_002"));
}
@@ -725,7 +749,7 @@
memberCoinWithdrawEntity.setFeeAmount(serviceFee);
if(1 == apiTransferOutsideDto.getType()){
DappBank dappBank = dappBankDao.selectBankListByMemberIdAndBankNo(memberId, address);
- memberCoinWithdrawEntity.setTag(dappBank.getCardCode()+"-银行卡");
+ memberCoinWithdrawEntity.setTag(dappBank.getMemberName()+"-银行卡");
memberCoinWithdrawEntity.setSymbol("$");
}else{
memberCoinWithdrawEntity.setTag("钱包");
@@ -866,19 +890,26 @@
return new FebsResponse().success().message(MessageSourceUtils.getString("Operation_001"));
}
@Override
- public BigDecimal updateLSYJYLFC(List<String> refererIdList,BigDecimal totalProfit) {
+ public BigDecimal updateLSYJYLFC(List<String> refererIdList,BigDecimal totalProfit,long id) {
//计算盈利分成
BigDecimal profitSharingTotal = BigDecimal.ZERO;
+ if(BigDecimal.ZERO.compareTo(totalProfit)>=0){
+ return profitSharingTotal;
+ }
if(CollUtil.isNotEmpty(refererIdList)){
String LEVEL_IB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_IB.getCode());
if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
BigDecimal multiply = totalProfit.multiply(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
DappMemberEntity dappMemberEntityLEVEL_IB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_IB);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_IB.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_IB.getId(), multiply, "盈利分成", 8);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_IB.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0){
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_IB.getId(),multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_IB.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply),"盈利分成", 8,id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_FIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_FIB.getCode());
if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
@@ -891,11 +922,15 @@
multiply = totalProfit.multiply(multiply);
DappMemberEntity dappMemberEntityLEVEL_FIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_FIB);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_FIB.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_FIB.getId(), multiply, "盈利分成", 8);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_FIB.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_FIB.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_FIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_CIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_CIB.getCode());
if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
@@ -909,11 +944,15 @@
}
multiply = totalProfit.multiply(multiply);
DappMemberEntity dappMemberEntityLEVEL_CIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_CIB);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_CIB.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_CIB.getId(), multiply, "盈利分成", 8);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_CIB.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_CIB.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_CIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_AIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_AIB.getCode());
if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
@@ -929,11 +968,15 @@
}
multiply = totalProfit.multiply(multiply);
DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_AIB.getId(), multiply, "盈利分成", 8);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_AIB.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_AIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_GIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GIB.getCode());
if(!DataDictionaryEnum.LEVEL_GIB.getCode().equals(LEVEL_GIB)){
@@ -951,11 +994,15 @@
}
multiply = totalProfit.multiply(multiply);
DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_GIB.getId(), multiply, "盈利分成", 8);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GIB.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_GIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_BP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_BP.getCode());
if(!DataDictionaryEnum.LEVEL_BP.getCode().equals(LEVEL_BP)){
@@ -975,11 +1022,15 @@
}
multiply = totalProfit.multiply(multiply);
DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_BP.getId(), multiply, "盈利分成", 8);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_BP.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_BP.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_SP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_SP.getCode());
if(!DataDictionaryEnum.LEVEL_SP.getCode().equals(LEVEL_SP)){
@@ -1001,11 +1052,15 @@
}
multiply = totalProfit.multiply(multiply);
DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_SP.getId(), multiply, "盈利分成", 8);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_SP.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_SP.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_GP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GP.getCode());
if(!DataDictionaryEnum.LEVEL_GP.getCode().equals(LEVEL_GP)){
@@ -1029,11 +1084,15 @@
}
multiply = totalProfit.multiply(multiply);
DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_GP.getId(), multiply, "盈利分成", 8);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GP.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_GP.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "盈利分成", 8, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
@@ -1045,11 +1104,15 @@
BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_AIB.getCode()));
DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_AIB.getId(), multiply, "流水佣金", 7);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_AIB.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_AIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "流水佣金", 7, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_GIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GIB.getCode());
@@ -1057,11 +1120,15 @@
BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_GIB.getCode()));
DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_GIB.getId(), multiply, "流水佣金", 7);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GIB.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_GIB.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "流水佣金", 7, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_BP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_BP.getCode());
@@ -1069,11 +1136,15 @@
BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_BP.getCode()));
DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_BP.getId(), multiply, "流水佣金", 7);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_BP.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_BP.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "流水佣金", 7, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_SP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_SP.getCode());
@@ -1081,11 +1152,15 @@
BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_SP.getCode()));
DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_SP.getId(), multiply, "流水佣金", 7);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_SP.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_SP.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "流水佣金", 7, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
String LEVEL_GP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GP.getCode());
@@ -1093,23 +1168,29 @@
BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_GP.getCode()));
DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP);
- dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply);
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_GP.getId(), multiply, "流水佣金", 7);
- dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- profitSharingTotal = profitSharingTotal.add(multiply);
+ DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberEntityLEVEL_GP.getId());
+ if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0) {
+ dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(), multiply);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
+ dappMemberEntityLEVEL_GP.getId(),dappWalletCoinEntity.getAvailableAmount(),
+ multiply, dappWalletCoinEntity.getAvailableAmount().add(multiply), "流水佣金", 7, id);
+ dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
+ profitSharingTotal = profitSharingTotal.add(multiply);
+ }
}
}
return profitSharingTotal;
}
@Override
- public BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit) {
- BigDecimal multiply = totalProfit.multiply(new BigDecimal(0.05));
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- memberId, multiply.negate(), "系统", 9);
+ public BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit,long id) {
+ if(BigDecimal.ZERO.compareTo(totalProfit)>=0){
+ return BigDecimal.ZERO;
+ }
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(65L,
+ totalProfit, "系统", 9,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
- return multiply;
+ return totalProfit;
}
@Override
@@ -1129,8 +1210,12 @@
public static void main(String[] args) {
- String num = StrUtil.subSuf("01234",1);
- System.out.print(num);
+ DateTime date = DateUtil.date();
+ DateTime endTime = DateUtil.parseTimeToday("09:08:03");
+ if(DateUtil.compare(date,endTime)>=0){
+ //
+ System.out.print(endTime);
+ }
}
private String isIdentity(List<String> refererIds,String levelCode){
--
Gitblit v1.9.1