peng
8 天以前 75f9783d5a70a5f037e3b34dc0e479069e63c0e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package cn.lili.modules.promotion.entity.dos;
 
import cn.lili.modules.promotion.entity.enums.CouponRangeDayEnum;
import cn.lili.modules.promotion.entity.enums.PromotionsStatusEnum;
import cn.lili.modules.promotion.entity.vos.CouponVO;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.beans.BeanUtils;
 
 
/**
 * 优惠券活动实体类
 *
 * @author Chopper
 * @since 2020-03-19 10:44 上午
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("li_coupon")
@ApiModel(value = "优惠券实体类")
@ToString(callSuper = true)
@NoArgsConstructor
public class Coupon extends BasePromotions {
 
    private static final long serialVersionUID = 8372820376262437018L;
 
    @ApiModelProperty(value = "优惠券名称")
    private String couponName;
 
    /**
     * POINT("打折"), PRICE("减免现金");
     *
     * @see cn.lili.modules.promotion.entity.enums.CouponTypeEnum
     */
    @ApiModelProperty(value = "优惠券类型")
    private String couponType;
 
    @ApiModelProperty(value = "面额")
    private Double price;
 
    @ApiModelProperty(value = "折扣")
    private Double couponDiscount;
 
    /**
     * @see cn.lili.modules.promotion.entity.enums.CouponGetEnum
     */
    @ApiModelProperty(value = "优惠券类型,分为免费领取和活动赠送")
    private String getType;
 
    @ApiModelProperty(value = "店铺承担比例,平台发布时可以提供一定返点")
    private Double storeCommission;
 
    @ApiModelProperty(value = "活动描述")
    private String description;
 
    @ApiModelProperty(value = "发行数量,如果是0则是不限制")
    private Integer publishNum;
 
    @ApiModelProperty(value = "领取限制")
    private Integer couponLimitNum;
 
    @ApiModelProperty(value = "已被使用的数量")
    private Integer usedNum;
 
    @ApiModelProperty(value = "已被领取的数量")
    private Integer receivedNum;
 
    @ApiModelProperty(value = "消费门槛")
    private Double consumeThreshold;
 
    /**
     * @see cn.lili.modules.promotion.entity.enums.CouponRangeDayEnum
     */
    @ApiModelProperty(value = "时间范围类型")
    private String rangeDayType;
 
    @ApiModelProperty(value = "有效期")
    private Integer effectiveDays;
 
    public Coupon(CouponVO couponVO) {
        BeanUtils.copyProperties(couponVO, this);
    }
 
 
    /**
     * @return 促销状态
     * @see cn.lili.modules.promotion.entity.enums.PromotionsStatusEnum
     */
    @Override
    public String getPromotionStatus() {
        if (this.rangeDayType != null && this.rangeDayType.equals(CouponRangeDayEnum.DYNAMICTIME.name())
                && (this.effectiveDays != null && this.effectiveDays > 0 && this.effectiveDays <= 365)) {
            return PromotionsStatusEnum.START.name();
        }
        return super.getPromotionStatus();
    }
}