package cc.mrbird.febs.rabbit.consumer;
|
|
import cc.mrbird.febs.dapp.service.DappSystemService;
|
import cc.mrbird.febs.rabbit.QueueConstants;
|
import com.rabbitmq.client.Channel;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.amqp.core.Message;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* @author wzy
|
* @date 2022-05-31
|
**/
|
@Slf4j
|
@Component
|
@ConditionalOnProperty(prefix = "system", name = "online-transfer", havingValue = "true")
|
public class ChainConsumer {
|
|
@Autowired
|
private DappSystemService dappSystemService;
|
|
@RabbitListener(queues = QueueConstants.ONLINE_TRANSFER)
|
public void onlineTransfer(String batchNo) {
|
log.info("收到链上转账消息:{}", batchNo);
|
dappSystemService.onlineTransfer(batchNo);
|
}
|
|
@RabbitListener(queues = QueueConstants.DISTRIB_PROFIT)
|
public void distrbProfit(String id) {
|
log.info("收到滑点分配消息:{}", id);
|
dappSystemService.tradeProfitDistribute(Long.parseLong(id));
|
}
|
|
@RabbitListener(queues = QueueConstants.USER_BUY_REWARD)
|
public void userBuyReward(String id) {
|
log.info("收到用户购买奖励消息:{}", id);
|
dappSystemService.userBuyReward(Long.parseLong(id));
|
}
|
|
@RabbitListener(queues = QueueConstants.QUEUE_GFA_ZY_TIME)
|
public void getZhiYaDelayMsg(Long achieveId) {
|
log.info("收到延时质押消息,编号:{}",achieveId);
|
try {
|
dappSystemService.getZhiYaDelayMsg(achieveId);
|
} catch (Exception e) {
|
log.error("延时开奖异常", e);
|
// todo 更新表
|
|
}
|
}
|
|
@RabbitListener(queues = QueueConstants.QUEUE_GFA_ZY_TIME_FLOW)
|
public void getZhiYaDelayMsgFlow(Long flowId) {
|
log.info("收到延时质押流水消息,编号:{}",flowId);
|
try {
|
dappSystemService.getZhiYaDelayMsgFlow(flowId);
|
} catch (Exception e) {
|
log.error("延时开奖异常", e);
|
// todo 更新表
|
|
}
|
}
|
}
|