Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -351,33 +351,39 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||
// }
|
||||
|
||||
if("MC".equals(userPromotion.getTypeCode())){
|
||||
createUserV3Profit(order,userPromotion.getParentUserId(),profits,accounts,accountFlows,new BigDecimal(userPromotion.getCurrentFee()));
|
||||
// if("1".equals(userPromotion.getIsExtend())||"2".equals(userPromotion.getIsExtend())){
|
||||
// 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,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;
|
||||
|
||||
@@ -416,11 +422,22 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||
|
||||
sendProfitMessage(nowUserApp, profitAmt, order.getOrderNumber());
|
||||
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分润
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user