From bf68aa759bc3c0a858d80cb3d1ae1f1682cd6c94 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 06 Apr 2021 15:38:42 +0800 Subject: [PATCH] Merge branch 'activity' of http://120.27.238.55:7000/r/exchange into activity --- src/main/java/com/xcong/excoin/rabbit/producer/FollowProducer.java | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/xcong/excoin/rabbit/producer/FollowProducer.java b/src/main/java/com/xcong/excoin/rabbit/producer/FollowProducer.java index 2091602..1c5e466 100644 --- a/src/main/java/com/xcong/excoin/rabbit/producer/FollowProducer.java +++ b/src/main/java/com/xcong/excoin/rabbit/producer/FollowProducer.java @@ -1,13 +1,19 @@ package com.xcong.excoin.rabbit.producer; +import com.alibaba.fastjson.JSONObject; import com.xcong.excoin.configurations.RabbitMqConfig; import lombok.extern.slf4j.Slf4j; +import net.sf.json.JSON; import org.springframework.amqp.rabbit.connection.CorrelationData; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.web3j.abi.datatypes.Int; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; import java.util.UUID; /** @@ -39,6 +45,22 @@ public void sendAddFollowOrder(Long id) { CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); log.info("发送跟单下单消息: {}, {}", id, correlationData.getId()); - rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_A, RabbitMqConfig.ROUTINGKEY_FOLLOW_ORDER, id, correlationData); + rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_A, RabbitMqConfig.ROUTINGKEY_FOLLOW_ORDER, id.toString(), correlationData); + } + + /** + * 发送跟单调整保证金信息 + * + * @param id + */ + public void sendChangeFollowOrderBond(Long id, BigDecimal changeBond, Integer type) { + CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); + Map<String, Object> map = new HashMap<>(); + map.put("id", id); + map.put("bond", changeBond); + map.put("type", type); + String msg = JSONObject.toJSONString(map); + log.info("发送跟单保证金调整消息: {}, {}", msg, correlationData.getId()); + rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_A, RabbitMqConfig.ROUTINGKEY_FOLLOW_CHANGE_BOND, msg, correlationData); } } -- Gitblit v1.9.1