package com.ycwl.basic.pricing.dto; import com.ycwl.basic.pricing.enums.ProductType; import com.ycwl.basic.pricing.enums.VoucherDiscountType; import lombok.Data; import java.math.BigDecimal; import java.util.Date; import java.util.List; /** * 券码信息DTO */ @Data public class VoucherInfo { /** * 券码ID */ private Long voucherId; /** * 券码 */ private String voucherCode; /** * 批次ID */ private Long batchId; /** * 批次名称 */ private String batchName; /** * 景区ID */ private Long scenicId; /** * 推客ID */ private Long brokerId; /** * 优惠类型 */ private VoucherDiscountType discountType; /** * 优惠值 */ private BigDecimal discountValue; /** * 实际优惠金额 */ private BigDecimal actualDiscountAmount; /** * 状态 */ private Integer status; /** * 领取时间 */ private Date claimedTime; /** * 使用时间 */ private Date usedTime; /** * 是否可用 */ private Boolean available; /** * 不可用原因 */ private String unavailableReason; /** * 适用商品类型列表 * null表示适用所有商品类型 */ private List applicableProducts; /** * 当前使用次数 */ private Integer currentUseCount; /** * 最大使用次数 */ private Integer maxUseCount; /** * 每个用户最大使用次数 */ private Integer maxUsePerUser; /** * 使用间隔小时数 */ private Integer useIntervalHours; /** * 剩余可使用次数 */ private Integer remainingUseCount; /** * 是否还能使用 */ private Boolean canUseMore; /** * 最后使用时间 */ private Date lastUsedTime; /** * 有效期开始时间 */ private Date validStartTime; /** * 有效期结束时间 */ private Date validEndTime; /** * 检查指定时间是否在有效期内 * @param checkTime 待检查的时间 * @return true-在有效期内,false-不在有效期内 */ public boolean isWithinValidTimeRange(Date checkTime) { if (checkTime == null) { return false; } // 检查开始时间 if (validStartTime != null && checkTime.before(validStartTime)) { return false; } // 检查结束时间 if (validEndTime != null && checkTime.after(validEndTime)) { return false; } return true; } /** * 检查当前时间是否在有效期内 * @return true-在有效期内,false-不在有效期内 */ public boolean isWithinValidTimeRange() { return isWithinValidTimeRange(new Date()); } }