KKSU
2024-04-16 1d5f689f34d827ac4be67fd84212a5cb7fc80d57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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.QUEUE_GFA_ZY_HUA_DIAN)
    public void distrbProfit(Long id) {
        log.info("收到滑点分配消息:{}", id);
//        dappSystemService.tradeProfitDistribute(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 更新表
 
        }
    }
}