| | |
| | | |
| | | import cc.mrbird.febs.common.configure.i18n.MessageSourceUtils; |
| | | 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; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | |
| | | import cc.mrbird.febs.dapp.mapper.*; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.dapp.utils.BoxUtil; |
| | | import cc.mrbird.febs.dapp.vo.ActiveNftListVo; |
| | | import cc.mrbird.febs.dapp.vo.DappFundFlowVo; |
| | | import cc.mrbird.febs.dapp.vo.DappMemberNodeVo; |
| | | import cc.mrbird.febs.dapp.vo.WalletInfoVo; |
| | | import cc.mrbird.febs.dapp.vo.*; |
| | | import cc.mrbird.febs.rabbit.producer.ChainProducer; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateField; |
| | |
| | | if ("upgrade".equals(upgrade)) { |
| | | throw new FebsException("功能升级中"); |
| | | } |
| | | BigDecimal amountIn = transferAusdDto.getAmount(); |
| | | if(BigDecimal.ZERO.compareTo(amountIn) >= 0){ |
| | | throw new FebsException("请输入正确的金额"); |
| | | } |
| | | |
| | | /** |
| | | * 充值 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<DappFundFlowVo> getRecordVoInPage(RecordInPageDto recordInPageDto) { |
| | | public IPage<DappFundFlowVo> getRecordVoInPage(RecordInPageDto recordInPageDto) { |
| | | Page<DappFundFlowVo> page = new Page<>(recordInPageDto.getPageNum(), recordInPageDto.getPageSize()); |
| | | |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | |
| | | if (recordInPageDto.getType() != null && recordInPageDto.getType() != 0) { |
| | | dappFundFlowEntity.setType(recordInPageDto.getType()); |
| | | } |
| | | dappFundFlowEntity.setFlowType(recordInPageDto.getFlowType()); |
| | | dappFundFlowEntity.setMemberId(member.getId()); |
| | | IPage<DappFundFlowVo> records = dappFundFlowDao.selectVoInPage(page, dappFundFlowEntity); |
| | | return records.getRecords(); |
| | | return records; |
| | | } |
| | | |
| | | @Override |
| | |
| | | // dappMemberEntity.getId()); |
| | | // dappFundFlowDao.insert(aCoinCntFlowParent); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse withdrawAgree(Long id) { |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(id); |
| | | |
| | | if(FundFlowEnum.WITHDRAW_USDT.getCode() != dappFundFlowEntity.getType()){ |
| | | return new FebsResponse().fail().message("该记录不存在"); |
| | | } |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_ING != dappFundFlowEntity.getStatus()){ |
| | | return new FebsResponse().fail().message("提现记录不是进行中状态"); |
| | | } |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(dappFundFlowEntity.getMemberId()); |
| | | if(ObjectUtil.isEmpty(dappMemberEntity)) { |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | MemberCoinWithdrawEntity memberCoinWithdrawEntity = memberCoinWithdrawDao.selectByFlowId(dappMemberEntity.getId(),dappFundFlowEntity.getId()); |
| | | if(ObjectUtil.isEmpty(memberCoinWithdrawEntity)){ |
| | | return new FebsResponse().fail().message("该记录不存在"); |
| | | } |
| | | if(MemberCoinWithdrawEntity.STATUS_DOING != memberCoinWithdrawEntity.getStatus()){ |
| | | return new FebsResponse().fail().message("提现记录不是进行中状态"); |
| | | } |
| | | dappFundFlowEntity.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_AGREE); |
| | | dappFundFlowDao.updateById(dappFundFlowEntity); |
| | | |
| | | memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_YES); |
| | | memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_NO); |
| | | memberCoinWithdrawDao.updateById(memberCoinWithdrawEntity); |
| | | |
| | | /** |
| | | * 提现手续费10%进入资产管理池 |
| | | * USDT_ORDER_PERCENT |
| | | */ |
| | | BigDecimal withdrawFee = dappFundFlowEntity.getFee(); |
| | | if(BigDecimal.ZERO.compareTo(withdrawFee) < 0){ |
| | | BigDecimal addPoor = withdrawFee; |
| | | |
| | | DataDictionaryCustom packageScorePriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_SCORE_PRICE.getType(), |
| | | DataDictionaryEnum.PACKAGE_SCORE_PRICE.getCode() |
| | | ); |
| | | DataDictionaryCustom packageTotalScoreDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | 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); |
| | | //更新USDT底池 |
| | | DataDictionaryCustom packagePoorDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.PACKAGE_POOR.getType(), |
| | | DataDictionaryEnum.PACKAGE_POOR.getCode() |
| | | ); |
| | | BigDecimal packagePoor = new BigDecimal(ObjectUtil.isEmpty(packagePoorDic) ? "0" : packagePoorDic.getValue()).setScale(2, BigDecimal.ROUND_DOWN); |
| | | BigDecimal avaPackagePoor = packagePoor.add(addPoor); |
| | | packagePoorDic.setValue(avaPackagePoor.toString()); |
| | | dataDictionaryCustomMapper.updateById(packagePoorDic); |
| | | //计算当前价格 |
| | | BigDecimal divide = avaPackagePoor.divide(packageTotalScore, 8, BigDecimal.ROUND_DOWN); |
| | | packageScorePriceDic.setValue(divide.toString()); |
| | | dataDictionaryCustomMapper.updateById(packageScorePriceDic); |
| | | } |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse withdrawDisAgree(Long id) { |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(id); |
| | | |
| | | if(FundFlowEnum.WITHDRAW_USDT.getCode() != dappFundFlowEntity.getType()){ |
| | | return new FebsResponse().fail().message("该记录不存在"); |
| | | } |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_ING != dappFundFlowEntity.getStatus()){ |
| | | return new FebsResponse().fail().message("提现记录不是进行中状态"); |
| | | } |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(dappFundFlowEntity.getMemberId()); |
| | | if(ObjectUtil.isEmpty(dappMemberEntity)) { |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | MemberCoinWithdrawEntity memberCoinWithdrawEntity = memberCoinWithdrawDao.selectByFlowId(dappMemberEntity.getId(),dappFundFlowEntity.getId()); |
| | | if(ObjectUtil.isEmpty(memberCoinWithdrawEntity)){ |
| | | return new FebsResponse().fail().message("该记录不存在"); |
| | | } |
| | | if(MemberCoinWithdrawEntity.STATUS_DOING != memberCoinWithdrawEntity.getStatus()){ |
| | | return new FebsResponse().fail().message("提现记录不是进行中状态"); |
| | | } |
| | | dappFundFlowEntity.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_DISAGREE); |
| | | dappFundFlowDao.updateById(dappFundFlowEntity); |
| | | |
| | | memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_NO); |
| | | memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_NO); |
| | | memberCoinWithdrawDao.updateById(memberCoinWithdrawEntity); |
| | | //增加余额 |
| | | this.updateWalletCoinWithLock(dappFundFlowEntity.getAmount().negate(), dappMemberEntity.getId(), 1); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse getChangeInPageInPage(ChangeInPageDto changeInPageDto) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | Long memberId = member.getId(); |
| | | changeInPageDto.setMemberId(memberId); |
| | | Page<DappAccountMoneyChangeEntity> page = new Page<>(changeInPageDto.getPageNum(), changeInPageDto.getPageSize()); |
| | | IPage<DappAccountMoneyChangeEntity> memberMoneyFlowVos = dappAccountMoneyChangeDao.getChangeInPageInPage(page,changeInPageDto); |
| | | return new FebsResponse().success().data(memberMoneyFlowVos); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse changeInToday() { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | Long memberId = member.getId(); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = dappAccountMoneyChangeDao.selectNewOneByMemberId(memberId); |
| | | return new FebsResponse().success().data(dappAccountMoneyChangeEntity); |
| | | } |
| | | } |