12 files modified
1 files added
| | |
| | | @ApiModelProperty(value = "每页数量") |
| | | private Integer pageSize = 10; |
| | | |
| | | @ApiModelProperty(value = "类型", example = "1-买入 2-卖出 3-采矿") |
| | | @ApiModelProperty(value = "类型", example = "1-认购 2-提现 3-矩阵收益 4-直推收益") |
| | | private Integer type; |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | private Integer hasMoney; |
| | | |
| | | private Integer deep; |
| | | |
| | | @TableField(exist = false) |
| | | private String inviteId; |
| | | |
| | | @TableField(exist = false) |
| | | private String address; |
| | | } |
| | |
| | | |
| | | public interface DappAchieveMemberTreeDao extends BaseMapper<DappAchieveMemberTreeEntity> { |
| | | |
| | | List<DappAchieveMemberTreeEntity> selectNotBottomNodeInMatrix(Long memberId); |
| | | List<DappAchieveMemberTreeEntity> selectNotBottomNodeInMatrix(@Param("memberId") Long memberId); |
| | | |
| | | List<DappAchieveMemberTreeEntity> selectMatrixTreeByTopNode(Long memberId); |
| | | List<DappAchieveMemberTreeEntity> selectMatrixTreeByTopNode(@Param("memberId") Long memberId, @Param("hasMoney") Integer hasMoney); |
| | | |
| | | DappAchieveMemberTreeEntity selectNodeByDeep(@Param("memberId") Long memberId, @Param("deep") Integer deep); |
| | | |
| | | int resetMatrixTree(Long memberId); |
| | | List<DappAchieveMemberTreeEntity> selectMatrixChildNode(@Param("topNode") Long topNode, @Param("parentNode") Long parentNode); |
| | | |
| | | int reentryMoney(Long memberId); |
| | | int resetMatrixTree(@Param("memberId") Long memberId); |
| | | |
| | | int reentryMoney(@Param("memberId") Long memberId); |
| | | } |
| | |
| | | |
| | | BigDecimal selectChildHoldAmount(@Param("inviteId") String inviteId); |
| | | |
| | | IPage<TeamListVo> selectTeamListInPage(@Param("record") TeamListDto teamListDto, Page<TeamListDto> page); |
| | | |
| | | List<DappMemberEntity> selectMakerAddress(); |
| | | } |
| | |
| | | |
| | | DappMemberEntity insertMember(String address, String refererId, String chainType, String accountType); |
| | | |
| | | List<TeamListVo> findTeamList(TeamListDto teamListDto); |
| | | TeamListVo findTeamList(TeamListDto teamListDto); |
| | | } |
| | |
| | | private final DappWalletMineDao dappWalletMineDao; |
| | | private final DappTransferRecordDao dappTransferRecordDao; |
| | | private final RedisUtils redisUtils; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | |
| | | private final DappAchieveMemberTreeDao dappAchieveMemberTreeDao; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<TeamListVo> findTeamList(TeamListDto teamListDto) { |
| | | public TeamListVo findTeamList(TeamListDto teamListDto) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | Page<TeamListDto> page = new Page<>(teamListDto.getPageNum(), teamListDto.getPageSize()); |
| | | teamListDto.setInviteId(member.getInviteId()); |
| | | return dappMemberDao.selectTeamListInPage(teamListDto, page).getRecords(); |
| | | |
| | | DappAchieveMemberTreeEntity topNode = dappAchieveMemberTreeDao.selectNodeByDeep(member.getId(), 1); |
| | | return buildTeamMatrix(topNode); |
| | | } |
| | | |
| | | public TeamListVo buildTeamMatrix(DappAchieveMemberTreeEntity node) { |
| | | List<DappAchieveMemberTreeEntity> childNodes = dappAchieveMemberTreeDao.selectMatrixChildNode(node.getTopNode(), node.getTreeNode()); |
| | | |
| | | TeamListVo teamListVo = new TeamListVo(); |
| | | teamListVo.setName(node.getInviteId()); |
| | | teamListVo.setHasMoney(node.getHasMoney()); |
| | | |
| | | if (CollUtil.isEmpty(childNodes)) { |
| | | return teamListVo; |
| | | } |
| | | |
| | | List<TeamListVo> list = new ArrayList<>(); |
| | | for (DappAchieveMemberTreeEntity childNode : childNodes) { |
| | | list.add(buildTeamMatrix(childNode)); |
| | | } |
| | | return teamListVo; |
| | | } |
| | | } |
| | |
| | | |
| | | // 完成矩阵树,并重置矩阵且重入 |
| | | public void finishMatrixTree(Long memberId) { |
| | | List<DappAchieveMemberTreeEntity> matrixTree = dappAchieveMemberTreeDao.selectMatrixTreeByTopNode(memberId); |
| | | List<DappAchieveMemberTreeEntity> matrixTree = dappAchieveMemberTreeDao.selectMatrixTreeByTopNode(memberId, 1); |
| | | // 如果达到标准,则重置该矩阵树 |
| | | if (matrixTree.size() == 7) { |
| | | dappAchieveMemberTreeDao.resetMatrixTree(memberId); |
| | |
| | | walletInfo.setInviteId(member.getInviteId()); |
| | | walletInfo.setBalance(walletCoin.getAvailableAmount()); |
| | | walletInfo.setHasBuy(memberInfo.getActiveStatus()); |
| | | walletInfo.setOutCnt(1); |
| | | walletInfo.setProfit(BigDecimal.TEN); |
| | | return walletInfo; |
| | | } |
| | | |
| | |
| | | package cc.mrbird.febs.dapp.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | @ApiModel(value = "TeamLIstVo", description = "团队列表接口返回参数类") |
| | | public class TeamListVo { |
| | | |
| | | private String address; |
| | | @ApiModelProperty(value = "名称") |
| | | private String name; |
| | | |
| | | private Integer count; |
| | | @ApiModelProperty(value = "是否认购") |
| | | private int hasMoney; |
| | | |
| | | private BigDecimal coinCount; |
| | | @ApiModelProperty(value = "子节点") |
| | | private List<TeamListVo> children; |
| | | |
| | | private BigDecimal selfCoinCount; |
| | | |
| | | public BigDecimal getCoinCount() { |
| | | return coinCount.setScale(2, RoundingMode.HALF_DOWN); |
| | | } |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.dapp.vo; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @date 2022-08-26 |
| | | **/ |
| | | public class TeamMatrixVo { |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "余额") |
| | | private BigDecimal balance; |
| | | |
| | | @ApiModelProperty(value = "出局次数") |
| | | private int outCnt; |
| | | |
| | | @ApiModelProperty(value = "收益") |
| | | private BigDecimal profit; |
| | | |
| | | @ApiModelProperty(value = "是否购买") |
| | | private Integer hasBuy; |
| | | } |
| | |
| | | |
| | | <select id="selectMatrixTreeByTopNode" resultType="cc.mrbird.febs.dapp.entity.DappAchieveMemberTreeEntity"> |
| | | select * from dapp_achieve_member_tree |
| | | where top_node=#{memberId} and has_money=1 |
| | | where top_node=#{memberId} |
| | | <if test="hasMoney != null"> |
| | | and has_money=#{hasMoney} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectNodeByDeep" resultType="cc.mrbird.febs.dapp.entity.DappAchieveMemberTreeEntity"> |
| | | select * from dapp_achieve_member_tree |
| | | where tree_node=#{memberId} and deep=#{deep} |
| | | select a.*, b.invite_id, b.address from dapp_achieve_member_tree a, dapp_member b |
| | | where a.tree_node=#{memberId} and a.deep=#{deep} and a.tree_node=b.id |
| | | </select> |
| | | |
| | | <select id="resetMatrixTree" resultType="java.lang.Integer"> |
| | | <select id="selectMatrixChildNode" resultType="cc.mrbird.febs.dapp.entity.DappAchieveMemberTreeEntity"> |
| | | select a.*, b.invite_id, b.address from dapp_achieve_member_tree a, , dapp_member b |
| | | where a.top_node=#{topNode} and a.parent_node=#{parentNode} and a.tree_node=b.id |
| | | </select> |
| | | |
| | | <update id="resetMatrixTree"> |
| | | update dapp_achieve_member_tree |
| | | set has_money=2 |
| | | where top_node=#{memberId} and deep in (2,3) |
| | | </select> |
| | | </update> |
| | | |
| | | <select id="reentryMoney" resultType="java.lang.Integer"> |
| | | <update id="reentryMoney"> |
| | | update dapp_achieve_member_tree |
| | | set has_money=1 |
| | | where tree_node=#{memberId} |
| | | </select> |
| | | </update> |
| | | </mapper> |
| | |
| | | where find_in_set(#{inviteId}, fee_profit_ids) |
| | | </select> |
| | | |
| | | <!-- where find_in_set(#{record.inviteId}, a.fee_profit_ids)--> |
| | | <select id="selectTeamListInPage" resultType="cc.mrbird.febs.dapp.vo.TeamListVo"> |
| | | select |
| | | concat(left(a.address,5), '******', right(a.address,5)) address, |
| | | (select count(1) from dapp_member b where find_in_set(a.invite_id, b.fee_profit_ids) |
| | | ) count, |
| | | (select ifnull(sum(c.balance),0) from dapp_member c where find_in_set(a.invite_id, c.fee_profit_ids) |
| | | ) coinCount, |
| | | a.balance selfCoinCount |
| | | from dapp_member a |
| | | where a.referer_id=#{record.inviteId} |
| | | </select> |
| | | |
| | | <select id="selectMakerAddress" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity"> |
| | | select * from dapp_member |
| | | where maker_type=1 and account_type='normal' |