frist commit
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-mall</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>yudao-module-promotion-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
promotion 模块 API,暴露给其它模块调用
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId> <!-- 接口文档:使用最新版本的 Swagger 模型 -->
|
||||
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.bargain;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 砍价活动")
|
||||
public interface BargainActivityApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/bargain-activity";
|
||||
|
||||
@PutMapping(PREFIX + "/update-stock")
|
||||
@Operation(summary = "更新砍价活动库存")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "砍价活动编号", required = true, example = "1024"),
|
||||
@Parameter(name = "count", description = "购买数量", required = true, example = "1"),
|
||||
})
|
||||
CommonResult<Boolean> updateBargainActivityStock(@RequestParam("id") Long id,
|
||||
@RequestParam("count") Integer count);
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.bargain;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainValidateJoinRespDTO;
|
||||
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 砍价记录")
|
||||
public interface BargainRecordApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/bargain-record";
|
||||
|
||||
@GetMapping(PREFIX + "/validate-join")
|
||||
@Operation(summary = "【下单前】校验是否参与砍价活动") // 如果校验失败,则抛出业务异常
|
||||
@Parameters({
|
||||
@Parameter(name = "userId", description = "用户编号", required = true, example = "1024"),
|
||||
@Parameter(name = "bargainRecordId", description = "砍价记录编号", required = true, example = "2048"),
|
||||
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "4096"),
|
||||
})
|
||||
CommonResult<BargainValidateJoinRespDTO> validateJoinBargain(@RequestParam("userId") Long userId,
|
||||
@RequestParam("bargainRecordId") Long bargainRecordId,
|
||||
@RequestParam("skuId") Long skuId);
|
||||
|
||||
@PutMapping(PREFIX + "/update-order-id")
|
||||
@Operation(summary = "更新砍价记录的订单编号") // 在砍价成功后,用户发起订单后,会记录该订单编号
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "砍价记录编号", required = true, example = "1024"),
|
||||
@Parameter(name = "orderId", description = "订单编号", required = true, example = "2048"),
|
||||
})
|
||||
CommonResult<Boolean> updateBargainRecordOrderId(@RequestParam("id") Long id,
|
||||
@RequestParam("oderId") Long orderId);
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.bargain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 校验参与砍价 Response DTO
|
||||
*/
|
||||
@Data
|
||||
public class BargainValidateJoinRespDTO {
|
||||
|
||||
/**
|
||||
* 砍价活动编号
|
||||
*/
|
||||
private Long activityId;
|
||||
/**
|
||||
* 砍价活动名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 砍价金额
|
||||
*/
|
||||
private Integer bargainPrice;
|
||||
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.combination;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateRespDTO;
|
||||
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordRespDTO;
|
||||
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO;
|
||||
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 拼团记录")
|
||||
public interface CombinationRecordApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/combination-record";
|
||||
|
||||
@GetMapping(PREFIX + "/validate")
|
||||
@Operation(summary = "校验是否满足拼团条件")
|
||||
@Parameters({
|
||||
@Parameter(name = "userId", description = "用户编号", required = true, example = "1024"),
|
||||
@Parameter(name = "activityId", description = "活动编号", required = true, example = "2048"),
|
||||
@Parameter(name = "headId", description = "团长编号", required = true, example = "4096"),
|
||||
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "8192"),
|
||||
@Parameter(name = "count", description = "数量", required = true, example = "1"),
|
||||
})
|
||||
CommonResult<Boolean> validateCombinationRecord(@RequestParam("userId") Long userId,
|
||||
@RequestParam("activityId") Long activityId,
|
||||
@RequestParam("headId") Long headId,
|
||||
@RequestParam("skuId") Long skuId,
|
||||
@RequestParam("count") Integer count);
|
||||
|
||||
@PostMapping(PREFIX + "/create")
|
||||
@Operation(summary = "创建开团记录")
|
||||
CommonResult<CombinationRecordCreateRespDTO> createCombinationRecord(
|
||||
@RequestBody @Valid CombinationRecordCreateReqDTO reqDTO);
|
||||
|
||||
@GetMapping(PREFIX + "/get-by-order-id")
|
||||
@Operation(summary = "基于订单编号,查询拼团记录")
|
||||
@Parameters({
|
||||
@Parameter(name = "userId", description = "用户编号", required = true, example = "1024"),
|
||||
@Parameter(name = "orderId", description = "订单编号", required = true, example = "2048"),
|
||||
})
|
||||
CommonResult<CombinationRecordRespDTO> getCombinationRecordByOrderId(@RequestParam("userId") Long userId,
|
||||
@RequestParam("orderId") Long orderId);
|
||||
|
||||
@GetMapping(PREFIX + "/validate-join")
|
||||
@Operation(summary = "【下单前】校验是否满足拼团活动条件") // 如果校验失败,则抛出业务异常
|
||||
@Parameters({
|
||||
@Parameter(name = "userId", description = "用户编号", required = true, example = "1024"),
|
||||
@Parameter(name = "activityId", description = "活动编号", required = true, example = "2048"),
|
||||
@Parameter(name = "headId", description = "团长编号", example = "4096"), // 如果新发起的团,headId 不用传递
|
||||
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "8192"),
|
||||
@Parameter(name = "count", description = "数量", required = true, example = "1"),
|
||||
})
|
||||
CommonResult<CombinationValidateJoinRespDTO> validateJoinCombination(@RequestParam("userId") Long userId,
|
||||
@RequestParam("activityId") Long activityId,
|
||||
@RequestParam(value = "headId", required = false) Long headId,
|
||||
@RequestParam("skuId") Long skuId,
|
||||
@RequestParam("count") Integer count);
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.combination.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 拼团记录的创建 Request DTO
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Data
|
||||
public class CombinationRecordCreateReqDTO {
|
||||
|
||||
/**
|
||||
* 拼团活动编号
|
||||
*/
|
||||
@NotNull(message = "拼团活动编号不能为空")
|
||||
private Long activityId;
|
||||
/**
|
||||
* spu 编号
|
||||
*/
|
||||
@NotNull(message = "spu 编号不能为空")
|
||||
private Long spuId;
|
||||
/**
|
||||
* sku 编号
|
||||
*/
|
||||
@NotNull(message = "sku 编号不能为空")
|
||||
private Long skuId;
|
||||
/**
|
||||
* 购买的商品数量
|
||||
*/
|
||||
@NotNull(message = "购买数量不能为空")
|
||||
private Integer count;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@NotNull(message = "订单编号不能为空")
|
||||
private Long orderId;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
/**
|
||||
* 团长编号
|
||||
*/
|
||||
private Long headId;
|
||||
/**
|
||||
* 拼团商品单价
|
||||
*/
|
||||
@NotNull(message = "拼团商品单价不能为空")
|
||||
private Integer combinationPrice;
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.combination.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 拼团记录的创建 Response DTO
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Data
|
||||
public class CombinationRecordCreateRespDTO {
|
||||
|
||||
/**
|
||||
* 拼团活动编号
|
||||
*
|
||||
* 关联 CombinationActivityDO 的 id 字段
|
||||
*/
|
||||
private Long combinationActivityId;
|
||||
/**
|
||||
* 拼团团长编号
|
||||
*
|
||||
* 关联 CombinationRecordDO 的 headId 字段
|
||||
*/
|
||||
private Long combinationHeadId;
|
||||
/**
|
||||
* 拼团记录编号
|
||||
*
|
||||
* 关联 CombinationRecordDO 的 id 字段
|
||||
*/
|
||||
private Long combinationRecordId;
|
||||
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.combination.dto;
|
||||
|
||||
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 拼团记录 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class CombinationRecordRespDTO {
|
||||
|
||||
/**
|
||||
* 编号,主键自增
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 拼团活动编号
|
||||
*
|
||||
* 关联 CombinationActivityDO 的 id 字段
|
||||
*/
|
||||
private Long activityId;
|
||||
/**
|
||||
* 拼团商品单价
|
||||
*
|
||||
* 冗余 CombinationProductDO 的 combinationPrice 字段
|
||||
*/
|
||||
private Integer combinationPrice;
|
||||
/**
|
||||
* SPU 编号
|
||||
*/
|
||||
private Long spuId;
|
||||
/**
|
||||
* 商品名字
|
||||
*/
|
||||
private String spuName;
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
private String picUrl;
|
||||
/**
|
||||
* SKU 编号
|
||||
*/
|
||||
private Long skuId;
|
||||
/**
|
||||
* 购买的商品数量
|
||||
*/
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 团长编号
|
||||
*/
|
||||
private Long headId;
|
||||
/**
|
||||
* 开团状态
|
||||
*
|
||||
* 关联 {@link CombinationRecordStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private Long orderId;
|
||||
/**
|
||||
* 开团需要人数
|
||||
*
|
||||
* 关联 CombinationActivityDO 的 userSize 字段
|
||||
*/
|
||||
private Integer userSize;
|
||||
/**
|
||||
* 已加入拼团人数
|
||||
*/
|
||||
private Integer userCount;
|
||||
/**
|
||||
* 是否虚拟成团
|
||||
*/
|
||||
private Boolean virtualGroup;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private LocalDateTime expireTime;
|
||||
/**
|
||||
* 开始时间 (订单付款后开始的时间)
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
/**
|
||||
* 结束时间(成团时间/失败时间)
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.combination.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 校验参与拼团 Response DTO
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Data
|
||||
public class CombinationValidateJoinRespDTO {
|
||||
|
||||
/**
|
||||
* 砍价活动编号
|
||||
*/
|
||||
private Long activityId;
|
||||
/**
|
||||
* 砍价活动名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 拼团金额
|
||||
*/
|
||||
private Integer combinationPrice;
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.coupon;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponRespDTO;
|
||||
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO;
|
||||
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 优惠劵")
|
||||
public interface CouponApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/coupon";
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-user-id")
|
||||
@Operation(summary = "获得用户的优惠劵列表")
|
||||
CommonResult<List<CouponRespDTO>> getCouponListByUserId(@RequestParam("userId") Long userId,
|
||||
@RequestParam("status") Integer status);
|
||||
|
||||
@PutMapping(PREFIX + "/use")
|
||||
@Operation(summary = "使用优惠劵")
|
||||
CommonResult<Boolean> useCoupon(@RequestBody @Valid CouponUseReqDTO useReqDTO);
|
||||
|
||||
@PutMapping(PREFIX + "/return-used")
|
||||
@Operation(summary = "退还已使用的优惠券")
|
||||
@Parameter(name = "id", description = "优惠券编号", required = true, example = "1")
|
||||
CommonResult<Boolean> returnUsedCoupon(@RequestParam("id") Long id);
|
||||
|
||||
@PostMapping(PREFIX + "/take-by-admin")
|
||||
@Operation(summary = "【管理员】给指定用户批量发送优惠券") // 返回:优惠券编号列表
|
||||
@Parameters({
|
||||
@Parameter(name = "giveCoupons", description = "key: 优惠劵模版编号,value:对应的数量", required = true),
|
||||
@Parameter(name = "userId", description = "用户编号", required = true)
|
||||
})
|
||||
CommonResult<List<Long>> takeCouponsByAdmin(@RequestBody Map<Long, Integer> giveCoupons,
|
||||
@RequestParam("userId") Long userId);
|
||||
|
||||
@PostMapping(PREFIX + "/invalidate-by-admin")
|
||||
@Operation(summary = "【管理员】作废指定用户的指定优惠劵")
|
||||
@Parameters({
|
||||
@Parameter(name = "giveCouponIds", description = "赠送的优惠券编号", required = true),
|
||||
@Parameter(name = "userId", description = "用户编号", required = true)
|
||||
})
|
||||
CommonResult<Boolean> invalidateCouponsByAdmin(@RequestParam("giveCouponIds") List<Long> giveCouponIds,
|
||||
@RequestParam("userId") Long userId);
|
||||
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.coupon.dto;
|
||||
|
||||
import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum;
|
||||
import cn.iocoder.yudao.module.promotion.enums.coupon.CouponStatusEnum;
|
||||
import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠劵 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class CouponRespDTO {
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
/**
|
||||
* 优惠劵编号
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 优惠劵模板编号
|
||||
*/
|
||||
private Integer templateId;
|
||||
/**
|
||||
* 优惠劵名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 优惠码状态
|
||||
*
|
||||
* 枚举 {@link CouponStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
// ========== 基本信息 END ==========
|
||||
|
||||
// ========== 领取情况 BEGIN ==========
|
||||
/**
|
||||
* 用户编号
|
||||
*
|
||||
* 关联 MemberUserDO 的 id 字段
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 领取类型
|
||||
*
|
||||
* 枚举 {@link CouponTakeTypeEnum}
|
||||
*/
|
||||
private Integer takeType;
|
||||
// ========== 领取情况 END ==========
|
||||
|
||||
// ========== 使用规则 BEGIN ==========
|
||||
/**
|
||||
* 是否设置满多少金额可用,单位:分
|
||||
*/
|
||||
private Integer usePrice;
|
||||
/**
|
||||
* 生效开始时间
|
||||
*/
|
||||
private LocalDateTime validStartTime;
|
||||
/**
|
||||
* 生效结束时间
|
||||
*/
|
||||
private LocalDateTime validEndTime;
|
||||
/**
|
||||
* 商品范围
|
||||
*/
|
||||
private Integer productScope;
|
||||
/**
|
||||
* 商品范围编号的数组
|
||||
*/
|
||||
private List<Long> productScopeValues;
|
||||
// ========== 使用规则 END ==========
|
||||
|
||||
// ========== 使用效果 BEGIN ==========
|
||||
/**
|
||||
* 折扣类型
|
||||
*/
|
||||
private Integer discountType;
|
||||
/**
|
||||
* 折扣百分比
|
||||
*/
|
||||
private Integer discountPercent;
|
||||
/**
|
||||
* 优惠金额,单位:分
|
||||
*/
|
||||
private Integer discountPrice;
|
||||
/**
|
||||
* 折扣上限,仅在 {@link #discountType} 等于 {@link PromotionDiscountTypeEnum#PERCENT} 时生效
|
||||
*/
|
||||
private Integer discountLimitPrice;
|
||||
// ========== 使用效果 END ==========
|
||||
|
||||
// ========== 使用情况 BEGIN ==========
|
||||
/**
|
||||
* 使用订单号
|
||||
*/
|
||||
private Long useOrderId;
|
||||
/**
|
||||
* 使用时间
|
||||
*/
|
||||
private LocalDateTime useTime;
|
||||
|
||||
// ========== 使用情况 END ==========
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.coupon.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 优惠券模版 Response DTO
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@Data
|
||||
public class CouponTemplateRespDTO {
|
||||
/**
|
||||
* 模板编号,自增唯一
|
||||
*/
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 优惠劵名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.coupon.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 优惠劵使用 Request DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class CouponUseReqDTO {
|
||||
|
||||
/**
|
||||
* 优惠劵编号
|
||||
*/
|
||||
@NotNull(message = "优惠劵编号不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@NotNull(message = "订单编号不能为空")
|
||||
private Long orderId;
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.coupon.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 优惠劵使用 Request DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class CouponValidReqDTO {
|
||||
|
||||
/**
|
||||
* 优惠劵编号
|
||||
*/
|
||||
@NotNull(message = "优惠劵编号不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.discount;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.promotion.api.discount.dto.DiscountProductRespDTO;
|
||||
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 限时折扣")
|
||||
public interface DiscountActivityApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/discount-activity";
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-sku-id")
|
||||
@Operation(summary = "获得商品匹配的的限时折扣信息")
|
||||
@Parameter(name = "skuIds", description = "商品 SKU 编号数组", required = true, example = "[1, 2]")
|
||||
CommonResult<List<DiscountProductRespDTO>> getMatchDiscountProductListBySkuIds(@RequestParam("skuIds") Collection<Long> skuIds);
|
||||
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.discount.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 限时折扣活动商品 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class DiscountProductRespDTO {
|
||||
|
||||
/**
|
||||
* 编号,主键自增
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 商品 SPU 编号
|
||||
*/
|
||||
private Long spuId;
|
||||
/**
|
||||
* 商品 SKU 编号
|
||||
*/
|
||||
private Long skuId;
|
||||
/**
|
||||
* 折扣类型
|
||||
*/
|
||||
private Integer discountType;
|
||||
/**
|
||||
* 折扣百分比
|
||||
*/
|
||||
private Integer discountPercent;
|
||||
/**
|
||||
* 优惠金额,单位:分
|
||||
*/
|
||||
private Integer discountPrice;
|
||||
|
||||
// ========== 活动字段 ==========
|
||||
/**
|
||||
* 限时折扣活动的编号
|
||||
*/
|
||||
private Long activityId;
|
||||
/**
|
||||
* 活动标题
|
||||
*/
|
||||
private String activityName;
|
||||
/**
|
||||
* 活动开始时间点
|
||||
*/
|
||||
private LocalDateTime activityStartTime;
|
||||
/**
|
||||
* 活动结束时间点
|
||||
*/
|
||||
private LocalDateTime activityEndTime;
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.point;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.promotion.api.point.dto.PointValidateJoinRespDTO;
|
||||
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 秒杀活动")
|
||||
public interface PointActivityApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/point-activity";
|
||||
|
||||
@GetMapping(PREFIX + "/validate-join")
|
||||
@Operation(summary = "【下单前】校验是否参与积分商城活动")
|
||||
@Parameters({
|
||||
@Parameter(name = "activityId", description = "活动编号", required = true, example = "1"),
|
||||
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "2"),
|
||||
@Parameter(name = "count", description = "数量", required = true, example = "3"),
|
||||
})
|
||||
CommonResult<PointValidateJoinRespDTO> validateJoinPointActivity(@RequestParam("activityId") Long activityId,
|
||||
@RequestParam("skuId") Long skuId,
|
||||
@RequestParam("count")Integer count);
|
||||
|
||||
@PutMapping(PREFIX + "/update-stock-decr")
|
||||
@Operation(summary = "更新积分商品库存(减少)")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "活动编号", required = true, example = "1"),
|
||||
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "2"),
|
||||
@Parameter(name = "count", description = "数量", required = true, example = "3"),
|
||||
})
|
||||
CommonResult<Boolean> updatePointStockDecr(@RequestParam("id") Long id,
|
||||
@RequestParam("skuId") Long skuId,
|
||||
@RequestParam("count")Integer count);
|
||||
|
||||
@PutMapping(PREFIX + "/update-stock-incr")
|
||||
@Operation(summary = "更新积分商城商品库存(增加)")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "活动编号", required = true, example = "1"),
|
||||
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "2"),
|
||||
@Parameter(name = "count", description = "数量", required = true, example = "3"),
|
||||
})
|
||||
CommonResult<Boolean> updatePointStockIncr(@RequestParam("id") Long id,
|
||||
@RequestParam("skuId") Long skuId,
|
||||
@RequestParam("count")Integer count);
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.point.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 校验参与积分商城 Response DTO
|
||||
*/
|
||||
@Data
|
||||
public class PointValidateJoinRespDTO {
|
||||
|
||||
/**
|
||||
* 可兑换次数
|
||||
*/
|
||||
private Integer count;
|
||||
/**
|
||||
* 所需兑换积分
|
||||
*/
|
||||
private Integer point;
|
||||
/**
|
||||
* 所需兑换金额,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.reward;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.promotion.api.reward.dto.RewardActivityMatchRespDTO;
|
||||
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 满减送")
|
||||
public interface RewardActivityApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/reward-activity";
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-spu-id")
|
||||
@Operation(summary = "获得商品匹配的的满减送活动信息")
|
||||
@Parameter(name = "spuIds", description = "商品 SPU 编号数组", required = true, example = "[1, 2]")
|
||||
CommonResult<List<RewardActivityMatchRespDTO>> getMatchRewardActivityListBySpuIds(@RequestParam("spuIds") Collection<Long> spuIds);
|
||||
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.reward.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.module.promotion.enums.common.PromotionConditionTypeEnum;
|
||||
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 满减送活动的匹配 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class RewardActivityMatchRespDTO {
|
||||
|
||||
/**
|
||||
* 匹配的 SPU 数组
|
||||
*/
|
||||
private List<Long> spuIds;
|
||||
|
||||
/**
|
||||
* 活动编号,主键自增
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 活动标题
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 条件类型
|
||||
*
|
||||
* 枚举 {@link PromotionConditionTypeEnum}
|
||||
*/
|
||||
private Integer conditionType;
|
||||
/**
|
||||
* 商品范围
|
||||
*
|
||||
* 枚举 {@link PromotionProductScopeEnum}
|
||||
*/
|
||||
private Integer productScope;
|
||||
/**
|
||||
* 商品 SPU 编号的数组
|
||||
*/
|
||||
private List<Long> productScopeValues;
|
||||
/**
|
||||
* 优惠规则的数组
|
||||
*/
|
||||
private List<Rule> rules;
|
||||
|
||||
/**
|
||||
* 优惠规则
|
||||
*/
|
||||
@Data
|
||||
public static class Rule implements Serializable {
|
||||
|
||||
/**
|
||||
* 优惠门槛
|
||||
*
|
||||
* 1. 满 N 元,单位:分
|
||||
* 2. 满 N 件
|
||||
*/
|
||||
private Integer limit;
|
||||
/**
|
||||
* 优惠价格,单位:分
|
||||
*/
|
||||
private Integer discountPrice;
|
||||
/**
|
||||
* 是否包邮
|
||||
*/
|
||||
private Boolean freeDelivery;
|
||||
/**
|
||||
* 赠送的积分
|
||||
*/
|
||||
private Integer point;
|
||||
/**
|
||||
* 赠送的优惠劵
|
||||
*
|
||||
* key: 优惠劵模版编号
|
||||
* value:对应的优惠券数量
|
||||
*
|
||||
* 目的:用于订单支付后赠送优惠券
|
||||
*/
|
||||
private Map<Long, Integer> giveCouponTemplateCounts;
|
||||
|
||||
/**
|
||||
* 规则描述
|
||||
*
|
||||
* 通过 {@link #limit}、{@link #discountPrice} 等字段进行拼接
|
||||
*/
|
||||
private String description;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.seckill;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.promotion.api.seckill.dto.SeckillValidateJoinRespDTO;
|
||||
import cn.iocoder.yudao.module.promotion.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 秒杀活动")
|
||||
public interface SeckillActivityApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/discount-activity";
|
||||
|
||||
@PutMapping(PREFIX + "/update-stock-decr")
|
||||
@Operation(summary = "更新秒杀库存(减少)")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "活动编号", required = true, example = "1"),
|
||||
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "2"),
|
||||
@Parameter(name = "count", description = "数量", required = true, example = "3"),
|
||||
})
|
||||
CommonResult<Boolean> updateSeckillStockDecr(@RequestParam("id") Long id,
|
||||
@RequestParam("skuId") Long skuId,
|
||||
@RequestParam("count")Integer count);
|
||||
|
||||
@PutMapping(PREFIX + "/update-stock-incr")
|
||||
@Operation(summary = "更新秒杀库存(增加)")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "活动编号", required = true, example = "1"),
|
||||
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "2"),
|
||||
@Parameter(name = "count", description = "数量", required = true, example = "3"),
|
||||
})
|
||||
CommonResult<Boolean> updateSeckillStockIncr(@RequestParam("id") Long id,
|
||||
@RequestParam("skuId") Long skuId,
|
||||
@RequestParam("count")Integer count);
|
||||
|
||||
@GetMapping(PREFIX + "/validate-join")
|
||||
@Operation(summary = "【下单前】校验是否参与秒杀活动") // 如果校验失败,则抛出业务异常
|
||||
@Parameters({
|
||||
@Parameter(name = "activityId", description = "活动编号", required = true, example = "1"),
|
||||
@Parameter(name = "skuId", description = "SKU 编号", required = true, example = "2"),
|
||||
@Parameter(name = "count", description = "数量", required = true, example = "3"),
|
||||
})
|
||||
CommonResult<SeckillValidateJoinRespDTO> validateJoinSeckill(@RequestParam("activityId") Long activityId,
|
||||
@RequestParam("skuId") Long skuId,
|
||||
@RequestParam("count")Integer count);
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.promotion.api.seckill.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 校验参与秒杀 Response DTO
|
||||
*/
|
||||
@Data
|
||||
public class SeckillValidateJoinRespDTO {
|
||||
|
||||
/**
|
||||
* 秒杀活动名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 总限购数量
|
||||
*
|
||||
* 目的:目前只有 trade 有具体下单的数据,需要交给 trade 价格计算使用
|
||||
*/
|
||||
private Integer totalLimitCount;
|
||||
|
||||
/**
|
||||
* 秒杀金额
|
||||
*/
|
||||
private Integer seckillPrice;
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.RpcConstants;
|
||||
|
||||
/**
|
||||
* API 相关的枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public class ApiConstants {
|
||||
|
||||
/**
|
||||
* 服务名
|
||||
*
|
||||
* 注意,需要保证和 spring.application.name 保持一致
|
||||
*/
|
||||
public static final String NAME = "promotion-server";
|
||||
|
||||
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/promotion";
|
||||
|
||||
public static final String VERSION = "1.0.0";
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums;
|
||||
|
||||
/**
|
||||
* promotion 字典类型的枚举类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
public class DictTypeConstants {
|
||||
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* Promotion 错误码枚举类
|
||||
* <p>
|
||||
* promotion 系统,使用 1-013-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 促销活动相关 1-013-001-000 ============
|
||||
ErrorCode DISCOUNT_ACTIVITY_NOT_EXISTS = new ErrorCode(1_013_001_000, "限时折扣活动不存在");
|
||||
ErrorCode DISCOUNT_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1_013_001_001, "存在商品参加了其它限时折扣活动【{}】");
|
||||
ErrorCode DISCOUNT_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_001_002, "限时折扣活动已关闭,不能修改");
|
||||
ErrorCode DISCOUNT_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED = new ErrorCode(1_013_001_003, "限时折扣活动未关闭,不能删除");
|
||||
ErrorCode DISCOUNT_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_001_004, "限时折扣活动已关闭,不能重复关闭");
|
||||
|
||||
// ========== Banner 相关 1-013-002-000 ============
|
||||
ErrorCode BANNER_NOT_EXISTS = new ErrorCode(1_013_002_000, "Banner 不存在");
|
||||
|
||||
// ========== Coupon 相关 1-013-003-000 ============
|
||||
|
||||
// ========== 优惠劵模板 1-013-004-000 ==========
|
||||
ErrorCode COUPON_TEMPLATE_NOT_EXISTS = new ErrorCode(1_013_004_000, "优惠劵模板不存在");
|
||||
ErrorCode COUPON_TEMPLATE_TOTAL_COUNT_TOO_SMALL = new ErrorCode(1_013_004_001, "发放数量不能小于已领取数量({})");
|
||||
ErrorCode COUPON_TEMPLATE_NOT_ENOUGH = new ErrorCode(1_013_004_002, "当前剩余数量不够领取");
|
||||
ErrorCode COUPON_TEMPLATE_USER_ALREADY_TAKE = new ErrorCode(1_013_004_003, "用户已领取过此优惠券");
|
||||
ErrorCode COUPON_TEMPLATE_EXPIRED = new ErrorCode(1_013_004_004, "优惠券已过期");
|
||||
ErrorCode COUPON_TEMPLATE_CANNOT_TAKE = new ErrorCode(1_013_004_005, "领取方式不正确");
|
||||
|
||||
// ========== 优惠劵 1-013-005-000 ==========
|
||||
ErrorCode COUPON_NOT_EXISTS = new ErrorCode(1_013_005_000, "优惠券不存在");
|
||||
ErrorCode COUPON_DELETE_FAIL_USED = new ErrorCode(1_013_005_001, "回收优惠劵失败,优惠劵已被使用");
|
||||
ErrorCode COUPON_STATUS_NOT_UNUSED = new ErrorCode(1_013_005_002, "优惠劵不处于待使用状态");
|
||||
ErrorCode COUPON_VALID_TIME_NOT_NOW = new ErrorCode(1_013_005_003, "优惠券不在使用时间范围内");
|
||||
ErrorCode COUPON_STATUS_NOT_USED = new ErrorCode(1_013_005_004, "优惠劵不是已使用状态");
|
||||
|
||||
// ========== 满减送活动 1-013-006-000 ==========
|
||||
ErrorCode REWARD_ACTIVITY_NOT_EXISTS = new ErrorCode(1_013_006_000, "满减送活动不存在");
|
||||
ErrorCode REWARD_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1_013_006_001, "该时间段存在商品参加了其它满减送活动");
|
||||
ErrorCode REWARD_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_006_002, "满减送活动已关闭,不能修改");
|
||||
ErrorCode REWARD_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED = new ErrorCode(1_013_006_003, "满减送活动未关闭,不能删除");
|
||||
ErrorCode REWARD_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_006_004, "满减送活动已关闭,不能重复关闭");
|
||||
ErrorCode REWARD_ACTIVITY_SCOPE_EXISTS = new ErrorCode(1_013_006_005, "与该时间段满减送活动【{}】商品范围冲突,原因:{}");
|
||||
|
||||
// ========== 积分商城活动 1-013-007-000 ==========
|
||||
ErrorCode POINT_ACTIVITY_NOT_EXISTS = new ErrorCode(1_013_007_000, "积分商城活动不存在");
|
||||
ErrorCode POINT_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1_013_007_001, "存在商品参加了其它积分商城活动");
|
||||
ErrorCode POINT_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_007_002, "积分商城活动已关闭,不能修改");
|
||||
ErrorCode POINT_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1_013_007_003, "积分商城活动未关闭或未结束,不能删除");
|
||||
ErrorCode POINT_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_007_004, "积分商城活动已关闭,不能重复关闭");
|
||||
ErrorCode POINT_ACTIVITY_JOIN_ACTIVITY_STATUS_CLOSED = new ErrorCode(1_013_007_005, "积分商品兑换失败,原因:积分商城活动已关闭");
|
||||
ErrorCode POINT_ACTIVITY_JOIN_ACTIVITY_SINGLE_LIMIT_COUNT_EXCEED = new ErrorCode(1_013_007_006, "积分商品兑换失败,原因:单次限购超出");
|
||||
ErrorCode POINT_ACTIVITY_JOIN_ACTIVITY_PRODUCT_NOT_EXISTS = new ErrorCode(1_013_007_007, "积分商品兑换失败,原因:商品不存在");
|
||||
ErrorCode POINT_ACTIVITY_UPDATE_STOCK_FAIL = new ErrorCode(1_013_007_008, "积分商品兑换失败,原因:积分商品库存不足");
|
||||
|
||||
// ========== 秒杀活动 1-013-008-000 ==========
|
||||
ErrorCode SECKILL_ACTIVITY_NOT_EXISTS = new ErrorCode(1_013_008_000, "秒杀活动不存在");
|
||||
ErrorCode SECKILL_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1_013_008_002, "存在商品参加了其它秒杀活动,秒杀时段冲突");
|
||||
ErrorCode SECKILL_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_008_003, "秒杀活动已关闭,不能修改");
|
||||
ErrorCode SECKILL_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1_013_008_004, "秒杀活动未关闭或未结束,不能删除");
|
||||
ErrorCode SECKILL_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_008_005, "秒杀活动已关闭,不能重复关闭");
|
||||
ErrorCode SECKILL_ACTIVITY_UPDATE_STOCK_FAIL = new ErrorCode(1_013_008_006, "秒杀失败,原因:秒杀库存不足");
|
||||
ErrorCode SECKILL_JOIN_ACTIVITY_TIME_ERROR = new ErrorCode(1_013_008_007, "秒杀失败,原因:不在活动时间范围内");
|
||||
ErrorCode SECKILL_JOIN_ACTIVITY_STATUS_CLOSED = new ErrorCode(1_013_008_008, "秒杀失败,原因:秒杀活动已关闭");
|
||||
ErrorCode SECKILL_JOIN_ACTIVITY_SINGLE_LIMIT_COUNT_EXCEED = new ErrorCode(1_013_008_009, "秒杀失败,原因:单次限购超出");
|
||||
ErrorCode SECKILL_JOIN_ACTIVITY_PRODUCT_NOT_EXISTS = new ErrorCode(1_013_008_010, "秒杀失败,原因:商品不存在");
|
||||
|
||||
// ========== 秒杀时段 1-013-009-000 ==========
|
||||
ErrorCode SECKILL_CONFIG_NOT_EXISTS = new ErrorCode(1_013_009_000, "秒杀时段不存在");
|
||||
ErrorCode SECKILL_CONFIG_TIME_CONFLICTS = new ErrorCode(1_013_009_001, "秒杀时段冲突");
|
||||
ErrorCode SECKILL_CONFIG_DISABLE = new ErrorCode(1_013_009_004, "秒杀时段已关闭");
|
||||
|
||||
// ========== 拼团活动 1-013-010-000 ==========
|
||||
ErrorCode COMBINATION_ACTIVITY_NOT_EXISTS = new ErrorCode(1_013_010_000, "拼团活动不存在");
|
||||
ErrorCode COMBINATION_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1_013_010_001, "存在商品参加了其它拼团活动");
|
||||
ErrorCode COMBINATION_ACTIVITY_STATUS_DISABLE_NOT_UPDATE = new ErrorCode(1_013_010_002, "拼团活动已关闭不能修改");
|
||||
ErrorCode COMBINATION_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1_013_010_003, "拼团活动未关闭或未结束,不能删除");
|
||||
ErrorCode COMBINATION_ACTIVITY_STATUS_DISABLE = new ErrorCode(1_013_010_004, "拼团失败,原因:拼团活动已关闭");
|
||||
ErrorCode COMBINATION_JOIN_ACTIVITY_PRODUCT_NOT_EXISTS = new ErrorCode(1_013_010_005, "拼团失败,原因:拼团活动商品不存在");
|
||||
ErrorCode COMBINATION_ACTIVITY_UPDATE_STOCK_FAIL = new ErrorCode(1_013_010_006, "拼团失败,原因:拼团活动商品库存不足");
|
||||
|
||||
// ========== 拼团记录 1-013-011-000 ==========
|
||||
ErrorCode COMBINATION_RECORD_NOT_EXISTS = new ErrorCode(1_013_011_000, "拼团不存在");
|
||||
ErrorCode COMBINATION_RECORD_EXISTS = new ErrorCode(1_013_011_001, "拼团失败,已参与过该拼团");
|
||||
ErrorCode COMBINATION_RECORD_HEAD_NOT_EXISTS = new ErrorCode(1_013_011_002, "拼团失败,父拼团不存在");
|
||||
ErrorCode COMBINATION_RECORD_USER_FULL = new ErrorCode(1_013_011_003, "拼团失败,拼团人数已满");
|
||||
ErrorCode COMBINATION_RECORD_FAILED_HAVE_JOINED = new ErrorCode(1_013_011_004, "拼团失败,原因:存在该活动正在进行的拼团记录");
|
||||
ErrorCode COMBINATION_RECORD_FAILED_TIME_NOT_START = new ErrorCode(1_013_011_005, "拼团失败,活动未开始");
|
||||
ErrorCode COMBINATION_RECORD_FAILED_TIME_END = new ErrorCode(1_013_011_006, "拼团失败,活动已经结束");
|
||||
ErrorCode COMBINATION_RECORD_FAILED_SINGLE_LIMIT_COUNT_EXCEED = new ErrorCode(1_013_011_007, "拼团失败,原因:单次限购超出");
|
||||
ErrorCode COMBINATION_RECORD_FAILED_TOTAL_LIMIT_COUNT_EXCEED = new ErrorCode(1_013_011_008, "拼团失败,原因:超出总购买次数");
|
||||
ErrorCode COMBINATION_RECORD_FAILED_ORDER_STATUS_UNPAID = new ErrorCode(1_013_011_009, "拼团失败,原因:存在未支付订单,请先支付");
|
||||
|
||||
// ========== 砍价活动 1-013-012-000 ==========
|
||||
ErrorCode BARGAIN_ACTIVITY_NOT_EXISTS = new ErrorCode(1_013_012_000, "砍价活动不存在");
|
||||
ErrorCode BARGAIN_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1_013_012_001, "存在商品参加了其它砍价活动");
|
||||
ErrorCode BARGAIN_ACTIVITY_STATUS_DISABLE = new ErrorCode(1_013_012_002, "砍价活动已关闭,不能修改");
|
||||
ErrorCode BARGAIN_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1_013_012_003, "砍价活动未关闭或未结束,不能删除");
|
||||
ErrorCode BARGAIN_ACTIVITY_STOCK_NOT_ENOUGH = new ErrorCode(1_013_012_004, "砍价活动库存不足");
|
||||
ErrorCode BARGAIN_ACTIVITY_STATUS_CLOSED = new ErrorCode(1_013_012_005, "砍价活动已关闭");
|
||||
ErrorCode BARGAIN_ACTIVITY_TIME_END = new ErrorCode(1_013_012_006, "砍价活动已经结束");
|
||||
|
||||
// ========== 砍价记录 1-013-013-000 ==========
|
||||
ErrorCode BARGAIN_RECORD_NOT_EXISTS = new ErrorCode(1_013_013_000, "砍价记录不存在");
|
||||
ErrorCode BARGAIN_RECORD_CREATE_FAIL_EXISTS = new ErrorCode(1_013_013_001, "参与失败,您已经参与当前砍价活动");
|
||||
ErrorCode BARGAIN_RECORD_CREATE_FAIL_LIMIT = new ErrorCode(1_013_013_002, "参与失败,您已达到当前砍价活动的参与上限");
|
||||
ErrorCode BARGAIN_JOIN_RECORD_NOT_SUCCESS = new ErrorCode(1_013_013_004, "下单失败,砍价未成功");
|
||||
ErrorCode BARGAIN_JOIN_RECORD_ALREADY_ORDER = new ErrorCode(1_013_013_005, "下单失败,该砍价已经下单");
|
||||
|
||||
// ========== 砍价助力 1-013-014-000 ==========
|
||||
ErrorCode BARGAIN_HELP_CREATE_FAIL_RECORD_NOT_IN_PROCESS = new ErrorCode(1_013_014_000, "助力失败,砍价记录不处于进行中");
|
||||
ErrorCode BARGAIN_HELP_CREATE_FAIL_RECORD_SELF = new ErrorCode(1_013_014_001, "助力失败,不能助力自己");
|
||||
ErrorCode BARGAIN_HELP_CREATE_FAIL_LIMIT = new ErrorCode(1_013_014_002, "助力失败,您已达到当前砍价活动的助力上限");
|
||||
ErrorCode BARGAIN_HELP_CREATE_FAIL_CONFLICT = new ErrorCode(1_013_014_003, "助力失败,请重试");
|
||||
ErrorCode BARGAIN_HELP_CREATE_FAIL_HELP_EXISTS = new ErrorCode(1_013_014_004, "助力失败,您已经助力过了");
|
||||
|
||||
// ========== 文章分类 1-013-015-000 ==========
|
||||
ErrorCode ARTICLE_CATEGORY_NOT_EXISTS = new ErrorCode(1_013_015_000, "文章分类不存在");
|
||||
ErrorCode ARTICLE_CATEGORY_DELETE_FAIL_HAVE_ARTICLES = new ErrorCode(1_013_015_001, "文章分类删除失败,存在关联文章");
|
||||
|
||||
// ========== 文章管理 1-013-016-000 ==========
|
||||
ErrorCode ARTICLE_NOT_EXISTS = new ErrorCode(1_013_016_000, "文章不存在");
|
||||
|
||||
// ========== 装修模板 1-013-017-000 ==========
|
||||
ErrorCode DIY_TEMPLATE_NOT_EXISTS = new ErrorCode(1_013_017_000, "装修模板不存在");
|
||||
ErrorCode DIY_TEMPLATE_NAME_USED = new ErrorCode(1_013_017_001, "装修模板名称({})已经被使用");
|
||||
ErrorCode DIY_TEMPLATE_USED_CANNOT_DELETE = new ErrorCode(1_013_017_002, "不能删除正在使用的装修模板");
|
||||
|
||||
// ========== 装修页面 1-013-018-000 ==========
|
||||
ErrorCode DIY_PAGE_NOT_EXISTS = new ErrorCode(1_013_018_000, "装修页面不存在");
|
||||
ErrorCode DIY_PAGE_NAME_USED = new ErrorCode(1_013_018_001, "装修页面名称({})已经被使用");
|
||||
|
||||
// ========== 客服会话 1-013-019-000 ==========
|
||||
ErrorCode KEFU_CONVERSATION_NOT_EXISTS = new ErrorCode(1_013_019_000, "客服会话不存在");
|
||||
|
||||
// ========== 客服消息 1-013-020-000 ==========
|
||||
ErrorCode KEFU_MESSAGE_NOT_EXISTS = new ErrorCode(1_013_020_000, "客服消息不存在");
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums;
|
||||
|
||||
/**
|
||||
* 通知模板枚举类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
public interface MessageTemplateConstants {
|
||||
|
||||
//======================= 小程序订阅消息模版 =======================
|
||||
|
||||
String COMBINATION_SUCCESS = "拼团结果通知";
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums;
|
||||
|
||||
/**
|
||||
* Promotion 的 WebSocket 消息类型枚举类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
public interface WebSocketMessageTypeConstants {
|
||||
|
||||
// ======================= mall 客服 =======================
|
||||
|
||||
String KEFU_MESSAGE_TYPE = "kefu_message_type"; // 客服消息类型
|
||||
String KEFU_MESSAGE_ADMIN_READ = "kefu_message_read_status_change"; // 客服消息管理员已读
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.banner;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Banner Position 枚举
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum BannerPositionEnum implements ArrayValuable<Integer> {
|
||||
|
||||
HOME_POSITION(1, "首页"),
|
||||
SECKILL_POSITION(2, "秒杀活动页"),
|
||||
COMBINATION_POSITION(3, "砍价活动页"),
|
||||
DISCOUNT_POSITION(4, "限时折扣页"),
|
||||
REWARD_POSITION(5, "满减送页");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(BannerPositionEnum::getPosition).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private final Integer position;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.bargain;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 砍价记录的状态枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum BargainRecordStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
IN_PROGRESS(1, "砍价中"),
|
||||
SUCCESS(2, "砍价成功"),
|
||||
FAILED(3, "砍价失败"), // 活动到期时,会自动将到期的砍价全部设置为过期
|
||||
;
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(BargainRecordStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.combination;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 拼团状态枚举
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum CombinationRecordStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
IN_PROGRESS(0, "进行中"),
|
||||
SUCCESS(1, "拼团成功"),
|
||||
FAILED(2, "拼团失败");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(CombinationRecordStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
public static boolean isSuccess(Integer status) {
|
||||
return ObjectUtil.equal(status, SUCCESS.getStatus());
|
||||
}
|
||||
|
||||
public static boolean isInProgress(Integer status) {
|
||||
return ObjectUtil.equal(status, IN_PROGRESS.getStatus());
|
||||
}
|
||||
|
||||
public static boolean isFailed(Integer status) {
|
||||
return ObjectUtil.equal(status, FAILED.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.common;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
// TODO 芋艿:弱化这个状态
|
||||
/**
|
||||
* 促销活动的状态枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum PromotionActivityStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
WAIT(10, "未开始"),
|
||||
RUN(20, "进行中"),
|
||||
END(30, "已结束"),
|
||||
CLOSE(40, "已关闭");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(PromotionActivityStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.common;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 营销的条件类型枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum PromotionConditionTypeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
PRICE(10, "满 N 元"),
|
||||
COUNT(20, "满 N 件");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(PromotionConditionTypeEnum::getType).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 类型值
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 类型名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.common;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 优惠类型枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PromotionDiscountTypeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
PRICE(1, "满减"), // 具体金额
|
||||
PERCENT(2, "折扣"), // 百分比
|
||||
;
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(PromotionDiscountTypeEnum::getType).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 优惠类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.common;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 营销的商品范围枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PromotionProductScopeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
ALL(1, "全部商品"),
|
||||
SPU(2, "指定商品"),
|
||||
CATEGORY(3, "指定品类");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(PromotionProductScopeEnum::getScope).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 范围值
|
||||
*/
|
||||
private final Integer scope;
|
||||
/**
|
||||
* 范围名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
public static boolean isAll(Integer scope) {
|
||||
return Objects.equals(scope, ALL.scope);
|
||||
}
|
||||
|
||||
public static boolean isSpu(Integer scope) {
|
||||
return Objects.equals(scope, SPU.scope);
|
||||
}
|
||||
|
||||
public static boolean isCategory(Integer scope) {
|
||||
return Objects.equals(scope, CATEGORY.scope);
|
||||
}
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.common;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 营销类型枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PromotionTypeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
SECKILL_ACTIVITY(1, "秒杀活动"),
|
||||
BARGAIN_ACTIVITY(2, "砍价活动"),
|
||||
COMBINATION_ACTIVITY(3, "拼团活动"),
|
||||
|
||||
DISCOUNT_ACTIVITY(4, "限时折扣"),
|
||||
REWARD_ACTIVITY(5, "满减送"),
|
||||
|
||||
MEMBER_LEVEL(6, "会员折扣"),
|
||||
COUPON(7, "优惠劵"),
|
||||
POINT(8, "积分")
|
||||
;
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(PromotionTypeEnum::getType).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 类型值
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 类型名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.coupon;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 优惠劵状态枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum CouponStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
UNUSED(1, "未使用"),
|
||||
USED(2, "已使用"),
|
||||
EXPIRE(3, "已过期");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(CouponStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.coupon;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 优惠劵领取方式
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum CouponTakeTypeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
USER(1, "直接领取"), // 用户可在首页、每日领劵直接领取
|
||||
ADMIN(2, "指定发放"), // 后台指定会员赠送优惠劵
|
||||
REGISTER(3, "新人券"), // 注册时自动领取
|
||||
;
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(CouponTakeTypeEnum::getType).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
public static boolean isUser(Integer type) {
|
||||
return Objects.equals(USER.getType(), type);
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.coupon;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 优惠劵模板的有限期类型的枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum CouponTemplateValidityTypeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
DATE(1, "固定日期"),
|
||||
TERM(2, "领取之后"),
|
||||
;
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(CouponTemplateValidityTypeEnum::getType).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.decorate;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 页面组件枚举
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@SuppressWarnings("JavadocLinkAsPlainText")
|
||||
public enum DecorateComponentEnum {
|
||||
|
||||
/**
|
||||
* 格式:[{
|
||||
* "name": "标题"
|
||||
* "picUrl": "https://www.iocoder.cn/xxx.png",
|
||||
* "url": "/pages/users/index"
|
||||
* }]
|
||||
*
|
||||
* 最多 10 个
|
||||
*/
|
||||
MENU("menu", "菜单"),
|
||||
/**
|
||||
* 格式:[{
|
||||
* "name": "标题"
|
||||
* "url": "/pages/users/index"
|
||||
* }]
|
||||
*/
|
||||
ROLLING_NEWS("scrolling-news", "滚动新闻"),
|
||||
/**
|
||||
* 格式:[{
|
||||
* "picUrl": "https://www.iocoder.cn/xxx.png",
|
||||
* "url": "/pages/users/index"
|
||||
* }]
|
||||
*/
|
||||
SLIDE_SHOW("slide-show", "轮播图"),
|
||||
/**
|
||||
* 格式:[{
|
||||
* "name": "标题"
|
||||
* "type": "类型", // best、hot、new、benefit、good
|
||||
* "tag": "标签" // 例如说:多买多省
|
||||
* }]
|
||||
*
|
||||
* 最多 4 个
|
||||
*/
|
||||
PRODUCT_RECOMMEND("product-recommend", "商品推荐");
|
||||
|
||||
/**
|
||||
* 页面组件代码
|
||||
*/
|
||||
private final String code;
|
||||
|
||||
/**
|
||||
* 页面组件说明
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.diy;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 装修页面枚举
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum DiyPageEnum implements ArrayValuable<Integer> {
|
||||
|
||||
INDEX(1, "首页"),
|
||||
MY(2, "我的"),
|
||||
;
|
||||
|
||||
private static final Integer[] ARRAYS = Arrays.stream(values()).map(DiyPageEnum::getPage).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 页面编号
|
||||
*/
|
||||
private final Integer page;
|
||||
|
||||
/**
|
||||
* 页面名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.promotion.enums.kefu;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 客服消息的类型枚举
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum KeFuMessageContentTypeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
TEXT(1, "文本消息"),
|
||||
IMAGE(2, "图片消息"),
|
||||
VOICE(3, "语音消息"),
|
||||
VIDEO(4, "视频消息"),
|
||||
SYSTEM(5, "系统消息"),
|
||||
|
||||
// ========== 商城特殊消息 ==========
|
||||
PRODUCT(10, "商品消息"),
|
||||
ORDER(11, "订单消息");
|
||||
|
||||
private static final Integer[] ARRAYS = Arrays.stream(values()).map(KeFuMessageContentTypeEnum::getType).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user