1 files added
9 files modified
New file |
| | |
| | | package cc.mrbird.febs.dapp.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2022-08-25 |
| | | **/ |
| | | @Data |
| | | @TableName("dapp_achieve_tree") |
| | | public class DappAchieveTreeEntity extends BaseEntity { |
| | | |
| | | private Long midNode; |
| | | |
| | | private Long leftNode; |
| | | |
| | | private Long rightNode; |
| | | |
| | | private int batchNo; |
| | | |
| | | private int validState; |
| | | } |
| | |
| | | BigDecimal newestPrice(); |
| | | |
| | | boolean hasProfit(String address); |
| | | |
| | | void achieveTree(Long memberId); |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | DappMemberEntity fromMember = dappMemberService.findByAddress(e.from, null); |
| | | |
| | | BigInteger tokens = e.tokens; |
| | | BigDecimal amount = new BigDecimal(tokens.toString()).divide(BigDecimal.TEN.pow(decimals), decimals, RoundingMode.HALF_DOWN); |
| | | |
| | |
| | | if (parent == null) { |
| | | throw new FebsException("recommender is not exist"); |
| | | } |
| | | } |
| | | |
| | | List<DappMemberEntity> child = dappMemberDao.selectChildMemberDirectOrNot(connectDto.getInviteId(), 1); |
| | | if (child.size() == 6) { |
| | | throw new FebsException("Invite Code is Invalid"); |
| | | } |
| | | } |
| | | member = insertMember(connectDto.getAddress(), null); |
| | | } |
| | | |
| | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public synchronized void achieveTree(Long memberId) { |
| | | |
| | | } |
| | | } |
| | |
| | | **/ |
| | | public class QueueConstants { |
| | | |
| | | public static final String ONLINE_TRANSFER = "queue_online_transfer"; |
| | | public static final String DISTRIB_PROFIT = "queue_distrib_profit"; |
| | | public static final String USER_BUY_REWARD = "queue_user_buy_reward"; |
| | | public static final String NFT_BOX = "queue_nft_box"; |
| | | public static final String ONLINE_TRANSFER = "queue_sdm_online_transfer"; |
| | | public static final String DISTRIB_PROFIT = "queue_sdm_distrib_profit"; |
| | | public static final String USER_BUY_REWARD = "queue_sdm_user_buy_reward"; |
| | | public static final String NFT_BOX = "queue_sdm_nft_box"; |
| | | public static final String ACHIEVE_TREE = "queue_sdm_achieve_tree"; |
| | | } |
| | |
| | | @Getter |
| | | public enum QueueEnum { |
| | | |
| | | ONLINE_TRANSFER("exchange_online_transfer", "route_key_online_transfer", "queue_online_transfer"), |
| | | DISTRIB_PROFIT("exchange_distrib_profit", "route_key_distrib_profit", "queue_distrib_profit"), |
| | | USER_BUY_REWARD("exchange_user_buy_reward", "route_key_user_buy_reward", "queue_user_buy_reward"), |
| | | NFT_BOX("exchange_nft_box", "route_key_nft_box", "queue_nft_box"); |
| | | ONLINE_TRANSFER("exchange_sdm_online_transfer", "route_key_sdm_online_transfer", "queue_sdm_online_transfer"), |
| | | DISTRIB_PROFIT("exchange_sdm_distrib_profit", "route_key_sdm_distrib_profit", "queue_sdm_distrib_profit"), |
| | | USER_BUY_REWARD("exchange_sdm_user_buy_reward", "route_key_sdm_user_buy_reward", "queue_sdm_user_buy_reward"), |
| | | NFT_BOX("exchange_sdm_nft_box", "route_key_sdm_nft_box", "queue_sdm_nft_box"), |
| | | ACHIEVE_TREE("exchange_sdm_achieve_tree", "route_key_sdm_achieve_tree", "queue_sdm_achieve_tree"); |
| | | |
| | | private String exchange; |
| | | |
| | |
| | | return BindingBuilder.bind(nftBoxQueue()).to(nftBoxExchange()).with(QueueEnum.NFT_BOX.getRoute()); |
| | | } |
| | | // === nft卡牌盲盒 end === |
| | | |
| | | |
| | | // === 业绩树 start === |
| | | @Bean |
| | | public DirectExchange achieveTreeExchange() { |
| | | return new DirectExchange(QueueEnum.ACHIEVE_TREE.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue achieveTreeQueue() { |
| | | return new Queue(QueueEnum.ACHIEVE_TREE.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding achieveTreeBind() { |
| | | return BindingBuilder.bind(achieveTreeQueue()).to(achieveTreeExchange()).with(QueueEnum.ACHIEVE_TREE.getRoute()); |
| | | } |
| | | // === 业绩树 end === |
| | | } |
| | |
| | | log.info("收到nft盲盒消息:{}", id); |
| | | dappSystemService.boxCnt(Long.parseLong(id)); |
| | | } |
| | | |
| | | @RabbitListener(queues = QueueConstants.ACHIEVE_TREE) |
| | | public void achieveTree(String id) { |
| | | log.info("收到业绩树消息"); |
| | | } |
| | | } |
| | |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.NFT_BOX.getExchange(), QueueEnum.NFT_BOX.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | |
| | | public void sendAchieveTreeMsg(Long id) { |
| | | log.info("发送业绩树消息:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ACHIEVE_TREE.getExchange(), QueueEnum.ACHIEVE_TREE.getRoute(), id, correlationData); |
| | | } |
| | | } |