Merge remote-tracking branch 'origin/master'

This commit is contained in:
liuyingfang
2023-08-26 17:31:17 +08:00

View File

@@ -351,33 +351,39 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
// } // }
if("MC".equals(userPromotion.getTypeCode())){ if("MC".equals(userPromotion.getTypeCode())){
createUserV3Profit(order,userPromotion.getParentUserId(),profits,accounts,accountFlows,new BigDecimal(userPromotion.getCurrentFee())); // createUserV3Profit(order,userPromotion.getParentUserId(),profits,accounts,accountFlows,new BigDecimal(userPromotion.getCurrentFee()));
// if("1".equals(userPromotion.getIsExtend())||"2".equals(userPromotion.getIsExtend())){ if("1".equals(userPromotion.getIsExtend())){
// BigDecimal profitRate = BigDecimal.ZERO;
// userPromotion= getUserPromotion(Long.valueOf(userPromotion.getParentUserId()));
// if (nowRate.compareTo(new BigDecimal(userPromotion.getCurrentFee())) >= 0) {
// profitRate = nowRate.subtract(new BigDecimal(userPromotion.getCurrentFee())); BigDecimal profitRate = BigDecimal.ZERO;
// nowRate = new BigDecimal(userPromotion.getCurrentFee());
// }else { if (nowRate.compareTo(new BigDecimal(userPromotion.getCurrentFee())) >= 0) {
// return; profitRate = nowRate.subtract(new BigDecimal(userPromotion.getCurrentFee()));
// } nowRate = new BigDecimal(userPromotion.getCurrentFee());
// }else {
// UserApp nowUserApp = userAppMapper.selectByUserId(userId); return;
// if(ObjectUtil.isEmpty(nowUserApp)){ }
// log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size());
// return; UserApp nowUserApp = userAppMapper.selectByUserId(userId);
// } if(ObjectUtil.isEmpty(nowUserApp)){
// log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size());
// log.info("userId:{},rate:{},amount:{}",nowUserApp.getUserId(),profitRate,order.getConsumeFee()); 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); log.info("userId:{},rate:{},amount:{}",nowUserApp.getUserId(),profitRate,order.getConsumeFee());
// sendProfitMessage(nowUserApp, profitAmt, order.getOrderNumber());
// createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee()));
//
// }else { BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(100)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN);
// createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee())); 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 { }else {
BigDecimal profitRate = BigDecimal.ZERO; BigDecimal profitRate = BigDecimal.ZERO;
@@ -416,11 +422,22 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
sendProfitMessage(nowUserApp, profitAmt, order.getOrderNumber()); sendProfitMessage(nowUserApp, profitAmt, order.getOrderNumber());
createUserV3Profit(order,userPromotion.getParentUserId(),profits,accounts,accountFlows,new BigDecimal(userPromotion.getCurrentFee())); createUserV3Profit(order,userPromotion.getParentUserId(),profits,accounts,accountFlows,new BigDecimal(userPromotion.getCurrentFee()));
} }
} }
private UserPromotion getUserPromotion(Long userId){
UserPromotion userPromotion= userPromotionMapper.selectByPrimaryKey(userId);
if(ObjectUtil.isNotEmpty(userPromotion)&&"MC".equals(userPromotion.getTypeCode())){
getUserPromotion(Long.valueOf(userPromotion.getParentUserId()));
}
return userPromotion;
}
/** /**
* 创建2.0分润 * 创建2.0分润
* *