From e72fa0716169831068f8fe781640129e4ed49d6d Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 18 May 2021 18:43:21 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/modules/yunding/service/Impl/XchProfitServiceImpl.java | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 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 1796454..3b8ef4d 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
@@ -10,9 +10,11 @@
import com.xcong.excoin.modules.member.entity.MemberEntity;
import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
import com.xcong.excoin.modules.yunding.dao.YdBasicLevelSettingDao;
+import com.xcong.excoin.modules.yunding.dao.YdBasicSettingDao;
import com.xcong.excoin.modules.yunding.dao.YdOrderDao;
import com.xcong.excoin.modules.yunding.dao.YdProductDao;
import com.xcong.excoin.modules.yunding.entity.YdBasicLevelSettingEntity;
+import com.xcong.excoin.modules.yunding.entity.YdBasicSettingEntity;
import com.xcong.excoin.modules.yunding.entity.YdOrderEntity;
import com.xcong.excoin.modules.yunding.entity.YdProductEntity;
import com.xcong.excoin.modules.yunding.service.XchProfitService;
@@ -47,6 +49,9 @@
@Autowired
private YunDingProducter yunDingProducter;
+
+ @Autowired
+ private YdBasicSettingDao ydBasicSettingDao;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -177,6 +182,21 @@
updateOrder.setId(order.getId());
ydOrderDao.updateById(updateOrder);
}
+
+ List<MemberEntity> partners = memberDao.selectPartnerMemberList();
+ YdBasicSettingEntity setting = ydBasicSettingDao.selectById(1L);
+ if (CollUtil.isNotEmpty(partners)) {
+ BigDecimal returnAmount = order.getAmount().multiply(setting.getPartnerRatio()).divide(BigDecimal.valueOf(partners.size()), 8, BigDecimal.ROUND_DOWN);
+ log.info("合伙人分红:{}", returnAmount);
+ 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);
+ }
+ }
+
}
private Map<Long, BigDecimal> buildReturnRatioObj(List<MemberEntity> agents, int type) {
@@ -263,7 +283,7 @@
}
}
- remainProfit = remainProfit.subtract(orderProfit.subtract(orderProfit.multiply(order.getYdProductEntity().getManageExpense())));
+ remainProfit = remainProfit.subtract(orderProfit.multiply(order.getYdProductEntity().getManageExpense()));
String content = "XCH收益";
LogRecordUtils.insertMemberAccountMoneyChangeWithId(order.getMemberId(), content, remainProfit, "XCH", 1, 4, order.getId());
MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(order.getMemberId(), "XCH");
--
Gitblit v1.9.1