xiaoyong931011
2022-11-16 8dd33964afa3e8a4b1540e857f0270f25994598d
src/main/java/cc/mrbird/febs/dapp/service/impl/ApiIgtOnHookPlanServiceImpl.java
@@ -174,6 +174,9 @@
        long between = DateUtil.between(startTime, DateUtil.date(), DateUnit.MINUTE);
        //获得总收益
        BigDecimal totalProfit = minuteProfit.multiply(new BigDecimal(between));
        if(multiply.compareTo(totalProfit) < 0){
            totalProfit = multiply;
        }
        String refererIds = dappMemberEntity.getRefererIds();
        List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true);
@@ -536,6 +539,7 @@
                .multiply(new BigDecimal(0.01)).setScale(4,BigDecimal.ROUND_DOWN);
        //获取收益
        //获取当前用户每分钟应该获取的收益
        //预期最大收益
        BigDecimal multiply = hangingRevenueLevel.multiply(planAmount);
        DataDictionaryCustom maxHoursDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MAX_HOURS.getType(), DataDictionaryEnum.MAX_HOURS.getCode());
        //挂机总时长(分钟)
@@ -547,6 +551,10 @@
        long between = DateUtil.between(startTime, DateUtil.date(), DateUnit.MINUTE);
        //获得总收益
        BigDecimal totalProfit = minuteProfit.multiply(new BigDecimal(between)).setScale(4,BigDecimal.ROUND_DOWN);
        if(multiply.compareTo(totalProfit) < 0){
            totalProfit = multiply;
        }
//        BigDecimal totalProfit = planAmount.multiply(hangingRevenueLevel).setScale(4,BigDecimal.ROUND_DOWN);
        String refererIds = dappMemberEntity.getRefererIds();
@@ -591,11 +599,8 @@
    }
    @Override
    public void memberCoinInsideMessage(Long withdrawId) {
        MemberCoinWithdrawEntity memberCoinWithdrawEntity = memberCoinWithdrawDao.selectById(withdrawId);
        if(ObjectUtil.isEmpty(memberCoinWithdrawEntity)){
            return;
        }
    public void memberCoinInsideMessage(Long orderId) {
        MemberCoinWithdrawEntity memberCoinWithdrawEntity = memberCoinWithdrawDao.selectById(orderId);
        memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_YES);
        memberCoinWithdrawDao.updateById(memberCoinWithdrawEntity);
        //转出账户,总额减少,冻结减少
@@ -604,16 +609,8 @@
        DappWalletCoinEntity dappWalletCoinEntityOut = dappWalletCoinDao.selectByMemberId(memberIdOut);
        dappWalletCoinDao.delTotalAndDelFrozenById(dappWalletCoinEntityOut.getId(),amount);
        String isInside = memberCoinWithdrawEntity.getIsInside();
        String content = "";
        Integer type = 0;
        if(MemberCoinWithdrawEntity.ISINSIDE_NO.equals(isInside)){
            content = "提现";
            type = 2;
        }else{
            content = "转账";
            type = 4;
        }
        String content = "内部转账";
        Integer type =  4;
        //转出账户生成一条账户资金变化记录
        DappAccountMoneyChangeEntity dappAccountMoneyChangeEntityOut = new DappAccountMoneyChangeEntity(memberIdOut,
                dappWalletCoinEntityOut.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN),
@@ -625,26 +622,18 @@
        //转入账户,总额增加,余额增加
        //转账
        if(MemberCoinWithdrawEntity.ISINSIDE_YES.equals(isInside)){
            String addressIn = memberCoinWithdrawEntity.getAddress();
            DappMemberEntity dappMemberEntityIn = dappMemberDao.selectMemberInfoByInviteId(addressIn);
            if(ObjectUtil.isEmpty(dappMemberEntityIn)){
                return;
            }
            DappWalletCoinEntity dappWalletCoinEntityIn = dappWalletCoinDao.selectByMemberId(dappMemberEntityIn.getId());
            Integer countIn = dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntityIn.getId(), memberCoinWithdrawEntity.getAmount());
            if(1 != countIn){
                return;
            }
            //生成流水记录
            DappAccountMoneyChangeEntity dappAccountMoneyChangeEntityIn = new DappAccountMoneyChangeEntity(dappMemberEntityIn.getId(),
                    dappWalletCoinEntityIn.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN),
                    amount,
                    dappWalletCoinEntityIn.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN).add(amount),
                    "转账",
                    4);
            dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntityIn);
        }
        String addressIn = memberCoinWithdrawEntity.getAddress();
        DappMemberEntity dappMemberEntityIn = dappMemberDao.selectMemberInfoByInviteId(addressIn);
        DappWalletCoinEntity dappWalletCoinEntityIn = dappWalletCoinDao.selectByMemberId(dappMemberEntityIn.getId());
        Integer countIn = dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntityIn.getId(), memberCoinWithdrawEntity.getAmount());
        //生成流水记录
        DappAccountMoneyChangeEntity dappAccountMoneyChangeEntityIn = new DappAccountMoneyChangeEntity(dappMemberEntityIn.getId(),
                dappWalletCoinEntityIn.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN),
                amount,
                dappWalletCoinEntityIn.getTotalAmount().setScale(4,BigDecimal.ROUND_DOWN).add(amount),
                "转账",
                4);
        dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntityIn);
    }
    private String getProfitCase(String identity,BigDecimal balance){