From 0b10fd71ce7a6c32b70eef96f0ceb5a516306d6b Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 24 May 2021 15:05:01 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/modules/yunding/service/Impl/XchProfitServiceImpl.java | 55 +++++++++++++++++++++++++++++++++++--------------------
1 files changed, 35 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/yunding/service/Impl/XchProfitServiceImpl.java b/src/main/java/com/xcong/excoin/modules/yunding/service/Impl/XchProfitServiceImpl.java
index 3b8ef4d..ea55732 100644
--- a/src/main/java/com/xcong/excoin/modules/yunding/service/Impl/XchProfitServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/yunding/service/Impl/XchProfitServiceImpl.java
@@ -4,6 +4,7 @@
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
+import com.xcong.excoin.common.contants.AppContants;
import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao;
import com.xcong.excoin.modules.member.dao.MemberDao;
import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
@@ -18,6 +19,7 @@
import com.xcong.excoin.modules.yunding.entity.YdOrderEntity;
import com.xcong.excoin.modules.yunding.entity.YdProductEntity;
import com.xcong.excoin.modules.yunding.service.XchProfitService;
+import com.xcong.excoin.netty.common.Contans;
import com.xcong.excoin.rabbit.producer.YunDingProducter;
import com.xcong.excoin.utils.LogRecordUtils;
import lombok.extern.slf4j.Slf4j;
@@ -165,24 +167,25 @@
List<String> inviteIds = StrUtil.split(memberEntity.getRefererIds(), ',');
List<MemberEntity> agents = memberDao.selectYdParentAgent(inviteIds);
- if (CollUtil.isNotEmpty(agents)) {
- Map<Long, BigDecimal> returnRatio = buildReturnRatioObj(agents, 1);
+// if (CollUtil.isNotEmpty(agents)) {
+// Map<Long, BigDecimal> returnRatio = buildReturnRatioObj(agents, 1);
+//
+// for (Map.Entry<Long, BigDecimal> entry : returnRatio.entrySet()) {
+// String conent = "USDT返利";
+// BigDecimal amount = order.getAmount().multiply(entry.getValue());
+// LogRecordUtils.insertMemberAccountMoneyChangeWithId(entry.getKey(), conent, amount, "USDT", 1, 6, order.getId());
+// MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(entry.getKey(), "USDT");
+//
+// memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), amount, BigDecimal.ZERO, 0);
+// }
+//
+// YdOrderEntity updateOrder = new YdOrderEntity();
+// updateOrder.setReturnState(2);
+// updateOrder.setId(order.getId());
+// ydOrderDao.updateById(updateOrder);
+// }
- for (Map.Entry<Long, BigDecimal> entry : returnRatio.entrySet()) {
- String conent = "USDT返利";
- BigDecimal amount = order.getAmount().multiply(entry.getValue());
- LogRecordUtils.insertMemberAccountMoneyChangeWithId(entry.getKey(), conent, amount, "USDT", 1, 6, order.getId());
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(entry.getKey(), "USDT");
-
- memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), amount, BigDecimal.ZERO, 0);
- }
-
- YdOrderEntity updateOrder = new YdOrderEntity();
- updateOrder.setReturnState(2);
- updateOrder.setId(order.getId());
- ydOrderDao.updateById(updateOrder);
- }
-
+ // 合伙人分红
List<MemberEntity> partners = memberDao.selectPartnerMemberList();
YdBasicSettingEntity setting = ydBasicSettingDao.selectById(1L);
if (CollUtil.isNotEmpty(partners)) {
@@ -191,12 +194,24 @@
for (MemberEntity partner : partners) {
String conent = "合伙人USDT分红";
LogRecordUtils.insertMemberAccountMoneyChangeWithId(partner.getId(), conent, returnAmount, "USDT", 1, 9, order.getId());
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(partner.getId(), "USDT");
-
- memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), returnAmount, BigDecimal.ZERO, 0);
+// MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(partner.getId(), "USDT");
+// memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), returnAmount, BigDecimal.ZERO, 0);
}
}
+ if(!AppContants.SYSTEM_REFERER.equals(memberEntity.getRefererId())) {
+ // 直推返利
+ MemberEntity parentNode = memberDao.selectMemberInfoByInviteId(memberEntity.getRefererId());
+ if (parentNode != null) {
+ BigDecimal parentAmount = order.getAmount().multiply(setting.getParentRatio());
+
+ String conent = "直推USDT返利";
+ LogRecordUtils.insertMemberAccountMoneyChangeWithId(parentNode.getId(), conent, parentAmount, "USDT", 1, 10, order.getId());
+ MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(parentNode.getId(), "USDT");
+
+ memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), parentAmount, BigDecimal.ZERO, 0);
+ }
+ }
}
private Map<Long, BigDecimal> buildReturnRatioObj(List<MemberEntity> agents, int type) {
--
Gitblit v1.9.1