From c194fa54a13eacffde902df8e06758ddec951c4c Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Thu, 18 Jul 2024 09:42:53 +0800
Subject: [PATCH] 逻辑

---
 src/main/java/cc/mrbird/febs/job/ProfitDailyJob.java |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/job/ProfitDailyJob.java b/src/main/java/cc/mrbird/febs/job/ProfitDailyJob.java
index 6161e8c..04c7d37 100644
--- a/src/main/java/cc/mrbird/febs/job/ProfitDailyJob.java
+++ b/src/main/java/cc/mrbird/febs/job/ProfitDailyJob.java
@@ -6,6 +6,7 @@
 import cc.mrbird.febs.dapp.entity.DataDictionaryCustom;
 import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum;
 import cc.mrbird.febs.dapp.enumerate.MoneyFlowEnum;
+import cc.mrbird.febs.dapp.mapper.DappFundFlowDao;
 import cc.mrbird.febs.dapp.mapper.DappMemberDao;
 import cc.mrbird.febs.dapp.mapper.DappStorageMapper;
 import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
@@ -42,6 +43,8 @@
     private DappMemberDao dappMemberDao;
     @Resource
     private ChainProducer chainProducer;
+    @Resource
+    private DappFundFlowDao dappFundFlowDao;
 
     /**
      * 每天释放1%的静态释放
@@ -84,8 +87,27 @@
      * (其中50%给予当天大单排名激励前4名,40%、30%、20、10%;
      * 另外50% 给予当天直推总业绩排名激励前10名,第1名40%,2-4名30%,5-10名30%)
      */
-    @Scheduled(cron = "0 0 0 * * ?")
+    @Scheduled(cron = "0 0/1 0 * * ?")
     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){
+            return;
+        }
+
+        DataDictionaryCustom symbolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
+                DataDictionaryEnum.BUCHANG_SYMBOL.getType(),
+                DataDictionaryEnum.BUCHANG_SYMBOL.getCode()
+        );
+        if(2 == Integer.parseInt(symbolDic.getValue())){
+            return;
+        }
+        symbolDic.setValue("2");
+        dataDictionaryCustomMapper.updateById(symbolDic);
+
         DataDictionaryCustom buChangChiDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                 DataDictionaryEnum.BUCAHNG_CHI.getType(),
                 DataDictionaryEnum.BUCAHNG_CHI.getCode()
@@ -173,7 +195,7 @@
             BigDecimal everyAmount = daDanTotal.divide(new BigDecimal(count));
 
             if(everyAmount.compareTo(BigDecimal.ZERO) > 0){
-                List<DappStorage> dappStorageOne = dappStorageMapper.selectSumByAmountDesc(new Date(),0,1);
+                List<DappStorage> dappStorageOne = dappStorageMapper.selectSumByAmountDescFiveToFive(DateUtil.offsetHour(new Date(),-24),0,1);
                 if(CollUtil.isNotEmpty(dappStorageOne)){
                     BigDecimal multiply = everyAmount.multiply(new BigDecimal(oneCount));
                     dappSystemService.updateBalanceInsertFlow(
@@ -184,7 +206,7 @@
 
                     realAmount = realAmount.add(multiply);
                 }
-                List<DappStorage> dappStorageTwo = dappStorageMapper.selectSumByAmountDesc(new Date(),1,1);
+                List<DappStorage> dappStorageTwo = dappStorageMapper.selectSumByAmountDescFiveToFive(DateUtil.offsetHour(new Date(),-24),1,1);
                 if(CollUtil.isNotEmpty(dappStorageTwo)){
                     BigDecimal multiply = everyAmount.multiply(new BigDecimal(twoCount));
                     dappSystemService.updateBalanceInsertFlow(
@@ -195,7 +217,7 @@
 
                     realAmount = realAmount.add(multiply);
                 }
-                List<DappStorage> dappStorageThree = dappStorageMapper.selectSumByAmountDesc(new Date(),2,1);
+                List<DappStorage> dappStorageThree = dappStorageMapper.selectSumByAmountDescFiveToFive(DateUtil.offsetHour(new Date(),-24),2,1);
                 if(CollUtil.isNotEmpty(dappStorageThree)){
                     BigDecimal multiply = everyAmount.multiply(new BigDecimal(threeCount));
                     dappSystemService.updateBalanceInsertFlow(
@@ -206,7 +228,7 @@
 
                     realAmount = realAmount.add(multiply);
                 }
-                List<DappStorage> dappStorageFour = dappStorageMapper.selectSumByAmountDesc(new Date(),3,1);
+                List<DappStorage> dappStorageFour = dappStorageMapper.selectSumByAmountDescFiveToFive(DateUtil.offsetHour(new Date(),-24),3,1);
                 if(CollUtil.isNotEmpty(dappStorageFour)){
                     BigDecimal multiply = everyAmount.multiply(new BigDecimal(fourCount));
                     dappSystemService.updateBalanceInsertFlow(
@@ -256,7 +278,9 @@
          */
         HashMap<Long, BigDecimal> map = new HashMap<>();
 
-        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDate(new Date());
+        DateTime startTime = DateUtil.offsetHour(new Date(), -24);
+        List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDateFiveToFiver(startTime);
+
         if(CollUtil.isNotEmpty(dappMemberEntityList)){
             for(DappMemberEntity member : dappMemberEntityList){
                 if(StrUtil.isEmpty(member.getRefererId())){
@@ -337,8 +361,31 @@
     }
 
     public static void main(String[] args) {
+
+        Date date = new Date();
+        System.out.println(date);
+        DateTime dateTime1 = DateUtil.offsetHour(date, 24);
+        System.out.println(dateTime1);
+
+        int compare = DateUtil.compare(date, dateTime1);
+        System.out.println(compare);
+
+
+
         DateTime dateTime = DateUtil.offsetHour(new Date(), -24);
         System.out.println(dateTime);
+        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);
+
 
 
         // 创建一个HashMap示例

--
Gitblit v1.9.1