| | |
| | | package com.ruoyi.member.domain.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.system.api.domain.dto.MgtBaseDto; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Range; |
| | | |
| | | import javax.validation.constraints.AssertTrue; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | @ApiModelProperty(value = "优惠券id 新增不传") |
| | | private String couponId; |
| | | |
| | | @ApiModelProperty("优惠券类型1.满减2.折扣3.代金4.商品") |
| | | @ApiModelProperty(value="优惠券类型1.满减2.折扣3.代金4.商品5.抽奖领取") |
| | | @NotNull(message = "优惠券类型不能为空") |
| | | private Integer couponType; |
| | | |
| | | @ApiModelProperty("优惠券名称") |
| | | @ApiModelProperty(value="优惠券名称") |
| | | @NotNull(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | @ApiModelProperty(value = "发送类型1.手动领取2.全部用户3.会员用户4非会员用户5自定义") |
| | | @ApiModelProperty(value = "发送类型1.手动领取2.指定发放") |
| | | @NotNull(message = "发送类型不能为空") |
| | | private Integer sendType; |
| | | |
| | | @ApiModelProperty("发送时间类型1立即2定时") |
| | | @ApiModelProperty(value = "发送对象2.全部用户3.会员用户4非会员用户5自定义") |
| | | @NotNull(message = "发送对象不能为空") |
| | | private Integer sendTarget; |
| | | |
| | | @ApiModelProperty(value="发送时间类型1立即2定时") |
| | | private Integer sendTimeType; |
| | | |
| | | @ApiModelProperty("发送时间") |
| | | @ApiModelProperty(value="发送时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date sendTime; |
| | | |
| | | @ApiModelProperty(value = "使用范围1.全场2.指定商品") |
| | | private Integer useScope; |
| | | |
| | | @ApiModelProperty(value = "有效期类型1.时间段2.领取之日起") |
| | | @Range(min = 1, max = 2, message = "有效期类型只能是1或2") |
| | | private Integer validTimeType; |
| | | |
| | | @ApiModelProperty(value = "有效开始时间") |
| | |
| | | @ApiModelProperty(value = "关联类型1.用户管理筛选2.活动管理筛选") |
| | | private Integer relationType; |
| | | |
| | | @ApiModelProperty(value = "关联活动类型1秒杀活动") |
| | | private Integer relationActivityType; |
| | | |
| | | @ApiModelProperty(value = "关联活动id") |
| | | private String relationActivityId; |
| | | |
| | | @ApiModelProperty(value = "关联用户id集合") |
| | | private List<Long> relUserIdList; |
| | | |
| | | @ApiModelProperty(value = "宣传海报") |
| | | private String propagandaPoster; |
| | | |
| | | @ApiModelProperty(value = "发放限制数量") |
| | | private Integer sendLimitNumber; |
| | | |
| | | @ApiModelProperty(value = "发放限制0否1是") |
| | | private Integer sendLimitFlag; |
| | | |
| | | @ApiModelProperty(value = "领取限制数量 0为不限") |
| | | private Integer limitNumber; |
| | | |
| | | @ApiModelProperty("分享文案") |
| | | private String sharePassage; |
| | | |
| | | @ApiModelProperty("分享图片") |
| | | private String sharePic; |
| | | // 自定义校验逻辑 |
| | | @AssertTrue(message = "当有效期类型为时间段时,有效开始时间和有效截止时间不能为空") |
| | | public boolean isValidTimeRange() { |
| | | if (validTimeType == null) return true; // 由@NotNull校验 |
| | | if (validTimeType == 1) { |
| | | return validStartTime != null && validEndTime != null; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @AssertTrue(message = "当有效期类型为领取之日起时,有效期不能为空且必须大于0") |
| | | public boolean isValidDay() { |
| | | if (validTimeType == null) return true; |
| | | if (validTimeType == 2) { |
| | | return validDay != null && validDay > 0; |
| | | } |
| | | return true; |
| | | } |
| | | } |