|
@@ -608,11 +608,14 @@ public class UserTicketOrderServiceImpl extends
|
|
|
// 线下购票,优先给当前票的经销商渠道分润
|
|
|
TicketBox ticketBox = ticketBoxService.getById(channelCommParam.getBoxId());
|
|
|
|
|
|
+ // 推广员的分佣
|
|
|
+ int promoterCommAmt = 0;
|
|
|
// 如果有推广员则先给推广员分佣
|
|
|
if (channelCommParam.getPromoterId() != null && channelCommParam.getPromoterId() > 0) {
|
|
|
Channel promoter = channelService.getById(channelCommParam.getPromoterId());
|
|
|
if (promoter != null) {
|
|
|
- ChannelCommission siteCommission = saveSiteCommAmt(channelCommParam, ticketBox, promoter);
|
|
|
+ ChannelCommission siteCommission = saveSiteCommAmt(channelCommParam, ticketBox, promoter, promoterCommAmt);
|
|
|
+ promoterCommAmt = siteCommission.getCommAmt();
|
|
|
// 推广员账户余额增加
|
|
|
changeMoney(promoter, siteCommission);
|
|
|
}
|
|
@@ -621,7 +624,7 @@ public class UserTicketOrderServiceImpl extends
|
|
|
// 给门店分佣
|
|
|
Channel channel = channelService.getById(channelCommParam.getChannelId());
|
|
|
|
|
|
- ChannelCommission siteCommission = saveSiteCommAmt(channelCommParam, ticketBox, channel);
|
|
|
+ ChannelCommission siteCommission = saveSiteCommAmt(channelCommParam, ticketBox, channel, promoterCommAmt);
|
|
|
// 经销商账户余额增加
|
|
|
changeMoney(channel, siteCommission);
|
|
|
|
|
@@ -670,7 +673,7 @@ public class UserTicketOrderServiceImpl extends
|
|
|
}
|
|
|
|
|
|
private ChannelCommission saveSiteCommAmt(ChannelCommParam channelCommParam, TicketBox ticketBox,
|
|
|
- Channel channel) {
|
|
|
+ Channel channel, int sumCommAmt) {
|
|
|
ChannelCommission siteCommission = new ChannelCommission();
|
|
|
siteCommission.setChannelId(channel.getChannelId());
|
|
|
siteCommission.setOrderId(channelCommParam.getOrderId());
|
|
@@ -682,7 +685,7 @@ public class UserTicketOrderServiceImpl extends
|
|
|
.intValue());
|
|
|
siteCommission.setCommRate(channel.getCommRate());
|
|
|
siteCommission.setCommAmt(new BigDecimal(siteCommission.getSaleCommAmt()).multiply(
|
|
|
- siteCommission.getCommRate()).divide(new BigDecimal(100), 0, RoundingMode.DOWN).intValue());
|
|
|
+ siteCommission.getCommRate()).divide(new BigDecimal(100), 0, RoundingMode.DOWN).intValue() - sumCommAmt);
|
|
|
channelCommissionService.save(siteCommission);
|
|
|
return siteCommission;
|
|
|
}
|