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();