| | |
| | | BigDecimal donateScore = amount.multiply(donateScorePercent); |
| | | dappWalletMineDao.updateBalance(donateScore,donateScore,memberId); |
| | | DappFundFlowEntity donateScoreFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.SCORE.getCode(), |
| | | memberId, |
| | | donateScore, |
| | | FundFlowEnum.DONATE_SCORE.getCode(), |
| | |
| | | memberId,amount,amount,DateUtil.date(),orderId,1,mallOrderInfo.getPayTime() |
| | | ); |
| | | mallAchieveRecordMapper.insert(mallAchieveRecord); |
| | | |
| | | DappFundFlowEntity achieveFlow = new DappFundFlowEntity( |
| | | memberId, |
| | | amount, |
| | | FundFlowEnum.ACHIEVE_ADD.getCode(), |
| | | 2, |
| | | BigDecimal.ZERO, |
| | | null, |
| | | orderId); |
| | | dappFundFlowDao.insert(achieveFlow); |
| | | /** |
| | | * 商城销售额1%-10%,可设定进入资产管理池 |
| | | * USDT_ORDER_PERCENT |
| | | */ |
| | | DataDictionaryCustom orderPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.USDT_ORDER_PERCENT.getType(), |
| | | DataDictionaryEnum.USDT_ORDER_PERCENT.getCode() |
| | | ); |
| | | if(ObjectUtil.isNotEmpty(orderPercentDic)){ |
| | | BigDecimal orderPercent = new BigDecimal(StrUtil.isEmpty(orderPercentDic.getValue()) ? "0.1" : orderPercentDic.getValue()); |
| | | BigDecimal addPoor = amount.multiply(orderPercent); |
| | | |
| | | DataDictionaryCustom packageScorePriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_SCORE_PRICE.getType(), |
| | | DataDictionaryEnum.PACKAGE_SCORE_PRICE.getCode() |
| | | ); |
| | | DataDictionaryCustom packageTotalScoreDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_TOTAL_SCORE.getType(), |
| | | DataDictionaryEnum.PACKAGE_TOTAL_SCORE.getCode() |
| | | ); |
| | | BigDecimal packageTotalScore = new BigDecimal(ObjectUtil.isEmpty(packageTotalScoreDic) ? "21000" : packageTotalScoreDic.getValue()).setScale(2, BigDecimal.ROUND_DOWN); |
| | | //更新USDT底池 |
| | | DataDictionaryCustom packagePoorDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_POOR.getType(), |
| | | DataDictionaryEnum.PACKAGE_POOR.getCode() |
| | | ); |
| | | BigDecimal packagePoor = new BigDecimal(ObjectUtil.isEmpty(packagePoorDic) ? "0" : packagePoorDic.getValue()).setScale(2, BigDecimal.ROUND_DOWN); |
| | | BigDecimal avaPackagePoor = packagePoor.add(addPoor); |
| | | packagePoorDic.setValue(avaPackagePoor.toString()); |
| | | dataDictionaryCustomMapper.updateById(packagePoorDic); |
| | | //计算当前价格 |
| | | BigDecimal divide = avaPackagePoor.divide(packageTotalScore, 8, BigDecimal.ROUND_DOWN); |
| | | packageScorePriceDic.setValue(divide.toString()); |
| | | dataDictionaryCustomMapper.updateById(packageScorePriceDic); |
| | | |
| | | DappFundFlowEntity packageFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.SYSTEM_PACKAGE.getCode(), |
| | | 1L, |
| | | addPoor, |
| | | FundFlowEnum.SYSTEM_ORDER_PACKAGE.getCode(), |
| | | 2, |
| | | BigDecimal.ZERO, |
| | | null, |
| | | orderId); |
| | | dappFundFlowDao.insert(packageFlow); |
| | | |
| | | DappAKlineEntity dappAKlineEntity = new DappAKlineEntity(); |
| | | dappAKlineEntity.setOpenPrice(divide); |
| | | dappAKlineEntity.setType(1); |
| | | dappAKlineMapper.insert(dappAKlineEntity); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | 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)); |
| | | FundFlowEnum.STATIC_RELEASE.getCode(),DateUtil.date()); |
| | | // 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); |
| | |
| | | * 获取用户前一天的所有返利记录 |
| | | */ |
| | | List<DappFundFlowEntity> dappFundFlowEntities = dappFundFlowDao.selectListByMemberIdAndTypeAndDate(memberId, |
| | | FundFlowEnum.STATIC_RELEASE.getCode(),DateUtil.offsetHour(DateUtil.date(),12)); |
| | | FundFlowEnum.STATIC_RELEASE.getCode(),DateUtil.offsetHour(DateUtil.date(),-12)); |
| | | for(DappFundFlowEntity dappFundFlowEntity : dappFundFlowEntities){ |
| | | BigDecimal staticReleaseAmount = dappFundFlowEntity.getAmount(); |
| | | BigDecimal directReleaseAmount = staticReleaseAmount.multiply(directRelease).setScale(2, BigDecimal.ROUND_DOWN); |
| | |
| | | |
| | | List<DappMemberEntity> dappMemberEntities = dappMemberDao.selectMemberByAccountType(MemberLevelEnum.V1.getType()); |
| | | shareStaticPerk(dappMemberEntities,FundFlowEnum.SHARE_PERK_V1.getCode()); |
| | | teamStaticPerkMemberLevel(dappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V1.getCode()); |
| | | teamStaticPerkMemberLevel(dappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V1.getCode(),MemberLevelEnum.V1.getType()); |
| | | isAllPerkMemberLevel(dappMemberEntities,MemberLevelEnum.V1.getType(),FundFlowEnum.ALL_PERK_V1.getCode()); |
| | | |
| | | List<DappMemberEntity> v2DappMemberEntities = dappMemberDao.selectMemberByAccountType(MemberLevelEnum.V2.getType()); |
| | | shareStaticPerk(dappMemberEntities,FundFlowEnum.SHARE_PERK_V2.getCode()); |
| | | teamStaticPerkMemberLevel(v2DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V2.getCode()); |
| | | shareStaticPerk(v2DappMemberEntities,FundFlowEnum.SHARE_PERK_V2.getCode()); |
| | | teamStaticPerkMemberLevel(v2DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V2.getCode(),MemberLevelEnum.V2.getType()); |
| | | isAllPerkMemberLevel(v2DappMemberEntities,MemberLevelEnum.V2.getType(),FundFlowEnum.ALL_PERK_V2.getCode()); |
| | | |
| | | List<DappMemberEntity> v3DappMemberEntities = dappMemberDao.selectMemberByAccountType(MemberLevelEnum.V3.getType()); |
| | | shareStaticPerk(dappMemberEntities,FundFlowEnum.SHARE_PERK_V3.getCode()); |
| | | teamStaticPerkMemberLevel(v3DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V3.getCode()); |
| | | shareStaticPerk(v3DappMemberEntities,FundFlowEnum.SHARE_PERK_V3.getCode()); |
| | | teamStaticPerkMemberLevel(v3DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V3.getCode(),MemberLevelEnum.V3.getType()); |
| | | isAllPerkMemberLevel(v3DappMemberEntities,MemberLevelEnum.V3.getType(),FundFlowEnum.ALL_PERK_V3.getCode()); |
| | | |
| | | List<DappMemberEntity> v4DappMemberEntities = dappMemberDao.selectMemberByAccountType(MemberLevelEnum.V4.getType()); |
| | | shareStaticPerk(dappMemberEntities,FundFlowEnum.SHARE_PERK_V4.getCode()); |
| | | teamStaticPerkMemberLevel(v4DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V4.getCode()); |
| | | shareStaticPerk(v4DappMemberEntities,FundFlowEnum.SHARE_PERK_V4.getCode()); |
| | | teamStaticPerkMemberLevel(v4DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V4.getCode(),MemberLevelEnum.V4.getType()); |
| | | isAllPerkMemberLevel(v4DappMemberEntities,MemberLevelEnum.V4.getType(),FundFlowEnum.ALL_PERK_V4.getCode()); |
| | | |
| | | List<DappMemberEntity> v5DappMemberEntities = dappMemberDao.selectMemberByAccountType(MemberLevelEnum.V5.getType()); |
| | | shareStaticPerk(dappMemberEntities,FundFlowEnum.SHARE_PERK_V5.getCode()); |
| | | teamStaticPerkMemberLevel(v5DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V5.getCode()); |
| | | shareStaticPerk(v5DappMemberEntities,FundFlowEnum.SHARE_PERK_V5.getCode()); |
| | | teamStaticPerkMemberLevel(v5DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V5.getCode(),MemberLevelEnum.V5.getType()); |
| | | isAllPerkMemberLevel(v5DappMemberEntities,MemberLevelEnum.V5.getType(),FundFlowEnum.ALL_PERK_V5.getCode()); |
| | | |
| | | List<DappMemberEntity> v6DappMemberEntities = dappMemberDao.selectMemberByAccountType(MemberLevelEnum.V6.getType()); |
| | | shareStaticPerk(dappMemberEntities,FundFlowEnum.SHARE_PERK_V6.getCode()); |
| | | teamStaticPerkMemberLevel(v6DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V6.getCode()); |
| | | shareStaticPerk(v6DappMemberEntities,FundFlowEnum.SHARE_PERK_V6.getCode()); |
| | | teamStaticPerkMemberLevel(v6DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V6.getCode(),MemberLevelEnum.V6.getType()); |
| | | isAllPerkMemberLevel(v6DappMemberEntities,MemberLevelEnum.V6.getType(),FundFlowEnum.ALL_PERK_V6.getCode()); |
| | | |
| | | List<DappMemberEntity> v7DappMemberEntities = dappMemberDao.selectMemberByAccountType(MemberLevelEnum.V7.getType()); |
| | | shareStaticPerk(dappMemberEntities,FundFlowEnum.SHARE_PERK_V7.getCode()); |
| | | teamStaticPerkMemberLevel(v7DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V7.getCode()); |
| | | shareStaticPerk(v7DappMemberEntities,FundFlowEnum.SHARE_PERK_V7.getCode()); |
| | | teamStaticPerkMemberLevel(v7DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V7.getCode(),MemberLevelEnum.V7.getType()); |
| | | isAllPerkMemberLevel(v7DappMemberEntities,MemberLevelEnum.V7.getType(),FundFlowEnum.ALL_PERK_V7.getCode()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void updateAchieve() { |
| | | public Set<DappMemberEntity> updateAchieve() { |
| | | /** |
| | | * 每个人预期获得的总流水 |
| | | */ |
| | | |
| | | Set<DappMemberEntity> set = new HashSet<>(); |
| | | List<DappFundFlowEntity> dappFundFlowEntities = dappFundFlowDao.selectListByTypeAndDate(FundFlowEnum.ADD_AMOUNT.getCode(), DateUtil.date()); |
| | | if(CollUtil.isEmpty(dappFundFlowEntities)){ |
| | | return; |
| | | return set; |
| | | } |
| | | for(DappFundFlowEntity dappFundFlowEntity : dappFundFlowEntities){ |
| | | Long memberId = dappFundFlowEntity.getMemberId(); |
| | |
| | | BigDecimal amountMagic = amount; |
| | | List<MallAchieveRecord> mallAchieveRecords = mallAchieveRecordMapper.selectListByMemberId(memberId); |
| | | if(CollUtil.isEmpty(mallAchieveRecords)){ |
| | | return; |
| | | |
| | | BigDecimal localTotalAchieve = amount; |
| | | /** |
| | | * 用户减少赠送积分 |
| | | */ |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | DappWalletMineEntity dappWalletMineEntity = dappWalletMineDao.selectByMemberId(memberId); |
| | | BigDecimal totalScore = dappWalletMineEntity.getTotalAmount(); |
| | | BigDecimal availableScore = dappWalletMineEntity.getAvailableAmount(); |
| | | |
| | | if(localTotalAchieve.compareTo(totalScore) >= 0){ |
| | | localTotalAchieve = totalScore; |
| | | //当实际获取大于用户的赠送积分,将用户更新为未激活 |
| | | dappMemberEntity.setActiveStatus(2); |
| | | dappMemberDao.updateById(dappMemberEntity); |
| | | } |
| | | |
| | | DappAccountMoneyChangeEntity reduceScoreAMC = new DappAccountMoneyChangeEntity( |
| | | memberId, |
| | | totalScore, |
| | | amountMagic.negate(), |
| | | localTotalAchieve.negate(), |
| | | AccountFlowEnum.SCORE.getCode(), |
| | | null); |
| | | dappAccountMoneyChangeDao.insert(reduceScoreAMC); |
| | | |
| | | //插入积分流水 |
| | | DappFundFlowEntity scoreFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.SCORE.getCode(), |
| | | memberId, |
| | | localTotalAchieve.negate(), |
| | | FundFlowEnum.REDUCE_SCORE_REAL.getCode(), |
| | | DappFundFlowEntity.WITHDRAW_STATUS_AGREE, |
| | | BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(scoreFlow); |
| | | |
| | | BigDecimal totalScoreRelease = totalScore.subtract(localTotalAchieve); |
| | | BigDecimal availableScoreRelease = availableScore.subtract(localTotalAchieve); |
| | | //更新积分账户 |
| | | dappWalletMineEntity.setTotalAmount(totalScoreRelease); |
| | | dappWalletMineEntity.setAvailableAmount(availableScoreRelease); |
| | | dappWalletMineDao.updateById(dappWalletMineEntity); |
| | | |
| | | |
| | | //用户增加余额 |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId); |
| | | BigDecimal totalAmount = dappWalletCoinEntity.getTotalAmount(); |
| | | BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount(); |
| | | |
| | | DappAccountMoneyChangeEntity addAmountAMC = new DappAccountMoneyChangeEntity( |
| | | memberId, |
| | | totalAmount, |
| | | amountMagic, |
| | | localTotalAchieve, |
| | | AccountFlowEnum.AMOUNT.getCode(), |
| | | null); |
| | | dappAccountMoneyChangeDao.insert(addAmountAMC); |
| | | //插入余额流水 |
| | | DappFundFlowEntity amountFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.AMOUNT.getCode(), |
| | | memberId, |
| | | localTotalAchieve, |
| | | FundFlowEnum.ADD_AMOUNT_REAL.getCode(), |
| | | DappFundFlowEntity.WITHDRAW_STATUS_AGREE, |
| | | BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(amountFlow); |
| | | |
| | | BigDecimal totalAmountRelease = totalAmount.add(localTotalAchieve); |
| | | BigDecimal availableAmountRelease = availableAmount.add(localTotalAchieve); |
| | | //更新余额账户 |
| | | dappWalletCoinEntity.setTotalAmount(totalAmountRelease); |
| | | dappWalletCoinEntity.setAvailableAmount(availableAmountRelease); |
| | | dappWalletCoinDao.updateById(dappWalletCoinEntity); |
| | | |
| | | StringBuffer content = new StringBuffer(); |
| | | if(amountMagic.compareTo(localTotalAchieve) > 0){ |
| | | content.append("今日可加速"+amountMagic.setScale(2,BigDecimal.ROUND_DOWN)+",实际加速"+localTotalAchieve.setScale(2,BigDecimal.ROUND_DOWN)+"" + |
| | | "烧伤"+amountMagic.subtract(localTotalAchieve).setScale(2,BigDecimal.ROUND_DOWN)+",原因消费金额1%加速上" + |
| | | "限,增加消费金额可获得更多收益"); |
| | | }else{ |
| | | content.append("今日可加速"+amountMagic.setScale(2,BigDecimal.ROUND_DOWN)+",实际加速"+localTotalAchieve.setScale(2,BigDecimal.ROUND_DOWN)+"" + |
| | | "烧伤"+amountMagic.subtract(localTotalAchieve).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | } |
| | | DappAccountMoneyChangeEntity record = new DappAccountMoneyChangeEntity( |
| | | memberId, |
| | | totalAmount, |
| | | amountMagic, |
| | | localTotalAchieve, |
| | | AccountFlowEnum.AMOUNT_RECORD.getCode(), |
| | | content.toString()); |
| | | dappAccountMoneyChangeDao.insert(record); |
| | | |
| | | //实时更新用户等级 |
| | | chainProducer.sendAutoLevelUpTeamMsg(memberId); |
| | | |
| | | set.add(dappMemberEntity); |
| | | continue; |
| | | } |
| | | //实际获取总收益 |
| | | BigDecimal localTotalAchieve = BigDecimal.ZERO; |
| | | BigDecimal totalAchieve = mallAchieveRecords.stream().map(MallAchieveRecord::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | //用户每日获取的最大值 |
| | | DataDictionaryCustom maxReleaseDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.MAX_RELEASE.getType(), |
| | | DataDictionaryEnum.MAX_RELEASE.getCode() |
| | | ); |
| | | BigDecimal maxRelease = new BigDecimal(ObjectUtil.isEmpty(maxReleaseDic) ? "1" : maxReleaseDic.getValue()); |
| | | //用户每日获取的最大值 |
| | | BigDecimal maxReleaseMember = totalAchieve.multiply(maxRelease).setScale(2, BigDecimal.ROUND_DOWN); |
| | | if(amount.compareTo(maxReleaseMember) > 0){ |
| | | amount = maxReleaseMember; |
| | | } |
| | | //当日获取总收益大于总业绩 |
| | | if(amount.compareTo(totalAchieve) >= 0){ |
| | | for(MallAchieveRecord memberAchieve : mallAchieveRecords){ |
| | |
| | | */ |
| | | for(MallAchieveRecord memberAchieve : mallAchieveRecords){ |
| | | BigDecimal achieveAmount = memberAchieve.getAmount(); |
| | | if(amount.compareTo(achieveAmount) < 0){ |
| | | if(BigDecimal.ZERO.compareTo(amount) >= 0){ |
| | | break; |
| | | }else if(amount.compareTo(achieveAmount) < 0){ |
| | | memberAchieve.setAmount(achieveAmount.subtract(amount).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | mallAchieveRecordMapper.updateById(memberAchieve); |
| | | localTotalAchieve = localTotalAchieve.add(amount); |
| | |
| | | totalScore, |
| | | amountMagic.negate(), |
| | | localTotalAchieve.negate(), |
| | | FundFlowEnum.REDUCE_SCORE.getCode(), |
| | | AccountFlowEnum.SCORE.getCode(), |
| | | null); |
| | | dappAccountMoneyChangeDao.insert(reduceScoreAMC); |
| | | |
| | | //插入积分流水 |
| | | DappFundFlowEntity scoreFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.SCORE.getCode(), |
| | | memberId, |
| | | localTotalAchieve.negate(), |
| | | FundFlowEnum.REDUCE_SCORE_REAL.getCode(), |
| | |
| | | totalAmount, |
| | | amountMagic, |
| | | localTotalAchieve, |
| | | FundFlowEnum.ADD_AMOUNT_REAL.getCode(), |
| | | AccountFlowEnum.AMOUNT.getCode(), |
| | | null); |
| | | dappAccountMoneyChangeDao.insert(addAmountAMC); |
| | | //插入余额流水 |
| | | DappFundFlowEntity amountFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.AMOUNT.getCode(), |
| | | memberId, |
| | | localTotalAchieve, |
| | | FundFlowEnum.ADD_AMOUNT_REAL.getCode(), |
| | |
| | | dappWalletCoinEntity.setAvailableAmount(availableAmountRelease); |
| | | dappWalletCoinDao.updateById(dappWalletCoinEntity); |
| | | |
| | | StringBuffer content = new StringBuffer(); |
| | | if(amountMagic.compareTo(localTotalAchieve) > 0){ |
| | | content.append("今日可加速"+amountMagic.setScale(2,BigDecimal.ROUND_DOWN)+",实际加速"+localTotalAchieve.setScale(2,BigDecimal.ROUND_DOWN)+"" + |
| | | "烧伤"+amountMagic.subtract(localTotalAchieve).setScale(2,BigDecimal.ROUND_DOWN)+",原因消费金额1%加速上" + |
| | | "限,增加消费金额可获得更多收益"); |
| | | }else{ |
| | | content.append("今日可加速"+amountMagic.setScale(2,BigDecimal.ROUND_DOWN)+",实际加速"+localTotalAchieve.setScale(2,BigDecimal.ROUND_DOWN)+"" + |
| | | "烧伤"+amountMagic.subtract(localTotalAchieve).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | } |
| | | DappAccountMoneyChangeEntity record = new DappAccountMoneyChangeEntity( |
| | | memberId, |
| | | totalAmount, |
| | | amountMagic, |
| | | localTotalAchieve, |
| | | AccountFlowEnum.AMOUNT_RECORD.getCode(), |
| | | content.toString()); |
| | | dappAccountMoneyChangeDao.insert(record); |
| | | |
| | | //实时更新用户等级 |
| | | chainProducer.sendAutoLevelUpTeamMsg(memberId); |
| | | |
| | | set.add(dappMemberEntity); |
| | | } |
| | | return set; |
| | | } |
| | | |
| | | @Override |
| | | public void speedSalePackageMsg(Long flowId) { |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(flowId); |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_ING != dappFundFlowEntity.getStatus()){ |
| | | return; |
| | | } |
| | | dappFundFlowEntity.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_AGREE); |
| | | dappFundFlowDao.updateById(dappFundFlowEntity); |
| | | |
| | | BigDecimal cnt = dappFundFlowEntity.getAmount(); |
| | | Long memberId = dappFundFlowEntity.getMemberId(); |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | if(BigDecimal.ZERO.compareTo(cnt) >= 0){ |
| | | return; |
| | | } |
| | | DataDictionaryCustom packageScorePriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_SCORE_PRICE.getType(), |
| | | DataDictionaryEnum.PACKAGE_SCORE_PRICE.getCode() |
| | | ); |
| | | BigDecimal packageScorePrice = new BigDecimal(ObjectUtil.isEmpty(packageScorePriceDic) ? "0" : packageScorePriceDic.getValue()).setScale(8, BigDecimal.ROUND_DOWN); |
| | | //卖出资产乘以价格获取到预期获取的总额 |
| | | BigDecimal totalAmount = cnt.multiply(packageScorePrice).setScale(4, BigDecimal.ROUND_DOWN); |
| | | //资产包卖出划入底池比例 |
| | | DataDictionaryCustom packageToPoorPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_SALE_TO_POOR_PERCENT.getType(), |
| | | DataDictionaryEnum.PACKAGE_SALE_TO_POOR_PERCENT.getCode() |
| | | ); |
| | | BigDecimal packageToPoorPercent = new BigDecimal(ObjectUtil.isEmpty(packageToPoorPercentDic) ? "0.1" : packageToPoorPercentDic.getValue()).setScale(8, BigDecimal.ROUND_DOWN); |
| | | //划入底池的金额 |
| | | BigDecimal poorAmount = totalAmount.multiply(packageToPoorPercent).setScale(4, BigDecimal.ROUND_DOWN); |
| | | //实际获取的金额 |
| | | BigDecimal realAmount = totalAmount.subtract(poorAmount); |
| | | //生成一条资金流水 |
| | | DappFundFlowEntity scoreFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.AMOUNT.getCode(), |
| | | memberId, |
| | | realAmount, |
| | | FundFlowEnum.SALE_PACKAGE_AMOUNT.getCode(), |
| | | DappFundFlowEntity.WITHDRAW_STATUS_AGREE, |
| | | BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(scoreFlow); |
| | | dappWalletCoinDao.addTotalAndaddAvailableByMemberId(memberId,realAmount); |
| | | DappFundFlowEntity feeFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.AMOUNT.getCode(), |
| | | memberId, |
| | | poorAmount.negate(), |
| | | FundFlowEnum.SALE_PACKAGE_AMOUNT_FEE.getCode(), |
| | | DappFundFlowEntity.WITHDRAW_STATUS_AGREE, |
| | | BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(feeFlow); |
| | | |
| | | //卖出积分直接销毁。 |
| | | DataDictionaryCustom packageTotalScoreDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_TOTAL_SCORE.getType(), |
| | | DataDictionaryEnum.PACKAGE_TOTAL_SCORE.getCode() |
| | | ); |
| | | BigDecimal packageTotalScore = new BigDecimal(ObjectUtil.isEmpty(packageTotalScoreDic) ? "21000" : packageTotalScoreDic.getValue()).setScale(4, BigDecimal.ROUND_DOWN); |
| | | BigDecimal avaPackageTotalScore = packageTotalScore.subtract(cnt); |
| | | packageTotalScoreDic.setValue(avaPackageTotalScore.toString()); |
| | | dataDictionaryCustomMapper.updateById(packageTotalScoreDic); |
| | | //更新USDT底池 |
| | | DataDictionaryCustom packagePoorDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_POOR.getType(), |
| | | DataDictionaryEnum.PACKAGE_POOR.getCode() |
| | | ); |
| | | BigDecimal packagePoor = new BigDecimal(ObjectUtil.isEmpty(packagePoorDic) ? "0" : packagePoorDic.getValue()).setScale(4, BigDecimal.ROUND_DOWN); |
| | | BigDecimal avaPackagePoor = packagePoor.add(poorAmount); |
| | | packagePoorDic.setValue(avaPackagePoor.toString()); |
| | | dataDictionaryCustomMapper.updateById(packagePoorDic); |
| | | //计算当前价格 |
| | | BigDecimal divide = avaPackagePoor.divide(avaPackageTotalScore, 8, BigDecimal.ROUND_DOWN); |
| | | packageScorePriceDic.setValue(divide.toString()); |
| | | dataDictionaryCustomMapper.updateById(packageScorePriceDic); |
| | | |
| | | DataDictionaryCustom packageAvaCntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_AVA_CNT.getType(), |
| | | DataDictionaryEnum.PACKAGE_AVA_CNT.getCode() |
| | | ); |
| | | BigDecimal packageAvaCnt = new BigDecimal(ObjectUtil.isEmpty(packageAvaCntDic) ? "0" : packageAvaCntDic.getValue()).setScale(4, BigDecimal.ROUND_DOWN); |
| | | BigDecimal packageAvaCntScore = packageAvaCnt.add(cnt); |
| | | packageAvaCntDic.setValue(packageAvaCntScore.toString()); |
| | | dataDictionaryCustomMapper.updateById(packageAvaCntDic); |
| | | |
| | | DappFundFlowEntity packageFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.SYSTEM_PACKAGE.getCode(), |
| | | memberId, |
| | | poorAmount.negate(), |
| | | FundFlowEnum.SYSTEM_SALE_PACKAGE.getCode(), |
| | | DappFundFlowEntity.WITHDRAW_STATUS_AGREE, |
| | | BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(packageFlow); |
| | | |
| | | DappAKlineEntity dappAKlineEntity = new DappAKlineEntity(); |
| | | dappAKlineEntity.setOpenPrice(divide); |
| | | dappAKlineEntity.setType(1); |
| | | dappAKlineMapper.insert(dappAKlineEntity); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void updatePackage(Set<DappMemberEntity> dappMemberEntities) { |
| | | DataDictionaryCustom packageTeamPerkPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_TEAM_PERK_PERCENT.getType(), |
| | | DataDictionaryEnum.PACKAGE_TEAM_PERK_PERCENT.getCode() |
| | | ); |
| | | BigDecimal packageTeamPerkPercent = new BigDecimal(ObjectUtil.isEmpty(packageTeamPerkPercentDic) ? "0.01" : packageTeamPerkPercentDic.getValue()); |
| | | |
| | | for(DappMemberEntity dappMemberEntity : dappMemberEntities){ |
| | | // List<DappFundFlowEntity> dappFundFlowEntities = dappFundFlowDao.selectListByMemberIdAndTypeAndDate(dappMemberEntity.getId() |
| | | // , FundFlowEnum.ADD_AMOUNT_REAL.getCode() |
| | | // , DateUtil.offsetHour(DateUtil.date(), -12)); |
| | | List<DappFundFlowEntity> dappFundFlowEntities = dappFundFlowDao.selectListByMemberIdAndTypeAndDate(dappMemberEntity.getId() |
| | | , FundFlowEnum.ADD_AMOUNT_REAL.getCode() |
| | | , DateUtil.date()); |
| | | //总收益 |
| | | BigDecimal totalPerk = dappFundFlowEntities.stream().map(DappFundFlowEntity::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal memberPerk = totalPerk.multiply(packageTeamPerkPercent); |
| | | |
| | | DataDictionaryCustom packageTeamPerkCntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_TEAM_PERK_CNT.getType(), |
| | | DataDictionaryEnum.PACKAGE_TEAM_PERK_CNT.getCode() |
| | | ); |
| | | |
| | | DataDictionaryCustom packageScorePriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_SCORE_PRICE.getType(), |
| | | DataDictionaryEnum.PACKAGE_SCORE_PRICE.getCode() |
| | | ); |
| | | BigDecimal packageScorePrice = new BigDecimal(ObjectUtil.isEmpty(packageScorePriceDic) ? "0" : packageScorePriceDic.getValue()).setScale(2, BigDecimal.ROUND_DOWN); |
| | | |
| | | BigDecimal divide = memberPerk.divide(packageScorePrice, 4, BigDecimal.ROUND_DOWN); |
| | | if(BigDecimal.ZERO.compareTo(divide) >= 0){ |
| | | continue; |
| | | } |
| | | |
| | | BigDecimal packageTeamPerkCnt = new BigDecimal(packageTeamPerkCntDic.getValue()).setScale(2, BigDecimal.ROUND_DOWN); |
| | | if(BigDecimal.ZERO.compareTo(packageTeamPerkCnt) >= 0){ |
| | | return; |
| | | } |
| | | if(packageTeamPerkCnt.compareTo(divide) >= 0){ |
| | | BigDecimal subtract = packageTeamPerkCnt.subtract(divide); |
| | | packageTeamPerkCntDic.setValue(subtract.toString()); |
| | | dataDictionaryCustomMapper.updateById(packageTeamPerkCntDic); |
| | | } |
| | | |
| | | BigDecimal balance = dappMemberEntity.getBalance(); |
| | | balance = balance.add(divide); |
| | | dappMemberEntity.setBalance(balance); |
| | | dappMemberDao.updateById(dappMemberEntity); |
| | | |
| | | //插入余额流水 |
| | | DappFundFlowEntity amountFlow = new DappFundFlowEntity( |
| | | AccountFlowEnum.AMOUNT.getCode(), |
| | | dappMemberEntity.getId(), |
| | | divide, |
| | | FundFlowEnum.PACKAGE_ADD.getCode(), |
| | | DappFundFlowEntity.WITHDRAW_STATUS_AGREE, |
| | | BigDecimal.ZERO); |
| | | dappFundFlowDao.insert(amountFlow); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 每个人的第一次入单之后的业绩不一样 |
| | | */ |
| | | Date createTime = dappMemberEntity.getCreateTime(); |
| | | List<MallAchieveRecord> mallAchieveRecords = mallAchieveRecordMapper.selectListByMemberId(dappMemberEntity.getId()); |
| | | if(CollUtil.isEmpty(mallAchieveRecords)){ |
| | | continue; |
| | | } |
| | | Date payTime = mallAchieveRecords.get(0).getPayTime(); |
| | | //下第一单之后的共享区全部业绩 |
| | | BigDecimal totalAchieve = mallAchieveRecordMapper.selectAchieveTotalByCreateTime(createTime); |
| | | BigDecimal totalAchieve = mallAchieveRecordMapper.selectAchieveTotalByCreateTime(payTime); |
| | | //个人总业绩 |
| | | BigDecimal totalMemberAchieve = mallAchieveRecordMapper.selectAchieveTotalByMemberIdAndCreateTime(dappMemberEntity.getId(), createTime); |
| | | BigDecimal totalMemberAchieve = mallAchieveRecordMapper.selectAchieveTotalByMemberIdAndCreateTime(dappMemberEntity.getId(), payTime); |
| | | if(BigDecimal.ZERO.compareTo(totalAchieve) >= 0 || BigDecimal.ZERO.compareTo(totalMemberAchieve) >= 0){ |
| | | continue; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public void isAllPerkMemberLevel(List<DappMemberEntity> dappMemberEntities, |
| | | String level, |
| | | int code){ |
| | | if(CollUtil.isEmpty(dappMemberEntities)){ |
| | | return; |
| | | } |
| | | DataDictionaryCustom teamPerkMemberDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | "TEAM_LEVEL", level); |
| | | TeamLevelPerk adminAgentInfo = JSONObject.parseObject(teamPerkMemberDic.getValue(), TeamLevelPerk.class); |
| | | BigDecimal orderSalePercent = adminAgentInfo.getOrderSalePercent(); |
| | | if(BigDecimal.ZERO.compareTo(orderSalePercent) >= 0){ |
| | | return; |
| | | } |
| | | allPerkMemberLevel(dappMemberEntities,level,code); |
| | | |
| | | } |
| | | |
| | | public void allPerkMemberLevel(List<DappMemberEntity> dappMemberEntities, |
| | | String level, |
| | | int code) { |
| | | /** |
| | | * 全网24小时内的全部分红 |
| | | */ |
| | | Date createTime = DateUtil.offsetHour(DateUtil.date(),-24); |
| | | //下第一单之后的共享区全部业绩 |
| | | BigDecimal totalAchieve = mallAchieveRecordMapper.selectAchieveTotalByCreateTime(createTime); |
| | | if(BigDecimal.ZERO.compareTo(totalAchieve) >= 0){ |
| | | return; |
| | | } |
| | | DataDictionaryCustom teamPerkMemberDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | "TEAM_LEVEL", level); |
| | | TeamLevelPerk adminAgentInfo = JSONObject.parseObject(teamPerkMemberDic.getValue(), TeamLevelPerk.class); |
| | | BigDecimal orderSalePercent = adminAgentInfo.getOrderSalePercent(); |
| | | //每人平分数量 |
| | | BigDecimal divide = totalAchieve.multiply(orderSalePercent).divide(new BigDecimal(dappMemberEntities.size()), 2, BigDecimal.ROUND_DOWN); |
| | | |
| | | for(DappMemberEntity dappMemberEntity : dappMemberEntities){ |
| | | sendPerk(dappMemberEntity, divide, dappMemberEntity.getId(), code); |
| | | } |
| | | } |
| | | |
| | | public void teamStaticPerkMemberLevel(List<DappMemberEntity> dappMemberEntities, |
| | | BigDecimal teamPerkEquals, |
| | | BigDecimal staticRelease, |
| | | int code) { |
| | | int code, |
| | | String memberAccountType) { |
| | | if(CollUtil.isEmpty(dappMemberEntities)){ |
| | | return; |
| | | } |
| | |
| | | BigDecimal cashPercent = adminAgentInfo.getTeamPercent(); |
| | | // 直推用户 |
| | | List<DappMemberEntity> childs = dappMemberDao.selectMemberInfoByRefererId(teamPerkMember.getInviteId()); |
| | | List<DappMemberEntity> collect = childs.stream() |
| | | .filter(dappMemberEntity -> dappMemberEntity.getAccountType() == MemberLevelEnum.V1.getType()) |
| | | .collect(Collectors.toList()); |
| | | //极差 |
| | | if(CollUtil.isNotEmpty(collect)){ |
| | | //平级 |
| | | cashPercent = teamPerkEquals; |
| | | } |
| | | // List<DappMemberEntity> collect = childs.stream() |
| | | // .filter(dappMemberEntity -> dappMemberEntity.getAccountType().equals(memberAccountType)) |
| | | // .collect(Collectors.toList()); |
| | | //所有直推团队,就是这个会员的所有区域的业绩。 |
| | | List<String> childsInviteIds = childs.stream().map(DappMemberEntity::getInviteId).collect(Collectors.toList()); |
| | | //总业绩 |
| | | BigDecimal teamIncomeMax = BigDecimal.ZERO; |
| | | for(String inviteId : childsInviteIds){ |
| | | BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByInviteId(inviteId); |
| | | teamIncomeMax = teamIncomeMax.add(totalIncomeMember); |
| | | } |
| | | if(BigDecimal.ZERO.compareTo(teamIncomeMax) >= 0){ |
| | | continue; |
| | | } |
| | | //V1加速团队静态收益的15%=每日静态的20000*6‰*15%=18元的额外释放加速 |
| | | BigDecimal cashAmount = teamIncomeMax.multiply(cashPercent).multiply(staticRelease).setScale(2, BigDecimal.ROUND_DOWN); |
| | | // List<String> childsInviteIds = childs.stream().map(DappMemberEntity::getInviteId).collect(Collectors.toList()); |
| | | if(CollUtil.isNotEmpty(childs)){ |
| | | for(DappMemberEntity dappMemberChild : childs){ |
| | | String childAccountType = dappMemberChild.getAccountType(); |
| | | int compareLevel = MemberLevelEnum.V1.compareLevel(level, childAccountType); |
| | | //级别比我高,则没有团队加速 |
| | | if(compareLevel < 1){ |
| | | continue; |
| | | } |
| | | if(compareLevel == 1){ |
| | | BigDecimal cashPercentChild = BigDecimal.ZERO; |
| | | if(!MemberLevelEnum.MEMBER.getType().equals(childAccountType)){ |
| | | DataDictionaryCustom teamPerkMemberChildDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | "TEAM_LEVEL", childAccountType); |
| | | TeamLevelPerk adminAgentInfoChild = JSONObject.parseObject(teamPerkMemberChildDic.getValue(), TeamLevelPerk.class); |
| | | cashPercentChild = adminAgentInfoChild.getTeamPercent(); |
| | | } |
| | | BigDecimal subtract = cashPercent.subtract(cashPercentChild); |
| | | BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByInviteId(dappMemberChild.getInviteId()); |
| | | //V1加速团队静态收益的15%=每日静态的20000*6‰*15%=18元的额外释放加速 |
| | | BigDecimal cashAmount = totalIncomeMember.multiply(staticRelease).multiply(subtract).setScale(2, BigDecimal.ROUND_DOWN); |
| | | if(BigDecimal.ZERO.compareTo(cashAmount) >= 0){ |
| | | continue; |
| | | } |
| | | BigDecimal bigDecimal = sendPerk(teamPerkMember, cashAmount, teamPerkMember.getId(), code); |
| | | continue; |
| | | } |
| | | if(compareLevel > 1){ |
| | | BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByInviteId(dappMemberChild.getInviteId()); |
| | | //V1加速团队静态收益的15%=每日静态的20000*6‰*15%=18元的额外释放加速 |
| | | BigDecimal cashAmount = totalIncomeMember.multiply(staticRelease).multiply(teamPerkEquals).setScale(2, BigDecimal.ROUND_DOWN); |
| | | if(BigDecimal.ZERO.compareTo(cashAmount) >= 0){ |
| | | continue; |
| | | } |
| | | BigDecimal bigDecimal = sendPerk(teamPerkMember, cashAmount, teamPerkMember.getId(), code); |
| | | continue; |
| | | |
| | | BigDecimal bigDecimal = sendPerk(teamPerkMember, cashAmount, teamPerkMember.getId(), code); |
| | | } |
| | | } |
| | | } |
| | | // //总业绩 |
| | | // BigDecimal teamIncomeMax = BigDecimal.ZERO; |
| | | // for(String inviteId : childsInviteIds){ |
| | | // //极差 |
| | | // if(CollUtil.isNotEmpty(collect)){ |
| | | // List<String> collectInviteIds = collect.stream().map(DappMemberEntity::getInviteId).collect(Collectors.toList()); |
| | | // if(collectInviteIds.contains(inviteId)){ |
| | | // BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByInviteId(inviteId); |
| | | // //V1加速团队静态收益的15%=每日静态的20000*6‰*15%=18元的额外释放加速 |
| | | // BigDecimal cashAmount = totalIncomeMember.multiply(teamPerkEquals).multiply(staticRelease).setScale(2, BigDecimal.ROUND_DOWN); |
| | | // if(BigDecimal.ZERO.compareTo(cashAmount) >= 0){ |
| | | // continue; |
| | | // } |
| | | // BigDecimal bigDecimal = sendPerk(teamPerkMember, cashAmount, teamPerkMember.getId(), code); |
| | | // continue; |
| | | // }else{ |
| | | // BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByInviteId(inviteId); |
| | | // //V1加速团队静态收益的15%=每日静态的20000*6‰*15%=18元的额外释放加速 |
| | | // BigDecimal cashAmount = totalIncomeMember.multiply(cashPercent).multiply(staticRelease).setScale(2, BigDecimal.ROUND_DOWN); |
| | | // if(BigDecimal.ZERO.compareTo(cashAmount) >= 0){ |
| | | // continue; |
| | | // } |
| | | // BigDecimal bigDecimal = sendPerk(teamPerkMember, cashAmount, teamPerkMember.getId(), code); |
| | | // continue; |
| | | // } |
| | | // } |
| | | // BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByInviteId(inviteId); |
| | | // //V1加速团队静态收益的15%=每日静态的20000*6‰*15%=18元的额外释放加速 |
| | | // BigDecimal cashAmount = totalIncomeMember.multiply(cashPercent).multiply(staticRelease).setScale(2, BigDecimal.ROUND_DOWN); |
| | | // if(BigDecimal.ZERO.compareTo(cashAmount) >= 0){ |
| | | // continue; |
| | | // } |
| | | // BigDecimal bigDecimal = sendPerk(teamPerkMember, cashAmount, teamPerkMember.getId(), code); |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | if(BigDecimal.ZERO.compareTo(directReleaseAmount) >= 0){ |
| | | return realScoreReduce; |
| | | } |
| | | //插入积分流水 |
| | | DappFundFlowEntity scoreFlow = new DappFundFlowEntity( |
| | | parentMember.getId(), |
| | | realScoreReduce.negate(), |
| | | FundFlowEnum.REDUCE_SCORE.getCode(), |
| | | DappFundFlowEntity.WITHDRAW_STATUS_AGREE, |
| | | BigDecimal.ZERO, |
| | | orderId); |
| | | dappFundFlowDao.insert(scoreFlow); |
| | | //生成一条静态补贴的流水 |
| | | 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; |