| | |
| | | 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.contract.parameter.dto.ChangeBondDto; |
| | | import com.xcong.excoin.modules.documentary.service.FollowOrderOperationService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.amqp.core.Message; |
| | |
| | | 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 |
| | |
| | | **/ |
| | | @Slf4j |
| | | @Component |
| | | @ConditionalOnProperty(prefix = "app", name = "rabbit-consumer1", havingValue = "true") |
| | | @ConditionalOnProperty(prefix = "app", name = "rabbit-consumer", havingValue = "true") |
| | | public class FollowConsumer { |
| | | |
| | | @Autowired |
| | |
| | | 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); |
| | | ChangeBondDto changeBondDto = JSONObject.parseObject(content, ChangeBondDto.class); |
| | | followOrderOperationService.changeFollowOrdersBond(changeBondDto.getId(), changeBondDto.getAmount(), changeBondDto.getType()); |
| | | } |
| | | } |