| | |
| | | package cc.mrbird.febs.dapp.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | |
| | | BigDecimal runPerk = dappFundFlowDao.selectSumRunPerkByMemberId(member.getId()); |
| | | walletInfo.setRunPerk(runPerk); |
| | | |
| | | |
| | | // List<DappMemberEntity> dappMemberEntities = dappMemberDao.selectList(null); |
| | | List<DappStorage> allAddressNums = dappStorageMapper.selectListGroupByMemberId(); |
| | | walletInfo.setAddressNum(CollUtil.isEmpty(allAddressNums) ? 0 : allAddressNums.size()); |
| | | |
| | |
| | | |
| | | DappMemberEntity memberEntity = dappMemberDao.selectById(member.getId()); |
| | | BigDecimal usdtBalance = memberEntity.getUsdtBalance(); |
| | | if(BigDecimal.ZERO.compareTo(usdtBalance) >= 0){ |
| | | throw new FebsException("额度不足"); |
| | | } |
| | | if(1 != memberEntity.getNodeType()){ |
| | | if(BigDecimal.ZERO.compareTo(usdtBalance) >= 0){ |
| | | throw new FebsException("额度不足"); |
| | | } |
| | | |
| | | if(BigDecimal.ZERO.compareTo(withdrawDto.getAmount()) >= 0){ |
| | | throw new FebsException("请输入正确的数量"); |
| | | if(BigDecimal.ZERO.compareTo(withdrawDto.getAmount()) >= 0){ |
| | | throw new FebsException("请输入正确的数量"); |
| | | } |
| | | if(withdrawDto.getAmount().compareTo(usdtBalance) > 0){ |
| | | throw new FebsException("额度不足"); |
| | | } |
| | | }else{ |
| | | if(BigDecimal.ZERO.compareTo(withdrawDto.getAmount()) >= 0){ |
| | | throw new FebsException("请输入正确的数量"); |
| | | } |
| | | } |
| | | if(withdrawDto.getAmount().compareTo(usdtBalance) > 0){ |
| | | throw new FebsException("额度不足"); |
| | | } |
| | | |
| | | // List<MemberCoinWithdrawEntity> memberCoinWithdrawEntities = memberCoinWithdrawDao.selectListByDate(member.getId(),new Date()); |
| | | // if(CollUtil.isNotEmpty(memberCoinWithdrawEntities)){ |
| | | // throw new FebsException("今日已提现"); |
| | |
| | | BigDecimal feeAmount = withdrawDto.getAmount().multiply(withdrawPercent).setScale(2, BigDecimal.ROUND_DOWN); |
| | | |
| | | updateWalletCoinWithLock(withdrawDto.getAmount(), member.getId(), 2); |
| | | |
| | | memberEntity.setUsdtBalance(usdtBalance.subtract(withdrawDto.getAmount()).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | dappMemberDao.updateById(memberEntity); |
| | | if(1 != memberEntity.getNodeType()){ |
| | | memberEntity.setUsdtBalance(usdtBalance.subtract(withdrawDto.getAmount()).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | dappMemberDao.updateById(memberEntity); |
| | | } |
| | | |
| | | DappFundFlowEntity fundFlow = new DappFundFlowEntity( |
| | | member.getId(), |
| | |
| | | DataDictionaryEnum.BUCAHNG_CHI.getCode() |
| | | ).getValue()); |
| | | List<DappStorage> dappStorages = dappStorageMapper.selectList(null); |
| | | BigDecimal reduce = dappStorages.stream().map(DappStorage::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2,BigDecimal.ROUND_DOWN); |
| | | apiIndexInfoVo.setJiedianChi(reduce.toString()); |
| | | BigDecimal reduce = dappStorages.stream().map(DappStorage::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal bigDecimal = reduce.multiply(new BigDecimal(AppContants.DAO_NODE_PERCENT)).setScale(2, BigDecimal.ROUND_DOWN); |
| | | apiIndexInfoVo.setJiedianChi(bigDecimal.toString()); |
| | | |
| | | // apiIndexInfoVo.setJiedianChi(dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | // DataDictionaryEnum.JIE_DIAN_CHI.getType(), |