mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 07:11:52 +08:00
603 mall: 优惠券退还优化
This commit is contained in:
parent
670f2ef5da
commit
482a84a6f1
@ -54,7 +54,7 @@ public class CouponTemplateBaseVO {
|
||||
@InEnum(PromotionProductScopeEnum.class)
|
||||
private Integer productScope;
|
||||
|
||||
@Schema(description = "商品范围编号的数组", example = "1,3")
|
||||
@Schema(description = "商品范围编号的数组", example = "[1, 3]")
|
||||
private List<Long> productScopeValues;
|
||||
|
||||
@Schema(description = "生效日期类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
|
@ -93,6 +93,7 @@ public class CouponServiceImpl implements CouponService {
|
||||
public void useCoupon(Long id, Long userId, Long orderId) {
|
||||
// 校验优惠劵
|
||||
validCoupon(id, userId);
|
||||
|
||||
// 更新状态
|
||||
int updateCount = couponMapper.updateByIdAndStatus(id, CouponStatusEnum.UNUSED.getStatus(),
|
||||
new CouponDO().setStatus(CouponStatusEnum.USED.getStatus())
|
||||
@ -116,10 +117,10 @@ public class CouponServiceImpl implements CouponService {
|
||||
|
||||
// 退还
|
||||
Integer status = LocalDateTimeUtils.beforeNow(coupon.getValidEndTime())
|
||||
// 退还时可能已经过期了
|
||||
? CouponStatusEnum.EXPIRE.getStatus()
|
||||
? CouponStatusEnum.EXPIRE.getStatus() // 退还时可能已经过期了
|
||||
: CouponStatusEnum.UNUSED.getStatus();
|
||||
int updateCount = couponMapper.updateByIdAndStatus(id, CouponStatusEnum.UNUSED.getStatus(), new CouponDO().setStatus(status));
|
||||
int updateCount = couponMapper.updateByIdAndStatus(id, CouponStatusEnum.UNUSED.getStatus(),
|
||||
new CouponDO().setStatus(status));
|
||||
if (updateCount == 0) {
|
||||
throw exception(COUPON_STATUS_NOT_USED);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user