zainali5120
2020-10-13 17fb78903b310564aaeea6e4fd50824f45d4677a
src/main/java/com/xcong/excoin/rabbit/consumer/ExchangeConsumer.java
@@ -15,6 +15,7 @@
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;
@@ -24,11 +25,11 @@
import java.util.Set;
/**
 * @author wzy
 * @date 2020-05-25
 **/
 *  websocket 只能后台撮合交易那台开启
 */
@Slf4j
@Component
@ConditionalOnProperty(prefix = "app", name = "exchange-trade", havingValue = "true")
public class ExchangeConsumer {
    @Resource
@@ -49,8 +50,7 @@
     */
    @RabbitListener(queues = RabbitMqConfig.QUEUE_TRADE_PLATE)
    public void tradePlate(String content) {
        //log.info("#盘口信息消费者---->{}#", content);
        tradePlateSendWebSocket.sendMessagePlate("NEKK/USDT",content,null);
        tradePlateSendWebSocket.sendMessagePlate("ROC/USDT",content,null);
    }
    /**
@@ -116,23 +116,4 @@
        orderCoinService.handleOrder(exchangeTrades);
    }
    /**
     *  更新最新K线
     * @param content
     */
//    @RabbitListener(queues = RabbitMqConfig.QUEUE_TRADE_PLATE)
//    public void newKling(String content) {
//        log.info("#---->{}#", content);
//        // 最新K线的币种
//        String key = "NEW_KINE_{}";
//        key = StrUtil.format(key, content);
//        Object o = redisUtils.get(key);
//        Map<String, Candlestick> currentKlineMap = (Map<String, Candlestick>)o;
//        // 推送最新K线
//        Set<Map.Entry<String, Candlestick>> entries = currentKlineMap.entrySet();
//        for(Map.Entry<String, Candlestick> map : entries){
//            tradePlateSendWebSocket.sendMessageKline(content,map.getKey(),JSONObject.toJSONString(map.getValue()),null);
//        }
//
//    }
}