From 243e976e859494cc2adca3088e04820c198eb7e8 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Tue, 2 Apr 2019 19:50:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E7=AB=AF=EF=BC=9A=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=8A=B5=20rpc=20api=20=E7=9A=84=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/promotion/api/CouponService.java | 102 ++++++++++++++++++ .../mall/promotion/api/bo/CouponCardBO.java | 4 + .../api/bo/CouponCardTemplateBO.java | 4 + .../api/bo/CouponCardTemplatePageBO.java | 5 + .../api/bo/CouponCodeTemplateBO.java | 4 + .../api/bo/CouponCodeTemplatePageBO.java | 4 + .../api/dto/CouponCardTemplateAddDTO.java | 4 + .../api/dto/CouponCardTemplatePageDTO.java | 21 ++++ .../api/dto/CouponCardTemplateUpdateDTO.java | 4 + .../api/dto/CouponCodeTemplateAddDTO.java | 4 + .../api/dto/CouponCodeTemplatePageDTO.java | 21 ++++ .../api/dto/CouponCodeTemplateUpdateDTO.java | 4 + .../{CouponDO.java => CouponCardDO.java} | 17 ++- .../biz/dataobject/CouponTemplateDO.java | 21 ++-- .../biz/service/CouponServiceImpl.java | 4 + 15 files changed, 202 insertions(+), 21 deletions(-) create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplateBO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplatePageBO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplateBO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplatePageBO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplatePageDTO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplatePageDTO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java rename promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/{CouponDO.java => CouponCardDO.java} (91%) create mode 100644 promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java new file mode 100644 index 000000000..68800a936 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java @@ -0,0 +1,102 @@ +package cn.iocoder.mall.promotion.api; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.mall.promotion.api.bo.CouponCardBO; +import cn.iocoder.mall.promotion.api.bo.CouponCardTemplatePageBO; +import cn.iocoder.mall.promotion.api.bo.CouponCodeTemplateBO; +import cn.iocoder.mall.promotion.api.bo.CouponCodeTemplatePageBO; +import cn.iocoder.mall.promotion.api.dto.*; + +public interface CouponService { + + // ========== 优惠劵(码)模板 ========== + + CommonResult getCouponCodeTemplatePage(CouponCodeTemplatePageDTO couponCodeTemplatePageDTO); + + CommonResult getCouponCardTemplatePage(CouponCardTemplatePageDTO couponCardTemplatePageDTO); + + /** + * 创建优惠码模板 + * + * @param couponCodeTemplateAddDTO 优惠码模板添加 DTO + * @return 优惠码模板 + */ + CommonResult addCouponCodeTemplate(CouponCodeTemplateAddDTO couponCodeTemplateAddDTO); + + /** + * 创建优惠劵模板 + * + * @param couponCardTemplateAddDTO 优惠码模板添加 DTO + * @return 优惠劵模板 + */ + CommonResult addCouponCardTemplate(CouponCardTemplateAddDTO couponCardTemplateAddDTO); + + /** + * 更新优惠码模板 + * + * @param couponCodeTemplateUpdateDTO 优惠码模板修改 DTO + * @return 是否成功 + */ + CommonResult updateCouponCodeTemplate(CouponCodeTemplateUpdateDTO couponCodeTemplateUpdateDTO); + + /** + * 更新优惠劵模板 + * + * @param couponCardTemplateUpdateDTO 优惠劵模板修改 DTO + * @return 是否成功 + */ + CommonResult updateCouponCardTemplate(CouponCardTemplateUpdateDTO couponCardTemplateUpdateDTO); + + /** + * 更新优惠劵(码)模板的状态 + * + * @param adminId 操作管理员编号 + * @param couponTemplateId 模板编号 + * @param status 状态 + * @return 是否成功 + */ + CommonResult updateCouponTemplateStatus(Integer adminId, Integer couponTemplateId, Integer status); + + // ========== 优惠劵 ========== + + /** + * 基于优惠劵模板,领取优惠劵 + * + * @param userId 用户编号 + * @param couponTemplateId 优惠劵模板 + * @return 优惠劵 + */ + CommonResult addCouponCard(Integer userId, Integer couponTemplateId); + + /** + * 使用优惠劵下单 + * + * @param userId 用户编号 + * @param couponCardId 优惠劵编号 + * @param usedOrderId 下单的编号 + * @param usedPrice 下单的价格 + * @return 是否成功 + */ + CommonResult useCouponCard(Integer userId, Integer couponCardId, Integer usedOrderId, Integer usedPrice); + + /** + * 取消优惠劵的使用 + * + * @param userId 用户编号 + * @param couponCardId 优惠劵编号 + * @return 是否成功 + */ + CommonResult cancelUseCouponCard(Integer userId, Integer couponCardId); + + // ========== 优惠码 ========== + + /** + * 使用优惠码,兑换优惠劵 + * + * @param userId 用户编号 + * @param code 优惠码 + * @return 优惠劵 + */ + CommonResult useCouponCode(Integer userId, String code); + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java new file mode 100644 index 000000000..4239b9aa7 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.bo; + +public class CouponCardBO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplateBO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplateBO.java new file mode 100644 index 000000000..3f83b06ca --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplateBO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.bo; + +public class CouponCardTemplateBO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplatePageBO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplatePageBO.java new file mode 100644 index 000000000..2f9fddbe8 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplatePageBO.java @@ -0,0 +1,5 @@ +package cn.iocoder.mall.promotion.api.bo; + +public class CouponCardTemplatePageBO { + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplateBO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplateBO.java new file mode 100644 index 000000000..bb8902702 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplateBO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.bo; + +public class CouponCodeTemplateBO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplatePageBO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplatePageBO.java new file mode 100644 index 000000000..48fd8c69a --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplatePageBO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.bo; + +public class CouponCodeTemplatePageBO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java new file mode 100644 index 000000000..e283db5ff --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.dto; + +public class CouponCardTemplateAddDTO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplatePageDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplatePageDTO.java new file mode 100644 index 000000000..098046c14 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplatePageDTO.java @@ -0,0 +1,21 @@ +package cn.iocoder.mall.promotion.api.dto; + +/** + * 优惠劵模板分页 DTO + */ +public class CouponCardTemplatePageDTO { + + /** + * 标题 + */ + private String title; + /** + * 状态 + */ + private Integer status; + /** + * 优惠类型 + */ + private Integer preferentialType; + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java new file mode 100644 index 000000000..e64efa7a3 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.dto; + +public class CouponCardTemplateUpdateDTO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java new file mode 100644 index 000000000..85a307243 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.dto; + +public class CouponCodeTemplateAddDTO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplatePageDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplatePageDTO.java new file mode 100644 index 000000000..98552abad --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplatePageDTO.java @@ -0,0 +1,21 @@ +package cn.iocoder.mall.promotion.api.dto; + +/** + * 优惠码模板分页 DTO + */ +public class CouponCodeTemplatePageDTO { + + /** + * 标题 + */ + private String title; + /** + * 状态 + */ + private Integer status; + /** + * 优惠类型 + */ + private Integer preferentialType; + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java new file mode 100644 index 000000000..8a88fb159 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.dto; + +public class CouponCodeTemplateUpdateDTO { +} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java similarity index 91% rename from promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponDO.java rename to promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java index 9e62e5833..ed966e707 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java @@ -7,7 +7,7 @@ import java.util.Date; /** * 优惠劵 DO */ -public class CouponDO extends BaseDO { +public class CouponCardDO extends BaseDO { // ========== 基本信息 BEGIN ========== /** @@ -25,13 +25,9 @@ public class CouponDO extends BaseDO { /** * 优惠码状态 * - * 1-生效中 - * 2-已失效 - * 3-已过期 - * 4-已删除 - * 5-已使用 - * - * TODO 需要讨论下 + * 1-未使用 + * 2-已使用 + * 3-已失效 */ private Integer status; @@ -103,6 +99,9 @@ public class CouponDO extends BaseDO { * 使用时间 */ private Date usedTime; + + // TODO 芋艿,后续要加优惠劵的使用日志,因为下单后,可能会取消。 + // ========== 使用情况 END ========== -} \ No newline at end of file +} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java index a141ff540..fb418c8d4 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java @@ -7,7 +7,7 @@ import java.util.Date; /** * 优惠劵(码)模板 DO * - * 当用户领取时,会生成 {@link CouponDO} 优惠劵(码)。 + * 当用户领取时,会生成 {@link CouponCardDO} 优惠劵(码)。 */ public class CouponTemplateDO extends BaseDO { @@ -43,14 +43,11 @@ public class CouponTemplateDO extends BaseDO { /** * 优惠码状态 * - * 1-生效中 - * 2-已失效 + * 1-开启中 + * 2-禁用中 * 3-已过期 - * 4-已删除 * - * 当优惠劵(码)有效时,可以手动操作,设置成无效。 - * - * TODO 需要讨论下 + * 当优惠劵(码)开启中,可以手动操作,设置禁用中。 */ private Integer status; // /** @@ -61,10 +58,10 @@ public class CouponTemplateDO extends BaseDO { * 设置为失效时间 */ private Date invalidTime; - /** - * 删除时间 - */ - private Date deleteTime; +// /** +// * 删除时间 +// */ +// private Date deleteTime; /** * 可领取的开始时间 */ @@ -221,4 +218,4 @@ public class CouponTemplateDO extends BaseDO { // private Integer statUseNum; // // ========== 统计信息 END ========== -} \ No newline at end of file +} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java new file mode 100644 index 000000000..d285abc60 --- /dev/null +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.biz.service; + +public class CouponServiceImpl { +}