Helius
2022-06-09 7f58b6ad935f464abe3cb6ebc0a107bf2ad34b8c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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<DataDictionaryCustom> 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);
    }
}