From 8e0b1627b49e85c129c40ad1045116b73d2bcab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E9=B9=8F=E8=BE=89?= <18322780655@163.com> Date: Sat, 26 Aug 2023 15:46:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=AF=E6=8F=90=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserAppController.java | 2 +- .../impl/MerchantProfitServiceImpl.java | 73 ++++++++++++------- 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/pluss-api-page/src/main/java/cn/pluss/platform/controller/UserAppController.java b/pluss-api-page/src/main/java/cn/pluss/platform/controller/UserAppController.java index 323c79d..23b6b24 100644 --- a/pluss-api-page/src/main/java/cn/pluss/platform/controller/UserAppController.java +++ b/pluss-api-page/src/main/java/cn/pluss/platform/controller/UserAppController.java @@ -534,7 +534,7 @@ public class UserAppController { totalShareMoneyToday = userAccountFlowMapper.selectSumByUserId(userId, DateUtils.getDayBegin(), DateUtils.getDayEnd()); // 可提现分润 - allowCashMoney = userAccountByUserId.getBalance(); + allowCashMoney = userAccountByUserId.getBalance().subtract(userAccountByUserId.getFreezeBalance()); //审核中的提现金额 examineMoney = userAccountByUserId.getFreezeBalance(); diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchantProfit/impl/MerchantProfitServiceImpl.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchantProfit/impl/MerchantProfitServiceImpl.java index c68f945..a48e288 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/merchantProfit/impl/MerchantProfitServiceImpl.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/merchantProfit/impl/MerchantProfitServiceImpl.java @@ -337,33 +337,39 @@ public class MerchantProfitServiceImpl extends ServiceImpl= 0) { -// profitRate = nowRate.subtract(new BigDecimal(userPromotion.getCurrentFee())); -// nowRate = new BigDecimal(userPromotion.getCurrentFee()); -// }else { -// return; -// } -// -// UserApp nowUserApp = userAppMapper.selectByUserId(userId); -// if(ObjectUtil.isEmpty(nowUserApp)){ -// log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size()); -// return; -// } -// -// log.info("userId:{},rate:{},amount:{}",nowUserApp.getUserId(),profitRate,order.getConsumeFee()); -// BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(100)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN); -// MerchantProfit profit = new MerchantProfit(nowUserApp, nowUserApp, order, profitAmt, profitRate, "5", "1"); -// profits.add(profit); -// sendProfitMessage(nowUserApp, profitAmt, order.getOrderNumber()); -// createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee())); -// -// }else { -// createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee())); -// } +// createUserV3Profit(order,userPromotion.getParentUserId(),profits,accounts,accountFlows,new BigDecimal(userPromotion.getCurrentFee())); + if("1".equals(userPromotion.getIsExtend())){ + + userPromotion= getUserPromotion(Long.valueOf(userPromotion.getParentUserId())); + + BigDecimal profitRate = BigDecimal.ZERO; + + if (nowRate.compareTo(new BigDecimal(userPromotion.getCurrentFee())) >= 0) { + profitRate = nowRate.subtract(new BigDecimal(userPromotion.getCurrentFee())); + nowRate = new BigDecimal(userPromotion.getCurrentFee()); + }else { + return; + } + + UserApp nowUserApp = userAppMapper.selectByUserId(userId); + if(ObjectUtil.isEmpty(nowUserApp)){ + log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size()); + return; + } + + log.info("userId:{},rate:{},amount:{}",nowUserApp.getUserId(),profitRate,order.getConsumeFee()); + + + + BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(100)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN); + MerchantProfit profit = new MerchantProfit(nowUserApp, nowUserApp, order, profitAmt, profitRate, "5", "1"); + profits.add(profit); + sendProfitMessage(nowUserApp, profitAmt, order.getOrderNumber()); + createUserV3Profit(order,userPromotion.getParentUserId(),profits,accounts,accountFlows,new BigDecimal(userPromotion.getCurrentFee())); + + }else { + createUserV3Profit(order,userPromotion.getParentUserId(),profits,accounts,accountFlows,new BigDecimal(userPromotion.getCurrentFee())); + } }else { BigDecimal profitRate = BigDecimal.ZERO; @@ -402,11 +408,22 @@ public class MerchantProfitServiceImpl extends ServiceImpl