| | |
| | | package com.yami.trading.api.controller.exchange; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.extra.qrcode.QrCodeUtil; |
| | | import cn.hutool.extra.qrcode.QrConfig; |
| | |
| | | |
| | | @Autowired |
| | | RechargeBlockchainOrderService rechargeBlockchainOrderService; |
| | | |
| | | private String normalizeChainKey(String value) { |
| | | if (value == null) { |
| | | return ""; |
| | | } |
| | | return value.replace("-", "").replace("_", "").replace(" ", "").toUpperCase(Locale.ROOT); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有链地址 |
| | |
| | | Map<String, List<CryptoCurrencyEnum>> allGroupedByCoin = CryptoCurrencyEnum.getAllGroupedByCoin(); |
| | | List<CryptoCurrencyEnum> currencyEnums = allGroupedByCoin.get(coin); |
| | | List<Coin> coinList = udunClient.listSupportCoin(false); |
| | | if (CollectionUtil.isEmpty(currencyEnums) || CollectionUtil.isEmpty(coinList)) { |
| | | return Result.succeed(data); |
| | | } |
| | | |
| | | /*boolean change = false; |
| | | try { |
| | |
| | | }*/ |
| | | currencyEnums.forEach((currencyEnum) -> { |
| | | String coinName = currencyEnum.getName(); |
| | | Coin c = coinList.stream().filter(x -> x.getName().equals(coinName)).findFirst().orElse(null); |
| | | String normalizedCoinName = normalizeChainKey(coinName); |
| | | Coin c = coinList.stream().filter(x -> |
| | | normalizedCoinName.equals(normalizeChainKey(x.getName())) |
| | | || normalizedCoinName.equals(normalizeChainKey(x.getCoinType())) |
| | | || normalizedCoinName.equals(normalizeChainKey(x.getSymbol())) |
| | | || (normalizeChainKey(currencyEnum.getCoin()).equals(normalizeChainKey(x.getCoinType())) |
| | | && normalizeChainKey(currencyEnum.getChain()).contains("BSC") |
| | | && (normalizeChainKey(x.getName()).contains("BSC") |
| | | || normalizeChainKey(x.getMainCoinType()).contains("BSC") |
| | | || normalizeChainKey(x.getSymbol()).contains("BSC"))) |
| | | ).findFirst().orElse(null); |
| | | if (c != null) { |
| | | ChannelBlockchain rechargeAddressVo = new ChannelBlockchain(); |
| | | //创建地址 |