Commit 482a84a6f1059fa4726892c0fcbd249c73ba2d1d
1 parent
670f2ef5
603 mall: 优惠券退还优化
Showing
2 changed files
with
5 additions
and
4 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/vo/template/CouponTemplateBaseVO.java
| @@ -54,7 +54,7 @@ public class CouponTemplateBaseVO { | @@ -54,7 +54,7 @@ public class CouponTemplateBaseVO { | ||
| 54 | @InEnum(PromotionProductScopeEnum.class) | 54 | @InEnum(PromotionProductScopeEnum.class) |
| 55 | private Integer productScope; | 55 | private Integer productScope; |
| 56 | 56 | ||
| 57 | - @Schema(description = "商品范围编号的数组", example = "1,3") | 57 | + @Schema(description = "商品范围编号的数组", example = "[1, 3]") |
| 58 | private List<Long> productScopeValues; | 58 | private List<Long> productScopeValues; |
| 59 | 59 | ||
| 60 | @Schema(description = "生效日期类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 60 | @Schema(description = "生效日期类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java
| @@ -93,6 +93,7 @@ public class CouponServiceImpl implements CouponService { | @@ -93,6 +93,7 @@ public class CouponServiceImpl implements CouponService { | ||
| 93 | public void useCoupon(Long id, Long userId, Long orderId) { | 93 | public void useCoupon(Long id, Long userId, Long orderId) { |
| 94 | // 校验优惠劵 | 94 | // 校验优惠劵 |
| 95 | validCoupon(id, userId); | 95 | validCoupon(id, userId); |
| 96 | + | ||
| 96 | // 更新状态 | 97 | // 更新状态 |
| 97 | int updateCount = couponMapper.updateByIdAndStatus(id, CouponStatusEnum.UNUSED.getStatus(), | 98 | int updateCount = couponMapper.updateByIdAndStatus(id, CouponStatusEnum.UNUSED.getStatus(), |
| 98 | new CouponDO().setStatus(CouponStatusEnum.USED.getStatus()) | 99 | new CouponDO().setStatus(CouponStatusEnum.USED.getStatus()) |
| @@ -116,10 +117,10 @@ public class CouponServiceImpl implements CouponService { | @@ -116,10 +117,10 @@ public class CouponServiceImpl implements CouponService { | ||
| 116 | 117 | ||
| 117 | // 退还 | 118 | // 退还 |
| 118 | Integer status = LocalDateTimeUtils.beforeNow(coupon.getValidEndTime()) | 119 | Integer status = LocalDateTimeUtils.beforeNow(coupon.getValidEndTime()) |
| 119 | - // 退还时可能已经过期了 | ||
| 120 | - ? CouponStatusEnum.EXPIRE.getStatus() | 120 | + ? CouponStatusEnum.EXPIRE.getStatus() // 退还时可能已经过期了 |
| 121 | : CouponStatusEnum.UNUSED.getStatus(); | 121 | : CouponStatusEnum.UNUSED.getStatus(); |
| 122 | - int updateCount = couponMapper.updateByIdAndStatus(id, CouponStatusEnum.UNUSED.getStatus(), new CouponDO().setStatus(status)); | 122 | + int updateCount = couponMapper.updateByIdAndStatus(id, CouponStatusEnum.UNUSED.getStatus(), |
| 123 | + new CouponDO().setStatus(status)); | ||
| 123 | if (updateCount == 0) { | 124 | if (updateCount == 0) { |
| 124 | throw exception(COUPON_STATUS_NOT_USED); | 125 | throw exception(COUPON_STATUS_NOT_USED); |
| 125 | } | 126 | } |