You've already forked FrameTour-BE
- 新增 CouponClaimRequest 和 CouponClaimResult 类用于处理优惠券领取请求和结果 - 在 ICouponService 接口中添加 claimCoupon 方法 - 在 CouponServiceImpl 中实现 claimCoupon 方法,包括参数验证、优惠券查询、库存检查、记录创建等步骤 - 优化日志记录和异常处理
51 lines
1.1 KiB
Java
51 lines
1.1 KiB
Java
package com.ycwl.basic.pricing.dto;
|
|
|
|
import lombok.Data;
|
|
|
|
/**
|
|
* 优惠券领取请求DTO
|
|
*/
|
|
@Data
|
|
public class CouponClaimRequest {
|
|
|
|
/**
|
|
* 用户ID
|
|
*/
|
|
private Long userId;
|
|
|
|
/**
|
|
* 优惠券ID
|
|
*/
|
|
private Long couponId;
|
|
|
|
/**
|
|
* 景区ID(可选,记录在哪个景区领取)
|
|
*/
|
|
private String scenicId;
|
|
|
|
/**
|
|
* 领取来源(可选,如:活动页面、签到奖励等)
|
|
*/
|
|
private String claimSource;
|
|
|
|
public CouponClaimRequest() {
|
|
}
|
|
|
|
public CouponClaimRequest(Long userId, Long couponId) {
|
|
this.userId = userId;
|
|
this.couponId = couponId;
|
|
}
|
|
|
|
public CouponClaimRequest(Long userId, Long couponId, String scenicId) {
|
|
this.userId = userId;
|
|
this.couponId = couponId;
|
|
this.scenicId = scenicId;
|
|
}
|
|
|
|
public CouponClaimRequest(Long userId, Long couponId, String scenicId, String claimSource) {
|
|
this.userId = userId;
|
|
this.couponId = couponId;
|
|
this.scenicId = scenicId;
|
|
this.claimSource = claimSource;
|
|
}
|
|
} |