| | |
| | | package com.yami.trading.api.controller; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yami.trading.api.dto.ChannelBlockchainDto; |
| | | import com.yami.trading.api.model.GetChannelBlockchainModel; |
| | |
| | | import com.yami.trading.bean.model.ChannelBlockchain; |
| | | import com.yami.trading.bean.model.Wallet; |
| | | import com.yami.trading.bean.model.WalletExtend; |
| | | import com.yami.trading.bean.rate.domain.ExchangeRate; |
| | | import com.yami.trading.bean.vo.WithdrawFeeVo; |
| | | import com.yami.trading.common.constants.Constants; |
| | | import com.yami.trading.common.domain.Result; |
| | |
| | | mapRet.put("lock_money", usdt.getLockMoney()); |
| | | mapRet.put("freeze_money", usdt.getFreezeMoney()); |
| | | } |
| | | |
| | | // 其他币账户 |
| | | List<Item> list_it = this.itemService.cacheGetByMarket(""); |
| | | if (StringUtils.isNotEmpty(symbolType)) { |
| | |
| | | list_it = list_it.stream().filter(i -> symbolType.equalsIgnoreCase(i.getType())).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | List<String> list_symbol = new ArrayList<>(); |
| | | if (!StringUtils.isNotEmpty(symbol)) { |
| | | // symbol为空,获取所有的 |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<Item> items = this.itemService.cacheGetAll(); |
| | | // 按id排序 |
| | | Collections.sort(items, new Comparator<Item>() { |
| | |
| | | return arg0.getUuid().compareTo(arg1.getUuid()); |
| | | } |
| | | }); |
| | | |
| | | Map<String, Item> itemMap = new HashMap<String, Item>(); |
| | | for (int i = 0; i < items.size(); i++) { |
| | | itemMap.put(items.get(i).getSymbol(), items.get(i)); |
| | |
| | | walletExtends = this.walletService.findExtend(partyId, list_symbol); |
| | | } |
| | | } |
| | | |
| | | if (null == walletExtends) { |
| | | walletExtends = new ArrayList<>(); |
| | | } |
| | | List<WalletExtend> walletExtendsRet = new ArrayList<WalletExtend>(); |
| | | int temp = 0; |
| | | for (int i = 0; i < list_symbol.size(); i++) { |
| | | for (int j = 0; j < walletExtends.size(); j++) { |
| | | WalletExtend walletExtend = walletExtends.get(j); |
| | | if (walletExtend.getWallettype().toUpperCase().equals(list_symbol.get(i).toUpperCase())) { |
| | | walletExtend.setAmount(Double.valueOf(df2.format(walletExtend.getAmount()))); |
| | | walletExtend.setLockAmount(Double.valueOf(df2.format(walletExtend.getLockAmount()))); |
| | | walletExtend.setFreezeAmount(Double.valueOf(df2.format(walletExtend.getFreezeAmount()))); |
| | | walletExtendsRet.add(walletExtend); |
| | | temp = 1; |
| | | String symbols = list_symbol.get(i); |
| | | WalletExtend walletExtend = walletExtends.stream() |
| | | .filter(x -> x.getWallettype().equalsIgnoreCase(symbols)) |
| | | .findFirst().orElse(null); |
| | | if (null != walletExtend) { |
| | | walletExtend.setAmount(Double.parseDouble(df2.format(walletExtend.getAmount()))); |
| | | walletExtend.setLockAmount(Double.parseDouble(df2.format(walletExtend.getLockAmount()))); |
| | | walletExtend.setFreezeAmount(Double.parseDouble(df2.format(walletExtend.getFreezeAmount()))); |
| | | walletExtendsRet.add(walletExtend); |
| | | } else { |
| | | if (symbolType.equalsIgnoreCase(Item.US_STOCKS)) { |
| | | continue; |
| | | } |
| | | } |
| | | if (0 == temp) { |
| | | WalletExtend walletExtend = new WalletExtend(); |
| | | walletExtend = new WalletExtend(); |
| | | if (StringUtils.isNotEmpty(partyId)) { |
| | | walletExtend.setPartyId(partyId); |
| | | } |
| | |
| | | } |
| | | walletExtendsRet.add(walletExtend); |
| | | } |
| | | temp = 0; |
| | | } |
| | | |
| | | String symbolsStr = ""; |
| | | |
| | | List<String> wallTypeList = walletExtendsRet.stream() |
| | | .map(WalletExtend::getWallettype) |
| | | .map(type -> type != null ? type.toLowerCase() : null) |
| | | .collect(Collectors.toList()); |
| | | list_symbol = list_symbol.stream().filter( x -> wallTypeList.contains(x.toLowerCase())).collect(Collectors.toList()); |
| | | for (int i = 0; i < list_symbol.size(); i++) { |
| | | if (i != 0) { |
| | | symbolsStr = symbolsStr + "," + list_symbol.get(i); |
| | |
| | | realtimeMap.put(realtime_all.get(i).getSymbol(), realtime_all.get(i)); |
| | | } |
| | | List<Map<String, Object>> extendsList = new ArrayList<Map<String, Object>>(); |
| | | List<ExchangeRate> rateList = exchangeRateService.list(); |
| | | for (int i = 0; i < walletExtendsRet.size(); i++) { |
| | | if (false == all) { |
| | | // 只要btc、eth |
| | |
| | | map.put("frozenAmount", walletExtendsRet.get(i).getFreezeAmount()); |
| | | Realtime rt = realtimeMap.get(walletExtendsRet.get(i).getWallettype()); |
| | | if (null != rt) { |
| | | map.put("usdt", df2.format(exchangeRateService.getUsdtByType(BigDecimal.valueOf(Arith.mul(rt.getClose(), volume)), symbolType))); |
| | | map.put("usableUsdt", df2.format(exchangeRateService.getUsdtByType(BigDecimal.valueOf(Arith.mul(rt.getClose(), walletExtendsRet.get(i).getAmount())), symbolType))); |
| | | map.put("usdt", df2.format(exchangeRateService.getUsdtByType(rateList, BigDecimal.valueOf(Arith.mul(rt.getClose(), volume)), symbolType))); |
| | | map.put("usableUsdt", df2.format(exchangeRateService.getUsdtByType(rateList, BigDecimal.valueOf(Arith.mul(rt.getClose(), walletExtendsRet.get(i).getAmount())), symbolType))); |
| | | } else { |
| | | map.put("usdt", 0); |
| | | map.put("usableUsdt", 0); |
| | |
| | | } |
| | | Map<String, String> itemMap = new HashMap<String, String>(); |
| | | Map<String, String> itemSymbolDataMap = new HashMap<String, String>(); |
| | | |
| | | for (int i = 0; i < list_it.size(); i++) { |
| | | itemMap.put(list_it.get(i).getSymbol(), list_it.get(i).getSymbolFullName()); |
| | | itemSymbolDataMap.put(list_it.get(i).getSymbol(), list_it.get(i).getSymbolData()); |