xiaoyong931011
2023-08-18 6c75b0c0fd6862b0d10793821db7017341a6a771
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -2456,6 +2456,7 @@
        BigDecimal donateScore = amount.multiply(donateScorePercent);
        dappWalletMineDao.updateBalance(donateScore,donateScore,memberId);
        DappFundFlowEntity donateScoreFlow = new DappFundFlowEntity(
                AccountFlowEnum.SCORE.getCode(),
                memberId,
                donateScore,
                FundFlowEnum.DONATE_SCORE.getCode(),
@@ -2471,6 +2472,16 @@
                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
@@ -2487,7 +2498,6 @@
                    DataDictionaryEnum.PACKAGE_SCORE_PRICE.getType(),
                    DataDictionaryEnum.PACKAGE_SCORE_PRICE.getCode()
            );
            //卖出积分直接销毁。
            DataDictionaryCustom packageTotalScoreDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                    DataDictionaryEnum.PACKAGE_TOTAL_SCORE.getType(),
                    DataDictionaryEnum.PACKAGE_TOTAL_SCORE.getCode()
@@ -2503,9 +2513,25 @@
            packagePoorDic.setValue(avaPackagePoor.toString());
            dataDictionaryCustomMapper.updateById(packagePoorDic);
            //计算当前价格
            BigDecimal divide = avaPackagePoor.divide(packageTotalScore, 2, BigDecimal.ROUND_DOWN);
            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);
        }
    }
@@ -2781,9 +2807,16 @@
            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();
@@ -2792,18 +2825,20 @@
                        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.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);
@@ -2836,7 +2871,7 @@
         * 获取用户前一天的所有返利记录
         */
        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);
@@ -2859,41 +2894,50 @@
        List<DappMemberEntity> dappMemberEntities = dappMemberDao.selectMemberByAccountType(MemberLevelEnum.V1.getType());
        shareStaticPerk(dappMemberEntities,FundFlowEnum.SHARE_PERK_V1.getCode());
        teamStaticPerkMemberLevel(dappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V1.getCode());
        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());
        shareStaticPerk(v2DappMemberEntities,FundFlowEnum.SHARE_PERK_V2.getCode());
        teamStaticPerkMemberLevel(v2DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V2.getCode());
        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());
        shareStaticPerk(v3DappMemberEntities,FundFlowEnum.SHARE_PERK_V3.getCode());
        teamStaticPerkMemberLevel(v3DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V3.getCode());
        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());
        shareStaticPerk(v4DappMemberEntities,FundFlowEnum.SHARE_PERK_V4.getCode());
        teamStaticPerkMemberLevel(v4DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V4.getCode());
        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());
        shareStaticPerk(v5DappMemberEntities,FundFlowEnum.SHARE_PERK_V5.getCode());
        teamStaticPerkMemberLevel(v5DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V5.getCode());
        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());
        shareStaticPerk(v6DappMemberEntities,FundFlowEnum.SHARE_PERK_V6.getCode());
        teamStaticPerkMemberLevel(v6DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V6.getCode());
        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());
        shareStaticPerk(v7DappMemberEntities,FundFlowEnum.SHARE_PERK_V7.getCode());
        teamStaticPerkMemberLevel(v7DappMemberEntities,teamPerkEquals,staticRelease,FundFlowEnum.TEAM_PERK_V7.getCode());
        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();
@@ -2906,7 +2950,7 @@
            BigDecimal amountMagic = amount;
            List<MallAchieveRecord> mallAchieveRecords = mallAchieveRecordMapper.selectListByMemberId(memberId);
            if(CollUtil.isEmpty(mallAchieveRecords)){
                return;
                continue;
            }
            //实际获取总收益
            BigDecimal localTotalAchieve = BigDecimal.ZERO;
@@ -2942,7 +2986,9 @@
                 */
                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);
@@ -2978,12 +3024,13 @@
                    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(),
@@ -3009,11 +3056,12 @@
                    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(),
@@ -3028,19 +3076,30 @@
            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,
                    maxReleaseMember,
                    localTotalAchieve,
                    FundFlowEnum.AMOUNT_RECORD.getCode(),
                    null);
                    AccountFlowEnum.AMOUNT_RECORD.getCode(),
                    content.toString());
            dappAccountMoneyChangeDao.insert(record);
            //实时更新用户等级
            chainProducer.sendAutoLevelUpTeamMsg(memberId);
        }
            set.add(dappMemberEntity);
        }
        return set;
    }
    @Override
@@ -3049,6 +3108,9 @@
        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);
@@ -3059,33 +3121,35 @@
                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 packageScorePrice = new BigDecimal(ObjectUtil.isEmpty(packageScorePriceDic) ? "0" : packageScorePriceDic.getValue()).setScale(8, BigDecimal.ROUND_DOWN);
        //卖出资产乘以价格获取到预期获取的总额
        BigDecimal totalAmount = cnt.multiply(packageScorePrice).setScale(2, 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(2, BigDecimal.ROUND_DOWN);
        BigDecimal packageToPoorPercent = new BigDecimal(ObjectUtil.isEmpty(packageToPoorPercentDic) ? "0.1" : packageToPoorPercentDic.getValue()).setScale(8, BigDecimal.ROUND_DOWN);
        //划入底池的金额
        BigDecimal poorAmount = totalAmount.multiply(packageToPoorPercent).setScale(2, 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_ING,
                DappFundFlowEntity.WITHDRAW_STATUS_AGREE,
                BigDecimal.ZERO);
        dappFundFlowDao.insert(scoreFlow);
        dappWalletCoinDao.addTotalAndaddAvailableByMemberId(memberId,realAmount);
        DappFundFlowEntity feeFlow = new DappFundFlowEntity(
                AccountFlowEnum.AMOUNT.getCode(),
                memberId,
                poorAmount,
                poorAmount.negate(),
                FundFlowEnum.SALE_PACKAGE_AMOUNT_FEE.getCode(),
                DappFundFlowEntity.WITHDRAW_STATUS_ING,
                DappFundFlowEntity.WITHDRAW_STATUS_AGREE,
                BigDecimal.ZERO);
        dappFundFlowDao.insert(feeFlow);
@@ -3094,7 +3158,7 @@
                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);
        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);
@@ -3103,14 +3167,87 @@
                DataDictionaryEnum.PACKAGE_POOR.getType(),
                DataDictionaryEnum.PACKAGE_POOR.getCode()
        );
        BigDecimal packagePoor = new BigDecimal(ObjectUtil.isEmpty(packagePoorDic) ? "0" : packagePoorDic.getValue()).setScale(2, BigDecimal.ROUND_DOWN);
        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, 2, BigDecimal.ROUND_DOWN);
        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);
        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()).setScale(2, BigDecimal.ROUND_DOWN);
        for(DappMemberEntity dappMemberEntity : dappMemberEntities){
            List<DappFundFlowEntity> dappFundFlowEntities = dappFundFlowDao.selectListByMemberIdAndTypeAndDate(dappMemberEntity.getId()
                    , FundFlowEnum.ADD_AMOUNT_REAL.getCode()
                    , DateUtil.offsetHour(DateUtil.date(), -12));
            //总收益
            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(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);
        }
    }
    public void shareStaticPerk(List<DappMemberEntity> dappMemberEntities,
@@ -3151,6 +3288,47 @@
                sharePerk = maxSharePerk;
            }
            sendPerk(dappMemberEntity, sharePerk, dappMemberEntity.getId(), code);
        }
    }
    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);
        }
    }
@@ -3208,31 +3386,37 @@
        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;