26 files modified
20 files added
| New file |
| | |
| | | package cc.mrbird.febs.common.tree; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.ArrayDeque; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * |
| | | * @author wzy |
| | | * @date 2023-04-18 |
| | | **/ |
| | | @Slf4j |
| | | public class MatrixTree { |
| | | |
| | | private static final MatrixTree MATRIX_TREE = new MatrixTree(); |
| | | public static MatrixTree getInstance() { |
| | | return MATRIX_TREE; |
| | | } |
| | | |
| | | private int childNodeCnt = 2; |
| | | |
| | | // 节点数量 |
| | | private int count = 0; |
| | | private MemberNode root; |
| | | |
| | | private MatrixTree() { |
| | | count = 1; |
| | | } |
| | | |
| | | /** |
| | | * @param node 待添加的节点 |
| | | * @return 返回父节点 |
| | | */ |
| | | public MemberNode addNode(MemberNode node) { |
| | | if (root == null) { |
| | | root = node; |
| | | return null; |
| | | } |
| | | |
| | | MemberNode childTreeRoot = getNode(node.getRefererId()); |
| | | |
| | | MemberNode parentNode = findNotWholeNode(childTreeRoot == null ? root : childTreeRoot); |
| | | parentNode.addNode(node); |
| | | return parentNode; |
| | | } |
| | | |
| | | public MemberNode addNode(MemberNode node, Long parentNodeId) { |
| | | if (parentNodeId == null) { |
| | | root = node; |
| | | return null; |
| | | } |
| | | |
| | | MemberNode parentNode = getNode(parentNodeId); |
| | | parentNode.addNode(node); |
| | | return parentNode; |
| | | } |
| | | |
| | | /** |
| | | * 层级遍历,查到子节点未满3个的节点 |
| | | * @return |
| | | */ |
| | | public MemberNode findNotWholeNode(MemberNode root) { |
| | | ArrayDeque<MemberNode> deque = new ArrayDeque<>(); |
| | | deque.add(root); |
| | | |
| | | MemberNode result = null; |
| | | while(!deque.isEmpty()) { |
| | | int num = deque.size(); |
| | | |
| | | for (int i = 0; i < num; i++) { |
| | | MemberNode memberNode = deque.removeFirst(); |
| | | if (memberNode.CHILD.size() < childNodeCnt) { |
| | | result = memberNode; |
| | | break; |
| | | } |
| | | |
| | | for (MemberNode node : memberNode.CHILD) { |
| | | deque.addLast(node); |
| | | } |
| | | } |
| | | |
| | | if (result != null) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public MemberNode findNotWholeNode() { |
| | | return findNotWholeNode(root); |
| | | } |
| | | |
| | | /** |
| | | * 查找整个树下对应节点 |
| | | * @param param memberId/address/inviteId |
| | | * @return |
| | | */ |
| | | public MemberNode getNode(Object param) { |
| | | if (root == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (root.getMemberId().equals(param) || root.getInviteId().equals(param)) { |
| | | return root; |
| | | } |
| | | |
| | | return getNode(root.CHILD, param); |
| | | } |
| | | |
| | | /** |
| | | * 查找某节点下的对应节点 |
| | | * |
| | | * @param nodeList 某节点 |
| | | * @param param memberId/address/inviteId |
| | | * @return |
| | | */ |
| | | public MemberNode getNode(List<MemberNode> nodeList, Object param) { |
| | | if (CollUtil.isEmpty(nodeList)) { |
| | | return null; |
| | | } |
| | | |
| | | for (MemberNode node : nodeList) { |
| | | if (node.getMemberId().equals(param) || node.getInviteId().equals(param)) { |
| | | return node; |
| | | } |
| | | |
| | | MemberNode childNode = getNode(node.CHILD, param); |
| | | if (childNode != null) { |
| | | return childNode; |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.common.tree; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2022-08-23 |
| | | **/ |
| | | @Data |
| | | public class MemberNode { |
| | | |
| | | private Long memberId; |
| | | |
| | | private String inviteId; |
| | | |
| | | private String refererId; |
| | | |
| | | public List<MemberNode> CHILD = new LinkedList<>(); |
| | | |
| | | public MemberNode(Long memberId, String phone, String inviteId, String refererId) { |
| | | this.memberId = memberId; |
| | | this.inviteId = inviteId; |
| | | this.refererId = refererId; |
| | | } |
| | | |
| | | public MemberNode() {} |
| | | |
| | | public void addNode(MemberNode node) { |
| | | this.CHILD.add(node); |
| | | } |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.common.utils; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.Random; |
| | | |
| | | public class MallUtils { |
| | | |
| | | public static String getRandomNum(int length) { |
| | | String str = "0123456789"; |
| | | Random random = new Random(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int i = 0; i < length; ++i) { |
| | | int number = random.nextInt(str.length()); |
| | | sb.append(str.charAt(number)); |
| | | } |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static String getOrderNum(String prefix) { |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | String dd=df.format(new Date()); |
| | | if (StrUtil.isNotBlank(prefix)) { |
| | | return prefix+dd+getRandomNum(5); |
| | | } |
| | | return dd+getRandomNum(5); |
| | | } |
| | | |
| | | public static String getOrderNum() { |
| | | return getOrderNum(null); |
| | | } |
| | | } |
| | |
| | | } |
| | | System.out.println("启动区块事件监听,监听起始:"+start); |
| | | andaoContractMain.listenBetting(start); |
| | | andaoContractMain.listenBettings(start); |
| | | } |
| | | } |
| | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据flowID,重新消费", notes = "根据flowID,重新消费") |
| | | @GetMapping(value = "/sendFlow/{flowId}") |
| | | public FebsResponse sendFlow(@PathVariable("flowId") String flowId) { |
| | | chainProducer.sendContractAnDao(Long.parseLong(flowId)); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | // @ApiOperation(value = "头部数据", notes = "头部数据") |
| | | // @GetMapping(value = "/totalIncome") |
| | | // public FebsResponse totalIncome() { |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.controller; |
| | | |
| | | import cc.mrbird.febs.common.annotation.EncryptEnable; |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.dapp.dto.*; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.dapp.vo.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author |
| | | * @date 2022-03-17 |
| | | **/ |
| | | @Slf4j |
| | | @EncryptEnable |
| | | @RequiredArgsConstructor |
| | | @CrossOrigin("*") |
| | | @RestController |
| | | @Api(value = "dapp接口", tags = "dappOrder接口") |
| | | @RequestMapping(value = "/dapi/order") |
| | | public class ApiDappOrderController { |
| | | |
| | | private final DappMemberService dappMemberService; |
| | | |
| | | @ApiOperation(value = "商品列表", notes = "商品列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = MallGoodsListVo.class) |
| | | }) |
| | | @PostMapping(value = "/findMallGoodsList") |
| | | public FebsResponse findMallGoodsList(@RequestBody MallGoodsQueryDto queryDto) { |
| | | return new FebsResponse().success().data(dappMemberService.findMallGoodsListInPage(queryDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "商品详情", notes = "商品详情") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = MallGoodsListVo.class) |
| | | }) |
| | | @GetMapping(value = "/goodsDetails/{id}") |
| | | public FebsResponse goodsDetails(@PathVariable("id") Long id) { |
| | | return new FebsResponse().success().data(dappMemberService.findGoodsDetailsById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "订单列表", notes = "订单列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = MallOrderListVo.class) |
| | | }) |
| | | @PostMapping(value = "/findMallOrderList") |
| | | public FebsResponse findMallOrderList(@RequestBody MallOrderQueryDto queryDto) { |
| | | return new FebsResponse().success().data(dappMemberService.findMallOrderListInPage(queryDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "订单详情", notes = "订单详情") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = MallOrderListVo.class) |
| | | }) |
| | | @GetMapping(value = "/orderDetails/{id}") |
| | | public FebsResponse orderDetails(@PathVariable("id") Long id) { |
| | | return new FebsResponse().success().data(dappMemberService.findOrderDetailsById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "创建订单", notes = "创建订单") |
| | | @PostMapping(value = "/createOrder") |
| | | public FebsResponse createOrder(@RequestBody AddOrderDto addOrderDto) { |
| | | Long orderId = dappMemberService.createOrder(addOrderDto); |
| | | return new FebsResponse().success().data(orderId).message("操作成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "取消订单", notes = "取消订单") |
| | | @PostMapping(value = "/cancelOrder/{id}") |
| | | public FebsResponse cancelOrder(@PathVariable("id") Long id) { |
| | | dappMemberService.cancelOrder(id); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "支付订单", notes = "支付订单") |
| | | @PostMapping(value = "/payOrder") |
| | | public FebsResponse payOrder(@PathVariable("id") Long id) { |
| | | dappMemberService.payOrder(id); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AddOrderDto", description = "新增订单接口参数接收类") |
| | | public class AddOrderDto { |
| | | |
| | | @NotNull(message = "参数不能为空") |
| | | @ApiModelProperty(value = "商品ID", example = "1") |
| | | private Long goodsId; |
| | | |
| | | |
| | | @NotNull(message = "参数不能为空") |
| | | @ApiModelProperty(value = "数量", example = "1") |
| | | private Integer goodsCnt; |
| | | |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class MallGoodsQueryDto { |
| | | |
| | | @ApiModelProperty(value = "页码", example = "1") |
| | | private Integer pageNow; |
| | | |
| | | @ApiModelProperty(value = "每页数量", example = "10") |
| | | private Integer pageSize; |
| | | |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class MallOrderQueryDto { |
| | | |
| | | @ApiModelProperty(value = "页码", example = "1") |
| | | private Integer pageNow; |
| | | |
| | | @ApiModelProperty(value = "每页数量", example = "10") |
| | | private Integer pageSize; |
| | | |
| | | @ApiModelProperty(value = "状态;1-待支付2-已支付3-已取消", example = "10") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long memberId; |
| | | } |
| | |
| | | this.fee = fee; |
| | | } |
| | | |
| | | // public DappFundFlowEntity(Long memberId, BigDecimal amount, Integer type, Integer status, BigDecimal fee,Long systemProfitId) { |
| | | // this.memberId = memberId; |
| | | // this.amount = amount; |
| | | // this.type = type; |
| | | // this.status = status; |
| | | // this.fee = fee; |
| | | // this.systemProfitId = systemProfitId; |
| | | // } |
| | | |
| | | public DappFundFlowEntity(Long memberId, BigDecimal amount, Integer type, Integer status, BigDecimal fee, String fromHash) { |
| | | this.memberId = memberId; |
| | | this.amount = amount; |
| | |
| | | private Integer withdrawAble; |
| | | |
| | | private String inviteId; |
| | | private String inviteRight; |
| | | private String inviteLeft; |
| | | |
| | | private String refererId; |
| | | |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author |
| | | * @date 2022-03-17 |
| | | **/ |
| | | @Data |
| | | @TableName("dapp_wallet_coin") |
| | | public class DappWalletCoinEntity extends BaseEntity { |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2022-06-15 |
| | | **/ |
| | | @Data |
| | | @TableName("mall_achieve_record") |
| | | public class MallAchieveRecord extends BaseEntity { |
| | | |
| | | private Long memberId; |
| | | |
| | | private BigDecimal amount; |
| | | //订单成本 |
| | | private BigDecimal costAmount; |
| | | |
| | | private Date achieveTime; |
| | | |
| | | private Long orderId; |
| | | |
| | | private Long orderItemId; |
| | | //1-进行中 2-已结束 |
| | | private Integer isNormal; |
| | | |
| | | private Date payTime; |
| | | public MallAchieveRecord() {} |
| | | |
| | | |
| | | public MallAchieveRecord(Long memberId, |
| | | BigDecimal amount, |
| | | BigDecimal costAmount, |
| | | Date achieveTime, |
| | | Long orderId, |
| | | Integer isNormal, |
| | | Date payTime) { |
| | | this.memberId = memberId; |
| | | this.amount = amount; |
| | | this.costAmount = costAmount; |
| | | this.achieveTime = achieveTime; |
| | | this.orderId = orderId; |
| | | this.isNormal = isNormal; |
| | | this.payTime = payTime; |
| | | } |
| | | |
| | | } |
| | |
| | | private String payMethod; |
| | | //支付订单号 |
| | | private String payOrderNo; |
| | | //支付结果 1-成功2-未成功 |
| | | //支付结果 1-成功2-失败 |
| | | private String payResult; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Integer status; |
| | | |
| | | public static final Integer STATUS_WAIT = 1; |
| | | public static final Integer STATUS_PAY = 2; |
| | | public static final Integer STATUS_CANCEL = 3; |
| | | |
| | | /** |
| | | * 取消类型;1-超时未支付2-主动取消 |
| | | */ |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName(value = "matrix_tree_node") |
| | | public class MatrixTreeNode extends BaseEntity { |
| | | |
| | | private Long treeNode; |
| | | |
| | | private Long parentNode; |
| | | |
| | | private Integer deep; |
| | | |
| | | @TableField(exist = false) |
| | | private String phone; |
| | | |
| | | @TableField(exist = false) |
| | | private String name; |
| | | |
| | | @TableField(exist = false) |
| | | private String inviteId; |
| | | |
| | | @TableField(exist = false) |
| | | private String referrerId; |
| | | } |
| | |
| | | |
| | | @Getter |
| | | public enum DataDictionaryEnum { |
| | | // 前期节点归集地址 |
| | | TOTAL_ADDRESS("SYSTEM_SETTING","TOTAL_ADDRESS"), |
| | | // 分发地址的私钥 |
| | | FEE_ADDRESS_KEY("SYSTEM_SETTING","FEE_ADDRESS_KEY"), |
| | | // 复投盈利收益 |
| | | INVEST_AMOUNT_PROFIT("SYSTEM_SETTING","INVEST_AMOUNT_PROFIT"), |
| | | // 投资金额 |
| | | INVEST_AMOUNT("SYSTEM_SETTING","INVEST_AMOUNT"), |
| | | // 当前轮数 |
| | | QUEUE_COUNT("SYSTEM_SETTING","QUEUE_COUNT"), |
| | | // 会员代理等级 |
| | | BIG_BOSS("MEMBER_LEVEL","BIG_BOSS"), |
| | | BOSS("MEMBER_LEVEL","BOSS"), |
| | | AGENT("MEMBER_LEVEL","AGENT"), |
| | | MEMBER("MEMBER_LEVEL","MEMBER"), |
| | | // 层级奖励比率 |
| | | LEVEL_PROFIT("SYSTEM_SETTING","LEVEL_PROFIT"), |
| | | // 直推奖励比率 |
| | | DIRECT_PROFIT("SYSTEM_SETTING","DIRECT_PROFIT"), |
| | | // 技术方收取BNB数量 |
| | | SYSTEM_PROFIT("SYSTEM_SETTING","SYSTEM_PROFIT"), |
| | | // 每日返利的产矿百分比 |
| | | REBATE_PERCENT("SYSTEM_SETTING","REBATE_PERCENT"), |
| | | // 分给推荐三人的终身VIP会员手续费 |
| | | MEMBER_FEE("SYSTEM_SETTING","MEMBER_FEE"), |
| | | // 提现手续费 |
| | | WITHDRAW_SERVICE_FEE("SYSTEM_SETTING", "WITHDRAW_SERVICE_FEE"), |
| | | // 币的价格 |
| | | SYMBOL_PRICE("SYSTEM_SETTING", "SYMBOL_PRICE"); |
| | | /** |
| | | * shareSpeedPercent 共享区加速百分比 |
| | | * shareMaxPercent 共享区加速最大值 |
| | | * smallAchieve 升级要求业绩 |
| | | * teamPercent 团队静态收益 |
| | | * orderSalePercent 全网销售额加权平分分红 |
| | | * {"shareMinPercent":"0.00004","shareMaxPercent":"0.01","smallAchieve":"20000","teamPercent":"0.15","orderSalePercent":"0"} |
| | | * {"shareMinPercent":"0.00005","shareMaxPercent":"0.012","smallAchieve":"60000","teamPercent":"0.3","orderSalePercent":"0"} |
| | | * {"shareMinPercent":"0.00006","shareMaxPercent":"0.014","smallAchieve":"200000","teamPercent":"0.45","orderSalePercent":"0"} |
| | | * {"shareMinPercent":"0.00007","shareMaxPercent":"0.016","smallAchieve":"600000","teamPercent":"0.60","orderSalePercent":"0"} |
| | | * {"shareMinPercent":"0.00008","shareMaxPercent":"0.018","smallAchieve":"2000000","teamPercent":"0.75","orderSalePercent":"0.02"} |
| | | * {"shareMinPercent":"0.00009","shareMaxPercent":"0.020","smallAchieve":"6000000","teamPercent":"0.90","orderSalePercent":"0.02"} |
| | | * {"shareMinPercent":"0.0001","shareMaxPercent":"0.022","smallAchieve":"20000000","teamPercent":"1","orderSalePercent":"0.02"} |
| | | */ |
| | | V1("TEAM_LEVEL","V1"), |
| | | V2("TEAM_LEVEL","V2"), |
| | | V3("TEAM_LEVEL","V3"), |
| | | V4("TEAM_LEVEL","V4"), |
| | | V5("TEAM_LEVEL","V5"), |
| | | V6("TEAM_LEVEL","V6"), |
| | | V7("TEAM_LEVEL","V7"), |
| | | /** |
| | | * 商城入单的10%入底池 |
| | | */ |
| | | USDT_ORDER_PERCENT("USDT_ORDER_PERCENT","USDT_ORDER_PERCENT"), |
| | | /** |
| | | * 积分价格 = USDT底池 / 积分底池 |
| | | */ |
| | | SCORE_PRICE("SCORE_PRICE","SCORE_PRICE"), |
| | | /** |
| | | * 积分底池 |
| | | */ |
| | | SCORE_POOL("SCORE_POOL","SCORE_POOL"), |
| | | /** |
| | | * USDT底池 |
| | | */ |
| | | USDT_POOL("USDT_POOL","USDT_POOL"), |
| | | /** |
| | | * |
| | | * 每个帐号下的消费订单独立结算,最大封顶为此消费单的本金5%(每日每人的最大获得比例)每天(可设定,最小为0) |
| | | */ |
| | | MAX_RELEASE("MAX_RELEASE","MAX_RELEASE"), |
| | | /** |
| | | * 直推加速,享受直推人的100%个人静态释放 |
| | | * 直推消费分享:享受直接分享人每日消费金额释放的100%加速。 |
| | | * (a推b,b收益5块,那么a也有5块。) |
| | | */ |
| | | DIRECT_RELEASE("DIRECT_RELEASE","DIRECT_RELEASE"), |
| | | /** |
| | | * 每天按照消费金额的5‰个人静态释放 |
| | | * (千分之五的静态释放比例) |
| | | * (按购买顺序结算,同时有5个订单就有结算记录) |
| | | * (设置多少,全部按照最新的来释放) |
| | | */ |
| | | STATIC_RELEASE("STATIC_RELEASE","STATIC_RELEASE"), |
| | | /** |
| | | * 赠送消费金额1.5倍增值积分(释放额度,额度为零就要复购) |
| | | */ |
| | | DONATE_SCORE_PERCENT("DONATE_SCORE_PERCENT","DONATE_SCORE_PERCENT"); |
| | | |
| | | private String type; |
| | | |
| | |
| | | |
| | | /** |
| | | * 流水类型 |
| | | * 类型 1-认购节点 2-直推收益 3-技术方收款 4-入金,买入A币 5-进入a底池... |
| | | */ |
| | | @Getter |
| | | public enum FundFlowEnum { |
| | | //进入提现池-(USDT 提现池) |
| | | USDT_IN_W_POOL("USDT_IN_W_POOL", 34), |
| | | //权益额度 |
| | | MEMBER_AMOUNT_PERK_TOTAL("MEMBER_AMOUNT_PERK_TOTAL", 33), |
| | | //ANDAO互转 |
| | | ANDAO_MEMBER_TO_MENBER("ANDAO_MEMBER_TO_MENBER", 32), |
| | | //AUSDT互转 |
| | | AUSDT_MEMBER_TO_MENBER("AUSDT_MEMBER_TO_MENBER", 31), |
| | | //20%全网加权分红(按20%释放递减)-(全网收益) |
| | | POOL_MEMBER_A_CNT("POOL_MEMBER_A_CNT", 30), |
| | | //每小时燃烧-(AN DAO燃烧) |
| | | A_COIN_FIRE("A_COIN_FIRE", 29), |
| | | //入金,买入AUSD币-(买入AUSD) |
| | | BUY_AUSD_COIN("BUY_AUSD_COIN", 28), |
| | | //闪对钱包转USDT(USDT流水)-(闪兑USDT) |
| | | WALLET_COIN_TO_USDT_W("WALLET_COIN_TO_USDT_W", 27), |
| | | //闪对钱包转USDT-(AN DAO-USDT) |
| | | WALLET_COIN_TO_USDT("WALLET_COIN_TO_USDT", 25), |
| | | //资产钱包转账到闪对钱包-(闪兑AN DAO) |
| | | WALLET_MINE_TO_COIN_FEE("WALLET_MINE_TO_COIN_FEE", 24), |
| | | //资产钱包转账到闪对钱包-(资产AN DAO-闪兑AN DAO) |
| | | WALLET_MINE_TO_COIN("WALLET_MINE_TO_COIN", 23), |
| | | //节点的全网分红-(DAO 5平级收益) |
| | | DAO_5_NODE_EQUALS_PERK("DAO_5_NODE_EQUALS_PERK", 22), |
| | | //-(DAO 5节点收益奖) |
| | | DAO_5_NODE_PERK("DAO_5_NODE_PERK", 21), |
| | | //-(DAO 4节点收益) |
| | | DAO_4_NODE_PERK("DAO_4_NODE_PERK", 20), |
| | | //-(DAO 3节点收益) |
| | | DAO_3_NODE_PERK("DAO_3_NODE_PERK", 19), |
| | | //dao5的平级全网分红-(每日DAO 5平级收益总量) |
| | | DAO_5_CNT_EQUALS_MEMBER("DAO_5_CNT_EQUALS_MEMBER", 18), |
| | | //dao5的全网分红-(每日DAO 5的全网收益总量) |
| | | DAO_5_CNT_MEMBER("DAO_5_CNT_MEMBER", 17), |
| | | //dao4的全网分红-(每日DAO 4的全网收益总量) |
| | | DAO_4_CNT_MEMBER("DAO_4_CNT_MEMBER", 16), |
| | | //dao3的全网分红-(每日DAO 3的全网收益总量) |
| | | DAO_3_CNT_MEMBER("DAO_3_CNT_MEMBER", 15), |
| | | //10%级差奖给会员-(业绩奖) |
| | | LEVEL_A_PERCENT_CNT_MEMBER("LEVEL_A_PERCENT_CNT_MEMBER", 14), |
| | | //10%级差奖-(业绩奖收益总量) |
| | | LEVEL_A_PERCENT_CNT("LEVEL_A_PERCENT_CNT", 13), |
| | | //5%基金会-(基金会收益总量) |
| | | FOUNDATION_A_PERCENT("NODE_A_PERCENT_TO_MEMBER", 12), |
| | | //5%节点平分-(超级节点收益) |
| | | NODE_A_PERCENT_TO_MEMBER("NODE_A_PERCENT_TO_MEMBER", 11), |
| | | //5%节点-(超级节点收益总量) |
| | | NODE_A_PERCENT("NODE_A_PERCENT", 10), |
| | | //10%直推-(直推收益) |
| | | DIRECT_A_PERCENT("DIRECT_A_PERCENT", 9), |
| | | //20%全网加权分红(按20%释放递减)-(全网加权分红收益总量) |
| | | POOL_ALL_MEMBER_A_CNT("POOL_ALL_MEMBER_A_CNT", 8), |
| | | //50%客户秒到-(AN DAO) |
| | | MEMBER_GET_A_CNT("MEMBER_GET_A_CNT", 7), |
| | | //进入b底池-(USDT B池) |
| | | USDT_IN_B_POOL("USDT_IN_B_POOL", 6), |
| | | //进入a底池-(USDT A池) |
| | | USDT_IN_A_POOL("USDT_IN_A_POOL", 5), |
| | | //入金,买入A币-(买入AN DAO) |
| | | BUY_A_COIN("BUY_A_COIN", 4), |
| | | //技术方收款-(技术方收益) |
| | | PROJECT_PERK("PROJECT_PERK", 3), |
| | | //直推收益-(节点直推收益) |
| | | DIRECT_PERK("DIRECT_PERK", 2), |
| | | //认购节点-(买入节点) |
| | | BUY_NODE("BUY_NODE", 1); |
| | | //赠送积分 |
| | | PAY_ORDER("PAY_ORDER", 2), |
| | | //赠送积分 |
| | | DONATE_SCORE("DONATE_SCORE", 1); |
| | | |
| | | private String type; |
| | | |
| | |
| | | public enum MemberLevelEnum { |
| | | /** |
| | | */ |
| | | NODE_5("NODE_5",5,"DAO5"), |
| | | NODE_4("NODE_4",4,"DAO4"), |
| | | NODE_3("NODE_3",3,"DAO3"), |
| | | NODE_2("NODE_2",2,"DAO2"), |
| | | NODE_1("NODE_1",1,"DAO1"), |
| | | V7("V7",5,"V7"), |
| | | V6("V6",5,"V6"), |
| | | V5("V5",5,"V5"), |
| | | V4("V4",4,"V4"), |
| | | V3("V3",3,"V3"), |
| | | V2("V2",2,"V2"), |
| | | V1("V1",1,"V1"), |
| | | MEMBER("MEMBER",0,"MEMBER"); |
| | | |
| | | |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.init; |
| | | |
| | | import cc.mrbird.febs.dapp.entity.MatrixTreeNode; |
| | | import cc.mrbird.febs.dapp.mapper.MatrixTreeNodeMapper; |
| | | import cc.mrbird.febs.common.tree.MatrixTree; |
| | | import cc.mrbird.febs.common.tree.MemberNode; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 初始化 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class MatrixTreeInit { |
| | | |
| | | @Autowired |
| | | private MatrixTreeNodeMapper matrixTreeNodeMapper; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | List<MatrixTreeNode> tree = matrixTreeNodeMapper.selectAllMatrixTreeNode(); |
| | | |
| | | if (CollUtil.isEmpty(tree)) { |
| | | return; |
| | | } |
| | | |
| | | for (MatrixTreeNode node : tree) { |
| | | MemberNode memberNode = new MemberNode(); |
| | | memberNode.setMemberId(node.getTreeNode()); |
| | | memberNode.setInviteId(node.getInviteId()); |
| | | memberNode.setRefererId(node.getReferrerId()); |
| | | MatrixTree.getInstance().addNode(memberNode, node.getParentNode()); |
| | | } |
| | | |
| | | MatrixTree instance = MatrixTree.getInstance(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package cc.mrbird.febs.dapp.mapper; |
| | | |
| | | import cc.mrbird.febs.dapp.dto.MallGoodsQueryDto; |
| | | import cc.mrbird.febs.dapp.dto.MallOrderQueryDto; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.vo.AdminTeamInfoVo; |
| | | import cc.mrbird.febs.dapp.vo.DappMemberInfoVo; |
| | | import cc.mrbird.febs.dapp.vo.*; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | List<DappMemberEntity> selectByNodetype(); |
| | | |
| | | List<String> selectAddress(); |
| | | |
| | | IPage<MallGoodsListVo> selectMallGoodsListQueryInPage( @Param("record")MallGoodsQueryDto queryDto, Page<MallGoodsListVo> page); |
| | | |
| | | IPage<MallOrderListVo> selectMallOrderListQueryInPage( @Param("record")MallOrderQueryDto queryDto, Page<MallOrderListVo> page); |
| | | |
| | | MallOrderListVo selectMallOrderListVoById(@Param("orderId")Long id); |
| | | |
| | | List<MallOrderItemVo> selectMallOrderItemVoByOrderId(@Param("orderId")Long id); |
| | | |
| | | MallGoodsListVo selectMallGoodsListVoById(@Param("goodsId")Long id); |
| | | |
| | | DappMemberEntity selectInviteLeft(@Param("inviteId")String inviteId); |
| | | |
| | | DappMemberEntity selectInviteRight(@Param("inviteId")String inviteId); |
| | | } |
| | |
| | | List<DappMemberEntity> selectTotalAmount(); |
| | | |
| | | void addTotalAndaddAvailableByMemberId(@Param("memberId")Long id, @Param("balance")BigDecimal multiply); |
| | | void reduceTotalAndAvailableByMemberId(@Param("memberId")Long id, @Param("balance")BigDecimal multiply); |
| | | |
| | | List<DappWalletCoinEntity> selectAmountThanZero(); |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.mapper; |
| | | |
| | | import cc.mrbird.febs.dapp.entity.MallAchieveRecord; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface MallAchieveRecordMapper extends BaseMapper<MallAchieveRecord> { |
| | | /** |
| | | * 根据日期获取总业绩 |
| | | * @param type D:某一天;M:某一月 |
| | | * @param date |
| | | * @return |
| | | */ |
| | | BigDecimal selectAchieveTotal(@Param("type") String type, @Param("date") Date date); |
| | | |
| | | BigDecimal selectSumAchieveByMemberIds(@Param("list")List<Long> mallMembersOffLinePerkIds, @Param("date") Date date); |
| | | |
| | | List<MallAchieveRecord> selectListByDate(@Param("date")Date profitDate); |
| | | } |
| | |
| | | package cc.mrbird.febs.dapp.mapper; |
| | | |
| | | import cc.mrbird.febs.dapp.dto.MallOrderInfoDto; |
| | | import cc.mrbird.febs.dapp.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.dapp.entity.MallOrderItem; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface MallOrderInfoMapper extends BaseMapper<MallOrderInfo> { |
| | | |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.mapper; |
| | | |
| | | |
| | | import cc.mrbird.febs.dapp.entity.MallOrderItem; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface MallOrderItemMapper extends BaseMapper<MallOrderItem> { |
| | | |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.mapper; |
| | | |
| | | import cc.mrbird.febs.dapp.entity.MatrixTreeNode; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface MatrixTreeNodeMapper extends BaseMapper<MatrixTreeNode> { |
| | | |
| | | List<MatrixTreeNode> selectAllMatrixTreeNode(); |
| | | |
| | | MatrixTreeNode selectByTreeNode(@Param("treeNode") Long treeNode); |
| | | } |
| | |
| | | |
| | | void setNewestPrice(PriceSettingDto priceSettingDto); |
| | | |
| | | DappMemberEntity insertMember(String address, String refererId); |
| | | DappMemberEntity insertMember(String address, String refererId,int nodeType); |
| | | |
| | | DappMemberEntity insertMember(String address, String refererId, String chainType, String accountType); |
| | | DappMemberEntity insertMember(String address, String refererId, String chainType, String accountType,int nodeType); |
| | | |
| | | TeamListVo findTeamList(); |
| | | |
| | |
| | | |
| | | FebsResponse agentLevelSetUpdate(AgentLevelSetUpdateDto agentLevelSetUpdateDto); |
| | | |
| | | IPage<MallGoodsListVo> findMallGoodsListInPage(MallGoodsQueryDto queryDto); |
| | | |
| | | IPage<MallOrderListVo> findMallOrderListInPage(MallOrderQueryDto queryDto); |
| | | |
| | | MallOrderListVo findOrderDetailsById(Long id); |
| | | |
| | | MallGoodsListVo findGoodsDetailsById(Long id); |
| | | |
| | | Long createOrder(AddOrderDto addOrderDto); |
| | | |
| | | void cancelOrder(Long id); |
| | | |
| | | void payOrder(Long id); |
| | | } |
| | |
| | | |
| | | SystemDto system(); |
| | | |
| | | void achieveTree(Long memberId); |
| | | |
| | | /** |
| | | * 投入收益 |
| | | * |
| | |
| | | void contractAnDaoMsg(Long flowId); |
| | | |
| | | void contractAnDaoInMsg(Long flowId); |
| | | |
| | | void speedPayOrderMsg(Long orderId); |
| | | |
| | | void speedAutoLevelUpMsg(Long memberId); |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.service; |
| | | |
| | | import cc.mrbird.febs.common.tree.MemberNode; |
| | | import cc.mrbird.febs.dapp.entity.MatrixTreeNode; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | public interface IMatrixTreeNodeService extends IService<MatrixTreeNode> { |
| | | |
| | | public MemberNode addTreeNode(Long memberId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jsoup.helper.DataUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.web3j.utils.Strings; |
| | |
| | | private final DappMemberNodeMapper dappMemberNodeMapper; |
| | | private final DappAKlineMapper dappAKlineMapper; |
| | | private final DappUsdtPerkEntityMapper dappUsdtPerkEntityMapper; |
| | | private final MallGoodsMapper mallGoodsMapper; |
| | | private final MallOrderInfoMapper mallOrderInfoMapper; |
| | | private final MallOrderItemMapper mallOrderItemMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | if (member == null) { |
| | | String referenceID = null; |
| | | int nodeType = 0; |
| | | // |
| | | if (!"asdf4321".equals(connectDto.getInviteId())) { |
| | | DappMemberEntity parent = dappMemberDao.selectByAddress(connectDto.getInviteId(), null); |
| | | DappMemberEntity left = dappMemberDao.selectInviteLeft(connectDto.getInviteId()); |
| | | DappMemberEntity right = dappMemberDao.selectInviteRight(connectDto.getInviteId()); |
| | | if(ObjectUtil.isEmpty(left) && ObjectUtil.isEmpty(right)){ |
| | | throw new FebsException("recommender is not exist"); |
| | | } |
| | | if(ObjectUtil.isEmpty(left)){ |
| | | nodeType = 2; |
| | | }else{ |
| | | nodeType = 1; |
| | | } |
| | | String inviteId = ObjectUtil.isEmpty(left) ? right.getInviteId() : left.getInviteId(); |
| | | DappMemberEntity parent = dappMemberDao.selectByAddress(inviteId, null); |
| | | if (parent == null) { |
| | | throw new FebsException("recommender is not exist"); |
| | | } |
| | |
| | | } else { |
| | | connectDto.setInviteId(null); |
| | | } |
| | | member = insertMember(connectDto.getAddress(), referenceID); |
| | | member = insertMember(connectDto.getAddress(), referenceID,nodeType); |
| | | } |
| | | |
| | | String key = LoginUserUtil.getLoginKey(connectDto.getAddress(), connectDto.getNonce(), connectDto.getSign()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public DappMemberEntity insertMember(String address, String refererId) { |
| | | public DappMemberEntity insertMember(String address, String refererId,int nodeType) { |
| | | |
| | | return insertMember(address, refererId, "BSC", DataDictionaryEnum.MEMBER.getCode()); |
| | | return insertMember(address, refererId, "BSC", MemberLevelEnum.MEMBER.getType(),nodeType); |
| | | } |
| | | |
| | | @Override |
| | | public DappMemberEntity insertMember(String address, String refererId, String chainType, String accountType) { |
| | | public DappMemberEntity insertMember(String address, String refererId, String chainType, String accountType,int nodeType) { |
| | | DappMemberEntity member = new DappMemberEntity(); |
| | | member.setAddress(address); |
| | | member.setChainType(chainType); |
| | | member.setAccountType(accountType); |
| | | member.setActiveStatus(2); |
| | | member.setNodeType(nodeType); |
| | | |
| | | dappMemberDao.insert(member); |
| | | |
| | |
| | | // 若没有推荐人,则直接激活 |
| | | member.setActiveStatus(2); |
| | | } |
| | | |
| | | member.setInviteId(ShareCodeUtil.toSerialCode(member.getId())); |
| | | String inviteIdStr = ShareCodeUtil.toSerialCode(member.getId()); |
| | | member.setInviteId(inviteIdStr); |
| | | member.setInviteLeft(inviteIdStr+"L"); |
| | | member.setInviteRight(inviteIdStr+"R"); |
| | | member.setRefererId(refererId); |
| | | if (StrUtil.isNotBlank(refererId)) { |
| | | boolean flag = false; |
| | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<MallGoodsListVo> findMallGoodsListInPage(MallGoodsQueryDto queryDto) { |
| | | Page<MallGoodsListVo> page = new Page<>(queryDto.getPageNow(), queryDto.getPageSize()); |
| | | return dappMemberDao.selectMallGoodsListQueryInPage(queryDto, page); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<MallOrderListVo> findMallOrderListInPage(MallOrderQueryDto queryDto) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | queryDto.setMemberId(member.getId()); |
| | | Page<MallOrderListVo> page = new Page<>(queryDto.getPageNow(), queryDto.getPageSize()); |
| | | return dappMemberDao.selectMallOrderListQueryInPage(queryDto, page); |
| | | } |
| | | |
| | | @Override |
| | | public MallOrderListVo findOrderDetailsById(Long id) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | MallOrderListVo mallOrderListVo = dappMemberDao.selectMallOrderListVoById(id); |
| | | List<MallOrderItemVo> mallOrderItemVoList = dappMemberDao.selectMallOrderItemVoByOrderId(id); |
| | | mallOrderListVo.setItems(mallOrderItemVoList); |
| | | return mallOrderListVo; |
| | | } |
| | | |
| | | @Override |
| | | public MallGoodsListVo findGoodsDetailsById(Long id) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | MallGoodsListVo mallGoodsListVo = dappMemberDao.selectMallGoodsListVoById(id); |
| | | return mallGoodsListVo; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Long createOrder(AddOrderDto addOrderDto) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | /** |
| | | * 1、商品是否上架 |
| | | * 2、用户余额是否足够 |
| | | */ |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(addOrderDto.getGoodsId()); |
| | | if(ObjectUtil.isEmpty(mallGoods)){ |
| | | throw new FebsException("商品不存在"); |
| | | } |
| | | if(MallGoods.ISSALE_STATUS_DISABLED == mallGoods.getIsSale()){ |
| | | throw new FebsException("商品已下架"); |
| | | } |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(member.getId()); |
| | | if(ObjectUtil.isEmpty(dappWalletCoinEntity)){ |
| | | throw new FebsException("余额不足"); |
| | | } |
| | | BigDecimal presentPrice = new BigDecimal(mallGoods.getPresentPrice()); |
| | | BigDecimal totalAmount = presentPrice.multiply(new BigDecimal(addOrderDto.getGoodsCnt())).setScale(2,BigDecimal.ROUND_DOWN); |
| | | if(BigDecimal.ZERO.compareTo(totalAmount) >= 0){ |
| | | throw new FebsException("商品异常"); |
| | | } |
| | | BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount(); |
| | | if(totalAmount.compareTo(availableAmount) > 0){ |
| | | throw new FebsException("余额不足"); |
| | | } |
| | | /** |
| | | * 生成一条待支付的订单 |
| | | */ |
| | | |
| | | String orderNo = MallUtils.getOrderNum(); |
| | | MallOrderInfo mallOrderInfo = new MallOrderInfo(); |
| | | mallOrderInfo.setOrderNo(orderNo); |
| | | mallOrderInfo.setMemberId(member.getId()); |
| | | mallOrderInfo.setOrderTime(DateUtil.date()); |
| | | mallOrderInfo.setAmount(totalAmount); |
| | | mallOrderInfo.setStatus(MallOrderInfo.STATUS_WAIT); |
| | | mallOrderInfo.setOrderType(1); |
| | | mallOrderInfoMapper.insert(mallOrderInfo); |
| | | MallOrderItem mallOrderItem = new MallOrderItem(); |
| | | mallOrderItem.setOrderId(mallOrderInfo.getId()); |
| | | mallOrderItem.setGoodsId(addOrderDto.getGoodsId()); |
| | | mallOrderItem.setGoodsName(mallGoods.getGoodsName()); |
| | | mallOrderItem.setCnt(addOrderDto.getGoodsCnt()); |
| | | mallOrderItem.setPrice(presentPrice); |
| | | mallOrderItem.setAmount(totalAmount); |
| | | mallOrderItemMapper.insert(mallOrderItem); |
| | | return mallOrderInfo.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void cancelOrder(Long id) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | MallOrderInfo orderInfo = mallOrderInfoMapper.selectById(id); |
| | | if (ObjectUtil.isEmpty(orderInfo)) { |
| | | throw new FebsException("订单异常"); |
| | | } |
| | | |
| | | if (MallOrderInfo.STATUS_WAIT != orderInfo.getStatus()) { |
| | | throw new FebsException("只能取消待支付的订单"); |
| | | } |
| | | |
| | | orderInfo.setStatus(MallOrderInfo.STATUS_CANCEL); |
| | | orderInfo.setCancelType(MallOrderInfo.CANCEL_BY_SELF); |
| | | mallOrderInfoMapper.updateById(orderInfo); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void payOrder(Long id) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | MallOrderInfo orderInfo = mallOrderInfoMapper.selectById(id); |
| | | if (ObjectUtil.isEmpty(orderInfo)) { |
| | | throw new FebsException("订单异常"); |
| | | } |
| | | |
| | | if (MallOrderInfo.STATUS_WAIT != orderInfo.getStatus()) { |
| | | throw new FebsException("只能支付待支付的订单"); |
| | | } |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(member.getId()); |
| | | BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount(); |
| | | BigDecimal totalAmount = orderInfo.getAmount(); |
| | | if(totalAmount.compareTo(availableAmount) > 0){ |
| | | throw new FebsException("余额不足"); |
| | | } |
| | | orderInfo.setPayTime(DateUtil.date()); |
| | | String payOrderNo = MallUtils.getOrderNum("PAY"); |
| | | orderInfo.setPayOrderNo(payOrderNo); |
| | | orderInfo.setPayMethod("余额支付"); |
| | | orderInfo.setPayResult("成功"); |
| | | orderInfo.setStatus(MallOrderInfo.STATUS_PAY); |
| | | mallOrderInfoMapper.updateById(orderInfo); |
| | | /** |
| | | * 更新用户余额 |
| | | */ |
| | | dappWalletCoinDao.reduceTotalAndAvailableByMemberId(member.getId(),totalAmount); |
| | | DappFundFlowEntity donateScoreFlow = new DappFundFlowEntity( |
| | | member.getId(), |
| | | totalAmount.negate(), |
| | | FundFlowEnum.PAY_ORDER.getCode(), |
| | | 2, |
| | | BigDecimal.ZERO, |
| | | payOrderNo, |
| | | id); |
| | | dappFundFlowDao.insert(donateScoreFlow); |
| | | /** |
| | | * todo 发送一条订单出的消息 |
| | | */ |
| | | chainProducer.sendSpeedPayOrderMsg(id); |
| | | } |
| | | |
| | | public static List<List<String>> partitionList(List<String> originalList, int partitionSize) { |
| | | List<List<String>> partitionedList = new ArrayList<>(); |
| | | int size = originalList.size(); |
| | |
| | | |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.tree.MemberNode; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.common.utils.SpringContextUtil; |
| | |
| | | import cc.mrbird.febs.dapp.mapper.*; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.dapp.service.IMatrixTreeNodeService; |
| | | import cc.mrbird.febs.dapp.vo.AKLineLimitVo; |
| | | import cc.mrbird.febs.rabbit.producer.ChainProducer; |
| | | import cc.mrbird.febs.tree.MatrixTree; |
| | | import cc.mrbird.febs.tree.MemberNode; |
| | | import cc.mrbird.febs.tree.TreeConstants; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | |
| | | private final DappWalletMineDao dappWalletMineDao; |
| | | private final DappAKlineMapper dappAKlineMapper; |
| | | |
| | | private final MallOrderInfoMapper mallOrderInfoMapper; |
| | | private final MallAchieveRecordMapper mallAchieveRecordMapper; |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | SystemDto system = new SystemDto(); |
| | | system.setBuyAmount(new BigDecimal("100")); |
| | | return system; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized void achieveTree(Long memberId) { |
| | | DappMemberEntity member = dappMemberDao.selectById(memberId); |
| | | |
| | | int batchNo = 0; |
| | | DappAchieveTreeEntity newestTreeNode = dappAchieveTreeDao.selectNewestTreeNode(); |
| | | if (newestTreeNode != null) { |
| | | if (newestTreeNode.getValidState() == 2) { |
| | | batchNo = newestTreeNode.getBatchNo() + 1; |
| | | } else { |
| | | batchNo = newestTreeNode.getBatchNo(); |
| | | } |
| | | } |
| | | |
| | | // 在大树中,插入当前节点 |
| | | DappAchieveTreeEntity achieveTree = new DappAchieveTreeEntity(); |
| | | achieveTree.setMidNode(memberId); |
| | | achieveTree.setValidState(1); |
| | | achieveTree.setBatchNo(batchNo); |
| | | dappAchieveTreeDao.insert(achieveTree); |
| | | |
| | | // 在内存树(大树)中插入当前节点,并返回父节点 |
| | | MemberNode node = new MemberNode(member.getId(), member.getAddress(), member.getInviteId(), member.getRefererId()); |
| | | |
| | | MatrixTree tree = MatrixTree.getInstance(); |
| | | MemberNode exist = tree.getNode(member.getId()); |
| | | if (exist != null) { |
| | | return; |
| | | } |
| | | |
| | | MemberNode parentNode = tree.addNode(node); |
| | | |
| | | // 创建该节点的矩阵 |
| | | DappAchieveMemberTreeEntity achieveMemberTree = new DappAchieveMemberTreeEntity(); |
| | | achieveMemberTree.setTreeNode(memberId); |
| | | achieveMemberTree.setTopNode(memberId); |
| | | achieveMemberTree.setDeep(1); |
| | | achieveMemberTree.setHasMoney(1); |
| | | if (parentNode != null) { |
| | | achieveMemberTree.setParentNode(parentNode.getMemberId()); |
| | | } |
| | | dappAchieveMemberTreeDao.insert(achieveMemberTree); |
| | | |
| | | // 激活用户状态 |
| | | member.setActiveStatus(1); |
| | | dappMemberDao.updateById(member); |
| | | |
| | | putIntoProfit(memberId, 2); |
| | | if (parentNode == null) { |
| | | return; |
| | | } |
| | | |
| | | // 修改父节点在数据库中的左/右节点数据 |
| | | DappAchieveTreeEntity treeMidNode = dappAchieveTreeDao.selectByMidNode(parentNode.getMemberId()); |
| | | boolean isLeft = false; |
| | | if (parentNode.getLeft() != null && memberId.equals(parentNode.getLeft().getMemberId())) { |
| | | treeMidNode.setLeftNode(memberId); |
| | | isLeft = true; |
| | | } else { |
| | | treeMidNode.setRightNode(memberId); |
| | | } |
| | | dappAchieveTreeDao.updateById(treeMidNode); |
| | | |
| | | // 更新矩阵中的数据 |
| | | List<DappAchieveMemberTreeEntity> matrixNodes = dappAchieveMemberTreeDao.selectNotBottomNodeInMatrix(parentNode.getMemberId()); |
| | | for (DappAchieveMemberTreeEntity matrixNode : matrixNodes) { |
| | | if (isLeft) { |
| | | matrixNode.setLeftNode(memberId); |
| | | } else { |
| | | matrixNode.setRightNode(memberId); |
| | | } |
| | | |
| | | dappAchieveMemberTreeDao.updateById(matrixNode); |
| | | |
| | | DappAchieveMemberTreeEntity newMatrixNode = new DappAchieveMemberTreeEntity(); |
| | | newMatrixNode.setTreeNode(memberId); |
| | | newMatrixNode.setTopNode(matrixNode.getTopNode()); |
| | | newMatrixNode.setParentNode(parentNode.getMemberId()); |
| | | newMatrixNode.setHasMoney(1); |
| | | newMatrixNode.setDeep(matrixNode.getDeep() + 1); |
| | | dappAchieveMemberTreeDao.insert(newMatrixNode); |
| | | |
| | | if (matrixNode.getDeep() == 2) { |
| | | finishMatrixTree(matrixNode.getTopNode()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 完成矩阵树,并重置矩阵且重入 |
| | | public void finishMatrixTree(Long memberId) { |
| | | List<DappAchieveMemberTreeEntity> matrixTree = dappAchieveMemberTreeDao.selectMatrixTreeByTopNode(memberId, 1); |
| | | // 如果达到标准,则重置该矩阵树 |
| | | if (matrixTree.size() == 7) { |
| | | dappAchieveMemberTreeDao.resetMatrixTree(memberId); |
| | | dappAchieveMemberTreeDao.reentryMoney(memberId); |
| | | |
| | | putIntoProfit(memberId, 1); |
| | | DappAchieveMemberTreeEntity bottomNode = dappAchieveMemberTreeDao.selectNodeByDeep(memberId, 3); |
| | | if (bottomNode != null) { |
| | | finishMatrixTree(bottomNode.getTopNode()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void speedPayOrderMsg(Long orderId) { |
| | | MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectById(orderId); |
| | | if(ObjectUtil.isEmpty(mallOrderInfo)){ |
| | | return; |
| | | } |
| | | if(MallOrderInfo.STATUS_PAY != mallOrderInfo.getStatus()){ |
| | | return; |
| | | } |
| | | Long memberId = mallOrderInfo.getMemberId(); |
| | | /** |
| | | * 赠送消费金额1.5倍增值积分 |
| | | */ |
| | | BigDecimal amount = mallOrderInfo.getAmount(); |
| | | DataDictionaryCustom donateScorePercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.DONATE_SCORE_PERCENT.getType(), |
| | | DataDictionaryEnum.DONATE_SCORE_PERCENT.getCode() |
| | | ); |
| | | BigDecimal donateScorePercent = new BigDecimal(donateScorePercentDic.getValue()); |
| | | BigDecimal donateScore = amount.multiply(donateScorePercent); |
| | | dappWalletMineDao.updateBalance(donateScore,donateScore,memberId); |
| | | DappFundFlowEntity donateScoreFlow = new DappFundFlowEntity( |
| | | memberId, |
| | | donateScore, |
| | | FundFlowEnum.DONATE_SCORE.getCode(), |
| | | 2, |
| | | BigDecimal.ZERO, |
| | | null, |
| | | orderId); |
| | | dappFundFlowDao.insert(donateScoreFlow); |
| | | /** |
| | | * 新增一条业绩 |
| | | */ |
| | | MallAchieveRecord mallAchieveRecord = new MallAchieveRecord( |
| | | memberId,amount,amount,DateUtil.date(),orderId,1,mallOrderInfo.getPayTime() |
| | | ); |
| | | mallAchieveRecordMapper.insert(mallAchieveRecord); |
| | | |
| | | } |
| | | |
| | | |
| | | private final IMatrixTreeNodeService matrixTreeNodeService; |
| | | |
| | | @Override |
| | | public void speedAutoLevelUpMsg(Long memberId) {log.info("###代理自动升级###"); |
| | | DappMemberEntity member = dappMemberDao.selectById(memberId); |
| | | if (MemberLevelEnum.V7.getType().equals(member.getAccountType())) { |
| | | return; |
| | | } |
| | | |
| | | MemberNode parentNode = matrixTreeNodeService.addTreeNode(memberId); |
| | | if (parentNode == null) { |
| | | log.info("父级节点未找到:{}", memberId); |
| | | return; |
| | | } |
| | | |
| | | List<DataDictionaryCustom> dicList = dataDictionaryCustomMapper.selectDicByType(AppContants.AGENT_LEVEL); |
| | | DataDictionaryCustom dic = null; |
| | | for (DataDictionaryCustom dataDictionaryCustom : dicList) { |
| | | if (Integer.parseInt(dataDictionaryCustom.getValue()) == parentNode.CHILD.size()) { |
| | | dic = dataDictionaryCustom; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (dic == null) { |
| | | return; |
| | | } |
| | | |
| | | MallMember parentMember = memberMapper.selectById(parentNode.getMemberId()); |
| | | parentMember.setChildNodeCnt(parentNode.CHILD.size()); |
| | | int levelCode = MemberLevelEnum.getLevelCode(parentMember.getLevel()); |
| | | if (Integer.parseInt(dic.getValue()) >= levelCode) { |
| | | parentMember.setLevel(dic.getCode()); |
| | | } |
| | | memberMapper.updateById(parentMember); |
| | | } |
| | | |
| | | /** |
| | | * 测试转账 |
| | | * @param args |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.tree.MatrixTree; |
| | | import cc.mrbird.febs.common.tree.MemberNode; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.entity.MatrixTreeNode; |
| | | import cc.mrbird.febs.dapp.mapper.DappMemberDao; |
| | | import cc.mrbird.febs.dapp.mapper.MatrixTreeNodeMapper; |
| | | import cc.mrbird.febs.dapp.service.IMatrixTreeNodeService; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class MatrixTreeNodeServiceImpl extends ServiceImpl<MatrixTreeNodeMapper, MatrixTreeNode> implements IMatrixTreeNodeService { |
| | | |
| | | private final DappMemberDao mallMemberMapper; |
| | | private final MatrixTreeNodeMapper matrixTreeNodeMapper; |
| | | |
| | | @Override |
| | | public MemberNode addTreeNode(Long memberId) { |
| | | DappMemberEntity mallMember = mallMemberMapper.selectById(memberId); |
| | | if (mallMember == null) { |
| | | return null; |
| | | } |
| | | |
| | | MatrixTree instance = MatrixTree.getInstance(); |
| | | MemberNode node = instance.getNode(memberId); |
| | | if (node != null) { |
| | | return null; |
| | | } |
| | | |
| | | if (StrUtil.isNotBlank(mallMember.getRefererId())) { |
| | | MemberNode parentNode = instance.getNode(mallMember.getRefererId()); |
| | | |
| | | MemberNode notWholeNode = null; |
| | | if (parentNode != null) { |
| | | notWholeNode = instance.findNotWholeNode(parentNode); |
| | | } else { |
| | | notWholeNode = instance.findNotWholeNode(); |
| | | } |
| | | |
| | | MatrixTreeNode treeNode = new MatrixTreeNode(); |
| | | treeNode.setTreeNode(mallMember.getId()); |
| | | treeNode.setParentNode(notWholeNode.getMemberId()); |
| | | matrixTreeNodeMapper.insert(treeNode); |
| | | } else { |
| | | MatrixTreeNode treeNode = new MatrixTreeNode(); |
| | | treeNode.setTreeNode(mallMember.getId()); |
| | | matrixTreeNodeMapper.insert(treeNode); |
| | | } |
| | | |
| | | node = new MemberNode(); |
| | | node.setMemberId(memberId); |
| | | node.setInviteId(mallMember.getInviteId()); |
| | | node.setRefererId(mallMember.getRefererId()); |
| | | return instance.addNode(node); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "代理身份") |
| | | private String accountType; |
| | | |
| | | @ApiModelProperty(value = "是否激活 1:已激活 2:未激活 已激活,有推广链接") |
| | | private Integer activeStatus; |
| | | |
| | | @ApiModelProperty(value = "资产余额") |
| | | private BigDecimal propertyAmount; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "我的贡献值") |
| | | private BigDecimal nftDevote; |
| | | |
| | | @ApiModelProperty(value = "是否激活 1:已激活 2:未激活 已激活,有推广链接") |
| | | private Integer activeStatus; |
| | | |
| | | @ApiModelProperty(value = "是否是超级节点 1:是 2:否") |
| | | private Integer nodeType; |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "MallGoodsListVo", description = "节点信息") |
| | | public class MallGoodsListVo { |
| | | private Long id; |
| | | //商品编号 |
| | | @ApiModelProperty(value = "商品编号") |
| | | private String goodsNo; |
| | | //商品名称 |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | //商品介绍 |
| | | @ApiModelProperty(value = "商品介绍") |
| | | private String goodsIntrodution; |
| | | //缩略图 |
| | | @ApiModelProperty(value = "缩略图") |
| | | private String thumb; |
| | | //商品参数 |
| | | @ApiModelProperty(value = "商品参数") |
| | | private String goodsParameter; |
| | | //商品详情 |
| | | @ApiModelProperty(value = "商品详情") |
| | | private String goodsDetails; |
| | | //是否上架;1-上架 2-下架 |
| | | @ApiModelProperty(value = "是否上架;1-上架 2-下架") |
| | | private Integer isSale; |
| | | |
| | | //原价 |
| | | @ApiModelProperty(value = "原价") |
| | | private String originalPrice; |
| | | //现价 |
| | | @ApiModelProperty(value = "现价") |
| | | private String presentPrice; |
| | | /** |
| | | * 销量 |
| | | */ |
| | | @ApiModelProperty(value = "销量") |
| | | private Integer volume; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @ApiModelProperty(value = "排序") |
| | | private Integer sortCnt; |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | @Data |
| | | @ApiModel(value = "MallOrderItemVo", description = "订单信息") |
| | | public class MallOrderItemVo { |
| | | //商品ID |
| | | @ApiModelProperty(value = "商品ID") |
| | | private Long goodsId; |
| | | //商品名称 |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | //数量 |
| | | @ApiModelProperty(value = "数量") |
| | | private Integer cnt; |
| | | //单价 |
| | | @ApiModelProperty(value = "单价") |
| | | private BigDecimal price; |
| | | //金额 |
| | | @ApiModelProperty(value = "金额") |
| | | private BigDecimal amount; |
| | | } |
| New file |
| | |
| | | package cc.mrbird.febs.dapp.vo; |
| | | |
| | | import cc.mrbird.febs.dapp.entity.MallOrderItem; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "MallOrderListVo", description = "节点信息") |
| | | public class MallOrderListVo { |
| | | private Long id; |
| | | //订单号 |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNo; |
| | | |
| | | //下单时间 |
| | | @ApiModelProperty(value = "下单时间") |
| | | private Date orderTime; |
| | | //支付时间 |
| | | @ApiModelProperty(value = "支付时间") |
| | | private Date payTime; |
| | | //订单金额 |
| | | @ApiModelProperty(value = "订单金额") |
| | | private BigDecimal amount; |
| | | //支付方式 |
| | | @ApiModelProperty(value = "支付方式") |
| | | private String payMethod; |
| | | //支付订单号 |
| | | @ApiModelProperty(value = "支付订单号") |
| | | private String payOrderNo; |
| | | //支付结果 1-成功2-未成功 |
| | | @ApiModelProperty(value = "支付结果 1-成功2-未成功") |
| | | private String payResult; |
| | | |
| | | /** |
| | | * 状态;1-待支付2-已支付3-已取消 |
| | | */ |
| | | @ApiModelProperty(value = "状态;1-待支付2-已支付3-已取消") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 取消类型;1-超时未支付2-主动取消 |
| | | */ |
| | | @ApiModelProperty(value = "取消类型;1-超时未支付2-主动取消") |
| | | private Integer cancelType; |
| | | |
| | | /** |
| | | * 订单类型 1-普通订单 2-积分订单 |
| | | */ |
| | | @ApiModelProperty(value = "订单类型 1-普通订单 2-积分订单") |
| | | private Integer orderType; |
| | | |
| | | @ApiModelProperty(value = "订单详情") |
| | | private List<MallOrderItemVo> items; |
| | | |
| | | } |
| | |
| | | @Component |
| | | @ConditionalOnProperty(prefix = "system", name = "quartz-job", havingValue = "true") |
| | | public class BnbTransferJob{ |
| | | /** |
| | | * 搜索还未发生转账操作,但是记录已经更新没有产生HASH值的流水记录,并发起转账操作 |
| | | */ |
| | | @Autowired |
| | | private DappFundFlowDao dappFundFlowDao; |
| | | @Autowired |
| | | private ChainProducer chainProducer; |
| | | @Autowired |
| | | private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | @Autowired |
| | | private DappSystemService dappSystemService; |
| | | |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | public void BnbTransferAgain() { |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectByStateAndVersionAndFromHashLimitOne(2,2); |
| | | if(ObjectUtil.isNotEmpty(dappFundFlowEntity)){ |
| | | Integer isReturn = dappFundFlowEntity.getIsReturn(); |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == isReturn){ |
| | | chainProducer.sendBnbTransferTestMsg(dappFundFlowEntity.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | public void ABTransferAgain() { |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectByStateAndVersionAndFromHashTwoLimitOne(1,2); |
| | | if(ObjectUtil.isNotEmpty(dappFundFlowEntity)){ |
| | | Integer isReturn = dappFundFlowEntity.getIsReturn(); |
| | | if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == isReturn){ |
| | | chainProducer.sendAntKLineABMsg(dappFundFlowEntity.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 20%所有人平分的底池 |
| | | */ |
| | | // @Scheduled(cron = "0 0 1 * * ?") |
| | | // public void memberPool() { |
| | | // DataDictionaryCustom nodeThreePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | // PoolEnum.POOL_ALL_MEMBER_A_CNT.getType(), |
| | | // PoolEnum.POOL_ALL_MEMBER_A_CNT.getCode() |
| | | // ); |
| | | // BigDecimal nodeThreePoolDicCnt = new BigDecimal(nodeThreePoolDic.getValue()); |
| | | // if(BigDecimal.ZERO.compareTo(nodeThreePoolDicCnt) >= 0){ |
| | | // return; |
| | | // } |
| | | // BigDecimal nodeThreePoolDicCntReal = dappSystemService.nodePoolPerk(nodeThreePoolDicCnt, MemberLevelEnum.MEMBER.getType(), FundFlowEnum.POOL_MEMBER_A_CNT.getCode()); |
| | | // BigDecimal nodeThreePoolDicCntAva = nodeThreePoolDicCnt.subtract(nodeThreePoolDicCntReal); |
| | | // nodeThreePoolDic.setValue(nodeThreePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeThreePoolDicCntAva.toString() : "0"); |
| | | // dataDictionaryCustomMapper.updateById(nodeThreePoolDic); |
| | | // } |
| | | /** |
| | | * NODE_5_POOL |
| | | * NODE_4_POOL |
| | | * NODE_3_POOL |
| | | * 节点底池的每日分配 |
| | | */ |
| | | // @Scheduled(cron = "0 0 1 * * ?") |
| | | // public void NodeThreePool() { |
| | | // DataDictionaryCustom nodeThreePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | // PoolEnum.NODE_3_POOL.getType(), |
| | | // PoolEnum.NODE_3_POOL.getCode() |
| | | // ); |
| | | // BigDecimal nodeThreePoolDicCnt = new BigDecimal(nodeThreePoolDic.getValue()); |
| | | // if(BigDecimal.ZERO.compareTo(nodeThreePoolDicCnt) >= 0){ |
| | | // return; |
| | | // } |
| | | // BigDecimal nodeThreePoolDicCntReal = dappSystemService.nodePoolPerk(nodeThreePoolDicCnt, MemberLevelEnum.NODE_3.getType(), FundFlowEnum.DAO_3_NODE_PERK.getCode()); |
| | | // BigDecimal nodeThreePoolDicCntAva = nodeThreePoolDicCnt.subtract(nodeThreePoolDicCntReal); |
| | | // nodeThreePoolDic.setValue(nodeThreePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeThreePoolDicCntAva.toString() : "0"); |
| | | // dataDictionaryCustomMapper.updateById(nodeThreePoolDic); |
| | | // } |
| | | |
| | | /** |
| | | * 节点四的每日分配 |
| | | */ |
| | | @Scheduled(cron = "0 0 1 * * ?") |
| | | // public void NodeFourFivePool() { |
| | | // DataDictionaryCustom nodeFourPoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | // PoolEnum.NODE_4_POOL.getType(), |
| | | // PoolEnum.NODE_4_POOL.getCode() |
| | | // ); |
| | | // BigDecimal nodeFourPoolDicCnt = new BigDecimal(nodeFourPoolDic.getValue()); |
| | | // if(BigDecimal.ZERO.compareTo(nodeFourPoolDicCnt) >= 0){ |
| | | // return; |
| | | // } |
| | | // BigDecimal nodeFourPoolDicCntReal = dappSystemService.nodePoolPerk(nodeFourPoolDicCnt, MemberLevelEnum.NODE_4.getType(), FundFlowEnum.DAO_4_NODE_PERK.getCode()); |
| | | // BigDecimal nodeFourPoolDicCntAva = nodeFourPoolDicCnt.subtract(nodeFourPoolDicCntReal); |
| | | // nodeFourPoolDic.setValue(nodeFourPoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFourPoolDicCntAva.toString() : "0"); |
| | | // dataDictionaryCustomMapper.updateById(nodeFourPoolDic); |
| | | // } |
| | | |
| | | /** |
| | | * 节点五的每日分配 |
| | | */ |
| | | @Scheduled(cron = "0 0 1 * * ?") |
| | | // public void NodeFivePool() { |
| | | // DataDictionaryCustom nodeFivePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | // PoolEnum.NODE_5_POOL.getType(), |
| | | // PoolEnum.NODE_5_POOL.getCode() |
| | | // ); |
| | | // BigDecimal nodeFivePoolDicCnt = new BigDecimal(nodeFivePoolDic.getValue()); |
| | | // if(BigDecimal.ZERO.compareTo(nodeFivePoolDicCnt) >= 0){ |
| | | // return; |
| | | // } |
| | | // BigDecimal nodeFivePoolDicCntReal = dappSystemService.nodePoolPerk(nodeFivePoolDicCnt, MemberLevelEnum.NODE_5.getType(), FundFlowEnum.DAO_5_NODE_PERK.getCode()); |
| | | // BigDecimal nodeFivePoolDicCntAva = nodeFivePoolDicCnt.subtract(nodeFivePoolDicCntReal); |
| | | // nodeFivePoolDic.setValue(nodeFivePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFivePoolDicCntAva.toString() : "0"); |
| | | // dataDictionaryCustomMapper.updateById(nodeFivePoolDic); |
| | | // } |
| | | |
| | | /** |
| | | * 节点五的平级奖励每日分配 |
| | | */ |
| | | @Scheduled(cron = "0 0 1 * * ?") |
| | | // public void NodeFiveEqualsPool() { |
| | | // DataDictionaryCustom nodeFivePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | // PoolEnum.NODE_5_EQUALS_POOL.getType(), |
| | | // PoolEnum.NODE_5_EQUALS_POOL.getCode() |
| | | // ); |
| | | // BigDecimal nodeFivePoolDicCnt = new BigDecimal(nodeFivePoolDic.getValue()); |
| | | // if(BigDecimal.ZERO.compareTo(nodeFivePoolDicCnt) >= 0){ |
| | | // return; |
| | | // } |
| | | // BigDecimal nodeFivePoolDicCntReal = dappSystemService.nodePoolEqualsPerk(nodeFivePoolDicCnt, MemberLevelEnum.NODE_5.getType(), FundFlowEnum.DAO_5_NODE_EQUALS_PERK.getCode()); |
| | | // BigDecimal nodeFivePoolDicCntAva = nodeFivePoolDicCnt.subtract(nodeFivePoolDicCntReal); |
| | | // nodeFivePoolDic.setValue(nodeFivePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFivePoolDicCntAva.toString() : "0"); |
| | | // dataDictionaryCustomMapper.updateById(nodeFivePoolDic); |
| | | // } |
| | | |
| | | /** |
| | | * 超级节点奖励每日分配 |
| | | */ |
| | | @Scheduled(cron = "0 0 1 * * ?") |
| | | // public void NodeAPercentPool() { |
| | | // DataDictionaryCustom nodeFivePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | // PoolEnum.NODE_A_PERCENT_POOL.getType(), |
| | | // PoolEnum.NODE_A_PERCENT_POOL.getCode() |
| | | // ); |
| | | // BigDecimal nodeFivePoolDicCnt = new BigDecimal(nodeFivePoolDic.getValue()); |
| | | // if(BigDecimal.ZERO.compareTo(nodeFivePoolDicCnt) >= 0){ |
| | | // return; |
| | | // } |
| | | // /** |
| | | // * todo 超级节点的分红 |
| | | // */ |
| | | // BigDecimal nodeFivePoolDicCntReal = dappSystemService.superNodePoolPerk(nodeFivePoolDicCnt, NodeCodeEnum.SUPER_NODE.getCode(), FundFlowEnum.NODE_A_PERCENT_TO_MEMBER.getCode()); |
| | | // BigDecimal nodeFivePoolDicCntAva = nodeFivePoolDicCnt.subtract(nodeFivePoolDicCntReal); |
| | | // nodeFivePoolDic.setValue(nodeFivePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFivePoolDicCntAva.toString() : "0"); |
| | | // dataDictionaryCustomMapper.updateById(nodeFivePoolDic); |
| | | // } |
| | | @Scheduled(cron = "0 0 * * * ?") |
| | | public void aKlineJobHour() { |
| | | /** |
| | | * A币全网每小时自动燃烧0.1%,燃烧按递减燃烧,按个人每小时0.1%每小时递减。 |
| | | * |
| | | * A币技术做到资产钱包燃烧,闪兑钱包也要燃烧0.1%每小时 |
| | | */ |
| | | dappSystemService.aCoinFire(); |
| | | /** |
| | | * A币内网要做K线图,K线效果做到与交易所效果接近。 |
| | | * 小时 |
| | | */ |
| | | dappSystemService.aKlineJobHour(); |
| | | } |
| | | /** |
| | | * A币内网要做K线图,K线效果做到与交易所效果接近。 |
| | | * 日 |
| | | */ |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public void aKlineJobDay() { |
| | | dappSystemService.aKlineJobDay(); |
| | |
| | | |
| | | MatrixTree instance = MatrixTree.getInstance(); |
| | | for (DappAchieveTreeEntity treeNode : tree) { |
| | | |
| | | MemberNode node = new MemberNode(); |
| | | node.setAddress(treeNode.getAddress()); |
| | | node.setInviteId(treeNode.getInviteId()); |
| | |
| | | **/ |
| | | public class QueueConstants { |
| | | |
| | | public static final String QUEUE_BNB_TRANSFER_TEST = "queue_bnb_agent_up_test_test"; |
| | | public static final String QUEUE_BNB_AGENT_UP = "queue_bnb_agent_up_test"; |
| | | public static final String QUEUE_BNB_TRANSFER = "queue_ant_transfer_test"; |
| | | public static final String QUEUE_MEMBER_OUT = "queue_bnb_member_out_test"; |
| | | public static final String QUEUE_LEVEL_PROFIT = "queue_bnb_level_profit_transfer_test"; |
| | | /** |
| | | * speed 代理升级 |
| | | */ |
| | | public static final String QUEUE_SPEED_LEVEL_UP = "queue_speed_level_up"; |
| | | |
| | | public static final String ONLINE_TRANSFER = "queue_sdm_online_transfer_test"; |
| | | public static final String DISTRIB_PROFIT = "queue_sdm_distrib_profit_test"; |
| | | public static final String USER_BUY_REWARD = "queue_sdm_user_buy_reward_test"; |
| | | public static final String NFT_BOX = "queue_sdm_nft_box_test"; |
| | | public static final String ACHIEVE_TREE = "queue_sdm_achieve_tree_test"; |
| | | public static final String TFC_NEW_PRICE = "queue_tfc_new_price_test"; |
| | | /** |
| | | * A 入金的消息 队列 |
| | | * speed 支付订单 |
| | | */ |
| | | public static final String QUEUE_ANT_A_CION_IN = "queue_ant_a_coin_in_test"; |
| | | /** |
| | | * A 入金,转入A底池 队列 |
| | | */ |
| | | public static final String QUEUE_ANT_A_CION_IN_A_POOL = "queue_ant_a_coin_in_a_pool_test"; |
| | | /** |
| | | * A 入金,转入B底池 队列 |
| | | */ |
| | | public static final String QUEUE_ANT_A_CION_IN_B_POOL = "queue_ant_a_coin_in_b_pool_test"; |
| | | /** |
| | | * A 入金,5%节点 队列 |
| | | */ |
| | | public static final String QUEUE_ANT_A_CION_IN_NODE = "queue_ant_a_coin_in_node_test"; |
| | | /** |
| | | * A 入金,极差奖 队列 |
| | | */ |
| | | public static final String QUEUE_ANT_A_CION_IN_LEVEL = "queue_ant_a_coin_in_level_test"; |
| | | /** |
| | | * A 提现 |
| | | */ |
| | | public static final String QUEUE_ANT_A_CION_OUT = "queue_ant_a_coin_out_test"; |
| | | /** |
| | | * A 会员升级 |
| | | */ |
| | | public static final String QUEUE_ANT_MEMBER_LEVEL = "queue_ant_member_level_test"; |
| | | /** |
| | | * A k线数据 |
| | | */ |
| | | public static final String QUEUE_ANT_K_LINE = "queue_ant_k_line_test"; |
| | | /** |
| | | * A k线数据 |
| | | */ |
| | | public static final String QUEUE_ANT_K_LINE_AB = "queue_ant_k_line_test_ab"; |
| | | /** |
| | | * A k线数据 |
| | | */ |
| | | public static final String QUEUE_ALL_MEMBER_PERK_AVA = "queue_all_member_perk_ava"; |
| | | /** |
| | | * A 合约铸造ANDAO |
| | | */ |
| | | public static final String QUEUE_CONTRACT_AN_DAO = "queue_contract_an_dao"; |
| | | /** |
| | | * A 入金的消息 队列 |
| | | */ |
| | | public static final String QUEUE_ANT_A_CION_IN_CONTRACT = "queue_ant_a_coin_in_contract"; |
| | | public static final String QUEUE_SPEED_PAY_ORDER = "queue_speed_pay_order"; |
| | | } |
| | |
| | | |
| | | @Getter |
| | | public enum QueueEnum { |
| | | //A 合约铸造ANDAO |
| | | ANT_A_CION_IN_CONTRACT("exchange_ant_a_coin_in_contract", "route_key_ant_a_coin_in_contract", QueueConstants.QUEUE_ANT_A_CION_IN_CONTRACT), |
| | | //A 合约铸造ANDAO |
| | | CONTRACT_AN_DAO("exchange_contract_an_dao", "route_key_contract_an_dao", QueueConstants.QUEUE_CONTRACT_AN_DAO), |
| | | //A 每人平分 |
| | | ALL_MEMBER_PERK_AVA("exchange_all_member_perk_ava", "route_key_all_member_perk_ava", QueueConstants.QUEUE_ALL_MEMBER_PERK_AVA), |
| | | //A k线数据 |
| | | ANT_K_LINE_AB("exchange_ant_k_line_test_ab", "route_key_ant_k_line_test_ab", QueueConstants.QUEUE_ANT_K_LINE_AB), |
| | | //A k线数据 |
| | | ANT_K_LINE("exchange_ant_k_line_test", "route_key_ant_k_line_test", QueueConstants.QUEUE_ANT_K_LINE), |
| | | //A 会员升级 |
| | | ANT_MEMBER_LEVEL("exchange_ant_member_level_test", "route_key_ant_member_level_test", QueueConstants.QUEUE_ANT_MEMBER_LEVEL), |
| | | //A 入金的消息 |
| | | ANT_A_CION_OUT("exchange_ant_a_coin_out_test", "route_key_ant_a_coin_out_test", QueueConstants.QUEUE_ANT_A_CION_OUT), |
| | | //A 入金的消息 |
| | | ANT_A_CION_IN_LEVEL("exchange_ant_a_coin_in_level_test", "route_key_ant_a_coin_in_level_test", QueueConstants.QUEUE_ANT_A_CION_IN_LEVEL), |
| | | //A 入金的消息 |
| | | ANT_A_CION_IN_NODE("exchange_ant_a_coin_in_node_test", "route_key_ant_a_coin_in_node_test", QueueConstants.QUEUE_ANT_A_CION_IN_NODE), |
| | | //A 入金的消息 |
| | | ANT_A_CION_IN_B_POOL("exchange_ant_a_coin_in_b_pool_test", "route_key_ant_a_coin_in_b_pool_test", QueueConstants.QUEUE_ANT_A_CION_IN_B_POOL), |
| | | //A 入金的消息 |
| | | ANT_A_CION_IN_A_POOL("exchange_ant_a_coin_in_a_pool_test", "route_key_ant_a_coin_in_a_pool_test", QueueConstants.QUEUE_ANT_A_CION_IN_A_POOL), |
| | | //A 入金的消息 |
| | | ANT_A_CION_IN("exchange_ant_a_coin_in_test", "route_key_ant_a_coin_in_test", QueueConstants.QUEUE_ANT_A_CION_IN), |
| | | //代理升级 |
| | | BNB_TRANSFER_TEST("exchange_bnb_agent_up_test_test", "route_key_bnb_agent_up_test_test", "queue_bnb_agent_up_test_test"), |
| | | //代理升级 |
| | | BNB_AGENT_UP("exchange_bnb_agent_up_test", "route_key_bnb_agent_up_test", "queue_bnb_agent_up_test"), |
| | | //转账拨币 |
| | | BNB_TRANSFER("exchange_ant_transfer_test", "route_key_ant_transfer_test", "queue_ant_transfer_test"), |
| | | //计算是否有人出局 |
| | | MEMBER_OUT("exchange_bnb_member_out_test", "route_key_bnb_member_out_test", "queue_bnb_member_out_test"), |
| | | //层级奖励 |
| | | LEVEL_PROFIT("exchange_bnb_level_profit_transfer_test", "route_key_bnb_level_profit_transfer_test", "queue_bnb_level_profit_transfer_test"), |
| | | |
| | | ONLINE_TRANSFER("exchange_sdm_online_transfer_test", "route_key_sdm_online_transfer_test", "queue_sdm_online_transfer_test"), |
| | | DISTRIB_PROFIT("exchange_sdm_distrib_profit_test", "route_key_sdm_distrib_profit_test", "queue_sdm_distrib_profit_test"), |
| | | USER_BUY_REWARD("exchange_sdm_user_buy_reward_test", "route_key_sdm_user_buy_reward_test", "queue_sdm_user_buy_reward_test"), |
| | | NFT_BOX("exchange_sdm_nft_box_test", "route_key_sdm_nft_box_test", "queue_sdm_nft_box_test"), |
| | | ACHIEVE_TREE("exchange_sdm_achieve_tree_test", "route_key_sdm_achieve_tree_test", "queue_sdm_achieve_tree_test"), |
| | | WITHDRAW_FEE("exchange_withdraw_fee_test", "route_key_withdraw_fee_test", "queue_withdraw_fee_test"), |
| | | TFC_NEW_PRICE("exchange_tfc_new_price_test", "route_key_tfc_new_price_test", "queue_tfc_new_price_test"); |
| | | /** |
| | | * speed 代理升级 |
| | | */ |
| | | SPEED_LEVEL_UP("exchange_speed_level_up", "route_key_speed_level_up", QueueConstants.QUEUE_SPEED_LEVEL_UP), |
| | | /** |
| | | * speed 支付订单 |
| | | */ |
| | | SPEED_PAY_ORDER("exchange_speed_pay_order", "route_key_speed_pay_order", QueueConstants.QUEUE_SPEED_PAY_ORDER); |
| | | |
| | | private String exchange; |
| | | |
| | |
| | | return new RabbitTemplate(connectionFactory); |
| | | } |
| | | |
| | | // === 业绩树 start === |
| | | // === speed 支付订单 start === |
| | | @Bean |
| | | public DirectExchange achieveTreeExchange() { |
| | | return new DirectExchange(QueueEnum.ACHIEVE_TREE.getExchange()); |
| | | public DirectExchange speedPayOrderExchange() { |
| | | return new DirectExchange(QueueEnum.SPEED_PAY_ORDER.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue achieveTreeQueue() { |
| | | return new Queue(QueueEnum.ACHIEVE_TREE.getQueue()); |
| | | public Queue speedPayOrderQueue() { |
| | | return new Queue(QueueEnum.SPEED_PAY_ORDER.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding achieveTreeBind() { |
| | | return BindingBuilder.bind(achieveTreeQueue()).to(achieveTreeExchange()).with(QueueEnum.ACHIEVE_TREE.getRoute()); |
| | | public Binding speedPayOrderBind() { |
| | | return BindingBuilder.bind(speedPayOrderQueue()).to(speedPayOrderExchange()).with(QueueEnum.SPEED_PAY_ORDER.getRoute()); |
| | | } |
| | | // === 业绩树 end === |
| | | // === speed 支付订单 end === |
| | | |
| | | |
| | | // === 提现手续费 start === |
| | | // === speed 代理升级 start === |
| | | @Bean |
| | | public DirectExchange withdrawFeeExchange() { |
| | | return new DirectExchange(QueueEnum.WITHDRAW_FEE.getExchange()); |
| | | public DirectExchange speedLevelUpExchange() { |
| | | return new DirectExchange(QueueEnum.SPEED_LEVEL_UP.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue withdrawFeeQueue() { |
| | | return new Queue(QueueEnum.WITHDRAW_FEE.getQueue()); |
| | | public Queue speedLevelUpQueue() { |
| | | return new Queue(QueueEnum.SPEED_LEVEL_UP.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding withdrawFeeBind() { |
| | | return BindingBuilder.bind(withdrawFeeQueue()).to(withdrawFeeExchange()).with(QueueEnum.WITHDRAW_FEE.getRoute()); |
| | | public Binding speedLevelUpBind() { |
| | | return BindingBuilder.bind(speedLevelUpQueue()).to(speedLevelUpExchange()).with(QueueEnum.SPEED_LEVEL_UP.getRoute()); |
| | | } |
| | | // === 提现手续费 end === |
| | | |
| | | |
| | | |
| | | // === tfc最新价 start === |
| | | @Bean |
| | | public DirectExchange tfcNewPriceExchange() { |
| | | return new DirectExchange(QueueEnum.TFC_NEW_PRICE.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue tfcNewPriceQueue() { |
| | | return new Queue(QueueEnum.TFC_NEW_PRICE.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding tfcNewPriceBind() { |
| | | return BindingBuilder.bind(tfcNewPriceQueue()).to(tfcNewPriceExchange()).with(QueueEnum.TFC_NEW_PRICE.getRoute()); |
| | | } |
| | | // === tfc最新价 end === |
| | | |
| | | |
| | | |
| | | // === 手续费分发 start === |
| | | @Bean |
| | | public DirectExchange feeDistributeExchange() { |
| | | return new DirectExchange(QueueEnum.DISTRIB_PROFIT.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue feeDistributeQueue() { |
| | | return new Queue(QueueEnum.DISTRIB_PROFIT.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding feeDistributeBind() { |
| | | return BindingBuilder.bind(feeDistributeQueue()).to(feeDistributeExchange()).with(QueueEnum.DISTRIB_PROFIT.getRoute()); |
| | | } |
| | | // === 手续费分发 end === |
| | | |
| | | |
| | | |
| | | // === 层级奖励分发 start === |
| | | @Bean |
| | | public DirectExchange levelProfitExchange() { |
| | | return new DirectExchange(QueueEnum.LEVEL_PROFIT.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue levelProfitQueue() { |
| | | return new Queue(QueueEnum.LEVEL_PROFIT.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding levelProfitBind() { |
| | | return BindingBuilder.bind(levelProfitQueue()).to(levelProfitExchange()).with(QueueEnum.LEVEL_PROFIT.getRoute()); |
| | | } |
| | | // === 层级奖励分发 end === |
| | | |
| | | |
| | | |
| | | // === 计算是否有人出局 start === |
| | | @Bean |
| | | public DirectExchange memberOutExchange() { |
| | | return new DirectExchange(QueueEnum.MEMBER_OUT.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue memberOutQueue() { |
| | | return new Queue(QueueEnum.MEMBER_OUT.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding memberOutBind() { |
| | | return BindingBuilder.bind(memberOutQueue()).to(memberOutExchange()).with(QueueEnum.MEMBER_OUT.getRoute()); |
| | | } |
| | | // === 计算是否有人出局 end === |
| | | |
| | | |
| | | |
| | | // === 转账拨币 start === |
| | | @Bean |
| | | public DirectExchange bnbTransferExchange() { |
| | | return new DirectExchange(QueueEnum.BNB_TRANSFER.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue bnbTransferQueue() { |
| | | return new Queue(QueueEnum.BNB_TRANSFER.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding bnbTransferBind() { |
| | | return BindingBuilder.bind(bnbTransferQueue()).to(bnbTransferExchange()).with(QueueEnum.BNB_TRANSFER.getRoute()); |
| | | } |
| | | // === 转账拨币 end === |
| | | |
| | | |
| | | |
| | | // === 代理升级 start === |
| | | @Bean |
| | | public DirectExchange agentUpExchange() { |
| | | return new DirectExchange(QueueEnum.BNB_AGENT_UP.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue agentUpQueue() { |
| | | return new Queue(QueueEnum.BNB_AGENT_UP.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding agentUpBind() { |
| | | return BindingBuilder.bind(agentUpQueue()).to(agentUpExchange()).with(QueueEnum.BNB_AGENT_UP.getRoute()); |
| | | } |
| | | // === 代理升级 end === |
| | | |
| | | |
| | | |
| | | // === 消息测试 start === |
| | | @Bean |
| | | public DirectExchange bnbTransferTestExchange() { |
| | | return new DirectExchange(QueueEnum.BNB_TRANSFER_TEST.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue bnbTransferTestQueue() { |
| | | return new Queue(QueueEnum.BNB_TRANSFER_TEST.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding bnbTransferTestBind() { |
| | | return BindingBuilder.bind(bnbTransferTestQueue()).to(bnbTransferTestExchange()).with(QueueEnum.BNB_TRANSFER_TEST.getRoute()); |
| | | } |
| | | // === 消息测试 end === |
| | | |
| | | |
| | | // === A 入金的消息 start === |
| | | @Bean |
| | | public DirectExchange antACoinInExchange() { |
| | | return new DirectExchange(QueueEnum.ANT_A_CION_IN.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue antACoinInQueue() { |
| | | return new Queue(QueueEnum.ANT_A_CION_IN.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding antACoinInBind() { |
| | | return BindingBuilder.bind(antACoinInQueue()).to(antACoinInExchange()).with(QueueEnum.ANT_A_CION_IN.getRoute()); |
| | | } |
| | | // === A 入金的消息 end === |
| | | |
| | | |
| | | // === A 入金,转入A底池 start === |
| | | @Bean |
| | | public DirectExchange antACoinInAPoolExchange() { |
| | | return new DirectExchange(QueueEnum.ANT_A_CION_IN_A_POOL.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue antACoinInAPoolQueue() { |
| | | return new Queue(QueueEnum.ANT_A_CION_IN_A_POOL.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding antACoinInAPoolBind() { |
| | | return BindingBuilder.bind(antACoinInAPoolQueue()).to(antACoinInAPoolExchange()).with(QueueEnum.ANT_A_CION_IN_A_POOL.getRoute()); |
| | | } |
| | | // === A 入金,转入A底池 end === |
| | | |
| | | |
| | | // === A 入金,转入B底池 start === |
| | | @Bean |
| | | public DirectExchange antACoinInBPoolExchange() { |
| | | return new DirectExchange(QueueEnum.ANT_A_CION_IN_B_POOL.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue antACoinInBPoolQueue() { |
| | | return new Queue(QueueEnum.ANT_A_CION_IN_B_POOL.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding antACoinInBPoolBind() { |
| | | return BindingBuilder.bind(antACoinInBPoolQueue()).to(antACoinInBPoolExchange()).with(QueueEnum.ANT_A_CION_IN_B_POOL.getRoute()); |
| | | } |
| | | // === A 入金,转入B底池 end === |
| | | |
| | | |
| | | // === A 入金,5%节点 start === |
| | | @Bean |
| | | public DirectExchange antACoinInNodeExchange() { |
| | | return new DirectExchange(QueueEnum.ANT_A_CION_IN_NODE.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue antACoinInNodeQueue() { |
| | | return new Queue(QueueEnum.ANT_A_CION_IN_NODE.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding antACoinInNodeBind() { |
| | | return BindingBuilder.bind(antACoinInNodeQueue()).to(antACoinInNodeExchange()).with(QueueEnum.ANT_A_CION_IN_NODE.getRoute()); |
| | | } |
| | | // === A 入金,5%节点 end === |
| | | |
| | | |
| | | // === A 入金,极差奖 start === |
| | | @Bean |
| | | public DirectExchange antACoinInLevelExchange() { |
| | | return new DirectExchange(QueueEnum.ANT_A_CION_IN_LEVEL.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue antACoinInLevelQueue() { |
| | | return new Queue(QueueEnum.ANT_A_CION_IN_LEVEL.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding antACoinInLevelBind() { |
| | | return BindingBuilder.bind(antACoinInLevelQueue()).to(antACoinInLevelExchange()).with(QueueEnum.ANT_A_CION_IN_LEVEL.getRoute()); |
| | | } |
| | | // === A 入金,极差奖 end === |
| | | |
| | | |
| | | // === A 提现 start === |
| | | @Bean |
| | | public DirectExchange antACoinOutExchange() { |
| | | return new DirectExchange(QueueEnum.ANT_A_CION_OUT.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue antACoinOutQueue() { |
| | | return new Queue(QueueEnum.ANT_A_CION_OUT.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding antACoinOutBind() { |
| | | return BindingBuilder.bind(antACoinOutQueue()).to(antACoinOutExchange()).with(QueueEnum.ANT_A_CION_OUT.getRoute()); |
| | | } |
| | | // === A 提现 end === |
| | | |
| | | |
| | | // === A 会员升级 start === |
| | | @Bean |
| | | public DirectExchange antMemberLevelExchange() { |
| | | return new DirectExchange(QueueEnum.ANT_MEMBER_LEVEL.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue antMemberLevelQueue() { |
| | | return new Queue(QueueEnum.ANT_MEMBER_LEVEL.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding antMemberLevelBind() { |
| | | return BindingBuilder.bind(antMemberLevelQueue()).to(antMemberLevelExchange()).with(QueueEnum.ANT_MEMBER_LEVEL.getRoute()); |
| | | } |
| | | // === A 会员升级 end === |
| | | |
| | | |
| | | // === A k线数据 start === |
| | | @Bean |
| | | public DirectExchange antKLineExchange() { |
| | | return new DirectExchange(QueueEnum.ANT_K_LINE.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue antKLineQueue() { |
| | | return new Queue(QueueEnum.ANT_K_LINE.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding antKLineBind() { |
| | | return BindingBuilder.bind(antKLineQueue()).to(antKLineExchange()).with(QueueEnum.ANT_K_LINE.getRoute()); |
| | | } |
| | | // === A k线数据 end === |
| | | |
| | | |
| | | // === A k线数据 start === |
| | | @Bean |
| | | public DirectExchange antKLineABExchange() { |
| | | return new DirectExchange(QueueEnum.ANT_K_LINE_AB.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue antKLineABQueue() { |
| | | return new Queue(QueueEnum.ANT_K_LINE_AB.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding antKLineABBind() { |
| | | return BindingBuilder.bind(antKLineABQueue()).to(antKLineABExchange()).with(QueueEnum.ANT_K_LINE_AB.getRoute()); |
| | | } |
| | | // === A k线数据 end === |
| | | |
| | | |
| | | // === A k线数据 start === |
| | | @Bean |
| | | public DirectExchange allMemberPerkAvaExchange() { |
| | | return new DirectExchange(QueueEnum.ALL_MEMBER_PERK_AVA.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue allMemberPerkAvaQueue() { |
| | | return new Queue(QueueEnum.ALL_MEMBER_PERK_AVA.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding allMemberPerkAvaBind() { |
| | | return BindingBuilder.bind(allMemberPerkAvaQueue()).to(allMemberPerkAvaExchange()).with(QueueEnum.ALL_MEMBER_PERK_AVA.getRoute()); |
| | | } |
| | | // === A k线数据 end === |
| | | |
| | | |
| | | // === A 合约铸造ANDAO start === |
| | | @Bean |
| | | public DirectExchange contractAnDaoExchange() { |
| | | return new DirectExchange(QueueEnum.CONTRACT_AN_DAO.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue contractAnDaoQueue() { |
| | | return new Queue(QueueEnum.CONTRACT_AN_DAO.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding contractAnDaoBind() { |
| | | return BindingBuilder.bind(contractAnDaoQueue()).to(contractAnDaoExchange()).with(QueueEnum.CONTRACT_AN_DAO.getRoute()); |
| | | } |
| | | // === A 合约铸造ANDAO end === |
| | | |
| | | |
| | | // === A 合约铸造ANDAO start === |
| | | @Bean |
| | | public DirectExchange contractAnDaoInExchange() { |
| | | return new DirectExchange(QueueEnum.ANT_A_CION_IN_CONTRACT.getExchange()); |
| | | } |
| | | |
| | | @Bean |
| | | public Queue contractAnDaoInQueue() { |
| | | return new Queue(QueueEnum.ANT_A_CION_IN_CONTRACT.getQueue()); |
| | | } |
| | | |
| | | @Bean |
| | | public Binding contractAnDaoInBind() { |
| | | return BindingBuilder.bind(contractAnDaoInQueue()).to(contractAnDaoInExchange()).with(QueueEnum.ANT_A_CION_IN_CONTRACT.getRoute()); |
| | | } |
| | | // === A 合约铸造ANDAO end === |
| | | // === speed 代理升级 end === |
| | | } |
| | |
| | | @Autowired |
| | | private DappSystemService dappSystemService; |
| | | |
| | | // @RabbitListener(queues = QueueConstants.ACHIEVE_TREE) |
| | | // public void achieveTree(String id) { |
| | | // log.info("收到业绩树消息"); |
| | | // dappSystemService.achieveTree(Long.parseLong(id)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 生产者在tfc应用 |
| | | // * @param data |
| | | // */ |
| | | // @RabbitListener(queues = QueueConstants.TFC_NEW_PRICE) |
| | | // public void tfcNewPrice(String data) { |
| | | //// dappSystemService.tfcNewPrice(data); |
| | | // } |
| | | // |
| | | // /** |
| | | // * @param data |
| | | // */ |
| | | // @RabbitListener(queues = QueueConstants.DISTRIB_PROFIT) |
| | | // public void feeDistribute(String data) { |
| | | // dappSystemService.feeDistribute(data); |
| | | // } |
| | | |
| | | /**层级奖励分发消息 |
| | | * @param id |
| | | */ |
| | | // @RabbitListener(queues = QueueConstants.QUEUE_LEVEL_PROFIT) |
| | | // public void levelProfit(Long id) { |
| | | // log.info("消费层级奖励分发消息:{}", id); |
| | | // dappSystemService.levelProfit(id); |
| | | // } |
| | | |
| | | /**计算是否有人出局分发消息 |
| | | * @param id |
| | | */ |
| | | // @RabbitListener(queues = QueueConstants.QUEUE_MEMBER_OUT) |
| | | // public void memberOut(Long id) { |
| | | // log.info("消费计算是否有人出局:{}", id); |
| | | // dappSystemService.memberOut(id); |
| | | // } |
| | | |
| | | /**转账拨币 |
| | | * @param id |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_BNB_TRANSFER) |
| | | public void bnbTransfer(Long id) { |
| | | log.info("消费转账拨币第一步:{}", id); |
| | | dappSystemService.bnbTransfer(id); |
| | | } |
| | | |
| | | /**转账拨币 |
| | | * @param id |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_BNB_TRANSFER_TEST) |
| | | public void bnbTransferTest(Long id) { |
| | | log.info("消费转账拨币第二步:{}", id); |
| | | dappSystemService.bnbTransferTest(id); |
| | | } |
| | | // |
| | | // /**代理升级 |
| | | // * @param id |
| | | // */ |
| | | // @RabbitListener(queues = QueueConstants.QUEUE_BNB_AGENT_UP) |
| | | // public void agentUp(Long id) { |
| | | // log.info("代理升级:{}", id); |
| | | // dappSystemService.agentUp(id); |
| | | // } |
| | | |
| | | /** |
| | | * 消费---A 入金的消息 |
| | | * @param id |
| | | * speed 支付订单 |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN) |
| | | public void AntACoinInMsg(Long id) { |
| | | log.info("消费---A 入金的消息:{}", id); |
| | | dappSystemService.AntACoinInMsg(id); |
| | | @RabbitListener(queues = QueueConstants.QUEUE_SPEED_PAY_ORDER) |
| | | public void speedPayOrderMsg(Long orderId) { |
| | | log.info("speedPayOrderMsg:{}", orderId); |
| | | try { |
| | | dappSystemService.speedPayOrderMsg(orderId); |
| | | } catch (Exception e) { |
| | | log.error("speedPayOrderErr:", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 消费---A 入金,转入A底池 |
| | | * @param id |
| | | * speed 代理升级 |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN_A_POOL) |
| | | public void AntACoinAPollInMsg(Long id) { |
| | | log.info("消费---A 入金,转入A底池:{}", id); |
| | | dappSystemService.AntACoinAPollInMsg(id); |
| | | } |
| | | |
| | | /** |
| | | * 消费---A 入金,转入B底池 |
| | | * @param id |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN_B_POOL) |
| | | public void AntACoinBPollInMsg(Long id) { |
| | | log.info("消费---A 入金,转入B底池:{}", id); |
| | | dappSystemService.AntACoinBPollInMsg(id); |
| | | } |
| | | |
| | | /** |
| | | * 消费---A 入金,5%节点 |
| | | * @param id |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN_NODE) |
| | | public void antACoinInNodeMsg(Long id) { |
| | | log.info("消费---A 入金,转入5%节点:{}", id); |
| | | dappSystemService.antACoinInNodeMsg(id); |
| | | } |
| | | |
| | | /** |
| | | * 消费---A 入金,10%极差奖 |
| | | * @param id |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN_LEVEL) |
| | | public void antACoinInLevelMsg(Long id) { |
| | | log.info("消费---A 入金,转入10%极差奖:{}", id); |
| | | dappSystemService.antACoinInLevelMsg(id); |
| | | } |
| | | |
| | | /** |
| | | * 提现 |
| | | * @param id |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_OUT) |
| | | public void antACoinOutMsg(Long id) { |
| | | log.info("消费---A 提现:{}", id); |
| | | dappSystemService.antACoinOutMsg(id); |
| | | } |
| | | |
| | | /** |
| | | * A 代理升级 |
| | | * @param memberId |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ANT_MEMBER_LEVEL) |
| | | public void antMemberLevelMsg(Long memberId) { |
| | | log.info("消费---A 代理升级:{}", memberId); |
| | | dappSystemService.antMemberLevelMsg(memberId); |
| | | } |
| | | |
| | | /** |
| | | * A k线数据 |
| | | * @param type |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ANT_K_LINE) |
| | | public void antKLineMsg(int type) { |
| | | log.info("消费---A k线数据:{}", type); |
| | | dappSystemService.antKLineMsg(type); |
| | | } |
| | | |
| | | /**转账拨币 |
| | | * @param id |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ANT_K_LINE_AB) |
| | | public void antKLineABMsg(Long id) { |
| | | log.info("消费转账拨币第二步:{}", id); |
| | | dappSystemService.antKLineABMsg(id); |
| | | } |
| | | |
| | | /**转账拨币 |
| | | * @param id |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ALL_MEMBER_PERK_AVA) |
| | | public void allMemberPerkAvaMsg(Long id) { |
| | | log.info("全体平分:{}", id); |
| | | dappSystemService.allMemberPerkAvaMsg(id); |
| | | } |
| | | |
| | | /**合约铸造ANDAO |
| | | * @param flowId |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_CONTRACT_AN_DAO) |
| | | public void contractAnDaoMsg(Long flowId) { |
| | | log.info("1-消费合约铸造ANDAO:{}", flowId); |
| | | dappSystemService.contractAnDaoMsg(flowId); |
| | | } |
| | | |
| | | /**合约铸造ANDAO |
| | | * @param flowId |
| | | */ |
| | | @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN_CONTRACT) |
| | | public void contractAnDaoInMsg(Long flowId) { |
| | | log.info("2-消费合约铸造ANDAO:{}", flowId); |
| | | dappSystemService.contractAnDaoInMsg(flowId); |
| | | @RabbitListener(queues = QueueConstants.QUEUE_SPEED_LEVEL_UP) |
| | | public void speedAutoLevelUpMsg(Long memberId) { |
| | | log.info("speedAutoLevelUpMsg:{}", memberId); |
| | | try { |
| | | dappSystemService.speedAutoLevelUpMsg(memberId); |
| | | } catch (Exception e) { |
| | | log.error("speedAutoLevelUpErr:", e); |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | |
| | | |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | | * 消费者在tfc应用 |
| | | * |
| | | * @param data |
| | | * speed 支付订单 |
| | | * @param orderId 订单ID |
| | | */ |
| | | public void sendTfcFee(String data) { |
| | | log.info("发送提现手续费消息:{}", data); |
| | | public void sendSpeedPayOrderMsg(Long orderId) { |
| | | log.info("sendSpeedPayOrderMsg:{}", orderId); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.WITHDRAW_FEE.getExchange(), QueueEnum.WITHDRAW_FEE.getRoute(), data, correlationData); |
| | | rabbitTemplate.convertAndSend(QueueEnum.SPEED_PAY_ORDER.getExchange(), QueueEnum.SPEED_PAY_ORDER.getRoute(), orderId, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * 发送手续费分发消息 |
| | | * |
| | | * @param id |
| | | */ |
| | | public void sendFeeDistributeMsg(Long id) { |
| | | log.info("发送手续费分发消息:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.DISTRIB_PROFIT.getExchange(), QueueEnum.DISTRIB_PROFIT.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * 层级奖励分发消息 |
| | | * |
| | | * 会员ID |
| | | * @param id |
| | | */ |
| | | public void sendLevelProfitMsg(Long id) { |
| | | log.info("层级奖励分发消息:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.LEVEL_PROFIT.getExchange(), QueueEnum.LEVEL_PROFIT.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * 计算是否有人出局分发消息 |
| | | */ |
| | | public void sendMemberOutMsg(Long id) { |
| | | log.info("计算是否有人出局:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.MEMBER_OUT.getExchange(), QueueEnum.MEMBER_OUT.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * 转账拨币 |
| | | */ |
| | | public void sendBnbTransferMsg(Long id) { |
| | | log.info("开始转账拨币第一步:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.BNB_TRANSFER.getExchange(), QueueEnum.BNB_TRANSFER.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * 转账拨币 |
| | | */ |
| | | public void sendBnbTransferTestMsg(Long id) { |
| | | log.info("开始转账拨币第二步:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.BNB_TRANSFER_TEST.getExchange(), QueueEnum.BNB_TRANSFER_TEST.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * 代理升级 |
| | | */ |
| | | public void sendAgentUpMsg(Long id) { |
| | | log.info("代理升级:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.BNB_AGENT_UP.getExchange(), QueueEnum.BNB_AGENT_UP.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * A 入金的消息 |
| | | * @param id |
| | | */ |
| | | public void sendAntACoinInMsg(Long id) { |
| | | log.info("开始---A 入金的消息:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN.getExchange(), QueueEnum.ANT_A_CION_IN.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * A 入金,转入A底池 |
| | | * @param id |
| | | */ |
| | | public void sendAntACoinInAPoolMsg(Long id) { |
| | | log.info("开始---A 入金,转入A底池:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN_A_POOL.getExchange(), QueueEnum.ANT_A_CION_IN_A_POOL.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * A 入金,转入B底池 |
| | | * @param id |
| | | */ |
| | | public void sendAntACoinInBPoolMsg(Long id) { |
| | | log.info("开始---A 入金,转入B底池:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN_B_POOL.getExchange(), QueueEnum.ANT_A_CION_IN_B_POOL.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * A 入金,5%节点 |
| | | * @param id |
| | | */ |
| | | public void sendAntACoinInNodeMsg(Long id) { |
| | | log.info("开始---A 入金,转入5%节点:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN_NODE.getExchange(), QueueEnum.ANT_A_CION_IN_NODE.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * A 入金,10%极差奖 |
| | | * @param id |
| | | */ |
| | | public void sendAntACoinInLevelMsg(Long id) { |
| | | log.info("开始---A 入金,转入10%极差奖:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN_LEVEL.getExchange(), QueueEnum.ANT_A_CION_IN_LEVEL.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * A 提现 |
| | | * @param id |
| | | */ |
| | | public void sendAntACoinOutMsg(Long id) { |
| | | log.info("开始---A 提现:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_OUT.getExchange(), QueueEnum.ANT_A_CION_OUT.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * A 代理升级 |
| | | * speed 代理升级 |
| | | * @param memberId |
| | | */ |
| | | public void sendAntMemberLevelMsg(Long memberId) { |
| | | log.info("开始---A 代理升级:{}", memberId); |
| | | public void sendAutoLevelUpMsg(@NotNull Long memberId) { |
| | | log.info("sendAutoLevelUpMsg:{}", memberId); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ANT_MEMBER_LEVEL.getExchange(), QueueEnum.ANT_MEMBER_LEVEL.getRoute(), memberId, correlationData); |
| | | rabbitTemplate.convertAndSend(QueueEnum.SPEED_LEVEL_UP.getExchange(), QueueEnum.SPEED_LEVEL_UP.getRoute(), memberId, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * A k线数据 |
| | | * @param type |
| | | */ |
| | | public void sendAntKLineMsg(int type) { |
| | | log.info("开始---A k线数据:{}", type); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ANT_K_LINE.getExchange(), QueueEnum.ANT_K_LINE.getRoute(), type, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * 转账拨币 |
| | | */ |
| | | public void sendAntKLineABMsg(Long id) { |
| | | log.info("开始转账拨币第二步:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ANT_K_LINE_AB.getExchange(), QueueEnum.ANT_K_LINE_AB.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * 转账拨币 |
| | | */ |
| | | public void sendAllMemberPerkAvaMsg(Long id) { |
| | | log.info("开始全体平分:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ALL_MEMBER_PERK_AVA.getExchange(), QueueEnum.ALL_MEMBER_PERK_AVA.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | /** |
| | | * 合约铸造ANDAO |
| | | */ |
| | | public void sendContractAnDao(Long flowId) { |
| | | log.info("合约铸造ANDAO:{}", flowId); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.CONTRACT_AN_DAO.getExchange(), QueueEnum.CONTRACT_AN_DAO.getRoute(), flowId, correlationData); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * A 入金的消息 |
| | | * @param id |
| | | */ |
| | | public void sendAntACoinInContractMsg(Long id) { |
| | | log.info("开始---合约铸造ANDAO:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN_CONTRACT.getExchange(), QueueEnum.ANT_A_CION_IN_CONTRACT.getRoute(), id, correlationData); |
| | | } |
| | | } |
| | |
| | | address |
| | | from dapp_member where active_status = 1 |
| | | </select> |
| | | |
| | | <select id="selectMallGoodsListQueryInPage" resultType="cc.mrbird.febs.dapp.vo.MallGoodsListVo"> |
| | | select |
| | | a.* |
| | | from mall_goods a |
| | | where a.is_sale = 1 |
| | | group by a.id |
| | | order by a.sort_cnt asc |
| | | </select> |
| | | |
| | | <select id="selectMallOrderListQueryInPage" resultType="cc.mrbird.febs.dapp.vo.MallOrderListVo"> |
| | | select a.* |
| | | from mall_order_info a |
| | | <where> |
| | | a.member_id = #{record.memberId} |
| | | <if test="record != null"> |
| | | <if test="record.status != null and record.status != ''"> |
| | | and a.status = #{record.status} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | order by a.create_time desc |
| | | </select> |
| | | |
| | | <select id="selectMallOrderListVoById" resultType="cc.mrbird.febs.dapp.vo.MallOrderListVo"> |
| | | select a.* |
| | | from mall_order_info a |
| | | where id = #{orderId} |
| | | order by a.create_time desc |
| | | </select> |
| | | |
| | | <select id="selectMallOrderItemVoByOrderId" resultType="cc.mrbird.febs.dapp.vo.MallOrderItemVo"> |
| | | select a.* |
| | | from mall_order_item a |
| | | where orderId = #{orderId} |
| | | </select> |
| | | |
| | | <select id="selectMallGoodsListVoById" resultType="cc.mrbird.febs.dapp.vo.MallGoodsListVo"> |
| | | select |
| | | a.* |
| | | from mall_goods a |
| | | where a.id = #{goodsId} |
| | | </select> |
| | | |
| | | <select id="selectInviteLeft" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity"> |
| | | select * from dapp_member where invite_left = #{inviteId} |
| | | </select> |
| | | |
| | | <select id="selectInviteRight" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity"> |
| | | select * from dapp_member where invite_right = #{inviteId} |
| | | </select> |
| | | </mapper> |
| | |
| | | member_id = #{memberId} |
| | | </update> |
| | | |
| | | <update id="reduceTotalAndAvailableByMemberId"> |
| | | update dapp_wallet_coin |
| | | set |
| | | total_amount = total_amount - #{balance}, |
| | | available_amount = available_amount - #{balance} |
| | | where |
| | | member_id = #{memberId} |
| | | </update> |
| | | |
| | | <select id="selectAmountThanZero" resultType="cc.mrbird.febs.dapp.entity.DappWalletCoinEntity"> |
| | | select * from dapp_wallet_coin where available_amount > 0 |
| | | </select> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.dapp.mapper.MallAchieveRecordMapper"> |
| | | |
| | | <select id="selectAchieveTotal" resultType="java.math.BigDecimal"> |
| | | select IFNULL(sum(IFNULL(amount,0)),0) from mall_achieve_record |
| | | where 1=1 |
| | | <if test='type == "D"'> |
| | | and date_format(achieve_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d'); |
| | | </if> |
| | | <if test='type == "M"'> |
| | | and date_format(achieve_time, '%Y-%m') = date_format(#{date}, '%Y-%m'); |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectSumAchieveByMemberIds" resultType="java.math.BigDecimal"> |
| | | select IFNULL(sum(IFNULL(amount,0)),0) |
| | | from mall_achieve_record |
| | | where member_id IN |
| | | <foreach collection = "list" item = "item" separator="," open = "(" close = ")" > |
| | | #{item} |
| | | </foreach > |
| | | and date_format(achieve_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d'); |
| | | </select> |
| | | |
| | | <select id="selectListByDate" resultType="cc.mrbird.febs.dapp.entity.MallAchieveRecord"> |
| | | select * from mall_achieve_record |
| | | where date_format(achieve_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d'); |
| | | </select> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.dapp.mapper.MatrixTreeNodeMapper"> |
| | | |
| | | <select id="selectAllMatrixTreeNode" resultType="cc.mrbird.febs.dapp.entity.MatrixTreeNode"> |
| | | select a.*, b.phone, b.name, b.invite_id, b.referrer_id from matrix_tree_node a |
| | | inner join mall_member b on a.tree_node=b.id |
| | | order by a.id |
| | | </select> |
| | | |
| | | <select id="selectByTreeNode" resultType="cc.mrbird.febs.dapp.entity.MatrixTreeNode"> |
| | | select * from matrix_tree_node where tree_node=#{treeNode} |
| | | </select> |
| | | </mapper> |