| | |
| | | import com.yami.trading.api.service.UserCacheService; |
| | | import com.yami.trading.bean.data.domain.Realtime; |
| | | import com.yami.trading.bean.item.domain.Item; |
| | | import com.yami.trading.bean.model.CapitaltWallet; |
| | | 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.common.util.HttpContextUtils; |
| | | import com.yami.trading.common.util.StringUtils; |
| | | import com.yami.trading.security.common.util.SecurityUtils; |
| | | import com.yami.trading.service.ChannelBlockchainService; |
| | | import com.yami.trading.service.RechargeBlockchainOrderService; |
| | | import com.yami.trading.service.WalletService; |
| | | import com.yami.trading.service.WithdrawService; |
| | | import com.yami.trading.service.*; |
| | | import com.yami.trading.service.data.DataService; |
| | | import com.yami.trading.service.item.ItemService; |
| | | import com.yami.trading.service.syspara.SysparaService; |
| | |
| | | ItemService itemService; |
| | | @Autowired |
| | | WalletLogService walletLogService; |
| | | @Autowired |
| | | CapitaltWalletService capitaltWalletService; |
| | | |
| | | @GetMapping("/getUsdt") |
| | | @ApiOperation(value = "获取usdt余额") |
| | |
| | | df2.setRoundingMode(RoundingMode.FLOOR); |
| | | // String partyId ="dcc0dd35a49c383dadabc4dc030afe70"; |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | Wallet usdt = null; |
| | | CapitaltWallet usdt = null; |
| | | if (StringUtils.isNotEmpty(partyId)) { |
| | | usdt = this.walletService.saveWalletByPartyId(partyId); |
| | | // usdt = this.walletService.saveWalletByPartyId(partyId); |
| | | usdt = capitaltWalletService.getUserIdWallet(partyId); |
| | | } |
| | | if (null == usdt) { |
| | | usdt = new Wallet(); |
| | | usdt = new CapitaltWallet(); |
| | | usdt.setMoney(new BigDecimal(0)); |
| | | usdt.setLockMoney(new BigDecimal(0)); |
| | | usdt.setFreezeMoney(new BigDecimal(0)); |
| | |
| | | walletExtend.setAmount(Double.valueOf(df2.format(walletExtend.getAmount()))); |
| | | walletExtend.setLockAmount(Double.valueOf(df2.format(walletExtend.getLockAmount()))); |
| | | walletExtend.setFreezeAmount(Double.valueOf(df2.format(walletExtend.getFreezeAmount()))); |
| | | walletExtend.setName(itemMap.get(list_symbol.get(i)).getName()); |
| | | walletExtendsRet.add(walletExtend); |
| | | temp = 1; |
| | | } |
| | |
| | | mapUsdt.put("frozenAmount", 0); |
| | | extendsList.add(0, mapUsdt); |
| | | } |
| | | mapRet.put("extends", extendsList); |
| | | |
| | | // 分离 USDC 和 USDT,并保留其他数据 |
| | | Map<String, Object> usdcEntry = null; |
| | | Map<String, Object> usdtEntry = null; |
| | | List<Map<String, Object>> otherEntries = new ArrayList<>(); |
| | | |
| | | for (Map<String, Object> entry : extendsList) { |
| | | String symbolData = (String) entry.get("symbol_data"); |
| | | if ("usdc".equals(symbolData)) { |
| | | usdcEntry = entry; |
| | | } else if ("usdt".equals(symbolData)) { |
| | | usdtEntry = entry; |
| | | } else { |
| | | otherEntries.add(entry); |
| | | } |
| | | } |
| | | |
| | | // 重新组合,USDC 第一,USDT 第二,其他保持原顺序 |
| | | List<Map<String, Object>> newExtendsList = new ArrayList<>(); |
| | | if (usdcEntry != null) newExtendsList.add(usdcEntry); |
| | | if (usdtEntry != null) newExtendsList.add(usdtEntry); |
| | | newExtendsList.addAll(otherEntries); |
| | | |
| | | mapRet.put("extends", newExtendsList); |
| | | |
| | | return Result.succeed(mapRet); |
| | | } |
| | | |