From 5772ee39bd00b83ecca16b0b472d86e945d8c0ea Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 01 Sep 2023 10:21:09 +0800
Subject: [PATCH] 后台修改

---
 src/main/java/cc/mrbird/febs/job/BnbTransferJob.java |  228 ++++++++++++--------------------------------------------
 1 files changed, 50 insertions(+), 178 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/job/BnbTransferJob.java b/src/main/java/cc/mrbird/febs/job/BnbTransferJob.java
index 9ca7b75..bdfa268 100644
--- a/src/main/java/cc/mrbird/febs/job/BnbTransferJob.java
+++ b/src/main/java/cc/mrbird/febs/job/BnbTransferJob.java
@@ -1,15 +1,10 @@
 package cc.mrbird.febs.job;
 
-import cc.mrbird.febs.dapp.entity.DappFundFlowEntity;
-import cc.mrbird.febs.dapp.entity.DataDictionaryCustom;
-import cc.mrbird.febs.dapp.enumerate.FundFlowEnum;
-import cc.mrbird.febs.dapp.enumerate.MemberLevelEnum;
-import cc.mrbird.febs.dapp.enumerate.NodeCodeEnum;
-import cc.mrbird.febs.dapp.enumerate.PoolEnum;
-import cc.mrbird.febs.dapp.mapper.DappFundFlowDao;
-import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
+import cc.mrbird.febs.dapp.entity.DappAKlineEntity;
+import cc.mrbird.febs.dapp.entity.DappMemberEntity;
+import cc.mrbird.febs.dapp.mapper.DappAKlineMapper;
 import cc.mrbird.febs.dapp.service.DappSystemService;
-import cc.mrbird.febs.rabbit.producer.ChainProducer;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,185 +13,62 @@
 import org.springframework.stereotype.Component;
 
 import java.math.BigDecimal;
+import java.util.Set;
 
 @Slf4j
 @Component
-@ConditionalOnProperty(prefix = "system", name = "quartz-job", havingValue = "true")
+@ConditionalOnProperty(prefix = "system", name = "online-transfer", havingValue = "true")
 public class BnbTransferJob{
-    /**
-     * 搜索还未发生转账操作,但是记录已经更新没有产生HASH值的流水记录,并发起转账操作
-     */
-    @Autowired
-    private DappFundFlowDao dappFundFlowDao;
-    @Autowired
-    private ChainProducer chainProducer;
-    @Autowired
-    private DataDictionaryCustomMapper dataDictionaryCustomMapper;
+
+
     @Autowired
     private DappSystemService dappSystemService;
+    @Autowired
+    private DappAKlineMapper dappAKlineMapper;
 
-    @Scheduled(cron = "0/30 * * * * ? ")
-    public void BnbTransferAgain() {
-        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectByStateAndVersionAndFromHashLimitOne(2,2);
-        if(ObjectUtil.isNotEmpty(dappFundFlowEntity)){
-            Integer isReturn = dappFundFlowEntity.getIsReturn();
-            if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == isReturn){
-                chainProducer.sendBnbTransferTestMsg(dappFundFlowEntity.getId());
-            }
+//    @Scheduled(cron = "0 0 0 * * ?")
+    @Scheduled(cron = "0 0 2 * * ?")
+    public void memberPerk() {
+        /**
+         * 加速团队静态收益的70%(业绩全算)
+         * 加速团队静态收益为极差制,平级10%
+         * 如V1加速团队静态收益的15%=每日静态的20000*6‰*15%=18元的额外释放加速
+         * 共享区加速万分之5,上限1.8%(按本金计)
+         */
+        dappSystemService.teamStaticPerk();
+        /**
+         * 每天按照消费金额的5‰静释放(千分之五的静态释放比例)
+         * (按购买顺序结算,同时有5个订单就有结算记录)
+         * (设置多少,全部按照最新的来释放)
+         */
+        dappSystemService.memberPerk();
+        /**
+         * 直推消费分享:享受直接分享人每日消费金额释放的100%加速;
+         */
+        dappSystemService.directMemberPerk();
+        /**
+         * 实际更新账户业绩余额和积分
+         */
+        Set<DappMemberEntity> dappMemberEntities = dappSystemService.updateAchieve();
+        if(CollUtil.isNotEmpty(dappMemberEntities)){
+            /**
+             * 奖励;团队产生的收益1%奖励积分,对标价格
+             */
+            dappSystemService.updatePackage(dappMemberEntities);
         }
     }
 
-//    @Scheduled(cron = "0/30 * * * * ? ")
-//    public void ABTransferAgain() {
-//        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectByStateAndVersionAndFromHashTwoLimitOne(1,2);
-//        if(ObjectUtil.isNotEmpty(dappFundFlowEntity)){
-//            Integer isReturn = dappFundFlowEntity.getIsReturn();
-//            if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == isReturn){
-//                chainProducer.sendAntKLineABMsg(dappFundFlowEntity.getId());
-//            }
-//        }
-//    }
-
-    /**
-     * 20%所有人平分的底池
-     */
-//    @Scheduled(cron = "0 0 1 * * ?")
-//    public void memberPool() {
-//        DataDictionaryCustom nodeThreePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-//                PoolEnum.POOL_ALL_MEMBER_A_CNT.getType(),
-//                PoolEnum.POOL_ALL_MEMBER_A_CNT.getCode()
-//        );
-//        BigDecimal nodeThreePoolDicCnt = new BigDecimal(nodeThreePoolDic.getValue());
-//        if(BigDecimal.ZERO.compareTo(nodeThreePoolDicCnt) >= 0){
-//            return;
-//        }
-//        BigDecimal nodeThreePoolDicCntReal = dappSystemService.nodePoolPerk(nodeThreePoolDicCnt, MemberLevelEnum.MEMBER.getType(), FundFlowEnum.POOL_MEMBER_A_CNT.getCode());
-//        BigDecimal nodeThreePoolDicCntAva = nodeThreePoolDicCnt.subtract(nodeThreePoolDicCntReal);
-//        nodeThreePoolDic.setValue(nodeThreePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeThreePoolDicCntAva.toString() : "0");
-//        dataDictionaryCustomMapper.updateById(nodeThreePoolDic);
-//    }
-    /**
-     * NODE_5_POOL
-     * NODE_4_POOL
-     * NODE_3_POOL
-     * 节点底池的每日分配
-     */
-//    @Scheduled(cron = "0 0 1 * * ?")
-//    public void NodeThreePool() {
-//        DataDictionaryCustom nodeThreePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-//                PoolEnum.NODE_3_POOL.getType(),
-//                PoolEnum.NODE_3_POOL.getCode()
-//        );
-//        BigDecimal nodeThreePoolDicCnt = new BigDecimal(nodeThreePoolDic.getValue());
-//        if(BigDecimal.ZERO.compareTo(nodeThreePoolDicCnt) >= 0){
-//            return;
-//        }
-//        BigDecimal nodeThreePoolDicCntReal = dappSystemService.nodePoolPerk(nodeThreePoolDicCnt, MemberLevelEnum.NODE_3.getType(), FundFlowEnum.DAO_3_NODE_PERK.getCode());
-//        BigDecimal nodeThreePoolDicCntAva = nodeThreePoolDicCnt.subtract(nodeThreePoolDicCntReal);
-//        nodeThreePoolDic.setValue(nodeThreePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeThreePoolDicCntAva.toString() : "0");
-//        dataDictionaryCustomMapper.updateById(nodeThreePoolDic);
-//    }
-
-    /**
-     * 节点四的每日分配
-     */
-    @Scheduled(cron = "0 0 1 * * ?")
-//    public void NodeFourFivePool() {
-//        DataDictionaryCustom nodeFourPoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-//                PoolEnum.NODE_4_POOL.getType(),
-//                PoolEnum.NODE_4_POOL.getCode()
-//        );
-//        BigDecimal nodeFourPoolDicCnt = new BigDecimal(nodeFourPoolDic.getValue());
-//        if(BigDecimal.ZERO.compareTo(nodeFourPoolDicCnt) >= 0){
-//            return;
-//        }
-//        BigDecimal nodeFourPoolDicCntReal = dappSystemService.nodePoolPerk(nodeFourPoolDicCnt, MemberLevelEnum.NODE_4.getType(), FundFlowEnum.DAO_4_NODE_PERK.getCode());
-//        BigDecimal nodeFourPoolDicCntAva = nodeFourPoolDicCnt.subtract(nodeFourPoolDicCntReal);
-//        nodeFourPoolDic.setValue(nodeFourPoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFourPoolDicCntAva.toString() : "0");
-//        dataDictionaryCustomMapper.updateById(nodeFourPoolDic);
-//    }
-
-    /**
-     * 节点五的每日分配
-     */
-    @Scheduled(cron = "0 0 1 * * ?")
-//    public void NodeFivePool() {
-//        DataDictionaryCustom nodeFivePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-//                PoolEnum.NODE_5_POOL.getType(),
-//                PoolEnum.NODE_5_POOL.getCode()
-//        );
-//        BigDecimal nodeFivePoolDicCnt = new BigDecimal(nodeFivePoolDic.getValue());
-//        if(BigDecimal.ZERO.compareTo(nodeFivePoolDicCnt) >= 0){
-//            return;
-//        }
-//        BigDecimal nodeFivePoolDicCntReal = dappSystemService.nodePoolPerk(nodeFivePoolDicCnt, MemberLevelEnum.NODE_5.getType(), FundFlowEnum.DAO_5_NODE_PERK.getCode());
-//        BigDecimal nodeFivePoolDicCntAva = nodeFivePoolDicCnt.subtract(nodeFivePoolDicCntReal);
-//        nodeFivePoolDic.setValue(nodeFivePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFivePoolDicCntAva.toString() : "0");
-//        dataDictionaryCustomMapper.updateById(nodeFivePoolDic);
-//    }
-
-    /**
-     * 节点五的平级奖励每日分配
-     */
-    @Scheduled(cron = "0 0 1 * * ?")
-//    public void NodeFiveEqualsPool() {
-//        DataDictionaryCustom nodeFivePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-//                PoolEnum.NODE_5_EQUALS_POOL.getType(),
-//                PoolEnum.NODE_5_EQUALS_POOL.getCode()
-//        );
-//        BigDecimal nodeFivePoolDicCnt = new BigDecimal(nodeFivePoolDic.getValue());
-//        if(BigDecimal.ZERO.compareTo(nodeFivePoolDicCnt) >= 0){
-//            return;
-//        }
-//        BigDecimal nodeFivePoolDicCntReal = dappSystemService.nodePoolEqualsPerk(nodeFivePoolDicCnt, MemberLevelEnum.NODE_5.getType(), FundFlowEnum.DAO_5_NODE_EQUALS_PERK.getCode());
-//        BigDecimal nodeFivePoolDicCntAva = nodeFivePoolDicCnt.subtract(nodeFivePoolDicCntReal);
-//        nodeFivePoolDic.setValue(nodeFivePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFivePoolDicCntAva.toString() : "0");
-//        dataDictionaryCustomMapper.updateById(nodeFivePoolDic);
-//    }
-
-    /**
-     * 超级节点奖励每日分配
-     */
-    @Scheduled(cron = "0 0 1 * * ?")
-//    public void NodeAPercentPool() {
-//        DataDictionaryCustom nodeFivePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-//                PoolEnum.NODE_A_PERCENT_POOL.getType(),
-//                PoolEnum.NODE_A_PERCENT_POOL.getCode()
-//        );
-//        BigDecimal nodeFivePoolDicCnt = new BigDecimal(nodeFivePoolDic.getValue());
-//        if(BigDecimal.ZERO.compareTo(nodeFivePoolDicCnt) >= 0){
-//            return;
-//        }
-//        /**
-//         * todo 超级节点的分红
-//         */
-//        BigDecimal nodeFivePoolDicCntReal = dappSystemService.superNodePoolPerk(nodeFivePoolDicCnt, NodeCodeEnum.SUPER_NODE.getCode(), FundFlowEnum.NODE_A_PERCENT_TO_MEMBER.getCode());
-//        BigDecimal nodeFivePoolDicCntAva = nodeFivePoolDicCnt.subtract(nodeFivePoolDicCntReal);
-//        nodeFivePoolDic.setValue(nodeFivePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFivePoolDicCntAva.toString() : "0");
-//        dataDictionaryCustomMapper.updateById(nodeFivePoolDic);
-//    }
-    @Scheduled(cron = "0 0 * * * ?")
-    public void aKlineJobHour() {
-        /**
-         * A币全网每小时自动燃烧0.1%,燃烧按递减燃烧,按个人每小时0.1%每小时递减。
-         *
-         * A币技术做到资产钱包燃烧,闪兑钱包也要燃烧0.1%每小时
-         */
-        dappSystemService.aCoinFire();
-        /**
-         * A币内网要做K线图,K线效果做到与交易所效果接近。
-         * 小时
-         */
-        dappSystemService.aKlineJobHour();
+    @Scheduled(cron = "0 0 0/4 * * ?")
+    public void klineUpdate() {
+        DappAKlineEntity dappAKlineEntity = new DappAKlineEntity();
+        dappAKlineEntity.setType(2);
+        DappAKlineEntity dappAKlineOld = dappAKlineMapper.selectOneHourByType();
+        if(ObjectUtil.isEmpty(dappAKlineOld)){
+            dappAKlineEntity.setOpenPrice(BigDecimal.ZERO);
+        }else{
+            dappAKlineEntity.setOpenPrice(dappAKlineOld.getOpenPrice());
+        }
+        dappAKlineMapper.insert(dappAKlineEntity);
     }
-    /**
-     * A币内网要做K线图,K线效果做到与交易所效果接近。
-     * 日
-     */
-    @Scheduled(cron = "0 0 0 * * ?")
-    public void aKlineJobDay() {
-        dappSystemService.aKlineJobDay();
-    }
-
 
 }

--
Gitblit v1.9.1