From 9a3d2383714287b9e9f6027a561aefed3ea2a1b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E9=B9=8F=E8=BE=89?= <18322780655@163.com> Date: Thu, 13 Jul 2023 16:40:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E4=BD=A3=E7=AE=97?= =?UTF-8?q?=E6=B3=95=E6=B7=BB=E5=8A=A0=E5=BC=82=E5=B8=B8=E8=B4=B9=E7=8E=87?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/MerchantProfitServiceImpl.java | 102 ++++++++++++------ .../notify/impl/NotifyMessageServiceImpl.java | 1 + 2 files changed, 72 insertions(+), 31 deletions(-) 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 4a11dfb..66a3a5c 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 @@ -68,11 +68,14 @@ public class MerchantProfitServiceImpl extends ServiceImpl= 0) { - profitRate = nowRate.subtract(new BigDecimal(userPromotion.getCurrentFee())); - nowRate = new BigDecimal(userPromotion.getCurrentFee()); + 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; + } + + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq("userId",userPromotion.getParentUserId()); + UserApp pUserApp=userAppMapper.selectOne(queryWrapper); + if(ObjectUtil.isEmpty(pUserApp)){ + log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size()); + return; + } + + BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(100)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN); + MerchantProfit profit = new MerchantProfit(nowUserApp, pUserApp, order, profitAmt, profitRate, "5", "1"); + profits.add(profit); + sendProfitMessage(pUserApp, profitAmt, order.getOrderNumber()); + createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee())); + + }else { + createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee())); + } }else { - return; - } + BigDecimal profitRate = BigDecimal.ZERO; - if(!"1".equals(userPromotion.getIsExtend())||!"2".equals(userPromotion.getIsExtend())){ + 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; + } + +// QueryWrapper queryWrapper=new QueryWrapper<>(); +// queryWrapper.eq("userId",userPromotion.getParentUserId()); +// UserApp pUserApp=userAppMapper.selectOne(queryWrapper); +// if(ObjectUtil.isEmpty(pUserApp)){ +// log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size()); +// return; +// } + + 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())); - } - UserApp nowUserApp = userAppMapper.selectByUserId(userId); - if(ObjectUtil.isEmpty(nowUserApp)){ - log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size()); - return; } - QueryWrapper queryWrapper=new QueryWrapper<>(); - queryWrapper.eq("userId",userPromotion.getParentUserId()); - UserApp pUserApp=userAppMapper.selectOne(queryWrapper); - if(ObjectUtil.isEmpty(pUserApp)){ - log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size()); - return; - } - - BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(10000)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN); - MerchantProfit profit = new MerchantProfit(nowUserApp, pUserApp, order, profitAmt, profitRate, "5", "1"); - profits.add(profit); - sendProfitMessage(pUserApp, profitAmt, order.getOrderNumber()); - createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee())); - } /** diff --git a/pluss-service-bundle/src/main/java/cn/pluss/platform/notify/impl/NotifyMessageServiceImpl.java b/pluss-service-bundle/src/main/java/cn/pluss/platform/notify/impl/NotifyMessageServiceImpl.java index 62d1900..40298c7 100644 --- a/pluss-service-bundle/src/main/java/cn/pluss/platform/notify/impl/NotifyMessageServiceImpl.java +++ b/pluss-service-bundle/src/main/java/cn/pluss/platform/notify/impl/NotifyMessageServiceImpl.java @@ -197,6 +197,7 @@ public class NotifyMessageServiceImpl implements NotifyMessageService { */ @Override public void sendPayMessage(MerchantOrder order, String type, JSONObject params, String mercId) { + logger.info(">>>>>>>>>>>>>>>>>>>>发送支付消息: {}",order.getMercNotifyUrl()); sendLowerPayNotifyCallback(order); String orderType = order.getOrderType(); int val = PayMessageType.PLAIN_PAY.getValue();