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