移除商品推荐的逻辑

This commit is contained in:
YunaiV
2022-11-05 01:19:25 +08:00
parent fcea893ec9
commit 479a05b5d7
52 changed files with 0 additions and 2783 deletions

View File

@@ -1,36 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.activity;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO;
import cn.iocoder.mall.managementweb.manager.promotion.activity.PromotionActivityManager;
import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.common.framework.vo.CommonResult.success;
@RestController
@RequestMapping("/promotion/activity")
@Api(tags = "促销活动 API")
@Validated
public class PromotionActivityController {
@Autowired
private PromotionActivityManager promotionActivityManager;
// TODO 芋艿DTO => VO
@GetMapping("/page")
@ApiOperation("获得促销活动分页")
@RequiresPermissions("promotion:activity:page")
public CommonResult<PageResult<PromotionActivityRespDTO>> pagePromotionActivity(PromotionActivityPageReqVO pageReqVO) {
return success(promotionActivityManager.pagePromotionActivity(pageReqVO));
}
}

View File

@@ -1,26 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.activity.vo;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Collection;
/**
* 促销活动分页 Request DTO
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class PromotionActivityPageReqVO extends PageParam {
@ApiModelProperty(value = "标题", example = "优惠劵牛逼")
private String title;
@ApiModelProperty(value = "活动类型", example = "1", notes = "参见 PromotionActivityTypeEnum 枚举")
private Integer activityType;
@ApiModelProperty(value = "状态数组", example = "1,2", notes = "参考 PromotionActivityStatusEnum 枚举")
private Collection<Integer> statuses;
}

View File

@@ -1,65 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.brand;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerCreateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerPageReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerRespVO;
import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerUpdateReqVO;
import cn.iocoder.mall.managementweb.manager.promotion.brand.BannerManager;
import cn.iocoder.security.annotations.RequiresPermissions;
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 static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* Banner Controller
*/
@RestController
@RequestMapping("/promotion/banner")
@Api(tags = "Banner API")
@Validated
public class BannerController {
@Autowired
private BannerManager bannerManager;
@PostMapping("/create")
@ApiOperation("创建 Banner")
@RequiresPermissions("promotion:banner:create")
public CommonResult<Integer> createBanner(@Valid BannerCreateReqVO createVO) {
return success(bannerManager.createBanner(createVO));
}
@PostMapping("/update")
@ApiOperation("更新 Banner")
@RequiresPermissions("promotion:banner:update")
public CommonResult<Boolean> updateBanner(@Valid BannerUpdateReqVO updateVO) {
bannerManager.updateBanner(updateVO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除 Banner")
@ApiImplicitParam(name = "bannerId", value = " Banner 编号", required = true)
@RequiresPermissions("promotion:banner:delete")
public CommonResult<Boolean> deleteBanner(@RequestParam("bannerId") Integer bannerId) {
bannerManager.deleteBanner(bannerId);
return success(true);
}
@GetMapping("/page")
@ApiOperation("获得 Banner 分页")
@RequiresPermissions("promotion:banner:page")
public CommonResult<PageResult<BannerRespVO>> pageBanner(BannerPageReqVO pageVO) {
return success(bannerManager.pageBanner(pageVO));
}
}

View File

@@ -1,43 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.brand.vo;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("Banner 创建 Request VO")
@Data
public class BannerCreateReqVO {
@ApiModelProperty(value = "标题", required = true, example = "活动 A")
@NotEmpty(message = "标题不能为空")
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
private String title;
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
@NotEmpty(message = "跳转链接不能为空")
@URL(message = "跳转链接格式不正确")
@Length(max = 255, message = "跳转链接最大长度为 255 位")
private String url;
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.iocoder.cn/01.jpg")
@NotEmpty(message = "跳转链接不能为空")
@URL(message = "图片链接格式不正确")
@Length(max = 255, message = "图片链接最大长度为 255 位")
private String picUrl;
@ApiModelProperty(value = "排序", required = true, example = "10")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
@ApiModelProperty(value = "备注", example = "这个活动很牛逼")
@Length(max = 255, message = "备注最大长度为 255 位")
private String memo;
}

View File

@@ -1,17 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.brand.vo;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("Banner 分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class BannerPageReqVO extends PageParam {
@ApiModelProperty(value = "标题", required = true, example = "活动 A")
private String title;
}

View File

@@ -1,32 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.brand.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@ApiModel("Banner VO")
@Data
@Accessors(chain = true)
public class BannerRespVO {
@ApiModelProperty(value = "Banner 编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "标题", required = true, example = "活动 A")
private String title;
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
private String url;
@ApiModelProperty(value = "图片链接", required = true, example = "http://www.iocoder.cn/01.jpg")
private String picUrl;
@ApiModelProperty(value = "排序", required = true, example = "10")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1")
private Integer status;
@ApiModelProperty(value = "备注", example = "这个活动很牛逼")
private String memo;
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
private Date createTime;
}

View File

@@ -1,43 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.brand.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("Banner 更新 Request VO")
@Data
public class BannerUpdateReqVO {
@ApiModelProperty(value = "Banner 编号", required = true, example = "1")
@NotNull(message = "编号不能为空")
private Integer id;
@ApiModelProperty(value = "标题", required = true, example = "活动 A")
@NotEmpty(message = "标题不能为空")
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
private String title;
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
@NotEmpty(message = "跳转链接不能为空")
@URL(message = "跳转链接格式不正确")
@Length(max = 255, message = "跳转链接最大长度为 255 位")
private String url;
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.iocoder.cn/01.jpg")
@NotEmpty(message = "跳转链接不能为空")
@URL(message = "图片链接格式不正确")
@Length(max = 255, message = "图片链接最大长度为 255 位")
private String picUrl;
@ApiModelProperty(value = "排序", required = true, example = "10")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1")
@NotNull(message = "状态不能为空")
private Integer status;
@ApiModelProperty(value = "备注", example = "这个活动很牛逼")
@Length(max = 255, message = "备注最大长度为 255 位")
private String memo;
}

View File

@@ -1,71 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.coupon;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplatePageReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateRespVO;
import cn.iocoder.mall.managementweb.manager.promotion.coupon.CouponTemplateManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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 static cn.iocoder.common.framework.vo.CommonResult.success;
@RestController
@RequestMapping("/promotion/coupon-template")
@Api(tags = "优惠劵(码)模板 API")
@Validated
public class CouponTemplateController {
@Autowired
private CouponTemplateManager couponTemplateManager;
// ========== 通用逻辑 =========
@GetMapping("/page")
@ApiOperation("获得优惠劵模板分页")
@RequiresPermissions("promotion:coupon-template:page")
public CommonResult<PageResult<CouponTemplateRespVO>> pageCouponTemplate(CouponTemplatePageReqVO pageVO) {
return success(couponTemplateManager.pageCouponTemplate(pageVO));
}
@PostMapping("/update-status")
@ApiOperation("更新优惠劵(码)模板的状态")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "优惠劵(码)模板编号", required = true, example = "1"),
@ApiImplicitParam(name = "status", value = "状态。1 - 开启2 - 禁用", required = true, example = "1"),
})
@RequiresPermissions("promotion:coupon-template:update-status")
public CommonResult<Boolean> updateCouponTemplateStatus(@RequestParam("id") Integer id,
@RequestParam("status") Integer status) {
couponTemplateManager.updateCouponTemplateStatus(id, status);
return success(true);
}
// ========== 优惠劵模板 ==========
@PostMapping("/create-card")
@ApiOperation("创建优惠劵模板")
@RequiresPermissions("promotion:coupon-template:create-card")
public CommonResult<Integer> createCouponCardTemplate(@Valid CouponTemplateCardCreateReqVO createVO) {
return success(couponTemplateManager.createCouponCardTemplate(createVO));
}
@PostMapping("/update-card")
@ApiOperation("更新优惠劵模板")
@RequiresPermissions("promotion:coupon-template:update-card")
public CommonResult<Boolean> updateCouponCardTemplate(@Valid CouponTemplateCardUpdateReqVO updateVO) {
couponTemplateManager.updateCouponCardTemplate(updateVO);
return success(true);
}
}

View File

@@ -1,84 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum;
import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum;
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateDateTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
@ApiModel("优惠劵模板创建 Request VO")
@Data
@Accessors(chain = true)
public class CouponTemplateCardCreateReqVO {
// ========== 基本信息 BEGIN ==========
@ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼")
@NotEmpty(message = "标题不能为空")
@Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位")
private String title;
@ApiModelProperty(value = "使用说明", required = true, example = "我只是描述")
@Length(max = 255, message = "使用说明最大长度为 {max} 位")
private String description;
@ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制")
@Min(value = 1, message = "每人限领个数最小为 {value}")
private Integer quota;
@ApiModelProperty(value = "发放总量", example = "100")
@Min(value = 1, message = "每人限领个数最小为 {value}")
private Integer total;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
@ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0", notes = "0-不限制大于0-多少金额可用")
@Min(value = 0L, message = "使用金额门槛最低为 {value}")
private Integer priceAvailable;
@ApiModelProperty(value = "可用范围的类型", required = true, example = "10", notes = "参见 RangeTypeEnum 枚举")
@NotNull(message = "可用范围的类型不能为空")
@InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}")
private Integer rangeType;
@ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5")
private String rangeValues;
@ApiModelProperty(value = "生效日期类型", example = "1", notes = "参见 CouponTemplateDateTypeEnum 枚举")
@NotNull(message = "生效日期类型不能为空")
@InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}")
private Integer dateType;
@ApiModelProperty(value = "固定日期-生效开始时间", notes = "当 dateType 为固定日期时,非空")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date validStartTime;
@ApiModelProperty(value = "固定日期-生效结束时间", notes = "当 dateType 为固定日期时,非空")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date validEndTime;
@ApiModelProperty(value = "领取日期-开始天数", example = "0", notes = "例如0-当天1-次天")
@Min(value = 0L, message = "领取日期开始时间最小为 {value}")
private Integer fixedStartTerm;
@ApiModelProperty(value = "领取日期-结束天数", example = "1", notes = "当 dateType 为领取日期时,非空")
@Min(value = 1L, message = "领取日期结束时间最小为 {value}")
private Integer fixedEndTerm;
// ========== 使用效果 BEGIN ==========
@ApiModelProperty(value = "优惠类型", required = true, example = "1", notes = "参见 PreferentialTypeEnum 枚举")
@NotNull(message = "优惠类型不能为空")
@InEnum(value = PreferentialTypeEnum.class, message = "优惠类型必须在 {value}")
private Integer preferentialType;
@ApiModelProperty(value = "折扣百分比", example = "80", notes = "当 preferentialType 为现金券时,非空")
@Max(value = 100, message = "折扣比最大值为 {value}")
private Integer percentOff;
@ApiModelProperty(value = "优惠金额,单位:分", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
@Min(value = 1, message = "优惠金额最小值为 {value}")
private Integer priceOff;
@ApiModelProperty(value = "折扣上限", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
@Min(value = 1, message = "折扣上限最小值为 {value}")
private Integer discountPriceLimit;
// ========== 使用效果 END ==========
}

View File

@@ -1,47 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("优惠劵模板更新 Request VO")
@Data
@Accessors(chain = true)
public class CouponTemplateCardUpdateReqVO {
// ========== 基本信息 BEGIN ==========
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
@NotNull(message = "编号不能为空")
private Integer id;
@ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼")
@NotEmpty(message = "标题不能为空")
@Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位")
private String title;
@ApiModelProperty(value = "使用说明", required = true, example = "我只是描述")
@Length(max = 255, message = "使用说明最大长度为 {max} 位")
private String description;
@ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制")
@Min(value = 1, message = "每人限领个数最小为 {value}")
private Integer quota;
@ApiModelProperty(value = "发放总量", example = "100")
@Min(value = 1, message = "每人限领个数最小为 {value}")
private Integer total;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
@NotNull(message = "可用范围的类型不能为空")
@InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}")
private Integer rangeType;
@ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5")
private String rangeValues;
// ========== 使用规则 END ==========
}

View File

@@ -1,23 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("优惠劵(码)模板分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class CouponTemplatePageReqVO extends PageParam {
@ApiModelProperty(value = "类型", example = "1", notes = "参考 CouponTemplateTypeEnum 枚举")
private Integer type;
@ApiModelProperty(value = "标题", example = "优惠劵牛逼")
private String title;
@ApiModelProperty(value = "状态", example = "1", notes = "参考 CouponTemplateStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "优惠类型", example = "1", notes = "参见 PreferentialTypeEnum 枚举")
private Integer preferentialType;
}

View File

@@ -1,80 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
@ApiModel("优惠劵(码)模板 VO")
@Data
@Accessors(chain = true)
public class CouponTemplateRespVO {
// ========== 基本信息 BEGIN ==========
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼")
private String title;
@ApiModelProperty(value = "使用说明", required = true, example = "我只是描述")
private String description;
@ApiModelProperty(value = "优惠劵类型", required = true, example = "1", notes = "参见 CouponTemplateTypeEnum 枚举")
private Integer type;
/**
* 码类型
*
* 1-一卡一码UNIQUE
* 2-通用码GENERAL
*
* 【优惠码独有】 @see CouponCodeDO
*/
private Integer codeType;
@ApiModelProperty(value = "优惠码状态", required = true, example = "1", notes = "参见 CouponTemplateStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制")
private Integer quota;
@ApiModelProperty(value = "发放总量", example = "100")
private Integer total;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
@ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0", notes = "0-不限制大于0-多少金额可用")
private Integer priceAvailable;
@ApiModelProperty(value = "可用范围的类型", required = true, example = "10", notes = "参见 RangeTypeEnum 枚举")
private Integer rangeType;
@ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5")
private List<Integer> rangeValues;
@ApiModelProperty(value = "生效日期类型", example = "1", notes = "参见 CouponTemplateDateTypeEnum 枚举")
private Integer dateType;
@ApiModelProperty(value = "固定日期-生效开始时间", notes = "当 dateType 为固定日期时,非空")
private Date validStartTime;
@ApiModelProperty(value = "固定日期-生效结束时间", notes = "当 dateType 为固定日期时,非空")
private Date validEndTime;
@ApiModelProperty(value = "领取日期-开始天数", example = "0", notes = "例如0-当天1-次天")
private Integer fixedStartTerm;
@ApiModelProperty(value = "领取日期-结束天数", example = "1", notes = "当 dateType 为领取日期时,非空")
private Integer fixedEndTerm;
// ========== 使用规则 END ==========
// ========== 使用效果 BEGIN ==========
@ApiModelProperty(value = "优惠类型", required = true, example = "1", notes = "参见 PreferentialTypeEnum 枚举")
private Integer preferentialType;
@ApiModelProperty(value = "折扣百分比", example = "80", notes = "当 preferentialType 为现金券时,非空")
private Integer percentOff;
@ApiModelProperty(value = "优惠金额,单位:分", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
private Integer priceOff;
@ApiModelProperty(value = "折扣上限", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
private Integer discountPriceLimit;
// ========== 使用效果 END ==========
// ========== 统计信息 BEGIN ==========
@ApiModelProperty(value = "领取优惠券的次数", required = true)
private Integer statFetchNum;
// ========== 统计信息 END ==========
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -1,60 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.recommend;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendCreateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendDetailVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendPageReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendUpdateReqVO;
import cn.iocoder.mall.managementweb.manager.promotion.recommend.ProductRecommendManager;
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 static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品推荐 Controller
*/
@RestController
@RequestMapping("/promotion/product-recommend")
@Api(tags = "商品推荐")
@Validated
public class ProductRecommendController {
@Autowired
private ProductRecommendManager productRecommendManager;
@PostMapping("/create")
@ApiOperation("创建商品推荐")
public CommonResult<Integer> createProductRecommend(@Valid ProductRecommendCreateReqVO createVO) {
return success(productRecommendManager.createProductRecommend(createVO));
}
@PostMapping("/update")
@ApiOperation("更新商品推荐")
public CommonResult<Boolean> updateProductRecommend(@Valid ProductRecommendUpdateReqVO updateVO) {
productRecommendManager.updateProductRecommend(updateVO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除商品推荐")
@ApiImplicitParam(name = "productRecommendId", value = "商品推荐编号", required = true)
public CommonResult<Boolean> deleteProductRecommend(@RequestParam("productRecommendId") Integer productRecommendId) {
productRecommendManager.deleteProductRecommend(productRecommendId);
return success(true);
}
@GetMapping("/page")
@ApiOperation("获得商品推荐分页")
public CommonResult<PageResult<ProductRecommendDetailVO>> pageProductRecommend(ProductRecommendPageReqVO pageVO) {
return success(productRecommendManager.pageProductRecommend(pageVO));
}
}

View File

@@ -1,33 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@ApiModel("商品推荐创建 Request VO")
@Data
public class ProductRecommendCreateReqVO {
@ApiModelProperty(value = "类型", example = "1", required = true, notes = "参见 ProductRecommendTypeEnum 枚举")
@NotNull(message = "类型不能为空")
@InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}")
private Integer type;
@ApiModelProperty(value = "商品 Spu 编号", required = true, example = "1")
@NotNull(message = "商品 Spu 编号不能为空")
private Integer productSpuId;
@ApiModelProperty(value = "排序", required = true, example = "1")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
@ApiModelProperty(value = "备注", example = "我是备注")
private String memo;
}

View File

@@ -1,43 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@ApiModel("商品推荐明细 VO")
@Data
@Accessors(chain = true)
public class ProductRecommendDetailVO {
@ApiModelProperty(value = "编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "推荐类型", required = true, example = "1", notes = "参见 ProductRecommendTypeEnum 枚举")
private Integer type;
@ApiModelProperty(value = "商品编号", required = true, example = "1")
private Integer productSpuId;
@ApiModelProperty(value = "排序", required = true, example = "10")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "备注", required = true, example = "这个活动很牛逼")
private String memo;
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
private Date createTime;
/**
* 商品信息
*/
private Spu spu;
@ApiModel("商品信息")
@Data
public static class Spu {
@ApiModelProperty(value = "SPU 名字", required = true, example = "厮大牛逼")
private String name;
}
}

View File

@@ -1,20 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.common.framework.vo.PageParam;
import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("商品推荐分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class ProductRecommendPageReqVO extends PageParam {
@ApiModelProperty(value = "类型", example = "1", notes = "参见 ProductRecommendTypeEnum 枚举")
@InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}")
private Integer type;
}

View File

@@ -1,36 +0,0 @@
package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@ApiModel("商品推荐更新 Request VO")
@Data
public class ProductRecommendUpdateReqVO {
@ApiModelProperty(value = "编号", required = true, example = "1")
@NotNull(message = "编号不能为空")
private Integer id;
@ApiModelProperty(value = "类型", example = "1", required = true, notes = "参见 ProductRecommendTypeEnum 枚举")
@NotNull(message = "类型不能为空")
@InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}")
private Integer type;
@ApiModelProperty(value = "商品 Spu 编号", required = true, example = "1")
@NotNull(message = "商品 Spu 编号不能为空")
private Integer productSpuId;
@ApiModelProperty(value = "排序", required = true, example = "1")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
@ApiModelProperty(value = "备注", example = "我是备注")
private String memo;
}

View File

@@ -1,28 +0,0 @@
package cn.iocoder.mall.managementweb.convert.promotion;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplatePageReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateRespVO;
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateCreateReqDTO;
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateReqDTO;
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplatePageReqDTO;
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface CouponTemplateConvert {
CouponTemplateConvert INSTANCE = Mappers.getMapper(CouponTemplateConvert.class);
CouponCardTemplateUpdateReqDTO convert(CouponTemplateCardUpdateReqVO bean);
CouponTemplatePageReqDTO convert(CouponTemplatePageReqVO bean);
PageResult<CouponTemplateRespVO> convertPage(PageResult<CouponTemplateRespDTO> page);
CouponCardTemplateCreateReqDTO convert(CouponTemplateCardCreateReqVO bean);
}

View File

@@ -1,31 +0,0 @@
package cn.iocoder.mall.managementweb.convert.promotion;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendCreateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendDetailVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendPageReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendUpdateReqVO;
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO;
import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendCreateReqDTO;
import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendPageReqDTO;
import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO;
import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendUpdateReqDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface ProductRecommendConvert {
ProductRecommendConvert INSTANCE = Mappers.getMapper(ProductRecommendConvert.class);
ProductRecommendCreateReqDTO convert(ProductRecommendCreateReqVO bean);
ProductRecommendUpdateReqDTO convert(ProductRecommendUpdateReqVO bean);
ProductRecommendPageReqDTO convert(ProductRecommendPageReqVO bean);
PageResult<ProductRecommendDetailVO> convertPage(PageResult<ProductRecommendRespDTO> page);
ProductRecommendDetailVO.Spu convert(ProductSpuRespDTO bean);
}

View File

@@ -1,15 +0,0 @@
package cn.iocoder.mall.managementweb.convert.promotion;
import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO;
import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface PromotionActivityConvert {
PromotionActivityConvert INSTANCE = Mappers.getMapper(PromotionActivityConvert.class);
PromotionActivityPageReqDTO convert(PromotionActivityPageReqVO bean);
}

View File

@@ -1,31 +0,0 @@
package cn.iocoder.mall.managementweb.manager.promotion.activity;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO;
import cn.iocoder.mall.managementweb.convert.promotion.PromotionActivityConvert;
import cn.iocoder.mall.promotion.api.rpc.activity.PromotionActivityFeign;
import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 促销活动 Manager
*/
@Service
@Validated
public class PromotionActivityManager {
@Autowired
private PromotionActivityFeign promotionActivityFeign;
public PageResult<PromotionActivityRespDTO> pagePromotionActivity(PromotionActivityPageReqVO pageReqVO) {
CommonResult<PageResult<PromotionActivityRespDTO>> pagePromotionActivityResult = promotionActivityFeign.pagePromotionActivity(
PromotionActivityConvert.INSTANCE.convert(pageReqVO));
pagePromotionActivityResult.checkError();
return pagePromotionActivityResult.getData();
}
}

View File

@@ -1,54 +0,0 @@
package cn.iocoder.mall.managementweb.manager.promotion.coupon;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplatePageReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateRespVO;
import cn.iocoder.mall.managementweb.convert.promotion.CouponTemplateConvert;
import cn.iocoder.mall.promotion.api.rpc.coupon.CouponTemplateFeign;
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateStatusReqDTO;
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@Service
@Validated
public class CouponTemplateManager {
@Autowired
private CouponTemplateFeign couponTemplateFeign;
// ========== 通用逻辑 =========
public PageResult<CouponTemplateRespVO> pageCouponTemplate(CouponTemplatePageReqVO pageVO) {
CommonResult<PageResult<CouponTemplateRespDTO>> pageCouponTemplateResult =
couponTemplateFeign.pageCouponTemplate(CouponTemplateConvert.INSTANCE.convert(pageVO));
pageCouponTemplateResult.checkError();
return CouponTemplateConvert.INSTANCE.convertPage(pageCouponTemplateResult.getData());
}
public void updateCouponTemplateStatus(Integer id, Integer status) {
CommonResult<Boolean> updateCouponTemplateStatusResult = couponTemplateFeign.updateCouponTemplateStatus(
new CouponCardTemplateUpdateStatusReqDTO().setId(id).setStatus(status));
updateCouponTemplateStatusResult.checkError();
}
// ========== 优惠劵模板 ==========
public Integer createCouponCardTemplate(CouponTemplateCardCreateReqVO createVO) {
CommonResult<Integer> createCouponCardTemplateResult = couponTemplateFeign.createCouponCardTemplate(
CouponTemplateConvert.INSTANCE.convert(createVO));
createCouponCardTemplateResult.checkError();
return createCouponCardTemplateResult.getData();
}
public void updateCouponCardTemplate(CouponTemplateCardUpdateReqVO updateVO) {
CommonResult<Boolean> updateCouponCardTemplateResult = couponTemplateFeign.updateCouponCardTemplate(
CouponTemplateConvert.INSTANCE.convert(updateVO));
updateCouponCardTemplateResult.checkError();
}
}

View File

@@ -1,90 +0,0 @@
package cn.iocoder.mall.managementweb.manager.promotion.recommend;
import cn.iocoder.common.framework.util.CollectionUtils;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendCreateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendDetailVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendPageReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendUpdateReqVO;
import cn.iocoder.mall.managementweb.convert.promotion.ProductRecommendConvert;
import cn.iocoder.mall.productservice.rpc.spu.ProductSpuFeign;
import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO;
import cn.iocoder.mall.promotion.api.rpc.recommend.ProductRecommendFeign;
import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.List;
import java.util.Map;
/**
* 商品推荐 Manager
*/
@Service
@Validated
public class ProductRecommendManager {
@Autowired
private ProductRecommendFeign productRecommendFeign;
@Autowired
private ProductSpuFeign productSpuFeign;
/**
* 创建商品推荐
*
* @param createVO 创建商品推荐 VO
* @return 商品推荐
*/
public Integer createProductRecommend(ProductRecommendCreateReqVO createVO) {
CommonResult<Integer> createProductRecommendResult = productRecommendFeign.createProductRecommend(
ProductRecommendConvert.INSTANCE.convert(createVO));
createProductRecommendResult.checkError();
return createProductRecommendResult.getData();
}
/**
* 更新商品推荐
*
* @param updateVO 更新商品推荐 VO
*/
public void updateProductRecommend(ProductRecommendUpdateReqVO updateVO) {
CommonResult<Boolean> updateProductRecommendResult = productRecommendFeign.updateProductRecommend(
ProductRecommendConvert.INSTANCE.convert(updateVO));
updateProductRecommendResult.checkError();
}
/**
* 删除商品推荐
*
* @param productRecommendId 商品推荐编号
*/
public void deleteProductRecommend(Integer productRecommendId) {
CommonResult<Boolean> deleteProductRecommendResult = productRecommendFeign.deleteProductRecommend(productRecommendId);
deleteProductRecommendResult.checkError();
}
/**
* 获得商品推荐分页
*
* @param pageVO 商品推荐分页查询
* @return 商品推荐分页结果
*/
public PageResult<ProductRecommendDetailVO> pageProductRecommend(ProductRecommendPageReqVO pageVO) {
CommonResult<PageResult<ProductRecommendRespDTO>> pageProductRecommendResult = productRecommendFeign.pageProductRecommend(ProductRecommendConvert.INSTANCE.convert(pageVO));
pageProductRecommendResult.checkError();
// 拼接结果
PageResult<ProductRecommendDetailVO> pageResult = ProductRecommendConvert.INSTANCE.convertPage(pageProductRecommendResult.getData());
if (!CollectionUtils.isEmpty(pageResult.getList())) {
// 获取商品信息,并进行拼接
CommonResult<List<ProductSpuRespDTO>> listProductSpusResult = productSpuFeign.listProductSpus(
CollectionUtils.convertSet(pageResult.getList(), ProductRecommendDetailVO::getProductSpuId));
listProductSpusResult.checkError();
Map<Integer, ProductSpuRespDTO> productSpuMap = CollectionUtils.convertMap(listProductSpusResult.getData(), ProductSpuRespDTO::getId);
pageResult.getList().forEach(detailVO ->
detailVO.setSpu(ProductRecommendConvert.INSTANCE.convert(productSpuMap.get(detailVO.getProductSpuId()))));
}
return pageResult;
}
}