| | |
| | | package cc.mrbird.febs.rabbit.consumer; |
| | | |
| | | import cc.mrbird.febs.dapp.entity.DbMemberNode; |
| | | import cc.mrbird.febs.dapp.mapper.DbMemberNodeMapper; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cc.mrbird.febs.rabbit.QueueConstants; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | **/ |
| | | @Slf4j |
| | | @Component |
| | | @ConditionalOnProperty(prefix = "system", name = "online-transfer", havingValue = "true") |
| | | @ConditionalOnProperty(prefix = "system", name = "charge-transfer", havingValue = "true") |
| | | public class ChainConsumer { |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private DappSystemService dappSystemService; |
| | | @Autowired |
| | | private DbMemberNodeMapper dbMemberNodeMapper; |
| | | |
| | | @RabbitListener(queues = QueueConstants.ACHIEVE_TREE) |
| | | public void achieveTree(String id) { |
| | | log.info("收到业绩树消息"); |
| | | dappSystemService.achieveTree(Long.parseLong(id)); |
| | | } |
| | | |
| | | /** |
| | | * 生产者在tfc应用 |
| | | * @param data |
| | | * 一、DAO成员静态: |
| | | * 质押PEOPLE(500枚起)静态每天1%。 |
| | | * 直推8% |
| | | * 六、永动补偿池2% |
| | | * 五、DAO永动激励池:6% |
| | | * 四、DAO联盟委员会 : 5% (50名全球DAO委员) |
| | | * @param id 流水ID |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.TFC_NEW_PRICE) |
| | | public void tfcNewPrice(String data) { |
| | | // dappSystemService.tfcNewPrice(data); |
| | | @RabbitListener(queues = QueueConstants.FPD_MEMBER_DIRECT_PERK) |
| | | public void directPerkMsg(Long id) { |
| | | log.info("消费直推,流水ID:{}", id); |
| | | dappSystemService.directPerkMsg(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param data |
| | | * 二、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 |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.DISTRIB_PROFIT) |
| | | public void feeDistribute(String data) { |
| | | dappSystemService.feeDistribute(data); |
| | | } |
| | | |
| | | |
| | | |
| | | @RabbitListener(queues = QueueConstants.TFC_INVITE_PERK_QUEEN) |
| | | public void invitePerkMsg(Long id) { |
| | | log.info("消费推荐规则奖励,流水ID:{}", id); |
| | | @RabbitListener(queues = QueueConstants.FPD_MEMBER_DYNAMIC_PERK) |
| | | public void memberDynamicPerkMsg(Long id) { |
| | | log.info("消费DAO成员动态,流水ID:{}", id); |
| | | dappSystemService.invitePerkMsg(id); |
| | | } |
| | | |
| | | @RabbitListener(queues = QueueConstants.TFC_NODE_PERK_QUEEN) |
| | | |
| | | /** |
| | | * 六、永动补偿池2% |
| | | * 五、DAO永动激励池:6% |
| | | * 四、DAO联盟委员会 : 5% (50名全球DAO委员) |
| | | * @param id 流水ID |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.FPD_NODE_JILI_BUCHANG_PERK) |
| | | public void nodePerkMsg(Long id) { |
| | | log.info("消费节点投资,流水ID:{}", id); |
| | | log.info("消费DAO节点,激励,补偿,流水ID:{}", id); |
| | | dappSystemService.nodePerkMsg(id); |
| | | } |
| | | |
| | | @RabbitListener(queues = QueueConstants.TFC_NODE_AGAIN) |
| | | public void nodeMsg(Long id) { |
| | | log.info("复投:{}", id); |
| | | dappSystemService.achieveTreeV2(id); |
| | | /** |
| | | * |
| | | * 3. DAO成员团队奖:5%加权分红(people数量) |
| | | * DAO1:小区业绩30万/币 加权分红50% |
| | | * DAO2:小区业绩100万/币 加权分红30% |
| | | * DAO3:小区业绩500万/币加权分红20% |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.FPD_TEAM_PERK) |
| | | public void teamPerk(Long id) { |
| | | log.info("消费成员团队奖5%,流水ID:{}", id); |
| | | dappSystemService.teamPerk(id); |
| | | } |
| | | |
| | | @RabbitListener(queues = QueueConstants.TFC_NODE_AGAIN_LONG) |
| | | public void nodeMsgLong(Long id) { |
| | | log.info("复投:{}", id); |
| | | |
| | | /** |
| | | * 获取所有左右节点都有值,轮数为 1,未复投work_state = 1 的节点 |
| | | * 判断右节点有值 |
| | | * 有继续向判断右节点 |
| | | * 有,原纪录复投逻辑 |
| | | */ |
| | | QueryWrapper<DbMemberNode> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("count_fund", 1); |
| | | objectQueryWrapper.eq("work_state", 1); |
| | | objectQueryWrapper.eq("type", 1); |
| | | objectQueryWrapper.eq("member_id", id); |
| | | List<DbMemberNode> dbMemberNodes = dbMemberNodeMapper.selectList(objectQueryWrapper); |
| | | if(CollUtil.isEmpty(dbMemberNodes)){ |
| | | return; |
| | | } |
| | | for(DbMemberNode dbMemberNode : dbMemberNodes){ |
| | | if(ObjectUtil.isEmpty(dbMemberNode.getRightNode())){ |
| | | continue; |
| | | } |
| | | //子节点 |
| | | Long rightNode = dbMemberNode.getRightNode(); |
| | | DbMemberNode dbMemberNode1 = dbMemberNodeMapper.selectById(rightNode); |
| | | if(ObjectUtil.isEmpty(dbMemberNode1)){ |
| | | continue; |
| | | } |
| | | |
| | | if(ObjectUtil.isEmpty(dbMemberNode1.getRightNode())){ |
| | | continue; |
| | | } |
| | | |
| | | //有,则上级节点出局复投,轮数加1,复投逻辑 |
| | | dappSystemService.memberNodeNext(dbMemberNode); |
| | | } |
| | | /** |
| | | * |
| | | * 3. 成员升级或者降级 |
| | | * DAO1:小区业绩30万/币 |
| | | * DAO2:小区业绩100万/币 |
| | | * DAO3:小区业绩500万/币 |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.FPD_MEMBER_LEVEL) |
| | | public void MemberLevel(Long id) { |
| | | log.info("消费发送成员升级,会员ID:{}", id); |
| | | dappSystemService.MemberLevel(id); |
| | | } |
| | | |
| | | |
| | | |
| | | } |