KKSU
2024-04-17 829f629756e5402bcd3e9f6ef1f9c6dbffbabb11
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());
    }
}