| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.trade.CoinTrader; |
| | | import com.xcong.excoin.trade.CoinTraderFactory; |
| | | import com.xcong.excoin.trade.ExchangeTrade; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.springframework.amqp.rabbit.annotation.RabbitListener; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 提交买卖单进入撮合系统 |
| | |
| | | @Resource |
| | | private CoinTraderFactory factory; |
| | | |
| | | @Resource |
| | | private OrderCoinService orderCoinService; |
| | | |
| | | @RabbitListener(queues = RabbitMqConfig.QUEUE_ROC_ORDER_SUBMIT) |
| | | public void doSomething(String content) { |
| | | log.info("#提交的订单---->{}#", content); |
| | | //log.info("#提交的订单---->{}#", content); |
| | | OrderCoinsEntity coinsEntity = JSONObject.parseObject(content, OrderCoinsEntity.class); |
| | | String symbol = coinsEntity.getSymbol(); |
| | | CoinTrader trader = factory.getTrader(symbol); |
| | | trader.trade(coinsEntity); |
| | | } |
| | | |
| | | /** |
| | | * 取消订单 |
| | | * @param content |
| | | */ |
| | | @RabbitListener(queues = RabbitMqConfig.QUEUE_ROC_ORDER_CANCEL) |
| | | public void doCancel(String content) { |
| | | //log.debug("#取消的订单---->{}#", content); |
| | | orderCoinService.cancelEntrustWalletCoinOrderForMatch(content); |
| | | } |
| | | |
| | | |
| | | } |