From ff9f5b37d6933af1a7b733a261ca5aeae9e8962a Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 03 Nov 2022 10:58:19 +0800
Subject: [PATCH] 20221021
---
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java | 89 +++++++++++++++++++++++++++++---------------
1 files changed, 59 insertions(+), 30 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 dc3d61d..f6a7c93 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
@@ -68,6 +68,7 @@
private final DappMemberService dappMemberService;
private final MemberCoinWithdrawDao memberCoinWithdrawDao;
private final IgtOnHookPlanOrderItemDao igtOnHookPlanOrderItemdao;
+ private final DappBankDao dappBankDao;
private final RedisTemplate<String, Object> redisTemplate;
@@ -537,8 +538,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"));
@@ -592,7 +601,7 @@
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());
@@ -603,9 +612,9 @@
//提现次数
DataDictionaryCustom withdrawTimesDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WITHDRAW_TIMES.getType(), DataDictionaryEnum.WITHDRAW_TIMES.getCode());
Integer withdrawTimes = Integer.parseInt(withdrawTimesDic.getValue());
- Integer withdrawTimesReal = memberCoinWithdrawDao.selectByMemberIdAndCreateTime(memberIdOut,DateUtil.format(DateUtil.date(),"yyyy-MM-dd"));
+ Integer withdrawTimesReal = memberCoinWithdrawDao.selectByMemberIdAndCreateTime(memberIdOut,DateUtil.format(DateUtil.date(),"yyyy-MM-dd"),"Y");
if(withdrawTimesReal >= withdrawTimes){
- return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_004"));
+ return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0016"));
}
//转出账户,余额减少,冻结增加
Integer countOut = dappWalletCoinDao.addFrozenAndDelAvailableById(dappWalletCoinEntityOut.getId(), balance);
@@ -669,12 +678,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){
@@ -690,7 +711,7 @@
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());
@@ -700,29 +721,31 @@
}
//(2)每24小时只能提现一次
// 提现次数
- DataDictionaryCustom withdrawOutTimesDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getType(), DataDictionaryEnum.OUT_ACCOUNT_PROFIT.getCode());
+ DataDictionaryCustom withdrawOutTimesDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WITHDRAW_OUT_TIMES.getType()
+ , DataDictionaryEnum.WITHDRAW_OUT_TIMES.getCode());
String withdrawOutTimesStr = withdrawOutTimesDic.getValue() == null ? "1" : withdrawOutTimesDic.getValue();
int withdrawOutTimes = Integer.parseInt(withdrawOutTimesStr);
- Integer withdrawTimesReal = memberCoinWithdrawDao.selectByMemberIdAndCreateTime(memberId,DateUtil.format(DateUtil.date(),"yyyy-MM-dd"));
- if(withdrawOutTimes < withdrawTimesReal){
+ Integer withdrawTimesReal = memberCoinWithdrawDao.selectByMemberIdAndCreateTime(memberId,DateUtil.format(DateUtil.date(),"yyyy-MM-dd"),"N");
+ if(withdrawOutTimes <= withdrawTimesReal){
return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_0014"));
}
//余额减少冻结增加
- Integer count = dappWalletCoinDao.addFrozenAndDelAvailableById(memberId, balance);
+ Integer count = dappWalletCoinDao.addFrozenAndDelAvailableById(dappWalletCoinEntity.getId(), balance);
if(1 != count){
throw new FebsException(MessageSourceUtils.getString("balance_err_002"));
}
DataDictionaryCustom serviceFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.SERVICE_FEE.getType(), DataDictionaryEnum.SERVICE_FEE.getCode());
BigDecimal serviceFee = new BigDecimal(serviceFeeDic.getValue());
- //转出账户生成一条内部转账记录
+ //转出账户生成一条记录
MemberCoinWithdrawEntity memberCoinWithdrawEntity = new MemberCoinWithdrawEntity();
memberCoinWithdrawEntity.setAddress(address);
- memberCoinWithdrawEntity.setAmount(balance.negate());
+ memberCoinWithdrawEntity.setAmount(balance);
memberCoinWithdrawEntity.setFeeAmount(serviceFee);
if(1 == apiTransferOutsideDto.getType()){
- memberCoinWithdrawEntity.setTag("银行卡");
+ DappBank dappBank = dappBankDao.selectBankListByMemberIdAndBankNo(memberId, address);
+ memberCoinWithdrawEntity.setTag(dappBank.getMemberName()+"-银行卡");
memberCoinWithdrawEntity.setSymbol("$");
}else{
memberCoinWithdrawEntity.setTag("钱包");
@@ -863,9 +886,12 @@
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)){
@@ -873,7 +899,7 @@
DappMemberEntity dappMemberEntityLEVEL_IB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_IB);
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_IB.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_IB.getId(), multiply, "盈利分成", 8);
+ dappMemberEntityLEVEL_IB.getId(), multiply, "盈利分成", 8,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -890,7 +916,7 @@
DappMemberEntity dappMemberEntityLEVEL_FIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_FIB);
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_FIB.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_FIB.getId(), multiply, "盈利分成", 8);
+ dappMemberEntityLEVEL_FIB.getId(), multiply, "盈利分成", 8,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -908,7 +934,7 @@
DappMemberEntity dappMemberEntityLEVEL_CIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_CIB);
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_CIB.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_CIB.getId(), multiply, "盈利分成", 8);
+ dappMemberEntityLEVEL_CIB.getId(), multiply, "盈利分成", 8,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -928,7 +954,7 @@
DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB);
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_AIB.getId(), multiply, "盈利分成", 8);
+ dappMemberEntityLEVEL_AIB.getId(), multiply, "盈利分成", 8,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -950,7 +976,7 @@
DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB);
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_GIB.getId(), multiply, "盈利分成", 8);
+ dappMemberEntityLEVEL_GIB.getId(), multiply, "盈利分成", 8,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -974,7 +1000,7 @@
DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP);
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_BP.getId(), multiply, "盈利分成", 8);
+ dappMemberEntityLEVEL_BP.getId(), multiply, "盈利分成", 8,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -1000,7 +1026,7 @@
DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP);
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_SP.getId(), multiply, "盈利分成", 8);
+ dappMemberEntityLEVEL_SP.getId(), multiply, "盈利分成", 8,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -1028,7 +1054,7 @@
DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP);
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_GP.getId(), multiply, "盈利分成", 8);
+ dappMemberEntityLEVEL_GP.getId(), multiply, "盈利分成", 8,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -1044,7 +1070,7 @@
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_AIB.getId(), multiply, "流水佣金", 7);
+ dappMemberEntityLEVEL_AIB.getId(), multiply, "流水佣金", 7,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -1056,7 +1082,7 @@
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_GIB.getId(), multiply, "流水佣金", 7);
+ dappMemberEntityLEVEL_GIB.getId(), multiply, "流水佣金", 7,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -1068,7 +1094,7 @@
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_BP.getId(), multiply, "流水佣金", 7);
+ dappMemberEntityLEVEL_BP.getId(), multiply, "流水佣金", 7,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -1080,7 +1106,7 @@
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_SP.getId(), multiply, "流水佣金", 7);
+ dappMemberEntityLEVEL_SP.getId(), multiply, "流水佣金", 7,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -1092,7 +1118,7 @@
dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply);
DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- dappMemberEntityLEVEL_GP.getId(), multiply, "流水佣金", 7);
+ dappMemberEntityLEVEL_GP.getId(), multiply, "流水佣金", 7,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
profitSharingTotal = profitSharingTotal.add(multiply);
}
@@ -1101,10 +1127,13 @@
}
@Override
- public BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit) {
+ public BigDecimal updatePTFC(Long memberId, BigDecimal totalProfit,long id) {
+ if(BigDecimal.ZERO.compareTo(totalProfit)>=0){
+ return BigDecimal.ZERO;
+ }
BigDecimal multiply = totalProfit.multiply(new BigDecimal(0.05));
- DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
- memberId, multiply.negate(), "系统", 9);
+ DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(65L,
+ multiply.negate(), "系统", 9,id);
dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
return multiply;
}
--
Gitblit v1.9.1