From a9f98642c8ec0d92cdb2aa3500377c97b89dbc71 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Tue, 09 Jul 2024 21:50:27 +0800
Subject: [PATCH] 逻辑

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java |   49 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
index 976e467..27caa88 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -18,6 +18,7 @@
 import cc.mrbird.febs.dapp.vo.*;
 import cc.mrbird.febs.rabbit.producer.ChainProducer;
 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;
@@ -422,6 +423,11 @@
             throw new FebsException("贡献暂未开启");
         }
 
+        DateTime startTime = DateUtil.parseDateTime("2024-07-09 17:00:00");
+        if(DateUtil.compare(DateUtil.date(), startTime) < 0){
+            throw new FebsException("贡献暂未开启");
+        }
+
         BigDecimal amount = transferDto.getAmount();
         if(BigDecimal.ZERO.compareTo(amount) >= 0){
             throw new FebsException("请输入正确的存储数量");
@@ -689,10 +695,14 @@
                 DataDictionaryEnum.BUCAHNG_CHI.getType(),
                 DataDictionaryEnum.BUCAHNG_CHI.getCode()
         ).getValue());
-        apiIndexInfoVo.setJiedianChi(dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-                DataDictionaryEnum.JIE_DIAN_CHI.getType(),
-                DataDictionaryEnum.JIE_DIAN_CHI.getCode()
-        ).getValue());
+        List<DappStorage> dappStorages = dappStorageMapper.selectList(null);
+        BigDecimal reduce = dappStorages.stream().map(DappStorage::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2,BigDecimal.ROUND_DOWN);
+        apiIndexInfoVo.setJiedianChi(reduce.toString());
+
+//        apiIndexInfoVo.setJiedianChi(dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+//                DataDictionaryEnum.JIE_DIAN_CHI.getType(),
+//                DataDictionaryEnum.JIE_DIAN_CHI.getCode()
+//        ).getValue());
         apiIndexInfoVo.setJijinghuiChi(dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                 DataDictionaryEnum.JI_JING_HUI_CHI.getType(),
                 DataDictionaryEnum.JI_JING_HUI_CHI.getCode()
@@ -707,7 +717,19 @@
     @Override
     public List<ApiStorageInfoVo> storageIndex() {
         List<ApiStorageInfoVo> apiStorageInfoVos = new ArrayList<>();
-        List<DappStorage> dappStorages = dappStorageMapper.selectSumByAmountDesc(DateUtil.offsetHour(new Date(), -1), 0, 10);
+
+        DateTime nowTime = DateUtil.parseTime(DateUtil.formatTime(new Date()));
+        DateTime perkTime = DateUtil.parseTime("17:00:00");
+        String startTimeStr = null;
+        if(DateUtil.compare(nowTime,perkTime) >= 0){
+            startTimeStr = DateUtil.formatDate(DateUtil.offsetDay(new Date(), 0)) + " 17:00:00";
+        }else{
+            startTimeStr = DateUtil.formatDate(DateUtil.offsetDay(new Date(), -1)) + " 17:00:00";
+        }
+        DateTime startTime = DateUtil.parseDateTime(startTimeStr);
+
+        List<DappStorage> dappStorages = dappStorageMapper.selectSumByAmountDescFiveToFive(startTime, 0, 10);
+//        List<DappStorage> dappStorages = dappStorageMapper.selectSumByAmountDesc(DateUtil.offsetHour(new Date(), -1), 0, 10);
         if(CollUtil.isNotEmpty(dappStorages)){
             for(DappStorage dappStorage : dappStorages){
                 ApiStorageInfoVo apiStorageInfoVo = new ApiStorageInfoVo();
@@ -781,12 +803,27 @@
          */
         HashMap<Long, BigDecimal> map = new HashMap<>();
 
-        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDate(new Date());
+        DateTime nowTime = DateUtil.parseTime(DateUtil.formatTime(new Date()));
+        DateTime perkTime = DateUtil.parseTime("17:00:00");
+        String startTimeStr = null;
+        if(DateUtil.compare(nowTime,perkTime) >= 0){
+            startTimeStr = DateUtil.formatDate(DateUtil.offsetDay(new Date(), 0)) + " 17:00:00";
+        }else{
+            startTimeStr = DateUtil.formatDate(DateUtil.offsetDay(new Date(), -1)) + " 17:00:00";
+        }
+        DateTime startTime = DateUtil.parseDateTime(startTimeStr);
+        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDateFiveToFiver(startTime);
+
+//        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDate(new Date());
         if(CollUtil.isNotEmpty(dappMemberEntityList)){
             for(DappMemberEntity member : dappMemberEntityList){
+
                 if(StrUtil.isEmpty(member.getRefererId())){
                     continue;
                 }
+                if(2 == member.getActiveStatus()){
+                    continue;
+                }
                 DappMemberEntity memberRef = dappMemberDao.selectMemberInfoByInviteId(member.getRefererId());
                 if(ObjectUtil.isEmpty(memberRef)){
                     continue;

--
Gitblit v1.9.1