package cc.mrbird.febs.rabbit.producer;
|
|
import cc.mrbird.febs.rabbit.QueueEnum;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.util.UUID;
|
|
/**
|
* @author wzy
|
* @date 2022-05-31
|
**/
|
@Slf4j
|
@Component
|
public class ChainProducer implements RabbitTemplate.ConfirmCallback {
|
|
/**
|
* 配置中配置的RabbitTemplate的是prototype类型,不能直接注入
|
*/
|
private RabbitTemplate rabbitTemplate;
|
|
@Autowired
|
public ChainProducer(RabbitTemplate rabbitTemplate) {
|
this.rabbitTemplate = rabbitTemplate;
|
rabbitTemplate.setConfirmCallback(this);
|
}
|
|
@Override
|
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
|
}
|
|
/**
|
* 一、DAO成员静态:
|
* 质押PEOPLE(500枚起)静态每天1%。
|
* 直推8%
|
* @param id 流水ID
|
*/
|
public void sendDirectPerkMsg(Long id) {
|
log.info("发送直推:{}", id);
|
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
|
rabbitTemplate.convertAndSend(QueueEnum.FPD_MEMBER_DIRECT_PERK.getExchange(), QueueEnum.FPD_MEMBER_DIRECT_PERK.getRoute(), id, correlationData);
|
}
|
|
/**
|
* 二、DAO成员动态:
|
* 1.直推1个拿2代,直推10个拿20代,直推15个拿30代,最高30代
|
* 2. 1-5代奖励7%
|
* 6-10代奖励6%
|
* 11-15代奖励5%
|
* 15-20代奖励4%
|
* 21-25代奖励4%
|
* 26-30代奖励7%
|
* @param id 流水ID
|
*/
|
public void sendMemberDynamicPerkMsg(Long id) {
|
log.info("发送DAO成员动态,流水ID:{}", id);
|
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
|
rabbitTemplate.convertAndSend(QueueEnum.FPD_MEMBER_DYNAMIC_PERK.getExchange(), QueueEnum.FPD_MEMBER_DYNAMIC_PERK.getRoute(), id, correlationData);
|
}
|
|
/**
|
* 六、永动补偿池2%
|
* 五、DAO永动激励池:6%
|
* 四、DAO联盟委员会 : 5% (50名全球DAO委员)
|
* @param id 流水ID
|
*/
|
public void sendNodePerkMsg(Long id) {
|
log.info("发送DAO节点,激励,补偿,流水ID:{}", id);
|
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
|
rabbitTemplate.convertAndSend(QueueEnum.FPD_NODE_JILI_BUCHANG_PERK.getExchange(), QueueEnum.FPD_NODE_JILI_BUCHANG_PERK.getRoute(), id, correlationData);
|
}
|
|
/**
|
*
|
* 3. DAO成员团队奖:5%加权分红(people数量)
|
* DAO1:小区业绩30万/币 加权分红50%
|
* DAO2:小区业绩100万/币 加权分红30%
|
* DAO3:小区业绩500万/币加权分红20%
|
*/
|
public void sendTeamPerk(Long id) {
|
log.info("发送成员团队奖5%,流水ID:{}", id);
|
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
|
rabbitTemplate.convertAndSend(QueueEnum.FPD_TEAM_PERK.getExchange(), QueueEnum.FPD_TEAM_PERK.getRoute(), id, correlationData);
|
}
|
|
/**
|
*
|
* 3. 成员升级
|
* DAO1:小区业绩30万/币 加权分红50%
|
* DAO2:小区业绩100万/币 加权分红30%
|
* DAO3:小区业绩500万/币加权分红20%
|
*/
|
public void sendMemberLevel(Long id) {
|
log.info("发送成员升级,会员ID:{}", id);
|
CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
|
rabbitTemplate.convertAndSend(QueueEnum.FPD_MEMBER_LEVEL.getExchange(), QueueEnum.FPD_MEMBER_LEVEL.getRoute(), id, correlationData);
|
}
|
|
}
|