From 499a0c143b62381b780fb901e0b1a7d417fe8755 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 05 Dec 2022 15:56:56 +0800
Subject: [PATCH] 20221130

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java |   35 ++++++++++++++++++++---------------
 src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java           |    4 ++--
 src/main/java/cc/mrbird/febs/job/BnbTransferJob.java                      |    2 +-
 src/main/resources/application-prod.yml                                   |    2 +-
 src/main/java/cc/mrbird/febs/dapp/mapper/DappSystemProfitDao.java         |    2 ++
 src/main/resources/mapper/dapp/DappSystemProfitDao.xml                    |    7 +++++++
 6 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/mapper/DappSystemProfitDao.java b/src/main/java/cc/mrbird/febs/dapp/mapper/DappSystemProfitDao.java
index 41210ce..b38e066 100644
--- a/src/main/java/cc/mrbird/febs/dapp/mapper/DappSystemProfitDao.java
+++ b/src/main/java/cc/mrbird/febs/dapp/mapper/DappSystemProfitDao.java
@@ -31,4 +31,6 @@
     IPage<AdminSystemProfitFlowListVo> selectSystemProfitFlowListInPage(@Param("record")DappSystemProfit dappSystemProfit, Page<AdminSystemProfitFlowListVo> page);
 
     List<DappSystemProfit> selectDappSysstemProfitByState(@Param("state")int stateIn);
+
+    DappSystemProfit selectByMemberId(@Param("memberId")Long memberId);
 }
diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
index 65ec96e..924b777 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -463,21 +463,21 @@
             return;
         }
         Integer count = dappFundFlowDao.updateStatusById(DappFundFlowEntity.WITHDRAW_STATUS_AGREE,dappFundFlowEntity.getId());
-        if(count > 0){
-            DappFundFlowEntity dappFundFlow = dappFundFlowDao.selectById(id);
-            //金额
-            BigDecimal amount = dappFundFlow.getAmount();
-            //目标地址
-            String address = dappFundFlow.getAddress();
-    //        String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(address, amount);
-            String hash = ChainService.getInstance(ChainEnum.BNB.name()).transferBaseToken(address, amount);
-            if(StrUtil.isEmpty(hash)){
-                return;
-            }
-            log.info("{},{}",id,hash);
-            dappFundFlow.setFromHash(hash);
-            dappFundFlowDao.updateById(dappFundFlow);
-        }
+//        if(count > 0){
+//            DappFundFlowEntity dappFundFlow = dappFundFlowDao.selectById(id);
+//            //金额
+//            BigDecimal amount = dappFundFlow.getAmount();
+//            //目标地址
+//            String address = dappFundFlow.getAddress();
+//    //        String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(address, amount);
+//            String hash = ChainService.getInstance(ChainEnum.BNB.name()).transferBaseToken(address, amount);
+//            if(StrUtil.isEmpty(hash)){
+//                return;
+//            }
+//            log.info("{},{}",id,hash);
+//            dappFundFlow.setFromHash(hash);
+//            dappFundFlowDao.updateById(dappFundFlow);
+//        }
     }
 
     @Override
@@ -512,6 +512,11 @@
     @Override
     public void bnbTransferTest(Long id) {
         DappFundFlowEntity dappFundFlow = dappFundFlowDao.selectById(id);
+        //用户已经加入动能队列
+        DappSystemProfit dappSystemProfit = dappSystemProfitDao.selectById(dappFundFlow.getSystemProfitId()==null ? 0L : dappFundFlow.getSystemProfitId());
+        if(ObjectUtil.isEmpty(dappSystemProfit)){
+            return;
+        }
         if(ObjectUtil.isEmpty(dappFundFlow)){
             return;
         }
diff --git a/src/main/java/cc/mrbird/febs/job/BnbTransferJob.java b/src/main/java/cc/mrbird/febs/job/BnbTransferJob.java
index 1831ccb..5c75555 100644
--- a/src/main/java/cc/mrbird/febs/job/BnbTransferJob.java
+++ b/src/main/java/cc/mrbird/febs/job/BnbTransferJob.java
@@ -21,7 +21,7 @@
     @Autowired
     private ChainProducer chainProducer;
 
-    @Scheduled(cron = "0/3 * * * * ? ")
+    @Scheduled(cron = "0/5 * * * * ? ")
     public void BnbTransferAgain() {
         DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectByStateAndVersionAndFromHashLimitOne(2,2);
         if(ObjectUtil.isNotEmpty(dappFundFlowEntity)){
diff --git a/src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java b/src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java
index 18eac11..cb62c56 100644
--- a/src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java
+++ b/src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java
@@ -69,7 +69,7 @@
      */
     @RabbitListener(queues = QueueConstants.QUEUE_BNB_TRANSFER)
     public void bnbTransfer(Long id) {
-        log.info("消费转账拨币:{}", id);
+        log.info("消费转账拨币第一步:{}", id);
         dappSystemService.bnbTransfer(id);
     }
 
@@ -78,7 +78,7 @@
      */
     @RabbitListener(queues = QueueConstants.QUEUE_BNB_TRANSFER_TEST)
     public void bnbTransferTest(Long id) {
-        log.info("消费转账拨币:{}", id);
+        log.info("消费转账拨币第二步:{}", id);
         dappSystemService.bnbTransferTest(id);
     }
 
diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml
index adc517a..c33a05f 100644
--- a/src/main/resources/application-prod.yml
+++ b/src/main/resources/application-prod.yml
@@ -2,7 +2,7 @@
   datasource:
     dynamic:
       # 是否开启 SQL日志输出,生产环境建议关闭,有性能损耗
-      p6spy: true
+      p6spy: false
       hikari:
         connection-timeout: 30000
         max-lifetime: 1800000
diff --git a/src/main/resources/mapper/dapp/DappSystemProfitDao.xml b/src/main/resources/mapper/dapp/DappSystemProfitDao.xml
index 877e8b6..159c01e 100644
--- a/src/main/resources/mapper/dapp/DappSystemProfitDao.xml
+++ b/src/main/resources/mapper/dapp/DappSystemProfitDao.xml
@@ -103,4 +103,11 @@
         order by a.id asc
     </select>
 
+    <select id="selectByMemberId" resultType="cc.mrbird.febs.dapp.entity.DappSystemProfit">
+        select a.*
+        from dapp_system_profit a
+        where member_id = #{memberId}
+            limit 1
+    </select>
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1