修改分佣算法添加异常费率判断处理
This commit is contained in:
parent
22179ce8de
commit
542a1079a0
|
|
@ -139,7 +139,18 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
createUserV3Profit(order,order.getUserId().toString(),profitList,order.getRate());
|
UserPromotion userPromotion= userPromotionMapper.selectByUserId(order.getUserId().toString());
|
||||||
|
if(ObjectUtil.isEmpty(userPromotion)){
|
||||||
|
log.error("订单号:{},用户信息不存在",order.getOrderNumber());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if("SO".equals(userPromotion.getTypeCode())||"FO".equals(userPromotion.getTypeCode())||"MG".equals(userPromotion.getTypeCode())){
|
||||||
|
log.error("此为系统用户不参与分润");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
createUserV3Profit(order,userPromotion.getParentUserId(),profitList,order.getRate().divide(BigDecimal.valueOf(100)));
|
||||||
|
|
||||||
if (!profitList.isEmpty()) {
|
if (!profitList.isEmpty()) {
|
||||||
log.info("【分润计算完成】开始批量插入分润数据,生成分润的订单编号:{},分润条数:{}", order.getOrderNumber(), profitList.size());
|
log.info("【分润计算完成】开始批量插入分润数据,生成分润的订单编号:{},分润条数:{}", order.getOrderNumber(), profitList.size());
|
||||||
|
|
@ -194,18 +205,10 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryWrapper<UserApp> 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);
|
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");
|
MerchantProfit profit = new MerchantProfit(nowUserApp, nowUserApp, order, profitAmt, profitRate, "5", "1");
|
||||||
profits.add(profit);
|
profits.add(profit);
|
||||||
sendProfitMessage(pUserApp, profitAmt, order.getOrderNumber());
|
sendProfitMessage(nowUserApp, profitAmt, order.getOrderNumber());
|
||||||
createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee()));
|
createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee()));
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
@ -229,16 +232,8 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryWrapper<UserApp> 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);
|
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");
|
MerchantProfit profit = new MerchantProfit(nowUserApp,nowUserApp , order, profitAmt, profitRate, "5", "1");
|
||||||
profits.add(profit);
|
profits.add(profit);
|
||||||
sendProfitMessage(nowUserApp, profitAmt, order.getOrderNumber());
|
sendProfitMessage(nowUserApp, profitAmt, order.getOrderNumber());
|
||||||
createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee()));
|
createUserV3Profit(order,userPromotion.getParentUserId(),profits,new BigDecimal(userPromotion.getCurrentFee()));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue