| | |
| | | * * 21-25代奖励4% |
| | | * * 26-30代奖励7% |
| | | */ |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(id); |
| | | if(ObjectUtil.isEmpty(dappFundFlowEntity)){ |
| | | // DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(id); |
| | | // if(ObjectUtil.isEmpty(dappFundFlowEntity)){ |
| | | // return; |
| | | // } |
| | | // if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE != dappFundFlowEntity.getStatus()){ |
| | | // return; |
| | | // } |
| | | DappStorage dappStorage = dappStorageMapper.selectById(id); |
| | | |
| | | if(ObjectUtil.isEmpty(dappStorage)){ |
| | | return; |
| | | } |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE != dappFundFlowEntity.getStatus()){ |
| | | return; |
| | | } |
| | | BigDecimal amount = dappFundFlowEntity.getAmount().abs(); |
| | | BigDecimal amount = dappStorage.getReleaseAmount().abs(); |
| | | /** |
| | | * 往上循环30层,判断每一层是否有见点奖 |
| | | */ |
| | | Long memberId = dappFundFlowEntity.getMemberId(); |
| | | Long memberId = dappStorage.getMemberId(); |
| | | for(int i = 1;i <= 30;i++){ |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | String refererId = dappMemberEntity.getRefererId(); |
| | |
| | | } |
| | | |
| | | //减少用户的总额度 |
| | | BigDecimal usdtBalance = dappMemberEntity.getUsdtBalance(); |
| | | if(BigDecimal.ZERO.compareTo(usdtBalance) >= 0){ |
| | | return; |
| | | } |
| | | if(daoNodeAmount.compareTo(usdtBalance) >= 0){ |
| | | daoNodeAmount = usdtBalance; |
| | | usdtBalance = BigDecimal.ZERO; |
| | | }else{ |
| | | usdtBalance = usdtBalance.subtract(daoNodeAmount); |
| | | } |
| | | // BigDecimal usdtBalance = dappMemberEntity.getUsdtBalance(); |
| | | // if(BigDecimal.ZERO.compareTo(usdtBalance) >= 0){ |
| | | // return; |
| | | // } |
| | | // if(daoNodeAmount.compareTo(usdtBalance) >= 0){ |
| | | // daoNodeAmount = usdtBalance; |
| | | // usdtBalance = BigDecimal.ZERO; |
| | | // }else{ |
| | | // usdtBalance = usdtBalance.subtract(daoNodeAmount); |
| | | // } |
| | | |
| | | //总额度为0,用户变成未激活 |
| | | if(BigDecimal.ZERO.compareTo(usdtBalance) >= 0){ |
| | | dappMemberEntity.setActiveStatus(2); |
| | | //更新用户所有的业绩为已失效 |
| | | QueryWrapper<DappStorage> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("member_id",memberId); |
| | | objectQueryWrapper.eq("state",1); |
| | | List<DappStorage> dappStorages = dappStorageMapper.selectList(objectQueryWrapper); |
| | | if(CollUtil.isNotEmpty(dappStorages)){ |
| | | for(DappStorage dappStorage : dappStorages){ |
| | | dappStorage.setState(2); |
| | | dappStorageMapper.updateById(dappStorage); |
| | | } |
| | | } |
| | | } |
| | | dappMemberEntity.setUsdtBalance(usdtBalance); |
| | | dappMemberDao.updateById(dappMemberEntity); |
| | | // if(BigDecimal.ZERO.compareTo(usdtBalance) >= 0){ |
| | | // dappMemberEntity.setActiveStatus(2); |
| | | // //更新用户所有的业绩为已失效 |
| | | // QueryWrapper<DappStorage> objectQueryWrapper = new QueryWrapper<>(); |
| | | // objectQueryWrapper.eq("member_id",memberId); |
| | | // objectQueryWrapper.eq("state",1); |
| | | // List<DappStorage> dappStorages = dappStorageMapper.selectList(objectQueryWrapper); |
| | | // if(CollUtil.isNotEmpty(dappStorages)){ |
| | | // for(DappStorage dappStorage : dappStorages){ |
| | | // dappStorage.setState(2); |
| | | // dappStorageMapper.updateById(dappStorage); |
| | | // } |
| | | // } |
| | | // } |
| | | // dappMemberEntity.setUsdtBalance(usdtBalance); |
| | | // dappMemberDao.updateById(dappMemberEntity); |
| | | |
| | | dappWalletService.updateWalletCoinWithLock(daoNodeAmount, memberId, 1); |
| | | DappFundFlowEntity nodeFlow = new DappFundFlowEntity( |
| | |
| | | for(DappMemberEntity directMember : directMembers){ |
| | | //每一个直推的团队 |
| | | List<DappMemberEntity> direct = dappMemberDao.selectChildMemberDirectOrNot(directMember.getInviteId(), 2, null); |
| | | direct.add(directMember); |
| | | if(CollUtil.isEmpty(direct)){ |
| | | continue; |
| | | } |