xiaoyong931011
2022-10-26 e92fd4ee90a7296fcb2336409d128dfd1bf653f4
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -860,184 +860,176 @@
    @Override
    public BigDecimal updateLSYJYLFC(List<String> refererIdList,BigDecimal totalProfit) {
        //计算盈利分成
//        if(CollUtil.isNotEmpty(refererIdList)){
//            String LEVEL_IB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_IB.getCode());
//            if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
//                BigDecimal multiply = totalProfit.multiply(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
//                DappMemberEntity dappMemberEntityLEVEL_IB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_IB);
//
//                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_IB.getId(),multiply);
//                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
//                        dappMemberEntityLEVEL_IB.getId(), multiply, "盈利分成", 8);
//                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
//                totalProfit = totalProfit.subtract(multiply);
//            }
//            String LEVEL_FIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_FIB.getCode());
//            if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
//                BigDecimal multiply = BigDecimal.ZERO;
//                if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
//                }else{
//                    multiply = totalProfit.multiply(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
//                }
//                DappMemberEntity dappMemberEntityLEVEL_FIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_FIB);
//
//                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_FIB.getId(),multiply);
//                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
//                        dappMemberEntityLEVEL_FIB.getId(), multiply, "盈利分成", 8);
//                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
//                totalProfit = totalProfit.subtract(multiply);
//            }
//            String LEVEL_CIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_CIB.getCode());
//            if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
//                BigDecimal multiply = BigDecimal.ZERO;
//                if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
//                }
//                multiply = totalProfit.multiply(multiply);
//                DappMemberEntity dappMemberEntityLEVEL_CIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_CIB);
//                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_CIB.getId(),multiply);
//                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
//                        dappMemberEntityLEVEL_CIB.getId(), multiply, "盈利分成", 8);
//                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
//                totalProfit = totalProfit.subtract(multiply);
//            }
//            String LEVEL_AIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_AIB.getCode());
//            if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
//                BigDecimal multiply = BigDecimal.ZERO;
//                if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()));
//                }
//                multiply = totalProfit.multiply(multiply);
//                DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB);
//                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_AIB.getId(),multiply);
//                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
//                        dappMemberEntityLEVEL_AIB.getId(), multiply, "盈利分成", 8);
//                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
//                totalProfit = totalProfit.subtract(multiply);
//            }
//            String LEVEL_GIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GIB.getCode());
//            if(!DataDictionaryEnum.LEVEL_GIB.getCode().equals(LEVEL_GIB)){
//                BigDecimal multiply = BigDecimal.ZERO;
//                if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()));
//                }
//                multiply = totalProfit.multiply(multiply);
//                DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB);
//                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_GIB.getId(),multiply);
//                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
//                        dappMemberEntityLEVEL_GIB.getId(), multiply, "盈利分成", 8);
//                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
//                totalProfit = totalProfit.subtract(multiply);
//            }
//            String LEVEL_BP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_BP.getCode());
//            if(!DataDictionaryEnum.LEVEL_BP.getCode().equals(LEVEL_BP)){
//                BigDecimal multiply = BigDecimal.ZERO;
//                if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_GIB.getCode().equals(LEVEL_GIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()));
//                }
//                multiply = totalProfit.multiply(multiply);
//                DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP);
//                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_BP.getId(),multiply);
//                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
//                        dappMemberEntityLEVEL_BP.getId(), multiply, "盈利分成", 8);
//                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
//                totalProfit = totalProfit.subtract(multiply);
//            }
//            String LEVEL_SP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_SP.getCode());
//            if(!DataDictionaryEnum.LEVEL_SP.getCode().equals(LEVEL_SP)){
//                BigDecimal multiply = BigDecimal.ZERO;
//                if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_GIB.getCode().equals(LEVEL_GIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_BP.getCode().equals(LEVEL_BP)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()));
//                }
//                multiply = totalProfit.multiply(multiply);
//                DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP);
//                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_SP.getId(),multiply);
//                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
//                        dappMemberEntityLEVEL_SP.getId(), multiply, "盈利分成", 8);
//                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
//                totalProfit = totalProfit.subtract(multiply);
//            }
//            String LEVEL_GP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GP.getCode());
//            if(!DataDictionaryEnum.LEVEL_GP.getCode().equals(LEVEL_GP)){
//                BigDecimal multiply = BigDecimal.ZERO;
//                if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_GIB.getCode().equals(LEVEL_GIB)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_BP.getCode().equals(LEVEL_BP)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()));
//                }
//                if(!DataDictionaryEnum.LEVEL_SP.getCode().equals(LEVEL_SP)){
//                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode()));
//                }
//                multiply = totalProfit.multiply(multiply);
//                DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP);
//                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_GP.getId(),multiply);
//                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
//                        dappMemberEntityLEVEL_GP.getId(), multiply, "盈利分成", 8);
//                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
//                totalProfit = totalProfit.subtract(multiply);
//            }
//
//
//        }
        BigDecimal profitSharingTotal = BigDecimal.ZERO;
        if(CollUtil.isNotEmpty(refererIdList)){
            String LEVEL_IB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_IB.getCode());
            if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
                BigDecimal multiply = totalProfit.multiply(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
                DappMemberEntity dappMemberEntityLEVEL_IB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_IB);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_IB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_IB.getId(), multiply, "盈利分成", 8);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_FIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_FIB.getCode());
            if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
                BigDecimal multiply = BigDecimal.ZERO;
                if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
                }else{
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode());
                }
                multiply = totalProfit.multiply(multiply);
                DappMemberEntity dappMemberEntityLEVEL_FIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_FIB);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_FIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_FIB.getId(), multiply, "盈利分成", 8);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_CIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_CIB.getCode());
            if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
                BigDecimal multiply = BigDecimal.ZERO;
                if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
                }else{
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode());
                }
                multiply = totalProfit.multiply(multiply);
                DappMemberEntity dappMemberEntityLEVEL_CIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_CIB);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_CIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_CIB.getId(), multiply, "盈利分成", 8);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_AIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_AIB.getCode());
            if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
                BigDecimal multiply = BigDecimal.ZERO;
                if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
                }else{
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode());
                }
                multiply = totalProfit.multiply(multiply);
                DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_AIB.getId(), multiply, "盈利分成", 8);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_GIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GIB.getCode());
            if(!DataDictionaryEnum.LEVEL_GIB.getCode().equals(LEVEL_GIB)){
                BigDecimal multiply = BigDecimal.ZERO;
                if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
                }else{
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode());
                }
                multiply = totalProfit.multiply(multiply);
                DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_GIB.getId(), multiply, "盈利分成", 8);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_BP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_BP.getCode());
            if(!DataDictionaryEnum.LEVEL_BP.getCode().equals(LEVEL_BP)){
                BigDecimal multiply = BigDecimal.ZERO;
                if(!DataDictionaryEnum.LEVEL_GIB.getCode().equals(LEVEL_GIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
                }else{
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode());
                }
                multiply = totalProfit.multiply(multiply);
                DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_BP.getId(), multiply, "盈利分成", 8);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_SP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_SP.getCode());
            if(!DataDictionaryEnum.LEVEL_SP.getCode().equals(LEVEL_SP)){
                BigDecimal multiply = BigDecimal.ZERO;
                if(!DataDictionaryEnum.LEVEL_BP.getCode().equals(LEVEL_BP)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_GIB.getCode().equals(LEVEL_GIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
                }else{
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode());
                }
                multiply = totalProfit.multiply(multiply);
                DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_SP.getId(), multiply, "盈利分成", 8);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_GP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GP.getCode());
            if(!DataDictionaryEnum.LEVEL_GP.getCode().equals(LEVEL_GP)){
                BigDecimal multiply = BigDecimal.ZERO;
                if(!DataDictionaryEnum.LEVEL_SP.getCode().equals(LEVEL_SP)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_SP.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_BP.getCode().equals(LEVEL_BP)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_BP.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_GIB.getCode().equals(LEVEL_GIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_GIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_AIB.getCode().equals(LEVEL_AIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_AIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_CIB.getCode().equals(LEVEL_CIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_CIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_FIB.getCode().equals(LEVEL_FIB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_FIB.getCode()));
                }else if(!DataDictionaryEnum.LEVEL_IB.getCode().equals(LEVEL_IB)){
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GP.getCode()).subtract(getProfitSharing(DataDictionaryEnum.LEVEL_IB.getCode()));
                }else{
                    multiply = getProfitSharing(DataDictionaryEnum.LEVEL_GP.getCode());
                }
                multiply = totalProfit.multiply(multiply);
                DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_GP.getId(), multiply, "盈利分成", 8);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
        }
        //计算流水佣金
        if(CollUtil.isNotEmpty(refererIdList)){
            String LEVEL_AIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_AIB.getCode());
@@ -1045,11 +1037,11 @@
                BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_AIB.getCode()));
                DappMemberEntity dappMemberEntityLEVEL_AIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_AIB);
                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_AIB.getId(),multiply);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_AIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_AIB.getId(), multiply, "流水佣金", 7);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                totalProfit = totalProfit.subtract(multiply);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_GIB = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GIB.getCode());
@@ -1057,11 +1049,11 @@
                BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_GIB.getCode()));
                DappMemberEntity dappMemberEntityLEVEL_GIB = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GIB);
                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_GIB.getId(),multiply);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GIB.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_GIB.getId(), multiply, "流水佣金", 7);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                totalProfit = totalProfit.subtract(multiply);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_BP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_BP.getCode());
@@ -1069,11 +1061,11 @@
                BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_BP.getCode()));
                DappMemberEntity dappMemberEntityLEVEL_BP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_BP);
                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_BP.getId(),multiply);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_BP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_BP.getId(), multiply, "流水佣金", 7);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                totalProfit = totalProfit.subtract(multiply);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_SP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_SP.getCode());
@@ -1081,11 +1073,11 @@
                BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_SP.getCode()));
                DappMemberEntity dappMemberEntityLEVEL_SP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_SP);
                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_SP.getId(),multiply);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_SP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_SP.getId(), multiply, "流水佣金", 7);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                totalProfit = totalProfit.subtract(multiply);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
            String LEVEL_GP = isIdentity(refererIdList, DataDictionaryEnum.LEVEL_GP.getCode());
@@ -1093,14 +1085,14 @@
                BigDecimal multiply = totalProfit.multiply(getRunningCommission(DataDictionaryEnum.LEVEL_GP.getCode()));
                DappMemberEntity dappMemberEntityLEVEL_GP = dappMemberDao.selectMemberInfoByInviteId(LEVEL_GP);
                dappWalletCoinDao.addTotalAndaddAvailableById(dappMemberEntityLEVEL_GP.getId(),multiply);
                dappWalletCoinDao.addTotalAndaddAvailableByMemberId(dappMemberEntityLEVEL_GP.getId(),multiply);
                DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                        dappMemberEntityLEVEL_GP.getId(), multiply, "流水佣金", 7);
                dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
                totalProfit = totalProfit.subtract(multiply);
                profitSharingTotal = profitSharingTotal.add(multiply);
            }
        }
        return totalProfit;
        return profitSharingTotal;
    }
    @Override
@@ -1109,8 +1101,7 @@
        DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(
                memberId, multiply, "系统", 9);
        dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity);
        totalProfit = totalProfit.subtract(multiply);
        return totalProfit;
        return multiply;
    }
    private String isIdentity(List<String> refererIds,String levelCode){
@@ -1121,6 +1112,7 @@
                String identity = dappMemberEntity.getIdentity();
                if(levelCode.equals(identity)){
                    flag = str;
                    return flag;
                }
            }
        }