| | |
| | | |
| | | boolean order_open = sysparaService.find("exchange_order_open").getBoolean(); |
| | | if (!order_open) { |
| | | throw new YamiShopBindException("不在交易时段"); |
| | | throw new YamiShopBindException("Outside trading hours"); |
| | | } |
| | | Item item = itemService.findBySymbol(order.getSymbol()); |
| | | if (item == null) { |
| | | throw new YamiShopBindException("参数错误"); |
| | | throw new YamiShopBindException("Invalid parameters"); |
| | | } |
| | | /*if (itemService.isSuspended(order.getSymbol())) { |
| | | throw new YamiShopBindException("停牌禁止交易"); |
| | | throw new YamiShopBindException("Trading suspended"); |
| | | }*/ |
| | | |
| | | |
| | |
| | | } |
| | | for (ExchangeRecord entry : recordMap.values()) { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | map.put("symbol", entry.getSymbol()); |
| | | //map.put("symbol", entry.getSymbol()); |
| | | map.put("symbol", entry.getSymbol().equalsIgnoreCase("galausdt") ? "dxcmusdt" : entry.getSymbol()); |
| | | Item bySymbol = itemService.findBySymbol(entry.getSymbol()); |
| | | if (bySymbol != null) { |
| | | map.put("symbol_data", bySymbol.getSymbolData()); |
| | | } |
| | | map.put("symbol_to", entry.getSymbol_to()); |
| | | map.put("symbol_to", entry.getSymbol_to().equalsIgnoreCase("galausdt") ? "dxcmusdt" : entry.getSymbol_to()); |
| | | //map.put("symbol_to", entry.getSymbol_to()); |
| | | map.put("amount", entry.getAmount()); |
| | | map.put("amount_to", entry.getAmount_to()); |
| | | map.put("create_time", entry.getCreate_time()); |
| | |
| | | System.out.println("-----userIdWallet---------:"+userIdWallet.getMoney().doubleValue()); |
| | | System.out.println("-----order---------:"+order.getVolume().doubleValue()); |
| | | if (userIdWallet.getMoney().doubleValue() < order.getVolume().doubleValue()) { |
| | | throw new YamiShopBindException("余额不足"); |
| | | throw new YamiShopBindException("Insufficient balance"); |
| | | } |
| | | // this.walletService.update(userIdWallet.getUserId().toString(), Arith.sub(0, order.getVolume())); |
| | | capitaltWalletService.update(userIdWallet, Arith.sub(0, order.getVolume())); |
| | |
| | | } |
| | | if (!order.isTriggerOrder()) { |
| | | if (order.getVolume() > walletExtend.getAmount()) { |
| | | throw new YamiShopBindException("仓位不足"); |
| | | throw new YamiShopBindException("Insufficient position"); |
| | | } |
| | | walletService.updateExtend(walletExtend.getPartyId().toString(), walletExtend.getWallettype(), |
| | | Arith.sub(0, order.getVolume())); |