From 9219e18a9b2fb06b95b5c881b057d3fde7270ca3 Mon Sep 17 00:00:00 2001
From: zainali5120 <512061637@qq.com>
Date: Thu, 25 Feb 2021 10:28:54 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/whole_new' into whole_new

---
 src/test/java/com/xcong/excoin/ReturnMoneyTest.java |  181 +++++++++++++++++++++++---------------------
 1 files changed, 95 insertions(+), 86 deletions(-)

diff --git a/src/test/java/com/xcong/excoin/ReturnMoneyTest.java b/src/test/java/com/xcong/excoin/ReturnMoneyTest.java
index eb40f55..90f687d 100644
--- a/src/test/java/com/xcong/excoin/ReturnMoneyTest.java
+++ b/src/test/java/com/xcong/excoin/ReturnMoneyTest.java
@@ -1,86 +1,95 @@
-package com.xcong.excoin;
-
-import cn.hutool.core.collection.CollUtil;
-import jnr.ffi.annotations.IgnoreError;
-
-import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao;
-import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
-import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.service.impl.OrderWebsocketServiceImpl;
-import com.xcong.excoin.modules.member.dao.AgentReturnDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletAgentDao;
-import com.xcong.excoin.modules.member.entity.AgentReturnEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletAgentEntity;
-import com.xcong.excoin.utils.SpringContextHolder;
-import com.xcong.excoin.utils.ThreadPoolUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-06-30
- **/
-@Slf4j
-@SpringBootTest
-public class ReturnMoneyTest {
-
-    @Resource
-    private ContractOrderDao contractOrderDao;
-    @Resource
-    private AgentReturnDao agentReturnDao;
-    @Resource
-    private MemberWalletAgentDao memberWalletAgentDao;
-    @Resource
-    private MemberAccountMoneyChangeDao memberAccountMoneyChangeDao;
-
-    /*@Test
-    public void returnTest() {
-        ContractOrderEntity entity = contractOrderDao.selectById(667L);
-        OrderWebsocketServiceImpl orderWebsocketService = SpringContextHolder.getBean(OrderWebsocketServiceImpl.class);
-        orderWebsocketService.calYj(19L, new BigDecimal(4.18004236), entity, AgentReturnEntity.ORDER_TYPE_OPEN);
-    }*/
-
-
-    @Test
-    public void moneyReturnTest() {
-        List<AgentReturnEntity> list = agentReturnDao.selectAllNeedMoneyReturn();
-        log.info("返佣条数:{}", list.size());
-        if (CollUtil.isNotEmpty(list)) {
-            for (AgentReturnEntity agentReturn : list) {
-                BigDecimal needReturn = agentReturn.getReturnAmount();
-                Long refererId = agentReturn.getRefererId();
-                MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(refererId, "USDT");
-                if (walletAgent == null) {
-                    continue;
-                }
-
-                log.info("用户ID:{}, 当前余额:{},总金额:{}, 返佣金额:{}", refererId, walletAgent.getAvailableBalance().toPlainString(), walletAgent.getTotalBalance().toPlainString(), needReturn);
-                walletAgent.setAvailableBalance(walletAgent.getAvailableBalance().add(needReturn));
-                walletAgent.setTotalBalance(walletAgent.getTotalBalance().add(needReturn));
-
-
-                MemberAccountMoneyChange moneyChange = new MemberAccountMoneyChange();
-                moneyChange.setAmount(needReturn);
-                moneyChange.setContent("佣金到账");
-                moneyChange.setType(MemberAccountMoneyChange.TYPE_WALLET_AGENT);
-                moneyChange.setStatus(MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER);
-                moneyChange.setMemberId(refererId);
-                moneyChange.setSymbol("USDT");
-
-//                // 更新代理钱包金额
-                memberWalletAgentDao.updateById(walletAgent);
-//                // 更新返佣明细中状态
-                agentReturnDao.updateAgentReturnStatusByRefererId(AgentReturnEntity.IS_RETURN_Y, refererId);
-//                // 插入财务流水记录
-                memberAccountMoneyChangeDao.insert(moneyChange);
-            }
-        }
-    }
-}
+package com.xcong.excoin;
+
+import cn.hutool.core.collection.CollUtil;
+import jnr.ffi.annotations.IgnoreError;
+
+import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao;
+import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
+import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
+import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
+import com.xcong.excoin.modules.contract.service.impl.OrderWebsocketServiceImpl;
+import com.xcong.excoin.modules.member.dao.AgentReturnDao;
+import com.xcong.excoin.modules.member.dao.MemberWalletAgentDao;
+import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
+import com.xcong.excoin.modules.member.entity.AgentReturnEntity;
+import com.xcong.excoin.modules.member.entity.MemberWalletAgentEntity;
+import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
+import com.xcong.excoin.utils.SpringContextHolder;
+import com.xcong.excoin.utils.ThreadPoolUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author wzy
+ * @date 2020-06-30
+ **/
+@Slf4j
+@SpringBootTest
+public class ReturnMoneyTest {
+
+    @Resource
+    private ContractOrderDao contractOrderDao;
+    @Resource
+    private AgentReturnDao agentReturnDao;
+    @Resource
+    private MemberWalletAgentDao memberWalletAgentDao;
+    @Resource
+    private MemberAccountMoneyChangeDao memberAccountMoneyChangeDao;
+    @Resource
+    private MemberWalletCoinDao memberWalletCoinDao;
+
+    /*@Test
+    public void returnTest() {
+        ContractOrderEntity entity = contractOrderDao.selectById(667L);
+        OrderWebsocketServiceImpl orderWebsocketService = SpringContextHolder.getBean(OrderWebsocketServiceImpl.class);
+        orderWebsocketService.calYj(19L, new BigDecimal(4.18004236), entity, AgentReturnEntity.ORDER_TYPE_OPEN);
+    }*/
+
+
+    @Test
+    public void moneyReturnTest() {
+        List<AgentReturnEntity> list = agentReturnDao.selectAllNeedMoneyReturn();
+        log.info("返佣条数:{}", list.size());
+        if (CollUtil.isNotEmpty(list)) {
+            for (AgentReturnEntity agentReturn : list) {
+                BigDecimal needReturn = agentReturn.getReturnAmount();
+                Long refererId = agentReturn.getRefererId();
+                //查询币币钱包
+                MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(refererId, "USDT");
+//                MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(refererId, "USDT");
+//                if (walletAgent == null) {
+//                    continue;
+//                }
+                if (memberWalletCoinEntity == null) {
+                	continue;
+                }
+
+                log.info("用户ID:{}, 当前余额:{},总金额:{}, 返佣金额:{}", refererId, memberWalletCoinEntity.getAvailableBalance().toPlainString(), memberWalletCoinEntity.getTotalBalance().toPlainString(), needReturn);
+                memberWalletCoinEntity.setAvailableBalance(memberWalletCoinEntity.getAvailableBalance().add(needReturn));
+                memberWalletCoinEntity.setTotalBalance(memberWalletCoinEntity.getTotalBalance().add(needReturn));
+
+
+                MemberAccountMoneyChange moneyChange = new MemberAccountMoneyChange();
+                moneyChange.setAmount(needReturn);
+                moneyChange.setContent("佣金到账");
+                moneyChange.setType(MemberAccountMoneyChange.TYPE_WALLET_AGENT);
+                moneyChange.setStatus(MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER);
+                moneyChange.setMemberId(refererId);
+                moneyChange.setSymbol("USDT");
+
+//                // 更新代理钱包金额
+                memberWalletCoinDao.updateById(memberWalletCoinEntity);
+//                // 更新返佣明细中状态
+                agentReturnDao.updateAgentReturnStatusByRefererId(AgentReturnEntity.IS_RETURN_Y, refererId);
+//                // 插入财务流水记录
+                memberAccountMoneyChangeDao.insert(moneyChange);
+            }
+        }
+    }
+}

--
Gitblit v1.9.1