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.blackchain.model.RocTransferDetail; import com.xcong.excoin.modules.coin.service.BlockCoinService; import com.xcong.excoin.modules.member.dao.MemberCoinAddressDao; import com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity; import com.xcong.excoin.rabbit.pricequeue.OrderModel; import com.xcong.excoin.rabbit.pricequeue.OrderOperatePriceService; import org.apache.commons.lang.StringUtils; import org.springframework.amqp.core.Message; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.List; /** * ROC币种同步 */ @Component @ConditionalOnProperty(prefix = "app", name = "block-job", havingValue = "true") public class RocBlockUpdateConsumer { @Resource private BlockCoinService blockCoinService; /** * ROC币种同步 * * @param message 消息体 * @param channel 信道 * @date 2019年4月19日 */ @RabbitListener(queues = RabbitMqConfig.QUEUE_ROC) public void onMessageMorePro(Message message, Channel channel) { String content = new String(message.getBody()); // 操作前的map // 转为model RocTransferDetail transferDetail = JSONObject.parseObject(content, RocTransferDetail.class); blockCoinService.updateRoc(transferDetail); } }