Commit de27f4c2dbbf4f788422128a0d5a7ce5847369e1

Authored by luowenfeng
2 parents 07e5e1b5 405bf497

Merge branch 'feature/1.8.0-uniapp' of https://gitee.com/zhijiantianya/ruoyi-vue…

…-pro into feature/1.8.0-uniapp
Showing 96 changed files with 4520 additions and 819 deletions
sql/optional/mall/coupon.sql 0 → 100644
  1 +DROP TABLE IF EXISTS `coupon`;
  2 +CREATE TABLE `coupon`
  3 +(
  4 + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  5 + `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '优惠券类型 reward-满减 discount-折扣 random-随机',
  6 + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '优惠券名称',
  7 + `coupon_type_id` bigint UNSIGNED DEFAULT 0 COMMENT '优惠券类型id',
  8 + `coupon_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '优惠券编码',
  9 + `member_id` bigint UNSIGNED NOT NULL DEFAULT 0 COMMENT '领用人',
  10 + `use_order_id` bigint UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券使用订单id',
  11 + `goods_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用',
  12 + `goods_ids` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '适用商品id',
  13 + `at_least` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最小金额',
  14 + `money` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '面额',
  15 + `discount` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '1 =< 折扣 <= 9.9 当type为discount时需要添加',
  16 + `discount_limit` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最多折扣金额 当type为discount时可选择性添加',
  17 + `whether_forbid_preference` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用',
  18 + `whether_expire_notice` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否开启过期提醒0-不开启 1-开启',
  19 + `expire_notice_fixed_term` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期前N天提醒',
  20 + `whether_noticed` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否已提醒',
  21 + `state` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券状态 1已领用(未使用) 2已使用 3已过期',
  22 + `get_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取',
  23 + `fetch_time` datetime NOT NULL DEFAULT 0 COMMENT '领取时间',
  24 + `use_time` datetime NOT NULL DEFAULT 0 COMMENT '使用时间',
  25 + `start_time` datetime NOT NULL DEFAULT 0 COMMENT '可使用的开始时间',
  26 + `end_time` datetime NOT NULL DEFAULT 0 COMMENT '有效期结束时间',
  27 + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  28 + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  29 + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  30 + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  31 + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  32 + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  33 + PRIMARY KEY (`id`) USING BTREE
  34 +) ENGINE = InnoDB
  35 + AUTO_INCREMENT = 119
  36 + CHARACTER SET = utf8mb4
  37 + COLLATE = utf8mb4_unicode_ci COMMENT = '优惠券';
  38 +
  39 +DROP TABLE IF EXISTS `coupon_templete`;
  40 +CREATE TABLE `coupon_templete`
  41 +(
  42 + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  43 + `type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '优惠券类型 reward-满减 discount-折扣 random-随机',
  44 + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '优惠券名称',
  45 + `coupon_name_remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '名称备注',
  46 + `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '优惠券图片',
  47 + `count` int(11) NOT NULL DEFAULT 0 COMMENT '发放数量',
  48 + `lead_count` int(11) NOT NULL DEFAULT 0 COMMENT '已领取数量',
  49 + `used_count` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已使用数量',
  50 + `goods_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用',
  51 + `product_ids` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '适用商品id',
  52 + `has_use_limit` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用门槛0-无门槛 1-有门槛',
  53 + `at_least` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '满多少元使用 0代表无限制',
  54 + `money` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '发放面额 当type为reward时需要添加',
  55 + `discount` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '1 =< 折扣 <= 9.9 当type为discount时需要添加',
  56 + `discount_limit` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '最多折扣金额 当type为discount时可选择性添加',
  57 + `min_money` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最低金额 当type为radom时需要添加',
  58 + `max_money` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最大金额 当type为radom时需要添加',
  59 + `validity_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期',
  60 + `start_use_time` datetime COMMENT '使用开始日期 过期类型1时必填',
  61 + `end_use_time` datetime COMMENT '使用结束日期 过期类型1时必填',
  62 + `fixed_term` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效',
  63 + `whether_limitless` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否无限制0-否 1是',
  64 + `max_fetch` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '每人最大领取个数',
  65 + `whether_expire_notice` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否开启过期提醒0-不开启 1-开启',
  66 + `expire_notice_fixed_term` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期前N天提醒',
  67 + `whether_forbid_preference` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用',
  68 + `whether_show` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否显示',
  69 + `discount_order_money` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单的优惠总金额',
  70 + `order_money` decimal(10, 2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '用券总成交额',
  71 + `whether_forbidden` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否禁止发放0-否 1-是',
  72 + `order_goods_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用优惠券购买的商品数量',
  73 + `status` tinyint(11) NOT NULL DEFAULT 0 COMMENT '状态(1进行中2已结束-1已关闭)',
  74 + `end_time` datetime COMMENT '有效日期结束时间',
  75 + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  76 + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  77 + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  78 + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  79 + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  80 + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  81 + PRIMARY KEY (`id`) USING BTREE
  82 +) ENGINE = InnoDB
  83 + AUTO_INCREMENT = 119
  84 + CHARACTER SET = utf8mb4
  85 + COLLATE = utf8mb4_unicode_ci COMMENT = '优惠券模板';
0 \ No newline at end of file 86 \ No newline at end of file
yudao-module-mall/pom.xml
@@ -24,6 +24,8 @@ @@ -24,6 +24,8 @@
24 <module>yudao-module-product-biz</module> 24 <module>yudao-module-product-biz</module>
25 <module>yudao-module-trade-api</module> 25 <module>yudao-module-trade-api</module>
26 <module>yudao-module-trade-biz</module> 26 <module>yudao-module-trade-biz</module>
  27 + <module>yudao-module-coupon-api</module>
  28 + <module>yudao-module-coupon-biz</module>
27 </modules> 29 </modules>
28 30
29 </project> 31 </project>
yudao-module-mall/yudao-module-coupon-api/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <groupId>cn.iocoder.boot</groupId>
  7 + <artifactId>yudao-module-mall</artifactId>
  8 + <version>${revision}</version>
  9 + </parent>
  10 +
  11 + <modelVersion>4.0.0</modelVersion>
  12 + <artifactId>yudao-module-coupon-api</artifactId>
  13 + <packaging>jar</packaging>
  14 +
  15 +
  16 + <name>${project.artifactId}</name>
  17 + <description>
  18 + coupon 模块 API,暴露给其它模块调用
  19 + </description>
  20 +
  21 + <dependencies>
  22 + <dependency>
  23 + <groupId>cn.iocoder.boot</groupId>
  24 + <artifactId>yudao-common</artifactId>
  25 + </dependency>
  26 + </dependencies>
  27 +
  28 +</project>
0 \ No newline at end of file 29 \ No newline at end of file
yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponExpireTimeTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.CouponTemplete.enums;
  2 +
  3 +
  4 +import lombok.Getter;
  5 +import lombok.RequiredArgsConstructor;
  6 +
  7 +
  8 +/**
  9 + * 优惠券 - 是否开启过期提醒
  10 + *
  11 + * @author Sin
  12 + */
  13 +@RequiredArgsConstructor
  14 +@Getter
  15 +public enum CouponExpireTimeTypeEnum {
  16 +
  17 + OPEN(1,"不开启"),CLOSE(0,"开启"),;
  18 +
  19 + /**
  20 + * 是否开启过期提醒
  21 + */
  22 + private final Integer type;
  23 + /**
  24 + * 是否开启过期提醒
  25 + */
  26 + private final String name;
  27 +
  28 +}
yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponFetchTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.CouponTemplete.enums;
  2 +
  3 +
  4 +import lombok.Getter;
  5 +import lombok.RequiredArgsConstructor;
  6 +
  7 +
  8 +/**
  9 + * 优惠券 - 领取是否无限制 0
  10 + *
  11 + * @author Sin
  12 + */
  13 +@RequiredArgsConstructor
  14 +@Getter
  15 +public enum CouponFetchTypeEnum {
  16 +
  17 + LIMIT(0,"否"),NOT_LIMIT(0,"开启"),;
  18 +
  19 + /**
  20 + * 是否开启过期提醒
  21 + */
  22 + private final Integer type;
  23 + /**
  24 + * 是否开启过期提醒
  25 + */
  26 + private final String name;
  27 +
  28 +}
yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponProductTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.CouponTemplete.enums;
  2 +
  3 +
  4 +import lombok.Getter;
  5 +import lombok.RequiredArgsConstructor;
  6 +
  7 +
  8 +/**
  9 + * 优惠券 - 优惠券类型
  10 + *
  11 + * @author Sin
  12 + */
  13 +@RequiredArgsConstructor
  14 +@Getter
  15 +public enum CouponProductTypeEnum {
  16 +
  17 + PROCESSING(1,"进行中"),
  18 + END(2,"已结束"),
  19 + CLOSE(3,"已关闭"),;
  20 +
  21 + /**
  22 + * 优惠券类型
  23 + */
  24 + private final Integer type;
  25 + /**
  26 + * 优惠券类型名
  27 + */
  28 + private final String name;
  29 +
  30 +}
yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponStatusTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.CouponTemplete.enums;
  2 +
  3 +
  4 +import lombok.Getter;
  5 +import lombok.RequiredArgsConstructor;
  6 +
  7 +
  8 +/**
  9 + * 优惠券 - 优惠券类型
  10 + *
  11 + * @author Sin
  12 + */
  13 +@RequiredArgsConstructor
  14 +@Getter
  15 +public enum CouponStatusTypeEnum {
  16 +
  17 + ALL(1,"全部商品可用"),
  18 + POINT_PRODUCT(2,"指定商品可用"),
  19 + POINT_PRODUCT_NOT(3,"指定商品不可用不能为空"),;
  20 +
  21 + /**
  22 + * 优惠券类型
  23 + */
  24 + private final Integer type;
  25 + /**
  26 + * 优惠券类型名
  27 + */
  28 + private final String name;
  29 +
  30 +}
yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.CouponTemplete.enums;
  2 +
  3 +
  4 +import lombok.Getter;
  5 +import lombok.RequiredArgsConstructor;
  6 +
  7 +
  8 +/**
  9 + * 优惠券 - 优惠券类型
  10 + *
  11 + * @author Sin
  12 + */
  13 +@RequiredArgsConstructor
  14 +@Getter
  15 +public enum CouponTypeEnum {
  16 +
  17 + REWARD(1,"满减"),
  18 + DISCOUNT(2,"折扣"),
  19 + RANDOW(3,"随机"),;
  20 +
  21 + /**
  22 + * 优惠券类型
  23 + */
  24 + private final Integer type;
  25 + /**
  26 + * 优惠券类型名
  27 + */
  28 + private final String name;
  29 +
  30 +}
yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponUseLimitEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.CouponTemplete.enums;
  2 +
  3 +
  4 +import lombok.Getter;
  5 +import lombok.RequiredArgsConstructor;
  6 +
  7 +
  8 +/**
  9 + * 优惠券 - 优惠券类型
  10 + *
  11 + * @author Sin
  12 + */
  13 +@RequiredArgsConstructor
  14 +@Getter
  15 +public enum CouponUseLimitEnum {
  16 +
  17 + HAS_LIMIT(1,"无门槛"),
  18 + NO_LIMIT(2,"有门槛"),;
  19 +
  20 + /**
  21 + * 优惠券类型
  22 + */
  23 + private final Integer type;
  24 + /**
  25 + * 优惠券类型名
  26 + */
  27 + private final String name;
  28 +
  29 +}
yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponValidityTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.CouponTemplete.enums;
  2 +
  3 +import lombok.Getter;
  4 +import lombok.RequiredArgsConstructor;
  5 +
  6 +/**
  7 + * 过期类型 - 状态
  8 + *
  9 + * @author Sin
  10 + */
  11 +@RequiredArgsConstructor
  12 +@Getter
  13 +public enum CouponValidityTypeEnum {
  14 +
  15 + TIME_RANGE_EXPIRTED(1,"时间范围过期"),
  16 + EXPIRES_AFTER_FIXED_DATE(2,"领取之日固定日期后过期"),
  17 + EXPIRES_DATE_NEXT_FIEXD_DATE(3,"领取次日固定日期后过期不能为空"),;
  18 +
  19 +
  20 + /**
  21 + * 状态值
  22 + */
  23 + private final Integer status;
  24 + /**
  25 + * 状态名
  26 + */
  27 + private final String name;
  28 +
  29 +}
yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/ErrorCodeConstants.java 0 → 100644
  1 +package cn.iocoder.yudao.module.CouponTemplete.enums;
  2 +
  3 +import cn.iocoder.yudao.framework.common.exception.ErrorCode;
  4 +
  5 +/**
  6 + * coupon 优惠券错误码枚举类
  7 + *
  8 + * coupon 优惠券系统,使用 1-010-000-000 段
  9 + */
  10 +public interface ErrorCodeConstants {
  11 + // ========== COUPON分类相关 1010001000 ============
  12 +
  13 + ErrorCode COUPON_TEMPLETE_NOT_EXISTS = new ErrorCode(1010001000, "优惠券模板不存在");
  14 + ErrorCode MONEY_NOT_NULL = new ErrorCode(1010001001, "当type为reward时需要添加发放面额不能为空");
  15 + ErrorCode DISCOUNT_NOT_NULL = new ErrorCode(1010001001, "当type为discount时需要添加折扣不能为空");
  16 + ErrorCode DISCOUNT_LIMIT_NOT_NULL = new ErrorCode(1010001001, "当type为discount时可选择性添加最多折扣金额不能为空");
  17 + ErrorCode MIN_MAX_NOT_NULL = new ErrorCode(1010001001, "当type为radom时需要添加最低金额");
  18 + ErrorCode START_END_TIME_NOT_NULL = new ErrorCode(1010001001, "使用开始日期,使用结束日期不能为空");
  19 + ErrorCode FIXED_TERM_NOT_NULL = new ErrorCode(1010001001, "领取之日起或者次日N天内有效不能为空");
  20 +
  21 +
  22 + // ========== COUPON分类相关 1010002000 ============
  23 + ErrorCode COUPON_NOT_EXISTS = new ErrorCode(1010001000, "优惠券模板不存在");
  24 +
  25 +
  26 +}
  27 +
yudao-module-mall/yudao-module-coupon-biz/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>yudao-module-mall</artifactId>
  7 + <groupId>cn.iocoder.boot</groupId>
  8 + <version>${revision}</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 + <artifactId>yudao-module-coupon-biz</artifactId>
  12 + <packaging>jar</packaging>
  13 +
  14 +
  15 + <name>${project.artifactId}</name>
  16 + <description>
  17 + trade 模块,主要实现交易相关功能
  18 + 例如:订单、退款、购物车等功能。
  19 + </description>
  20 +
  21 + <dependencies>
  22 +
  23 + <dependency>
  24 + <groupId>cn.iocoder.boot</groupId>
  25 + <artifactId>yudao-module-coupon-api</artifactId>
  26 + <version>${revision}</version>
  27 + </dependency>
  28 +
  29 + <!-- 业务组件 -->
  30 + <dependency>
  31 + <groupId>cn.iocoder.boot</groupId>
  32 + <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
  33 + </dependency>
  34 + <dependency>
  35 + <groupId>cn.iocoder.boot</groupId>
  36 + <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
  37 + </dependency>
  38 +
  39 + <!-- Web 相关 -->
  40 + <dependency>
  41 + <groupId>cn.iocoder.boot</groupId>
  42 + <artifactId>yudao-spring-boot-starter-web</artifactId>
  43 + </dependency>
  44 + <dependency>
  45 + <groupId>cn.iocoder.boot</groupId>
  46 + <artifactId>yudao-spring-boot-starter-excel</artifactId>
  47 + </dependency>
  48 +
  49 + <!-- DB 相关 -->
  50 + <dependency>
  51 + <groupId>cn.iocoder.boot</groupId>
  52 + <artifactId>yudao-spring-boot-starter-mybatis</artifactId>
  53 + </dependency>
  54 +
  55 + <!-- Test 测试相关 -->
  56 + <dependency>
  57 + <groupId>cn.iocoder.boot</groupId>
  58 + <artifactId>yudao-spring-boot-starter-test</artifactId>
  59 + </dependency>
  60 +
  61 + </dependencies>
  62 +
  63 +</project>
0 \ No newline at end of file 64 \ No newline at end of file
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/CouponController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon;
  2 +
  3 +import org.springframework.web.bind.annotation.*;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import io.swagger.annotations.*;
  8 +
  9 +import javax.validation.*;
  10 +import java.util.*;
  11 +
  12 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  13 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  14 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  15 +
  16 +
  17 +import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
  18 +import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
  19 +import cn.iocoder.yudao.module.coupon.convert.coupon.CouponConvert;
  20 +import cn.iocoder.yudao.module.coupon.service.coupon.CouponService;
  21 +
  22 +@Api(tags = "管理后台 - 优惠券")
  23 +@RestController
  24 +@RequestMapping("/coupon/coupon/")
  25 +@Validated
  26 +public class CouponController {
  27 +
  28 + @Resource
  29 + private CouponService couponService;
  30 +
  31 +
  32 + //todo 用户优惠券
  33 + @PostMapping("/create")
  34 + @ApiOperation("用户领取优惠券")
  35 + @PreAuthorize("@ss.hasPermission('coupon::create')")
  36 + public CommonResult<Long> create(@RequestParam("couponTemplateId") Long couponTemplateId) {
  37 +
  38 + return success(couponService.create(couponTemplateId));
  39 + }
  40 +
  41 +
  42 + @PutMapping("/update")
  43 + @ApiOperation("更新优惠券")
  44 + @PreAuthorize("@ss.hasPermission('coupon::update')")
  45 + public CommonResult<Boolean> update(@Valid @RequestBody CouponUpdateReqVO updateReqVO) {
  46 + couponService.update(updateReqVO);
  47 + return success(true);
  48 + }
  49 +
  50 + @DeleteMapping("/delete")
  51 + @ApiOperation("删除优惠券")
  52 + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
  53 + @PreAuthorize("@ss.hasPermission('coupon::delete')")
  54 + public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
  55 + couponService.delete(id);
  56 + return success(true);
  57 + }
  58 +
  59 + @GetMapping("/get")
  60 + @ApiOperation("获得优惠券")
  61 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
  62 + @PreAuthorize("@ss.hasPermission('coupon::query')")
  63 + public CommonResult<CouponRespVO> get(@RequestParam("id") Long id) {
  64 + CouponDO couponDO = couponService.get(id);
  65 + return success(CouponConvert.INSTANCE.convert(couponDO));
  66 + }
  67 +
  68 +
  69 +
  70 + @GetMapping("/list")
  71 + @ApiOperation("获得优惠券列表")
  72 +// @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
  73 + @PreAuthorize("@ss.hasPermission('coupon::query')")
  74 + public CommonResult<List<CouponRespVO>> getList(@RequestParam("ids") Collection<Long> ids) {
  75 + List<CouponDO> list = couponService.getList(ids);
  76 + return success(CouponConvert.INSTANCE.convertList(list));
  77 + }
  78 +
  79 + @GetMapping("/page")
  80 + @ApiOperation("获得优惠券分页")
  81 + @PreAuthorize("@ss.hasPermission('coupon::query')")
  82 + public CommonResult<PageResult<CouponRespVO>> getPage(@Valid CouponPageReqVO pageVO) {
  83 + PageResult<CouponDO> pageResult = couponService.getPage(pageVO);
  84 + return success(CouponConvert.INSTANCE.convertPage(pageResult));
  85 + }
  86 +
  87 +
  88 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponBaseVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +import io.swagger.annotations.*;
  7 +import javax.validation.constraints.*;
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +
  10 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  11 +
  12 +/**
  13 +* 优惠券 Base VO,提供给添加、修改、详细的子 VO 使用
  14 +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  15 +*/
  16 +@Data
  17 +public class CouponBaseVO {
  18 +
  19 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机", required = true)
  20 + @NotNull(message = "优惠券类型 reward-满减 discount-折扣 random-随机不能为空")
  21 + private String type;
  22 +
  23 + @ApiModelProperty(value = "优惠券名称", required = true)
  24 + @NotNull(message = "优惠券名称不能为空")
  25 + private String name;
  26 +
  27 + @ApiModelProperty(value = "优惠券类型id")
  28 + private Long couponTypeId;
  29 +
  30 + @ApiModelProperty(value = "优惠券编码", required = true)
  31 + @NotNull(message = "优惠券编码不能为空")
  32 + private String couponCode;
  33 +
  34 + @ApiModelProperty(value = "领用人", required = true)
  35 + @NotNull(message = "领用人不能为空")
  36 + private Long memberId;
  37 +
  38 + @ApiModelProperty(value = "优惠券使用订单id", required = true)
  39 + @NotNull(message = "优惠券使用订单id不能为空")
  40 + private Long useOrderId;
  41 +
  42 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用", required = true)
  43 + @NotNull(message = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用不能为空")
  44 + private Boolean goodsType;
  45 +
  46 + @ApiModelProperty(value = "适用商品id", required = true)
  47 + @NotNull(message = "适用商品id不能为空")
  48 + private String goodsIds;
  49 +
  50 + @ApiModelProperty(value = "最小金额", required = true)
  51 + @NotNull(message = "最小金额不能为空")
  52 + private BigDecimal atLeast;
  53 +
  54 + @ApiModelProperty(value = "面额", required = true)
  55 + @NotNull(message = "面额不能为空")
  56 + private BigDecimal money;
  57 +
  58 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加", required = true)
  59 + @NotNull(message = "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空")
  60 + private BigDecimal discount;
  61 +
  62 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加", required = true)
  63 + @NotNull(message = "最多折扣金额 当type为discount时可选择性添加不能为空")
  64 + private BigDecimal discountLimit;
  65 +
  66 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用", required = true)
  67 + @NotNull(message = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空")
  68 + private Boolean whetherForbidPreference;
  69 +
  70 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启", required = true)
  71 + @NotNull(message = "是否开启过期提醒0-不开启 1-开启不能为空")
  72 + private Boolean whetherExpireNotice;
  73 +
  74 + @ApiModelProperty(value = "过期前N天提醒", required = true)
  75 + @NotNull(message = "过期前N天提醒不能为空")
  76 + private Integer expireNoticeFixedTerm;
  77 +
  78 + @ApiModelProperty(value = "是否已提醒", required = true)
  79 + @NotNull(message = "是否已提醒不能为空")
  80 + private Boolean whetherNoticed;
  81 +
  82 + @ApiModelProperty(value = "优惠券状态 1已领用(未使用) 2已使用 3已过期", required = true)
  83 + @NotNull(message = "优惠券状态 1已领用(未使用) 2已使用 3已过期不能为空")
  84 + private Integer state;
  85 +
  86 + @ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取", required = true)
  87 + @NotNull(message = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取不能为空")
  88 + private Boolean getType;
  89 +
  90 + @ApiModelProperty(value = "领取时间", required = true)
  91 + @NotNull(message = "领取时间不能为空")
  92 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  93 + private Date fetchTime;
  94 +
  95 + @ApiModelProperty(value = "使用时间", required = true)
  96 + @NotNull(message = "使用时间不能为空")
  97 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  98 + private Date useTime;
  99 +
  100 + @ApiModelProperty(value = "可使用的开始时间", required = true)
  101 + @NotNull(message = "可使用的开始时间不能为空")
  102 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  103 + private Date startTime;
  104 +
  105 + @ApiModelProperty(value = "有效期结束时间", required = true)
  106 + @NotNull(message = "有效期结束时间不能为空")
  107 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  108 + private Date endTime;
  109 +
  110 +}
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/activity/vo/ActivityCreateReqVO.java renamed to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponCreateReqVO.java
1 -package cn.iocoder.yudao.module.market.controller.admin.activity.vo; 1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
2 2
3 import lombok.*; 3 import lombok.*;
4 import java.util.*; 4 import java.util.*;
5 import io.swagger.annotations.*; 5 import io.swagger.annotations.*;
6 import javax.validation.constraints.*; 6 import javax.validation.constraints.*;
7 7
8 -/**  
9 - * @author xia  
10 - */  
11 -@ApiModel("管理后台 - 促销活动创建 Request VO") 8 +@ApiModel("管理后台 - 优惠券创建 Request VO")
12 @Data 9 @Data
13 @EqualsAndHashCode(callSuper = true) 10 @EqualsAndHashCode(callSuper = true)
14 @ToString(callSuper = true) 11 @ToString(callSuper = true)
15 -public class ActivityCreateReqVO extends ActivityBaseVO { 12 +public class CouponCreateReqVO extends CouponBaseVO {
16 13
17 } 14 }
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponExcelVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +import io.swagger.annotations.*;
  7 +
  8 +import com.alibaba.excel.annotation.ExcelProperty;
  9 +
  10 +/**
  11 + * 优惠券 Excel VO
  12 + *
  13 + * @author wxr
  14 + */
  15 +@Data
  16 +public class CouponExcelVO {
  17 +
  18 + @ExcelProperty("用户ID")
  19 + private Long id;
  20 +
  21 + @ExcelProperty("优惠券类型 reward-满减 discount-折扣 random-随机")
  22 + private String type;
  23 +
  24 + @ExcelProperty("优惠券名称")
  25 + private String name;
  26 +
  27 + @ExcelProperty("优惠券类型id")
  28 + private Long couponTypeId;
  29 +
  30 + @ExcelProperty("优惠券编码")
  31 + private String couponCode;
  32 +
  33 + @ExcelProperty("领用人")
  34 + private Long memberId;
  35 +
  36 + @ExcelProperty("优惠券使用订单id")
  37 + private Long useOrderId;
  38 +
  39 + @ExcelProperty("适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  40 + private Boolean goodsType;
  41 +
  42 + @ExcelProperty("适用商品id")
  43 + private String goodsIds;
  44 +
  45 + @ExcelProperty("最小金额")
  46 + private BigDecimal atLeast;
  47 +
  48 + @ExcelProperty("面额")
  49 + private BigDecimal money;
  50 +
  51 + @ExcelProperty("1 =< 折扣 <= 9.9 当type为discount时需要添加")
  52 + private BigDecimal discount;
  53 +
  54 + @ExcelProperty("最多折扣金额 当type为discount时可选择性添加")
  55 + private BigDecimal discountLimit;
  56 +
  57 + @ExcelProperty("优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  58 + private Boolean whetherForbidPreference;
  59 +
  60 + @ExcelProperty("是否开启过期提醒0-不开启 1-开启")
  61 + private Boolean whetherExpireNotice;
  62 +
  63 + @ExcelProperty("过期前N天提醒")
  64 + private Integer expireNoticeFixedTerm;
  65 +
  66 + @ExcelProperty("是否已提醒")
  67 + private Boolean whetherNoticed;
  68 +
  69 + @ExcelProperty("优惠券状态 1已领用(未使用) 2已使用 3已过期")
  70 + private Integer state;
  71 +
  72 + @ExcelProperty("获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取")
  73 + private Boolean getType;
  74 +
  75 + @ExcelProperty("领取时间")
  76 + private Date fetchTime;
  77 +
  78 + @ExcelProperty("使用时间")
  79 + private Date useTime;
  80 +
  81 + @ExcelProperty("可使用的开始时间")
  82 + private Date startTime;
  83 +
  84 + @ExcelProperty("有效期结束时间")
  85 + private Date endTime;
  86 +
  87 + @ExcelProperty("创建时间")
  88 + private Date createTime;
  89 +
  90 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponExportReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +
  5 +import java.math.BigDecimal;
  6 +import java.util.*;
  7 +import io.swagger.annotations.*;
  8 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  9 +import org.springframework.format.annotation.DateTimeFormat;
  10 +
  11 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +
  13 +@ApiModel(value = "管理后台 - 优惠券 Excel 导出 Request VO", description = "参数和 CouponPageReqVO 是一致的")
  14 +@Data
  15 +public class CouponExportReqVO {
  16 +
  17 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
  18 + private String type;
  19 +
  20 + @ApiModelProperty(value = "优惠券名称")
  21 + private String name;
  22 +
  23 + @ApiModelProperty(value = "优惠券类型id")
  24 + private Long couponTypeId;
  25 +
  26 + @ApiModelProperty(value = "优惠券编码")
  27 + private String couponCode;
  28 +
  29 + @ApiModelProperty(value = "领用人")
  30 + private Long memberId;
  31 +
  32 + @ApiModelProperty(value = "优惠券使用订单id")
  33 + private Long useOrderId;
  34 +
  35 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  36 + private Boolean goodsType;
  37 +
  38 + @ApiModelProperty(value = "适用商品id")
  39 + private String goodsIds;
  40 +
  41 + @ApiModelProperty(value = "最小金额")
  42 + private BigDecimal atLeast;
  43 +
  44 + @ApiModelProperty(value = "面额")
  45 + private BigDecimal money;
  46 +
  47 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
  48 + private BigDecimal discount;
  49 +
  50 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
  51 + private BigDecimal discountLimit;
  52 +
  53 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  54 + private Boolean whetherForbidPreference;
  55 +
  56 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
  57 + private Boolean whetherExpireNotice;
  58 +
  59 + @ApiModelProperty(value = "过期前N天提醒")
  60 + private Integer expireNoticeFixedTerm;
  61 +
  62 + @ApiModelProperty(value = "是否已提醒")
  63 + private Boolean whetherNoticed;
  64 +
  65 + @ApiModelProperty(value = "优惠券状态 1已领用(未使用) 2已使用 3已过期")
  66 + private Integer state;
  67 +
  68 + @ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取")
  69 + private Boolean getType;
  70 +
  71 + @ApiModelProperty(value = "领取时间")
  72 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  73 + private Date[] fetchTime;
  74 +
  75 + @ApiModelProperty(value = "使用时间")
  76 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  77 + private Date[] useTime;
  78 +
  79 + @ApiModelProperty(value = "可使用的开始时间")
  80 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  81 + private Date[] startTime;
  82 +
  83 + @ApiModelProperty(value = "有效期结束时间")
  84 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  85 + private Date[] endTime;
  86 +
  87 + @ApiModelProperty(value = "创建时间")
  88 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  89 + private Date[] createTime;
  90 +
  91 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
  2 +
  3 +import lombok.*;
  4 +
  5 +import java.math.BigDecimal;
  6 +import java.util.*;
  7 +import io.swagger.annotations.*;
  8 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  9 +import org.springframework.format.annotation.DateTimeFormat;
  10 +
  11 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +
  13 +@ApiModel("管理后台 - 优惠券分页 Request VO")
  14 +@Data
  15 +@EqualsAndHashCode(callSuper = true)
  16 +@ToString(callSuper = true)
  17 +public class CouponPageReqVO extends PageParam {
  18 +
  19 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
  20 + private String type;
  21 +
  22 + @ApiModelProperty(value = "优惠券名称")
  23 + private String name;
  24 +
  25 + @ApiModelProperty(value = "优惠券类型id")
  26 + private Long couponTypeId;
  27 +
  28 + @ApiModelProperty(value = "优惠券编码")
  29 + private String couponCode;
  30 +
  31 + @ApiModelProperty(value = "领用人")
  32 + private Long memberId;
  33 +
  34 + @ApiModelProperty(value = "优惠券使用订单id")
  35 + private Long useOrderId;
  36 +
  37 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  38 + private Boolean goodsType;
  39 +
  40 + @ApiModelProperty(value = "适用商品id")
  41 + private String goodsIds;
  42 +
  43 + @ApiModelProperty(value = "最小金额")
  44 + private BigDecimal atLeast;
  45 +
  46 + @ApiModelProperty(value = "面额")
  47 + private BigDecimal money;
  48 +
  49 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
  50 + private BigDecimal discount;
  51 +
  52 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
  53 + private BigDecimal discountLimit;
  54 +
  55 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  56 + private Boolean whetherForbidPreference;
  57 +
  58 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
  59 + private Boolean whetherExpireNotice;
  60 +
  61 + @ApiModelProperty(value = "过期前N天提醒")
  62 + private Integer expireNoticeFixedTerm;
  63 +
  64 + @ApiModelProperty(value = "是否已提醒")
  65 + private Boolean whetherNoticed;
  66 +
  67 + @ApiModelProperty(value = "优惠券状态 1已领用(未使用) 2已使用 3已过期")
  68 + private Integer state;
  69 +
  70 + @ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取")
  71 + private Boolean getType;
  72 +
  73 + @ApiModelProperty(value = "领取时间")
  74 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  75 + private Date[] fetchTime;
  76 +
  77 + @ApiModelProperty(value = "使用时间")
  78 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  79 + private Date[] useTime;
  80 +
  81 + @ApiModelProperty(value = "可使用的开始时间")
  82 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  83 + private Date[] startTime;
  84 +
  85 + @ApiModelProperty(value = "有效期结束时间")
  86 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  87 + private Date[] endTime;
  88 +
  89 + @ApiModelProperty(value = "创建时间")
  90 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  91 + private Date[] createTime;
  92 +
  93 +}
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/activity/vo/ActivityRespVO.java renamed to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponRespVO.java
1 -package cn.iocoder.yudao.module.market.controller.admin.activity.vo; 1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
2 2
3 import lombok.*; 3 import lombok.*;
4 import java.util.*; 4 import java.util.*;
5 import io.swagger.annotations.*; 5 import io.swagger.annotations.*;
6 6
7 -@ApiModel("管理后台 - 促销活动 Response VO") 7 +@ApiModel("管理后台 - 优惠券 Response VO")
8 @Data 8 @Data
9 @EqualsAndHashCode(callSuper = true) 9 @EqualsAndHashCode(callSuper = true)
10 @ToString(callSuper = true) 10 @ToString(callSuper = true)
11 -public class ActivityRespVO extends ActivityBaseVO { 11 +public class CouponRespVO extends CouponBaseVO {
12 12
13 - @ApiModelProperty(value = "活动编号", required = true) 13 + @ApiModelProperty(value = "用户ID", required = true)
14 private Long id; 14 private Long id;
15 15
16 @ApiModelProperty(value = "创建时间", required = true) 16 @ApiModelProperty(value = "创建时间", required = true)
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/activity/vo/ActivityUpdateReqVO.java renamed to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponUpdateReqVO.java
1 -package cn.iocoder.yudao.module.market.controller.admin.activity.vo; 1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
2 2
3 import lombok.*; 3 import lombok.*;
4 import java.util.*; 4 import java.util.*;
5 import io.swagger.annotations.*; 5 import io.swagger.annotations.*;
6 import javax.validation.constraints.*; 6 import javax.validation.constraints.*;
7 7
8 -@ApiModel("管理后台 - 促销活动更新 Request VO") 8 +@ApiModel("管理后台 - 优惠券更新 Request VO")
9 @Data 9 @Data
10 @EqualsAndHashCode(callSuper = true) 10 @EqualsAndHashCode(callSuper = true)
11 @ToString(callSuper = true) 11 @ToString(callSuper = true)
12 -public class ActivityUpdateReqVO extends ActivityBaseVO { 12 +public class CouponUpdateReqVO extends CouponBaseVO {
13 13
14 - @ApiModelProperty(value = "活动编号", required = true)  
15 - @NotNull(message = "活动编号不能为空") 14 + @ApiModelProperty(value = "用户ID", required = true)
  15 + @NotNull(message = "用户ID不能为空")
16 private Long id; 16 private Long id;
17 17
18 } 18 }
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/CouponTempleteController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete;
  2 +
  3 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.*;
  4 +import cn.iocoder.yudao.module.coupon.convert.CouponTemplete.CouponTempleteConvert;
  5 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
  6 +import cn.iocoder.yudao.module.coupon.service.CouponTemplete.CouponTempleteService;
  7 +import org.springframework.web.bind.annotation.*;
  8 +import javax.annotation.Resource;
  9 +import org.springframework.validation.annotation.Validated;
  10 +import org.springframework.security.access.prepost.PreAuthorize;
  11 +import io.swagger.annotations.*;
  12 +
  13 +import javax.validation.*;
  14 +import java.util.*;
  15 +
  16 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  17 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  18 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  19 +
  20 +@Api(tags = "管理后台 - 优惠券模板")
  21 +@RestController
  22 +@RequestMapping("/coupon/CouponTemplete/")
  23 +@Validated
  24 +public class CouponTempleteController {
  25 +
  26 + @Resource
  27 + private CouponTempleteService Service;
  28 +
  29 + @PostMapping("/create")
  30 + @ApiOperation("创建优惠券模板")
  31 + @PreAuthorize("@ss.hasPermission('CouponTemplete::create')")
  32 + public CommonResult<Long> create(@Valid @RequestBody CouponTempleteCreateReqVO createReqVO) {
  33 + return success(Service.create(createReqVO));
  34 + }
  35 +
  36 + @PutMapping("/update")
  37 + @ApiOperation("更新优惠券模板")
  38 + @PreAuthorize("@ss.hasPermission('CouponTemplete::update')")
  39 + public CommonResult<Boolean> update(@Valid @RequestBody CouponTempleteUpdateReqVO updateReqVO) {
  40 + Service.update(updateReqVO);
  41 + return success(true);
  42 + }
  43 +
  44 + @DeleteMapping("/delete")
  45 + @ApiOperation("删除优惠券模板")
  46 + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
  47 + @PreAuthorize("@ss.hasPermission('CouponTemplete::delete')")
  48 + public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
  49 + Service.delete(id);
  50 + return success(true);
  51 + }
  52 +
  53 + @GetMapping("/get")
  54 + @ApiOperation("获得优惠券模板")
  55 +// @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
  56 + @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
  57 + public CommonResult<CouponTempleteRespVO> get(@RequestParam("id") Long id) {
  58 + CouponTempleteDO couponTempleteDO = Service.get(id);
  59 + return success(CouponTempleteConvert.INSTANCE.convert(couponTempleteDO));
  60 + }
  61 +
  62 + @GetMapping("/list")
  63 + @ApiOperation("获得优惠券模板列表")
  64 +// @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
  65 + @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
  66 + public CommonResult<List<CouponTempleteRespVO>> getList(@RequestParam("ids") Collection<Long> ids) {
  67 + List<CouponTempleteDO> list = Service.getList(ids);
  68 + return success(CouponTempleteConvert.INSTANCE.convertList(list));
  69 + }
  70 +
  71 + @GetMapping("/page")
  72 + @ApiOperation("获得优惠券模板分页")
  73 + @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
  74 + public CommonResult<PageResult<CouponTempleteRespVO>> getPage(@Valid CouponTempletePageReqVO pageVO) {
  75 + PageResult<CouponTempleteDO> pageResult = Service.getPage(pageVO);
  76 + return success(CouponTempleteConvert.INSTANCE.convertPage(pageResult));
  77 + }
  78 +
  79 +
  80 +
  81 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteBaseVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +import io.swagger.annotations.*;
  7 +import javax.validation.constraints.*;
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +
  10 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  11 +
  12 +/**
  13 +* 优惠券模板 Base VO,提供给添加、修改、详细的子 VO 使用
  14 +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  15 +*/
  16 +@Data
  17 +public class CouponTempleteBaseVO {
  18 +
  19 +
  20 + //基本信息
  21 +
  22 + @ApiModelProperty(value = "优惠券名称", required = true)
  23 + @NotNull(message = "优惠券名称不能为空")
  24 + private String name;
  25 +
  26 + @ApiModelProperty(value = "名称备注")
  27 + private String couponNameRemark;
  28 +
  29 + @ApiModelProperty(value = "优惠券图片")
  30 + private String image;
  31 +
  32 + /* ============判断适用商品——开始============= */
  33 +
  34 +
  35 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用", required = true)
  36 + @NotNull(message = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用不能为空")
  37 + private Boolean goodsType;
  38 +
  39 + @ApiModelProperty(value = "适用商品id")
  40 + private String productIds;
  41 +
  42 + @ApiModelProperty(value = "使用门槛0-无门槛 1-有门槛", required = true)
  43 + @NotNull(message = "使用门槛0-无门槛 1-有门槛不能为空")
  44 + private Boolean hasUseLimit;
  45 +
  46 + @ApiModelProperty(value = "满多少元使用 0代表无限制", required = true)
  47 + @NotNull(message = "满多少元使用 0代表无限制不能为空")
  48 + private BigDecimal atLeast;
  49 +
  50 +
  51 + /* ============折扣类型——开始============= */
  52 +
  53 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机", required = true)
  54 + @NotNull(message = "优惠券类型 reward-满减 discount-折扣 random-随机不能为空")
  55 + private String type;
  56 +
  57 + @ApiModelProperty(value = "发放面额 当type为reward时需要添加")
  58 + @NotNull(message = "发放面额 当type为reward时需要添加不能为空")
  59 + private BigDecimal money;
  60 +
  61 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
  62 + @NotNull(message = "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空")
  63 + private BigDecimal discount;
  64 +
  65 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
  66 + @NotNull(message = "最多折扣金额 当type为discount时可选择性添加不能为空")
  67 + private BigDecimal discountLimit;
  68 +
  69 + @ApiModelProperty(value = "最低金额 当type为radom时需要添加", required = true)
  70 + @NotNull(message = "最低金额 当type为radom时需要添加不能为空")
  71 + private BigDecimal minMoney;
  72 +
  73 + @ApiModelProperty(value = "最大金额 当type为radom时需要添加", required = true)
  74 + @NotNull(message = "最大金额 当type为radom时需要添加不能为空")
  75 + private BigDecimal maxMoney;
  76 +
  77 + /* ============折扣类型——结束============= */
  78 +
  79 +
  80 + /* ============过期类型——开始============= */
  81 +
  82 +
  83 + @ApiModelProperty(value = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期", required = true)
  84 + @NotNull(message = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期 不能为空")
  85 + private Integer validityType;
  86 +
  87 + @ApiModelProperty(value = "使用开始日期 过期类型1时必填")
  88 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  89 + private Date startUseTime;
  90 +
  91 + @ApiModelProperty(value = "使用结束日期 过期类型1时必填")
  92 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  93 + private Date endUseTime;
  94 +
  95 + @ApiModelProperty(value = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
  96 + @NotNull(message = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效不能为空")
  97 + private Integer fixedTerm;
  98 +
  99 + @ApiModelProperty(value = "有效日期结束时间")
  100 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  101 + private Date endTime;
  102 +
  103 + /* ============过期类型——结束============= */
  104 +
  105 +
  106 + @ApiModelProperty(value = "领取是否无限制0-否 1是", required = true)
  107 + @NotNull(message = "是否无限制0-否 1是 不能为空")
  108 + private Boolean whetherLimitless;
  109 +
  110 + @ApiModelProperty(value = "每人最大领取个数", required = true)
  111 + @NotNull(message = "每人最大领取个数不能为空")
  112 + private Integer maxFetch;
  113 +
  114 + @ApiModelProperty(value = "是否开启过期提醒 0-不开启 1-开启", required = true)
  115 + @NotNull(message = "是否开启过期提醒0-不开启 1-开启不能为空")
  116 + private Boolean whetherExpireNotice;
  117 +
  118 + @ApiModelProperty(value = "过期前N天提醒", required = true)
  119 + @NotNull(message = "过期前N天提醒不能为空")
  120 + private Integer expireNoticeFixedTerm;
  121 +
  122 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用", required = true)
  123 + @NotNull(message = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空")
  124 + private Boolean whetherForbidPreference;
  125 +
  126 + @ApiModelProperty(value = "是否显示", required = true)
  127 + @NotNull(message = "是否显示不能为空")
  128 + private Integer whetherShow;
  129 +
  130 + @ApiModelProperty(value = "是否禁止发放0-否 1-是", required = true)
  131 + @NotNull(message = "是否禁止发放0-否 1-是不能为空")
  132 + private Boolean whetherForbidden;
  133 +
  134 + /* ============汇总计算——开始============= */
  135 +
  136 +
  137 +
  138 + @ApiModelProperty(value = "使用优惠券购买的商品数量", required = true)
  139 + @NotNull(message = "使用优惠券购买的商品数量不能为空")
  140 + private Integer orderGoodsNum;
  141 +
  142 + @ApiModelProperty(value = "订单的优惠总金额", required = true)
  143 + @NotNull(message = "订单的优惠总金额不能为空")
  144 + private BigDecimal discountOrderMoney;
  145 +
  146 + @ApiModelProperty(value = "用券总成交额", required = true)
  147 + @NotNull(message = "用券总成交额不能为空")
  148 + private BigDecimal orderMoney;
  149 +
  150 + @ApiModelProperty(value = "发放数量", required = true)
  151 + @NotNull(message = "发放数量不能为空")
  152 + private Integer count;
  153 +
  154 + @ApiModelProperty(value = "已领取数量", required = true)
  155 + @NotNull(message = "已领取数量不能为空")
  156 + private Integer leadCount;
  157 +
  158 + @ApiModelProperty(value = "已使用数量", required = true)
  159 + @NotNull(message = "已使用数量不能为空")
  160 + private Integer usedCount;
  161 +
  162 +
  163 + /* ============汇总计算——结束============= */
  164 +
  165 +
  166 + @ApiModelProperty(value = "状态(1进行中2已结束3已关闭)", required = true)
  167 + @NotNull(message = "状态(1进行中2已结束-1已关闭)不能为空")
  168 + private Integer status;
  169 +
  170 +
  171 +
  172 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +import io.swagger.annotations.*;
  5 +
  6 +@ApiModel("管理后台 - 优惠券模板创建 Request VO")
  7 +@Data
  8 +@EqualsAndHashCode(callSuper = true)
  9 +@ToString(callSuper = true)
  10 +public class CouponTempleteCreateReqVO extends CouponTempleteBaseVO {
  11 +
  12 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteExcelVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +
  7 +import com.alibaba.excel.annotation.ExcelProperty;
  8 +
  9 +/**
  10 + * 优惠券模板 Excel VO
  11 + *
  12 + * @author wxr
  13 + */
  14 +@Data
  15 +public class CouponTempleteExcelVO {
  16 +
  17 + @ExcelProperty("用户ID")
  18 + private Long id;
  19 +
  20 + @ExcelProperty("优惠券类型 reward-满减 discount-折扣 random-随机")
  21 + private String type;
  22 +
  23 + @ExcelProperty("优惠券名称")
  24 + private String name;
  25 +
  26 + @ExcelProperty("名称备注")
  27 + private String couponNameRemark;
  28 +
  29 + @ExcelProperty("优惠券图片")
  30 + private String image;
  31 +
  32 + @ExcelProperty("发放数量")
  33 + private Integer count;
  34 +
  35 + @ExcelProperty("已领取数量")
  36 + private Integer leadCount;
  37 +
  38 + @ExcelProperty("已使用数量")
  39 + private Integer usedCount;
  40 +
  41 + @ExcelProperty("适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  42 + private Boolean goodsType;
  43 +
  44 + @ExcelProperty("适用商品id")
  45 + private String productIds;
  46 +
  47 + @ExcelProperty("使用门槛0-无门槛 1-有门槛")
  48 + private Boolean hasUseLimit;
  49 +
  50 + @ExcelProperty("满多少元使用 0代表无限制")
  51 + private BigDecimal atLeast;
  52 +
  53 + @ExcelProperty("发放面额 当type为reward时需要添加")
  54 + private BigDecimal money;
  55 +
  56 + @ExcelProperty("1 =< 折扣 <= 9.9 当type为discount时需要添加")
  57 + private BigDecimal discount;
  58 +
  59 + @ExcelProperty("最多折扣金额 当type为discount时可选择性添加")
  60 + private BigDecimal discountLimit;
  61 +
  62 + @ExcelProperty("最低金额 当type为radom时需要添加")
  63 + private BigDecimal minMoney;
  64 +
  65 + @ExcelProperty("最大金额 当type为radom时需要添加")
  66 + private BigDecimal maxMoney;
  67 +
  68 + @ExcelProperty("过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")
  69 + private Boolean validityType;
  70 +
  71 + @ExcelProperty("使用开始日期 过期类型1时必填")
  72 + private Date startUseTime;
  73 +
  74 + @ExcelProperty("使用结束日期 过期类型1时必填")
  75 + private Date endUseTime;
  76 +
  77 + @ExcelProperty("当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
  78 + private Integer fixedTerm;
  79 +
  80 + @ExcelProperty("是否无限制0-否 1是")
  81 + private Boolean whetherLimitless;
  82 +
  83 + @ExcelProperty("每人最大领取个数")
  84 + private Integer maxFetch;
  85 +
  86 + @ExcelProperty("是否开启过期提醒0-不开启 1-开启")
  87 + private Boolean whetherExpireNotice;
  88 +
  89 + @ExcelProperty("过期前N天提醒")
  90 + private Integer expireNoticeFixedTerm;
  91 +
  92 + @ExcelProperty("优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  93 + private Boolean whetherForbidPreference;
  94 +
  95 + @ExcelProperty("是否显示")
  96 + private Integer whetherShow;
  97 +
  98 + @ExcelProperty("订单的优惠总金额")
  99 + private BigDecimal discountOrderMoney;
  100 +
  101 + @ExcelProperty("用券总成交额")
  102 + private BigDecimal orderMoney;
  103 +
  104 + @ExcelProperty("是否禁止发放0-否 1-是")
  105 + private Boolean whetherForbidden;
  106 +
  107 + @ExcelProperty("使用优惠券购买的商品数量")
  108 + private Integer orderGoodsNum;
  109 +
  110 + @ExcelProperty("状态(1进行中2已结束-1已关闭)")
  111 + private Integer status;
  112 +
  113 + @ExcelProperty("有效日期结束时间")
  114 + private Date endTime;
  115 +
  116 + @ExcelProperty("创建时间")
  117 + private Date createTime;
  118 +
  119 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteExportReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +
  5 +import java.math.BigDecimal;
  6 +import java.util.*;
  7 +import io.swagger.annotations.*;
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +
  10 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  11 +
  12 +@ApiModel(value = "管理后台 - 优惠券模板 Excel 导出 Request VO", description = "参数和 CouponTempletePageReqVO 是一致的")
  13 +@Data
  14 +public class CouponTempleteExportReqVO {
  15 +
  16 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
  17 + private String type;
  18 +
  19 + @ApiModelProperty(value = "优惠券名称")
  20 + private String name;
  21 +
  22 + @ApiModelProperty(value = "名称备注")
  23 + private String couponNameRemark;
  24 +
  25 + @ApiModelProperty(value = "优惠券图片")
  26 + private String image;
  27 +
  28 + @ApiModelProperty(value = "发放数量")
  29 + private Integer count;
  30 +
  31 + @ApiModelProperty(value = "已领取数量")
  32 + private Integer leadCount;
  33 +
  34 + @ApiModelProperty(value = "已使用数量")
  35 + private Integer usedCount;
  36 +
  37 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  38 + private Boolean goodsType;
  39 +
  40 + @ApiModelProperty(value = "适用商品id")
  41 + private String productIds;
  42 +
  43 + @ApiModelProperty(value = "使用门槛0-无门槛 1-有门槛")
  44 + private Boolean hasUseLimit;
  45 +
  46 + @ApiModelProperty(value = "满多少元使用 0代表无限制")
  47 + private BigDecimal atLeast;
  48 +
  49 + @ApiModelProperty(value = "发放面额 当type为reward时需要添加")
  50 + private BigDecimal money;
  51 +
  52 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
  53 + private BigDecimal discount;
  54 +
  55 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
  56 + private BigDecimal discountLimit;
  57 +
  58 + @ApiModelProperty(value = "最低金额 当type为radom时需要添加")
  59 + private BigDecimal minMoney;
  60 +
  61 + @ApiModelProperty(value = "最大金额 当type为radom时需要添加")
  62 + private BigDecimal maxMoney;
  63 +
  64 + @ApiModelProperty(value = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")
  65 + private Boolean validityType;
  66 +
  67 + @ApiModelProperty(value = "使用开始日期 过期类型1时必填")
  68 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  69 + private Date[] startUseTime;
  70 +
  71 + @ApiModelProperty(value = "使用结束日期 过期类型1时必填")
  72 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  73 + private Date[] endUseTime;
  74 +
  75 + @ApiModelProperty(value = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
  76 + private Integer fixedTerm;
  77 +
  78 + @ApiModelProperty(value = "是否无限制0-否 1是")
  79 + private Boolean whetherLimitless;
  80 +
  81 + @ApiModelProperty(value = "每人最大领取个数")
  82 + private Integer maxFetch;
  83 +
  84 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
  85 + private Boolean whetherExpireNotice;
  86 +
  87 + @ApiModelProperty(value = "过期前N天提醒")
  88 + private Integer expireNoticeFixedTerm;
  89 +
  90 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  91 + private Boolean whetherForbidPreference;
  92 +
  93 + @ApiModelProperty(value = "是否显示")
  94 + private Integer whetherShow;
  95 +
  96 + @ApiModelProperty(value = "订单的优惠总金额")
  97 + private BigDecimal discountOrderMoney;
  98 +
  99 + @ApiModelProperty(value = "用券总成交额")
  100 + private BigDecimal orderMoney;
  101 +
  102 + @ApiModelProperty(value = "是否禁止发放0-否 1-是")
  103 + private Boolean whetherForbidden;
  104 +
  105 + @ApiModelProperty(value = "使用优惠券购买的商品数量")
  106 + private Integer orderGoodsNum;
  107 +
  108 + @ApiModelProperty(value = "状态(1进行中2已结束-1已关闭)")
  109 + private Integer status;
  110 +
  111 + @ApiModelProperty(value = "有效日期结束时间")
  112 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  113 + private Date[] endTime;
  114 +
  115 + @ApiModelProperty(value = "创建时间")
  116 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  117 + private Date[] createTime;
  118 +
  119 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempletePageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +
  5 +import java.math.BigDecimal;
  6 +import java.util.*;
  7 +import io.swagger.annotations.*;
  8 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  9 +import org.springframework.format.annotation.DateTimeFormat;
  10 +
  11 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +
  13 +@ApiModel("管理后台 - 优惠券模板分页 Request VO")
  14 +@Data
  15 +@EqualsAndHashCode(callSuper = true)
  16 +@ToString(callSuper = true)
  17 +public class CouponTempletePageReqVO extends PageParam {
  18 +
  19 + @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")
  20 + private String type;
  21 +
  22 + @ApiModelProperty(value = "优惠券名称")
  23 + private String name;
  24 +
  25 + @ApiModelProperty(value = "名称备注")
  26 + private String couponNameRemark;
  27 +
  28 + @ApiModelProperty(value = "优惠券图片")
  29 + private String image;
  30 +
  31 + @ApiModelProperty(value = "发放数量")
  32 + private Integer count;
  33 +
  34 + @ApiModelProperty(value = "已领取数量")
  35 + private Integer leadCount;
  36 +
  37 + @ApiModelProperty(value = "已使用数量")
  38 + private Integer usedCount;
  39 +
  40 + @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
  41 + private Boolean goodsType;
  42 +
  43 + @ApiModelProperty(value = "适用商品id")
  44 + private String productIds;
  45 +
  46 + @ApiModelProperty(value = "使用门槛0-无门槛 1-有门槛")
  47 + private Boolean hasUseLimit;
  48 +
  49 + @ApiModelProperty(value = "满多少元使用 0代表无限制")
  50 + private BigDecimal atLeast;
  51 +
  52 + @ApiModelProperty(value = "发放面额 当type为reward时需要添加")
  53 + private BigDecimal money;
  54 +
  55 + @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")
  56 + private BigDecimal discount;
  57 +
  58 + @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")
  59 + private BigDecimal discountLimit;
  60 +
  61 + @ApiModelProperty(value = "最低金额 当type为radom时需要添加")
  62 + private BigDecimal minMoney;
  63 +
  64 + @ApiModelProperty(value = "最大金额 当type为radom时需要添加")
  65 + private BigDecimal maxMoney;
  66 +
  67 + @ApiModelProperty(value = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")
  68 + private Boolean validityType;
  69 +
  70 + @ApiModelProperty(value = "使用开始日期 过期类型1时必填")
  71 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  72 + private Date[] startUseTime;
  73 +
  74 + @ApiModelProperty(value = "使用结束日期 过期类型1时必填")
  75 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  76 + private Date[] endUseTime;
  77 +
  78 + @ApiModelProperty(value = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")
  79 + private Integer fixedTerm;
  80 +
  81 + @ApiModelProperty(value = "是否无限制0-否 1是")
  82 + private Boolean whetherLimitless;
  83 +
  84 + @ApiModelProperty(value = "每人最大领取个数")
  85 + private Integer maxFetch;
  86 +
  87 + @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")
  88 + private Boolean whetherExpireNotice;
  89 +
  90 + @ApiModelProperty(value = "过期前N天提醒")
  91 + private Integer expireNoticeFixedTerm;
  92 +
  93 + @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")
  94 + private Boolean whetherForbidPreference;
  95 +
  96 + @ApiModelProperty(value = "是否显示")
  97 + private Integer whetherShow;
  98 +
  99 + @ApiModelProperty(value = "订单的优惠总金额")
  100 + private BigDecimal discountOrderMoney;
  101 +
  102 + @ApiModelProperty(value = "用券总成交额")
  103 + private BigDecimal orderMoney;
  104 +
  105 + @ApiModelProperty(value = "是否禁止发放0-否 1-是")
  106 + private Boolean whetherForbidden;
  107 +
  108 + @ApiModelProperty(value = "使用优惠券购买的商品数量")
  109 + private Integer orderGoodsNum;
  110 +
  111 + @ApiModelProperty(value = "状态(1进行中2已结束-1已关闭)")
  112 + private Integer status;
  113 +
  114 + @ApiModelProperty(value = "有效日期结束时间")
  115 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  116 + private Date[] endTime;
  117 +
  118 + @ApiModelProperty(value = "创建时间")
  119 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  120 + private Date[] createTime;
  121 +
  122 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.annotations.*;
  6 +
  7 +@ApiModel("管理后台 - 优惠券模板 Response VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class CouponTempleteRespVO extends CouponTempleteBaseVO {
  12 +
  13 + @ApiModelProperty(value = "用户ID", required = true)
  14 + private Long id;
  15 +
  16 + @ApiModelProperty(value = "创建时间", required = true)
  17 + private Date createTime;
  18 +
  19 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteUpdateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
  2 +
  3 +import lombok.*;
  4 +import io.swagger.annotations.*;
  5 +import javax.validation.constraints.*;
  6 +
  7 +@ApiModel("管理后台 - 优惠券模板更新 Request VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class CouponTempleteUpdateReqVO extends CouponTempleteBaseVO {
  12 +
  13 + @ApiModelProperty(value = "用户ID", required = true)
  14 + @NotNull(message = "用户ID不能为空")
  15 + private Long id;
  16 +
  17 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/convert/CouponTemplete/CouponTempleteConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.convert.CouponTemplete;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +
  7 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteCreateReqVO;
  8 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteExcelVO;
  9 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteRespVO;
  10 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteUpdateReqVO;
  11 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
  12 +import org.mapstruct.Mapper;
  13 +import org.mapstruct.factory.Mappers;
  14 +
  15 +
  16 +/**
  17 + * 优惠券模板 Convert
  18 + *
  19 + * @author wxr
  20 + */
  21 +@Mapper
  22 +public interface CouponTempleteConvert {
  23 +
  24 + CouponTempleteConvert INSTANCE = Mappers.getMapper(CouponTempleteConvert.class);
  25 +
  26 + CouponTempleteDO convert(CouponTempleteCreateReqVO bean);
  27 +
  28 + CouponTempleteDO convert(CouponTempleteUpdateReqVO bean);
  29 +
  30 + CouponTempleteRespVO convert(CouponTempleteDO bean);
  31 +
  32 + List<CouponTempleteRespVO> convertList(List<CouponTempleteDO> list);
  33 +
  34 + PageResult<CouponTempleteRespVO> convertPage(PageResult<CouponTempleteDO> page);
  35 +
  36 + List<CouponTempleteExcelVO> convertList02(List<CouponTempleteDO> list);
  37 +
  38 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/convert/coupon/CouponConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.convert.coupon;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +
  7 +import org.mapstruct.Mapper;
  8 +import org.mapstruct.factory.Mappers;
  9 +import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
  10 +import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
  11 +
  12 +/**
  13 + * 优惠券 Convert
  14 + *
  15 + * @author wxr
  16 + */
  17 +@Mapper
  18 +public interface CouponConvert {
  19 +
  20 + CouponConvert INSTANCE = Mappers.getMapper(CouponConvert.class);
  21 +
  22 + CouponDO convert(CouponCreateReqVO bean);
  23 +
  24 + CouponDO convert(CouponUpdateReqVO bean);
  25 +
  26 + CouponRespVO convert(CouponDO bean);
  27 +
  28 + List<CouponRespVO> convertList(List<CouponDO> list);
  29 +
  30 + PageResult<CouponRespVO> convertPage(PageResult<CouponDO> page);
  31 +
  32 + List<CouponExcelVO> convertList02(List<CouponDO> list);
  33 +
  34 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/CouponTemplete/CouponTempleteDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +import com.baomidou.mybatisplus.annotation.*;
  7 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  8 +
  9 +/**
  10 + * 优惠券模板 DO
  11 + *
  12 + * @author wxr
  13 + */
  14 +@TableName("coupon_templete")
  15 +@KeySequence("coupon_templete_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  16 +@Data
  17 +@EqualsAndHashCode(callSuper = true)
  18 +@ToString(callSuper = true)
  19 +@Builder
  20 +@NoArgsConstructor
  21 +@AllArgsConstructor
  22 +public class CouponTempleteDO extends BaseDO {
  23 +
  24 + /**
  25 + * 用户ID
  26 + */
  27 + @TableId
  28 + private Long id;
  29 + /**
  30 + * 优惠券类型 reward-满减 discount-折扣 random-随机
  31 + */
  32 + private String type;
  33 + /**
  34 + * 优惠券名称
  35 + */
  36 + private String name;
  37 + /**
  38 + * 名称备注
  39 + */
  40 + private String couponNameRemark;
  41 + /**
  42 + * 优惠券图片
  43 + */
  44 + private String image;
  45 + /**
  46 + * 发放数量
  47 + */
  48 + private Integer count;
  49 + /**
  50 + * 已领取数量
  51 + */
  52 + private Integer leadCount;
  53 + /**
  54 + * 已使用数量
  55 + */
  56 + private Integer usedCount;
  57 + /**
  58 + * 适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用
  59 + */
  60 + private Boolean goodsType;
  61 + /**
  62 + * 适用商品id
  63 + */
  64 + private String productIds;
  65 + /**
  66 + * 使用门槛0-无门槛 1-有门槛
  67 + */
  68 + private Boolean hasUseLimit;
  69 + /**
  70 + * 满多少元使用 0代表无限制
  71 + */
  72 + private BigDecimal atLeast;
  73 + /**
  74 + * 发放面额 当type为reward时需要添加
  75 + */
  76 + private BigDecimal money;
  77 + /**
  78 + * 1 =< 折扣 <= 9.9 当type为discount时需要添加
  79 + */
  80 + private BigDecimal discount;
  81 + /**
  82 + * 最多折扣金额 当type为discount时可选择性添加
  83 + */
  84 + private BigDecimal discountLimit;
  85 + /**
  86 + * 最低金额 当type为radom时需要添加
  87 + */
  88 + private BigDecimal minMoney;
  89 + /**
  90 + * 最大金额 当type为radom时需要添加
  91 + */
  92 + private BigDecimal maxMoney;
  93 + /**
  94 + * 过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期
  95 + */
  96 + private Boolean validityType;
  97 + /**
  98 + * 使用开始日期 过期类型1时必填
  99 + */
  100 + private Date startUseTime;
  101 + /**
  102 + * 使用结束日期 过期类型1时必填
  103 + */
  104 + private Date endUseTime;
  105 + /**
  106 + * 当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效
  107 + */
  108 + private Integer fixedTerm;
  109 + /**
  110 + * 是否无限制0-否 1是
  111 + */
  112 + private Boolean whetherLimitless;
  113 + /**
  114 + * 每人最大领取个数
  115 + */
  116 + private Integer maxFetch;
  117 + /**
  118 + * 是否开启过期提醒0-不开启 1-开启
  119 + */
  120 + private Boolean whetherExpireNotice;
  121 + /**
  122 + * 过期前N天提醒
  123 + */
  124 + private Integer expireNoticeFixedTerm;
  125 + /**
  126 + * 优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用
  127 + */
  128 + private Boolean whetherForbidPreference;
  129 + /**
  130 + * 是否显示
  131 + */
  132 + private Integer whetherShow;
  133 + /**
  134 + * 订单的优惠总金额
  135 + */
  136 + private BigDecimal discountOrderMoney;
  137 + /**
  138 + * 用券总成交额
  139 + */
  140 + private BigDecimal orderMoney;
  141 + /**
  142 + * 是否禁止发放0-否 1-是
  143 + */
  144 + private Boolean whetherForbidden;
  145 + /**
  146 + * 使用优惠券购买的商品数量
  147 + */
  148 + private Integer orderGoodsNum;
  149 + /**
  150 + * 状态(1进行中2已结束-1已关闭)
  151 + */
  152 + private Integer status;
  153 + /**
  154 + * 有效日期结束时间
  155 + */
  156 + private Date endTime;
  157 +
  158 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/coupon/CouponDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.dal.dataobject.coupon;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.math.BigDecimal;
  7 +import com.baomidou.mybatisplus.annotation.*;
  8 +
  9 +/**
  10 + * 优惠券 DO
  11 + *
  12 + * @author wxr
  13 + */
  14 +@TableName("coupon")
  15 +@KeySequence("coupon_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  16 +@Data
  17 +@EqualsAndHashCode(callSuper = true)
  18 +@ToString(callSuper = true)
  19 +@Builder
  20 +@NoArgsConstructor
  21 +@AllArgsConstructor
  22 +public class CouponDO extends BaseDO {
  23 +
  24 + /**
  25 + * 用户ID
  26 + */
  27 + @TableId
  28 + private Long id;
  29 + /**
  30 + * 优惠券类型 reward-满减 discount-折扣 random-随机
  31 + */
  32 + private String type;
  33 + /**
  34 + * 优惠券名称
  35 + */
  36 + private String name;
  37 + /**
  38 + * 优惠券类型id
  39 + */
  40 + private Long couponTypeId;
  41 + /**
  42 + * 优惠券编码
  43 + */
  44 + private String couponCode;
  45 + /**
  46 + * 领用人
  47 + */
  48 + private Long memberId;
  49 + /**
  50 + * 优惠券使用订单id
  51 + */
  52 + private Long useOrderId;
  53 + /**
  54 + * 适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用
  55 + */
  56 + private Boolean goodsType;
  57 + /**
  58 + * 适用商品id
  59 + */
  60 + private String goodsIds;
  61 + /**
  62 + * 最小金额
  63 + */
  64 + private BigDecimal atLeast;
  65 + /**
  66 + * 面额
  67 + */
  68 + private BigDecimal money;
  69 + /**
  70 + * 1 =< 折扣 <= 9.9 当type为discount时需要添加
  71 + */
  72 + private BigDecimal discount;
  73 + /**
  74 + * 最多折扣金额 当type为discount时可选择性添加
  75 + */
  76 + private BigDecimal discountLimit;
  77 + /**
  78 + * 优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用
  79 + */
  80 + private Boolean whetherForbidPreference;
  81 + /**
  82 + * 是否开启过期提醒0-不开启 1-开启
  83 + */
  84 + private Boolean whetherExpireNotice;
  85 + /**
  86 + * 过期前N天提醒
  87 + */
  88 + private Integer expireNoticeFixedTerm;
  89 + /**
  90 + * 是否已提醒
  91 + */
  92 + private Boolean whetherNoticed;
  93 + /**
  94 + * 优惠券状态 1已领用(未使用) 2已使用 3已过期
  95 + */
  96 + private Integer state;
  97 + /**
  98 + * 获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取
  99 + */
  100 + private Boolean getType;
  101 + /**
  102 + * 领取时间
  103 + */
  104 + private Date fetchTime;
  105 + /**
  106 + * 使用时间
  107 + */
  108 + private Date useTime;
  109 + /**
  110 + * 可使用的开始时间
  111 + */
  112 + private Date startTime;
  113 + /**
  114 + * 有效期结束时间
  115 + */
  116 + private Date endTime;
  117 +
  118 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/mysql/CouponTemplete/CouponTempleteMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  8 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteExportReqVO;
  9 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempletePageReqVO;
  10 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
  11 +import org.apache.ibatis.annotations.Mapper;
  12 +
  13 +
  14 +/**
  15 + * 优惠券模板 Mapper
  16 + *
  17 + * @author wxr
  18 + */
  19 +@Mapper
  20 +public interface CouponTempleteMapper extends BaseMapperX<CouponTempleteDO> {
  21 +
  22 + default PageResult<CouponTempleteDO> selectPage(CouponTempletePageReqVO reqVO) {
  23 + return selectPage(reqVO, new LambdaQueryWrapperX<CouponTempleteDO>()
  24 + .eqIfPresent(CouponTempleteDO::getType, reqVO.getType())
  25 + .likeIfPresent(CouponTempleteDO::getName, reqVO.getName())
  26 + .eqIfPresent(CouponTempleteDO::getCouponNameRemark, reqVO.getCouponNameRemark())
  27 + .eqIfPresent(CouponTempleteDO::getImage, reqVO.getImage())
  28 + .eqIfPresent(CouponTempleteDO::getCount, reqVO.getCount())
  29 + .eqIfPresent(CouponTempleteDO::getLeadCount, reqVO.getLeadCount())
  30 + .eqIfPresent(CouponTempleteDO::getUsedCount, reqVO.getUsedCount())
  31 + .eqIfPresent(CouponTempleteDO::getGoodsType, reqVO.getGoodsType())
  32 + .eqIfPresent(CouponTempleteDO::getProductIds, reqVO.getProductIds())
  33 + .eqIfPresent(CouponTempleteDO::getHasUseLimit, reqVO.getHasUseLimit())
  34 + .eqIfPresent(CouponTempleteDO::getAtLeast, reqVO.getAtLeast())
  35 + .eqIfPresent(CouponTempleteDO::getMoney, reqVO.getMoney())
  36 + .eqIfPresent(CouponTempleteDO::getDiscount, reqVO.getDiscount())
  37 + .eqIfPresent(CouponTempleteDO::getDiscountLimit, reqVO.getDiscountLimit())
  38 + .eqIfPresent(CouponTempleteDO::getMinMoney, reqVO.getMinMoney())
  39 + .eqIfPresent(CouponTempleteDO::getMaxMoney, reqVO.getMaxMoney())
  40 + .eqIfPresent(CouponTempleteDO::getValidityType, reqVO.getValidityType())
  41 + .betweenIfPresent(CouponTempleteDO::getStartUseTime, reqVO.getStartUseTime())
  42 + .betweenIfPresent(CouponTempleteDO::getEndUseTime, reqVO.getEndUseTime())
  43 + .eqIfPresent(CouponTempleteDO::getFixedTerm, reqVO.getFixedTerm())
  44 + .eqIfPresent(CouponTempleteDO::getWhetherLimitless, reqVO.getWhetherLimitless())
  45 + .eqIfPresent(CouponTempleteDO::getMaxFetch, reqVO.getMaxFetch())
  46 + .eqIfPresent(CouponTempleteDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
  47 + .eqIfPresent(CouponTempleteDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
  48 + .eqIfPresent(CouponTempleteDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
  49 + .eqIfPresent(CouponTempleteDO::getWhetherShow, reqVO.getWhetherShow())
  50 + .eqIfPresent(CouponTempleteDO::getDiscountOrderMoney, reqVO.getDiscountOrderMoney())
  51 + .eqIfPresent(CouponTempleteDO::getOrderMoney, reqVO.getOrderMoney())
  52 + .eqIfPresent(CouponTempleteDO::getWhetherForbidden, reqVO.getWhetherForbidden())
  53 + .eqIfPresent(CouponTempleteDO::getOrderGoodsNum, reqVO.getOrderGoodsNum())
  54 + .eqIfPresent(CouponTempleteDO::getStatus, reqVO.getStatus())
  55 + .betweenIfPresent(CouponTempleteDO::getEndTime, reqVO.getEndTime())
  56 + .betweenIfPresent(CouponTempleteDO::getCreateTime, reqVO.getCreateTime())
  57 + .orderByDesc(CouponTempleteDO::getId));
  58 + }
  59 +
  60 + default List<CouponTempleteDO> selectList(CouponTempleteExportReqVO reqVO) {
  61 + return selectList(new LambdaQueryWrapperX<CouponTempleteDO>()
  62 + .eqIfPresent(CouponTempleteDO::getType, reqVO.getType())
  63 + .likeIfPresent(CouponTempleteDO::getName, reqVO.getName())
  64 + .eqIfPresent(CouponTempleteDO::getCouponNameRemark, reqVO.getCouponNameRemark())
  65 + .eqIfPresent(CouponTempleteDO::getImage, reqVO.getImage())
  66 + .eqIfPresent(CouponTempleteDO::getCount, reqVO.getCount())
  67 + .eqIfPresent(CouponTempleteDO::getLeadCount, reqVO.getLeadCount())
  68 + .eqIfPresent(CouponTempleteDO::getUsedCount, reqVO.getUsedCount())
  69 + .eqIfPresent(CouponTempleteDO::getGoodsType, reqVO.getGoodsType())
  70 + .eqIfPresent(CouponTempleteDO::getProductIds, reqVO.getProductIds())
  71 + .eqIfPresent(CouponTempleteDO::getHasUseLimit, reqVO.getHasUseLimit())
  72 + .eqIfPresent(CouponTempleteDO::getAtLeast, reqVO.getAtLeast())
  73 + .eqIfPresent(CouponTempleteDO::getMoney, reqVO.getMoney())
  74 + .eqIfPresent(CouponTempleteDO::getDiscount, reqVO.getDiscount())
  75 + .eqIfPresent(CouponTempleteDO::getDiscountLimit, reqVO.getDiscountLimit())
  76 + .eqIfPresent(CouponTempleteDO::getMinMoney, reqVO.getMinMoney())
  77 + .eqIfPresent(CouponTempleteDO::getMaxMoney, reqVO.getMaxMoney())
  78 + .eqIfPresent(CouponTempleteDO::getValidityType, reqVO.getValidityType())
  79 + .betweenIfPresent(CouponTempleteDO::getStartUseTime, reqVO.getStartUseTime())
  80 + .betweenIfPresent(CouponTempleteDO::getEndUseTime, reqVO.getEndUseTime())
  81 + .eqIfPresent(CouponTempleteDO::getFixedTerm, reqVO.getFixedTerm())
  82 + .eqIfPresent(CouponTempleteDO::getWhetherLimitless, reqVO.getWhetherLimitless())
  83 + .eqIfPresent(CouponTempleteDO::getMaxFetch, reqVO.getMaxFetch())
  84 + .eqIfPresent(CouponTempleteDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
  85 + .eqIfPresent(CouponTempleteDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
  86 + .eqIfPresent(CouponTempleteDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
  87 + .eqIfPresent(CouponTempleteDO::getWhetherShow, reqVO.getWhetherShow())
  88 + .eqIfPresent(CouponTempleteDO::getDiscountOrderMoney, reqVO.getDiscountOrderMoney())
  89 + .eqIfPresent(CouponTempleteDO::getOrderMoney, reqVO.getOrderMoney())
  90 + .eqIfPresent(CouponTempleteDO::getWhetherForbidden, reqVO.getWhetherForbidden())
  91 + .eqIfPresent(CouponTempleteDO::getOrderGoodsNum, reqVO.getOrderGoodsNum())
  92 + .eqIfPresent(CouponTempleteDO::getStatus, reqVO.getStatus())
  93 + .betweenIfPresent(CouponTempleteDO::getEndTime, reqVO.getEndTime())
  94 + .betweenIfPresent(CouponTempleteDO::getCreateTime, reqVO.getCreateTime())
  95 + .orderByDesc(CouponTempleteDO::getId));
  96 + }
  97 +
  98 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/mysql/coupon/CouponMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.dal.mysql.coupon;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  8 +import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
  9 +import org.apache.ibatis.annotations.Mapper;
  10 +import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
  11 +
  12 +/**
  13 + * 优惠券 Mapper
  14 + *
  15 + * @author wxr
  16 + */
  17 +@Mapper
  18 +public interface CouponMapper extends BaseMapperX<CouponDO> {
  19 +
  20 + default PageResult<CouponDO> selectPage(CouponPageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<CouponDO>()
  22 + .eqIfPresent(CouponDO::getType, reqVO.getType())
  23 + .likeIfPresent(CouponDO::getName, reqVO.getName())
  24 + .eqIfPresent(CouponDO::getCouponTypeId, reqVO.getCouponTypeId())
  25 + .eqIfPresent(CouponDO::getCouponCode, reqVO.getCouponCode())
  26 + .eqIfPresent(CouponDO::getMemberId, reqVO.getMemberId())
  27 + .eqIfPresent(CouponDO::getUseOrderId, reqVO.getUseOrderId())
  28 + .eqIfPresent(CouponDO::getGoodsType, reqVO.getGoodsType())
  29 + .eqIfPresent(CouponDO::getGoodsIds, reqVO.getGoodsIds())
  30 + .eqIfPresent(CouponDO::getAtLeast, reqVO.getAtLeast())
  31 + .eqIfPresent(CouponDO::getMoney, reqVO.getMoney())
  32 + .eqIfPresent(CouponDO::getDiscount, reqVO.getDiscount())
  33 + .eqIfPresent(CouponDO::getDiscountLimit, reqVO.getDiscountLimit())
  34 + .eqIfPresent(CouponDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
  35 + .eqIfPresent(CouponDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
  36 + .eqIfPresent(CouponDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
  37 + .eqIfPresent(CouponDO::getWhetherNoticed, reqVO.getWhetherNoticed())
  38 + .eqIfPresent(CouponDO::getState, reqVO.getState())
  39 + .eqIfPresent(CouponDO::getGetType, reqVO.getGetType())
  40 + .betweenIfPresent(CouponDO::getFetchTime, reqVO.getFetchTime())
  41 + .betweenIfPresent(CouponDO::getUseTime, reqVO.getUseTime())
  42 + .betweenIfPresent(CouponDO::getStartTime, reqVO.getStartTime())
  43 + .betweenIfPresent(CouponDO::getEndTime, reqVO.getEndTime())
  44 + .betweenIfPresent(CouponDO::getCreateTime, reqVO.getCreateTime())
  45 + .orderByDesc(CouponDO::getId));
  46 + }
  47 +
  48 + default List<CouponDO> selectList(CouponExportReqVO reqVO) {
  49 + return selectList(new LambdaQueryWrapperX<CouponDO>()
  50 + .eqIfPresent(CouponDO::getType, reqVO.getType())
  51 + .likeIfPresent(CouponDO::getName, reqVO.getName())
  52 + .eqIfPresent(CouponDO::getCouponTypeId, reqVO.getCouponTypeId())
  53 + .eqIfPresent(CouponDO::getCouponCode, reqVO.getCouponCode())
  54 + .eqIfPresent(CouponDO::getMemberId, reqVO.getMemberId())
  55 + .eqIfPresent(CouponDO::getUseOrderId, reqVO.getUseOrderId())
  56 + .eqIfPresent(CouponDO::getGoodsType, reqVO.getGoodsType())
  57 + .eqIfPresent(CouponDO::getGoodsIds, reqVO.getGoodsIds())
  58 + .eqIfPresent(CouponDO::getAtLeast, reqVO.getAtLeast())
  59 + .eqIfPresent(CouponDO::getMoney, reqVO.getMoney())
  60 + .eqIfPresent(CouponDO::getDiscount, reqVO.getDiscount())
  61 + .eqIfPresent(CouponDO::getDiscountLimit, reqVO.getDiscountLimit())
  62 + .eqIfPresent(CouponDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
  63 + .eqIfPresent(CouponDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
  64 + .eqIfPresent(CouponDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
  65 + .eqIfPresent(CouponDO::getWhetherNoticed, reqVO.getWhetherNoticed())
  66 + .eqIfPresent(CouponDO::getState, reqVO.getState())
  67 + .eqIfPresent(CouponDO::getGetType, reqVO.getGetType())
  68 + .betweenIfPresent(CouponDO::getFetchTime, reqVO.getFetchTime())
  69 + .betweenIfPresent(CouponDO::getUseTime, reqVO.getUseTime())
  70 + .betweenIfPresent(CouponDO::getStartTime, reqVO.getStartTime())
  71 + .betweenIfPresent(CouponDO::getEndTime, reqVO.getEndTime())
  72 + .betweenIfPresent(CouponDO::getCreateTime, reqVO.getCreateTime())
  73 + .orderByDesc(CouponDO::getId));
  74 + }
  75 +
  76 +}
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/activity/ActivityService.java renamed to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteService.java
1 -package cn.iocoder.yudao.module.market.service.activity; 1 +package cn.iocoder.yudao.module.coupon.service.CouponTemplete;
2 2
3 import java.util.*; 3 import java.util.*;
4 import javax.validation.*; 4 import javax.validation.*;
5 -import cn.iocoder.yudao.module.market.controller.admin.activity.vo.*;  
6 -import cn.iocoder.yudao.module.market.dal.dataobject.activity.ActivityDO; 5 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.*;
7 import cn.iocoder.yudao.framework.common.pojo.PageResult; 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
8 8
9 /** 9 /**
10 - * 促销活动 Service 接口 10 + * 优惠券模板 Service 接口
11 * 11 *
12 - * @author 芋道源码 12 + * @author wxr
13 */ 13 */
14 -public interface ActivityService { 14 +public interface CouponTempleteService {
15 15
16 /** 16 /**
17 - * 创建促销活动 17 + * 创建优惠券模板
18 * 18 *
19 * @param createReqVO 创建信息 19 * @param createReqVO 创建信息
20 * @return 编号 20 * @return 编号
21 */ 21 */
22 - Long createActivity(@Valid ActivityCreateReqVO createReqVO); 22 + Long create(@Valid CouponTempleteCreateReqVO createReqVO);
23 23
24 /** 24 /**
25 - * 更新促销活动 25 + * 更新优惠券模板
26 * 26 *
27 * @param updateReqVO 更新信息 27 * @param updateReqVO 更新信息
28 */ 28 */
29 - void updateActivity(@Valid ActivityUpdateReqVO updateReqVO); 29 + void update(@Valid CouponTempleteUpdateReqVO updateReqVO);
30 30
31 /** 31 /**
32 - * 删除促销活动 32 + * 删除优惠券模板
33 * 33 *
34 * @param id 编号 34 * @param id 编号
35 */ 35 */
36 - void deleteActivity(Long id); 36 + void delete(Long id);
37 37
38 /** 38 /**
39 - * 获得促销活动 39 + * 获得优惠券模板
40 * 40 *
41 * @param id 编号 41 * @param id 编号
42 - * @return 促销活动 42 + * @return 优惠券模板
43 */ 43 */
44 - ActivityDO getActivity(Long id); 44 + CouponTempleteDO get(Long id);
45 45
46 /** 46 /**
47 - * 获得促销活动列表 47 + * 获得优惠券模板列表
48 * 48 *
49 * @param ids 编号 49 * @param ids 编号
50 - * @return 促销活动列表 50 + * @return 优惠券模板列表
51 */ 51 */
52 - List<ActivityDO> getActivityList(Collection<Long> ids); 52 + List<CouponTempleteDO> getList(Collection<Long> ids);
53 53
54 /** 54 /**
55 - * 获得促销活动分页 55 + * 获得优惠券模板分页
56 * 56 *
57 * @param pageReqVO 分页查询 57 * @param pageReqVO 分页查询
58 - * @return 促销活动分页 58 + * @return 优惠券模板分页
59 */ 59 */
60 - PageResult<ActivityDO> getActivityPage(ActivityPageReqVO pageReqVO); 60 + PageResult<CouponTempleteDO> getPage(CouponTempletePageReqVO pageReqVO);
  61 +
  62 + /**
  63 + * 获得优惠券模板列表, 用于 Excel 导出
  64 + *
  65 + * @param exportReqVO 查询条件
  66 + * @return 优惠券模板列表
  67 + */
  68 + List<CouponTempleteDO> getList(CouponTempleteExportReqVO exportReqVO);
61 69
62 } 70 }
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.service.CouponTemplete;
  2 +
  3 +import cn.iocoder.yudao.module.CouponTemplete.enums.CouponTypeEnum;
  4 +import cn.iocoder.yudao.module.CouponTemplete.enums.CouponValidityTypeEnum;
  5 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteCreateReqVO;
  6 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteExportReqVO;
  7 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempletePageReqVO;
  8 +import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteUpdateReqVO;
  9 +import cn.iocoder.yudao.module.coupon.convert.CouponTemplete.CouponTempleteConvert;
  10 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
  11 +import cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete.CouponTempleteMapper;
  12 +import cn.iocoder.yudao.module.coupon.service.CouponTemplete.CouponTempleteService;
  13 +import org.springframework.stereotype.Service;
  14 +import javax.annotation.Resource;
  15 +import org.springframework.validation.annotation.Validated;
  16 +
  17 +import java.util.*;
  18 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  19 +
  20 +
  21 +
  22 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  23 +import static cn.iocoder.yudao.module.CouponTemplete.enums.ErrorCodeConstants.*;
  24 +
  25 +/**
  26 + * 优惠券模板 Service 实现类
  27 + *
  28 + * @author wxr
  29 + */
  30 +@Service
  31 +@Validated
  32 +public class CouponTempleteServiceImpl implements CouponTempleteService {
  33 +
  34 + @Resource
  35 + private CouponTempleteMapper couponTempleteMapper;
  36 +
  37 + @Override
  38 + public Long create(CouponTempleteCreateReqVO createReqVO) {
  39 + // 插入
  40 + CouponTempleteDO couponTempleteDO = CouponTempleteConvert.INSTANCE.convert(createReqVO);
  41 + /* 验证类型、判断必填*/
  42 + checkCouponType(createReqVO);
  43 +
  44 + /*todo 验证过期类型、判断必填*/
  45 + checkValidityType(createReqVO);
  46 +
  47 +
  48 +
  49 + couponTempleteMapper.insert(couponTempleteDO);
  50 + // 返回
  51 + return couponTempleteDO.getId();
  52 + }
  53 +
  54 + /*确认优惠券类型*/
  55 + private void checkValidityType(CouponTempleteCreateReqVO createReqVO) {
  56 + Integer validtyType = createReqVO.getValidityType();
  57 +
  58 + if(CouponValidityTypeEnum.TIME_RANGE_EXPIRTED.getStatus().equals(validtyType)){
  59 + if(createReqVO.getStartUseTime() == null||createReqVO.getEndUseTime() == null){
  60 + throw exception(START_END_TIME_NOT_NULL);
  61 + }
  62 + }else{
  63 + if(createReqVO.getFixedTerm() == null){
  64 + throw exception(FIXED_TERM_NOT_NULL);
  65 + }
  66 + }
  67 + }
  68 +
  69 + private void checkCouponType(CouponTempleteCreateReqVO createReqVO) {
  70 +
  71 + String couponType = createReqVO.getType();
  72 + //当type=reward时候,需要添加
  73 + if(couponType.equals(CouponTypeEnum.REWARD.getName())){
  74 + if(createReqVO.getMoney()==null){
  75 + throw exception(MONEY_NOT_NULL);
  76 + }
  77 + }else if(couponType.equals(CouponTypeEnum.DISCOUNT.getName())){
  78 + if(createReqVO.getDiscount()==null){
  79 + throw exception(DISCOUNT_NOT_NULL);
  80 + }
  81 + if(createReqVO.getDiscountLimit()==null){
  82 + throw exception(DISCOUNT_LIMIT_NOT_NULL);
  83 + }
  84 + }else if (couponType.equals(CouponTypeEnum.RANDOW.getName())){
  85 + //当type为radom时需要添加不能为空
  86 + if(createReqVO.getMinMoney()==null||createReqVO.getMaxMoney()==null){
  87 + throw exception(MIN_MAX_NOT_NULL);
  88 + }
  89 + }
  90 + }
  91 +
  92 + @Override
  93 + public void update(CouponTempleteUpdateReqVO updateReqVO) {
  94 + // 校验存在
  95 + this.validateExists(updateReqVO.getId());
  96 + // 更新
  97 + CouponTempleteDO updateObj = CouponTempleteConvert.INSTANCE.convert(updateReqVO);
  98 + couponTempleteMapper.updateById(updateObj);
  99 + }
  100 +
  101 + @Override
  102 + public void delete(Long id) {
  103 + // 校验存在
  104 + this.validateExists(id);
  105 + // 删除
  106 + couponTempleteMapper.deleteById(id);
  107 + }
  108 +
  109 + private void validateExists(Long id) {
  110 + if (couponTempleteMapper.selectById(id) == null) {
  111 + throw exception(COUPON_TEMPLETE_NOT_EXISTS);
  112 + }
  113 + }
  114 +
  115 + @Override
  116 + public CouponTempleteDO get(Long id) {
  117 + return couponTempleteMapper.selectById(id);
  118 + }
  119 +
  120 + @Override
  121 + public List<CouponTempleteDO> getList(Collection<Long> ids) {
  122 + return couponTempleteMapper.selectBatchIds(ids);
  123 + }
  124 +
  125 + @Override
  126 + public PageResult<CouponTempleteDO> getPage(CouponTempletePageReqVO pageReqVO) {
  127 + return couponTempleteMapper.selectPage(pageReqVO);
  128 + }
  129 +
  130 + @Override
  131 + public List<CouponTempleteDO> getList(CouponTempleteExportReqVO exportReqVO) {
  132 + return couponTempleteMapper.selectList(exportReqVO);
  133 + }
  134 +
  135 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/coupon/CouponService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.service.coupon;
  2 +
  3 +import java.util.*;
  4 +import javax.validation.*;
  5 +import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
  6 +import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
  7 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  8 +
  9 +/**
  10 + * 优惠券 Service 接口
  11 + *
  12 + * @author wxr
  13 + */
  14 +public interface CouponService {
  15 +
  16 + /**
  17 + * 创建优惠券
  18 + *
  19 + * @param templateId 优惠券模板id
  20 + * @return 编号
  21 + */
  22 + Long create(Long templateId);
  23 +
  24 + /**
  25 + * 更新优惠券
  26 + *
  27 + * @param updateReqVO 更新信息
  28 + */
  29 + void update(@Valid CouponUpdateReqVO updateReqVO);
  30 +
  31 + /**
  32 + * 删除优惠券
  33 + *
  34 + * @param id 编号
  35 + */
  36 + void delete(Long id);
  37 +
  38 + /**
  39 + * 获得优惠券
  40 + *
  41 + * @param id 编号
  42 + * @return 优惠券
  43 + */
  44 + CouponDO get(Long id);
  45 +
  46 + /**
  47 + * 获得优惠券列表
  48 + *
  49 + * @param ids 编号
  50 + * @return 优惠券列表
  51 + */
  52 + List<CouponDO> getList(Collection<Long> ids);
  53 +
  54 + /**
  55 + * 获得优惠券分页
  56 + *
  57 + * @param pageReqVO 分页查询
  58 + * @return 优惠券分页
  59 + */
  60 + PageResult<CouponDO> getPage(CouponPageReqVO pageReqVO);
  61 +
  62 + /**
  63 + * 获得优惠券列表, 用于 Excel 导出
  64 + *
  65 + * @param exportReqVO 查询条件
  66 + * @return 优惠券列表
  67 + */
  68 + List<CouponDO> getList(CouponExportReqVO exportReqVO);
  69 +
  70 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/coupon/CouponServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.coupon.service.coupon;
  2 +
  3 +import cn.hutool.core.bean.BeanUtil;
  4 +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
  5 +import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
  6 +import cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete.CouponTempleteMapper;
  7 +import io.micrometer.core.instrument.Counter;
  8 +import org.springframework.stereotype.Service;
  9 +import javax.annotation.Resource;
  10 +import org.springframework.validation.annotation.Validated;
  11 +
  12 +import java.util.*;
  13 +import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
  14 +import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
  15 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  16 +
  17 +import cn.iocoder.yudao.module.coupon.convert.coupon.CouponConvert;
  18 +import cn.iocoder.yudao.module.coupon.dal.mysql.coupon.CouponMapper;
  19 +
  20 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  21 +import static cn.iocoder.yudao.module.CouponTemplete.enums.ErrorCodeConstants.COUPON_NOT_EXISTS;
  22 +
  23 +/**
  24 + * 优惠券 Service 实现类
  25 + *
  26 + * @author wxr
  27 + */
  28 +@Service
  29 +@Validated
  30 +public class CouponServiceImpl implements CouponService {
  31 +
  32 + @Resource
  33 + private CouponMapper couponMapper;
  34 +
  35 + @Resource
  36 + private CouponTempleteMapper couponTempleteMapper;
  37 +
  38 + public Long create(CouponCreateReqVO createReqVO) {
  39 + // 插入
  40 + CouponDO couponDO = CouponConvert.INSTANCE.convert(createReqVO);
  41 + couponMapper.insert(couponDO);
  42 + // 返回
  43 + return couponDO.getId();
  44 + }
  45 +
  46 +
  47 + /**
  48 + *todo 获取用户id收获优惠券
  49 + *@author:wxr
  50 + *@date:2022-08-13 3:11
  51 + *@Description
  52 + */
  53 + @Override
  54 + public Long create(Long templateId) {
  55 + Long userid = SecurityFrameworkUtils.getLoginUserId();
  56 + CouponDO couponDO = CouponDO.builder().memberId(userid).build();
  57 + CouponTempleteDO couponTempleteDO = couponTempleteMapper.selectById(templateId);
  58 + //todo 缺少判空
  59 + BeanUtil.copyProperties(couponTempleteDO,couponTempleteDO);
  60 + couponMapper.insert(couponDO);
  61 + return couponDO.getId();
  62 + }
  63 +
  64 + @Override
  65 + public void update(CouponUpdateReqVO updateReqVO) {
  66 + // 校验存在
  67 + this.validateExists(updateReqVO.getId());
  68 + // 更新
  69 + CouponDO updateObj = CouponConvert.INSTANCE.convert(updateReqVO);
  70 + couponMapper.updateById(updateObj);
  71 + }
  72 +
  73 + @Override
  74 + public void delete(Long id) {
  75 + // 校验存在
  76 + this.validateExists(id);
  77 + // 删除
  78 + couponMapper.deleteById(id);
  79 + }
  80 +
  81 + private void validateExists(Long id) {
  82 + if (couponMapper.selectById(id) == null) {
  83 + throw exception(COUPON_NOT_EXISTS);
  84 + }
  85 + }
  86 +
  87 + @Override
  88 + public CouponDO get(Long id) {
  89 + return couponMapper.selectById(id);
  90 + }
  91 +
  92 + @Override
  93 + public List<CouponDO> getList(Collection<Long> ids) {
  94 + return couponMapper.selectBatchIds(ids);
  95 + }
  96 +
  97 + @Override
  98 + public PageResult<CouponDO> getPage(CouponPageReqVO pageReqVO) {
  99 + return couponMapper.selectPage(pageReqVO);
  100 + }
  101 +
  102 + @Override
  103 + public List<CouponDO> getList(CouponExportReqVO exportReqVO) {
  104 + return couponMapper.selectList(exportReqVO);
  105 + }
  106 +
  107 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/resources/mapper/CouponTemplete/CouponTempleteMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete.CouponTempleteMapper">
  4 +
  5 + <!--
  6 + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  7 + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  8 + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  9 + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  10 + -->
  11 +
  12 +</mapper>
yudao-module-mall/yudao-module-coupon-biz/src/main/resources/mapper/coupon/CouponMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="cn.iocoder.yudao.module.coupon.dal.mysql.coupon.CouponMapper">
  4 +
  5 + <!--
  6 + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  7 + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  8 + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  9 + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  10 + -->
  11 +
  12 +</mapper>
yudao-module-mall/yudao-module-market-api/pom.xml
@@ -21,6 +21,13 @@ @@ -21,6 +21,13 @@
21 <groupId>cn.iocoder.boot</groupId> 21 <groupId>cn.iocoder.boot</groupId>
22 <artifactId>yudao-common</artifactId> 22 <artifactId>yudao-common</artifactId>
23 </dependency> 23 </dependency>
  24 +
  25 + <!-- 参数校验 -->
  26 + <dependency>
  27 + <groupId>org.springframework.boot</groupId>
  28 + <artifactId>spring-boot-starter-validation</artifactId>
  29 + <optional>true</optional>
  30 + </dependency>
24 </dependencies> 31 </dependencies>
25 32
26 </project> 33 </project>
yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/api/price/PriceApi.java 0 → 100644
  1 +package cn.iocoder.yudao.module.market.api.price;
  2 +
  3 +import cn.iocoder.yudao.module.market.api.price.dto.PriceCalculateReqDTO;
  4 +import cn.iocoder.yudao.module.market.api.price.dto.PriceCalculateRespDTO;
  5 +
  6 +/**
  7 + * 价格 API 接口
  8 + *
  9 + * @author 芋道源码
  10 + */
  11 +public interface PriceApi {
  12 +
  13 + /**
  14 + * 计算商品的价格
  15 + *
  16 + * @param calculateReqDTO 价格请求
  17 + * @return 价格相应
  18 + */
  19 + PriceCalculateRespDTO calculatePrice(PriceCalculateReqDTO calculateReqDTO);
  20 +
  21 +}
yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/api/price/dto/PriceCalculateReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.market.api.price.dto;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import javax.validation.constraints.Min;
  6 +import javax.validation.constraints.NotNull;
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * 价格计算 Request DTO
  11 + *
  12 + * @author 芋道源码
  13 + */
  14 +@Data
  15 +public class PriceCalculateReqDTO {
  16 +
  17 + /**
  18 + * 用户编号
  19 + *
  20 + * 对应 MemberUserDO 的 id 编号
  21 + */
  22 + private Long userId;
  23 +
  24 + /**
  25 + * 优惠劵编号
  26 + */
  27 + private Long couponId;
  28 +
  29 + /**
  30 + * 商品 SKU 数组
  31 + */
  32 + @NotNull(message = "商品数组不能为空")
  33 + private List<Item> items;
  34 +
  35 + /**
  36 + * 商品 SKU
  37 + */
  38 + @Data
  39 + public static class Item {
  40 +
  41 + /**
  42 + * SKU 编号
  43 + */
  44 + @NotNull(message = "商品 SKU 编号不能为空")
  45 + private Long skuId;
  46 +
  47 + /**
  48 + * SKU 数量
  49 + */
  50 + @NotNull(message = "商品 SKU 数量不能为空")
  51 + @Min(value = 0L, message = "商品 SKU 数量必须大于等于 0") // 可传递 0 数量,用于购物车未选中的情况
  52 + private Integer count;
  53 +
  54 + }
  55 +
  56 +}
yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/api/price/dto/PriceCalculateRespDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.market.api.price.dto;
  2 +
  3 +import cn.iocoder.yudao.module.market.enums.common.PromotionLevelEnum;
  4 +import cn.iocoder.yudao.module.market.enums.common.PromotionTypeEnum;
  5 +import lombok.Data;
  6 +
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * 价格计算 Response DTO
  11 + *
  12 + * @author 芋道源码
  13 + */
  14 +@Data
  15 +public class PriceCalculateRespDTO {
  16 +
  17 + /**
  18 + * 订单
  19 + */
  20 + private Order order;
  21 +
  22 + /**
  23 + * 商品 SKU 数组
  24 + */
  25 + private List<Item> items;
  26 +
  27 + /**
  28 + * 营销活动数组
  29 + *
  30 + * 只对应 {@link #items} 商品匹配的活动
  31 + */
  32 + private List<Promotion> promotions;
  33 +
  34 + /**
  35 + * 订单
  36 + */
  37 + @Data
  38 + public static class Order {
  39 +
  40 + /**
  41 + * 商品原价(总),单位:分
  42 + *
  43 + * 基于 {@link Item#getTotalOriginalPrice()} 求和
  44 + */
  45 + private Integer skuOriginalPrice;
  46 + /**
  47 + * 商品优惠(总),单位:分
  48 + *
  49 + * 基于 {@link Item#getTotalPromotionPrice()} 求和
  50 + */
  51 + private Integer skuPromotionPrice;
  52 + /**
  53 + * 订单优惠(总),单位:分
  54 + *
  55 + * 例如说:满减折扣;不包括优惠劵、商品优惠
  56 + */
  57 + private Integer orderPromotionPrice;
  58 + /**
  59 + * 运费金额,单位:分
  60 + */
  61 + private Integer deliveryPrice;
  62 + /**
  63 + * 应付金额(总),单位:分
  64 + *
  65 + * = {@link #skuOriginalPrice}
  66 + * + {@link #deliveryPrice}
  67 + * - {@link #skuPromotionPrice}
  68 + * - {@link #orderPromotionPrice}
  69 + */
  70 + // * - {@link #couponPrice} // TODO 芋艿:靠营销表记录
  71 + private Integer payPrice;
  72 +
  73 + // ========== 营销基本信息 ==========
  74 + /**
  75 + * 优惠劵编号
  76 + */
  77 + private Long couponId;
  78 +// /**
  79 +// * 优惠劵减免金额,单位:分
  80 +// *
  81 +// * // TODO 芋艿:靠营销表记录
  82 +// */
  83 +// private Integer couponPrice;
  84 +
  85 + }
  86 +
  87 + /**
  88 + * 商品 SKU
  89 + */
  90 + @Data
  91 + public static class Item extends PriceCalculateReqDTO.Item {
  92 +
  93 + /**
  94 + * 商品原价(单),单位:分
  95 + *
  96 + * 对应 ProductSkuDO 的 price 字段
  97 + */
  98 + private Integer originalPrice;
  99 + /**
  100 + * 商品原价(总),单位:分
  101 + *
  102 + * = {@link #originalPrice} * {@link #getCount()}
  103 + */
  104 + private Integer totalOriginalPrice;
  105 + /**
  106 + * 商品级优惠(总),单位:分
  107 + *
  108 + * 例如说“限时折扣”:商品原价的 8 折;商品原价的减 50 元
  109 + */
  110 + private Integer totalPromotionPrice;
  111 + /**
  112 + * 最终购买金额(总),单位:分。
  113 + *
  114 + * = {@link #totalOriginalPrice}
  115 + * - {@link #totalPromotionPrice}
  116 + */
  117 + private Integer totalPresentPrice;
  118 + /**
  119 + * 最终购买金额(单),单位:分。
  120 + *
  121 + * = {@link #totalPresentPrice} / {@link #getCount()}
  122 + */
  123 + private Integer presentPrice;
  124 + /**
  125 + * 应付金额(总),单位:分
  126 + */
  127 + private Integer totalPayPrice;
  128 +
  129 + }
  130 +
  131 + /**
  132 + * 营销活动
  133 + */
  134 + @Data
  135 + public static class Promotion {
  136 +
  137 + /**
  138 + * 营销编号
  139 + *
  140 + * 例如说:营销活动的编号、优惠劵的编号
  141 + */
  142 + private Long id;
  143 + /**
  144 + * 营销类型
  145 + *
  146 + * 枚举 {@link PromotionTypeEnum}
  147 + */
  148 + private Integer type;
  149 + /**
  150 + * 营销级别
  151 + *
  152 + * 枚举 {@link PromotionLevelEnum}
  153 + */
  154 + private Integer level;
  155 + /**
  156 + * 匹配的商品 SKU 数组
  157 + */
  158 + private List<Item> items;
  159 + /**
  160 + * 计算时的原价(总),单位:分
  161 + */
  162 + private Integer totalOriginalPrice;
  163 + /**
  164 + * 计算时的优惠(总),单位:分
  165 + */
  166 + private Integer totalPromotionPrice;
  167 + /**
  168 + * 是否满足优惠条件
  169 + */
  170 + private Boolean meet;
  171 + /**
  172 + * 满足条件的提示
  173 + *
  174 + * 如果 {@link #meet} = true 满足,则提示“圣诞价:省 150.00 元”
  175 + * 如果 {@link #meet} = false 不满足,则提示“购满 85 元,可减 40 元”
  176 + */
  177 + private String meetTip;
  178 +
  179 + /**
  180 + * 匹配的商品 SKU
  181 + */
  182 + @Data
  183 + public static class Item {
  184 +
  185 + /**
  186 + * 商品 SKU 编号
  187 + */
  188 + private Long skuId;
  189 + /**
  190 + * 计算时的原价(总),单位:分
  191 + */
  192 + private Integer totalOriginalPrice;
  193 + /**
  194 + * 计算时的优惠(总),单位:分
  195 + */
  196 + private Integer totalPromotionPrice;
  197 +
  198 + }
  199 +
  200 + }
  201 +
  202 +}
yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/activity/MarketActivityStatusEnum.java renamed to yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/common/PromotionActivityStatusEnum.java
1 -package cn.iocoder.yudao.module.market.enums.activity; 1 +package cn.iocoder.yudao.module.market.enums.common;
2 2
3 import cn.iocoder.yudao.framework.common.core.IntArrayValuable; 3 import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
  4 +import lombok.AllArgsConstructor;
  5 +import lombok.Getter;
4 6
5 import java.util.Arrays; 7 import java.util.Arrays;
6 8
7 /** 9 /**
8 - * 促销活动状态枚举 10 + * 促销活动的状态枚举
  11 + *
  12 + * @author 芋道源码
9 */ 13 */
10 -public enum MarketActivityStatusEnum implements IntArrayValuable { 14 +@AllArgsConstructor
  15 +@Getter
  16 +public enum PromotionActivityStatusEnum implements IntArrayValuable {
11 17
12 WAIT(10, "未开始"), 18 WAIT(10, "未开始"),
13 RUN(20, "进行中"), 19 RUN(20, "进行中"),
14 END(30, "已结束"), 20 END(30, "已结束"),
15 - /**  
16 - * 1. WAIT、RUN、END 可以转换成 INVALID 状态。  
17 - * 2. INVALID 只可以转换成 DELETED 状态。  
18 - */  
19 - INVALID(40, "已撤销"),  
20 - DELETED(50, "已删除"),  
21 - ; 21 + CLOSE(40, "已关闭");
22 22
23 - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(MarketActivityStatusEnum::getValue).toArray(); 23 + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PromotionActivityStatusEnum::getStatus).toArray();
24 24
25 /** 25 /**
26 * 状态值 26 * 状态值
27 */ 27 */
28 - private final Integer value; 28 + private final Integer status;
29 /** 29 /**
30 * 状态名 30 * 状态名
31 */ 31 */
32 private final String name; 32 private final String name;
33 33
34 - MarketActivityStatusEnum(Integer value, String name) {  
35 - this.value = value;  
36 - this.name = name;  
37 - }  
38 -  
39 - public Integer getValue() {  
40 - return value;  
41 - }  
42 -  
43 - public String getName() {  
44 - return name;  
45 - }  
46 -  
47 @Override 34 @Override
48 public int[] array() { 35 public int[] array() {
49 return ARRAYS; 36 return ARRAYS;
50 } 37 }
  38 +
51 } 39 }
yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/common/PromotionConditionTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.market.enums.common;
  2 +
  3 +import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
  4 +import lombok.AllArgsConstructor;
  5 +import lombok.Getter;
  6 +
  7 +import java.util.Arrays;
  8 +
  9 +/**
  10 + * 营销的条件类型枚举
  11 + *
  12 + * @author 芋道源码
  13 + */
  14 +@AllArgsConstructor
  15 +@Getter
  16 +public enum PromotionConditionTypeEnum implements IntArrayValuable {
  17 +
  18 + PRICE(10, "满 N 元"),
  19 + COUNT(20, "满 N 件");
  20 +
  21 + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PromotionConditionTypeEnum::getType).toArray();
  22 +
  23 + /**
  24 + * 类型值
  25 + */
  26 + private final Integer type;
  27 + /**
  28 + * 类型名
  29 + */
  30 + private final String name;
  31 +
  32 + @Override
  33 + public int[] array() {
  34 + return ARRAYS;
  35 + }
  36 +
  37 +}
yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/common/PromotionLevelEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.market.enums.common;
  2 +
  3 +import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
  4 +import lombok.AllArgsConstructor;
  5 +import lombok.Getter;
  6 +
  7 +import java.util.Arrays;
  8 +
  9 +/**
  10 + * 营销的级别枚举
  11 + *
  12 + * @author 芋道源码
  13 + */
  14 +@Getter
  15 +@AllArgsConstructor
  16 +public enum PromotionLevelEnum implements IntArrayValuable {
  17 +
  18 + ORDER(1, "订单级"),
  19 + SKU(2, "商品级"),
  20 + ;
  21 +
  22 + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PromotionLevelEnum::getLevel).toArray();
  23 +
  24 + /**
  25 + * 级别值
  26 + */
  27 + private final Integer level;
  28 + /**
  29 + * 类型名
  30 + */
  31 + private final String name;
  32 +
  33 + @Override
  34 + public int[] array() {
  35 + return ARRAYS;
  36 + }
  37 +}
yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/common/PromotionProductScopeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.market.enums.common;
  2 +
  3 +import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
  4 +import lombok.AllArgsConstructor;
  5 +import lombok.Getter;
  6 +
  7 +import java.util.Arrays;
  8 +
  9 +/**
  10 + * 营销的商品范围枚举
  11 + *
  12 + * @author 芋道源码
  13 + */
  14 +@Getter
  15 +@AllArgsConstructor
  16 +public enum PromotionProductScopeEnum implements IntArrayValuable {
  17 +
  18 + ALL(1, "全部商品参与"),
  19 + SPU(2, "指定商品参与"),
  20 + ;
  21 +
  22 + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PromotionProductScopeEnum::getScope).toArray();
  23 +
  24 + /**
  25 + * 范围值
  26 + */
  27 + private final Integer scope;
  28 + /**
  29 + * 范围名
  30 + */
  31 + private final String name;
  32 +
  33 + @Override
  34 + public int[] array() {
  35 + return ARRAYS;
  36 + }
  37 +
  38 +}
yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/activity/MarketActivityTypeEnum.java renamed to yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/enums/common/PromotionTypeEnum.java
1 -package cn.iocoder.yudao.module.market.enums.activity; 1 +package cn.iocoder.yudao.module.market.enums.common;
2 2
3 import cn.iocoder.yudao.framework.common.core.IntArrayValuable; 3 import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
  4 +import lombok.AllArgsConstructor;
  5 +import lombok.Getter;
4 6
5 import java.util.Arrays; 7 import java.util.Arrays;
6 8
7 /** 9 /**
8 - * 促销活动类型枚举 10 + * 营销类型枚举
  11 + *
  12 + * @author 芋道源码
9 */ 13 */
10 -public enum MarketActivityTypeEnum implements IntArrayValuable { 14 +@Getter
  15 +@AllArgsConstructor
  16 +public enum PromotionTypeEnum implements IntArrayValuable {
11 17
12 - TIME_LIMITED_DISCOUNT(1, "限时折扣"),  
13 - FULL_PRIVILEGE(2, "满减送"), 18 + DISCOUNT(1, "限时折扣"),
  19 + REWARD(2, "满减送"),
14 ; 20 ;
15 21
16 - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(MarketActivityTypeEnum::getValue).toArray(); 22 + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PromotionTypeEnum::getType).toArray();
17 23
18 /** 24 /**
19 * 类型值 25 * 类型值
20 */ 26 */
21 - private final Integer value; 27 + private final Integer type;
22 /** 28 /**
23 * 类型名 29 * 类型名
24 */ 30 */
25 private final String name; 31 private final String name;
26 32
27 - MarketActivityTypeEnum(Integer value, String name) {  
28 - this.value = value;  
29 - this.name = name;  
30 - }  
31 -  
32 - public Integer getValue() {  
33 - return value;  
34 - }  
35 -  
36 - public String getName() {  
37 - return name;  
38 - }  
39 -  
40 @Override 33 @Override
41 public int[] array() { 34 public int[] array() {
42 return ARRAYS; 35 return ARRAYS;
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/MarketTestController.java deleted
1 -package cn.iocoder.yudao.module.market.controller.admin;  
2 -  
3 -import cn.iocoder.yudao.framework.common.pojo.CommonResult;  
4 -import io.swagger.annotations.Api;  
5 -import io.swagger.annotations.ApiOperation;  
6 -import org.springframework.validation.annotation.Validated;  
7 -import org.springframework.web.bind.annotation.GetMapping;  
8 -import org.springframework.web.bind.annotation.RequestMapping;  
9 -import org.springframework.web.bind.annotation.RestController;  
10 -  
11 -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;  
12 -  
13 -@Api(tags = "管理后台 - 营销")  
14 -@RestController  
15 -@RequestMapping("/market/test")  
16 -@Validated  
17 -public class MarketTestController {  
18 -  
19 - @GetMapping("/get")  
20 - @ApiOperation("获取 market 信息")  
21 - public CommonResult<String> get() {  
22 - return success("true");  
23 - }  
24 -  
25 -}  
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/activity/ActivityController.java deleted
1 -package cn.iocoder.yudao.module.market.controller.admin.activity;  
2 -  
3 -import org.springframework.web.bind.annotation.*;  
4 -import javax.annotation.Resource;  
5 -import org.springframework.validation.annotation.Validated;  
6 -import org.springframework.security.access.prepost.PreAuthorize;  
7 -import io.swagger.annotations.*;  
8 -import javax.validation.*;  
9 -import java.util.*;  
10 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
11 -import cn.iocoder.yudao.framework.common.pojo.CommonResult;  
12 -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;  
13 -import cn.iocoder.yudao.module.market.controller.admin.activity.vo.*;  
14 -import cn.iocoder.yudao.module.market.dal.dataobject.activity.ActivityDO;  
15 -import cn.iocoder.yudao.module.market.convert.activity.ActivityConvert;  
16 -import cn.iocoder.yudao.module.market.service.activity.ActivityService;  
17 -  
18 -@Api(tags = "管理后台 - 促销活动")  
19 -@RestController  
20 -@RequestMapping("/market/activity")  
21 -@Validated  
22 -public class ActivityController {  
23 -  
24 - @Resource  
25 - private ActivityService activityService;  
26 -  
27 - @PostMapping("/create")  
28 - @ApiOperation("创建促销活动")  
29 - @PreAuthorize("@ss.hasPermission('market:activity:create')")  
30 - public CommonResult<Long> createActivity(@Valid @RequestBody ActivityCreateReqVO createReqVO) {  
31 - return success(activityService.createActivity(createReqVO));  
32 - }  
33 -  
34 - @PutMapping("/update")  
35 - @ApiOperation("更新促销活动")  
36 - @PreAuthorize("@ss.hasPermission('market:activity:update')")  
37 - public CommonResult<Boolean> updateActivity(@Valid @RequestBody ActivityUpdateReqVO updateReqVO) {  
38 - activityService.updateActivity(updateReqVO);  
39 - return success(true);  
40 - }  
41 -  
42 - @DeleteMapping("/delete")  
43 - @ApiOperation("删除促销活动")  
44 - @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)  
45 - @PreAuthorize("@ss.hasPermission('market:activity:delete')")  
46 - public CommonResult<Boolean> deleteActivity(@RequestParam("id") Long id) {  
47 - activityService.deleteActivity(id);  
48 - return success(true);  
49 - }  
50 -  
51 - @GetMapping("/get")  
52 - @ApiOperation("获得促销活动")  
53 - @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)  
54 - @PreAuthorize("@ss.hasPermission('market:activity:query')")  
55 - public CommonResult<ActivityRespVO> getActivity(@RequestParam("id") Long id) {  
56 - ActivityDO activity = activityService.getActivity(id);  
57 - return success(ActivityConvert.INSTANCE.convert(activity));  
58 - }  
59 -  
60 - @GetMapping("/list")  
61 - @ApiOperation("获得促销活动列表")  
62 - @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)  
63 - @PreAuthorize("@ss.hasPermission('market:activity:query')")  
64 - public CommonResult<List<ActivityRespVO>> getActivityList(@RequestParam("ids") Collection<Long> ids) {  
65 - List<ActivityDO> list = activityService.getActivityList(ids);  
66 - return success(ActivityConvert.INSTANCE.convertList(list));  
67 - }  
68 -  
69 - @GetMapping("/page")  
70 - @ApiOperation("获得促销活动分页")  
71 - @PreAuthorize("@ss.hasPermission('market:activity:query')")  
72 - public CommonResult<PageResult<ActivityRespVO>> getActivityPage(@Valid ActivityPageReqVO pageVO) {  
73 - PageResult<ActivityDO> pageResult = activityService.getActivityPage(pageVO);  
74 - return success(ActivityConvert.INSTANCE.convertPage(pageResult));  
75 - }  
76 -  
77 -}  
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/activity/vo/ActivityBaseVO.java deleted
1 -package cn.iocoder.yudao.module.market.controller.admin.activity.vo;  
2 -  
3 -import cn.iocoder.yudao.framework.common.validation.InEnum;  
4 -import cn.iocoder.yudao.module.market.enums.activity.MarketActivityStatusEnum;  
5 -import cn.iocoder.yudao.module.market.enums.activity.MarketActivityTypeEnum;  
6 -import lombok.*;  
7 -import java.util.*;  
8 -import io.swagger.annotations.*;  
9 -import javax.validation.constraints.*;  
10 -import org.springframework.format.annotation.DateTimeFormat;  
11 -  
12 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
13 -  
14 -/**  
15 -* 促销活动 Base VO,提供给添加、修改、详细的子 VO 使用  
16 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
17 -*/  
18 -@Data  
19 -public class ActivityBaseVO {  
20 -  
21 - @ApiModelProperty(value = "活动标题", required = true)  
22 - @NotNull(message = "活动标题不能为空")  
23 - private String title;  
24 -  
25 - @ApiModelProperty(value = "活动类型", required = true)  
26 - @NotNull(message = "活动类型不能为空")  
27 - @InEnum(MarketActivityTypeEnum.class)  
28 - private Integer activityType;  
29 -  
30 - @ApiModelProperty(value = "活动状态", required = true)  
31 - @NotNull(message = "活动状态不能为空")  
32 - @InEnum(MarketActivityStatusEnum.class)  
33 - private Integer status;  
34 -  
35 - @ApiModelProperty(value = "开始时间", required = true)  
36 - @NotNull(message = "开始时间不能为空")  
37 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
38 - private Date startTime;  
39 -  
40 - @ApiModelProperty(value = "结束时间", required = true)  
41 - @NotNull(message = "结束时间不能为空")  
42 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
43 - private Date endTime;  
44 -  
45 - @ApiModelProperty(value = "失效时间")  
46 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
47 - private Date invalidTime;  
48 -  
49 - @ApiModelProperty(value = "删除时间")  
50 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
51 - private Date deleteTime;  
52 -  
53 - @ApiModelProperty(value = "限制折扣字符串,使用 JSON 序列化成字符串存储")  
54 - private String timeLimitedDiscount;  
55 -  
56 - @ApiModelProperty(value = "限制折扣字符串,使用 JSON 序列化成字符串存储")  
57 - private String fullPrivilege;  
58 -  
59 -}  
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/activity/vo/ActivityPageReqVO.java deleted
1 -package cn.iocoder.yudao.module.market.controller.admin.activity.vo;  
2 -  
3 -import cn.iocoder.yudao.framework.common.validation.InEnum;  
4 -import cn.iocoder.yudao.module.market.enums.activity.MarketActivityStatusEnum;  
5 -import cn.iocoder.yudao.module.market.enums.activity.MarketActivityTypeEnum;  
6 -import lombok.*;  
7 -import java.util.*;  
8 -import io.swagger.annotations.*;  
9 -import cn.iocoder.yudao.framework.common.pojo.PageParam;  
10 -import org.springframework.format.annotation.DateTimeFormat;  
11 -  
12 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
13 -  
14 -@ApiModel("管理后台 - 促销活动分页 Request VO")  
15 -@Data  
16 -@EqualsAndHashCode(callSuper = true)  
17 -@ToString(callSuper = true)  
18 -public class ActivityPageReqVO extends PageParam {  
19 -  
20 - @ApiModelProperty(value = "活动标题")  
21 - private String title;  
22 -  
23 - @ApiModelProperty(value = "活动类型")  
24 - @InEnum(MarketActivityTypeEnum.class)  
25 - private Integer activityType;  
26 -  
27 - @ApiModelProperty(value = "活动状态")  
28 - @InEnum(MarketActivityStatusEnum.class)  
29 - private Integer status;  
30 -  
31 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
32 - @ApiModelProperty(value = "开始时间")  
33 - private Date[] startTime;  
34 -  
35 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
36 - @ApiModelProperty(value = "结束时间")  
37 - private Date[] endTime;  
38 -  
39 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
40 - @ApiModelProperty(value = "失效时间")  
41 - private Date[] invalidTime;  
42 -  
43 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
44 - @ApiModelProperty(value = "删除时间")  
45 - private Date[] deleteTime;  
46 -  
47 - @ApiModelProperty(value = "限制折扣字符串,使用 JSON 序列化成字符串存储")  
48 - private String timeLimitedDiscount;  
49 -  
50 - @ApiModelProperty(value = "限制折扣字符串,使用 JSON 序列化成字符串存储")  
51 - private String fullPrivilege;  
52 -  
53 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
54 - @ApiModelProperty(value = "创建时间")  
55 - private Date[] createTime;  
56 -  
57 -}  
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/controller/admin/discount/package-info.java 0 → 100644
  1 +/**
  2 + * TODO 占位
  3 + */
  4 +package cn.iocoder.yudao.module.market.controller.admin.discount;
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/convert/activity/ActivityConvert.java deleted
1 -package cn.iocoder.yudao.module.market.convert.activity;  
2 -  
3 -import java.util.*;  
4 -  
5 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
6 -  
7 -import org.mapstruct.Mapper;  
8 -import org.mapstruct.factory.Mappers;  
9 -import cn.iocoder.yudao.module.market.controller.admin.activity.vo.*;  
10 -import cn.iocoder.yudao.module.market.dal.dataobject.activity.ActivityDO;  
11 -  
12 -/**  
13 - * 促销活动 Convert  
14 - *  
15 - * @author 芋道源码  
16 - */  
17 -@Mapper  
18 -public interface ActivityConvert {  
19 -  
20 - ActivityConvert INSTANCE = Mappers.getMapper(ActivityConvert.class);  
21 -  
22 - ActivityDO convert(ActivityCreateReqVO bean);  
23 -  
24 - ActivityDO convert(ActivityUpdateReqVO bean);  
25 -  
26 - ActivityRespVO convert(ActivityDO bean);  
27 -  
28 - List<ActivityRespVO> convertList(List<ActivityDO> list);  
29 -  
30 - PageResult<ActivityRespVO> convertPage(PageResult<ActivityDO> page);  
31 -  
32 -}  
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/convert/discount/package-info.java 0 → 100644
  1 +/**
  2 + * TODO 占位
  3 + */
  4 +package cn.iocoder.yudao.module.market.convert.discount;
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/dataobject/activity/ActivityDO.java renamed to yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/dataobject/discount/DiscountActivityDO.java
1 -package cn.iocoder.yudao.module.market.dal.dataobject.activity; 1 +package cn.iocoder.yudao.module.market.dal.dataobject.discount;
2 2
3 -import lombok.*;  
4 -import java.util.*;  
5 -import com.baomidou.mybatisplus.annotation.*;  
6 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.market.enums.common.PromotionActivityStatusEnum;
  5 +import com.baomidou.mybatisplus.annotation.KeySequence;
  6 +import com.baomidou.mybatisplus.annotation.TableId;
  7 +import com.baomidou.mybatisplus.annotation.TableName;
  8 +import lombok.Data;
  9 +import lombok.EqualsAndHashCode;
  10 +
  11 +import java.util.Date;
7 12
8 /** 13 /**
9 - * 促销活动 DO 14 + * 限时折扣活动 DO
  15 + *
  16 + * 一个活动下,可以有 {@link DiscountProductDO} 商品;
  17 + * 一个商品,在指定时间段内,只能属于一个活动;
10 * 18 *
11 * @author 芋道源码 19 * @author 芋道源码
12 */ 20 */
13 -@TableName("market_activity") 21 +@TableName(value = "promotion_discount_activity", autoResultMap = true)
  22 +@KeySequence("promotion_discount_activity_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
14 @Data 23 @Data
15 @EqualsAndHashCode(callSuper = true) 24 @EqualsAndHashCode(callSuper = true)
16 -@ToString(callSuper = true)  
17 -@Builder  
18 -@NoArgsConstructor  
19 -@AllArgsConstructor  
20 -public class ActivityDO extends BaseDO { 25 +public class DiscountActivityDO extends BaseDO {
21 26
22 /** 27 /**
23 - * 活动编号 28 + * 活动编号,主键自增
24 */ 29 */
25 @TableId 30 @TableId
26 private Long id; 31 private Long id;
27 /** 32 /**
28 * 活动标题 33 * 活动标题
29 */ 34 */
30 - private String title; 35 + private String name;
31 /** 36 /**
32 - * 活动类型MarketActivityTypeEnum  
33 - */  
34 - private Integer activityType;  
35 - /**  
36 - * 活动状态MarketActivityStatusEnum 37 + * 状态
  38 + *
  39 + * 枚举 {@link PromotionActivityStatusEnum}
37 */ 40 */
38 private Integer status; 41 private Integer status;
39 /** 42 /**
@@ -45,20 +48,8 @@ public class ActivityDO extends BaseDO { @@ -45,20 +48,8 @@ public class ActivityDO extends BaseDO {
45 */ 48 */
46 private Date endTime; 49 private Date endTime;
47 /** 50 /**
48 - * 失效时间  
49 - */  
50 - private Date invalidTime;  
51 - /**  
52 - * 删除时间  
53 - */  
54 - private Date deleteTime;  
55 - /**  
56 - * 限制折扣字符串,使用 JSON 序列化成字符串存储  
57 - */  
58 - private String timeLimitedDiscount;  
59 - /**  
60 - * 限制折扣字符串,使用 JSON 序列化成字符串存储 51 + * 备注
61 */ 52 */
62 - private String fullPrivilege; 53 + private String remark;
63 54
64 } 55 }
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/dataobject/discount/DiscountProductDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.market.dal.dataobject.discount;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import com.baomidou.mybatisplus.annotation.KeySequence;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import lombok.Data;
  8 +import lombok.EqualsAndHashCode;
  9 +
  10 +import java.util.Date;
  11 +
  12 +/**
  13 + * 限时折扣商品 DO
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@TableName(value = "promotion_discount_product", autoResultMap = true)
  18 +@KeySequence("promotion_discount_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  19 +@Data
  20 +@EqualsAndHashCode(callSuper = true)
  21 +public class DiscountProductDO extends BaseDO {
  22 +
  23 + /**
  24 + * 编号,主键自增
  25 + */
  26 + @TableId
  27 + private Long id;
  28 + /**
  29 + * 限时折扣活动的编号
  30 + *
  31 + * 关联 {@link DiscountActivityDO#getId()}
  32 + */
  33 + private Long activityId;
  34 + /**
  35 + * 商品 SPU 编号
  36 + *
  37 + * 关联 ProductSpuDO 的 id 编号
  38 + */
  39 + private Long spuId;
  40 + /**
  41 + * 商品 SKU 编号
  42 + *
  43 + * 关联 ProductSkuDO 的 id 编号
  44 + */
  45 + private Long skuId;
  46 + /**
  47 + * 开始时间
  48 + */
  49 + private Date startTime;
  50 + /**
  51 + * 结束时间
  52 + */
  53 + private Date endTime;
  54 + /**
  55 + * 销售价格,单位:分
  56 + *
  57 + * 冗余 ProductSkuDO 的 price 字段
  58 + */
  59 + private Integer originalPrice;
  60 + /**
  61 + * 优惠价格,单位:分
  62 + */
  63 + private Integer promotionPrice;
  64 +
  65 +}
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/dataobject/reward/RewardActivityDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.market.dal.dataobject.reward;
  2 +
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.market.enums.common.PromotionActivityStatusEnum;
  5 +import cn.iocoder.yudao.module.market.enums.common.PromotionConditionTypeEnum;
  6 +import cn.iocoder.yudao.module.market.enums.common.PromotionProductScopeEnum;
  7 +import com.baomidou.mybatisplus.annotation.KeySequence;
  8 +import com.baomidou.mybatisplus.annotation.TableField;
  9 +import com.baomidou.mybatisplus.annotation.TableId;
  10 +import com.baomidou.mybatisplus.annotation.TableName;
  11 +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
  12 +import lombok.Data;
  13 +import lombok.EqualsAndHashCode;
  14 +
  15 +import java.util.Date;
  16 +import java.util.List;
  17 +
  18 +/**
  19 + * 满减送活动 DO
  20 + *
  21 + * @author 芋道源码
  22 + */
  23 +@TableName(value = "promotion_reward_activity", autoResultMap = true)
  24 +@KeySequence("promotion_reward_activity_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  25 +@Data
  26 +@EqualsAndHashCode(callSuper = true)
  27 +public class RewardActivityDO extends BaseDO {
  28 +
  29 + /**
  30 + * 活动编号,主键自增
  31 + */
  32 + @TableId
  33 + private Long id;
  34 + /**
  35 + * 活动标题
  36 + */
  37 + private String name;
  38 + /**
  39 + * 状态
  40 + *
  41 + * 枚举 {@link PromotionActivityStatusEnum}
  42 + */
  43 + private Integer status;
  44 + /**
  45 + * 开始时间
  46 + */
  47 + private Date startTime;
  48 + /**
  49 + * 结束时间
  50 + */
  51 + private Date endTime;
  52 + /**
  53 + * 备注
  54 + */
  55 + private String remark;
  56 + /**
  57 + * 条件类型
  58 + *
  59 + * 枚举 {@link PromotionConditionTypeEnum}
  60 + */
  61 + private Integer conditionType;
  62 + /**
  63 + * 商品范围
  64 + *
  65 + * 枚举 {@link PromotionProductScopeEnum}
  66 + */
  67 + private Integer productScope;
  68 + /**
  69 + * 商品 SPU 编号的数组
  70 + */
  71 + @TableField(typeHandler = JacksonTypeHandler.class)
  72 + private List<Long> spuIds;
  73 + /**
  74 + * 优惠规则的数组
  75 + */
  76 + @TableField(typeHandler = JacksonTypeHandler.class)
  77 + private List<Rule> rules;
  78 +
  79 + /**
  80 + * 优惠规则
  81 + */
  82 + @Data
  83 + public static class Rule {
  84 +
  85 + /**
  86 + * 优惠门槛
  87 + *
  88 + * 1. 满 N 元,单位:分
  89 + * 2. 满 N 件
  90 + */
  91 + private Integer limit;
  92 + /**
  93 + * 优惠价格,单位:分
  94 + */
  95 + private Integer promotionPrice;
  96 + /**
  97 + * 是否包邮
  98 + */
  99 + private Boolean freeDelivery;
  100 + /**
  101 + * 赠送的积分
  102 + */
  103 + private Integer integral;
  104 + /**
  105 + * 赠送的优惠劵编号的数组
  106 + */
  107 + private List<Long> couponIds;
  108 + /**
  109 + * 赠送的优惠卷数量的数组
  110 + */
  111 + private List<Integer> couponCounts;
  112 +
  113 + }
  114 +
  115 +
  116 +}
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/mysql/activity/ActivityMapper.java deleted
1 -package cn.iocoder.yudao.module.market.dal.mysql.activity;  
2 -  
3 -import java.util.*;  
4 -  
5 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
6 -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;  
7 -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;  
8 -import cn.iocoder.yudao.module.market.dal.dataobject.activity.ActivityDO;  
9 -import org.apache.ibatis.annotations.Mapper;  
10 -import cn.iocoder.yudao.module.market.controller.admin.activity.vo.*;  
11 -  
12 -/**  
13 - * 促销活动 Mapper  
14 - *  
15 - * @author 芋道源码  
16 - */  
17 -@Mapper  
18 -public interface ActivityMapper extends BaseMapperX<ActivityDO> {  
19 -  
20 - default PageResult<ActivityDO> selectPage(ActivityPageReqVO reqVO) {  
21 - return selectPage(reqVO, new LambdaQueryWrapperX<ActivityDO>()  
22 - .eqIfPresent(ActivityDO::getTitle, reqVO.getTitle())  
23 - .eqIfPresent(ActivityDO::getActivityType, reqVO.getActivityType())  
24 - .eqIfPresent(ActivityDO::getStatus, reqVO.getStatus())  
25 - .betweenIfPresent(ActivityDO::getStartTime, reqVO.getStartTime())  
26 - .betweenIfPresent(ActivityDO::getEndTime, reqVO.getEndTime())  
27 - .betweenIfPresent(ActivityDO::getInvalidTime, reqVO.getInvalidTime())  
28 - .betweenIfPresent(ActivityDO::getDeleteTime, reqVO.getDeleteTime())  
29 - .eqIfPresent(ActivityDO::getTimeLimitedDiscount, reqVO.getTimeLimitedDiscount())  
30 - .eqIfPresent(ActivityDO::getFullPrivilege, reqVO.getFullPrivilege())  
31 - .betweenIfPresent(ActivityDO::getCreateTime, reqVO.getCreateTime())  
32 - .orderByDesc(ActivityDO::getId));  
33 - }  
34 -  
35 -}  
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/dal/mysql/discount/package-info.java 0 → 100644
  1 +/**
  2 + * TODO 占位
  3 + */
  4 +package cn.iocoder.yudao.module.market.dal.mysql.discount;
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/package-info.java
1 /** 1 /**
2 - * market 模块,我们放营销业务。 2 + * promotion 模块,我们放营销业务。
3 * 例如说:营销活动、banner、优惠券等等 3 * 例如说:营销活动、banner、优惠券等等
4 * 4 *
5 - * 1. Controller URL:以 /market/ 开头,避免和其它 Module 冲突  
6 - * 2. DataObject 表名:以 market_ 开头,方便在数据库中区分 5 + * 1. Controller URL:以 /promotion/ 开头,避免和其它 Module 冲突
  6 + * 2. DataObject 表名:以 promotion_ 开头,方便在数据库中区分
7 */ 7 */
8 package cn.iocoder.yudao.module.market; 8 package cn.iocoder.yudao.module.market;
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/activity/ActivityServiceImpl.java deleted
1 -package cn.iocoder.yudao.module.market.service.activity;  
2 -  
3 -import org.springframework.stereotype.Service;  
4 -import javax.annotation.Resource;  
5 -import org.springframework.validation.annotation.Validated;  
6 -  
7 -import java.util.*;  
8 -import cn.iocoder.yudao.module.market.controller.admin.activity.vo.*;  
9 -import cn.iocoder.yudao.module.market.dal.dataobject.activity.ActivityDO;  
10 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
11 -  
12 -import cn.iocoder.yudao.module.market.convert.activity.ActivityConvert;  
13 -import cn.iocoder.yudao.module.market.dal.mysql.activity.ActivityMapper;  
14 -  
15 -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;  
16 -import static cn.iocoder.yudao.module.market.enums.ErrorCodeConstants.*;  
17 -  
18 -/**  
19 - * 促销活动 Service 实现类  
20 - *  
21 - * @author 芋道源码  
22 - */  
23 -@Service  
24 -@Validated  
25 -public class ActivityServiceImpl implements ActivityService {  
26 -  
27 - @Resource  
28 - private ActivityMapper activityMapper;  
29 -  
30 - @Override  
31 - public Long createActivity(ActivityCreateReqVO createReqVO) {  
32 - // 插入  
33 - ActivityDO activity = ActivityConvert.INSTANCE.convert(createReqVO);  
34 - activityMapper.insert(activity);  
35 - // 返回  
36 - return activity.getId();  
37 - }  
38 -  
39 - @Override  
40 - public void updateActivity(ActivityUpdateReqVO updateReqVO) {  
41 - // 校验存在  
42 - this.validateActivityExists(updateReqVO.getId());  
43 - // 更新  
44 - ActivityDO updateObj = ActivityConvert.INSTANCE.convert(updateReqVO);  
45 - activityMapper.updateById(updateObj);  
46 - }  
47 -  
48 - @Override  
49 - public void deleteActivity(Long id) {  
50 - // 校验存在  
51 - this.validateActivityExists(id);  
52 - // 删除  
53 - activityMapper.deleteById(id);  
54 - }  
55 -  
56 - private void validateActivityExists(Long id) {  
57 - if (activityMapper.selectById(id) == null) {  
58 - throw exception(ACTIVITY_NOT_EXISTS);  
59 - }  
60 - }  
61 -  
62 - @Override  
63 - public ActivityDO getActivity(Long id) {  
64 - return activityMapper.selectById(id);  
65 - }  
66 -  
67 - @Override  
68 - public List<ActivityDO> getActivityList(Collection<Long> ids) {  
69 - return activityMapper.selectBatchIds(ids);  
70 - }  
71 -  
72 - @Override  
73 - public PageResult<ActivityDO> getActivityPage(ActivityPageReqVO pageReqVO) {  
74 - return activityMapper.selectPage(pageReqVO);  
75 - }  
76 -  
77 -}  
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/discount/package-info.java 0 → 100644
  1 +/**
  2 + * TODO 占位
  3 + */
  4 +package cn.iocoder.yudao.module.market.service.discount;
yudao-module-mall/yudao-module-market-biz/src/test/java/cn/iocoder/yudao/module/market/service/activity/ActivityServiceImplTest.java deleted
1 -package cn.iocoder.yudao.module.market.service.activity;  
2 -  
3 -import org.junit.jupiter.api.Disabled;  
4 -import org.junit.jupiter.api.Test;  
5 -  
6 -import javax.annotation.Resource;  
7 -  
8 -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;  
9 -  
10 -import cn.iocoder.yudao.module.market.controller.admin.activity.vo.*;  
11 -import cn.iocoder.yudao.module.market.dal.dataobject.activity.ActivityDO;  
12 -import cn.iocoder.yudao.module.market.dal.mysql.activity.ActivityMapper;  
13 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
14 -  
15 -import org.springframework.context.annotation.Import;  
16 -  
17 -import static cn.iocoder.yudao.module.market.enums.ErrorCodeConstants.*;  
18 -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;  
19 -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;  
20 -import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;  
21 -import static org.junit.jupiter.api.Assertions.*;  
22 -  
23 -/**  
24 -* {@link ActivityServiceImpl} 的单元测试类  
25 -*  
26 -* @author 芋道源码  
27 -*/  
28 -@Import(ActivityServiceImpl.class)  
29 -public class ActivityServiceImplTest extends BaseDbUnitTest {  
30 -  
31 - @Resource  
32 - private ActivityServiceImpl activityService;  
33 -  
34 - @Resource  
35 - private ActivityMapper activityMapper;  
36 -  
37 - @Test  
38 - public void testCreateActivity_success() {  
39 - // 准备参数  
40 - ActivityCreateReqVO reqVO = randomPojo(ActivityCreateReqVO.class);  
41 -  
42 - // 调用  
43 - Long activityId = activityService.createActivity(reqVO);  
44 - // 断言  
45 - assertNotNull(activityId);  
46 - // 校验记录的属性是否正确  
47 - ActivityDO activity = activityMapper.selectById(activityId);  
48 - assertPojoEquals(reqVO, activity);  
49 - }  
50 -  
51 - @Test  
52 - public void testUpdateActivity_success() {  
53 - // mock 数据  
54 - ActivityDO dbActivity = randomPojo(ActivityDO.class);  
55 - activityMapper.insert(dbActivity);// @Sql: 先插入出一条存在的数据  
56 - // 准备参数  
57 - ActivityUpdateReqVO reqVO = randomPojo(ActivityUpdateReqVO.class, o -> {  
58 - o.setId(dbActivity.getId()); // 设置更新的 ID  
59 - });  
60 -  
61 - // 调用  
62 - activityService.updateActivity(reqVO);  
63 - // 校验是否更新正确  
64 - ActivityDO activity = activityMapper.selectById(reqVO.getId()); // 获取最新的  
65 - assertPojoEquals(reqVO, activity);  
66 - }  
67 -  
68 - @Test  
69 - public void testUpdateActivity_notExists() {  
70 - // 准备参数  
71 - ActivityUpdateReqVO reqVO = randomPojo(ActivityUpdateReqVO.class);  
72 -  
73 - // 调用, 并断言异常  
74 - assertServiceException(() -> activityService.updateActivity(reqVO), ACTIVITY_NOT_EXISTS);  
75 - }  
76 -  
77 - @Test  
78 - public void testDeleteActivity_success() {  
79 - // mock 数据  
80 - ActivityDO dbActivity = randomPojo(ActivityDO.class);  
81 - activityMapper.insert(dbActivity);// @Sql: 先插入出一条存在的数据  
82 - // 准备参数  
83 - Long id = dbActivity.getId();  
84 -  
85 - // 调用  
86 - activityService.deleteActivity(id);  
87 - // 校验数据不存在了  
88 - assertNull(activityMapper.selectById(id));  
89 - }  
90 -  
91 - @Test  
92 - public void testDeleteActivity_notExists() {  
93 - // 准备参数  
94 - Long id = randomLongId();  
95 -  
96 - // 调用, 并断言异常  
97 - assertServiceException(() -> activityService.deleteActivity(id), ACTIVITY_NOT_EXISTS);  
98 - }  
99 -  
100 - @Test  
101 - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解  
102 - public void testGetActivityPage() {  
103 - // mock 数据  
104 - ActivityDO dbActivity = randomPojo(ActivityDO.class, o -> { // 等会查询到  
105 - o.setTitle(null);  
106 - o.setActivityType(null);  
107 - o.setStatus(null);  
108 - o.setStartTime(null);  
109 - o.setEndTime(null);  
110 - o.setInvalidTime(null);  
111 - o.setDeleteTime(null);  
112 - o.setTimeLimitedDiscount(null);  
113 - o.setFullPrivilege(null);  
114 - o.setCreateTime(null);  
115 - });  
116 - activityMapper.insert(dbActivity);  
117 - // 测试 title 不匹配  
118 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setTitle(null)));  
119 - // 测试 activityType 不匹配  
120 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setActivityType(null)));  
121 - // 测试 status 不匹配  
122 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setStatus(null)));  
123 - // 测试 startTime 不匹配  
124 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setStartTime(null)));  
125 - // 测试 endTime 不匹配  
126 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setEndTime(null)));  
127 - // 测试 invalidTime 不匹配  
128 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setInvalidTime(null)));  
129 - // 测试 deleteTime 不匹配  
130 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setDeleteTime(null)));  
131 - // 测试 timeLimitedDiscount 不匹配  
132 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setTimeLimitedDiscount(null)));  
133 - // 测试 fullPrivilege 不匹配  
134 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setFullPrivilege(null)));  
135 - // 测试 createTime 不匹配  
136 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setCreateTime(null)));  
137 - // 准备参数  
138 - ActivityPageReqVO reqVO = new ActivityPageReqVO();  
139 - reqVO.setTitle(null);  
140 - reqVO.setActivityType(null);  
141 - reqVO.setStatus(null);  
142 - reqVO.setStartTime(null);  
143 - reqVO.setEndTime(null);  
144 - reqVO.setInvalidTime(null);  
145 - reqVO.setDeleteTime(null);  
146 - reqVO.setTimeLimitedDiscount(null);  
147 - reqVO.setFullPrivilege(null);  
148 - reqVO.setCreateTime(null);  
149 -  
150 - // 调用  
151 - PageResult<ActivityDO> pageResult = activityService.getActivityPage(reqVO);  
152 - // 断言  
153 - assertEquals(1, pageResult.getTotal());  
154 - assertEquals(1, pageResult.getList().size());  
155 - assertPojoEquals(dbActivity, pageResult.getList().get(0));  
156 - }  
157 -  
158 - @Test  
159 - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解  
160 - public void testGetActivityList() {  
161 - // mock 数据  
162 - ActivityDO dbActivity = randomPojo(ActivityDO.class, o -> { // 等会查询到  
163 - o.setTitle(null);  
164 - o.setActivityType(null);  
165 - o.setStatus(null);  
166 - o.setStartTime(null);  
167 - o.setEndTime(null);  
168 - o.setInvalidTime(null);  
169 - o.setDeleteTime(null);  
170 - o.setTimeLimitedDiscount(null);  
171 - o.setFullPrivilege(null);  
172 - o.setCreateTime(null);  
173 - });  
174 - activityMapper.insert(dbActivity);  
175 - // 测试 title 不匹配  
176 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setTitle(null)));  
177 - // 测试 activityType 不匹配  
178 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setActivityType(null)));  
179 - // 测试 status 不匹配  
180 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setStatus(null)));  
181 - // 测试 startTime 不匹配  
182 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setStartTime(null)));  
183 - // 测试 endTime 不匹配  
184 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setEndTime(null)));  
185 - // 测试 invalidTime 不匹配  
186 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setInvalidTime(null)));  
187 - // 测试 deleteTime 不匹配  
188 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setDeleteTime(null)));  
189 - // 测试 timeLimitedDiscount 不匹配  
190 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setTimeLimitedDiscount(null)));  
191 - // 测试 fullPrivilege 不匹配  
192 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setFullPrivilege(null)));  
193 - // 测试 createTime 不匹配  
194 - activityMapper.insert(cloneIgnoreId(dbActivity, o -> o.setCreateTime(null)));  
195 - }  
196 -  
197 -}  
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java
@@ -38,12 +38,6 @@ public class ProductCategoryDO extends BaseDO { @@ -38,12 +38,6 @@ public class ProductCategoryDO extends BaseDO {
38 * 父分类编号 38 * 父分类编号
39 */ 39 */
40 private Long parentId; 40 private Long parentId;
41 -// /**  
42 -// * 店铺编号  
43 -// *  
44 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
45 -// */  
46 -// private Long shopId;  
47 /** 41 /**
48 * 分类名称 42 * 分类名称
49 */ 43 */
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupBindDO.java
@@ -27,12 +27,6 @@ public class ProductGroupBindDO extends BaseDO { @@ -27,12 +27,6 @@ public class ProductGroupBindDO extends BaseDO {
27 */ 27 */
28 @TableId 28 @TableId
29 private Long id; 29 private Long id;
30 -// /**  
31 -// * 店铺编号  
32 -// *  
33 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
34 -// */  
35 -// private Long shopId;  
36 /** 30 /**
37 * 商品分组编号 31 * 商品分组编号
38 * 32 *
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/group/ProductGroupDO.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.product.dal.dataobject.group; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.product.dal.dataobject.group;
2 2
3 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 3 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
5 -import cn.iocoder.yudao.module.product.dal.dataobject.shop.ShopDO;  
6 import cn.iocoder.yudao.module.product.enums.group.ProductGroupStyleEnum; 5 import cn.iocoder.yudao.module.product.enums.group.ProductGroupStyleEnum;
7 import com.baomidou.mybatisplus.annotation.KeySequence; 6 import com.baomidou.mybatisplus.annotation.KeySequence;
8 import com.baomidou.mybatisplus.annotation.TableId; 7 import com.baomidou.mybatisplus.annotation.TableId;
@@ -29,12 +28,6 @@ public class ProductGroupDO extends BaseDO { @@ -29,12 +28,6 @@ public class ProductGroupDO extends BaseDO {
29 */ 28 */
30 @TableId 29 @TableId
31 private Long id; 30 private Long id;
32 -// /**  
33 -// * 店铺编号  
34 -// *  
35 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
36 -// */  
37 -// private Long shopId;  
38 /** 31 /**
39 * 分组名称 32 * 分组名称
40 */ 33 */
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java
@@ -27,12 +27,6 @@ public class ProductPropertyDO extends BaseDO { @@ -27,12 +27,6 @@ public class ProductPropertyDO extends BaseDO {
27 */ 27 */
28 @TableId 28 @TableId
29 private Long id; 29 private Long id;
30 -// /**  
31 -// * 店铺编号  
32 -// *  
33 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
34 -// */  
35 -// private Long shopId;  
36 /** 30 /**
37 * 规格名称 31 * 规格名称
38 */ 32 */
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/search/ProductHotSearchDO.java
@@ -34,11 +34,5 @@ public class ProductHotSearchDO extends BaseDO { @@ -34,11 +34,5 @@ public class ProductHotSearchDO extends BaseDO {
34 * 内容 34 * 内容
35 */ 35 */
36 private String content; 36 private String content;
37 -// /**  
38 -// * 店铺编号  
39 -// *  
40 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
41 -// */  
42 -// private Long shopId;  
43 37
44 } 38 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java
@@ -36,13 +36,6 @@ public class ProductSpuDO extends BaseDO { @@ -36,13 +36,6 @@ public class ProductSpuDO extends BaseDO {
36 @TableId 36 @TableId
37 private Long id; 37 private Long id;
38 38
39 -// /**  
40 -// * 店铺编号  
41 -// *  
42 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
43 -// */  
44 -// private Long shopId;  
45 -  
46 // ========== 基本信息 ========= 39 // ========== 基本信息 =========
47 40
48 /** 41 /**
@@ -215,4 +208,9 @@ public class ProductSpuDO extends BaseDO { @@ -215,4 +208,9 @@ public class ProductSpuDO extends BaseDO {
215 208
216 // TODO poster:商品自定义海报 209 // TODO poster:商品自定义海报
217 210
  211 + // TODO ========== 待定字段:laoji =========
  212 + // TODO productType 1 - 普通商品 2 - 预售商品;可能和 type 合并不错
  213 + // TODO productUnit 商品单位
  214 + // TODO extJson 扩展信息;例如说,预售商品的信息
  215 +
218 } 216 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java
@@ -22,7 +22,7 @@ public interface ProductSkuMapper extends BaseMapperX&lt;ProductSkuDO&gt; { @@ -22,7 +22,7 @@ public interface ProductSkuMapper extends BaseMapperX&lt;ProductSkuDO&gt; {
22 .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId()) 22 .eqIfPresent(ProductSkuDO::getSpuId, reqVO.getSpuId())
23 .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties()) 23 .eqIfPresent(ProductSkuDO::getProperties, reqVO.getProperties())
24 .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice()) 24 .eqIfPresent(ProductSkuDO::getPrice, reqVO.getPrice())
25 - .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice()) 25 +// .eqIfPresent(ProductSkuDO::getOriginalPrice, reqVO.getOriginalPrice())
26 // .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice()) 26 // .eqIfPresent(ProductSkuDO::getCostPrice, reqVO.getCostPrice())
27 .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode()) 27 .eqIfPresent(ProductSkuDO::getBarCode, reqVO.getBarCode())
28 .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl()) 28 .eqIfPresent(ProductSkuDO::getPicUrl, reqVO.getPicUrl())
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java
@@ -24,7 +24,7 @@ public interface ProductSpuMapper extends BaseMapperX&lt;ProductSpuDO&gt; { @@ -24,7 +24,7 @@ public interface ProductSpuMapper extends BaseMapperX&lt;ProductSpuDO&gt; {
24 .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls()) 24 .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls())
25 .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort()) 25 .eqIfPresent(ProductSpuDO::getSort, reqVO.getSort())
26 // .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount()) 26 // .eqIfPresent(ProductSpuDO::getLikeCount, reqVO.getLikeCount())
27 - .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice()) 27 +// .eqIfPresent(ProductSpuDO::getPrice, reqVO.getPrice())
28 // .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity()) 28 // .eqIfPresent(ProductSpuDO::getQuantity, reqVO.getQuantity())
29 .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus()) 29 .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus())
30 .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getCreateTime()) 30 .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getCreateTime())
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/sku/SkuServiceImplTest.java
@@ -105,7 +105,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { @@ -105,7 +105,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
105 o.setSpuId(null); 105 o.setSpuId(null);
106 o.setProperties(null); 106 o.setProperties(null);
107 o.setPrice(null); 107 o.setPrice(null);
108 - o.setOriginalPrice(null); 108 +// o.setOriginalPrice(null);
109 // o.setCostPrice(null); 109 // o.setCostPrice(null);
110 o.setBarCode(null); 110 o.setBarCode(null);
111 o.setPicUrl(null); 111 o.setPicUrl(null);
@@ -120,7 +120,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest { @@ -120,7 +120,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
120 // 测试 price 不匹配 120 // 测试 price 不匹配
121 ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null))); 121 ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setPrice(null)));
122 // 测试 originalPrice 不匹配 122 // 测试 originalPrice 不匹配
123 - ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null))); 123 +// ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setOriginalPrice(null)));
124 // 测试 costPrice 不匹配 124 // 测试 costPrice 不匹配
125 // ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null))); 125 // ProductSkuMapper.insert(cloneIgnoreId(dbSku, o -> o.setCostPrice(null)));
126 // 测试 barCode 不匹配 126 // 测试 barCode 不匹配
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java
@@ -110,7 +110,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { @@ -110,7 +110,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
110 o.setPicUrls(null); 110 o.setPicUrls(null);
111 o.setSort(null); 111 o.setSort(null);
112 // o.setLikeCount(null); 112 // o.setLikeCount(null);
113 - o.setPrice(null); 113 +// o.setPrice(null);
114 // o.setQuantity(null); 114 // o.setQuantity(null);
115 o.setStatus(null); 115 o.setStatus(null);
116 o.setCreateTime(null); 116 o.setCreateTime(null);
@@ -131,7 +131,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { @@ -131,7 +131,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
131 // 测试 likeCount 不匹配 131 // 测试 likeCount 不匹配
132 // ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null))); 132 // ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setLikeCount(null)));
133 // 测试 price 不匹配 133 // 测试 price 不匹配
134 - ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null))); 134 +// ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setPrice(null)));
135 // 测试 quantity 不匹配 135 // 测试 quantity 不匹配
136 // ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null))); 136 // ProductSpuMapper.insert(cloneIgnoreId(dbSpu, o -> o.setQuantity(null)));
137 // 测试 status 不匹配 137 // 测试 status 不匹配
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderCloseTypeEnum.java renamed to yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderCancelTypeEnum.java
@@ -10,7 +10,7 @@ import lombok.RequiredArgsConstructor; @@ -10,7 +10,7 @@ import lombok.RequiredArgsConstructor;
10 */ 10 */
11 @RequiredArgsConstructor 11 @RequiredArgsConstructor
12 @Getter 12 @Getter
13 -public enum TradeOrderCloseTypeEnum { 13 +public enum TradeOrderCancelTypeEnum {
14 14
15 PAY_TIMEOUT(10, "超时未支付"), 15 PAY_TIMEOUT(10, "超时未支付"),
16 REFUND_CLOSE(20, "退款关闭"), 16 REFUND_CLOSE(20, "退款关闭"),
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderStatusEnum.java
@@ -15,8 +15,8 @@ public enum TradeOrderStatusEnum { @@ -15,8 +15,8 @@ public enum TradeOrderStatusEnum {
15 WAITING_PAYMENT(0, "待付款"), 15 WAITING_PAYMENT(0, "待付款"),
16 WAIT_SHIPMENT(1, "待发货"), 16 WAIT_SHIPMENT(1, "待发货"),
17 ALREADY_SHIPMENT(2, "待收货"), 17 ALREADY_SHIPMENT(2, "待收货"),
18 - COMPLETED(3, "成功"),  
19 - CLOSED(4, "失败"); 18 + COMPLETED(3, "已完成"),
  19 + CANCEL(4, "已关闭");
20 20
21 /** 21 /**
22 * 状态值 22 * 状态值
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/CartController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.cart;
  2 +
  3 +import io.swagger.annotations.Api;
  4 +import org.springframework.validation.annotation.Validated;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +@Api(tags = "购物车 API")
  9 +@RestController
  10 +@RequestMapping("/cart")
  11 +@Validated
  12 +public class CartController {
  13 +
  14 +// @Autowired
  15 +// private CartManager cartManager;
  16 +//
  17 +// @PostMapping("add")
  18 +// @ApiOperation("添加商品到购物车")
  19 +// @ApiImplicitParams({
  20 +// @ApiImplicitParam(name = "skuId", value = "商品 SKU 编号", required = true, example = "1"),
  21 +// @ApiImplicitParam(name = "quantity", value = "增加数量", required = true, example = "1024")
  22 +// })
  23 +// @RequiresAuthenticate
  24 +// public CommonResult<Boolean> addCartItem(@RequestParam("skuId") Integer skuId,
  25 +// @RequestParam("quantity") Integer quantity) {
  26 +// cartManager.addCartItem(UserSecurityContextHolder.getUserId(), skuId, quantity);
  27 +// return success(true);
  28 +// }
  29 +//
  30 +// @GetMapping("sum-quantity")
  31 +// @ApiOperation("查询用户在购物车中的商品数量")
  32 +// @RequiresAuthenticate
  33 +// public CommonResult<Integer> sumCartItemQuantity() {
  34 +// return success(cartManager.sumCartItemQuantity(UserSecurityContextHolder.getUserId()));
  35 +// }
  36 +//
  37 +// @GetMapping("/get-detail")
  38 +// @ApiOperation("查询用户的购物车的商品列表")
  39 +// @RequiresAuthenticate
  40 +// public CommonResult<CartDetailVO> getCartDetail() {
  41 +// return success(cartManager.getCartDetail(UserSecurityContextHolder.getUserId()));
  42 +// }
  43 +//
  44 +// @PostMapping("update-quantity")
  45 +// @ApiOperation("更新购物车商品数量")
  46 +// @ApiImplicitParams({
  47 +// @ApiImplicitParam(name = "skuId", value = "商品 SKU 编号", required = true, example = "1"),
  48 +// @ApiImplicitParam(name = "quantity", value = "增加数量", required = true, example = "1024")
  49 +// })
  50 +// @RequiresAuthenticate
  51 +// public CommonResult<Boolean> updateCartItemQuantity(@RequestParam("skuId") Integer skuId,
  52 +// @RequestParam("quantity") Integer quantity) {
  53 +// cartManager.updateCartItemQuantity(UserSecurityContextHolder.getUserId(), skuId, quantity);
  54 +// return success(true);
  55 +// }
  56 +//
  57 +// @PostMapping("update-selected")
  58 +// @ApiOperation("更新购物车商品是否选中")
  59 +// @ApiImplicitParams({
  60 +// @ApiImplicitParam(name = "skuIds", value = "商品 SKU 编号数组", required = true, example = "1,3"),
  61 +// @ApiImplicitParam(name = "selected", value = "是否选中", required = true, example = "true")
  62 +// })
  63 +// @RequiresAuthenticate
  64 +// public CommonResult<Boolean> updateCartItemSelected(@RequestParam("skuIds") Set<Integer> skuIds,
  65 +// @RequestParam("selected") Boolean selected) {
  66 +// cartManager.updateCartItemSelected(UserSecurityContextHolder.getUserId(), skuIds, selected);
  67 +// // 获得目前购物车明细
  68 +// return success(true);
  69 +// }
  70 +
  71 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/vo/CartDetailVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.cart.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import lombok.Data;
  5 +import lombok.experimental.Accessors;
  6 +
  7 +import java.util.List;
  8 +
  9 +@ApiModel(value = "用户的购物车明细 Response VO") // TODO 芋艿:swagger 文档完善
  10 +@Data
  11 +@Accessors(chain = true)
  12 +public class CartDetailVO {
  13 +
  14 + /**
  15 + * 商品分组数组
  16 + */
  17 + private List<ItemGroup> itemGroups;
  18 + /**
  19 + * 费用
  20 + */
  21 + private Fee fee;
  22 +
  23 + /**
  24 + * 商品分组
  25 + *
  26 + * 多个商品,参加同一个活动,从而形成分组。
  27 + */
  28 + @Data
  29 + @Accessors(chain = true)
  30 + public static class ItemGroup {
  31 +
  32 +// /**
  33 +// * 优惠活动
  34 +// */
  35 +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
  36 + /**
  37 + * 促销减少的金额
  38 + *
  39 + * 1. 若未参与促销活动,或不满足促销条件,返回 null
  40 + * 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。
  41 + */
  42 + private Integer activityDiscountTotal;
  43 + /**
  44 + * 商品数组
  45 + */
  46 + private List<Sku> items;
  47 +
  48 + }
  49 +
  50 + @Data
  51 + @Accessors(chain = true)
  52 + public static class Sku {
  53 +
  54 + // SKU 自带信息
  55 + /**
  56 + * sku 编号
  57 + */
  58 + private Integer id;
  59 + /**
  60 + * SPU 信息
  61 + */
  62 + private Spu spu;
  63 + /**
  64 + * 图片地址
  65 + */
  66 + private String picURL;
  67 +// /**
  68 +// * 规格值数组
  69 +// */
  70 +// private List<ProductAttrKeyValueRespVO> attrs; // TODO 后面改下
  71 + /**
  72 + * 价格,单位:分
  73 + */
  74 + private Integer price;
  75 + /**
  76 + * 库存数量
  77 + */
  78 + private Integer quantity;
  79 +
  80 + // 非 SKU 自带信息
  81 +
  82 + /**
  83 + * 购买数量
  84 + */
  85 + private Integer buyQuantity;
  86 + /**
  87 + * 是否选中
  88 + */
  89 + private Boolean selected;
  90 +// /**
  91 +// * 优惠活动
  92 +// */
  93 +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
  94 + /**
  95 + * 原始单价,单位:分。
  96 + */
  97 + private Integer originPrice;
  98 + /**
  99 + * 购买单价,单位:分
  100 + */
  101 + private Integer buyPrice;
  102 + /**
  103 + * 最终价格,单位:分。
  104 + */
  105 + private Integer presentPrice;
  106 + /**
  107 + * 购买总金额,单位:分
  108 + *
  109 + * 用途类似 {@link #presentTotal}
  110 + */
  111 + private Integer buyTotal;
  112 + /**
  113 + * 优惠总金额,单位:分。
  114 + */
  115 + private Integer discountTotal;
  116 + /**
  117 + * 最终总金额,单位:分。
  118 + *
  119 + * 注意,presentPrice * quantity 不一定等于 presentTotal 。
  120 + * 因为,存在无法整除的情况。
  121 + * 举个例子,presentPrice = 8.33 ,quantity = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。
  122 + * 所以,需要存储一个该字段。
  123 + */
  124 + private Integer presentTotal;
  125 +
  126 + }
  127 +
  128 + @Data
  129 + @Accessors(chain = true)
  130 + public static class Spu {
  131 +
  132 + /**
  133 + * SPU 编号
  134 + */
  135 + private Integer id;
  136 +
  137 + // ========== 基本信息 =========
  138 + /**
  139 + * SPU 名字
  140 + */
  141 + private String name;
  142 + /**
  143 + * 分类编号
  144 + */
  145 + private Integer cid;
  146 + /**
  147 + * 商品主图地址
  148 + *
  149 + * 数组,以逗号分隔
  150 + *
  151 + * 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
  152 + */
  153 + private List<String> picUrls;
  154 +
  155 + }
  156 +
  157 + /**
  158 + * 费用(合计)
  159 + */
  160 + @Data
  161 + @Accessors(chain = true)
  162 + public static class Fee {
  163 +
  164 + /**
  165 + * 购买总价
  166 + */
  167 + private Integer buyTotal;
  168 + /**
  169 + * 优惠总价
  170 + *
  171 + * 注意,满多少元包邮,不算在优惠中。
  172 + */
  173 + private Integer discountTotal;
  174 + /**
  175 + * 邮费
  176 + */
  177 + private Integer postageTotal;
  178 + /**
  179 + * 最终价格
  180 + *
  181 + * 计算公式 = 总价 - 优惠总价 + 邮费
  182 + */
  183 + private Integer presentTotal;
  184 +
  185 + public Fee() {
  186 + }
  187 +
  188 + public Fee(Integer buyTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) {
  189 + this.buyTotal = buyTotal;
  190 + this.discountTotal = discountTotal;
  191 + this.postageTotal = postageTotal;
  192 + this.presentTotal = presentTotal;
  193 + }
  194 +
  195 + }
  196 +
  197 + /**
  198 + * 邮费信息 TODO 芋艿,未完成
  199 + */
  200 + @Data
  201 + @Accessors(chain = true)
  202 + public static class Postage {
  203 +
  204 + /**
  205 + * 需要满足多少钱,可以包邮。单位:分
  206 + */
  207 + private Integer threshold;
  208 +
  209 + }
  210 +
  211 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.http 0 → 100644
  1 +### /trade-order/confirm-create-order-info 基于商品,确认创建订单
  2 +GET {{appApi}}/trade/order/get-create-info?items[0].skuId=1&items[0].count=1
  3 +Authorization: Bearer {{user-access-token}}
  4 +tenant-id: {{appTenentId}}
  5 +
  6 +### /trade-order/confirm-create-order-info-from-cart 基于购物车,确认创建订单
  7 +GET {{shop-api-base-url}}/trade-order/confirm-create-order-info-from-cart
  8 +Content-Type: application/x-www-form-urlencoded
  9 +Authorization: Bearer {{user-access-token}}
  10 +
  11 +### /trade-order/confirm-create-order-info-from-cart 基于商品,创建订单
  12 +POST {{shop-api-base-url}}/trade-order/create
  13 +Content-Type: application/json
  14 +Authorization: Bearer {{user-access-token}}
  15 +
  16 +{
  17 + "userAddressId": 19,
  18 + "remark": "我是备注",
  19 + "orderItems": [
  20 + {
  21 + "skuId": 3,
  22 + "quantity": 1
  23 + }
  24 + ]
  25 +}
  26 +
  27 +### /trade-order/page 获得订单交易分页
  28 +GET {{shop-api-base-url}}/trade-order/page?status=1&pageNo=1&pageSize=10
  29 +Content-Type: application/x-www-form-urlencoded
  30 +
  31 +###
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
  6 +import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
  7 +import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderGetCreateInfoRespVO;
  8 +import cn.iocoder.yudao.module.trade.controller.app.order.vo.TradeOrderPageReqVO;
  9 +import cn.iocoder.yudao.module.trade.controller.app.order.vo.TradeOrderRespVO;
  10 +import io.swagger.annotations.Api;
  11 +import io.swagger.annotations.ApiImplicitParam;
  12 +import io.swagger.annotations.ApiOperation;
  13 +import lombok.extern.slf4j.Slf4j;
  14 +import org.springframework.validation.annotation.Validated;
  15 +import org.springframework.web.bind.annotation.*;
  16 +
  17 +import javax.servlet.http.HttpServletRequest;
  18 +
  19 +@Api(tags = "用户 App - 交易订单")
  20 +@RestController
  21 +@RequestMapping("/trade/order")
  22 +@Validated
  23 +@Slf4j
  24 +public class AppTradeOrderController {
  25 +
  26 + // TODO 在思考下;
  27 +
  28 + @GetMapping("/get-create-info")
  29 + @ApiOperation("基于商品,确认创建订单")
  30 + @PreAuthenticated
  31 + public CommonResult<AppTradeOrderGetCreateInfoRespVO> getTradeOrderCreateInfo(AppTradeOrderCreateReqVO createReqVO) {
  32 +// return success(tradeOrderService.getOrderConfirmCreateInfo(UserSecurityContextHolder.getUserId(), skuId, quantity, couponCardId));
  33 + return null;
  34 + }
  35 +
  36 + @PostMapping("/create")
  37 + @ApiOperation("创建订单")
  38 + @PreAuthenticated
  39 + public CommonResult<Integer> createTradeOrder(@RequestBody AppTradeOrderCreateReqVO createReqVO,
  40 + HttpServletRequest servletRequest) {
  41 +// return success(tradeOrderService.createTradeOrder(UserSecurityContextHolder.getUserId(),
  42 +// HttpUtil.getIp(servletRequest), createReqVO));
  43 + return null;
  44 + }
  45 +
  46 + @GetMapping("/get")
  47 + @ApiOperation("获得交易订单")
  48 + @ApiImplicitParam(name = "tradeOrderId", value = "交易订单编号", required = true)
  49 + public CommonResult<TradeOrderRespVO> getTradeOrder(@RequestParam("tradeOrderId") Integer tradeOrderId) {
  50 +// return success(tradeOrderService.getTradeOrder(tradeOrderId));
  51 + return null;
  52 + }
  53 +
  54 + @GetMapping("/page")
  55 + @ApiOperation("获得订单交易分页")
  56 + public CommonResult<PageResult<TradeOrderRespVO>> pageTradeOrder(TradeOrderPageReqVO pageVO) {
  57 +// return success(tradeOrderService.pageTradeOrder(UserSecurityContextHolder.getUserId(), pageVO));
  58 + return null;
  59 + }
  60 +
  61 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +import javax.validation.constraints.Min;
  8 +import javax.validation.constraints.NotNull;
  9 +import java.util.List;
  10 +
  11 +@ApiModel(value = "用户 App - 交易订单创建 Request VO")
  12 +@Data
  13 +public class AppTradeOrderCreateReqVO {
  14 +
  15 + @ApiModelProperty(name = "收件地址编号", required = true, example = "1")
  16 + @NotNull(message = "收件地址不能为空")
  17 + private Integer addressId;
  18 +
  19 + @ApiModelProperty(name = "优惠劵编号", example = "1024")
  20 + private Integer couponId;
  21 +
  22 + @ApiModelProperty(name = "备注", example = "1024")
  23 + private String remark;
  24 +
  25 + @ApiModelProperty(name = "是否来自购物车", required = true, example = "true", notes = "true - 来自购物车;false - 立即购买")
  26 + @NotNull(message = "是否来自购物车不能为空")
  27 + private Boolean fromCart;
  28 +
  29 + /**
  30 + * 订单商品项列表
  31 + */
  32 + @NotNull(message = "必须选择购买的商品")
  33 + private List<Item> items;
  34 +
  35 + @ApiModel(value = "订单商品项")
  36 + @Data
  37 + public static class Item {
  38 +
  39 + @ApiModelProperty(name = "商品 SKU 编号", required = true, example = "111")
  40 + @NotNull(message = "商品 SKU 编号不能为空")
  41 + private Integer skuId;
  42 +
  43 + @ApiModelProperty(name = "商品 SKU 购买数量", required = true, example = "1024")
  44 + @NotNull(message = "商品 SKU 购买数量不能为空")
  45 + @Min(value = 1, message = "商品 SKU 购买数量必须大于 0")
  46 + private Integer count;
  47 +
  48 + }
  49 +
  50 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderGetCreateInfoRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +
  8 +import java.util.List;
  9 +
  10 +@ApiModel(value = "用户 App - 订单获得创建信息 Response VO")
  11 +@Data
  12 +public class AppTradeOrderGetCreateInfoRespVO {
  13 +
  14 + /**
  15 + * 商品分组数组
  16 + */
  17 + private List<ItemGroup> itemGroups;
  18 + /**
  19 + * 费用
  20 + */
  21 + private Fee fee;
  22 +
  23 +// /**
  24 +// * 优惠劵列表 TODO 芋艿,后续改改
  25 +// */
  26 +// private List<CouponCardAvailableRespDTO> coupons;
  27 +
  28 + @ApiModel(value = "商品分组", description = "多个商品,参加同一个活动,从而形成分组")
  29 + @Data
  30 + public static class ItemGroup {
  31 +
  32 +// /**
  33 +// * 优惠活动
  34 +// */
  35 +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
  36 + /**
  37 + * 商品 SKU 数组
  38 + */
  39 + private List<Sku> items;
  40 +
  41 + }
  42 +
  43 + @ApiModel("商品 SKU")
  44 + @Data
  45 + public static class Sku {
  46 +
  47 + // SKU 自带信息
  48 + @ApiModelProperty(value = "SKU 编号", required = true, example = "1024")
  49 + private Integer id;
  50 + /**
  51 + * SPU 信息
  52 + */
  53 + private Spu spu;
  54 + /**
  55 + * 图片地址
  56 + */
  57 + private String picURL;
  58 +// /**
  59 +// * 规格值数组
  60 +// */
  61 +// private List<ProductAttrKeyValueRespVO> attrs; // TODO 后面改下
  62 + /**
  63 + * 价格,单位:分
  64 + */
  65 + private Integer price;
  66 + /**
  67 + * 库存数量
  68 + */
  69 + private Integer stock;
  70 +
  71 + // 非 SKU 自带信息
  72 +
  73 + /**
  74 + * 购买数量
  75 + */
  76 + private Integer buyQuantity;
  77 +// /**
  78 +// * 优惠活动
  79 +// */
  80 +// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
  81 + /**
  82 + * 原始单价,单位:分。
  83 + */
  84 + private Integer originPrice;
  85 + /**
  86 + * 购买单价,单位:分
  87 + */
  88 + private Integer buyPrice;
  89 + /**
  90 + * 最终价格,单位:分。
  91 + */
  92 + private Integer presentPrice;
  93 + /**
  94 + * 购买总金额,单位:分
  95 + *
  96 + * 用途类似 {@link #presentTotal}
  97 + */
  98 + private Integer buyTotal;
  99 + /**
  100 + * 优惠总金额,单位:分。
  101 + */
  102 + private Integer discountTotal;
  103 + /**
  104 + * 最终总金额,单位:分。
  105 + *
  106 + * 注意,presentPrice * quantity 不一定等于 presentTotal 。
  107 + * 因为,存在无法整除的情况。
  108 + * 举个例子,presentPrice = 8.33 ,quantity = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。
  109 + * 所以,需要存储一个该字段。
  110 + */
  111 + private Integer presentTotal;
  112 +
  113 + }
  114 +
  115 + @Data
  116 + public static class Spu {
  117 +
  118 + /**
  119 + * SPU 编号
  120 + */
  121 + private Integer id;
  122 +
  123 + // ========== 基本信息 =========
  124 + /**
  125 + * SPU 名字
  126 + */
  127 + private String name;
  128 + /**
  129 + * 分类编号
  130 + */
  131 + private Integer cid;
  132 + /**
  133 + * 商品主图地址
  134 + *
  135 + * 数组,以逗号分隔
  136 + *
  137 + * 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
  138 + */
  139 + private List<String> picUrls;
  140 +
  141 + }
  142 +
  143 + @ApiModel("费用(合计)")
  144 + @Data
  145 + @AllArgsConstructor
  146 + public static class Fee {
  147 +
  148 + @ApiModelProperty(value = "购买总价", required = true, example = "1024")
  149 + private Integer buyPrice;
  150 + /**
  151 + * 优惠总价
  152 + *
  153 + * 注意,满多少元包邮,不算在优惠中。
  154 + */
  155 + private Integer discountTotal;
  156 + /**
  157 + * 邮费
  158 + */
  159 + private Integer postageTotal;
  160 + /**
  161 + * 最终价格
  162 + *
  163 + * 计算公式 = 总价 - 优惠总价 + 邮费
  164 + */
  165 + private Integer presentTotal;
  166 +
  167 + }
  168 +
  169 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderItemRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +import java.util.Date;
  8 +
  9 +@ApiModel("交易订单项 Response VO")
  10 +@Data
  11 +public class TradeOrderItemRespVO {
  12 +
  13 + @ApiModelProperty(value = "id自增长", required = true)
  14 + private Integer id;
  15 + @ApiModelProperty(value = "订单编号", required = true)
  16 + private Integer orderId;
  17 + @ApiModelProperty(value = "订单项状态", required = true)
  18 + private Integer status;
  19 + @ApiModelProperty(value = "商品 SKU 编号", required = true)
  20 + private Integer skuId;
  21 + @ApiModelProperty(value = "商品 SPU 编号", required = true)
  22 + private Integer spuId;
  23 + @ApiModelProperty(value = "商品名字", required = true)
  24 + private String skuName;
  25 + @ApiModelProperty(value = "图片名字", required = true)
  26 + private String skuImage;
  27 + @ApiModelProperty(value = "商品数量", required = true)
  28 + private Integer quantity;
  29 + @ApiModelProperty(value = "原始单价,单位:分", required = true)
  30 + private Integer originPrice;
  31 + @ApiModelProperty(value = "购买单价,单位:分", required = true)
  32 + private Integer buyPrice;
  33 + @ApiModelProperty(value = "最终价格,单位:分", required = true)
  34 + private Integer presentPrice;
  35 + @ApiModelProperty(value = "购买总金额,单位:分", required = true)
  36 + private Integer buyTotal;
  37 + @ApiModelProperty(value = "优惠总金额,单位:分", required = true)
  38 + private Integer discountTotal;
  39 + @ApiModelProperty(value = "最终总金额,单位:分", required = true)
  40 + private Integer presentTotal;
  41 + @ApiModelProperty(value = "退款总金额,单位:分", required = true)
  42 + private Integer refundTotal;
  43 + @ApiModelProperty(value = "物流id")
  44 + private Integer logisticsId;
  45 + @ApiModelProperty(value = "售后状态", required = true)
  46 + private Integer afterSaleStatus;
  47 + @ApiModelProperty(value = "售后订单编号")
  48 + private Integer afterSaleOrderId;
  49 + @ApiModelProperty(value = "创建时间", required = true)
  50 + private Date createTime;
  51 +
  52 +
  53 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order.vo;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +import lombok.EqualsAndHashCode;
  8 +
  9 +@ApiModel("交易订单分页 Request VO")
  10 +@Data
  11 +@EqualsAndHashCode(callSuper = true)
  12 +public class TradeOrderPageReqVO extends PageParam {
  13 +
  14 + @ApiModelProperty(value = "订单状态", example = "1", notes = "参见 TradeOrderStatusEnum 枚举")
  15 + private Integer orderStatus;
  16 +
  17 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/TradeOrderRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.order.vo;
  2 +
  3 +import lombok.*;
  4 +import io.swagger.annotations.*;
  5 +import java.util.*;
  6 +
  7 +@ApiModel("订单交易 Response VO")
  8 +@Data
  9 +public class TradeOrderRespVO {
  10 +
  11 + @ApiModelProperty(value = "订单编号", required = true)
  12 + private Integer id;
  13 + @ApiModelProperty(value = "用户编号", required = true)
  14 + private Integer userId;
  15 + @ApiModelProperty(value = "订单单号", required = true)
  16 + private String orderNo;
  17 + @ApiModelProperty(value = "订单状态", required = true)
  18 + private Integer orderStatus;
  19 + @ApiModelProperty(value = "备注")
  20 + private String remark;
  21 + @ApiModelProperty(value = "订单结束时间")
  22 + private Date endTime;
  23 + @ApiModelProperty(value = "订单金额(总金额),单位:分", required = true)
  24 + private Integer buyPrice;
  25 + @ApiModelProperty(value = "优惠总金额,单位:分", required = true)
  26 + private Integer discountPrice;
  27 + @ApiModelProperty(value = "物流金额,单位:分", required = true)
  28 + private Integer logisticsPrice;
  29 + @ApiModelProperty(value = "最终金额,单位:分", required = true)
  30 + private Integer presentPrice;
  31 + @ApiModelProperty(value = "支付金额,单位:分", required = true)
  32 + private Integer payPrice;
  33 + @ApiModelProperty(value = "退款金额,单位:分", required = true)
  34 + private Integer refundPrice;
  35 + @ApiModelProperty(value = "付款时间")
  36 + private Date payTime;
  37 + @ApiModelProperty(value = "支付订单编号")
  38 + private Integer payTransactionId;
  39 + @ApiModelProperty(value = "支付渠道")
  40 + private Integer payChannel;
  41 + @ApiModelProperty(value = "配送类型", required = true)
  42 + private Integer deliveryType;
  43 + @ApiModelProperty(value = "发货时间")
  44 + private Date deliveryTime;
  45 + @ApiModelProperty(value = "收货时间")
  46 + private Date receiveTime;
  47 + @ApiModelProperty(value = "收件人名称", required = true)
  48 + private String receiverName;
  49 + @ApiModelProperty(value = "手机号", required = true)
  50 + private String receiverMobile;
  51 + @ApiModelProperty(value = "地区编码", required = true)
  52 + private Integer receiverAreaCode;
  53 + @ApiModelProperty(value = "收件详细地址", required = true)
  54 + private String receiverDetailAddress;
  55 + @ApiModelProperty(value = "售后状态", required = true)
  56 + private Integer afterSaleStatus;
  57 + @ApiModelProperty(value = "优惠劵编号")
  58 + private Integer couponCardId;
  59 + @ApiModelProperty(value = "创建时间", required = true)
  60 + private Date createTime;
  61 +
  62 + /**
  63 + * 订单项数组
  64 + *
  65 + * // TODO 芋艿,后续考虑怎么优化下,目前是内嵌了别的 dto
  66 + */
  67 + private List<TradeOrderItemRespVO> orderItems;
  68 +
  69 +
  70 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/refund/TradeRefundController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.trade.controller.app.refund;
  2 +
  3 +public class TradeRefundController {
  4 +}
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/package-info.java 0 → 100644
  1 +/**
  2 + * 提供 RESTful API 给前端:
  3 + * 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目
  4 + * 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
  5 + */
  6 +package cn.iocoder.yudao.module.trade.controller;
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/cart/CartItemDO.java
@@ -36,12 +36,6 @@ public class CartItemDO extends BaseDO { @@ -36,12 +36,6 @@ public class CartItemDO extends BaseDO {
36 36
37 // ========= 买家信息 BEGIN ========= 37 // ========= 买家信息 BEGIN =========
38 38
39 -// /**  
40 -// * 店铺编号  
41 -// *  
42 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
43 -// */  
44 -// private Long shopId;  
45 /** 39 /**
46 * 用户编号 40 * 用户编号
47 * 41 *
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java
@@ -3,10 +3,10 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order; @@ -3,10 +3,10 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order;
3 import cn.iocoder.yudao.framework.common.enums.TerminalEnum; 3 import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
5 import cn.iocoder.yudao.module.product.enums.delivery.DeliveryTypeEnum; 5 import cn.iocoder.yudao.module.product.enums.delivery.DeliveryTypeEnum;
6 -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCloseTypeEnum; 6 +import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCancelTypeEnum;
  7 +import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;
7 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; 8 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
8 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; 9 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
9 -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;  
10 import com.baomidou.mybatisplus.annotation.KeySequence; 10 import com.baomidou.mybatisplus.annotation.KeySequence;
11 import com.baomidou.mybatisplus.annotation.TableName; 11 import com.baomidou.mybatisplus.annotation.TableName;
12 import lombok.*; 12 import lombok.*;
@@ -32,32 +32,25 @@ public class TradeOrderDO extends BaseDO { @@ -32,32 +32,25 @@ public class TradeOrderDO extends BaseDO {
32 /** 32 /**
33 * 订单编号,主键自增 33 * 订单编号,主键自增
34 */ 34 */
35 - private Integer id; 35 + private Long id;
36 /** 36 /**
37 * 订单流水号 37 * 订单流水号
38 * 38 *
39 * 例如说,1146347329394184195 39 * 例如说,1146347329394184195
40 */ 40 */
41 private String sn; 41 private String sn;
42 - // TODO 芋艿:order_type 订单类型  
43 /** 42 /**
44 * 订单类型 43 * 订单类型
45 * 44 *
46 * 枚举 {@link TradeOrderTypeEnum} 45 * 枚举 {@link TradeOrderTypeEnum}
47 */ 46 */
48 - private Integer type; 47 + private Integer type; // TODO order_promotion_type
49 /** 48 /**
50 * 订单来源终端 49 * 订单来源终端
51 * 50 *
52 * 枚举 {@link TerminalEnum} 51 * 枚举 {@link TerminalEnum}
53 */ 52 */
54 private Integer terminal; 53 private Integer terminal;
55 -// /**  
56 -// * 店铺编号  
57 -// *  
58 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
59 -// */  
60 -// private Long shopId;  
61 /** 54 /**
62 * 用户编号 55 * 用户编号
63 * 56 *
@@ -65,34 +58,42 @@ public class TradeOrderDO extends BaseDO { @@ -65,34 +58,42 @@ public class TradeOrderDO extends BaseDO {
65 */ 58 */
66 private Long userId; 59 private Long userId;
67 /** 60 /**
  61 + * 用户 IP
  62 + */
  63 + private String userIp;
  64 + /**
  65 + * 用户备注
  66 + */
  67 + private String userRemark;
  68 + /**
68 * 订单状态 69 * 订单状态
69 * 70 *
70 * 枚举 {@link TradeOrderStatusEnum} 71 * 枚举 {@link TradeOrderStatusEnum}
71 */ 72 */
72 private Integer status; 73 private Integer status;
73 - /**  
74 - * 关闭类型  
75 - *  
76 - * 枚举 {@link TradeOrderCloseTypeEnum}  
77 - */  
78 - private Integer closeType;  
79 // TODO 芋艿:要不要存储 prod_name 购买的商品名门? 74 // TODO 芋艿:要不要存储 prod_name 购买的商品名门?
80 /** 75 /**
81 * 购买的商品数量 76 * 购买的商品数量
82 */ 77 */
83 private Integer productCount; // total_num 78 private Integer productCount; // total_num
84 /** 79 /**
85 - * 备注 80 + * 订单完成时间
86 */ 81 */
87 - private String remark;  
88 - /**  
89 - * 确认收获时间  
90 - */  
91 - private Date confirmTakeTime; 82 + private Date finishTime;
92 /** 83 /**
93 * 订单取消时间 84 * 订单取消时间
94 */ 85 */
95 private Date cancelTime; 86 private Date cancelTime;
  87 + /**
  88 + * 取消类型
  89 + *
  90 + * 枚举 {@link TradeOrderCancelTypeEnum}
  91 + */
  92 + private Integer cancelType;
  93 + /**
  94 + * 商家备注
  95 + */
  96 + private String remark;
96 97
97 // ========== 价格 + 支付基本信息 ========== 98 // ========== 价格 + 支付基本信息 ==========
98 /** 99 /**
@@ -101,38 +102,55 @@ public class TradeOrderDO extends BaseDO { @@ -101,38 +102,55 @@ public class TradeOrderDO extends BaseDO {
101 * true - 已经支付过 102 * true - 已经支付过
102 * false - 没有支付过 103 * false - 没有支付过
103 */ 104 */
104 - private Boolean payed; // TODO payStatus 0 - 待付款;1 - 已付款;2 - 已退款 105 + private Boolean payed;
105 /** 106 /**
106 * 付款时间 107 * 付款时间
107 */ 108 */
108 private Date payTime; 109 private Date payTime;
109 110
110 - // TODO 芋艿:delete_status 用户订单删除状态;0 - 未删除;1 - 回收站;2 - 永久删除  
111 -  
112 // ========== 价格 + 支付基本信息 ========== 111 // ========== 价格 + 支付基本信息 ==========
  112 + // 价格文档 - 淘宝:https://open.taobao.com/docV3.htm?docId=108471&docType=1
  113 + // 价格文档 - 京东到家:https://openo2o.jddj.com/api/getApiDetail/182/4d1494c5e7ac4679bfdaaed950c5bc7f.htm
  114 + // 价格文档 - 有赞:https://doc.youzanyun.com/detail/API/0/906
  115 +
  116 +// TODO promotion_details(订单优惠信息明细,商品和订单级优惠一般都在里面)
  117 +
113 /** 118 /**
114 - * 购买(商品)总金额,单位:分 119 + * 商品原价(总),单位:分
  120 + *
  121 + * 基于 {@link TradeOrderItemDO#getTotalOriginalPrice()} 求和
115 */ 122 */
116 - private Integer buyPrice; // total 123 + // niu - goods_money;
  124 + private Integer skuOriginalPrice;
117 /** 125 /**
118 - * 优惠总金额,单位:分。 126 + * 商品优惠(总),单位:分
  127 + *
  128 + * 基于 {@link TradeOrderItemDO#getTotalPromotionPrice()} 求和
119 */ 129 */
120 - private Integer discountPrice; // reduce_amount 130 + private Integer skuPromotionPrice;
121 /** 131 /**
122 - * 物流金额 (分) 132 + * 订单优惠(总),单位:分
  133 + *
  134 + * 例如说:满减折扣;不包括优惠劵、商品优惠
123 */ 135 */
124 - private Integer logisticsPrice; // freight_amount; freight_price 136 + // niu - promotion_money;taobao - discount_fee(主订单优惠)
  137 + private Integer orderPromotionPrice;
125 /** 138 /**
126 - * 最终金额,单位:分  
127 - *  
128 - * buyPrice + logisticsPrice - discountPrice = presentPrice 139 + * 运费金额,单位:分
129 */ 140 */
130 - private Integer presentPrice; // actual_total 141 + // niu - delivery_money;taobao - post_fee(订单邮费)
  142 + private Integer deliveryPrice;
  143 + // TODO 芋艿:taobao 的:trade.adjust_fee/order.adjust_fee(调整金额,如:卖家手动修改订单价格,官方数据修复等等)
131 /** 144 /**
132 - * 实际已支付金额,单位:分 145 + * 应付金额(总),单位:分
133 * 146 *
134 - * 初始时,金额为 0 。等到支付成功后,会进行更新。 147 + * = {@link #skuOriginalPrice}
  148 + * + {@link #deliveryPrice}
  149 + * - {@link #skuPromotionPrice}
  150 + * - {@link #orderPromotionPrice}
135 */ 151 */
  152 + // niu - pay_money;taobao - payment(主订单实付金额) | trade.total_fee(主订单应付金额,参考使用);
  153 +// * - {@link #couponPrice} // TODO 芋艿:靠营销表记录
136 private Integer payPrice; 154 private Integer payPrice;
137 /** 155 /**
138 * 支付订单编号 156 * 支付订单编号
@@ -142,17 +160,28 @@ public class TradeOrderDO extends BaseDO { @@ -142,17 +160,28 @@ public class TradeOrderDO extends BaseDO {
142 private Long payOrderId; 160 private Long payOrderId;
143 /** 161 /**
144 * 支付成功的支付渠道 162 * 支付成功的支付渠道
  163 + *
  164 + * 对应 PayChannelEnum 枚举
145 */ 165 */
146 - private Integer payType; 166 + private Integer payChannel;
147 167
148 // ========== 收件 + 物流基本信息 ========== 168 // ========== 收件 + 物流基本信息 ==========
149 /** 169 /**
150 * 配送方式 170 * 配送方式
  171 + * 会员用户下单时,选择的配送方式
151 * 172 *
152 * 枚举 {@link DeliveryTypeEnum} 173 * 枚举 {@link DeliveryTypeEnum}
153 */ 174 */
154 private Integer deliveryType; 175 private Integer deliveryType;
155 /** 176 /**
  177 + * 实际的配送方式
  178 + * 管理后台发货时,选择的配送方式
  179 + *
  180 + * 0 - 无需物流
  181 + * 枚举 {@link DeliveryTypeEnum}
  182 + */
  183 + private Integer actualDeliveryType; // like - shipping_status;
  184 + /**
156 * 配置模板的编号 185 * 配置模板的编号
157 * 186 *
158 * 关联 DeliveryTemplateDO 的 id 编号 187 * 关联 DeliveryTemplateDO 的 id 编号
@@ -163,6 +192,13 @@ public class TradeOrderDO extends BaseDO { @@ -163,6 +192,13 @@ public class TradeOrderDO extends BaseDO {
163 */ 192 */
164 private String expressNo; // dvy_flow_id 193 private String expressNo; // dvy_flow_id
165 /** 194 /**
  195 + * 发货状态
  196 + *
  197 + * true - 已发货
  198 + * false - 未发货
  199 + */
  200 + private Boolean deliveryStatus;
  201 + /**
166 * 发货时间 202 * 发货时间
167 */ 203 */
168 private Date deliveryTime; 204 private Date deliveryTime;
@@ -210,26 +246,30 @@ public class TradeOrderDO extends BaseDO { @@ -210,26 +246,30 @@ public class TradeOrderDO extends BaseDO {
210 /** 246 /**
211 * 优惠劵编号 247 * 优惠劵编号
212 */ 248 */
213 - private Integer couponId;  
214 -  
215 - // TODO 芋艿,这块还要结合营销和价格计算,在去优化下。 249 + private Long couponId;
  250 +// /**
  251 +// * 优惠劵减免金额,单位:分 // TODO 芋艿:靠营销表记录
  252 +// */
  253 +// // niu - coupon_money;
  254 +// private Integer couponPrice;
  255 +// /**
  256 +// * 积分抵扣的金额,单位:分
  257 +// */
  258 +// private Integer integralPrice;
  259 +// /**
  260 +// * 使用的积分
  261 +// */
  262 +// private Integer useIntegral;
216 263
217 // TODO ========== 待定字段:yv ========= 264 // TODO ========== 待定字段:yv =========
218 // TODO cart_id:购物车 id 265 // TODO cart_id:购物车 id
219 - // TODO total_postage:邮费  
220 - // TODO pay_postage:支付邮费  
221 - // TODO coupon_price:优惠劵金额;  
222 - // TODO refund_status:0 未退款;1 申请中;2 已退款  
223 // TODO refund_reason_wap_img:退款图片 266 // TODO refund_reason_wap_img:退款图片
224 // TODO refund_reason_wap_explain:退款用户说明 267 // TODO refund_reason_wap_explain:退款用户说明
225 // TODO refund_reason_time:退款时间 268 // TODO refund_reason_time:退款时间
226 // TODO refund_reason_wap:前台退款原因 269 // TODO refund_reason_wap:前台退款原因
227 // TODO refund_reason:不退款的理由 270 // TODO refund_reason:不退款的理由
228 - // TODO refund_price:退款金额  
229 271
230 // TODO gain_integral:消费赚取积分 272 // TODO gain_integral:消费赚取积分
231 - // TODO use_integral:使用积分  
232 - // TODO pay_integral:实际支付积分  
233 // TODO back_integral:给用户退了多少积分 273 // TODO back_integral:给用户退了多少积分
234 274
235 // TODO combination_id:拼团产品id 275 // TODO combination_id:拼团产品id
@@ -247,17 +287,18 @@ public class TradeOrderDO extends BaseDO { @@ -247,17 +287,18 @@ public class TradeOrderDO extends BaseDO {
247 // TODO out_trade_no:商户系统内部的订单号 String 287 // TODO out_trade_no:商户系统内部的订单号 String
248 288
249 // TODO ========== 待定字段:lf ========= 289 // TODO ========== 待定字段:lf =========
250 - // TODO integral_amount:积分抵扣金额  
251 - // TODO shipping_status:发货状态  
252 - // TODO shipping_time:最后新发货时间  
253 -  
254 - // TODO ========== 待定字段:lf =========  
255 // TODO settle_id:未结算 290 // TODO settle_id:未结算
256 // TODO settle_amount:结算金额 291 // TODO settle_amount:结算金额
257 - // TODO use_integral:使用的积分  
258 // TODO team_found_id: 拼团id 292 // TODO team_found_id: 拼团id
259 // TODO team_id: 拼团活动id 293 // TODO team_id: 拼团活动id
260 // TODO delivery_id: 发货单ID 294 // TODO delivery_id: 发货单ID
261 // TODO attach_values: 附带的值(赠送时机,赠送积分成长值什么的)Json格式 295 // TODO attach_values: 附带的值(赠送时机,赠送积分成长值什么的)Json格式
262 296
  297 + // TODO ========== 待定字段:nf =========
  298 + // TODO delivery_code:整体提货编码
  299 +
  300 + // TODO ========== 待定字段:niu =========
  301 + // TODO adjust_money '订单调整金额'
  302 + // TODO balance_money ''余额支付金额''
  303 +
263 } 304 }
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java
@@ -26,13 +26,7 @@ public class TradeOrderItemDO extends BaseDO { @@ -26,13 +26,7 @@ public class TradeOrderItemDO extends BaseDO {
26 /** 26 /**
27 * 编号 27 * 编号
28 */ 28 */
29 - private Integer id;  
30 -// /**  
31 -// * 店铺编号  
32 -// *  
33 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
34 -// */  
35 -// private Long shopId; 29 + private Long id;
36 /** 30 /**
37 * 用户编号 31 * 用户编号
38 * 32 *
@@ -50,7 +44,7 @@ public class TradeOrderItemDO extends BaseDO { @@ -50,7 +44,7 @@ public class TradeOrderItemDO extends BaseDO {
50 /** 44 /**
51 * 商品 SPU 编号 45 * 商品 SPU 编号
52 * 46 *
53 - * 关联 ProductSpuDO 的 id 编号 47 + * 关联 ProductSkuDO 的 spuId 编号
54 */ 48 */
55 private Long spuId; 49 private Long spuId;
56 /** 50 /**
@@ -58,7 +52,7 @@ public class TradeOrderItemDO extends BaseDO { @@ -58,7 +52,7 @@ public class TradeOrderItemDO extends BaseDO {
58 * 52 *
59 * 关联 ProductSkuDO 的 id 编号 53 * 关联 ProductSkuDO 的 id 编号
60 */ 54 */
61 - private Integer skuId; 55 + private Long skuId;
62 /** 56 /**
63 * 规格值数组,JSON 格式 57 * 规格值数组,JSON 格式
64 */ 58 */
@@ -75,7 +69,7 @@ public class TradeOrderItemDO extends BaseDO { @@ -75,7 +69,7 @@ public class TradeOrderItemDO extends BaseDO {
75 /** 69 /**
76 * 购买数量 70 * 购买数量
77 */ 71 */
78 - private Integer stock; 72 + private Integer count;
79 /** 73 /**
80 * 是否评论 74 * 是否评论
81 * 75 *
@@ -86,36 +80,56 @@ public class TradeOrderItemDO extends BaseDO { @@ -86,36 +80,56 @@ public class TradeOrderItemDO extends BaseDO {
86 80
87 // ========== 价格 + 支付基本信息 ========== 81 // ========== 价格 + 支付基本信息 ==========
88 /** 82 /**
89 - * 原始单价,单位:分。 83 + * 商品原价(单),单位:分
  84 + *
  85 + * 对应 ProductSkuDO 的 price 字段
90 */ 86 */
91 - private Integer originPrice; // price 87 + // like - original_price;niu - costPrice
  88 + private Integer originalPrice;
92 /** 89 /**
93 - * 购买单价,单位:分 90 + * 商品原价(总),单位:分
  91 + *
  92 + * = {@link #originalPrice} * {@link #count}
94 */ 93 */
95 - private Integer buyPrice; 94 + // like - total_price;niu - 暂无
  95 + private Integer totalOriginalPrice;
96 /** 96 /**
97 - * 最终单价,单位:分。 97 + * 商品级优惠(总),单位:分
  98 + *
  99 + * 例如说“限时折扣”:商品原价的 8 折;商品原价的减 50 元
98 */ 100 */
99 - private Integer presentPrice; 101 + // taobao - order.discount_fee(子订单商品优惠)
  102 + private Integer totalPromotionPrice;
100 /** 103 /**
101 - * 购买总金额,单位:分 104 + * 最终购买金额(单),单位:分。
102 * 105 *
103 - * 用途类似 {@link #presentTotal} 106 + * = {@link #totalPresentPrice} / {@link #count}
104 */ 107 */
105 - private Integer buyTotal; 108 + private Integer presentPrice;
106 /** 109 /**
107 - * 优惠总金额,单位:分。 110 + * 最终购买金额(总),单位:分。
  111 + *
  112 + * = {@link #totalOriginalPrice}
  113 + * - {@link #totalPromotionPrice}
108 */ 114 */
109 - private Integer discountTotal; 115 + // like - total_pay_price;niu - goods_money; taobao - order.payment(子订单实付金额,不算主订单分摊金额) | order.total_fee(子订单应付金额,参考使用)
  116 + private Integer totalPresentPrice;
  117 + // TODO 芋艿:part_mjz_discount(子订单分摊金额);本质上,totalOriginalPrice - totalPayPrice
110 /** 118 /**
111 - * 最终总金额,单位:分。  
112 - *  
113 - * 注意,presentPrice * stock 不一定等于 presentTotal 。  
114 - * 因为,存在无法整除的情况。  
115 - * 举个例子,presentPrice = 8.33 ,stock = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。  
116 - * 所以,需要存储一个该字段。 119 + * 应付金额(总),单位:分
117 */ 120 */
118 - private Integer presentTotal; // product_total_amount 121 + // taobao - divide_order_fee (分摊后子订单实付金额);
  122 + private Integer totalPayPrice;
  123 +
  124 + // ========== 营销基本信息 ==========
  125 +// /**
  126 +// * 积分抵扣的金额,单位:分
  127 +// */
  128 +// private Integer integralTotal; // like - integral_price;niu - point_money
  129 +// /**
  130 +// * 使用的积分
  131 +// */
  132 +// private Integer useIntegral; // niu - use_point
119 133
120 // ========== 退款基本信息 ========== 134 // ========== 退款基本信息 ==========
121 /** 135 /**
@@ -123,7 +137,7 @@ public class TradeOrderItemDO extends BaseDO { @@ -123,7 +137,7 @@ public class TradeOrderItemDO extends BaseDO {
123 * 137 *
124 * 枚举 {@link TradeOrderItemRefundStatusEnum} 138 * 枚举 {@link TradeOrderItemRefundStatusEnum}
125 */ 139 */
126 - private Integer refundStatus; 140 + private Integer refundStatus; // TODO 芋艿:可以考虑去查
127 // 如上字段,举个例子: 141 // 如上字段,举个例子:
128 // 假设购买三个,即 stock = 3 。 142 // 假设购买三个,即 stock = 3 。
129 // originPrice = 15 143 // originPrice = 15
@@ -178,4 +192,23 @@ public class TradeOrderItemDO extends BaseDO { @@ -178,4 +192,23 @@ public class TradeOrderItemDO extends BaseDO {
178 // TODO goods_info 商品信息 192 // TODO goods_info 商品信息
179 193
180 // TODO integral_price:积分抵扣的金额 194 // TODO integral_price:积分抵扣的金额
  195 +
  196 + // TODO 待确定:niu
  197 + // TODO is_virtual '是否是虚拟商品'
  198 + // TODO goods_class '商品种类(1.实物 2.虚拟3.卡券)'
  199 + // TODO adjust_money ''调整金额''
  200 +
  201 + // TODO is_fenxiao 是否分销,
  202 + // TODO adjust_money 是否分销,
  203 +
  204 + // TODO delivery_status '配送状态'
  205 + // TODO delivery_no ''配送单号''
  206 + // TODO gift_flag '赠品标识'
  207 + // TODO gift_flag '赠品标识'
  208 +
  209 + // TODO refund_status '退款状态'
  210 + // TODO refund_type '退款状态'
  211 + // TODO 一堆退款字段
  212 +
181 } 213 }
  214 +
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/refund/TradeRefundDO.java
@@ -42,12 +42,6 @@ public class TradeRefundDO extends BaseDO { @@ -42,12 +42,6 @@ public class TradeRefundDO extends BaseDO {
42 * 枚举 {@link TradeOrderRefundStatusEnum} 42 * 枚举 {@link TradeOrderRefundStatusEnum}
43 */ 43 */
44 private Integer status; 44 private Integer status;
45 -// /**  
46 -// * 店铺编号  
47 -// *  
48 -// * 关联 {@link ShopDO#getId()} TODO 芋艿:多店铺,暂不考虑  
49 -// */  
50 -// private Long shopId;  
51 /** 45 /**
52 * 用户编号 46 * 用户编号
53 * 47 *
yudao-server/pom.xml
@@ -51,6 +51,11 @@ @@ -51,6 +51,11 @@
51 <artifactId>yudao-module-product-biz</artifactId> 51 <artifactId>yudao-module-product-biz</artifactId>
52 <version>${revision}</version> 52 <version>${revision}</version>
53 </dependency> 53 </dependency>
  54 + <dependency>
  55 + <groupId>cn.iocoder.boot</groupId>
  56 + <artifactId>yudao-module-trade-biz</artifactId>
  57 + <version>${revision}</version>
  58 + </dependency>
54 <!-- 数据报表 --> 59 <!-- 数据报表 -->
55 <!-- <dependency>--> 60 <!-- <dependency>-->
56 <!-- <groupId>cn.iocoder.boot</groupId>--> 61 <!-- <groupId>cn.iocoder.boot</groupId>-->
yudao-ui-admin/.eslintignore
@@ -7,4 +7,4 @@ public @@ -7,4 +7,4 @@ public
7 # 忽略当前目录下为js的文件的语法检查 7 # 忽略当前目录下为js的文件的语法检查
8 *.js 8 *.js
9 # 忽略当前目录下为vue的文件的语法检查 9 # 忽略当前目录下为vue的文件的语法检查
10 -*.vue  
11 \ No newline at end of file 10 \ No newline at end of file
  11 +*.vue
yudao-ui-admin/src/api/mall/CouponTemplete/CouponTemplete.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 创建优惠券模板
  4 +export function create(data) {
  5 + return request({
  6 + url: '/coupon/CouponTemplete/create',
  7 + method: 'post',
  8 + data: data
  9 + })
  10 +}
  11 +
  12 +// 更新优惠券模板
  13 +export function update(data) {
  14 + return request({
  15 + url: '/coupon/CouponTemplete/update',
  16 + method: 'put',
  17 + data: data
  18 + })
  19 +}
  20 +
  21 +// 删除优惠券模板
  22 +export function deleteCouponTemplete (id) {
  23 + return request({
  24 + url: '/coupon/CouponTemplete/delete?id=' + id,
  25 + method: 'delete'
  26 + })
  27 +}
  28 +
  29 +// 获得优惠券模板
  30 +export function get(id) {
  31 + return request({
  32 + url: '/coupon/CouponTemplete/get?id=' + id,
  33 + method: 'get'
  34 + })
  35 +}
  36 +
  37 +// 获得优惠券模板分页
  38 +export function getPage(query) {
  39 + return request({
  40 + url: '/coupon/CouponTemplete/page',
  41 + method: 'get',
  42 + params: query
  43 + })
  44 +}
  45 +
  46 +// 导出优惠券模板 Excel
  47 +export function exportExcel(query) {
  48 + return request({
  49 + url: '/coupon/CouponTemplete/export-excel',
  50 + method: 'get',
  51 + params: query,
  52 + responseType: 'blob'
  53 + })
  54 +}
yudao-ui-admin/src/views/mall/CouponTemplete/index.vue 0 → 100644
  1 +<template>
  2 + <div class="app-container">
  3 +
  4 + <!-- 搜索工作栏 -->
  5 + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  6 + <el-form-item label="优惠券类" prop="type">
  7 + <el-select v-model="queryParams.type" placeholder="请选择优惠券类型 reward-满减 discount-折扣 random-随机" clearable size="small">
  8 + <el-option label="请选择字典生成" value="" />
  9 + </el-select>
  10 + </el-form-item>
  11 + <el-form-item label="优惠券名称" prop="name">
  12 + <el-input v-model="queryParams.name" placeholder="请输入优惠券名称" clearable @keyup.enter.native="handleQuery"/>
  13 + </el-form-item>
  14 +
  15 + <el-form-item label="状态" prop="status">
  16 + <el-select v-model="queryParams.status" placeholder="请选择状态(1进行中2已结束-1已关闭)" clearable size="small">
  17 + <el-option label="请选择字典生成" value="" />
  18 + </el-select>
  19 + </el-form-item>
  20 + <el-form-item label="有效日期结束时间" prop="endTime">
  21 + <el-date-picker v-model="queryParams.endTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
  22 + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
  23 + </el-form-item>
  24 +
  25 + <el-form-item>
  26 + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  27 + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  28 + </el-form-item>
  29 + </el-form>
  30 +
  31 + <!-- 操作工具栏 -->
  32 + <el-row :gutter="10" class="mb8">
  33 + <el-col :span="1.5">
  34 + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  35 + v-hasPermi="['CouponTemplete::create']">新增</el-button>
  36 + </el-col>
  37 + <el-col :span="1.5">
  38 + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
  39 + v-hasPermi="['CouponTemplete::export']">导出</el-button>
  40 + </el-col>
  41 + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  42 + </el-row>
  43 +
  44 + <!-- 列表 -->
  45 + <el-table v-loading="loading" :data="list">
  46 + <el-table-column label="用户ID" align="center" prop="id" />
  47 +
  48 + <!-- todo 优惠券类型-->
  49 + <el-table-column label="优惠券类型" align="center" prop="type" />
  50 + <el-table-column label="优惠券名称" align="center" prop="name" />
  51 + <el-table-column label="优惠券图片" align="center" prop="image" />
  52 + <el-table-column label="发放数量" align="center" prop="count" />
  53 + <el-table-column label="已领取数量" align="center" prop="leadCount" />
  54 + <el-table-column label="已使用数量" align="center" prop="usedCount" />
  55 +<!-- todo 适用商品类型-->
  56 +<!-- <el-table-column label="适用商品类型" align="center" prop="goodsType" />-->
  57 + <!-- todo 使用门槛0-无门槛 1-有门槛-->
  58 +
  59 + <el-table-column label="使用门槛" align="center" prop="hasUseLimit" />
  60 +<!-- <el-table-column label="满多少元使用 0代表无限制" align="center" prop="atLeast" />-->
  61 + <!-- todo 发放面额 折扣-->
  62 + <el-table-column label="优惠金额/折扣" align="center" prop="money" />
  63 +<!-- <el-table-column label="1 =< 折扣 <= 9.9 当type为discount时需要添加" align="center" prop="discount" />-->
  64 +<!-- <el-table-column label="最多折扣金额 当type为discount时可选择性添加" align="center" prop="discountLimit" />-->
  65 +<!-- <el-table-column label="最低金额 当type为radom时需要添加" align="center" prop="minMoney" />-->
  66 +<!-- <el-table-column label="最大金额 当type为radom时需要添加" align="center" prop="maxMoney" />-->
  67 + <!-- todo 1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期 -->
  68 + <el-table-column label="有效期限" align="center" prop="validityType" />
  69 +<!-- <el-table-column label="使用开始日期 过期类型1时必填" align="center" prop="startUseTime" width="180">-->
  70 +<!-- <template slot-scope="scope">-->
  71 +<!-- <span>{{ parseTime(scope.row.startUseTime) }}</span>-->
  72 +<!-- </template>-->
  73 +<!-- </el-table-column>-->
  74 +<!-- <el-table-column label="使用结束日期 过期类型1时必填" align="center" prop="endUseTime" width="180">-->
  75 +<!-- <template slot-scope="scope">-->
  76 +<!-- <span>{{ parseTime(scope.row.endUseTime) }}</span>-->
  77 +<!-- </template>-->
  78 +<!-- </el-table-column>-->
  79 +<!-- <el-table-column label="有效日期结束时间" align="center" prop="endTime" width="180">-->
  80 +<!-- <template slot-scope="scope">-->
  81 +<!-- <span>{{ parseTime(scope.row.endTime) }}</span>-->
  82 +<!-- </template>-->
  83 +<!-- </el-table-column>-->
  84 +<!-- <el-table-column label="当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效" align="center" prop="fixedTerm" />-->
  85 +<!-- <el-table-column label="是否无限制0-否 1是" align="center" prop="whetherLimitless" />-->
  86 + <el-table-column label="领取上限" align="center" prop="maxFetch" />
  87 + <!-- todo 0-不限制 1- 优惠券仅原价购买商品时可用-->
  88 + <el-table-column label="优惠叠加" align="center" prop="whetherForbidPreference" />
  89 + <el-table-column label="是否显示" align="center" prop="whetherShow" />
  90 + <el-table-column label="订单的优惠总金额" align="center" prop="discountOrderMoney" />
  91 + <el-table-column label="用券总成交额" align="center" prop="orderMoney" />
  92 + <el-table-column label="是否禁止发放" align="center" prop="whetherForbidden" />
  93 + <el-table-column label="使用优惠券购买的商品数量" align="center" prop="orderGoodsNum" />
  94 + <el-table-column label="状态" align="center" prop="status" />
  95 +
  96 + <el-table-column label="备注" align="center" prop="couponNameRemark" />
  97 +
  98 + <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  99 +
  100 + <template #scope>
  101 + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  102 + v-hasPermi="['CouponTemplete::update']">修改</el-button>
  103 + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  104 + v-hasPermi="['CouponTemplete::delete']">删除</el-button>
  105 + </template>
  106 + </el-table-column>
  107 + </el-table>
  108 + <!-- 分页组件 -->
  109 + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  110 + @pagination="getList"/>
  111 +
  112 + <!-- 对话框(添加 / 修改) -->
  113 + <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  114 + <el-form ref="form" :model="form" :rules="rules" label-width="150px">
  115 + <el-form-item label="优惠券类型" prop="type">
  116 + <el-select v-model="form.type" placeholder="请选择优惠券类型 reward-满减 discount-折扣 random-随机">
  117 + <el-option label="请选择字典生成" value="" />
  118 + </el-select>
  119 + </el-form-item>
  120 + <el-form-item label="优惠券名称" prop="name">
  121 + <el-input v-model="form.name" placeholder="请输入优惠券名称" />
  122 + </el-form-item>
  123 + <el-form-item label="名称备注" prop="couponNameRemark">
  124 + <el-input v-model="form.couponNameRemark" placeholder="请输入名称备注" />
  125 + </el-form-item>
  126 + <el-form-item label="发放数量" prop="count">
  127 + <el-input v-model="form.count" placeholder="请输入发放数量" />
  128 + </el-form-item>
  129 + <el-form-item label="适用商品类型" prop="goodsType">
  130 + <el-radio-group v-model="form.goodsType">
  131 + <el-radio label="1">请选择字典生成</el-radio>
  132 + </el-radio-group>
  133 + </el-form-item>
  134 + <!-- todo 请输入适用商品id-->
  135 + <el-form-item label="适用商品id" prop="productIds">
  136 + <el-input v-model="form.productIds" placeholder="请输入适用商品id" />
  137 + </el-form-item>
  138 + <el-form-item label="使用门槛" prop="hasUseLimit">
  139 + <el-radio-group v-model="form.hasUseLimit">
  140 + <el-radio label="1">请选择字典生成</el-radio>
  141 + </el-radio-group>
  142 + </el-form-item>
  143 + <el-form-item label="满多少元使用" prop="atLeast">
  144 + <el-input v-model="form.atLeast" placeholder="请输入满多少元使用 0代表无限制" />
  145 + </el-form-item>
  146 + <el-form-item label="发放面额" prop="money">
  147 + <el-input v-model="form.money" placeholder="请输入发放面额 当type为reward时需要添加" />
  148 + </el-form-item>
  149 + <el-form-item label="1 =< 折扣 <= 9.9" prop="discount">
  150 + <el-input v-model="form.discount" placeholder="请输入1 =< 折扣 <= 9.9 当type为discount时需要添加" />
  151 + </el-form-item>
  152 + <el-form-item label="最多折扣金额" prop="discountLimit">
  153 + <el-input v-model="form.discountLimit" placeholder="请输入最多折扣金额 当type为discount时可选择性添加" />
  154 + </el-form-item>
  155 + <el-form-item label="最低金额" prop="minMoney">
  156 + <el-input v-model="form.minMoney" placeholder="请输入最低金额 当type为radom时需要添加" />
  157 + </el-form-item>
  158 + <el-form-item label="最大金额" prop="maxMoney">
  159 + <el-input v-model="form.maxMoney" placeholder="请输入最大金额 当type为radom时需要添加" />
  160 + </el-form-item>
  161 + <el-form-item label="过期类型" prop="validityType">
  162 + <el-radio-group v-model="form.validityType">
  163 + <el-radio label="1">请选择字典生成</el-radio>
  164 + </el-radio-group>
  165 + </el-form-item>
  166 + <el-form-item label="使用开始日期 过期类型1时必填" prop="startUseTime">
  167 + <el-date-picker clearable v-model="form.startUseTime" type="date" value-format="timestamp" placeholder="选择使用开始日期 过期类型1时必填" />
  168 + </el-form-item>
  169 + <el-form-item label="使用结束日期 过期类型1时必填" prop="endUseTime">
  170 + <el-date-picker clearable v-model="form.endUseTime" type="date" value-format="timestamp" placeholder="选择使用结束日期 过期类型1时必填" />
  171 + </el-form-item>
  172 + <el-form-item label="当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效" prop="fixedTerm">
  173 + <el-input v-model="form.fixedTerm" placeholder="请输入当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效" />
  174 + </el-form-item>
  175 + <el-form-item label="是否无限制0-否 1是" prop="whetherLimitless">
  176 + <el-radio-group v-model="form.whetherLimitless">
  177 + <el-radio label="1">请选择字典生成</el-radio>
  178 + </el-radio-group>
  179 + </el-form-item>
  180 + <el-form-item label="每人最大领取个数" prop="maxFetch">
  181 + <el-input v-model="form.maxFetch" placeholder="请输入每人最大领取个数" />
  182 + </el-form-item>
  183 + <el-form-item label="是否开启过期提醒0-不开启 1-开启" prop="whetherExpireNotice">
  184 + <el-radio-group v-model="form.whetherExpireNotice">
  185 + <el-radio label="1">请选择字典生成</el-radio>
  186 + </el-radio-group>
  187 + </el-form-item>
  188 + <el-form-item label="过期前N天提醒" prop="expireNoticeFixedTerm">
  189 + <el-input v-model="form.expireNoticeFixedTerm" placeholder="请输入过期前N天提醒" />
  190 + </el-form-item>
  191 + <el-form-item label="优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用" prop="whetherForbidPreference">
  192 + <el-radio-group v-model="form.whetherForbidPreference">
  193 + <el-radio label="1">请选择字典生成</el-radio>
  194 + </el-radio-group>
  195 + </el-form-item>
  196 + <el-form-item label="是否显示" prop="whetherShow">
  197 + <el-input v-model="form.whetherShow" placeholder="请输入是否显示" />
  198 + </el-form-item>
  199 + <el-form-item label="订单的优惠总金额" prop="discountOrderMoney">
  200 + <el-input v-model="form.discountOrderMoney" placeholder="请输入订单的优惠总金额" />
  201 + </el-form-item>
  202 + <el-form-item label="用券总成交额" prop="orderMoney">
  203 + <el-input v-model="form.orderMoney" placeholder="请输入用券总成交额" />
  204 + </el-form-item>
  205 + <el-form-item label="是否禁止发放0-否 1-是" prop="whetherForbidden">
  206 + <el-radio-group v-model="form.whetherForbidden">
  207 + <el-radio label="1">请选择字典生成</el-radio>
  208 + </el-radio-group>
  209 + </el-form-item>
  210 + <el-form-item label="使用优惠券购买的商品数量" prop="orderGoodsNum">
  211 + <el-input v-model="form.orderGoodsNum" placeholder="请输入使用优惠券购买的商品数量" />
  212 + </el-form-item>
  213 + <el-form-item label="状态" prop="status">
  214 + <el-radio-group v-model="form.status">
  215 + <el-radio label="1">请选择字典生成</el-radio>
  216 + </el-radio-group>
  217 + </el-form-item>
  218 + <el-form-item label="有效日期结束时间" prop="endTime">
  219 + <el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择有效日期结束时间" />
  220 + </el-form-item>
  221 + </el-form>
  222 + <div slot="footer" class="dialog-footer">
  223 + <el-button type="primary" @click="submitForm">确 定</el-button>
  224 + <el-button @click="cancel">取 消</el-button>
  225 + </div>
  226 + </el-dialog>
  227 + </div>
  228 +</template>
  229 +
  230 +<script>
  231 +import { create, update, deleteCouponTemplete, get, getPage, exportExcel } from "@/api/mall/CouponTemplete/CouponTemplete.js";
  232 +
  233 +export default {
  234 + name: "",
  235 + components: {
  236 + },
  237 + data() {
  238 + return {
  239 + // 遮罩层
  240 + loading: true,
  241 + // 导出遮罩层
  242 + exportLoading: false,
  243 + // 显示搜索条件
  244 + showSearch: true,
  245 + // 总条数
  246 + total: 0,
  247 + // 优惠券模板列表
  248 + list: [],
  249 + // 弹出层标题
  250 + title: "",
  251 + // 是否显示弹出层
  252 + open: false,
  253 + // 查询参数
  254 + queryParams: {
  255 + pageNo: 1,
  256 + pageSize: 10,
  257 + type: null,
  258 + name: null,
  259 + couponNameRemark: null,
  260 + image: null,
  261 + count: null,
  262 + leadCount: null,
  263 + usedCount: null,
  264 + goodsType: null,
  265 + productIds: null,
  266 + hasUseLimit: null,
  267 + atLeast: null,
  268 + money: null,
  269 + discount: null,
  270 + discountLimit: null,
  271 + minMoney: null,
  272 + maxMoney: null,
  273 + validityType: null,
  274 + startUseTime: [],
  275 + endUseTime: [],
  276 + fixedTerm: null,
  277 + whetherLimitless: null,
  278 + maxFetch: null,
  279 + whetherExpireNotice: null,
  280 + expireNoticeFixedTerm: null,
  281 + whetherForbidPreference: null,
  282 + whetherShow: null,
  283 + discountOrderMoney: null,
  284 + orderMoney: null,
  285 + whetherForbidden: null,
  286 + orderGoodsNum: null,
  287 + status: null,
  288 + endTime: [],
  289 + createTime: [],
  290 + },
  291 + // 表单参数
  292 + form: {},
  293 + // 表单校验
  294 + rules: {
  295 + type: [{ required: true, message: "优惠券类型 reward-满减 discount-折扣 random-随机不能为空", trigger: "change" }],
  296 + name: [{ required: true, message: "优惠券名称不能为空", trigger: "blur" }],
  297 + count: [{ required: true, message: "发放数量不能为空", trigger: "blur" }],
  298 + leadCount: [{ required: true, message: "已领取数量不能为空", trigger: "blur" }],
  299 + usedCount: [{ required: true, message: "已使用数量不能为空", trigger: "blur" }],
  300 + goodsType: [{ required: true, message: "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用不能为空", trigger: "blur" }],
  301 + hasUseLimit: [{ required: true, message: "使用门槛0-无门槛 1-有门槛不能为空", trigger: "blur" }],
  302 + atLeast: [{ required: true, message: "满多少元使用 0代表无限制不能为空", trigger: "blur" }],
  303 + money: [{ required: true, message: "发放面额 当type为reward时需要添加不能为空", trigger: "blur" }],
  304 + discount: [{ required: true, message: "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空", trigger: "blur" }],
  305 + discountLimit: [{ required: true, message: "最多折扣金额 当type为discount时可选择性添加不能为空", trigger: "blur" }],
  306 + minMoney: [{ required: true, message: "最低金额 当type为radom时需要添加不能为空", trigger: "blur" }],
  307 + maxMoney: [{ required: true, message: "最大金额 当type为radom时需要添加不能为空", trigger: "blur" }],
  308 + validityType: [{ required: true, message: "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期不能为空", trigger: "blur" }],
  309 + fixedTerm: [{ required: true, message: "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效不能为空", trigger: "blur" }],
  310 + whetherLimitless: [{ required: true, message: "是否无限制0-否 1是不能为空", trigger: "blur" }],
  311 + maxFetch: [{ required: true, message: "每人最大领取个数不能为空", trigger: "blur" }],
  312 + whetherExpireNotice: [{ required: true, message: "是否开启过期提醒0-不开启 1-开启不能为空", trigger: "blur" }],
  313 + expireNoticeFixedTerm: [{ required: true, message: "过期前N天提醒不能为空", trigger: "blur" }],
  314 + whetherForbidPreference: [{ required: true, message: "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空", trigger: "blur" }],
  315 + whetherShow: [{ required: true, message: "是否显示不能为空", trigger: "blur" }],
  316 + discountOrderMoney: [{ required: true, message: "订单的优惠总金额不能为空", trigger: "blur" }],
  317 + orderMoney: [{ required: true, message: "用券总成交额不能为空", trigger: "blur" }],
  318 + whetherForbidden: [{ required: true, message: "是否禁止发放0-否 1-是不能为空", trigger: "blur" }],
  319 + orderGoodsNum: [{ required: true, message: "使用优惠券购买的商品数量不能为空", trigger: "blur" }],
  320 + status: [{ required: true, message: "状态(1进行中2已结束-1已关闭)不能为空", trigger: "blur" }],
  321 + }
  322 + };
  323 + },
  324 + created() {
  325 + this.getList();
  326 + },
  327 + methods: {
  328 + /** 查询列表 */
  329 + getList() {
  330 + this.loading = true;
  331 + // 执行查询
  332 + getPage(this.queryParams).then(response => {
  333 + this.list = response.data.list;
  334 + this.total = response.data.total;
  335 + this.loading = false;
  336 + });
  337 + },
  338 + /** 取消按钮 */
  339 + cancel() {
  340 + this.open = false;
  341 + this.reset();
  342 + },
  343 + /** 表单重置 */
  344 + reset() {
  345 + this.form = {
  346 + id: undefined,
  347 + type: undefined,
  348 + name: undefined,
  349 + couponNameRemark: undefined,
  350 + image: undefined,
  351 + count: undefined,
  352 + leadCount: undefined,
  353 + usedCount: undefined,
  354 + goodsType: undefined,
  355 + productIds: undefined,
  356 + hasUseLimit: undefined,
  357 + atLeast: undefined,
  358 + money: undefined,
  359 + discount: undefined,
  360 + discountLimit: undefined,
  361 + minMoney: undefined,
  362 + maxMoney: undefined,
  363 + validityType: undefined,
  364 + startUseTime: undefined,
  365 + endUseTime: undefined,
  366 + fixedTerm: undefined,
  367 + whetherLimitless: undefined,
  368 + maxFetch: undefined,
  369 + whetherExpireNotice: undefined,
  370 + expireNoticeFixedTerm: undefined,
  371 + whetherForbidPreference: undefined,
  372 + whetherShow: undefined,
  373 + discountOrderMoney: undefined,
  374 + orderMoney: undefined,
  375 + whetherForbidden: undefined,
  376 + orderGoodsNum: undefined,
  377 + status: undefined,
  378 + endTime: undefined,
  379 + };
  380 + this.resetForm("form");
  381 + },
  382 + /** 搜索按钮操作 */
  383 + handleQuery() {
  384 + this.queryParams.pageNo = 1;
  385 + this.getList();
  386 + },
  387 + /** 重置按钮操作 */
  388 + resetQuery() {
  389 + this.resetForm("queryForm");
  390 + this.handleQuery();
  391 + },
  392 + /** 新增按钮操作 */
  393 + handleAdd() {
  394 + this.reset();
  395 + this.open = true;
  396 + this.title = "添加优惠券模板";
  397 + },
  398 + /** 修改按钮操作 */
  399 + handleUpdate(row) {
  400 + this.reset();
  401 + const id = row.id;
  402 + get(id).then(response => {
  403 + this.form = response.data;
  404 + this.open = true;
  405 + this.title = "修改优惠券模板";
  406 + });
  407 + },
  408 + /** 提交按钮 */
  409 + submitForm() {
  410 + this.$refs["form"].validate(valid => {
  411 + if (!valid) {
  412 + return;
  413 + }
  414 + // 修改的提交
  415 + if (this.form.id != null) {
  416 + update(this.form).then(response => {
  417 + this.$modal.msgSuccess("修改成功");
  418 + this.open = false;
  419 + this.getList();
  420 + });
  421 + return;
  422 + }
  423 + // 添加的提交
  424 + create(this.form).then(response => {
  425 + this.$modal.msgSuccess("新增成功");
  426 + this.open = false;
  427 + this.getList();
  428 + });
  429 + });
  430 + },
  431 + /** 删除按钮操作 */
  432 + handleDelete(row) {
  433 + const id = row.id;
  434 + this.$modal.confirm('是否确认删除优惠券模板编号为"' + id + '"的数据项?').then(function() {
  435 + return deleteCouponTemplete(id);
  436 + }).then(() => {
  437 + this.getList();
  438 + this.$modal.msgSuccess("删除成功");
  439 + }).catch(() => {});
  440 + },
  441 + /** 导出按钮操作 */
  442 + handleExport() {
  443 + // 处理查询参数
  444 + let params = {...this.queryParams};
  445 + params.pageNo = undefined;
  446 + params.pageSize = undefined;
  447 + this.$modal.confirm('是否确认导出所有优惠券模板数据项?').then(() => {
  448 + this.exportLoading = true;
  449 + return exportExcel(params);
  450 + }).then(response => {
  451 + this.$download.excel(response, '优惠券模板.xls');
  452 + this.exportLoading = false;
  453 + }).catch(() => {});
  454 + }
  455 + }
  456 +};
  457 +</script>