package cc.mrbird.febs; import cc.mrbird.febs.common.contants.AppContants; import cc.mrbird.febs.dapp.entity.DappMemberEntity; import cc.mrbird.febs.dapp.entity.DataDictionaryCustom; import cc.mrbird.febs.dapp.mapper.DappMemberDao; import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper; import cn.hutool.core.util.StrUtil; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.util.List; /** * @author wzy * @date 2022-06-09 **/ @SpringBootTest public class MemberTest { @Autowired private DappMemberDao dappMemberDao; @Autowired private DataDictionaryCustomMapper dataDictionaryCustomMapper; @Test public void refererIdsTest() { DappMemberEntity member = dappMemberDao.selectById(24); boolean flag = false; String parentId = "35087336"; String ids = ""; String feeProfitIds = ""; int i = 1; List feeProfitDic = dataDictionaryCustomMapper.selectDicByType(AppContants.DIC_TYPE_DISTRIBUTE_PROP); while (!flag && StringUtils.isNotBlank(parentId)) { if (StrUtil.isBlank(ids)) { ids += parentId; } else { ids += ("," + parentId); } if (i <= 4) { if (StrUtil.isBlank(feeProfitIds)) { feeProfitIds += parentId; } else { feeProfitIds += ("," + parentId); } } i++; DappMemberEntity parentMember = dappMemberDao.selectMemberInfoByInviteId(parentId); if (parentMember == null) { break; } parentId = parentMember.getRefererId(); if(StringUtils.isBlank(parentId) || "0".equals(parentId)){ break; } if (parentMember.getRefererId().equals(parentMember.getInviteId())) { flag = true; } } member.setRefererIds(ids); member.setFeeProfitIds(feeProfitIds); } }