xiaoyong931011
2021-04-06 bf68aa759bc3c0a858d80cb3d1ae1f1682cd6c94
src/main/java/com/xcong/excoin/rabbit/consumer/FollowConsumer.java
@@ -1,5 +1,6 @@
package com.xcong.excoin.rabbit.consumer;
import com.alibaba.fastjson.JSONObject;
import com.rabbitmq.client.Channel;
import com.xcong.excoin.configurations.RabbitMqConfig;
import com.xcong.excoin.modules.documentary.service.FollowOrderOperationService;
@@ -9,6 +10,10 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import org.web3j.abi.datatypes.Int;
import java.math.BigDecimal;
import java.util.Map;
/**
 * @author wzy
@@ -26,6 +31,18 @@
    public void addFollowOrder(Message message, Channel channel) {
        String content = new String(message.getBody());
        log.info("==收到跟单下单消息 : {}", content);
        followOrderOperationService.addFollowerOrder(Long.parseLong(content));
    }
//    @RabbitListener(queues = RabbitMqConfig.QUEUE_FOLLOW_CHANGE_BOND)
    public void changeFollowOrderBond(Message message, Channel channel) {
        String content = new String(message.getBody());
        log.info("==收到跟单保证金调整消息 : {}", content);
        Map map = JSONObject.parseObject(content, Map.class);
        Integer id = (Integer) map.get("id");
        BigDecimal bond = (BigDecimal) map.get("bond");
        Integer type = (Integer) map.get("type");
        followOrderOperationService.changeFollowOrdersBond(id.longValue(), bond, type);
    }
}