前端:优惠劵列表

前端:增加路由的认证拦截
This commit is contained in:
YunaiV
2019-04-08 21:47:23 +08:00
parent 92ed97faed
commit 235da59f70
23 changed files with 321 additions and 127 deletions

View File

@@ -18,12 +18,16 @@ public class UsersCouponCardVO {
private Integer id;
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
private Integer templateId;
@ApiModelProperty(value = "优惠劵名", required = true, example = "大保剑")
private String title;
@ApiModelProperty(value = "优惠码状态", required = true, example = "参见 CouponCardStatusEnum 枚举")
private Integer status;
// ========== 基本信息 END ==========
// ========== 使用规则 BEGIN ==========
@ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true)
private Integer priceAvailable;
@ApiModelProperty(value = "固定日期-生效开始时间", required = true)
private Date validStartTime;
@ApiModelProperty(value = "固定日期-生效结束时间", required = true)

View File

@@ -21,6 +21,10 @@ public class CouponCardBO {
* 优惠劵(码)分组编号
*/
private Integer templateId;
/**
* 优惠劵名
*/
private String title;
// /**
// * 核销码
// */
@@ -51,6 +55,10 @@ public class CouponCardBO {
// ========== 领取情况 END ==========
// ========== 使用规则 BEGIN ==========
/**
* 是否设置满多少金额可用,单位:分
*/
private Integer priceAvailable;
/**
* 生效开始时间
*/

View File

@@ -6,8 +6,8 @@ import java.util.Arrays;
public enum CouponTemplateStatusEnum implements IntArrayValuable {
ENABLE(1, "开启"),
DISABLE(2, "禁用中"),
ENABLE(1, "生效"),
DISABLE(2, "已失效"),
// EXPIRE(3, "已过期"), TODO 芋艿,暂时不考虑过期的
;

View File

@@ -22,6 +22,14 @@ public class CouponCardDO extends BaseDO {
* 优惠劵(码)分组编号,{@link CouponTemplateDO} 的 id
*/
private Integer templateId;
/**
* 优惠劵名
*
* 冗余自 {@link CouponTemplateDO} 的 title
*
* TODO 芋艿,暂时不考虑冗余的更新
*/
private String title;
// /**
// * 核销码
// */
@@ -52,6 +60,10 @@ public class CouponCardDO extends BaseDO {
// ========== 领取情况 END ==========
// ========== 使用规则 BEGIN ==========
/**
* 是否设置满多少金额可用,单位:分
*/
private Integer priceAvailable;
/**
* 生效开始时间
*/

View File

@@ -38,4 +38,6 @@ public class CouponCodeDO extends BaseDO {
*/
private Integer couponId;
// TODO 芋艿,后续要考虑状态的追踪
}

View File

@@ -35,15 +35,6 @@ public class CouponTemplateDO extends BaseDO {
* 2-优惠码
*/
private Integer type;
/**
* 码类型
*
* 1-一卡一码UNIQUE
* 2-通用码GENERAL
*
* 【优惠码独有】 @see CouponCodeDO
*/
private Integer codeType;
/**
* 优惠码状态
*
@@ -212,4 +203,20 @@ public class CouponTemplateDO extends BaseDO {
// private Integer statUseNum;
// ========== 统计信息 END ==========
// ========== 优惠码 BEGIN ==========
/**
* 码类型
*
* 1-一卡一码UNIQUE
* 2-通用码GENERAL
*
* 【优惠码独有】 @see CouponCodeDO
*/
private Integer codeType;
/**
* 通用码
*/
private String commonCode;
// ========== 优惠码 BEGIN ==========
}

View File

@@ -0,0 +1,9 @@
package cn.iocoder.mall.promotion.biz.scheduler;
/**
* 优惠劵过期 Job
*
* TODO 芋艿
*/
public class CouponCardExpireJob {
}

View File

@@ -224,10 +224,12 @@ public class CouponServiceImpl implements CouponService {
// 1. 基本信息 + 领取情况
CouponCardDO card = new CouponCardDO()
.setTemplateId(couponTemplateId)
.setTitle(template.getTitle())
.setStatus(CouponCardStatusEnum.UNUSED.getValue())
.setUserId(userId)
.setTakeType(CouponCardTakeTypeEnum.BY_USER.getValue()); // TODO 需要改
// 2. 使用规则
card.setPriceAvailable(template.getPriceAvailable());
setCouponCardValidTime(card, template);
// 3. 使用效果
card.setPreferentialType(template.getPreferentialType())

View File

@@ -3,8 +3,8 @@
<mapper namespace="cn.iocoder.mall.promotion.biz.dao.CouponCardMapper">
<sql id="FIELDS">
id, template_id, status, user_id, take_type,
valid_start_time, valid_end_time, preferential_type, percent_off, price_off,
id, template_id, title, status, user_id, take_type,
price_available, valid_start_time, valid_end_time, preferential_type, percent_off, price_off,
discount_price_limit, used_order_id, used_price, used_time,
create_time
</sql>
@@ -78,13 +78,13 @@
<insert id="insert" parameterType="CouponCardDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO coupon_card (
template_id, status, user_id, take_type,
valid_start_time, valid_end_time, preferential_type, percent_off, price_off,
template_id, title, status, user_id, take_type,
price_available, valid_start_time, valid_end_time, preferential_type, percent_off, price_off,
discount_price_limit, used_order_id, used_price, used_time,
create_time
) VALUES (
#{templateId}, #{status}, #{userId}, #{takeType},
#{validStartTime}, #{validEndTime}, #{preferentialType}, #{percentOff}, #{priceOff},
#{templateId}, #{title}, #{status}, #{userId}, #{takeType},
#{priceAvailable}, #{validStartTime}, #{validEndTime}, #{preferentialType}, #{percentOff}, #{priceOff},
#{discountPriceLimit}, #{usedOrderId}, #{usedPrice}, #{usedTime},
#{createTime}
)