KKSU
2024-08-06 609d2e5f259aeb07b9579fb0ea0c01dd36b482d0
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
package cc.mrbird.febs;
 
import cc.mrbird.febs.common.contants.AppContants;
import cc.mrbird.febs.dapp.chain.ChainEnum;
import cc.mrbird.febs.dapp.chain.ChainService;
import cc.mrbird.febs.dapp.dto.BatchTransferDto;
import cc.mrbird.febs.dapp.entity.DappFundFlowEntity;
import cc.mrbird.febs.dapp.entity.DappMemberEntity;
import cc.mrbird.febs.dapp.entity.DappStorage;
import cc.mrbird.febs.dapp.entity.DappWalletCoinEntity;
import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum;
import cc.mrbird.febs.dapp.enumerate.MemberLevelEnum;
import cc.mrbird.febs.dapp.enumerate.MoneyFlowEnum;
import cc.mrbird.febs.dapp.mapper.*;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
 
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
 
/**
 * @author wzy
 * @date 2022-06-09
 **/
@SpringBootTest
public class MemberTest {
 
//    @Autowired
//    private DappMemberService dappMemberService;
//    @Autowired
//    private DappFundFlowDao dappFundFlowDao;
//
//    @Resource
//    private DappSystemService dappSystemService;
//
    @Resource
    private DappStorageMapper dappStorageMapper;
//
    @Resource
    private DataDictionaryCustomMapper dataDictionaryCustomMapper;
//
    @Resource
    private DappMemberDao dappMemberDao;
    @Resource
    private DappFundFlowDao dappFundFlowDao;
    @Resource
    private DappWalletCoinDao dappWalletCoinDao;
    @Resource
    private ApplicationContext applicationContext;
    @Test
    public void profitDailyJobOneV2() {
 
        String feeAddressKey = AppContants.FEE_ADDRESS_KEY.get("feeAddressKey").toString();
        String feeAddress = AppContants.FEE_ADDRESS.get("feeAddress").toString();
        System.out.println(feeAddressKey);
        System.out.println(feeAddress);
        System.out.println(ChainService.getInstance(ChainEnum.BSC_TFC.name()).blockNumber());
        AppContants.FEE_ADDRESS_KEY.replace("feeAddressKey","592cd2f7e57f94cad7eddc6019a9ed8a36ff05cf37037f74cebe1ffacfaabe77");
        AppContants.FEE_ADDRESS.replace("feeAddress","0xCEBfd36e03BD80c7015Cbad17eFfBc33d2923FF3");
        List<BatchTransferDto> objects = new ArrayList<>();
        BatchTransferDto batchTransferDtoFee = new BatchTransferDto("0xE09705E2D5283ee4b74182Ed5906D30E3b0D5fa8",new BigDecimal(1));
        objects.add(batchTransferDtoFee);
        ChainService.getInstance(ChainEnum.BSC_TFC.name()).transferList(objects);
        System.out.println(ChainService.getInstance(ChainEnum.BSC_TFC.name()).blockNumber());
//        System.out.println(feeAddressKey2);
 
 
//        String feeAddressKey = AppContants.FEE_ADDRESS_KEY.get("feeAddressKey").toString();
//        System.out.println(feeAddressKey);
//        System.out.println(ChainService.getInstance(ChainEnum.BSC_TFC.name()).blockNumber());
//        AppContants.FEE_ADDRESS_KEY.put("feeAddressKey","592cd2f7e57f94cad7eddc6019a9ed8a36ff05cf37037f74cebe1ffacfaabe77");
//        String feeAddressKey2 = AppContants.FEE_ADDRESS_KEY.get("feeAddressKey").toString();
//        System.out.println(ChainService.getInstance(ChainEnum.BSC_TFC.name()).blockNumber());
//        System.out.println(feeAddressKey2);
    }
 
 
    @Test
    public void profitDailyJobOne() {
 
        Date date = new Date();
        DappStorage dappStorageLast = dappStorageMapper.selectOneByCreateTimeDesc(0, 1);
        DateTime dateTime1 = DateUtil.offsetHour(dappStorageLast.getCreateTime(), 24);
        int compare = DateUtil.compare(dateTime1, date);
        if(compare > 0){
            System.out.println("时间未到");
        }
    }
 
    @Test
    public void returnDate() {//注册
 
        QueryWrapper<DappFundFlowEntity> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("type", MoneyFlowEnum.BU_CHANG_PERK.getValue());
        List<DappFundFlowEntity> dappFundFlowEntities = dappFundFlowDao.selectList(objectQueryWrapper);
        if(CollUtil.isNotEmpty(dappFundFlowEntities)){
            for(DappFundFlowEntity dappFundFlowEntity : dappFundFlowEntities){
                BigDecimal amount = dappFundFlowEntity.getAmount();
                Long memberId = dappFundFlowEntity.getMemberId();
 
                DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId);
                BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount();
                BigDecimal totalAmount = dappWalletCoinEntity.getTotalAmount();
                if(dappWalletCoinEntity.getAvailableAmount().compareTo(amount) >= 0){
                    dappWalletCoinEntity.setAvailableAmount(availableAmount.subtract(amount));
                    dappWalletCoinEntity.setTotalAmount(totalAmount.subtract(amount));
                    dappWalletCoinDao.updateWithLock(dappWalletCoinEntity);
                }
                dappFundFlowDao.deleteById(dappFundFlowEntity);
            }
        }
 
        List<DappStorage> dappStorages = dappStorageMapper.selectList(null);
        BigDecimal reduce = dappStorages.stream().map(DappStorage::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
        BigDecimal bigDecimal = reduce.multiply(new BigDecimal(AppContants.DAO_BU_CHANG_PERCENT)).setScale(2, BigDecimal.ROUND_DOWN);
        dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
                DataDictionaryEnum.BUCAHNG_CHI.getType(),
                DataDictionaryEnum.BUCAHNG_CHI.getCode(),bigDecimal.toString()
        );
 
    }
 
    @Test
    public void withdraw() {//注册
 
        ArrayList<BatchTransferDto> objects = new ArrayList<>();
        BatchTransferDto batchTransferDto = new BatchTransferDto("0x4b1e48d0c2fb8a80afa2ac1f8028fd25004d59b1",new BigDecimal("282.6"));
        objects.add(batchTransferDto);
 
        BatchTransferDto batchTransferDtoFee1 = new BatchTransferDto("0xe457e3e1413750c7810681ca5e080951b819d91c",new BigDecimal("423"));
        objects.add(batchTransferDtoFee1);
 
        BatchTransferDto batchTransferDtoFee2 = new BatchTransferDto("0x96d21a1aadf6156be9a79c5b18aaf9373cdbc8c2",new BigDecimal("295"));
        objects.add(batchTransferDtoFee2);
 
        BatchTransferDto batchTransferDtoFee3 = new BatchTransferDto("0x86bdeb5d597aeffedc80f6b63c410c71da606b8a",new BigDecimal("149"));
        objects.add(batchTransferDtoFee3);
        ChainService.getInstance(ChainEnum.BSC_USDT.name()).transferList(objects);
    }
//
    @Test
    public void register() {//注册
        List<DappMemberEntity> dappMemberEntities = dappMemberDao.selectList(null);
        for(DappMemberEntity memberEntityNow : dappMemberEntities){
            DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberEntityNow.getId());
            if(StrUtil.isEmpty(dappMemberEntity.getRefererIds())){
                continue;
            }
            //获取全部上级
            ArrayList<DappMemberEntity> activeMembers = new ArrayList<>();
            List<String> refererIds = Arrays.asList(StrUtil.split(dappMemberEntity.getRefererIds(),","));
            for(String inviteId : refererIds){
                DappMemberEntity memberEntity = dappMemberDao.selectMemberInfoByInviteId(inviteId);
                if(ObjectUtil.isNotEmpty(memberEntity)){
                    activeMembers.add(memberEntity);
                }
            }
            if(CollUtil.isEmpty(activeMembers)){
                continue;
            }
 
            for(DappMemberEntity activeMember : activeMembers){
                //获取每一个上级的所有直推,分辨大小区是否满足业绩需求
                List<DappMemberEntity> directMembers = dappMemberDao.selectChildMemberDirectOrNot(activeMember.getInviteId(), 1, null);
                if(CollUtil.isEmpty(directMembers)){
                    continue;
                }
                if(directMembers.size() < 2){
                    continue;
                }
                //获取activeMember的每一个直推的团队有效业绩
                HashMap<Long, BigDecimal> daXiaoQu = new HashMap<>();
                for(DappMemberEntity directMember : directMembers){
                    //每一个直推的团队
                    List<DappMemberEntity> direct = dappMemberDao.selectChildMemberDirectOrNot(directMember.getInviteId(), 2, null);
                    direct.add(directMember);
                    if(CollUtil.isEmpty(direct)){
                        continue;
                    }
                    //获取直推的团队的全部有效业绩
                    List<Long> collect = direct.stream().map(DappMemberEntity::getId).collect(Collectors.toList());
                    QueryWrapper<DappStorage> storageQueryWrapper = new QueryWrapper<>();
                    storageQueryWrapper.in("member_id",collect);
//                storageQueryWrapper.eq("state",1);
                    List<DappStorage> dappStorages = dappStorageMapper.selectList(storageQueryWrapper);
                    if(CollUtil.isEmpty(dappStorages)){
                        continue;
                    }
 
                    BigDecimal directAchieve = dappStorages.stream()
                            .map(DappStorage::getAmount) // 映射amount到流中
                            .reduce(BigDecimal.ZERO, BigDecimal::add);
                    daXiaoQu.put(directMember.getId(),directAchieve);
                }
                if(daXiaoQu.isEmpty()){
                    continue;
                }
                //输出小区的总业绩
                BigDecimal sum = sumExcludingMax(daXiaoQu);
                BigDecimal dao_1_levelAchieve = new BigDecimal(MemberLevelEnum.DAO_1.getLevelAchieve());
                BigDecimal dao_2_levelAchieve = new BigDecimal(MemberLevelEnum.DAO_2.getLevelAchieve());
                BigDecimal dao_3_levelAchieve = new BigDecimal(MemberLevelEnum.DAO_3.getLevelAchieve());
                if(sum.compareTo(dao_3_levelAchieve) >= 0){
                    activeMember.setLevel(MemberLevelEnum.DAO_3.getCode());
                    dappMemberDao.updateById(activeMember);
                }else if(sum.compareTo(dao_2_levelAchieve) >= 0 && sum.compareTo(dao_3_levelAchieve) < 0){
                    activeMember.setLevel(MemberLevelEnum.DAO_2.getCode());
                    dappMemberDao.updateById(activeMember);
                }else if(sum.compareTo(dao_1_levelAchieve) >= 0 && sum.compareTo(dao_2_levelAchieve) < 0){
                    activeMember.setLevel(MemberLevelEnum.DAO_1.getCode());
                    dappMemberDao.updateById(activeMember);
                }else{
                    activeMember.setLevel(MemberLevelEnum.DAO_0.getCode());
                    dappMemberDao.updateById(activeMember);
                }
            }
        }
    }
 
    public static BigDecimal sumExcludingMax(HashMap<Long, BigDecimal> map) {
        if (map == null) {
            throw new NullPointerException("HashMap cannot be null");
        }
 
        // 使用Stream API找到最大的BigDecimal值及其对应的key
        Optional<Map.Entry<Long, BigDecimal>> maxEntry = map.entrySet().stream()
                .max((e1, e2) -> e1.getValue().compareTo(e2.getValue()));
 
        // 检查是否找到了最大值
        if (maxEntry.isPresent()) {
            // 移除最大值对应的键值对
            map.remove(maxEntry.get().getKey());
 
            // 计算剩余数据的累计和
            BigDecimal sumOfRemaining = map.entrySet().stream()
                    .map(Map.Entry::getValue)
                    .reduce(BigDecimal.ZERO, BigDecimal::add);
 
            // 返回累计和
            return sumOfRemaining;
        } else {
            // 如果没有找到最大值(即HashMap为空),则返回BigDecimal.ZERO
            return BigDecimal.ZERO;
        }
    }
//
//    @Test
//    public void registerV2() {//存储
//        Long memberId = 348L;
//        BigDecimal bigDecimal = new BigDecimal("500");
//        DappFundFlowEntity fundFlow = new DappFundFlowEntity(
//                memberId,
//                bigDecimal.abs(),
//                MoneyFlowEnum.CUN_CHU.getValue(),
//                1,
//                BigDecimal.ZERO,
//                StrUtil.format(MoneyFlowEnum.CUN_CHU.getDescrition(),bigDecimal));
//        dappFundFlowDao.insert(fundFlow);
//
//    }
//
//    @Test
//    public void registerV3() {//存储
//        dappSystemService.teamPerk(4360L);
//
//    }
//
//    @Test
//    public void registerV4() {//存储
//
//        DataDictionaryCustom jiliChiDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
//                DataDictionaryEnum.JILI_CHI.getType(),
//                DataDictionaryEnum.JILI_CHI.getCode()
//        );
//
//        BigDecimal realAmount = BigDecimal.ZERO;
//        //DAO永动激励池50%
//        BigDecimal jiLiTotal = new BigDecimal(jiliChiDic.getValue()).multiply(new BigDecimal("0.5")).setScale(2, BigDecimal.ROUND_DOWN);
//        if(BigDecimal.ZERO.compareTo(jiLiTotal) >= 0){
//            return;
//        }
//
//
//        /**
//         * 其中50%给予当天大单排名激励前4名,40%、30%、20、10%
//         */
//        BigDecimal daDanTotal = jiLiTotal.multiply(new BigDecimal("0.5")).setScale(2, BigDecimal.ROUND_DOWN);
//        if(daDanTotal.compareTo(BigDecimal.ZERO) > 0){
//
//            int oneCount = 4;
//            int twoCount = 3;
//            int threeCount = 2;
//            int fourCount = 1;
//            int count = oneCount + twoCount + threeCount + fourCount;
//            //每一份的奖励数量
//            BigDecimal everyAmount = daDanTotal.divide(new BigDecimal(count));
//
//            if(everyAmount.compareTo(BigDecimal.ZERO) > 0){
//                DappStorage dappStorageOne = dappStorageMapper.selectAmountByDesc(DateUtil.offsetDay(new Date(),0),0,1);
//                if(ObjectUtil.isNotEmpty(dappStorageOne)){
//                    BigDecimal multiply = everyAmount.multiply(new BigDecimal(oneCount));
//                    dappSystemService.updateBalanceInsertFlow(
//                            multiply,
//                            dappStorageOne.getMemberId(),
//                            MoneyFlowEnum.DA_DAN_JI_LI_PERK.getValue(),
//                            StrUtil.format(MoneyFlowEnum.DA_DAN_JI_LI_PERK.getDescrition(),daDanTotal,multiply));
//
//                    realAmount = realAmount.add(multiply);
//                }
//                DappStorage dappStorageTwo = dappStorageMapper.selectAmountByDesc(DateUtil.offsetDay(new Date(),0),1,1);
//                if(ObjectUtil.isNotEmpty(dappStorageTwo)){
//                    BigDecimal multiply = everyAmount.multiply(new BigDecimal(twoCount));
//                    dappSystemService.updateBalanceInsertFlow(
//                            multiply,
//                            dappStorageTwo.getMemberId(),
//                            MoneyFlowEnum.DA_DAN_JI_LI_PERK.getValue(),
//                            StrUtil.format(MoneyFlowEnum.DA_DAN_JI_LI_PERK.getDescrition(),daDanTotal,multiply));
//
//                    realAmount = realAmount.add(multiply);
//                }
//                DappStorage dappStorageThree = dappStorageMapper.selectAmountByDesc(DateUtil.offsetDay(new Date(),0),2,1);
//                if(ObjectUtil.isNotEmpty(dappStorageThree)){
//                    BigDecimal multiply = everyAmount.multiply(new BigDecimal(threeCount));
//                    dappSystemService.updateBalanceInsertFlow(
//                            multiply,
//                            dappStorageThree.getMemberId(),
//                            MoneyFlowEnum.DA_DAN_JI_LI_PERK.getValue(),
//                            StrUtil.format(MoneyFlowEnum.DA_DAN_JI_LI_PERK.getDescrition(),daDanTotal,multiply));
//
//                    realAmount = realAmount.add(multiply);
//                }
//                DappStorage dappStorageFour = dappStorageMapper.selectAmountByDesc(DateUtil.offsetDay(new Date(),0),3,1);
//                if(ObjectUtil.isNotEmpty(dappStorageFour)){
//                    BigDecimal multiply = everyAmount.multiply(new BigDecimal(fourCount));
//                    dappSystemService.updateBalanceInsertFlow(
//                            multiply,
//                            dappStorageFour.getMemberId(),
//                            MoneyFlowEnum.DA_DAN_JI_LI_PERK.getValue(),
//                            StrUtil.format(MoneyFlowEnum.DA_DAN_JI_LI_PERK.getDescrition(),daDanTotal,multiply));
//
//                    realAmount = realAmount.add(multiply);
//                }
//            }
//        }
//
//        /**
//         * 另外50% 给予当天直推总业绩排名激励前10名,第1名40%,2-4名30%,5-10名30%
//         */
//        BigDecimal directTotal = jiLiTotal.multiply(new BigDecimal("0.5")).setScale(2, BigDecimal.ROUND_DOWN);
//        /**
//         * 存放直推业绩<上级的memberId,直推总业绩>
//         */
//        HashMap<Long, BigDecimal> map = new HashMap<>();
//
//        List<DappStorage> dappStorages = dappStorageMapper.selectListByDate(DateUtil.offsetDay(new Date(),0));
//        if(CollUtil.isNotEmpty(dappStorages)){
//            for(DappStorage dappStorage : dappStorages){
//                DappMemberEntity member = dappMemberDao.selectById(dappStorage.getMemberId());
//                if(StrUtil.isEmpty(member.getRefererId())){
//                    continue;
//                }
//                DappMemberEntity memberRef = dappMemberDao.selectMemberInfoByInviteId(member.getRefererId());
//                if(ObjectUtil.isEmpty(memberRef)){
//                    continue;
//                }
//                Long id = memberRef.getId();
//                if(map.containsKey(id)){
//                    BigDecimal bigDecimal = map.get(id);
//                    BigDecimal add = bigDecimal.add(dappStorage.getAmount());
//                    map.put(id,add);
//                }else{
//                    map.put(id,dappStorage.getAmount());
//                }
//            }
//        }
//        /**
//         * 获取这个map的直推总业绩前十,分发奖励
//         */
//        if(!map.isEmpty()){
//            // 使用Stream API按照BigDecimal从大到小排序
//            List<Map.Entry<Long, BigDecimal>> topTenEntries = map.entrySet().stream()
//                    .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
//                    .limit(10)
//                    .collect(Collectors.toList());
//
//            int startNum = 1;
//            for (Map.Entry<Long, BigDecimal> entry : topTenEntries) {
//
//                Long memberId = entry.getKey();
//                BigDecimal directAchieve = entry.getValue();
//                //第一名
//                if(startNum == 1){
//                    BigDecimal bigDecimal = directTotal.multiply(new BigDecimal("0.4")).setScale(2, BigDecimal.ROUND_DOWN);
//                    dappSystemService.updateBalanceInsertFlow(
//                            bigDecimal,
//                            memberId,
//                            MoneyFlowEnum.ZHI_TUI_JI_LI_PERK.getValue(),
//                            StrUtil.format(MoneyFlowEnum.ZHI_TUI_JI_LI_PERK.getDescrition(),directAchieve,startNum,bigDecimal));
//
//                    realAmount = realAmount.add(bigDecimal);
//                }else if(startNum > 1 && startNum <=4){
//                    BigDecimal bigDecimal = directTotal.multiply(new BigDecimal("0.3")).setScale(2, BigDecimal.ROUND_DOWN);
//                    BigDecimal divide = bigDecimal.divide(new BigDecimal("3"), 2, BigDecimal.ROUND_DOWN);
//
//                    dappSystemService.updateBalanceInsertFlow(
//                            divide,
//                            memberId,
//                            MoneyFlowEnum.ZHI_TUI_JI_LI_PERK.getValue(),
//                            StrUtil.format(MoneyFlowEnum.ZHI_TUI_JI_LI_PERK.getDescrition(),directAchieve,startNum,divide));
//
//                    realAmount = realAmount.add(divide);
//                }else{
//                    BigDecimal bigDecimal = directTotal.multiply(new BigDecimal("0.3")).setScale(2, BigDecimal.ROUND_DOWN);
//                    BigDecimal divide = bigDecimal.divide(new BigDecimal("6"), 2, BigDecimal.ROUND_DOWN);
//
//                    dappSystemService.updateBalanceInsertFlow(
//                            divide,
//                            memberId,
//                            MoneyFlowEnum.ZHI_TUI_JI_LI_PERK.getValue(),
//                            StrUtil.format(MoneyFlowEnum.ZHI_TUI_JI_LI_PERK.getDescrition(),directAchieve,startNum,divide));
//
//                    realAmount = realAmount.add(divide);
//                }
//                startNum = startNum + 1;
//            }
//        }
//
//        BigDecimal subtract = new BigDecimal(jiliChiDic.getValue()).subtract(realAmount);
//        jiliChiDic.setValue(subtract.toString());
//        dataDictionaryCustomMapper.updateById(jiliChiDic);
//    }
//    @Test
//    public void testv5(){
//        Long memberId = 1L;
//        List<TeamDownVo> objects = new ArrayList<>();
//
//        DappMemberEntity memberEntity = dappMemberDao.selectById(memberId);
//        List<DappMemberEntity> directMembers = dappMemberDao.selectChildMemberDirectOrNot(memberEntity.getInviteId(), 1, null);
//
//        if(CollUtil.isNotEmpty(directMembers)){
//
//            for(DappMemberEntity directMember : directMembers){
//                TeamDownVo teamDownVo = new TeamDownVo();
//
//
//
//                teamDownVo.setAddress(directMember.getAddress());
//                List<DappMemberEntity> teamMembers = dappMemberDao.selectChildMemberDirectOrNot(directMember.getInviteId(), 2, null);
//                if(CollUtil.isEmpty(teamMembers)){
//                    teamDownVo.setActiveCnt(0);
//                    teamDownVo.setActiveAchieve(BigDecimal.ZERO);
//                }else{
//                    List<DappMemberEntity> teamCntAva = teamMembers.stream().filter(dappMemberEntity -> dappMemberEntity.getActiveStatus() == 1).collect(Collectors.toList());
//                    List<Long> collectTeam = teamCntAva.stream().map(DappMemberEntity::getId).collect(Collectors.toList());
//
//                    if(CollUtil.isNotEmpty(collectTeam)){
//                        QueryWrapper<DappStorage> collectTeamWrapper = new QueryWrapper<>();
//                        collectTeamWrapper.in("member_id",collectTeam);
//                        collectTeamWrapper.eq("state",1);
//                        List<DappStorage> dappStoragesTeam = dappStorageMapper.selectList(collectTeamWrapper);
//                        BigDecimal teamAchieve = dappStoragesTeam.stream()
//                                .map(DappStorage::getAmount) // 映射amount到流中
//                                .reduce(BigDecimal.ZERO, BigDecimal::add);
//
//                        teamDownVo.setActiveCnt(teamCntAva.size());
//                        teamDownVo.setActiveAchieve(teamAchieve);
//                    }else{
//                        teamDownVo.setActiveCnt(0);
//                        teamDownVo.setActiveAchieve(BigDecimal.ZERO);
//                    }
//                }
//
//                objects.add(teamDownVo);
//            }
//        }
//        System.out.println(objects);
//    }
}