| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.huobi.client.model.Candlestick; |
| | | import com.xcong.excoin.configurations.RabbitMqConfig; |
| | | import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity; |
| | | import com.xcong.excoin.modules.coin.service.OrderCoinService; |
| | | import com.xcong.excoin.modules.exchange.service.HandleKlineService; |
| | | import com.xcong.excoin.trade.ExchangeTrade; |
| | |
| | | if(CollectionUtils.isEmpty(exchangeTrades)){ |
| | | return; |
| | | } |
| | | // 先处理处理用户订单 |
| | | orderCoinService.handleOrder(exchangeTrades); |
| | | // 处理K线 并更新最新价 |
| | | handleKlineService.handleExchangeOrderToKline(exchangeTrades); |
| | | // 推送最新K线 |
| | |
| | | newCandlestick.setTick(model); |
| | | tradePlateSendWebSocket.sendMessageKline(symbolUsdt,key1,JSONObject.toJSONString(newCandlestick),null); |
| | | } |
| | | // 处理用户订单 |
| | | orderCoinService.handleOrder(exchangeTrades); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 撮合交易订单全部完成 |
| | | * @param content |
| | | */ |
| | | @RabbitListener(queues = RabbitMqConfig.QUEUE_ROC_ORDER_COMPLETE) |
| | | public void doComplete(String content) { |
| | | log.debug("#完成的订单---->{}#", content); |
| | | List<OrderCoinsEntity> exchangeTrades = JSONObject.parseArray(content, OrderCoinsEntity.class); |
| | | if(CollectionUtils.isEmpty(exchangeTrades)){ |
| | | return; |
| | | } |
| | | orderCoinService.completeOrder(exchangeTrades); |
| | | } |
| | | |
| | | } |