| | |
| | | BigDecimal donateScore = amount.multiply(donateScorePercent); |
| | | dappWalletMineDao.updateBalance(donateScore,donateScore,memberId); |
| | | DappFundFlowEntity donateScoreFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.SCORE.getCode(), |
| | | memberId, |
| | | donateScore, |
| | | FundFlowEnum.DONATE_SCORE.getCode(), |
| | |
| | | String inviteId = dappMemberEntity.getInviteId(); |
| | | //该用户全部的直推用户 |
| | | List<DappMemberEntity> dappMemberEntities = dappMemberDao.selectChildMemberDirectOrNot(inviteId, 1, 1); |
| | | if(CollUtil.isEmpty(dappMemberEntities)){ |
| | | continue; |
| | | } |
| | | for(DappMemberEntity directMember : dappMemberEntities){ |
| | | if(1 != directMember.getActiveStatus()){ |
| | | return; |
| | | continue; |
| | | } |
| | | DappMemberEntity parentMember = dappMemberDao.selectMemberInfoByInviteId(directMember.getRefererId()); |
| | | if(ObjectUtil.isEmpty(parentMember)){ |
| | | continue; |
| | | } |
| | | Long directMemberId = directMember.getId(); |
| | | |
| | |
| | | DataDictionaryEnum.DIRECT_RELEASE.getCode() |
| | | ); |
| | | if(ObjectUtil.isEmpty(directReleaseDic)){ |
| | | return; |
| | | continue; |
| | | } |
| | | BigDecimal directRelease = new BigDecimal(directReleaseDic.getValue() == null ? "0" : directReleaseDic.getValue()); |
| | | if(BigDecimal.ZERO.compareTo(directRelease) >= 0){ |
| | | return; |
| | | continue; |
| | | } |
| | | DappMemberEntity parentMember = dappMemberDao.selectMemberInfoByInviteId(dappMemberEntity.getRefererId()); |
| | | /** |
| | | * 获取用户前一天的所有返利记录 |
| | | */ |
| | | List<DappFundFlowEntity> dappFundFlowEntities = dappFundFlowDao.selectListByMemberIdAndTypeAndDate(directMemberId, |
| | | FundFlowEnum.STATIC_RELEASE.getCode(),DateUtil.offsetHour(DateUtil.date(),-12)); |
| | | if(CollUtil.isEmpty(dappFundFlowEntities)){ |
| | | continue; |
| | | } |
| | | for(DappFundFlowEntity dappFundFlowEntity : dappFundFlowEntities){ |
| | | BigDecimal staticReleaseAmount = dappFundFlowEntity.getAmount(); |
| | | BigDecimal directReleaseAmount = staticReleaseAmount.multiply(directRelease).setScale(2, BigDecimal.ROUND_DOWN); |
| | |
| | | |
| | | //插入积分流水 |
| | | DappFundFlowEntity scoreFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.SCORE.getCode(), |
| | | memberId, |
| | | localTotalAchieve.negate(), |
| | | FundFlowEnum.REDUCE_SCORE_REAL.getCode(), |
| | |
| | | dappAccountMoneyChangeDao.insert(addAmountAMC); |
| | | //插入余额流水 |
| | | DappFundFlowEntity amountFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.AMOUNT.getCode(), |
| | | memberId, |
| | | localTotalAchieve, |
| | | FundFlowEnum.ADD_AMOUNT_REAL.getCode(), |
| | |
| | | |
| | | DappAccountMoneyChangeEntity record = new DappAccountMoneyChangeEntity( |
| | | memberId, |
| | | totalAmount, |
| | | amountMagic, |
| | | maxReleaseMember, |
| | | localTotalAchieve, |
| | | AccountFlowEnum.AMOUNT_RECORD.getCode(), |
| | | null); |
| | |
| | | } |
| | | //生成一条静态补贴的流水 |
| | | DappFundFlowEntity realUsdtAmountFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.AMOUNT.getCode(), |
| | | parentMember.getId(), |
| | | realScoreReduce, |
| | | fundFlowEnumType, |
| | | DappFundFlowEntity.WITHDRAW_STATUS_AGREE, |
| | | BigDecimal.ZERO, |
| | | null, |
| | | orderId); |
| | | dappFundFlowDao.insert(realUsdtAmountFlow); |
| | | //插入积分流水 |
| | | DappFundFlowEntity scoreFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.SCORE.getCode(), |
| | | parentMember.getId(), |
| | | realScoreReduce.negate(), |
| | | FundFlowEnum.REDUCE_SCORE.getCode(), |
| | | DappFundFlowEntity.WITHDRAW_STATUS_AGREE, |
| | | BigDecimal.ZERO, |
| | | null, |
| | | orderId); |
| | | dappFundFlowDao.insert(scoreFlow); |
| | | //插入余额流水 |
| | | DappFundFlowEntity amountFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.AMOUNT.getCode(), |
| | | parentMember.getId(), |
| | | realScoreReduce, |
| | | FundFlowEnum.ADD_AMOUNT.getCode(), |
| | | DappFundFlowEntity.WITHDRAW_STATUS_AGREE, |
| | | BigDecimal.ZERO, |
| | | null, |
| | | orderId); |
| | | dappFundFlowDao.insert(amountFlow); |
| | | return realScoreReduce; |