From 19b525873d0e740d6ea31e939eb921bb711c8db6 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 05 Dec 2022 10:52:11 +0800
Subject: [PATCH] 20221130

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java |   68 +++++++++++++++++++++-------------
 1 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java
index 42c051f..ffd55d5 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java
@@ -201,7 +201,23 @@
         if (currentUser.getDeptId() == null) {
             member.setCurrentUser(currentUser.getUserId());
         }
-        return dappMemberDao.selectInPage(member, page);
+        IPage<DappMemberEntity> dappMemberEntityIPage = dappMemberDao.selectInPage(member, page);
+        List<DappMemberEntity> records = dappMemberEntityIPage.getRecords();
+        if(CollUtil.isNotEmpty(records)){
+            for(DappMemberEntity memberEntity : records){
+                Long memberId = memberEntity.getId();
+
+                DappSystemProfit dappSystemProfit = dappSystemProfitDao.selectByMemberIdAndState(memberId,DappSystemProfit.STATE_IN);
+                memberEntity.setSystemProfitId(ObjectUtil.isEmpty(dappSystemProfit) ? 0L : dappSystemProfit.getId());
+                BigDecimal directProfit = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberId,3,2);
+                memberEntity.setDirectProfit(directProfit);
+                BigDecimal levelProfit = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberId,4,2);
+                memberEntity.setLevelProfit(levelProfit);
+                BigDecimal luckyProfit = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberId,7,2);
+                memberEntity.setLuckyProfit(luckyProfit);
+            }
+        }
+        return dappMemberEntityIPage;
     }
 
     @Override
@@ -382,31 +398,31 @@
     @Override
     public ApiRunListInfoVo findRunListInfo() {
         ApiRunListInfoVo apiRunListInfoVo = new ApiRunListInfoVo();
-        //获取当前是第几轮队列
-        String redisKey = "QUEUE_COUNT";
-        String memberOutCount = redisUtils.getString(redisKey);
-        DataDictionaryCustom queueCountSet = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.QUEUE_COUNT.getType(), DataDictionaryEnum.QUEUE_COUNT.getCode());
-        String queueCount = queueCountSet.getValue();
-        if(StrUtil.isBlank(memberOutCount)){
-            redisUtils.set(redisKey,queueCount,0L);
-            memberOutCount = queueCount;
-        }
-        //出局条件的人数
-        /**
-         * 初始大小 5+4*0
-         * 1  1,2,3,4,5  1出局 5+4*0
-         * 2  2,3,4,5,1(复投),7,8,9,10  2出局 5+4*1
-         * 3  3,4,5,1(复投),7,8,9,10,2(复投),12,13,14,15 3出局 5+4*2
-         * 4  4,5,1(复投),7,8,9,10,2(复投),12,13,14,15,3(复投),17,18,19,20  4出局 5+4*3
-         */
-        Integer memberCount = Integer.parseInt(memberOutCount) * 4 + 5;
-        //判断当前是否符合出局条件
-        QueryWrapper<DappSystemProfit> objectQueryWrapper = new QueryWrapper<>();
-        objectQueryWrapper.eq("state",DappSystemProfit.STATE_IN);
-        //实际投资人数
-        Integer selectCount = dappSystemProfitDao.selectCount(objectQueryWrapper);
-        BigDecimal runPercent = new BigDecimal(selectCount).divide(new BigDecimal(memberCount), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100));
-        apiRunListInfoVo.setRunPercent(runPercent);
+//        //获取当前是第几轮队列
+//        String redisKey = "QUEUE_COUNT";
+//        String memberOutCount = redisUtils.getString(redisKey);
+//        DataDictionaryCustom queueCountSet = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.QUEUE_COUNT.getType(), DataDictionaryEnum.QUEUE_COUNT.getCode());
+//        String queueCount = queueCountSet.getValue();
+//        if(StrUtil.isBlank(memberOutCount)){
+//            redisUtils.set(redisKey,queueCount,0L);
+//            memberOutCount = queueCount;
+//        }
+//        //出局条件的人数
+//        /**
+//         * 初始大小 5+4*0
+//         * 1  1,2,3,4,5  1出局 5+4*0
+//         * 2  2,3,4,5,1(复投),7,8,9,10  2出局 5+4*1
+//         * 3  3,4,5,1(复投),7,8,9,10,2(复投),12,13,14,15 3出局 5+4*2
+//         * 4  4,5,1(复投),7,8,9,10,2(复投),12,13,14,15,3(复投),17,18,19,20  4出局 5+4*3
+//         */
+//        Integer memberCount = Integer.parseInt(memberOutCount) * 4 + 5;
+//        //判断当前是否符合出局条件
+//        QueryWrapper<DappSystemProfit> objectQueryWrapper = new QueryWrapper<>();
+//        objectQueryWrapper.eq("state",DappSystemProfit.STATE_IN);
+//        //实际投资人数
+//        Integer selectCount = dappSystemProfitDao.selectCount(objectQueryWrapper);
+//        BigDecimal runPercent = new BigDecimal(selectCount).divide(new BigDecimal(memberCount), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100));
+//        apiRunListInfoVo.setRunPercent(runPercent);
         //实际投资人数小于出局条件人数
         //符合则出局 实际投资人数等于出局条件人数
         DappSystemProfit dappSystemProfitIn = dappSystemProfitDao.selectSystemProfitInByState(DappSystemProfit.STATE_IN);

--
Gitblit v1.9.1