| | |
| | | package com.xcong.excoin.rabbit.consumer; |
| | | |
| | | import cn.hutool.http.HttpException; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.xcong.excoin.configurations.RabbitMqConfig; |
| | | import com.xcong.excoin.modules.blackchain.model.EthUsdtChargeDto; |
| | |
| | | import com.xcong.excoin.modules.blackchain.service.TrxUsdtUpdateService; |
| | | import com.xcong.excoin.modules.blackchain.service.UsdtErc20UpdateService; |
| | | import com.xcong.excoin.modules.coin.service.BlockCoinService; |
| | | import com.xcong.excoin.quartz.job.BlockCoinUpdateJob; |
| | | import com.xcong.excoin.utils.RedisUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.amqp.rabbit.annotation.RabbitListener; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestClientException; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | |
| | | @Resource |
| | | TrxUsdtUpdateService trxUsdtUpdateService; |
| | | |
| | | |
| | | @RabbitListener(queues = RabbitMqConfig.QUEUE_USDT_UPDATE) |
| | | public void doSomething(String content) { |
| | |
| | | @RabbitListener(queues = RabbitMqConfig.QUEUE_USDT_ADDRESS) |
| | | public void addUsdtAddress(String content) { |
| | | if(!UsdtErc20UpdateService.ALL_ADDRESS_LIST.contains(content)){ |
| | | log.debug("#添加新地址---->{}#", content); |
| | | log.info("#添加新地址---->{}#", content); |
| | | if(StringUtils.isBlank(content)){ |
| | | return; |
| | | } |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | @RabbitListener(queues = RabbitMqConfig.QUEUE_TRC20_BLOCK) |
| | | public void trc20BlockMsg(String content) { |
| | | Long blocnNum = Long.parseLong(content); |
| | | try { |
| | | trxUsdtUpdateService.monitorCoinListener(blocnNum); |
| | | } catch (RestClientException | HttpException e) { |
| | | // 此时是连接问题 这个块需要重新扫描 |
| | | log.info("查询区块超时:" + blocnNum); |
| | | BlockCoinUpdateJob.TRC_BLOCK.add(blocnNum); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |