From f3948fa31158c7b7dea3b038e01c43ce54c55a1c Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Wed, 14 Apr 2021 11:09:57 +0800 Subject: [PATCH] modify --- src/main/java/com/xcong/excoin/rabbit/consumer/FollowConsumer.java | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/xcong/excoin/rabbit/consumer/FollowConsumer.java b/src/main/java/com/xcong/excoin/rabbit/consumer/FollowConsumer.java index d206b1b..e7fc215 100644 --- a/src/main/java/com/xcong/excoin/rabbit/consumer/FollowConsumer.java +++ b/src/main/java/com/xcong/excoin/rabbit/consumer/FollowConsumer.java @@ -3,6 +3,7 @@ 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; @@ -35,14 +36,11 @@ followOrderOperationService.addFollowerOrder(Long.parseLong(content)); } -// @RabbitListener(queues = RabbitMqConfig.QUEUE_FOLLOW_CHANGE_BOND) + @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); + ChangeBondDto changeBondDto = JSONObject.parseObject(content, ChangeBondDto.class); + followOrderOperationService.changeFollowOrdersBond(changeBondDto.getId(), changeBondDto.getAmount(), changeBondDto.getType()); } } -- Gitblit v1.9.1