mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
!603 mall: 优惠券退还优化
Merge pull request !603 from 疯狂的世界/mall_order_cancel
This commit is contained in:
commit
670f2ef5da
@ -115,12 +115,14 @@ public class CouponServiceImpl implements CouponService {
|
||||
}
|
||||
|
||||
// 退还
|
||||
// TODO @疯狂:最好 where status,避免可能存在的并发问题
|
||||
Integer status = LocalDateTimeUtils.beforeNow(coupon.getValidEndTime())
|
||||
// 退还时可能已经过期了
|
||||
? CouponStatusEnum.EXPIRE.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 增加优惠券变动记录?
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user