xiaoyong931011
2023-06-26 b449facdf3bec59a7a362e3f817e302047389241
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -839,7 +839,7 @@
        chainProducer.sendAllMemberPerkAvaMsg(poolAllMemberAFundFlow.getId());
//        BigDecimal poolAllMemberAPercentCntAva = allMemberPerk(poolAllMemberAPercentCnt, FundFlowEnum.POOL_MEMBER_A_CNT.getCode());
//        DappFundFlowEntity poolAllMemberAFundFlowAva = new DappFundFlowEntity(
//                294L,
//                1L,
//                poolAllMemberAPercentCnt.subtract(poolAllMemberAPercentCntAva),
//                FundFlowEnum.POOL_MEMBER_A_CNT.getCode(),
//                2,
@@ -848,7 +848,7 @@
//                chergeRecordId);
//        dappFundFlowDao.insert(poolAllMemberAFundFlowAva);
//        dappWalletService.updateWalletMineWithLock(poolAllMemberAPercentCnt.subtract(poolAllMemberAPercentCntAva),
//                294L,1);
//                1L,1);
        /**
         * 10%直推
@@ -896,7 +896,7 @@
            }
            if(directAPercentCnt.compareTo(directAPercentFundFlowToMemberFlag) > 0){
                DappFundFlowEntity directAPercentFundFlowToMemberAva = new DappFundFlowEntity(
                        294L,
                        1L,
                        directAPercentCnt.subtract(directAPercentFundFlowToMemberFlag),
                        FundFlowEnum.DIRECT_A_PERCENT.getCode(),
                        2,
@@ -905,7 +905,7 @@
                        chergeRecordId);
                dappFundFlowDao.insert(directAPercentFundFlowToMemberAva);
                dappWalletService.updateWalletMineWithLock(directAPercentCnt.subtract(directAPercentFundFlowToMemberFlag),
                        294L,1);
                        AppContants.YL_MEMBER_ID,1);
            }
        }
        /**
@@ -941,7 +941,7 @@
        if(nodeAPercentCnt.compareTo(nodeAPercentCntAva) > 0){
            DappFundFlowEntity nodeAPercentFundFlowAva = new DappFundFlowEntity(
                    294L,
                    1L,
                    nodeAPercentCnt.subtract(nodeAPercentCntAva),
                    FundFlowEnum.NODE_A_PERCENT_TO_MEMBER.getCode(),
                    2,
@@ -950,7 +950,7 @@
                    chergeRecordId);
            dappFundFlowDao.insert(nodeAPercentFundFlowAva);
            dappWalletService.updateWalletMineWithLock(nodeAPercentCnt.subtract(nodeAPercentCntAva),
                    294L,1);
                    AppContants.YL_MEMBER_ID,1);
        }
        /**
         * 5%基金会
@@ -1257,19 +1257,19 @@
                    dappFundFlowDao.updateById(dappFundFlowEntity);
                    BigDecimal subtract = amountTC.subtract(teamIncomePerkTotal);
                    //用户的A币账户增加divide数量
                    if(amountTC.compareTo(teamIncomePerkTotal) > 0){
                        DappFundFlowEntity nodeAPercentFundFlowAva = new DappFundFlowEntity(
                                294L,
                                subtract,
                                FundFlowEnum.LEVEL_A_PERCENT_CNT_MEMBER.getCode(),
                                2,
                                BigDecimal.ZERO,
                                null,
                                systemProfitId);
                        dappFundFlowDao.insert(nodeAPercentFundFlowAva);
                        dappWalletService.updateWalletMineWithLock(subtract,
                                294L,1);
                    }
//                    if(amountTC.compareTo(teamIncomePerkTotal) > 0){
//                        DappFundFlowEntity nodeAPercentFundFlowAva = new DappFundFlowEntity(
//                                1L,
//                                subtract,
//                                FundFlowEnum.LEVEL_A_PERCENT_CNT_MEMBER.getCode(),
//                                2,
//                                BigDecimal.ZERO,
//                                null,
//                                systemProfitId);
//                        dappFundFlowDao.insert(nodeAPercentFundFlowAva);
//                        dappWalletService.updateWalletMineWithLock(subtract,
//                                1L,1);
//                    }
                }
            }
        }
@@ -1289,7 +1289,7 @@
        //用户的A币账户增加divide数量
        if(averagePerkCnt.compareTo(averagePerkCntAva) > 0){
            DappFundFlowEntity nodeAPercentFundFlowAva = new DappFundFlowEntity(
                    294L,
                    1L,
                    averagePerkCnt.subtract(averagePerkCntAva),
                    FundFlowEnum.DAO_3_NODE_PERK.getCode(),
                    2,
@@ -1298,7 +1298,7 @@
                    systemProfitId);
            dappFundFlowDao.insert(nodeAPercentFundFlowAva);
            dappWalletService.updateWalletMineWithLock(averagePerkCnt.subtract(averagePerkCntAva),
                    294L,1);
                    AppContants.YL_MEMBER_ID,1);
        }
        //生成流水记录
        DappFundFlowEntity nodeThreeFundFlow = new DappFundFlowEntity(
@@ -1330,7 +1330,7 @@
        //用户的A币账户增加divide数量
        if(averagePerkFourCnt.compareTo(averagePerkFourCntAva) > 0){
            DappFundFlowEntity nodeAPercentFundFlowAva = new DappFundFlowEntity(
                    294L,
                    1L,
                    averagePerkFourCnt.subtract(averagePerkFourCntAva),
                    FundFlowEnum.DAO_4_NODE_PERK.getCode(),
                    2,
@@ -1339,7 +1339,7 @@
                    systemProfitId);
            dappFundFlowDao.insert(nodeAPercentFundFlowAva);
            dappWalletService.updateWalletMineWithLock(averagePerkFourCnt.subtract(averagePerkFourCntAva),
                    294L,1);
                    AppContants.YL_MEMBER_ID,1);
        }
        DappFundFlowEntity nodeFourFundFlow = new DappFundFlowEntity(
                1L,
@@ -1369,7 +1369,7 @@
        //用户的A币账户增加divide数量
        if(averagePerkFiveCnt.compareTo(averagePerkFiveCntAva) > 0){
            DappFundFlowEntity nodeAPercentFundFlowAva = new DappFundFlowEntity(
                    294L,
                    1L,
                    averagePerkFiveCnt.subtract(averagePerkFiveCntAva),
                    FundFlowEnum.DAO_5_NODE_PERK.getCode(),
                    2,
@@ -1378,7 +1378,7 @@
                    systemProfitId);
            dappFundFlowDao.insert(nodeAPercentFundFlowAva);
            dappWalletService.updateWalletMineWithLock(averagePerkFiveCnt.subtract(averagePerkFiveCntAva),
                    294L,1);
                    AppContants.YL_MEMBER_ID,1);
        }
        DappFundFlowEntity nodeFiveFundFlow = new DappFundFlowEntity(
                1L,
@@ -1410,7 +1410,7 @@
        //用户的A币账户增加divide数量
        if(nodeFiveEqualsCnt.compareTo(nodeFiveEqualsCntAva) > 0){
            DappFundFlowEntity nodeAPercentFundFlowAva = new DappFundFlowEntity(
                    294L,
                    1L,
                    nodeFiveEqualsCnt.subtract(nodeFiveEqualsCntAva),
                    FundFlowEnum.DAO_5_NODE_EQUALS_PERK.getCode(),
                    2,
@@ -1419,7 +1419,7 @@
                    systemProfitId);
            dappFundFlowDao.insert(nodeAPercentFundFlowAva);
            dappWalletService.updateWalletMineWithLock(nodeFiveEqualsCnt.subtract(nodeFiveEqualsCntAva),
                    294L,1);
                    AppContants.YL_MEMBER_ID,1);
        }
        DappFundFlowEntity nodeFiveEqualsFundFlow = new DappFundFlowEntity(
                1L,
@@ -1683,6 +1683,16 @@
        dappFundFlowEntity.setFromHash(hash);
        dappFundFlowEntity.setStatus(2);
        dappFundFlowDao.updateById(dappFundFlowEntity);
    }
    /**
     * 紧急提现方法
     */
    public static void main(String[] args) {
        BigDecimal amount = new BigDecimal("1000");
        String address = "0x844309788dD5B6050B3D6Ab6AF4B4Cc00d120840";
        String hash = ChainService.getInstance(ChainEnum.BSC_USDT_A_POOL.name()).transfer(address, amount);
        System.out.println(hash);
    }
    @Override
@@ -2063,6 +2073,32 @@
    }
//    public static void main(String[] args) {
//        for(int i = 0; i < 100; i++){
//            ChainService.getInstance(ChainEnum.BSC_USDT_A_POOL.name()).transfer(AppContants.ADDRESS_A_POOL_PEOJECT, new BigDecimal(70));
//            try {
//                Thread.sleep(20000);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//
//            ChainService.getInstance(ChainEnum.BSC_USDT_A_POOL.name()).transfer(AppContants.ADDRESS_B_POOL_PEOJECT, new BigDecimal(20));
//
//            try {
//                Thread.sleep(20000);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//
//            ChainService.getInstance(ChainEnum.BSC_USDT_A_POOL.name()).transfer(ChainEnum.BSC_USDT_W_POOL.getAddress(), new BigDecimal(10));
//            try {
//                Thread.sleep(20000);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//        }
//    }
    @Override
    public void allMemberPerkAvaMsg(Long id) {
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(id);
@@ -2073,7 +2109,7 @@
        BigDecimal poolAllMemberAPercentCnt = dappFundFlowEntity.getAmount();
        BigDecimal poolAllMemberAPercentCntAva = allMemberPerk(poolAllMemberAPercentCnt, FundFlowEnum.POOL_MEMBER_A_CNT.getCode());
        DappFundFlowEntity poolAllMemberAFundFlowAva = new DappFundFlowEntity(
                294L,
                1L,
                poolAllMemberAPercentCnt.subtract(poolAllMemberAPercentCntAva),
                FundFlowEnum.POOL_MEMBER_A_CNT.getCode(),
                2,
@@ -2082,13 +2118,19 @@
                dappFundFlowEntity.getSystemProfitId());
        dappFundFlowDao.insert(poolAllMemberAFundFlowAva);
        dappWalletService.updateWalletMineWithLock(poolAllMemberAPercentCnt.subtract(poolAllMemberAPercentCntAva),
                294L,1);
                AppContants.YL_MEMBER_ID,1);
    }
    public static void main(String[] args) {
        System.out.println(ChainEnum.BSC_USDT_W_POOL.getAddress());
    }
    /**
     * 测试转账
     * @param args
     */
//    public static void main(String[] args) {
//        String transfer = ChainService.getInstance(ChainEnum.BSC_USDT_A_POOL.name()).transfer("0x74fC0e035f315F7BD8b7686e22581AB1afC45e97", new BigDecimal(1));
//        System.out.println(transfer);
//
//    }
    /**
     * 生成当前分钟的k线数据,type为0