mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
mall: 优惠券退还优化
This commit is contained in:
parent
c25bf38f50
commit
11ad7ad5e4
@ -115,12 +115,14 @@ public class CouponServiceImpl implements CouponService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 退还
|
// 退还
|
||||||
// TODO @疯狂:最好 where status,避免可能存在的并发问题
|
|
||||||
Integer status = LocalDateTimeUtils.beforeNow(coupon.getValidEndTime())
|
Integer status = LocalDateTimeUtils.beforeNow(coupon.getValidEndTime())
|
||||||
// 退还时可能已经过期了
|
// 退还时可能已经过期了
|
||||||
? CouponStatusEnum.EXPIRE.getStatus()
|
? CouponStatusEnum.EXPIRE.getStatus()
|
||||||
: CouponStatusEnum.UNUSED.getStatus();
|
: CouponStatusEnum.UNUSED.getStatus();
|
||||||
couponMapper.updateById(new CouponDO().setId(id).setStatus(status));
|
int updateCount = couponMapper.updateByIdAndStatus(id, CouponStatusEnum.UNUSED.getStatus(), new CouponDO().setStatus(status));
|
||||||
|
if (updateCount == 0) {
|
||||||
|
throw exception(COUPON_STATUS_NOT_USED);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO 增加优惠券变动记录?
|
// TODO 增加优惠券变动记录?
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user