|  |  |  | 
|---|
|  |  |  | 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 lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private CoinTraderFactory factory; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private OrderCoinService orderCoinService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RabbitListener(queues = RabbitMqConfig.QUEUE_ROC_ORDER_SUBMIT) | 
|---|
|  |  |  | public void doSomething(String content) { | 
|---|
|  |  |  | log.info("#提交的订单---->{}#", content); | 
|---|
|  |  |  | 
|---|
|  |  |  | CoinTrader trader = factory.getTrader(symbol); | 
|---|
|  |  |  | trader.trade(coinsEntity); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *  取消订单 | 
|---|
|  |  |  | * @param content | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RabbitListener(queues = RabbitMqConfig.QUEUE_ROC_ORDER_CANCEL) | 
|---|
|  |  |  | public void doCancel(String content) { | 
|---|
|  |  |  | log.info("#取消的订单---->{}#", content); | 
|---|
|  |  |  | orderCoinService.cancelEntrustWalletCoinOrderForMatch(content); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|