From ef015d9e4c05fb9cdf52c41aae4d7f0f5d1b905b Mon Sep 17 00:00:00 2001 From: wuwenbin Date: Sun, 26 Jul 2020 10:04:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=20promotion=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/sql/old/mall_promotion.sql | 4 +- .../order/biz/service/CartServiceImpl.java | 2 +- pom.xml | 1 + promotion-service-project/pom.xml | 44 +++++++++++++++++++ .../promotion-service-api/pom.xml | 11 +++++ .../api/enums}/CouponCardStatusEnum.java | 2 +- .../api/enums}/CouponCardTakeTypeEnum.java | 2 +- .../enums}/CouponTemplateDateTypeEnum.java | 2 +- .../api/enums}/CouponTemplateStatusEnum.java | 2 +- .../api/enums}/CouponTemplateTypeEnum.java | 2 +- .../promotion/api/enums}/MeetTypeEnum.java | 2 +- .../api/enums}/PreferentialTypeEnum.java | 2 +- .../api/enums}/ProductRecommendTypeEnum.java | 2 +- .../enums}/PromotionActivityStatusEnum.java | 2 +- .../api/enums}/PromotionActivityTypeEnum.java | 2 +- .../api/enums}/PromotionErrorCodeEnum.java | 2 +- .../promotion/api/enums}/RangeTypeEnum.java | 2 +- .../activity/PromotionActivityService.java | 16 +++++++ .../dto/PromotionActivityPageReqDTO.java | 6 +-- .../dto/PromotionActivityPageRespDTO.java | 4 +- .../dto/PromotionActivityRespDTO.java | 10 ++--- .../api/rpc/banner/BannerService.java | 28 ++++++++++++ .../api/rpc/banner/dto/BannerAddReqDTO.java | 4 +- .../api/rpc/banner}/dto/BannerPageDTO.java | 2 +- .../api/rpc/banner/dto/BannerPageRespDTO.java | 6 +-- .../api/rpc/banner/dto/BannerRespDTO.java | 4 +- .../rpc/banner/dto/BannerUpdateReqDTO.java | 4 +- .../api/rpc/coupon}/CouponService.java | 21 +++++---- .../dto/CouponCardAvailableRespDTO.java | 4 +- .../api/rpc/coupon/dto}/CouponCardBO.java | 2 +- .../rpc/coupon/dto}/CouponCardDetailBO.java | 2 +- .../api/rpc/coupon/dto}/CouponCardPageBO.java | 2 +- .../rpc/coupon/dto/CouponCardPageReqDTO.java | 4 +- .../rpc/coupon/dto/CouponCardSpuRespDTO.java | 7 +-- .../dto/CouponCardTemplateAddReqDTO.java | 10 ++--- .../dto/CouponCardTemplateUpdateReqDTO.java | 20 ++++----- .../dto/CouponCodeTemplateAddReqDTO.java | 4 +- .../dto/CouponCodeTemplateUpdateReqDTO.java | 4 +- .../api/rpc/coupon/dto}/CouponTemplateBO.java | 2 +- .../rpc/coupon/dto}/CouponTemplatePageBO.java | 2 +- .../coupon/dto/CouponTemplatePageReqDTO.java | 4 +- .../recommend/ProductRecommendService.java | 24 ++++++++++ .../dto/ProductRecommendAddReqDTO.java | 6 +-- .../dto/ProductRecommendPageReqDTO.java | 4 +- .../dto/ProductRecommendPageRespDTO.java | 6 +-- .../dto/ProductRecommendRespDTO.java | 6 +-- .../dto/ProductRecommendUpdateReqDTO.java | 6 +-- .../promotion-service-app/pom.xml | 21 +++++++++ .../mall/promotion/api/BannerService.java | 28 ------------ .../api/ProductRecommendService.java | 29 ------------ .../api/PromotionActivityService.java | 20 --------- .../config/ServiceExceptionConfiguration.java | 2 +- .../biz/dataobject/CouponTemplateDO.java | 2 +- .../biz/dataobject/ProductRecommendDO.java | 2 +- .../biz/dataobject/PromotionActivityDO.java | 6 +-- .../biz/service/BannerServiceImpl.java | 2 +- .../biz/service/CouponServiceImpl.java | 2 +- .../service/ProductRecommendServiceImpl.java | 2 +- .../service/PromotionActivityServiceImpl.java | 4 +- .../biz/dao/PromotionActivityMapperTest.java | 8 ++-- .../AdminsPromotionActivityController.java | 2 +- 61 files changed, 254 insertions(+), 186 deletions(-) create mode 100644 promotion-service-project/pom.xml rename {promotion => promotion-service-project}/promotion-service-api/pom.xml (82%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/CouponCardStatusEnum.java (94%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/CouponCardTakeTypeEnum.java (94%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/CouponTemplateDateTypeEnum.java (94%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/CouponTemplateStatusEnum.java (94%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/CouponTemplateTypeEnum.java (92%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/MeetTypeEnum.java (90%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/PreferentialTypeEnum.java (94%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/ProductRecommendTypeEnum.java (95%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/PromotionActivityStatusEnum.java (93%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/PromotionActivityTypeEnum.java (91%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/PromotionErrorCodeEnum.java (97%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums}/RangeTypeEnum.java (95%) create mode 100644 promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityService.java rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/PromotionActivityPageBO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java (63%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/PromotionActivityPageDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageRespDTO.java (83%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/PromotionActivityBO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java (87%) create mode 100644 promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/BannerService.java rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerAddDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerAddReqDTO.java (90%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner}/dto/BannerPageDTO.java (89%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/BannerPageBO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageRespDTO.java (64%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/BannerBO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerRespDTO.java (85%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerUpdateDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerUpdateReqDTO.java (90%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon}/CouponService.java (82%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardAvailableBO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardAvailableRespDTO.java (76%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto}/CouponCardBO.java (97%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto}/CouponCardDetailBO.java (98%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto}/CouponCardPageBO.java (87%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardPageDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardPageReqDTO.java (80%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardSpuDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardSpuRespDTO.java (66%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateAddReqDTO.java (93%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateUpdateReqDTO.java (88%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateAddReqDTO.java (56%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateUpdateReqDTO.java (56%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto}/CouponTemplateBO.java (98%) rename {promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto}/CouponTemplatePageBO.java (88%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponTemplatePageDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageReqDTO.java (83%) create mode 100644 promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/ProductRecommendService.java rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendAddDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendAddReqDTO.java (79%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendPageDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageReqDTO.java (77%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/ProductRecommendPageBO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageRespDTO.java (62%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/ProductRecommendBO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendRespDTO.java (79%) rename promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendUpdateDTO.java => promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendUpdateReqDTO.java (80%) create mode 100644 promotion-service-project/promotion-service-app/pom.xml delete mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/BannerService.java delete mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/ProductRecommendService.java delete mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/PromotionActivityService.java diff --git a/docs/sql/old/mall_promotion.sql b/docs/sql/old/mall_promotion.sql index 27e1db005..dc686c429 100644 --- a/docs/sql/old/mall_promotion.sql +++ b/docs/sql/old/mall_promotion.sql @@ -157,8 +157,8 @@ DROP TABLE IF EXISTS `promotion_activity`; CREATE TABLE `promotion_activity` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '活动编号', `title` varchar(50) NOT NULL DEFAULT '' COMMENT '活动标题', - `activity_type` tinyint(4) NOT NULL COMMENT '活动类型\n *\n * 参见 {@link cn.iocoder.mall.promotion.api.constant.PromotionActivityTypeEnum} 枚举', - `status` tinyint(4) NOT NULL DEFAULT '-1' COMMENT '活动状态\n *\n * 参见 {@link cn.iocoder.mall.promotion.api.constant.PromotionActivityStatusEnum} 枚举', + `activity_type` tinyint(4) NOT NULL COMMENT '活动类型\n *\n * 参见 {@link cn.iocoder.mall.promotion.api.enums.PromotionActivityTypeEnum} 枚举', + `status` tinyint(4) NOT NULL DEFAULT '-1' COMMENT '活动状态\n *\n * 参见 {@link cn.iocoder.mall.promotion.api.enums.PromotionActivityStatusEnum} 枚举', `start_time` datetime NOT NULL COMMENT '开始时间', `end_time` datetime NOT NULL COMMENT '结束时间', `invalid_time` datetime DEFAULT NULL COMMENT '失效时间', diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/CartServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/CartServiceImpl.java index bb62f7728..fda65fb97 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/CartServiceImpl.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/CartServiceImpl.java @@ -19,7 +19,7 @@ import cn.iocoder.mall.promotion.api.CouponService; import cn.iocoder.mall.promotion.api.PromotionActivityService; import cn.iocoder.mall.promotion.api.bo.CouponCardDetailBO; import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO; -import cn.iocoder.mall.promotion.api.constant.*; +import cn.iocoder.mall.promotion.api.enums.*; import org.apache.dubbo.config.annotation.Reference; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/pom.xml b/pom.xml index 85928c013..ad03db84f 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,7 @@ management-web-app shop-web-app product-service-project + promotion-service-project pom diff --git a/promotion-service-project/pom.xml b/promotion-service-project/pom.xml new file mode 100644 index 000000000..7d36ed95e --- /dev/null +++ b/promotion-service-project/pom.xml @@ -0,0 +1,44 @@ + + + + onemall + cn.iocoder.mall + 1.0-SNAPSHOT + + 4.0.0 + + promotion-service-project + pom + + promotion-service-api + promotion-service-app + + + + + + + cn.iocoder.mall + mall-dependencies + 1.0-SNAPSHOT + pom + import + + + + cn.iocoder.mall + common-framework + 1.0-SNAPSHOT + + + + + cn.iocoder.mall + promotion-service-api + 1.0-SNAPSHOT + + + + \ No newline at end of file diff --git a/promotion/promotion-service-api/pom.xml b/promotion-service-project/promotion-service-api/pom.xml similarity index 82% rename from promotion/promotion-service-api/pom.xml rename to promotion-service-project/promotion-service-api/pom.xml index e7f74dd1f..caaeda443 100644 --- a/promotion/promotion-service-api/pom.xml +++ b/promotion-service-project/promotion-service-api/pom.xml @@ -33,6 +33,17 @@ org.projectlombok lombok + + + javax.validation + validation-api + + + + org.hibernate + hibernate-validator + true + diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponCardStatusEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponCardStatusEnum.java similarity index 94% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponCardStatusEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponCardStatusEnum.java index 0f1079438..717aa01f8 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponCardStatusEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponCardStatusEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; import cn.iocoder.common.framework.core.IntArrayValuable; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponCardTakeTypeEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponCardTakeTypeEnum.java similarity index 94% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponCardTakeTypeEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponCardTakeTypeEnum.java index 020f3fbb0..3717c74b2 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponCardTakeTypeEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponCardTakeTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; import cn.iocoder.common.framework.core.IntArrayValuable; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateDateTypeEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponTemplateDateTypeEnum.java similarity index 94% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateDateTypeEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponTemplateDateTypeEnum.java index da1ffaaa0..784dce778 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateDateTypeEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponTemplateDateTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; import cn.iocoder.common.framework.core.IntArrayValuable; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateStatusEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponTemplateStatusEnum.java similarity index 94% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateStatusEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponTemplateStatusEnum.java index c54c5e8ab..87a27a594 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateStatusEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponTemplateStatusEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; import cn.iocoder.common.framework.core.IntArrayValuable; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateTypeEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponTemplateTypeEnum.java similarity index 92% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateTypeEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponTemplateTypeEnum.java index e213429f3..9d3cc8da4 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/CouponTemplateTypeEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/CouponTemplateTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; import java.util.Arrays; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/MeetTypeEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/MeetTypeEnum.java similarity index 90% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/MeetTypeEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/MeetTypeEnum.java index eef76187e..85a194625 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/MeetTypeEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/MeetTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; /** * 匹配类型枚举 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PreferentialTypeEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PreferentialTypeEnum.java similarity index 94% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PreferentialTypeEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PreferentialTypeEnum.java index fb75cacc6..9af2827cf 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PreferentialTypeEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PreferentialTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; import cn.iocoder.common.framework.core.IntArrayValuable; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/ProductRecommendTypeEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/ProductRecommendTypeEnum.java similarity index 95% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/ProductRecommendTypeEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/ProductRecommendTypeEnum.java index 0b50ae71f..e01a3de6d 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/ProductRecommendTypeEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/ProductRecommendTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; import cn.iocoder.common.framework.core.IntArrayValuable; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionActivityStatusEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionActivityStatusEnum.java similarity index 93% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionActivityStatusEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionActivityStatusEnum.java index 3471ebf72..25786a186 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionActivityStatusEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionActivityStatusEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; /** * 促销活动状态枚举 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionActivityTypeEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionActivityTypeEnum.java similarity index 91% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionActivityTypeEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionActivityTypeEnum.java index d6bae8e6a..01d8a415c 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionActivityTypeEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionActivityTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; /** * 推广活动类型枚举 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionErrorCodeEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeEnum.java similarity index 97% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionErrorCodeEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeEnum.java index 723213adf..7e08132ff 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionErrorCodeEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; /** * 错误码枚举类 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/RangeTypeEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/RangeTypeEnum.java similarity index 95% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/RangeTypeEnum.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/RangeTypeEnum.java index 5cfbf1318..63bffdae0 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/RangeTypeEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/RangeTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.constant; +package cn.iocoder.mall.promotion.api.enums; import cn.iocoder.common.framework.core.IntArrayValuable; diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityService.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityService.java new file mode 100644 index 000000000..a8ea7dadd --- /dev/null +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityService.java @@ -0,0 +1,16 @@ +package cn.iocoder.mall.promotion.api.rpc.activity.dto; + +import java.util.Collection; +import java.util.List; + +public interface PromotionActivityService { + + List getPromotionActivityListBySpuId(Integer spuId, + Collection activityStatuses); + + List getPromotionActivityListBySpuIds(Collection spuIds, + Collection activityStatuses); + + PromotionActivityPageReqDTO getPromotionActivityPage(PromotionActivityPageRespDTO promotionActivityPageDTO); + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/PromotionActivityPageBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java similarity index 63% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/PromotionActivityPageBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java index dfd227fb1..26f7f3be1 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/PromotionActivityPageBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.activity.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -10,12 +10,12 @@ import java.util.List; */ @Data @Accessors(chain = true) -public class PromotionActivityPageBO { +public class PromotionActivityPageReqDTO { /** * PromotionActivityBO 数组 */ - private List list; + private List list; /** * 总量 */ diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/PromotionActivityPageDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageRespDTO.java similarity index 83% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/PromotionActivityPageDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageRespDTO.java index c2f06ff0c..06b39bc48 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/PromotionActivityPageDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.activity.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -12,7 +12,7 @@ import java.util.Collection; */ @Data @Accessors(chain = true) -public class PromotionActivityPageDTO implements Serializable { +public class PromotionActivityPageRespDTO implements Serializable { /** * 标题 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/PromotionActivityBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java similarity index 87% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/PromotionActivityBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java index 42f160893..d268ce73f 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/PromotionActivityBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.activity.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -9,7 +9,7 @@ import java.util.List; @Data @Accessors(chain = true) -public class PromotionActivityBO implements Serializable { +public class PromotionActivityRespDTO implements Serializable { /** * 活动编号 @@ -22,13 +22,13 @@ public class PromotionActivityBO implements Serializable { /** * 活动类型 * - * 参见 {@link cn.iocoder.mall.promotion.api.constant.PromotionActivityTypeEnum} 枚举 + * 参见 {@link cn.iocoder.mall.promotion.api.enums.PromotionActivityTypeEnum} 枚举 */ private Integer activityType; /** * 活动状态 * - * 参见 {@link cn.iocoder.mall.promotion.api.constant.PromotionActivityStatusEnum} 枚举 + * 参见 {@link cn.iocoder.mall.promotion.api.enums.PromotionActivityStatusEnum} 枚举 */ private Integer status; /** @@ -129,7 +129,7 @@ public class PromotionActivityBO implements Serializable { /** * 可用范围的类型 * - * 参见 {@link cn.iocoder.mall.promotion.api.constant.RangeTypeEnum} 枚举 + * 参见 {@link cn.iocoder.mall.promotion.api.enums.RangeTypeEnum} 枚举 * 暂时只用 “所有可用” + “PRODUCT_INCLUDE_PRT” */ private Integer rangeType; diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/BannerService.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/BannerService.java new file mode 100644 index 000000000..87a8ba179 --- /dev/null +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/BannerService.java @@ -0,0 +1,28 @@ +package cn.iocoder.mall.promotion.api.rpc.banner; + +import cn.iocoder.common.framework.enums.CommonStatusEnum; +import cn.iocoder.common.framework.validator.InEnum; +import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO; +import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerPageRespDTO; +import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerAddReqDTO; +import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerPageDTO; +import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerUpdateReqDTO; + +import java.util.List; + +public interface BannerService { + + List getBannerListByStatus(Integer status); + + BannerPageRespDTO getBannerPage(BannerPageDTO bannerPageDTO); + + BannerRespDTO addBanner(Integer adminId, BannerAddReqDTO bannerAddDTO); + + Boolean updateBanner(Integer adminId, BannerUpdateReqDTO bannerUpdateDTO); + + Boolean updateBannerStatus(Integer adminId, Integer bannerId, + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status); + + Boolean deleteBanner(Integer adminId, Integer bannerId); + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerAddDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerAddReqDTO.java similarity index 90% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerAddDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerAddReqDTO.java index e9c43a20f..a243d274e 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerAddDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerAddReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.banner.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -14,7 +14,7 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class BannerAddDTO implements Serializable { +public class BannerAddReqDTO implements Serializable { @NotEmpty(message = "标题不能为空") @Length(min = 2, max = 32, message = "标题长度为 2-32 位") diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerPageDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageDTO.java similarity index 89% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerPageDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageDTO.java index bf82ea691..a58a55722 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerPageDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.banner.dto; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/BannerPageBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageRespDTO.java similarity index 64% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/BannerPageBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageRespDTO.java index 75a16835b..111d19d8e 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/BannerPageBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.banner.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -11,12 +11,12 @@ import java.util.List; */ @Data @Accessors(chain = true) -public class BannerPageBO implements Serializable { +public class BannerPageRespDTO implements Serializable { /** * Banner 数组 */ - private List list; + private List list; /** * 总量 */ diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/BannerBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerRespDTO.java similarity index 85% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/BannerBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerRespDTO.java index 4a86ec76f..e0f3058a0 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/BannerBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.banner.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -11,7 +11,7 @@ import java.util.Date; */ @Data @Accessors(chain = true) -public class BannerBO implements Serializable { +public class BannerRespDTO implements Serializable { /** * 编号 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerUpdateDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerUpdateReqDTO.java similarity index 90% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerUpdateDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerUpdateReqDTO.java index 9582b2c5a..e7d3f3ec1 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/BannerUpdateDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerUpdateReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.banner.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -14,7 +14,7 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class BannerUpdateDTO implements Serializable { +public class BannerUpdateReqDTO implements Serializable { @NotNull(message = "编号不能为空") private Integer id; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponService.java similarity index 82% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponService.java index 406d2772d..903a6319c 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponService.java @@ -1,9 +1,8 @@ -package cn.iocoder.mall.promotion.api; +package cn.iocoder.mall.promotion.api.rpc.coupon; import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.bo.*; -import cn.iocoder.mall.promotion.api.constant.CouponTemplateStatusEnum; -import cn.iocoder.mall.promotion.api.dto.*; +import cn.iocoder.mall.promotion.api.enums.CouponTemplateStatusEnum; +import cn.iocoder.mall.promotion.api.rpc.coupon.dto.*; import javax.validation.constraints.NotNull; import java.util.List; @@ -14,7 +13,7 @@ public interface CouponService { CouponTemplateBO getCouponTemplate(Integer couponTemplateId); - CouponTemplatePageBO getCouponTemplatePage(CouponTemplatePageDTO couponTemplatePageDTO); + CouponTemplatePageBO getCouponTemplatePage(CouponTemplatePageReqDTO couponTemplatePageDTO); /** * 创建优惠码模板 @@ -22,7 +21,7 @@ public interface CouponService { * @param couponCodeTemplateAddDTO 优惠码模板添加 DTO * @return 优惠码模板 */ - CouponTemplateBO addCouponCodeTemplate(CouponCodeTemplateAddDTO couponCodeTemplateAddDTO); + CouponTemplateBO addCouponCodeTemplate(CouponCodeTemplateAddReqDTO couponCodeTemplateAddDTO); /** * 创建优惠劵模板 @@ -30,7 +29,7 @@ public interface CouponService { * @param couponCardTemplateAddDTO 优惠码模板添加 DTO * @return 优惠劵模板 */ - CouponTemplateBO addCouponCardTemplate(CouponCardTemplateAddDTO couponCardTemplateAddDTO); + CouponTemplateBO addCouponCardTemplate(CouponCardTemplateAddReqDTO couponCardTemplateAddDTO); /** * 更新优惠码模板 @@ -38,7 +37,7 @@ public interface CouponService { * @param couponCodeTemplateUpdateDTO 优惠码模板修改 DTO * @return 是否成功 */ - Boolean updateCouponCodeTemplate(CouponCodeTemplateUpdateDTO couponCodeTemplateUpdateDTO); + Boolean updateCouponCodeTemplate(CouponCodeTemplateUpdateReqDTO couponCodeTemplateUpdateDTO); /** * 更新优惠劵模板 @@ -46,7 +45,7 @@ public interface CouponService { * @param couponCardTemplateUpdateDTO 优惠劵模板修改 DTO * @return 是否成功 */ - Boolean updateCouponCardTemplate(CouponCardTemplateUpdateDTO couponCardTemplateUpdateDTO); + Boolean updateCouponCardTemplate(CouponCardTemplateUpdateReqDTO couponCardTemplateUpdateDTO); /** * 更新优惠劵(码)模板的状态 @@ -61,7 +60,7 @@ public interface CouponService { // ========== 优惠劵 ========== - CouponCardPageBO getCouponCardPage(CouponCardPageDTO couponCardPageDTO); + CouponCardPageBO getCouponCardPage(CouponCardPageReqDTO couponCardPageDTO); /** * 基于优惠劵模板,领取优惠劵 @@ -109,7 +108,7 @@ public interface CouponService { * @param spus 匹配的商品/分类 * @return 优惠劵列表 */ - List getCouponCardList(Integer userId, List spus); + List getCouponCardList(Integer userId, List spus); // ========== 优惠码 ========== diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardAvailableBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardAvailableRespDTO.java similarity index 76% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardAvailableBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardAvailableRespDTO.java index bae8718c8..78a26d08a 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardAvailableBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardAvailableRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -10,7 +10,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class CouponCardAvailableBO extends CouponCardBO { +public class CouponCardAvailableRespDTO extends CouponCardBO { /** * 是否可用 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardBO.java similarity index 97% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardBO.java index a060dceea..9d9a2b8fe 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardBO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardDetailBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardDetailBO.java similarity index 98% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardDetailBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardDetailBO.java index b1dd75474..2847cbc60 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardDetailBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardDetailBO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardPageBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardPageBO.java similarity index 87% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardPageBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardPageBO.java index 159e4b8ef..522027732 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardPageBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardPageBO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardPageDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardPageReqDTO.java similarity index 80% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardPageDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardPageReqDTO.java index 1b6d64ec1..273678663 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardPageDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardPageReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -11,7 +11,7 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class CouponCardPageDTO implements Serializable { +public class CouponCardPageReqDTO implements Serializable { /** * 用户编号 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardSpuDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardSpuRespDTO.java similarity index 66% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardSpuDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardSpuRespDTO.java index d3799e2dd..46a49468b 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardSpuDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardSpuRespDTO.java @@ -1,5 +1,6 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; +import cn.iocoder.mall.promotion.api.rpc.coupon.CouponService; import lombok.Data; import lombok.experimental.Accessors; @@ -9,11 +10,11 @@ import java.util.List; /** * 优惠劵商品 DTO * - * 主要用于 {@link cn.iocoder.mall.promotion.api.CouponService#getCouponCardList(Integer, List)} + * 主要用于 {@link CouponService#getCouponCardList(Integer, List)} */ @Data @Accessors(chain = true) -public class CouponCardSpuDTO implements Serializable { +public class CouponCardSpuRespDTO implements Serializable { /** * 商品 SPU 编号 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateAddReqDTO.java similarity index 93% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateAddReqDTO.java index 1b76cf906..5ec3e0c2a 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateAddReqDTO.java @@ -1,9 +1,9 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.constant.CouponTemplateDateTypeEnum; -import cn.iocoder.mall.promotion.api.constant.PreferentialTypeEnum; -import cn.iocoder.mall.promotion.api.constant.RangeTypeEnum; +import cn.iocoder.mall.promotion.api.enums.CouponTemplateDateTypeEnum; +import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum; +import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; import lombok.Data; import lombok.experimental.Accessors; import org.hibernate.validator.constraints.Length; @@ -20,7 +20,7 @@ import java.util.Date; */ @Data @Accessors(chain = true) -public class CouponCardTemplateAddDTO implements Serializable { +public class CouponCardTemplateAddReqDTO implements Serializable { // ========== 基本信息 BEGIN ========== /** diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateUpdateReqDTO.java similarity index 88% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateUpdateReqDTO.java index bade48238..8996c5aa9 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCardTemplateUpdateReqDTO.java @@ -1,7 +1,7 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.constant.RangeTypeEnum; +import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; import lombok.Data; import lombok.experimental.Accessors; import org.hibernate.validator.constraints.Length; @@ -16,7 +16,7 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class CouponCardTemplateUpdateDTO implements Serializable { +public class CouponCardTemplateUpdateReqDTO implements Serializable { @NotNull(message = "编号不能为空") private Integer id; @@ -143,7 +143,7 @@ public class CouponCardTemplateUpdateDTO implements Serializable { return id; } - public CouponCardTemplateUpdateDTO setId(Integer id) { + public CouponCardTemplateUpdateReqDTO setId(Integer id) { this.id = id; return this; } @@ -152,7 +152,7 @@ public class CouponCardTemplateUpdateDTO implements Serializable { return title; } - public CouponCardTemplateUpdateDTO setTitle(String title) { + public CouponCardTemplateUpdateReqDTO setTitle(String title) { this.title = title; return this; } @@ -161,7 +161,7 @@ public class CouponCardTemplateUpdateDTO implements Serializable { return description; } - public CouponCardTemplateUpdateDTO setDescription(String description) { + public CouponCardTemplateUpdateReqDTO setDescription(String description) { this.description = description; return this; } @@ -170,7 +170,7 @@ public class CouponCardTemplateUpdateDTO implements Serializable { return quota; } - public CouponCardTemplateUpdateDTO setQuota(Integer quota) { + public CouponCardTemplateUpdateReqDTO setQuota(Integer quota) { this.quota = quota; return this; } @@ -179,7 +179,7 @@ public class CouponCardTemplateUpdateDTO implements Serializable { return total; } - public CouponCardTemplateUpdateDTO setTotal(Integer total) { + public CouponCardTemplateUpdateReqDTO setTotal(Integer total) { this.total = total; return this; } @@ -188,7 +188,7 @@ public class CouponCardTemplateUpdateDTO implements Serializable { return rangeType; } - public CouponCardTemplateUpdateDTO setRangeType(Integer rangeType) { + public CouponCardTemplateUpdateReqDTO setRangeType(Integer rangeType) { this.rangeType = rangeType; return this; } @@ -197,7 +197,7 @@ public class CouponCardTemplateUpdateDTO implements Serializable { return rangeValues; } - public CouponCardTemplateUpdateDTO setRangeValues(String rangeValues) { + public CouponCardTemplateUpdateReqDTO setRangeValues(String rangeValues) { this.rangeValues = rangeValues; return this; } diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateAddReqDTO.java similarity index 56% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateAddReqDTO.java index 952f5d2cc..3ba79b1fe 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateAddReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -10,5 +10,5 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class CouponCodeTemplateAddDTO implements Serializable { +public class CouponCodeTemplateAddReqDTO implements Serializable { } diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateUpdateReqDTO.java similarity index 56% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateUpdateReqDTO.java index 797d1117a..75cb85fa8 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponCodeTemplateUpdateReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -10,5 +10,5 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class CouponCodeTemplateUpdateDTO implements Serializable { +public class CouponCodeTemplateUpdateReqDTO implements Serializable { } diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponTemplateBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplateBO.java similarity index 98% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponTemplateBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplateBO.java index af6dec572..e48f8f2c2 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponTemplateBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplateBO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponTemplatePageBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageBO.java similarity index 88% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponTemplatePageBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageBO.java index 697ccec3b..15f33570d 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponTemplatePageBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageBO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponTemplatePageDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageReqDTO.java similarity index 83% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponTemplatePageDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageReqDTO.java index 6acb381ed..d8e704dc2 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponTemplatePageDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/CouponTemplatePageReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.coupon.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -11,7 +11,7 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class CouponTemplatePageDTO implements Serializable { +public class CouponTemplatePageReqDTO implements Serializable { /** * 类型 diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/ProductRecommendService.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/ProductRecommendService.java new file mode 100644 index 000000000..5d6a2f98f --- /dev/null +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/ProductRecommendService.java @@ -0,0 +1,24 @@ +package cn.iocoder.mall.promotion.api.rpc.recommend.dto; + +import cn.iocoder.common.framework.enums.CommonStatusEnum; +import cn.iocoder.common.framework.exception.ServiceException; +import cn.iocoder.common.framework.validator.InEnum; + +import java.util.List; + +public interface ProductRecommendService { + + List getProductRecommendList(Integer type, Integer status); + + ProductRecommendPageRespDTO getProductRecommendPage(ProductRecommendPageReqDTO productRecommendPageDTO); + + ProductRecommendRespDTO addProductRecommend(Integer adminId, ProductRecommendAddReqDTO productRecommendAddDTO) throws ServiceException; + + Boolean updateProductRecommend(Integer adminId, ProductRecommendUpdateReqDTO productRecommendUpdateDTO) throws ServiceException; + + Boolean updateProductRecommendStatus(Integer adminId, Integer productRecommendId, + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status) throws ServiceException; + + Boolean deleteProductRecommend(Integer adminId, Integer productRecommendId); + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendAddDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendAddReqDTO.java similarity index 79% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendAddDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendAddReqDTO.java index d716af359..df3732c90 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendAddDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendAddReqDTO.java @@ -1,7 +1,7 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.recommend.dto; import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum; +import cn.iocoder.mall.promotion.api.enums.ProductRecommendTypeEnum; import lombok.Data; import lombok.experimental.Accessors; import org.hibernate.validator.constraints.Length; @@ -14,7 +14,7 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class ProductRecommendAddDTO implements Serializable { +public class ProductRecommendAddReqDTO implements Serializable { @InEnum(value = ProductRecommendTypeEnum.class, message = "修改推荐类型必须是 {value}") @NotNull(message = "推荐类型不能为空") diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendPageDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageReqDTO.java similarity index 77% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendPageDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageReqDTO.java index 8994f6b43..f6e6359c1 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendPageDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.recommend.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -11,7 +11,7 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class ProductRecommendPageDTO implements Serializable { +public class ProductRecommendPageReqDTO implements Serializable { /** * 推荐类型 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/ProductRecommendPageBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageRespDTO.java similarity index 62% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/ProductRecommendPageBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageRespDTO.java index 8f596526a..07e512c28 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/ProductRecommendPageBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.recommend.dto; import lombok.Data; import lombok.experimental.Accessors; @@ -11,12 +11,12 @@ import java.util.List; */ @Data @Accessors(chain = true) -public class ProductRecommendPageBO implements Serializable { +public class ProductRecommendPageRespDTO implements Serializable { /** * ProductRecommend 数组 */ - private List list; + private List list; /** * 总量 */ diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/ProductRecommendBO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendRespDTO.java similarity index 79% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/ProductRecommendBO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendRespDTO.java index 1a25869cc..342802715 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/ProductRecommendBO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendRespDTO.java @@ -1,6 +1,6 @@ -package cn.iocoder.mall.promotion.api.bo; +package cn.iocoder.mall.promotion.api.rpc.recommend.dto; -import cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum; +import cn.iocoder.mall.promotion.api.enums.ProductRecommendTypeEnum; import lombok.Data; import lombok.experimental.Accessors; @@ -12,7 +12,7 @@ import java.util.Date; */ @Data @Accessors(chain = true) -public class ProductRecommendBO implements Serializable { +public class ProductRecommendRespDTO implements Serializable { /** * 编号 diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendUpdateDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendUpdateReqDTO.java similarity index 80% rename from promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendUpdateDTO.java rename to promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendUpdateReqDTO.java index b44d6dfc7..0dee22b28 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/ProductRecommendUpdateDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendUpdateReqDTO.java @@ -1,7 +1,7 @@ -package cn.iocoder.mall.promotion.api.dto; +package cn.iocoder.mall.promotion.api.rpc.recommend.dto; import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum; +import cn.iocoder.mall.promotion.api.enums.ProductRecommendTypeEnum; import lombok.Data; import lombok.experimental.Accessors; import org.hibernate.validator.constraints.Length; @@ -14,7 +14,7 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class ProductRecommendUpdateDTO implements Serializable { +public class ProductRecommendUpdateReqDTO implements Serializable { @NotNull(message = "编号不能为空") private Integer id; diff --git a/promotion-service-project/promotion-service-app/pom.xml b/promotion-service-project/promotion-service-app/pom.xml new file mode 100644 index 000000000..3c61c34ec --- /dev/null +++ b/promotion-service-project/promotion-service-app/pom.xml @@ -0,0 +1,21 @@ + + + + promotion-service-project + cn.iocoder.mall + 1.0-SNAPSHOT + + 4.0.0 + + promotion-service-app + + + + cn.iocoder.mall + promotion-service-api + + + + \ No newline at end of file diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/BannerService.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/BannerService.java deleted file mode 100644 index bf3a05e9f..000000000 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/BannerService.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.promotion.api; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.bo.BannerBO; -import cn.iocoder.mall.promotion.api.bo.BannerPageBO; -import cn.iocoder.mall.promotion.api.dto.BannerAddDTO; -import cn.iocoder.mall.promotion.api.dto.BannerPageDTO; -import cn.iocoder.mall.promotion.api.dto.BannerUpdateDTO; - -import java.util.List; - -public interface BannerService { - - List getBannerListByStatus(Integer status); - - BannerPageBO getBannerPage(BannerPageDTO bannerPageDTO); - - BannerBO addBanner(Integer adminId, BannerAddDTO bannerAddDTO); - - Boolean updateBanner(Integer adminId, BannerUpdateDTO bannerUpdateDTO); - - Boolean updateBannerStatus(Integer adminId, Integer bannerId, - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status); - - Boolean deleteBanner(Integer adminId, Integer bannerId); - -} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/ProductRecommendService.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/ProductRecommendService.java deleted file mode 100644 index d173ebc3b..000000000 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/ProductRecommendService.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.promotion.api; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.exception.ServiceException; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO; -import cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO; -import cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO; -import cn.iocoder.mall.promotion.api.dto.ProductRecommendPageDTO; -import cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO; - -import java.util.List; - -public interface ProductRecommendService { - - List getProductRecommendList(Integer type, Integer status); - - ProductRecommendPageBO getProductRecommendPage(ProductRecommendPageDTO productRecommendPageDTO); - - ProductRecommendBO addProductRecommend(Integer adminId, ProductRecommendAddDTO productRecommendAddDTO) throws ServiceException; - - Boolean updateProductRecommend(Integer adminId, ProductRecommendUpdateDTO productRecommendUpdateDTO) throws ServiceException; - - Boolean updateProductRecommendStatus(Integer adminId, Integer productRecommendId, - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status) throws ServiceException; - - Boolean deleteProductRecommend(Integer adminId, Integer productRecommendId); - -} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/PromotionActivityService.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/PromotionActivityService.java deleted file mode 100644 index 94fa9e0eb..000000000 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/PromotionActivityService.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.promotion.api; - -import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO; -import cn.iocoder.mall.promotion.api.bo.PromotionActivityPageBO; -import cn.iocoder.mall.promotion.api.dto.PromotionActivityPageDTO; - -import java.util.Collection; -import java.util.List; - -public interface PromotionActivityService { - - List getPromotionActivityListBySpuId(Integer spuId, - Collection activityStatuses); - - List getPromotionActivityListBySpuIds(Collection spuIds, - Collection activityStatuses); - - PromotionActivityPageBO getPromotionActivityPage(PromotionActivityPageDTO promotionActivityPageDTO); - -} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/config/ServiceExceptionConfiguration.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/config/ServiceExceptionConfiguration.java index 632cb9cd2..8435e0fa7 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/config/ServiceExceptionConfiguration.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/config/ServiceExceptionConfiguration.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.promotion.biz.config; import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.promotion.api.constant.PromotionErrorCodeEnum; +import cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeEnum; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.annotation.Configuration; import org.springframework.context.event.EventListener; 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 4a2489a49..5ddc020a2 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 @@ -38,7 +38,7 @@ public class CouponTemplateDO extends BaseDO { /** * 优惠码状态 * - * {@link cn.iocoder.mall.promotion.api.constant.CouponTemplateStatusEnum} + * {@link cn.iocoder.mall.promotion.api.enums.CouponTemplateStatusEnum} * * 当优惠劵(码)开启中,可以手动操作,设置禁用中。 */ diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java index 7132427e7..be5e47e88 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java @@ -2,7 +2,7 @@ package cn.iocoder.mall.promotion.biz.dataobject; import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum; +import cn.iocoder.mall.promotion.api.enums.ProductRecommendTypeEnum; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java index e8075556a..e987a7871 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java @@ -25,7 +25,7 @@ public class PromotionActivityDO extends BaseDO { /** * 活动类型 * - * 参见 {@link cn.iocoder.mall.promotion.api.constant.PromotionActivityTypeEnum} 枚举 + * 参见 {@link cn.iocoder.mall.promotion.api.enums.PromotionActivityTypeEnum} 枚举 */ private Integer activityType; // /** @@ -36,7 +36,7 @@ public class PromotionActivityDO extends BaseDO { /** * 活动状态 * - * 参见 {@link cn.iocoder.mall.promotion.api.constant.PromotionActivityStatusEnum} 枚举 + * 参见 {@link cn.iocoder.mall.promotion.api.enums.PromotionActivityStatusEnum} 枚举 */ private Integer status; /** @@ -165,7 +165,7 @@ public class PromotionActivityDO extends BaseDO { /** * 可用范围的类型 * - * 参见 {@link cn.iocoder.mall.promotion.api.constant.RangeTypeEnum} 枚举 + * 参见 {@link cn.iocoder.mall.promotion.api.enums.RangeTypeEnum} 枚举 * 暂时只用 “所有可用” + “PRODUCT_INCLUDE_PRT” */ private Integer rangeType; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java index 280c1b4fd..3092d7e67 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java @@ -6,7 +6,7 @@ import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum; import cn.iocoder.mall.promotion.api.BannerService; import cn.iocoder.mall.promotion.api.bo.BannerBO; import cn.iocoder.mall.promotion.api.bo.BannerPageBO; -import cn.iocoder.mall.promotion.api.constant.PromotionErrorCodeEnum; +import cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeEnum; import cn.iocoder.mall.promotion.api.dto.BannerAddDTO; import cn.iocoder.mall.promotion.api.dto.BannerPageDTO; import cn.iocoder.mall.promotion.api.dto.BannerUpdateDTO; 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 index 53928c5f3..ab857af28 100644 --- 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 @@ -6,7 +6,7 @@ import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.util.StringUtil; import cn.iocoder.mall.promotion.api.CouponService; import cn.iocoder.mall.promotion.api.bo.*; -import cn.iocoder.mall.promotion.api.constant.*; +import cn.iocoder.mall.promotion.api.enums.*; import cn.iocoder.mall.promotion.api.dto.*; import cn.iocoder.mall.promotion.biz.convert.CouponCardConvert; import cn.iocoder.mall.promotion.biz.convert.CouponTemplateConvert; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java index a32ad6e1b..d79592218 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java @@ -7,7 +7,7 @@ import cn.iocoder.mall.product.rpc.api.ProductSpuRpc; import cn.iocoder.mall.promotion.api.ProductRecommendService; import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO; import cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO; -import cn.iocoder.mall.promotion.api.constant.PromotionErrorCodeEnum; +import cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeEnum; import cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO; import cn.iocoder.mall.promotion.api.dto.ProductRecommendPageDTO; import cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/PromotionActivityServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/PromotionActivityServiceImpl.java index 3e84a1de3..487a3f1e0 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/PromotionActivityServiceImpl.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/PromotionActivityServiceImpl.java @@ -3,8 +3,8 @@ package cn.iocoder.mall.promotion.biz.service; import cn.iocoder.mall.promotion.api.PromotionActivityService; import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO; import cn.iocoder.mall.promotion.api.bo.PromotionActivityPageBO; -import cn.iocoder.mall.promotion.api.constant.PromotionActivityTypeEnum; -import cn.iocoder.mall.promotion.api.constant.RangeTypeEnum; +import cn.iocoder.mall.promotion.api.enums.PromotionActivityTypeEnum; +import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; import cn.iocoder.mall.promotion.api.dto.PromotionActivityPageDTO; import cn.iocoder.mall.promotion.biz.convert.PromotionActivityConvert; import cn.iocoder.mall.promotion.biz.dao.PromotionActivityMapper; diff --git a/promotion/promotion-service-impl/src/test/java/cn/iocoder/mall/promotion/biz/dao/PromotionActivityMapperTest.java b/promotion/promotion-service-impl/src/test/java/cn/iocoder/mall/promotion/biz/dao/PromotionActivityMapperTest.java index fcc8302bd..8a576e88c 100644 --- a/promotion/promotion-service-impl/src/test/java/cn/iocoder/mall/promotion/biz/dao/PromotionActivityMapperTest.java +++ b/promotion/promotion-service-impl/src/test/java/cn/iocoder/mall/promotion/biz/dao/PromotionActivityMapperTest.java @@ -1,10 +1,10 @@ package cn.iocoder.mall.promotion.biz.dao; import cn.iocoder.common.framework.util.DateUtil; -import cn.iocoder.mall.promotion.api.constant.PreferentialTypeEnum; -import cn.iocoder.mall.promotion.api.constant.PromotionActivityStatusEnum; -import cn.iocoder.mall.promotion.api.constant.PromotionActivityTypeEnum; -import cn.iocoder.mall.promotion.api.constant.RangeTypeEnum; +import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum; +import cn.iocoder.mall.promotion.api.enums.PromotionActivityStatusEnum; +import cn.iocoder.mall.promotion.api.enums.PromotionActivityTypeEnum; +import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; import cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO; import org.junit.Ignore; import org.junit.Test; diff --git a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsPromotionActivityController.java b/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsPromotionActivityController.java index 13a83ec92..3a90b3692 100644 --- a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsPromotionActivityController.java +++ b/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsPromotionActivityController.java @@ -3,7 +3,7 @@ package cn.iocoder.mall.promotion.application.controller.admins; import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.mall.promotion.api.PromotionActivityService; import cn.iocoder.mall.promotion.api.bo.PromotionActivityPageBO; -import cn.iocoder.mall.promotion.api.constant.PromotionActivityStatusEnum; +import cn.iocoder.mall.promotion.api.enums.PromotionActivityStatusEnum; import cn.iocoder.mall.promotion.api.dto.PromotionActivityPageDTO; import io.swagger.annotations.Api; import org.apache.dubbo.config.annotation.Reference; From e87cb91332101750189398e141f8b514297457c6 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Sun, 26 Jul 2020 11:04:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=95=86=E5=93=81=20SPU=20=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/ProductSpuController.java | 67 +++++++++++++ .../product/vo/spu/ProductSpuCreateReqVO.java | 42 +++++++++ .../product/vo/spu/ProductSpuPageReqVO.java | 33 +++++++ .../product/vo/spu/ProductSpuRespVO.java | 36 +++++++ .../product/vo/spu/ProductSpuUpdateReqVO.java | 45 +++++++++ .../convert/product/ProductSpuConvert.java | 34 +++++++ .../manager/product/ProductSpuManager.java | 84 +++++++++++++++++ .../src/main/resources/application.yml | 2 + .../productservice/rpc/spu/ProductSpuRpc.java | 56 +++++++++++ .../rpc/spu/dto/ProductSpuCreateReqDTO.java | 63 +++++++++++++ .../rpc/spu/dto/ProductSpuPageReqDTO.java | 25 +++++ .../rpc/spu/dto/ProductSpuRespDTO.java | 61 ++++++++++++ .../rpc/spu/dto/ProductSpuUpdateReqDTO.java | 68 ++++++++++++++ .../convert/spu/ProductSpuConvert.java | 46 +++++++++ .../mysql}/dataobject/spu/ProductSkuDO.java | 3 +- .../mysql}/dataobject/spu/ProductSpuDO.java | 4 +- .../mysql/mapper/spu/ProductSpuMapper.java | 27 ++++++ .../manager/spu/ProductSpuManager.java | 77 +++++++++++++++ .../rpc/spu/ProductSpuRpcImpl.java | 52 ++++++++++ .../service/spu/ProductSpuService.java | 94 +++++++++++++++++++ .../service/spu/bo/ProductSpuBO.java | 61 ++++++++++++ .../service/spu/bo/ProductSpuCreateBO.java | 63 +++++++++++++ .../service/spu/bo/ProductSpuPageBO.java | 25 +++++ .../service/spu/bo/ProductSpuUpdateBO.java | 68 ++++++++++++++ .../src/main/resources/application.yaml | 2 + product/pom.xml | 3 - .../mall/product/dataobject/ProductSkuDO.java | 59 ------------ .../mall/product/dataobject/ProductSpuDO.java | 78 --------------- .../users/UsersProductCategoryController.java | 37 -------- .../vo/users/UsersProductCategoryVO.java | 20 ---- 30 files changed, 1135 insertions(+), 200 deletions(-) create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuPageReqVO.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductSpuConvert.java create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuRpc.java create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuCreateReqDTO.java create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuPageReqDTO.java create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java create mode 100644 product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuUpdateReqDTO.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/spu/ProductSpuConvert.java rename {product/product-biz/src/main/java/cn/iocoder/mall/product/biz => product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql}/dataobject/spu/ProductSkuDO.java (90%) rename {product/product-biz/src/main/java/cn/iocoder/mall/product/biz => product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql}/dataobject/spu/ProductSpuDO.java (91%) create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/spu/ProductSpuMapper.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuRpcImpl.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/ProductSpuService.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuPageBO.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java delete mode 100644 product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductCategoryController.java delete mode 100644 product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/users/UsersProductCategoryVO.java diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java new file mode 100644 index 000000000..deb9ad365 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java @@ -0,0 +1,67 @@ +package cn.iocoder.mall.managementweb.controller.product; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuCreateReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuRespVO; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuUpdateReqVO; +import cn.iocoder.mall.managementweb.manager.product.ProductSpuManager; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +import static cn.iocoder.common.framework.vo.CommonResult.success; + +/** +* 商品 SPU Controller +*/ +@RestController +@RequestMapping("/product_spu") +@Api(tags = "商品 SPU") +@Validated +public class ProductSpuController { + + @Autowired + private ProductSpuManager productSpuManager; + + @PostMapping("/create") + @ApiOperation("创建商品 SPU") + public CommonResult createProductSpu(@Valid ProductSpuCreateReqVO createVO) { + return success(productSpuManager.createProductSpu(createVO)); + } + + @PostMapping("/update") + @ApiOperation("更新商品 SPU") + public CommonResult updateProductSpu(@Valid ProductSpuUpdateReqVO updateVO) { + productSpuManager.updateProductSpu(updateVO); + return success(true); + } + + @GetMapping("/get") + @ApiOperation("获得商品 SPU") + @ApiImplicitParam(name = "productSpuId", value = "商品 SPU编号", required = true) + public CommonResult getProductSpu(@RequestParam("productSpuId") Integer productSpuId) { + return success(productSpuManager.getProductSpu(productSpuId)); + } + + @GetMapping("/list") + @ApiOperation("获得商品 SPU 列表") + @ApiImplicitParam(name = "productSpuIds", value = "商品 SPU编号列表", required = true) + public CommonResult> listProductSpus(@RequestParam("productSpuIds") List productSpuIds) { + return success(productSpuManager.listProductSpus(productSpuIds)); + } + + @GetMapping("/page") + @ApiOperation("获得商品 SPU 分页") + public CommonResult> pageProductSpu(ProductSpuPageReqVO pageVO) { + return success(productSpuManager.pageProductSpu(pageVO)); + } + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java new file mode 100644 index 000000000..4fdfca20e --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java @@ -0,0 +1,42 @@ +package cn.iocoder.mall.managementweb.controller.product.vo.spu; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@ApiModel("商品 SPU创建 Request VO") +@Data +public class ProductSpuCreateReqVO { + + @ApiModelProperty(value = "SPU 名字", required = true) + @NotEmpty(message = "SPU 名字不能为空") + private String name; + @ApiModelProperty(value = "卖点", required = true) + @NotEmpty(message = "卖点不能为空") + private String sellPoint; + @ApiModelProperty(value = "描述", required = true) + @NotEmpty(message = "描述不能为空") + private String description; + @ApiModelProperty(value = "分类编号", required = true) + @NotNull(message = "分类编号不能为空") + private Integer cid; + @ApiModelProperty(value = "商品主图地址", required = true) + @NotEmpty(message = "商品主图地址不能为空") + private String picUrls; + @ApiModelProperty(value = "是否上架商品", required = true) + @NotNull(message = "是否上架商品不能为空") + private Integer visible; + @ApiModelProperty(value = "排序字段", required = true) + @NotNull(message = "排序字段不能为空") + private Integer sort; + @ApiModelProperty(value = "价格", required = true) + @NotNull(message = "价格不能为空") + private Integer price; + @ApiModelProperty(value = "库存数量", required = true) + @NotNull(message = "库存数量不能为空") + private Integer quantity; + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuPageReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuPageReqVO.java new file mode 100644 index 000000000..cadfcea8c --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuPageReqVO.java @@ -0,0 +1,33 @@ +package cn.iocoder.mall.managementweb.controller.product.vo.spu; + +import cn.iocoder.common.framework.vo.PageParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@ApiModel("商品 SPU分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class ProductSpuPageReqVO extends PageParam { + + @ApiModelProperty(value = "SPU 名字", required = true) + private String name; + @ApiModelProperty(value = "卖点", required = true) + private String sellPoint; + @ApiModelProperty(value = "描述", required = true) + private String description; + @ApiModelProperty(value = "分类编号", required = true) + private Integer cid; + @ApiModelProperty(value = "商品主图地址", required = true) + private String picUrls; + @ApiModelProperty(value = "是否上架商品", required = true) + private Integer visible; + @ApiModelProperty(value = "排序字段", required = true) + private Integer sort; + @ApiModelProperty(value = "价格", required = true) + private Integer price; + @ApiModelProperty(value = "库存数量", required = true) + private Integer quantity; + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java new file mode 100644 index 000000000..95836b790 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java @@ -0,0 +1,36 @@ +package cn.iocoder.mall.managementweb.controller.product.vo.spu; + +import lombok.*; +import io.swagger.annotations.*; +import java.util.*; + +@ApiModel("商品 SPU Response VO") +@Data +public class ProductSpuRespVO { + + @ApiModelProperty(value = "SPU 编号", required = true) + private Integer id; + @ApiModelProperty(value = "SPU 名字", required = true) + private String name; + @ApiModelProperty(value = "卖点", required = true) + private String sellPoint; + @ApiModelProperty(value = "描述", required = true) + private String description; + @ApiModelProperty(value = "分类编号", required = true) + private Integer cid; + @ApiModelProperty(value = "商品主图地址", required = true) + private String picUrls; + @ApiModelProperty(value = "是否上架商品", required = true) + private Integer visible; + @ApiModelProperty(value = "排序字段", required = true) + private Integer sort; + @ApiModelProperty(value = "价格", required = true) + private Integer price; + @ApiModelProperty(value = "库存数量", required = true) + private Integer quantity; + @ApiModelProperty(value = "创建时间", required = true) + private Date createTime; + @ApiModelProperty(value = "最后更新时间", required = true) + private Date updateTime; + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java new file mode 100644 index 000000000..0498a9a66 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java @@ -0,0 +1,45 @@ +package cn.iocoder.mall.managementweb.controller.product.vo.spu; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@ApiModel("商品 SPU更新 Request VO") +@Data +public class ProductSpuUpdateReqVO { + + @ApiModelProperty(value = "SPU 编号", required = true) + @NotNull(message = "SPU 编号不能为空") + private Integer id; + @ApiModelProperty(value = "SPU 名字", required = true) + @NotEmpty(message = "SPU 名字不能为空") + private String name; + @ApiModelProperty(value = "卖点", required = true) + @NotEmpty(message = "卖点不能为空") + private String sellPoint; + @ApiModelProperty(value = "描述", required = true) + @NotEmpty(message = "描述不能为空") + private String description; + @ApiModelProperty(value = "分类编号", required = true) + @NotNull(message = "分类编号不能为空") + private Integer cid; + @ApiModelProperty(value = "商品主图地址", required = true) + @NotEmpty(message = "商品主图地址不能为空") + private String picUrls; + @ApiModelProperty(value = "是否上架商品", required = true) + @NotNull(message = "是否上架商品不能为空") + private Integer visible; + @ApiModelProperty(value = "排序字段", required = true) + @NotNull(message = "排序字段不能为空") + private Integer sort; + @ApiModelProperty(value = "价格", required = true) + @NotNull(message = "价格不能为空") + private Integer price; + @ApiModelProperty(value = "库存数量", required = true) + @NotNull(message = "库存数量不能为空") + private Integer quantity; + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductSpuConvert.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductSpuConvert.java new file mode 100644 index 000000000..19cc7c6bf --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductSpuConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.mall.managementweb.convert.product; + +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuCreateReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuRespVO; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuUpdateReqVO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuCreateReqDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuPageReqDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuUpdateReqDTO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface ProductSpuConvert { + + ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class); + + ProductSpuCreateReqDTO convert(ProductSpuCreateReqVO bean); + + ProductSpuUpdateReqDTO convert(ProductSpuUpdateReqVO bean); + + ProductSpuRespVO convert(ProductSpuRespDTO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + ProductSpuPageReqDTO convert(ProductSpuPageReqVO bean); + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java new file mode 100644 index 000000000..8655f307a --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java @@ -0,0 +1,84 @@ +package cn.iocoder.mall.managementweb.manager.product; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuCreateReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReqVO; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuRespVO; +import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuUpdateReqVO; +import cn.iocoder.mall.managementweb.convert.product.ProductSpuConvert; +import cn.iocoder.mall.productservice.rpc.spu.ProductSpuRpc; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* 商品 SPU Manager +*/ +@Service +public class ProductSpuManager { + + @DubboReference(version = "${dubbo.consumer.ProductSpuRpc.version}") + private ProductSpuRpc productSpuRpc; + + /** + * 创建商品 SPU + * + * @param createVO 创建商品 SPU VO + * @return 商品 SPU + */ + public Integer createProductSpu(ProductSpuCreateReqVO createVO) { + CommonResult createProductSpuResult = productSpuRpc.createProductSpu(ProductSpuConvert.INSTANCE.convert(createVO)); + createProductSpuResult.checkError(); + return createProductSpuResult.getData(); + } + + /** + * 更新商品 SPU + * + * @param updateVO 更新商品 SPU VO + */ + public void updateProductSpu(ProductSpuUpdateReqVO updateVO) { + CommonResult updateProductSpuResult = productSpuRpc.updateProductSpu(ProductSpuConvert.INSTANCE.convert(updateVO)); + updateProductSpuResult.checkError(); + } + + /** + * 获得商品 SPU + * + * @param productSpuId 商品 SPU编号 + * @return 商品 SPU + */ + public ProductSpuRespVO getProductSpu(Integer productSpuId) { + CommonResult getProductSpuResult = productSpuRpc.getProductSpu(productSpuId); + getProductSpuResult.checkError(); + return ProductSpuConvert.INSTANCE.convert(getProductSpuResult.getData()); + } + + /** + * 获得商品 SPU列表 + * + * @param productSpuIds 商品 SPU编号列表 + * @return 商品 SPU列表 + */ + public List listProductSpus(List productSpuIds) { + CommonResult> listProductSpuResult = productSpuRpc.listProductSpus(productSpuIds); + listProductSpuResult.checkError(); + return ProductSpuConvert.INSTANCE.convertList(listProductSpuResult.getData()); + } + + /** + * 获得商品 SPU分页 + * + * @param pageVO 商品 SPU分页查询 + * @return 商品 SPU分页结果 + */ + public PageResult pageProductSpu(ProductSpuPageReqVO pageVO) { + CommonResult> pageProductSpuResult = productSpuRpc.pageProductSpu(ProductSpuConvert.INSTANCE.convert(pageVO)); + pageProductSpuResult.checkError(); + return ProductSpuConvert.INSTANCE.convertPage(pageProductSpuResult.getData()); + } + +} diff --git a/management-web-app/src/main/resources/application.yml b/management-web-app/src/main/resources/application.yml index 08e950052..caeaea2e3 100644 --- a/management-web-app/src/main/resources/application.yml +++ b/management-web-app/src/main/resources/application.yml @@ -53,6 +53,8 @@ dubbo: version: 1.0.0 ProductBrandRpc: version: 1.0.0 + ProductSpuRpc: + version: 1.0.0 # Swagger 配置项 swagger: diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuRpc.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuRpc.java new file mode 100644 index 000000000..14c58e230 --- /dev/null +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuRpc.java @@ -0,0 +1,56 @@ +package cn.iocoder.mall.productservice.rpc.spu; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuCreateReqDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuPageReqDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuUpdateReqDTO; + +import java.util.List; + +/** +* 商品 SPU Rpc 接口 +*/ +public interface ProductSpuRpc { + + /** + * 创建商品 SPU + * + * @param createDTO 创建商品 SPU DTO + * @return 商品 SPU编号 + */ + CommonResult createProductSpu(ProductSpuCreateReqDTO createDTO); + + /** + * 更新商品 SPU + * + * @param updateDTO 更新商品 SPU DTO + */ + CommonResult updateProductSpu(ProductSpuUpdateReqDTO updateDTO); + + /** + * 获得商品 SPU + * + * @param productSpuId 商品 SPU 编号 + * @return 商品 SPU + */ + CommonResult getProductSpu(Integer productSpuId); + + /** + * 获得商品 SPU列表 + * + * @param productSpuIds 商品 SPU 编号列表 + * @return 商品 SPU 列表 + */ + CommonResult> listProductSpus(List productSpuIds); + + /** + * 获得商品 SPU分页 + * + * @param pageDTO 商品 SPU分页查询 + * @return 商品 SPU分页结果 + */ + CommonResult> pageProductSpu(ProductSpuPageReqDTO pageDTO); + +} diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuCreateReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuCreateReqDTO.java new file mode 100644 index 000000000..2395162da --- /dev/null +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuCreateReqDTO.java @@ -0,0 +1,63 @@ +package cn.iocoder.mall.productservice.rpc.spu.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** +* 商品 SPU 创建 Request DTO +*/ +@Data +@Accessors(chain = true) +public class ProductSpuCreateReqDTO { + + /** + * SPU 名字 + */ + @NotEmpty(message = "SPU 名字不能为空") + private String name; + /** + * 卖点 + */ + @NotEmpty(message = "卖点不能为空") + private String sellPoint; + /** + * 描述 + */ + @NotEmpty(message = "描述不能为空") + private String description; + /** + * 分类编号 + */ + @NotNull(message = "分类编号不能为空") + private Integer cid; + /** + * 商品主图地址 + */ + @NotEmpty(message = "商品主图地址不能为空") + private List picUrls; + /** + * 是否上架商品 + */ + @NotNull(message = "是否上架商品不能为空") + private Integer visible; + /** + * 排序字段 + */ + @NotNull(message = "排序字段不能为空") + private Integer sort; + /** + * 价格 + */ + @NotNull(message = "价格不能为空") + private Integer price; + /** + * 库存数量 + */ + @NotNull(message = "库存数量不能为空") + private Integer quantity; + +} diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuPageReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuPageReqDTO.java new file mode 100644 index 000000000..d0d6600be --- /dev/null +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuPageReqDTO.java @@ -0,0 +1,25 @@ +package cn.iocoder.mall.productservice.rpc.spu.dto; + +import cn.iocoder.common.framework.vo.PageParam; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** +* 商品 SPU 分页 Request DTO +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +public class ProductSpuPageReqDTO extends PageParam { + + /** + * SPU 名字 + */ + private String name; + /** + * 是否有库存 + */ + private Boolean hasQuantity; + +} diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java new file mode 100644 index 000000000..f38cfe003 --- /dev/null +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java @@ -0,0 +1,61 @@ +package cn.iocoder.mall.productservice.rpc.spu.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; +import java.util.List; + +/** +* 商品 SPU 信息 Response DTO +*/ +@Data +@Accessors(chain = true) +public class ProductSpuRespDTO { + + /** + * 商品 SPU 编号 + */ + private Integer id; + /** + * SPU 名字 + */ + private String name; + /** + * 卖点 + */ + private String sellPoint; + /** + * 描述 + */ + private String description; + /** + * 分类编号 + */ + private Integer cid; + /** + * 商品主图地址 + */ + private List picUrls; + /** + * 是否上架商品 + */ + private Integer visible; + /** + * 排序字段 + */ + private Integer sort; + /** + * 价格 + */ + private Integer price; + /** + * 库存数量 + */ + private Integer quantity; + /** + * 创建时间 + */ + private Date createTime; + +} diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuUpdateReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuUpdateReqDTO.java new file mode 100644 index 000000000..cfc281799 --- /dev/null +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuUpdateReqDTO.java @@ -0,0 +1,68 @@ +package cn.iocoder.mall.productservice.rpc.spu.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** +* 商品 SPU 更新 Request DTO +*/ +@Data +@Accessors(chain = true) +public class ProductSpuUpdateReqDTO { + + /** + * 商品 SPU 编号 + */ + @NotNull(message = "商品 SPU 编号不能为空") + private Integer id; + /** + * SPU 名字 + */ + @NotEmpty(message = "SPU 名字不能为空") + private String name; + /** + * 卖点 + */ + @NotEmpty(message = "卖点不能为空") + private String sellPoint; + /** + * 描述 + */ + @NotEmpty(message = "描述不能为空") + private String description; + /** + * 分类编号 + */ + @NotNull(message = "分类编号不能为空") + private Integer cid; + /** + * 商品主图地址 + */ + @NotEmpty(message = "商品主图地址不能为空") + private List picUrls; + /** + * 是否上架商品 + */ + @NotNull(message = "是否上架商品不能为空") + private Integer visible; + /** + * 排序字段 + */ + @NotNull(message = "排序字段不能为空") + private Integer sort; + /** + * 价格 + */ + @NotNull(message = "价格不能为空") + private Integer price; + /** + * 库存数量 + */ + @NotNull(message = "库存数量不能为空") + private Integer quantity; + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/spu/ProductSpuConvert.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/spu/ProductSpuConvert.java new file mode 100644 index 000000000..bc2b0e042 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/spu/ProductSpuConvert.java @@ -0,0 +1,46 @@ +package cn.iocoder.mall.productservice.convert.spu; + +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.productservice.dal.mysql.dataobject.spu.ProductSpuDO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuCreateReqDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuPageReqDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuUpdateReqDTO; +import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuBO; +import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuCreateBO; +import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuPageBO; +import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuUpdateBO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface ProductSpuConvert { + + ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class); + + ProductSpuDO convert(ProductSpuCreateBO bean); + + ProductSpuBO convert(ProductSpuDO bean); + + ProductSpuDO convert(ProductSpuUpdateBO bean); + + List convertList(List list); + + PageResult convertPage(IPage page); + + ProductSpuCreateBO convert(ProductSpuCreateReqDTO bean); + + ProductSpuUpdateBO convert(ProductSpuUpdateReqDTO bean); + + ProductSpuRespDTO convert(ProductSpuBO bean); + + List convertList02(List list); + + ProductSpuPageBO convert(ProductSpuPageReqDTO bean); + + PageResult convertPage(PageResult page); + +} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSkuDO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSkuDO.java similarity index 90% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSkuDO.java rename to product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSkuDO.java index bf800bb52..9f7d7e66c 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSkuDO.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSkuDO.java @@ -1,7 +1,6 @@ -package cn.iocoder.mall.product.biz.dataobject.spu; +package cn.iocoder.mall.productservice.dal.mysql.dataobject.spu; import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import cn.iocoder.mall.product.biz.dataobject.attr.ProductAttrDO; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSpuDO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java similarity index 91% rename from product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSpuDO.java rename to product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java index d75731c04..7e9dfb4f3 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/spu/ProductSpuDO.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java @@ -1,7 +1,8 @@ -package cn.iocoder.mall.product.biz.dataobject.spu; +package cn.iocoder.mall.productservice.dal.mysql.dataobject.spu; import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** @@ -10,6 +11,7 @@ import lombok.experimental.Accessors; * TODO 芋艿,后面增加商品普通参数。例如说,正面材料,背面材料,屏幕尺寸。 */ @Data +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) public class ProductSpuDO extends DeletableDO { diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/spu/ProductSpuMapper.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/spu/ProductSpuMapper.java new file mode 100644 index 000000000..dadd89d0c --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/spu/ProductSpuMapper.java @@ -0,0 +1,27 @@ +package cn.iocoder.mall.productservice.dal.mysql.mapper.spu; + +import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; +import cn.iocoder.mall.productservice.dal.mysql.dataobject.spu.ProductSpuDO; +import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuPageBO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Repository; + +@Repository +public interface ProductSpuMapper extends BaseMapper { + + default IPage selectPage(ProductSpuPageBO pageBO) { + QueryWrapperX query = new QueryWrapperX().likeIfPresent("name", pageBO.getName()); + // 库存过滤 + if (pageBO.getHasQuantity() != null) { + if (pageBO.getHasQuantity()) { + query.gt("quantity", 0); + } else { + query.eq("quantity", 0); + } + } + return selectPage(new Page<>(pageBO.getPageNo(), pageBO.getPageSize()), query); + } + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java new file mode 100644 index 000000000..7cd5f8228 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java @@ -0,0 +1,77 @@ +package cn.iocoder.mall.productservice.manager.spu; + +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.productservice.convert.spu.ProductSpuConvert; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuCreateReqDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuPageReqDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuUpdateReqDTO; +import cn.iocoder.mall.productservice.service.spu.ProductSpuService; +import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuBO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* 商品 SPU Manager +*/ +@Service +public class ProductSpuManager { + + @Autowired + private ProductSpuService productSpuService; + + /** + * 创建商品 SPU + * + * @param createDTO 创建商品 SPU DTO + * @return 商品 SPU + */ + public Integer createProductSpu(ProductSpuCreateReqDTO createDTO) { + ProductSpuBO productSpuBO = productSpuService.createProductSpu(ProductSpuConvert.INSTANCE.convert(createDTO)); + return productSpuBO.getId(); + } + + /** + * 更新商品 SPU + * + * @param updateDTO 更新商品 SPU DTO + */ + public void updateProductSpu(ProductSpuUpdateReqDTO updateDTO) { + productSpuService.updateProductSpu(ProductSpuConvert.INSTANCE.convert(updateDTO)); + } + + /** + * 获得商品 SPU + * + * @param productSpuId 商品 SPU编号 + * @return 商品 SPU + */ + public ProductSpuRespDTO getProductSpu(Integer productSpuId) { + ProductSpuBO productSpuBO = productSpuService.getProductSpu(productSpuId); + return ProductSpuConvert.INSTANCE.convert(productSpuBO); + } + + /** + * 获得商品 SPU列表 + * + * @param productSpuIds 商品 SPU编号列表 + * @return 商品 SPU列表 + */ + public List listProductSpus(List productSpuIds) { + List productSpuBOs = productSpuService.listProductSpus(productSpuIds); + return ProductSpuConvert.INSTANCE.convertList02(productSpuBOs); + } + + /** + * 获得商品 SPU分页 + * + * @param pageDTO 商品 SPU分页查询 + * @return 商品 SPU分页结果 + */ + public PageResult pageProductSpu(ProductSpuPageReqDTO pageDTO) { + PageResult pageResultBO = productSpuService.pageProductSpu(ProductSpuConvert.INSTANCE.convert(pageDTO)); + return ProductSpuConvert.INSTANCE.convertPage(pageResultBO); + } +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuRpcImpl.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuRpcImpl.java new file mode 100644 index 000000000..cb289c1fd --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuRpcImpl.java @@ -0,0 +1,52 @@ +package cn.iocoder.mall.productservice.rpc.spu; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.productservice.manager.spu.ProductSpuManager; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuCreateReqDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuPageReqDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuUpdateReqDTO; +import org.apache.dubbo.config.annotation.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +import static cn.iocoder.common.framework.vo.CommonResult.success; + +/** +* 商品 SPU Rpc 实现类 +*/ +@Service(version = "${dubbo.provider.ProductSpuRpc.version}") +public class ProductSpuRpcImpl implements ProductSpuRpc { + + @Autowired + private ProductSpuManager productSpuManager; + + @Override + public CommonResult createProductSpu(ProductSpuCreateReqDTO createDTO) { + return success(productSpuManager.createProductSpu(createDTO)); + } + + @Override + public CommonResult updateProductSpu(ProductSpuUpdateReqDTO updateDTO) { + productSpuManager.updateProductSpu(updateDTO); + return success(true); + } + + @Override + public CommonResult getProductSpu(Integer productSpuId) { + return success(productSpuManager.getProductSpu(productSpuId)); + } + + @Override + public CommonResult> listProductSpus(List productSpuIds) { + return success(productSpuManager.listProductSpus(productSpuIds)); + } + + @Override + public CommonResult> pageProductSpu(ProductSpuPageReqDTO pageDTO) { + return success(productSpuManager.pageProductSpu(pageDTO)); + } + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/ProductSpuService.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/ProductSpuService.java new file mode 100644 index 000000000..773e5a9d3 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/ProductSpuService.java @@ -0,0 +1,94 @@ +package cn.iocoder.mall.productservice.service.spu; + +import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.productservice.convert.spu.ProductSpuConvert; +import cn.iocoder.mall.productservice.dal.mysql.dataobject.spu.ProductSpuDO; +import cn.iocoder.mall.productservice.dal.mysql.mapper.spu.ProductSpuMapper; +import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuBO; +import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuCreateBO; +import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuPageBO; +import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuUpdateBO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.List; + +import static cn.iocoder.mall.productservice.enums.ProductErrorCodeConstants.PRODUCT_SPU_NOT_EXISTS; + +/** +* 商品 SPU Service +*/ +@Service +@Validated +public class ProductSpuService { + + @Autowired + private ProductSpuMapper productSpuMapper; + + /** + * 创建商品 SPU + * + * @param createBO 创建商品 SPU BO + * @return 商品 SPU + */ + public ProductSpuBO createProductSpu(@Valid ProductSpuCreateBO createBO) { + // 插入到数据库 + ProductSpuDO productSpuDO = ProductSpuConvert.INSTANCE.convert(createBO); + productSpuMapper.insert(productSpuDO); + // 返回 + return ProductSpuConvert.INSTANCE.convert(productSpuDO); + } + + /** + * 更新商品 SPU + * + * @param updateBO 更新商品 SPU BO + */ + public void updateProductSpu(@Valid ProductSpuUpdateBO updateBO) { + // 校验更新的商品 SPU是否存在 + if (productSpuMapper.selectById(updateBO.getId()) == null) { + throw ServiceExceptionUtil.exception(PRODUCT_SPU_NOT_EXISTS); + } + // 更新到数据库 + ProductSpuDO updateObject = ProductSpuConvert.INSTANCE.convert(updateBO); + productSpuMapper.updateById(updateObject); + } + + /** + * 获得商品 SPU + * + * @param productSpuId 商品 SPU编号 + * @return 商品 SPU + */ + public ProductSpuBO getProductSpu(Integer productSpuId) { + ProductSpuDO productSpuDO = productSpuMapper.selectById(productSpuId); + return ProductSpuConvert.INSTANCE.convert(productSpuDO); + } + + /** + * 获得商品 SPU列表 + * + * @param productSpuIds 商品 SPU编号列表 + * @return 商品 SPU列表 + */ + public List listProductSpus(List productSpuIds) { + List productSpuDOs = productSpuMapper.selectBatchIds(productSpuIds); + return ProductSpuConvert.INSTANCE.convertList(productSpuDOs); + } + + /** + * 获得商品 SPU分页 + * + * @param pageBO 商品 SPU分页查询 + * @return 商品 SPU分页结果 + */ + public PageResult pageProductSpu(ProductSpuPageBO pageBO) { + IPage productSpuDOPage = productSpuMapper.selectPage(pageBO); + return ProductSpuConvert.INSTANCE.convertPage(productSpuDOPage); + } + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java new file mode 100644 index 000000000..d752180c6 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java @@ -0,0 +1,61 @@ +package cn.iocoder.mall.productservice.service.spu.bo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; +import java.util.List; + +/** +* 商品 SPU 信息 BO +*/ +@Data +@Accessors(chain = true) +public class ProductSpuBO { + + /** + * 商品 SPU 编号 + */ + private Integer id; + /** + * SPU 名字 + */ + private String name; + /** + * 卖点 + */ + private String sellPoint; + /** + * 描述 + */ + private String description; + /** + * 分类编号 + */ + private Integer cid; + /** + * 商品主图地址 + */ + private List picUrls; + /** + * 是否上架商品 + */ + private Integer visible; + /** + * 排序字段 + */ + private Integer sort; + /** + * 价格 + */ + private Integer price; + /** + * 库存数量 + */ + private Integer quantity; + /** + * 创建时间 + */ + private Date createTime; + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java new file mode 100644 index 000000000..60f1892d5 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java @@ -0,0 +1,63 @@ +package cn.iocoder.mall.productservice.service.spu.bo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** +* 商品 SPU 创建 BO +*/ +@Data +@Accessors(chain = true) +public class ProductSpuCreateBO { + + /** + * SPU 名字 + */ + @NotEmpty(message = "SPU 名字不能为空") + private String name; + /** + * 卖点 + */ + @NotEmpty(message = "卖点不能为空") + private String sellPoint; + /** + * 描述 + */ + @NotEmpty(message = "描述不能为空") + private String description; + /** + * 分类编号 + */ + @NotNull(message = "分类编号不能为空") + private Integer cid; + /** + * 商品主图地址 + */ + @NotEmpty(message = "商品主图地址不能为空") + private List picUrls; + /** + * 是否上架商品 + */ + @NotNull(message = "是否上架商品不能为空") + private Integer visible; + /** + * 排序字段 + */ + @NotNull(message = "排序字段不能为空") + private Integer sort; + /** + * 价格 + */ + @NotNull(message = "价格不能为空") + private Integer price; + /** + * 库存数量 + */ + @NotNull(message = "库存数量不能为空") + private Integer quantity; + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuPageBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuPageBO.java new file mode 100644 index 000000000..46444b261 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuPageBO.java @@ -0,0 +1,25 @@ +package cn.iocoder.mall.productservice.service.spu.bo; + +import cn.iocoder.common.framework.vo.PageParam; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** +* 商品 SPU 分页 BO +*/ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +public class ProductSpuPageBO extends PageParam { + + /** + * SPU 名字 + */ + private String name; + /** + * 是否有库存 + */ + private Boolean hasQuantity; + +} diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java new file mode 100644 index 000000000..aaf1faa36 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java @@ -0,0 +1,68 @@ +package cn.iocoder.mall.productservice.service.spu.bo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** +* 商品 SPU 更新 BO +*/ +@Data +@Accessors(chain = true) +public class ProductSpuUpdateBO { + + /** + * 商品 SPU 编号 + */ + @NotNull(message = "商品 SPU 编号不能为空") + private Integer id; + /** + * SPU 名字 + */ + @NotEmpty(message = "SPU 名字不能为空") + private String name; + /** + * 卖点 + */ + @NotEmpty(message = "卖点不能为空") + private String sellPoint; + /** + * 描述 + */ + @NotEmpty(message = "描述不能为空") + private String description; + /** + * 分类编号 + */ + @NotNull(message = "分类编号不能为空") + private Integer cid; + /** + * 商品主图地址 + */ + @NotEmpty(message = "商品主图地址不能为空") + private List picUrls; + /** + * 是否上架商品 + */ + @NotNull(message = "是否上架商品不能为空") + private Integer visible; + /** + * 排序字段 + */ + @NotNull(message = "排序字段不能为空") + private Integer sort; + /** + * 价格 + */ + @NotNull(message = "价格不能为空") + private Integer price; + /** + * 库存数量 + */ + @NotNull(message = "库存数量不能为空") + private Integer quantity; + +} diff --git a/product-service-project/product-service-app/src/main/resources/application.yaml b/product-service-project/product-service-app/src/main/resources/application.yaml index 1216dffa9..f79c0380a 100644 --- a/product-service-project/product-service-app/src/main/resources/application.yaml +++ b/product-service-project/product-service-app/src/main/resources/application.yaml @@ -38,6 +38,8 @@ dubbo: version: 1.0.0 ProductBrandRpc: version: 1.0.0 + ProductSpuRpc: + version: 1.0.0 # Dubbo 服务消费者的配置 consumer: ErrorCodeRpc: diff --git a/product/pom.xml b/product/pom.xml index eaf283845..4926a772e 100644 --- a/product/pom.xml +++ b/product/pom.xml @@ -14,13 +14,10 @@ pom - product-application product-rpc-api product-rpc product-rest product-biz - product-biz-api - product-mq diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java deleted file mode 100644 index 85ac8d80e..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java +++ /dev/null @@ -1,59 +0,0 @@ -package cn.iocoder.mall.product.dataobject; - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 商品 SKU - */ -@Data -@Accessors(chain = true) -public class ProductSkuDO extends DeletableDO { - - /** - * sku 编号 - */ - private Integer id; - /** - * 商品编号 - */ - private Integer spuId; - - // TODO 店铺编号 - - /** - * 状态 - * - * 1-正常 - * 2-禁用 - */ - private Integer status; - /** - * 图片地址 - */ - private String picUrl; - /** - * 规格值({@link ProductAttrDO})数组 - * - * 数组,以逗号分隔 - */ - private String attrs; - /** - * 价格,单位:分 - */ - private Integer price; - /** - * 库存数量 - */ - private Integer quantity; -// /** -// * 商品在付款减库存的状态下,该Sku上未付款的订单数量 -// */ -// private Integer withHoldQuantity; -// /** -// * 销量 -// */ -// private Integer soldNum; - -} diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java deleted file mode 100644 index 18aa70805..000000000 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java +++ /dev/null @@ -1,78 +0,0 @@ -package cn.iocoder.mall.product.dataobject; - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 商品 SPU - * - * TODO 芋艿,后面增加商品普通参数。例如说,正面材料,背面材料,屏幕尺寸。 - */ -@Data -@Accessors(chain = true) -public class ProductSpuDO extends DeletableDO { - - /** - * SPU 编号 - */ - private Integer id; - - // TODO 店铺编号 先不考虑,因为第一个版本,不做 B2B2C - - // ========== 基本信息 ========= - /** - * SPU 名字 - */ - private String name; - /** - * 卖点 - */ - private String sellPoint; - /** - * 描述 - */ - private String description; - /** - * 分类编号 - */ - private Integer cid; - /** - * 商品主图地址 - * - * 数组,以逗号分隔 - * - * 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张 - */ - private String picUrls; - - // TODO 运费信息 - - // ========== 其他信息 ========= - /** - * 是否上架商品(是否可见)。 - * - * true 为已上架 - * false 为已下架 - */ - private Boolean visible; - /** - * 排序字段 - */ - private Integer sort; - - // ========== Sku 相关字段 ========= - /** - * 价格 - * - * 目前的计算方式是,以 Sku 最小价格为准 - */ - private Integer price; - /** - * 库存数量 - * - * 目前的计算方式是,以 Sku 库存累加为准 - */ - private Integer quantity; - -} diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductCategoryController.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductCategoryController.java deleted file mode 100644 index 8e2b6603a..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductCategoryController.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.iocoder.mall.product.application.controller.users; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.product.api.ProductCategoryService; -import cn.iocoder.mall.product.api.bo.ProductCategoryBO; -import cn.iocoder.mall.product.application.convert.ProductCategoryConvert; -import cn.iocoder.mall.product.application.vo.users.UsersProductCategoryVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.apache.dubbo.config.annotation.Reference; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -@RestController -@RequestMapping("users/category") -@Api("商品分类") -public class UsersProductCategoryController { - - @Reference(validation = "true", version = "${dubbo.provider.ProductCategoryService.version}") - @Autowired - private ProductCategoryService productCategoryService; - - @GetMapping("/list") - @ApiOperation("获得指定编号下的子分类的数组") - @ApiImplicitParam(name = "pid", value = "指定分类编号", required = true, example = "0") - public CommonResult> list(@RequestParam("pid") Integer pid) { - List result = productCategoryService.getListByPid(pid); - return CommonResult.success(ProductCategoryConvert.Users.INSTANCE.convertToVO(result)); - } - -} diff --git a/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/users/UsersProductCategoryVO.java b/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/users/UsersProductCategoryVO.java deleted file mode 100644 index 57b158e02..000000000 --- a/product/product-start/src/main/java/cn/iocoder/mall/product/application/vo/users/UsersProductCategoryVO.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.product.application.vo.users; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -@ApiModel("商品分类(简单)") -@Data -@Accessors(chain = true) -public class UsersProductCategoryVO { - - @ApiModelProperty(value = "分类编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "分类名", required = true, example = "手机") - private String name; - @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") - private String picUrl; - -}