奖励券不受 优惠券发放数量的限制 不扣除发放数量
This commit is contained in:
@@ -54,14 +54,14 @@ public class TbShopShareRecordServiceImpl extends ServiceImpl<TbShopShareRecordM
|
||||
TbShopShare shopShare = tbShopShareMapper.selectById(shareRecord.getShareId());
|
||||
TbShopUser tbShopUser = shopUserRepository.selectByUserIdAndShopId(userId.toString(), shopShare.getShopId().toString());
|
||||
if (userId.equals(shareRecord.getInvitedId())) {
|
||||
giveCoupon(shopShare, tbShopUser, shopShare.getRewardCoupons());
|
||||
giveCoupon(shopShare, tbShopUser, shopShare.getRewardCoupons(), true);
|
||||
} else if (userId.equals(shareRecord.getBeInvitedId())) {
|
||||
giveCoupon(shopShare, tbShopUser, shopShare.getNewCoupons());
|
||||
giveCoupon(shopShare, tbShopUser, shopShare.getNewCoupons(),true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void giveCoupon(TbShopShare shopShare, TbShopUser tbShopUser, List<TbShopShare.ShareCoupons> coupons) {
|
||||
public void giveCoupon(TbShopShare shopShare, TbShopUser tbShopUser, List<TbShopShare.ShareCoupons> coupons, boolean isReward) {
|
||||
for (TbShopShare.ShareCoupons newCoupon : coupons) {
|
||||
TbShopCoupon tbShopCoupon = couponMapper.selectById(newCoupon.getCouponId());
|
||||
Date start = new Date();
|
||||
@@ -91,7 +91,11 @@ public class TbShopShareRecordServiceImpl extends ServiceImpl<TbShopShareRecordM
|
||||
record.setSourceActId(shopShare.getId());
|
||||
record.setUseStartTime(start);
|
||||
record.setUseEndTime(end);
|
||||
record.setSource("invited");
|
||||
if(isReward){
|
||||
record.setSource("invited-reward");
|
||||
}else {
|
||||
record.setSource("invited");
|
||||
}
|
||||
actGiveRecords.add(record);
|
||||
} else if (tbShopCoupon.getType() == 2) {
|
||||
//商品卷
|
||||
@@ -109,11 +113,19 @@ public class TbShopShareRecordServiceImpl extends ServiceImpl<TbShopShareRecordM
|
||||
record.setSourceActId(shopShare.getId());
|
||||
record.setUseStartTime(start);
|
||||
record.setUseEndTime(end);
|
||||
record.setSource("invited");
|
||||
if(isReward){
|
||||
record.setSource("invited-reward");
|
||||
}else {
|
||||
record.setSource("invited");
|
||||
}
|
||||
actGiveRecords.add(record);
|
||||
}
|
||||
}
|
||||
inRecordMapper.insert(actGiveRecords);
|
||||
if(!isReward){
|
||||
tbShopCoupon.setLeftNumber(tbShopCoupon.getLeftNumber()-newCoupon.getCouponNum());
|
||||
couponMapper.updateById(tbShopCoupon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user