优惠券使用记录
This commit is contained in:
parent
d1c78ebfa0
commit
050b369aa5
|
|
@ -213,6 +213,7 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
|
|||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
ShopCoupon newCoupon = new ShopCoupon();
|
||||
newCoupon.setLeftNum(coupon.getLeftNum());
|
||||
newCoupon.setGiftNum(coupon.getGiftNum());
|
||||
if (coupon.getSyncId() != null) {
|
||||
queryWrapper.and(q -> {
|
||||
q.eq(ShopCoupon::getId, coupon.getSyncId()).or(q1 -> {
|
||||
|
|
|
|||
|
|
@ -392,9 +392,23 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||
ShopCoupon tbShopCoupon = getById(couponId);
|
||||
tbShopCoupon.setUseNum(tbShopCoupon.getUseNum() + count.intValue());
|
||||
ShopCoupon coupon1 = new ShopCoupon();
|
||||
coupon1.setId(couponId);
|
||||
coupon1.setUseNum(tbShopCoupon.getUseNum());
|
||||
updateById(coupon1);
|
||||
|
||||
QueryWrapper recordQueryWrapper = new QueryWrapper();
|
||||
if (tbShopCoupon.getSyncId() != null) {
|
||||
recordQueryWrapper.and(q -> {
|
||||
q.eq(ShopCoupon::getId, tbShopCoupon.getId()).or(q1 -> {
|
||||
q1.eq(ShopCoupon::getSyncId, tbShopCoupon.getSyncId());
|
||||
});
|
||||
});
|
||||
} else {
|
||||
recordQueryWrapper.and(q -> {
|
||||
q.eq(ShopCoupon::getId, tbShopCoupon.getId()).or(q1 -> {
|
||||
q1.eq(ShopCoupon::getSyncId, tbShopCoupon.getId());
|
||||
});
|
||||
});
|
||||
}
|
||||
update(coupon1, recordQueryWrapper);
|
||||
});
|
||||
return recordService.updateChain()
|
||||
.set(MkShopCouponRecord::getStatus, 1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue