KKSU
2025-02-12 1bb96bab1185f2e1aa2f468266512ee0beb83286
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
67
68
69
70
71
72
73
74
75
76
package cc.mrbird.febs.rabbit.consumer;
 
import cc.mrbird.febs.mall.dto.ApiMemberChargeFailDto;
import cc.mrbird.febs.mall.service.IAgentService;
import cc.mrbird.febs.rabbit.constants.QueueConstants;
import lombok.extern.slf4j.Slf4j;
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 2021-09-25
 **/
@Slf4j
@Component
@ConditionalOnProperty(prefix = "consumer", name = "open", havingValue = "true")
public class AgentConsumer {
    @Autowired
    private IAgentService agentService;
 
    /**
     * 充值自动过期
     * @param apiMemberChargeFailDto
     */
    @RabbitListener(queues = QueueConstants.RUN_VIP_OPERATION_CHARGE_FAIL)
    public void memberChargeFailMsg(ApiMemberChargeFailDto apiMemberChargeFailDto) {
        try {
            agentService.sendMemberChargeFailMsg(apiMemberChargeFailDto);
        } catch (Exception e) {
            log.error("消费充值自动过期异常", e);
        }
    }
 
 
    /**
     * 购买成功
     */
    @RabbitListener(queues = QueueConstants.RUN_VIP_OPERATION_CHARGE)
    public void buyVipSuccessMsg(Long chargeId) {
        try {
            agentService.buyVipSuccessMsg(chargeId);
        } catch (Exception e) {
            log.error("消费购买成功异常", e);
        }
    }
 
 
    /**
     * 充值成功
     */
    @RabbitListener(queues = QueueConstants.RUN_VIP_OPERATION_CHARGE_BALANCE)
    public void chargeSuccessMsg(Long chargeId) {
        try {
            agentService.chargeSuccessMsg(chargeId);
        } catch (Exception e) {
            log.error("消费充值异常", e);
        }
    }
 
 
    /**
     * 节点升级
     */
    @RabbitListener(queues = QueueConstants.RUN_VIP_NODE_UP)
    public void nodeUpMsg(Long memberId) {
        try {
            agentService.nodeUpMsg(memberId);
        } catch (Exception e) {
            log.error("消费节点升级异常", e);
        }
    }
 
 
}