| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import freemarker.template.utility.StringUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String ss = "0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7,0xd5c13dc4372d1e02b93add9dcca901bef51168be,0xe22bb5fB2e0F8ED9366785dADD33cA19355d037c,0x7685E62E679886494E3cdc3DE7103E026f815AF0,0x6893bE8F4fb73595A13f32bA5e1d198Ab135516C"; |
| | | // if(ss.contains("0xd5c13dc4372d1e02b93add9dcca901bef51168be")){ |
| | | // System.out.println(1); |
| | | // }else{ |
| | | // System.out.println(2); |
| | | // } |
| | | // getLocalAddress("0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7"); |
| | | BigDecimal amountIn = BigDecimal.valueOf(951); |
| | | BigDecimal result = amountIn.divide(BigDecimal.valueOf(100)); |
| | | System.out.println(result.remainder(BigDecimal.ONE).equals(BigDecimal.ZERO)); |
| | | } |
| | | |
| | | @Override |
| | | public Long transferA(TransferADto transferADto) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | |
| | | * 每人总共入金100U |
| | | */ |
| | | BigDecimal amountIn = transferADto.getAmount(); |
| | | if(amountIn.compareTo(new BigDecimal(100)) != 0){ |
| | | throw new FebsException("Limit per address 100 USDT"); |
| | | // if(amountIn.compareTo(new BigDecimal(100)) != 0){ |
| | | // throw new FebsException("Limit per address 100 USDT"); |
| | | // } |
| | | /** |
| | | * 每单金额得大于100 小于1000 限制 |
| | | */ |
| | | if(amountIn.compareTo(new BigDecimal(100)) < 0){ |
| | | throw new FebsException("Min 100"); |
| | | } |
| | | if(amountIn.compareTo(new BigDecimal(1000)) > 0){ |
| | | throw new FebsException("Max 1000"); |
| | | } |
| | | |
| | | BigDecimal result = amountIn.divide(BigDecimal.valueOf(100)); |
| | | if(!result.remainder(BigDecimal.ONE).equals(BigDecimal.ZERO)){ |
| | | throw new FebsException("Please enter an integer multiple of 100"); |
| | | } |
| | | |
| | | // BigDecimal amountInLast = dappChargeUsdtMapper.selectByMaxAmountMemberId(member.getId()); |
| | |
| | | * 限制用户买入总额, |
| | | * 目前每人限一单,总金额限制100U |
| | | */ |
| | | BigDecimal amountInLast = dappChargeUsdtMapper.selectBySumAmountMemberId(member.getId()); |
| | | DataDictionaryCustom systemAddressDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | PoolEnum.SYSTEM_ADDRESS.getType(), |
| | | PoolEnum.SYSTEM_ADDRESS.getCode() |
| | | ); |
| | | if(StrUtil.isNotEmpty(systemAddressDic.getValue())){ |
| | | if(!systemAddressDic.getValue().contains(dappMemberEntity.getAddress())){ |
| | | if(BigDecimal.ZERO.compareTo(amountInLast) < 0){ |
| | | throw new FebsException("Limit per address 100 USDT"); |
| | | } |
| | | } |
| | | }else{ |
| | | if(BigDecimal.ZERO.compareTo(amountInLast) < 0){ |
| | | throw new FebsException("Limit per address 100 USDT"); |
| | | // BigDecimal amountInLast = dappChargeUsdtMapper.selectBySumAmountMemberId(member.getId()); |
| | | BigDecimal amountInLast = dappChargeUsdtMapper.selectBySumAmountMemberIdAndDate(member.getId(),DateUtil.today()); |
| | | /** |
| | | * 每个地址只能使用一次 限制总额1000U |
| | | */ |
| | | BigDecimal amountInAll = amountInLast.add(amountIn); |
| | | if(getLocalAddress(dappMemberEntity.getAddress())){ |
| | | if(amountInAll.compareTo(new BigDecimal(1000)) > 0){ |
| | | BigDecimal add = new BigDecimal(1000).subtract(amountInLast).setScale(0, BigDecimal.ROUND_DOWN); |
| | | throw new FebsException("Max "+ add.toString()); |
| | | } |
| | | } |
| | | /** |
| | |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public boolean getLocalAddress(String address){ |
| | | /** |
| | | * dappMemberEntity.getAddress().equals("0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7") |
| | | * ||dappMemberEntity.getAddress().equals("0xd5c13dc4372d1e02b93add9dcca901bef51168be") |
| | | * ||dappMemberEntity.getAddress().equals("0xe22bb5fB2e0F8ED9366785dADD33cA19355d037c") |
| | | * ||dappMemberEntity.getAddress().equals("0x7685E62E679886494E3cdc3DE7103E026f815AF0") |
| | | * ||dappMemberEntity.getAddress().equals("0x6893bE8F4fb73595A13f32bA5e1d198Ab135516C" |
| | | */ |
| | | if(address.equals("0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7")){ |
| | | return false; |
| | | }else if(address.equals("0xd5c13dc4372d1e02b93add9dcca901bef51168be")){ |
| | | return false; |
| | | }else if(address.equals("0xe22bb5fB2e0F8ED9366785dADD33cA19355d037c")){ |
| | | return false; |
| | | }else if(address.equals("0x7685E62E679886494E3cdc3DE7103E026f815AF0")){ |
| | | return false; |
| | | }else if(address.equals("0x6893bE8F4fb73595A13f32bA5e1d198Ab135516C")){ |
| | | return false; |
| | | }else{ |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | throw new FebsException("请输入正确的地址"); |
| | | } |
| | | |
| | | /** |
| | | * 转ausdt,只能推广线上 |
| | | */ |
| | | String refererIdsDone = dappMemberEntity.getRefererIds(); |
| | | String inviteIdDone = dappMemberEntity.getInviteId(); |
| | | String refererIdsOther = memberParent.getRefererIds(); |
| | | String inviteId1Other = memberParent.getInviteId(); |
| | | if(!(StrUtil.contains(refererIdsOther,inviteIdDone) || StrUtil.contains(refererIdsDone,inviteId1Other))){ |
| | | throw new FebsException("不满足互转规则"); |
| | | } |
| | | |
| | | BigDecimal coinCnt = roundCoinDto.getCoinCnt(); |
| | | if(BigDecimal.ZERO.compareTo(coinCnt) >= 0){ |
| | | throw new FebsException("输入正确的数量"); |