Commit 042c4e8390ebb56c0b6fba7d4303ee063bce6ffc

Authored by xingyu4j
2 parents 6171dead f6420e30

Merge remote-tracking branch 'origin/master' into feature/vue3

Showing 294 changed files with 12057 additions and 4899 deletions

Too many changes.

To preserve performance only 100 of 294 files are displayed.

sql/optional/mall/mall.sql
@@ -248,7 +248,7 @@ DROP TABLE IF EXISTS `product_spu`; @@ -248,7 +248,7 @@ DROP TABLE IF EXISTS `product_spu`;
248 CREATE TABLE `product_spu` ( 248 CREATE TABLE `product_spu` (
249 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', 249 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
250 `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', 250 `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
251 - `brand_id` int DEFAULT NULL COMMENT '商品品牌编号', 251 + `brand_id` bigint DEFAULT NULL COMMENT '商品品牌编号',
252 `category_id` bigint NOT NULL COMMENT '分类id', 252 `category_id` bigint NOT NULL COMMENT '分类id',
253 `spec_type` int NOT NULL COMMENT '规格类型:0 单规格 1 多规格', 253 `spec_type` int NOT NULL COMMENT '规格类型:0 单规格 1 多规格',
254 `code` varchar(128) DEFAULT NULL COMMENT '商品编码', 254 `code` varchar(128) DEFAULT NULL COMMENT '商品编码',
sql/optional/mall/order.sql
1 /**todo cancelType 设置默认值 0?*/ 1 /**todo cancelType 设置默认值 0?*/
  2 +DROP TABLE IF EXISTS `trade_order`;
2 CREATE TABLE `trade_order` 3 CREATE TABLE `trade_order`
3 ( 4 (
4 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', 5 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
@@ -10,9 +11,10 @@ CREATE TABLE `trade_order` @@ -10,9 +11,10 @@ CREATE TABLE `trade_order`
10 `user_remark` varchar(200) DEFAULT NULL COMMENT '用户备注', 11 `user_remark` varchar(200) DEFAULT NULL COMMENT '用户备注',
11 `status` int NOT NULL DEFAULT '0' COMMENT '订单状态:[0:待付款 1:待发货 2:待收货 3:已完成 4:已关闭]', 12 `status` int NOT NULL DEFAULT '0' COMMENT '订单状态:[0:待付款 1:待发货 2:待收货 3:已完成 4:已关闭]',
12 `product_count` int NOT NULL COMMENT '购买的商品数量', 13 `product_count` int NOT NULL COMMENT '购买的商品数量',
13 - `cancel_type` int NOT NULL COMMENT '取消类型:[10:超时未支付 20:退款关闭 30:买家取消 40:已通过货到付款交易]', 14 + `cancel_type` int DEFAULT NULL COMMENT '取消类型:[10:超时未支付 20:退款关闭 30:买家取消 40:已通过货到付款交易]',
14 `remark` varchar(200) DEFAULT NULL COMMENT '商家备注', 15 `remark` varchar(200) DEFAULT NULL COMMENT '商家备注',
15 `payed` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已支付:[0:未支付 1:已经支付过]', 16 `payed` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已支付:[0:未支付 1:已经支付过]',
  17 + `pay_time` datetime DEFAULT NULL COMMENT '订单支付时间',
16 `finish_time` datetime DEFAULT NULL COMMENT '订单完成时间', 18 `finish_time` datetime DEFAULT NULL COMMENT '订单完成时间',
17 `cancel_time` datetime DEFAULT NULL COMMENT '订单取消时间', 19 `cancel_time` datetime DEFAULT NULL COMMENT '订单取消时间',
18 `sku_original_price` int NOT NULL DEFAULT '0' COMMENT '商品原价(总),单位:分', 20 `sku_original_price` int NOT NULL DEFAULT '0' COMMENT '商品原价(总),单位:分',
@@ -20,11 +22,11 @@ CREATE TABLE `trade_order` @@ -20,11 +22,11 @@ CREATE TABLE `trade_order`
20 `order_promotion_price` int NOT NULL DEFAULT '0' COMMENT '订单优惠(总),单位:分', 22 `order_promotion_price` int NOT NULL DEFAULT '0' COMMENT '订单优惠(总),单位:分',
21 `delivery_price` int NOT NULL DEFAULT '0' COMMENT '运费金额,单位:分', 23 `delivery_price` int NOT NULL DEFAULT '0' COMMENT '运费金额,单位:分',
22 `pay_price` int NOT NULL DEFAULT '0' COMMENT '应付金额(总),单位:分', 24 `pay_price` int NOT NULL DEFAULT '0' COMMENT '应付金额(总),单位:分',
23 - `pay_order_id` int NOT NULL COMMENT '支付订单编号',  
24 - `pay_channel` int NOT NULL COMMENT '支付成功的支付渠道',  
25 - `delivery_type` int NOT NULL DEFAULT '1' COMMENT '配送方式:[1:快递发货 2:自提]',  
26 - `actual_delivery_type` int NOT NULL DEFAULT '1' COMMENT '实际的配送方式:[1:快递发货 2:自提]',  
27 - `delivery_templateid` int DEFAULT NULL COMMENT '配置模板的编号', 25 + `pay_order_id` int DEFAULT NULL COMMENT '支付订单编号',
  26 + `pay_channel` int DEFAULT NULL COMMENT '支付成功的支付渠道',
  27 + `delivery_type` int DEFAULT NULL DEFAULT '1' COMMENT '配送方式:[1:快递发货 2:自提]',
  28 + `actual_delivery_type` int DEFAULT NULL DEFAULT '1' COMMENT '实际的配送方式:[1:快递发货 2:自提]',
  29 + `delivery_template_id` int DEFAULT NULL COMMENT '配置模板的编号',
28 `express_no` int DEFAULT NULL COMMENT '物流公司单号', 30 `express_no` int DEFAULT NULL COMMENT '物流公司单号',
29 `delivery_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '发货状态[0:未发货 1:已发货]', 31 `delivery_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '发货状态[0:未发货 1:已发货]',
30 `delivery_time` datetime DEFAULT NULL COMMENT '发货时间', 32 `delivery_time` datetime DEFAULT NULL COMMENT '发货时间',
@@ -73,4 +75,4 @@ CREATE TABLE `trade_order_item` @@ -73,4 +75,4 @@ CREATE TABLE `trade_order_item`
73 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 75 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
74 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 76 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
75 PRIMARY KEY (`id`) USING BTREE 77 PRIMARY KEY (`id`) USING BTREE
76 -) ENGINE = InnoDB COMMENT ='交易订单明细表';  
77 \ No newline at end of file 78 \ No newline at end of file
  79 +) ENGINE = InnoDB COMMENT ='交易订单明细表';
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/DocumentEnum.java
@@ -12,7 +12,8 @@ import lombok.Getter; @@ -12,7 +12,8 @@ import lombok.Getter;
12 @AllArgsConstructor 12 @AllArgsConstructor
13 public enum DocumentEnum { 13 public enum DocumentEnum {
14 14
15 - REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档"); 15 + REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档"),
  16 + TENANT("https://doc.iocoder.cn", "SaaS 多租户文档");
16 17
17 private final String url; 18 private final String url;
18 private final String memo; 19 private final String memo;
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java
1 package cn.iocoder.yudao.framework.common.util.date; 1 package cn.iocoder.yudao.framework.common.util.date;
2 2
3 -import cn.hutool.core.date.DateUtil;  
4 import cn.hutool.core.date.LocalDateTimeUtil; 3 import cn.hutool.core.date.LocalDateTimeUtil;
5 4
6 -import java.time.Duration;  
7 -import java.time.Instant;  
8 -import java.time.LocalDateTime;  
9 -import java.time.ZoneId;  
10 -import java.time.ZonedDateTime; 5 +import java.time.*;
11 import java.util.Calendar; 6 import java.util.Calendar;
12 import java.util.Date; 7 import java.util.Date;
13 8
@@ -58,6 +53,7 @@ public class DateUtils { @@ -58,6 +53,7 @@ public class DateUtils {
58 return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); 53 return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
59 } 54 }
60 55
  56 + @Deprecated
61 public static Date addTime(Duration duration) { 57 public static Date addTime(Duration duration) {
62 return new Date(System.currentTimeMillis() + duration.toMillis()); 58 return new Date(System.currentTimeMillis() + duration.toMillis());
63 } 59 }
@@ -87,6 +83,7 @@ public class DateUtils { @@ -87,6 +83,7 @@ public class DateUtils {
87 return buildTime(year, mouth, day, 0, 0, 0); 83 return buildTime(year, mouth, day, 0, 0, 0);
88 } 84 }
89 85
  86 + @Deprecated
90 public static LocalDateTime buildLocalDateTime(int year, int mouth, int day) { 87 public static LocalDateTime buildLocalDateTime(int year, int mouth, int day) {
91 return LocalDateTime.of(year, mouth, day, 0, 0, 0); 88 return LocalDateTime.of(year, mouth, day, 0, 0, 0);
92 } 89 }
@@ -135,14 +132,7 @@ public class DateUtils { @@ -135,14 +132,7 @@ public class DateUtils {
135 return a.isAfter(b) ? a : b; 132 return a.isAfter(b) ? a : b;
136 } 133 }
137 134
138 - public static boolean beforeNow(Date date) {  
139 - return date.getTime() < System.currentTimeMillis();  
140 - }  
141 -  
142 - public static boolean afterNow(Date date) {  
143 - return date.getTime() >= System.currentTimeMillis();  
144 - }  
145 - 135 + @Deprecated
146 public static boolean afterNow(LocalDateTime localDateTime) { 136 public static boolean afterNow(LocalDateTime localDateTime) {
147 return localDateTime.isAfter(LocalDateTime.now()); 137 return localDateTime.isAfter(LocalDateTime.now());
148 } 138 }
@@ -184,19 +174,6 @@ public class DateUtils { @@ -184,19 +174,6 @@ public class DateUtils {
184 * @param date 日期 174 * @param date 日期
185 * @return 是否 175 * @return 是否
186 */ 176 */
187 - public static boolean isToday(Date date) {  
188 - if (date == null) {  
189 - return false;  
190 - }  
191 - return DateUtil.isSameDay(date, new Date());  
192 - }  
193 -  
194 - /**  
195 - * 是否今天  
196 - *  
197 - * @param date 日期  
198 - * @return 是否  
199 - */  
200 public static boolean isToday(LocalDateTime date) { 177 public static boolean isToday(LocalDateTime date) {
201 return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now()); 178 return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now());
202 } 179 }
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.common.util.date;
  2 +
  3 +import cn.hutool.core.date.LocalDateTimeUtil;
  4 +
  5 +import java.time.Duration;
  6 +import java.time.LocalDateTime;
  7 +
  8 +/**
  9 + * 时间工具类,用于 {@link java.time.LocalDateTime}
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +public class LocalDateTimeUtils {
  14 +
  15 + public static LocalDateTime addTime(Duration duration) {
  16 + return LocalDateTime.now().plus(duration);
  17 + }
  18 +
  19 + public static boolean beforeNow(LocalDateTime date) {
  20 + return date.isBefore(LocalDateTime.now());
  21 + }
  22 +
  23 + public static boolean afterNow(LocalDateTime date) {
  24 + return date.isAfter(LocalDateTime.now());
  25 + }
  26 +
  27 + /**
  28 + * 创建指定时间
  29 + *
  30 + * @param year 年
  31 + * @param mouth 月
  32 + * @param day 日
  33 + * @return 指定时间
  34 + */
  35 + public static LocalDateTime buildTime(int year, int mouth, int day) {
  36 + return LocalDateTime.of(year, mouth, day, 0, 0, 0);
  37 + }
  38 +
  39 + /**
  40 + * 判断当前时间是否在该时间范围内
  41 + *
  42 + * @param startTime 开始时间
  43 + * @param endTime 结束时间
  44 + * @return 是否
  45 + */
  46 + public static boolean isBetween(LocalDateTime startTime, LocalDateTime endTime) {
  47 + if (startTime == null || endTime == null) {
  48 + return false;
  49 + }
  50 + return LocalDateTimeUtil.isIn(LocalDateTime.now(), startTime, endTime);
  51 + }
  52 +
  53 +}
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/string/StrUtils.java
@@ -3,7 +3,10 @@ package cn.iocoder.yudao.framework.common.util.string; @@ -3,7 +3,10 @@ package cn.iocoder.yudao.framework.common.util.string;
3 import cn.hutool.core.util.ArrayUtil; 3 import cn.hutool.core.util.ArrayUtil;
4 import cn.hutool.core.util.StrUtil; 4 import cn.hutool.core.util.StrUtil;
5 5
  6 +import java.util.Arrays;
6 import java.util.Collection; 7 import java.util.Collection;
  8 +import java.util.List;
  9 +import java.util.stream.Collectors;
7 10
8 /** 11 /**
9 * 字符串工具类 12 * 字符串工具类
@@ -37,4 +40,9 @@ public class StrUtils { @@ -37,4 +40,9 @@ public class StrUtils {
37 return false; 40 return false;
38 } 41 }
39 42
  43 + public static List<Long> splitToLong(String value, CharSequence separator) {
  44 + long[] longs = StrUtil.splitToLong(value, separator);
  45 + return Arrays.stream(longs).boxed().collect(Collectors.toList());
  46 + }
  47 +
40 } 48 }
yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClientTest.java
@@ -124,7 +124,7 @@ public class YunpianSmsClientTest extends BaseMockitoUnitTest { @@ -124,7 +124,7 @@ public class YunpianSmsClientTest extends BaseMockitoUnitTest {
124 @SuppressWarnings("unchecked") 124 @SuppressWarnings("unchecked")
125 public void testDoGetSmsTemplate() throws Throwable { 125 public void testDoGetSmsTemplate() throws Throwable {
126 // 准备参数 126 // 准备参数
127 - String apiTemplateId = randomString(); 127 + String apiTemplateId = String.valueOf(randomLongId());
128 // mock tpl 方法 128 // mock tpl 方法
129 TplApi tplApi = mock(TplApi.class); 129 TplApi tplApi = mock(TplApi.class);
130 when(client.tpl()).thenReturn(tplApi); 130 when(client.tpl()).thenReturn(tplApi);
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java
@@ -119,6 +119,8 @@ public class YudaoTenantAutoConfiguration { @@ -119,6 +119,8 @@ public class YudaoTenantAutoConfiguration {
119 }; 119 };
120 } 120 }
121 121
  122 + // ========== Redis ==========
  123 +
122 @Bean 124 @Bean
123 @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean 125 @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean
124 public RedisCacheManager tenantRedisCacheManager(RedisTemplate<String, Object> redisTemplate, 126 public RedisCacheManager tenantRedisCacheManager(RedisTemplate<String, Object> redisTemplate,
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java
1 package cn.iocoder.yudao.framework.tenant.core.context; 1 package cn.iocoder.yudao.framework.tenant.core.context;
2 2
  3 +import cn.iocoder.yudao.framework.common.enums.DocumentEnum;
3 import com.alibaba.ttl.TransmittableThreadLocal; 4 import com.alibaba.ttl.TransmittableThreadLocal;
4 5
5 /** 6 /**
@@ -36,7 +37,8 @@ public class TenantContextHolder { @@ -36,7 +37,8 @@ public class TenantContextHolder {
36 public static Long getRequiredTenantId() { 37 public static Long getRequiredTenantId() {
37 Long tenantId = getTenantId(); 38 Long tenantId = getTenantId();
38 if (tenantId == null) { 39 if (tenantId == null) {
39 - throw new NullPointerException("TenantContextHolder 不存在租户编号"); // TODO 芋艿:增加文档链接 40 + throw new NullPointerException("TenantContextHolder 不存在租户编号!可参考文档:"
  41 + + DocumentEnum.TENANT.getUrl());
40 } 42 }
41 return tenantId; 43 return tenantId;
42 } 44 }
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/redis/TenantRedisCacheManager.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.framework.tenant.core.redis; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.framework.tenant.core.redis;
2 2
3 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; 3 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
4 import lombok.extern.slf4j.Slf4j; 4 import lombok.extern.slf4j.Slf4j;
5 -import org.jetbrains.annotations.NotNull;  
6 import org.springframework.cache.Cache; 5 import org.springframework.cache.Cache;
7 import org.springframework.data.redis.cache.RedisCacheConfiguration; 6 import org.springframework.data.redis.cache.RedisCacheConfiguration;
8 import org.springframework.data.redis.cache.RedisCacheManager; 7 import org.springframework.data.redis.cache.RedisCacheManager;
@@ -11,7 +10,7 @@ import org.springframework.data.redis.cache.RedisCacheWriter; @@ -11,7 +10,7 @@ import org.springframework.data.redis.cache.RedisCacheWriter;
11 /** 10 /**
12 * 多租户的 {@link RedisCacheManager} 实现类 11 * 多租户的 {@link RedisCacheManager} 实现类
13 * 12 *
14 - * 操作指定 name 的 {@link Cache} 时,自动拼接租户后缀,格式为 name + ":" + tenantId 13 + * 操作指定 name 的 {@link Cache} 时,自动拼接租户后缀,格式为 name + ":" + tenantId + 后缀
15 * 14 *
16 * @author airhead 15 * @author airhead
17 */ 16 */
@@ -24,7 +23,7 @@ public class TenantRedisCacheManager extends RedisCacheManager { @@ -24,7 +23,7 @@ public class TenantRedisCacheManager extends RedisCacheManager {
24 } 23 }
25 24
26 @Override 25 @Override
27 - public Cache getCache(@NotNull String name) { 26 + public Cache getCache(String name) {
28 // 如果开启多租户,则 name 拼接租户后缀 27 // 如果开启多租户,则 name 拼接租户后缀
29 if (!TenantContextHolder.isIgnore() 28 if (!TenantContextHolder.isIgnore()
30 && TenantContextHolder.getTenantId() != null) { 29 && TenantContextHolder.getTenantId() != null) {
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/security/TenantSecurityWebFilter.java
@@ -28,8 +28,6 @@ import java.util.Objects; @@ -28,8 +28,6 @@ import java.util.Objects;
28 * 2. 如果请求未带租户的编号,检查是否是忽略的 URL,否则也不允许访问。 28 * 2. 如果请求未带租户的编号,检查是否是忽略的 URL,否则也不允许访问。
29 * 3. 校验租户是合法,例如说被禁用、到期 29 * 3. 校验租户是合法,例如说被禁用、到期
30 * 30 *
31 - * 校验用户访问的租户,是否是其所在的租户,  
32 - *  
33 * @author 芋道源码 31 * @author 芋道源码
34 */ 32 */
35 @Slf4j 33 @Slf4j
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/type/LongListTypeHandler.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.mybatis.core.type;
  2 +
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.iocoder.yudao.framework.common.util.string.StrUtils;
  5 +import org.apache.ibatis.type.JdbcType;
  6 +import org.apache.ibatis.type.MappedJdbcTypes;
  7 +import org.apache.ibatis.type.MappedTypes;
  8 +import org.apache.ibatis.type.TypeHandler;
  9 +
  10 +import java.sql.CallableStatement;
  11 +import java.sql.PreparedStatement;
  12 +import java.sql.ResultSet;
  13 +import java.sql.SQLException;
  14 +import java.util.List;
  15 +
  16 +/**
  17 + * List<Long> 的类型转换器实现类,对应数据库的 varchar 类型
  18 + *
  19 + * @author 芋道源码
  20 + */
  21 +@MappedJdbcTypes(JdbcType.VARCHAR)
  22 +@MappedTypes(List.class)
  23 +public class LongListTypeHandler implements TypeHandler<List<Long>> {
  24 +
  25 + private static final String COMMA = ",";
  26 +
  27 + @Override
  28 + public void setParameter(PreparedStatement ps, int i, List<Long> strings, JdbcType jdbcType) throws SQLException {
  29 + // 设置占位符
  30 + ps.setString(i, CollUtil.join(strings, COMMA));
  31 + }
  32 +
  33 + @Override
  34 + public List<Long> getResult(ResultSet rs, String columnName) throws SQLException {
  35 + String value = rs.getString(columnName);
  36 + return getResult(value);
  37 + }
  38 +
  39 + @Override
  40 + public List<Long> getResult(ResultSet rs, int columnIndex) throws SQLException {
  41 + String value = rs.getString(columnIndex);
  42 + return getResult(value);
  43 + }
  44 +
  45 + @Override
  46 + public List<Long> getResult(CallableStatement cs, int columnIndex) throws SQLException {
  47 + String value = cs.getString(columnIndex);
  48 + return getResult(value);
  49 + }
  50 +
  51 + private List<Long> getResult(String value) {
  52 + if (value == null) {
  53 + return null;
  54 + }
  55 + return StrUtils.splitToLong(value, COMMA);
  56 + }
  57 +}
yudao-module-mall/pom.xml
@@ -15,13 +15,13 @@ @@ -15,13 +15,13 @@
15 <name>${project.artifactId}</name> 15 <name>${project.artifactId}</name>
16 16
17 <description> 17 <description>
18 - 商城大模块,由 product 商品、market 营销、trade 交易 coupon等组成 18 + 商城大模块,由 product 商品、promotion 营销、trade 交易 coupon等组成
19 </description> 19 </description>
20 <modules> 20 <modules>
21 - <module>yudao-module-coupon-api</module>  
22 - <module>yudao-module-coupon-biz</module>  
23 - <module>yudao-module-market-api</module>  
24 - <module>yudao-module-market-biz</module> 21 +<!-- <module>yudao-module-coupon-api</module>-->
  22 +<!-- <module>yudao-module-coupon-biz</module>-->
  23 + <module>yudao-module-promotion-api</module>
  24 + <module>yudao-module-promotion-biz</module>
25 <module>yudao-module-product-api</module> 25 <module>yudao-module-product-api</module>
26 <module>yudao-module-product-biz</module> 26 <module>yudao-module-product-biz</module>
27 <module>yudao-module-trade-api</module> 27 <module>yudao-module-trade-api</module>
yudao-module-mall/yudao-module-coupon-api/pom.xml deleted
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 -  
27 - <!-- 参数校验 -->  
28 - <dependency>  
29 - <groupId>org.springframework.boot</groupId>  
30 - <artifactId>spring-boot-starter-validation</artifactId>  
31 - <optional>true</optional>  
32 - </dependency>  
33 - </dependencies>  
34 -  
35 -</project>  
36 \ No newline at end of file 0 \ No newline at end of file
yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponExpireTimeTypeEnum.java deleted
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,"不开启"),  
18 - CLOSE(0,"开启"),;  
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/CouponFetchTypeEnum.java deleted
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(1,"限制"),  
18 - NOT_LIMIT(0,"不限制"),;  
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/CouponForbidPreferenceEnum.java deleted
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 CouponForbidPreferenceEnum {  
16 -  
17 - UN_FORBID(0,"不限制"),  
18 - FORBID(1,"优惠券仅原价购买商品时可用");  
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/CouponGoodsTypeEnum.java deleted
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 CouponGoodsTypeEnum {  
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/CouponStatusTypeEnum.java deleted
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 - 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/CouponTypeEnum.java deleted
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 deleted
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 deleted
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 deleted
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 deleted
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 - <modelVersion>4.0.0</modelVersion>  
11 - <packaging>jar</packaging>  
12 - <artifactId>yudao-module-coupon-biz</artifactId>  
13 -  
14 - <name>${project.artifactId}</name>  
15 -  
16 - <description>  
17 - coupon模块,主要负责优惠券的一些业务,含发布优惠券模板,分发优惠券等  
18 - </description>  
19 -  
20 - <dependencies>  
21 -  
22 - <dependency>  
23 - <groupId>cn.iocoder.boot</groupId>  
24 - <artifactId>yudao-module-coupon-api</artifactId>  
25 - <version>${revision}</version>  
26 - </dependency>  
27 -  
28 - <!-- 业务组件 -->  
29 - <dependency>  
30 - <groupId>cn.iocoder.boot</groupId>  
31 - <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>  
32 - </dependency>  
33 -  
34 - <!-- Web 相关 -->  
35 - <dependency>  
36 - <groupId>cn.iocoder.boot</groupId>  
37 - <artifactId>yudao-spring-boot-starter-web</artifactId>  
38 - </dependency>  
39 - <dependency>  
40 - <groupId>cn.iocoder.boot</groupId>  
41 - <artifactId>yudao-spring-boot-starter-security</artifactId>  
42 - </dependency>  
43 -  
44 - <!-- DB 相关 -->  
45 - <dependency>  
46 - <groupId>cn.iocoder.boot</groupId>  
47 - <artifactId>yudao-spring-boot-starter-mybatis</artifactId>  
48 - </dependency>  
49 -  
50 - <!-- Test 测试相关 -->  
51 - <dependency>  
52 - <groupId>cn.iocoder.boot</groupId>  
53 - <artifactId>yudao-spring-boot-starter-test</artifactId>  
54 - </dependency>  
55 -  
56 - <!-- 工具类相关 -->  
57 - <dependency>  
58 - <groupId>cn.iocoder.boot</groupId>  
59 - <artifactId>yudao-spring-boot-starter-excel</artifactId>  
60 - </dependency>  
61 -  
62 - </dependencies>  
63 -  
64 -</project>  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/CouponController.java deleted
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/item")  
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 deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;  
2 -  
3 -import lombok.*;  
4 -  
5 -import java.time.LocalDateTime;  
6 -import java.math.BigDecimal;  
7 -import io.swagger.annotations.*;  
8 -import javax.validation.constraints.*;  
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 -/**  
14 -* 优惠券 Base VO,提供给添加、修改、详细的子 VO 使用  
15 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
16 -*/  
17 -@Data  
18 -public class CouponBaseVO {  
19 -  
20 - @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机", required = true)  
21 - @NotNull(message = "优惠券类型 reward-满减 discount-折扣 random-随机不能为空")  
22 - private String type;  
23 -  
24 - @ApiModelProperty(value = "优惠券名称", required = true)  
25 - @NotNull(message = "优惠券名称不能为空")  
26 - private String name;  
27 -  
28 - @ApiModelProperty(value = "优惠券类型id")  
29 - private Long couponTypeId;  
30 -  
31 - @ApiModelProperty(value = "优惠券编码", required = true)  
32 - @NotNull(message = "优惠券编码不能为空")  
33 - private String couponCode;  
34 -  
35 - @ApiModelProperty(value = "领用人", required = true)  
36 - @NotNull(message = "领用人不能为空")  
37 - private Long memberId;  
38 -  
39 - @ApiModelProperty(value = "优惠券使用订单id", required = true)  
40 - @NotNull(message = "优惠券使用订单id不能为空")  
41 - private Long useOrderId;  
42 -  
43 - @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用", required = true)  
44 - @NotNull(message = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用不能为空")  
45 - private Boolean goodsType;  
46 -  
47 - @ApiModelProperty(value = "适用商品id", required = true)  
48 - @NotNull(message = "适用商品id不能为空")  
49 - private String goodsIds;  
50 -  
51 - @ApiModelProperty(value = "最小金额", required = true)  
52 - @NotNull(message = "最小金额不能为空")  
53 - private BigDecimal atLeast;  
54 -  
55 - @ApiModelProperty(value = "面额", required = true)  
56 - @NotNull(message = "面额不能为空")  
57 - private BigDecimal money;  
58 -  
59 - @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加", required = true)  
60 - @NotNull(message = "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空")  
61 - private BigDecimal discount;  
62 -  
63 - @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加", required = true)  
64 - @NotNull(message = "最多折扣金额 当type为discount时可选择性添加不能为空")  
65 - private BigDecimal discountLimit;  
66 -  
67 - @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用", required = true)  
68 - @NotNull(message = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空")  
69 - private Boolean whetherForbidPreference;  
70 -  
71 - @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启", required = true)  
72 - @NotNull(message = "是否开启过期提醒0-不开启 1-开启")  
73 - private Boolean whetherExpireNotice;  
74 -  
75 - @ApiModelProperty(value = "过期前N天提醒", required = true)  
76 - @NotNull(message = "过期前N天提醒不能为空")  
77 - private Integer expireNoticeFixedTerm;  
78 -  
79 - @ApiModelProperty(value = "是否已提醒", required = true)  
80 - @NotNull(message = "是否已提醒不能为空")  
81 - private Boolean whetherNoticed;  
82 -  
83 - @ApiModelProperty(value = "优惠券状态 1已领用(未使用) 2已使用 3已过期", required = true)  
84 - @NotNull(message = "优惠券状态 1已领用(未使用) 2已使用 3已过期不能为空")  
85 - private Integer state;  
86 -  
87 - @ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取", required = true)  
88 - @NotNull(message = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取不能为空")  
89 - private Boolean getType;  
90 -  
91 - @ApiModelProperty(value = "领取时间", required = true)  
92 - @NotNull(message = "领取时间不能为空")  
93 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
94 - private LocalDateTime fetchTime;  
95 -  
96 - @ApiModelProperty(value = "使用时间", required = true)  
97 - @NotNull(message = "使用时间不能为空")  
98 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
99 - private LocalDateTime useTime;  
100 -  
101 - @ApiModelProperty(value = "可使用的开始时间", required = true)  
102 - @NotNull(message = "可使用的开始时间不能为空")  
103 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
104 - private LocalDateTime startTime;  
105 -  
106 - @ApiModelProperty(value = "有效期结束时间", required = true)  
107 - @NotNull(message = "有效期结束时间不能为空")  
108 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
109 - private LocalDateTime endTime;  
110 -  
111 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponCreateReqVO.java deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;  
2 -  
3 -import lombok.*;  
4 -import java.util.*;  
5 -import io.swagger.annotations.*;  
6 -import javax.validation.constraints.*;  
7 -  
8 -@ApiModel("管理后台 - 优惠券创建 Request VO")  
9 -@Data  
10 -@EqualsAndHashCode(callSuper = true)  
11 -@ToString(callSuper = true)  
12 -public class CouponCreateReqVO extends CouponBaseVO {  
13 -  
14 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponExcelVO.java deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;  
2 -  
3 -import lombok.*;  
4 -  
5 -import java.time.LocalDateTime;  
6 -import java.math.BigDecimal;  
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 LocalDateTime fetchTime;  
77 -  
78 - @ExcelProperty("使用时间")  
79 - private LocalDateTime useTime;  
80 -  
81 - @ExcelProperty("可使用的开始时间")  
82 - private LocalDateTime startTime;  
83 -  
84 - @ExcelProperty("有效期结束时间")  
85 - private LocalDateTime endTime;  
86 -  
87 - @ExcelProperty("创建时间")  
88 - private LocalDateTime createTime;  
89 -  
90 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponExportReqVO.java deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;  
2 -  
3 -import lombok.*;  
4 -  
5 -import java.math.BigDecimal;  
6 -import java.time.LocalDateTime;  
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 = "参数和 CouponPageReqVO 是一致的")  
13 -@Data  
14 -public class CouponExportReqVO {  
15 -  
16 - @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机")  
17 - private String type;  
18 -  
19 - @ApiModelProperty(value = "优惠券名称")  
20 - private String name;  
21 -  
22 - @ApiModelProperty(value = "优惠券类型id")  
23 - private Long couponTypeId;  
24 -  
25 - @ApiModelProperty(value = "优惠券编码")  
26 - private String couponCode;  
27 -  
28 - @ApiModelProperty(value = "领用人")  
29 - private Long memberId;  
30 -  
31 - @ApiModelProperty(value = "优惠券使用订单id")  
32 - private Long useOrderId;  
33 -  
34 - @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")  
35 - private Boolean goodsType;  
36 -  
37 - @ApiModelProperty(value = "适用商品id")  
38 - private String goodsIds;  
39 -  
40 - @ApiModelProperty(value = "最小金额")  
41 - private BigDecimal atLeast;  
42 -  
43 - @ApiModelProperty(value = "面额")  
44 - private BigDecimal money;  
45 -  
46 - @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")  
47 - private BigDecimal discount;  
48 -  
49 - @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")  
50 - private BigDecimal discountLimit;  
51 -  
52 - @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")  
53 - private Boolean whetherForbidPreference;  
54 -  
55 - @ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启")  
56 - private Boolean whetherExpireNotice;  
57 -  
58 - @ApiModelProperty(value = "过期前N天提醒")  
59 - private Integer expireNoticeFixedTerm;  
60 -  
61 - @ApiModelProperty(value = "是否已提醒")  
62 - private Boolean whetherNoticed;  
63 -  
64 - @ApiModelProperty(value = "优惠券状态 1已领用(未使用) 2已使用 3已过期")  
65 - private Integer state;  
66 -  
67 - @ApiModelProperty(value = "获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取")  
68 - private Boolean getType;  
69 -  
70 - @ApiModelProperty(value = "领取时间")  
71 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
72 - private LocalDateTime[] fetchTime;  
73 -  
74 - @ApiModelProperty(value = "使用时间")  
75 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
76 - private LocalDateTime[] useTime;  
77 -  
78 - @ApiModelProperty(value = "可使用的开始时间")  
79 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
80 - private LocalDateTime[] startTime;  
81 -  
82 - @ApiModelProperty(value = "有效期结束时间")  
83 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
84 - private LocalDateTime[] endTime;  
85 -  
86 - @ApiModelProperty(value = "创建时间")  
87 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
88 - private LocalDateTime[] createTime;  
89 -  
90 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponPageReqVO.java deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;  
2 -  
3 -import lombok.*;  
4 -  
5 -import java.math.BigDecimal;  
6 -import java.time.LocalDateTime;  
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 LocalDateTime[] fetchTime;  
76 -  
77 - @ApiModelProperty(value = "使用时间")  
78 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
79 - private LocalDateTime[] useTime;  
80 -  
81 - @ApiModelProperty(value = "可使用的开始时间")  
82 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
83 - private LocalDateTime[] startTime;  
84 -  
85 - @ApiModelProperty(value = "有效期结束时间")  
86 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
87 - private LocalDateTime[] endTime;  
88 -  
89 - @ApiModelProperty(value = "创建时间")  
90 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
91 - private LocalDateTime[] createTime;  
92 -  
93 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponUpdateReqVO.java deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;  
2 -  
3 -import lombok.*;  
4 -import java.util.*;  
5 -import io.swagger.annotations.*;  
6 -import javax.validation.constraints.*;  
7 -  
8 -@ApiModel("管理后台 - 优惠券更新 Request VO")  
9 -@Data  
10 -@EqualsAndHashCode(callSuper = true)  
11 -@ToString(callSuper = true)  
12 -public class CouponUpdateReqVO extends CouponBaseVO {  
13 -  
14 - @ApiModelProperty(value = "用户ID", required = true)  
15 - @NotNull(message = "用户ID不能为空")  
16 - private Long id;  
17 -  
18 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/CouponTempleteController.java deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.templete;  
2 -  
3 -import cn.iocoder.yudao.module.coupon.controller.admin.templete.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/template")  
23 -@Validated  
24 -public class CouponTempleteController {  
25 -  
26 - @Resource  
27 - private CouponTempleteService couponTempleteServiceService;  
28 -  
29 - @PostMapping("/create")  
30 - @ApiOperation("创建优惠券模板")  
31 - @PreAuthorize("@ss.hasPermission('CouponTemplete::create')")  
32 - public CommonResult<Long> create(@Valid @RequestBody CouponTempleteCreateReqVO createReqVO) {  
33 - return success(couponTempleteServiceService.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 -// couponTempleteServiceService.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 -// couponTempleteServiceService.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 = couponTempleteServiceService.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 = couponTempleteServiceService.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 = couponTempleteServiceService.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/templete/vo/CouponTempleteBaseVO.java deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;  
2 -  
3 -import lombok.*;  
4 -  
5 -import java.time.LocalDateTime;  
6 -import java.math.BigDecimal;  
7 -import io.swagger.annotations.*;  
8 -import javax.validation.constraints.*;  
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 -/**  
14 -* 优惠券模板 Base VO,提供给添加、修改、详细的子 VO 使用  
15 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
16 -*/  
17 -@Data  
18 -public class CouponTempleteBaseVO {  
19 -  
20 -  
21 - //基本信息  
22 -  
23 - @ApiModelProperty(value = "优惠券名称", required = true)  
24 - @NotNull(message = "优惠券名称不能为空")  
25 - private String name;  
26 -  
27 - @ApiModelProperty(value = "名称备注")  
28 - private String couponNameRemark;  
29 -  
30 - @ApiModelProperty(value = "优惠券图片")  
31 - private String image;  
32 -  
33 - /* ============判断适用商品——开始============= */  
34 -  
35 -  
36 - @ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用", required = true)  
37 - @NotNull(message = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用不能为空")  
38 - private Integer goodsType;  
39 -  
40 - @ApiModelProperty(value = "适用商品id")  
41 - private String productIds;  
42 -  
43 - @ApiModelProperty(value = "使用门槛0-无门槛 1-有门槛", required = true)  
44 - @NotNull(message = "使用门槛0-无门槛 1-有门槛不能为空")  
45 - private Boolean hasUseLimit;  
46 -  
47 - @ApiModelProperty(value = "满多少元使用 0代表无限制", required = true)  
48 - @NotNull(message = "满多少元使用 0代表无限制不能为空")  
49 - private BigDecimal atLeast;  
50 -  
51 -  
52 - /* ============折扣类型——开始============= */  
53 -  
54 - @ApiModelProperty(value = "优惠券类型 reward-满减 discount-折扣 random-随机", required = true)  
55 - @NotNull(message = "优惠券类型 reward-满减 discount-折扣 random-随机不能为空")  
56 - private String type;  
57 -  
58 - @ApiModelProperty(value = "发放面额 当type为reward时需要添加")  
59 - @NotNull(message = "发放面额 当type为reward时需要添加不能为空")  
60 - private BigDecimal money;  
61 -  
62 - @ApiModelProperty(value = "1 =< 折扣 <= 9.9 当type为discount时需要添加")  
63 - @NotNull(message = "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空")  
64 - private BigDecimal discount;  
65 -  
66 - @ApiModelProperty(value = "最多折扣金额 当type为discount时可选择性添加")  
67 - @NotNull(message = "最多折扣金额 当type为discount时可选择性添加不能为空")  
68 - private BigDecimal discountLimit;  
69 -  
70 - @ApiModelProperty(value = "最低金额 当type为radom时需要添加", required = true)  
71 - @NotNull(message = "最低金额 当type为radom时需要添加不能为空")  
72 - private BigDecimal minMoney;  
73 -  
74 - @ApiModelProperty(value = "最大金额 当type为radom时需要添加", required = true)  
75 - @NotNull(message = "最大金额 当type为radom时需要添加不能为空")  
76 - private BigDecimal maxMoney;  
77 -  
78 - /* ============折扣类型——结束============= */  
79 -  
80 -  
81 - /* ============过期类型——开始============= */  
82 -  
83 -  
84 - @ApiModelProperty(value = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期", required = true)  
85 - @NotNull(message = "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期 不能为空")  
86 - private Integer validityType;  
87 -  
88 - @ApiModelProperty(value = "使用开始日期 过期类型1时必填")  
89 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
90 - private LocalDateTime startUseTime;  
91 -  
92 - @ApiModelProperty(value = "使用结束日期 过期类型1时必填")  
93 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
94 - private LocalDateTime endUseTime;  
95 -  
96 - @ApiModelProperty(value = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")  
97 - @NotNull(message = "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效不能为空")  
98 - private Integer fixedTerm;  
99 -  
100 - @ApiModelProperty(value = "有效日期结束时间")  
101 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
102 - private LocalDateTime endTime;  
103 -  
104 - /* ============过期类型——结束============= */  
105 -  
106 -  
107 - @ApiModelProperty(value = "领取是否无限制0-否 1是", required = true)  
108 - @NotNull(message = "是否无限制0-否 1是")  
109 - private Boolean whetherLimitless;  
110 -  
111 - @ApiModelProperty(value = "每人最大领取个数", required = true)  
112 - @NotNull(message = "每人最大领取个数不能为空")  
113 - private Integer maxFetch;  
114 -  
115 - @ApiModelProperty(value = "是否开启过期提醒 0-不开启 1-开启", required = true)  
116 - @NotNull(message = "是否开启过期提醒0-不开启 1-开启不能为空")  
117 - private Boolean whetherExpireNotice;  
118 -  
119 - @ApiModelProperty(value = "过期前N天提醒", required = true)  
120 - @NotNull(message = "过期前N天提醒不能为空")  
121 - private Integer expireNoticeFixedTerm;  
122 -  
123 - @ApiModelProperty(value = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用", required = true)  
124 - @NotNull(message = "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空")  
125 - private Boolean whetherForbidPreference;  
126 -  
127 - @ApiModelProperty(value = "是否显示", required = true)  
128 - @NotNull(message = "是否显示不能为空")  
129 - private Integer whetherShow;  
130 -  
131 - @ApiModelProperty(value = "是否禁止发放0-否 1-是", required = true)  
132 - @NotNull(message = "是否禁止发放0-否 1-是不能为空")  
133 - private Boolean whetherForbidden;  
134 -  
135 - /* ============汇总计算——开始============= */  
136 -  
137 -  
138 -  
139 - @ApiModelProperty(value = "使用优惠券购买的商品数量", required = true)  
140 - @NotNull(message = "使用优惠券购买的商品数量不能为空")  
141 - private Integer orderGoodsNum;  
142 -  
143 - @ApiModelProperty(value = "订单的优惠总金额", required = true)  
144 - @NotNull(message = "订单的优惠总金额不能为空")  
145 - private BigDecimal discountOrderMoney;  
146 -  
147 - @ApiModelProperty(value = "用券总成交额", required = true)  
148 - @NotNull(message = "用券总成交额不能为空")  
149 - private BigDecimal orderMoney;  
150 -  
151 - @ApiModelProperty(value = "发放数量", required = true)  
152 - @NotNull(message = "发放数量不能为空")  
153 - private Integer count;  
154 -  
155 - @ApiModelProperty(value = "已领取数量", required = true)  
156 - @NotNull(message = "已领取数量不能为空")  
157 - private Integer leadCount;  
158 -  
159 - @ApiModelProperty(value = "已使用数量", required = true)  
160 - @NotNull(message = "已使用数量不能为空")  
161 - private Integer usedCount;  
162 -  
163 -  
164 - /* ============汇总计算——结束============= */  
165 -  
166 -  
167 - @ApiModelProperty(value = "状态(1进行中2已结束3已关闭)", required = true)  
168 - @NotNull(message = "状态(1进行中2已结束-1已关闭)不能为空")  
169 - private Integer status;  
170 -  
171 -  
172 -  
173 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteExcelVO.java deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;  
2 -  
3 -import lombok.*;  
4 -  
5 -import java.time.LocalDateTime;  
6 -import java.math.BigDecimal;  
7 -  
8 -import com.alibaba.excel.annotation.ExcelProperty;  
9 -  
10 -/**  
11 - * 优惠券模板 Excel VO  
12 - *  
13 - * @author wxr  
14 - */  
15 -@Data  
16 -public class CouponTempleteExcelVO {  
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("名称备注")  
28 - private String couponNameRemark;  
29 -  
30 - @ExcelProperty("优惠券图片")  
31 - private String image;  
32 -  
33 - @ExcelProperty("发放数量")  
34 - private Integer count;  
35 -  
36 - @ExcelProperty("已领取数量")  
37 - private Integer leadCount;  
38 -  
39 - @ExcelProperty("已使用数量")  
40 - private Integer usedCount;  
41 -  
42 - @ExcelProperty("适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")  
43 - private Integer goodsType;  
44 -  
45 - @ExcelProperty("适用商品id")  
46 - private String productIds;  
47 -  
48 - @ExcelProperty("使用门槛0-无门槛 1-有门槛")  
49 - private Boolean hasUseLimit;  
50 -  
51 - @ExcelProperty("满多少元使用 0代表无限制")  
52 - private BigDecimal atLeast;  
53 -  
54 - @ExcelProperty("发放面额 当type为reward时需要添加")  
55 - private BigDecimal money;  
56 -  
57 - @ExcelProperty("1 =< 折扣 <= 9.9 当type为discount时需要添加")  
58 - private BigDecimal discount;  
59 -  
60 - @ExcelProperty("最多折扣金额 当type为discount时可选择性添加")  
61 - private BigDecimal discountLimit;  
62 -  
63 - @ExcelProperty("最低金额 当type为radom时需要添加")  
64 - private BigDecimal minMoney;  
65 -  
66 - @ExcelProperty("最大金额 当type为radom时需要添加")  
67 - private BigDecimal maxMoney;  
68 -  
69 - @ExcelProperty("过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")  
70 - private Integer validityType;  
71 -  
72 - @ExcelProperty("使用开始日期 过期类型1时必填")  
73 - private LocalDateTime startUseTime;  
74 -  
75 - @ExcelProperty("使用结束日期 过期类型1时必填")  
76 - private LocalDateTime endUseTime;  
77 -  
78 - @ExcelProperty("当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效")  
79 - private Integer fixedTerm;  
80 -  
81 - @ExcelProperty("是否无限制0-否 1是")  
82 - private Boolean whetherLimitless;  
83 -  
84 - @ExcelProperty("每人最大领取个数")  
85 - private Integer maxFetch;  
86 -  
87 - @ExcelProperty("是否开启过期提醒0-不开启 1-开启")  
88 - private Boolean whetherExpireNotice;  
89 -  
90 - @ExcelProperty("过期前N天提醒")  
91 - private Integer expireNoticeFixedTerm;  
92 -  
93 - @ExcelProperty("优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用")  
94 - private Boolean whetherForbidPreference;  
95 -  
96 - @ExcelProperty("是否显示")  
97 - private Integer whetherShow;  
98 -  
99 - @ExcelProperty("订单的优惠总金额")  
100 - private BigDecimal discountOrderMoney;  
101 -  
102 - @ExcelProperty("用券总成交额")  
103 - private BigDecimal orderMoney;  
104 -  
105 - @ExcelProperty("是否禁止发放0-否 1-是")  
106 - private Boolean whetherForbidden;  
107 -  
108 - @ExcelProperty("使用优惠券购买的商品数量")  
109 - private Integer orderGoodsNum;  
110 -  
111 - @ExcelProperty("状态(1进行中2已结束-1已关闭)")  
112 - private Integer status;  
113 -  
114 - @ExcelProperty("有效日期结束时间")  
115 - private LocalDateTime endTime;  
116 -  
117 - @ExcelProperty("创建时间")  
118 - private LocalDateTime createTime;  
119 -  
120 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteExportReqVO.java deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;  
2 -  
3 -import lombok.*;  
4 -  
5 -import java.math.BigDecimal;  
6 -import java.time.LocalDateTime;  
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 LocalDateTime[] startUseTime;  
70 -  
71 - @ApiModelProperty(value = "使用结束日期 过期类型1时必填")  
72 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
73 - private LocalDateTime[] 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 LocalDateTime[] endTime;  
114 -  
115 - @ApiModelProperty(value = "创建时间")  
116 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
117 - private LocalDateTime[] createTime;  
118 -  
119 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempletePageReqVO.java deleted
1 -package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;  
2 -  
3 -import lombok.*;  
4 -  
5 -import java.math.BigDecimal;  
6 -import java.time.LocalDateTime;  
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 LocalDateTime[] startUseTime;  
73 -  
74 - @ApiModelProperty(value = "使用结束日期 过期类型1时必填")  
75 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
76 - private LocalDateTime[] 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 LocalDateTime[] endTime;  
117 -  
118 - @ApiModelProperty(value = "创建时间")  
119 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
120 - private LocalDateTime[] createTime;  
121 -  
122 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/convert/CouponTemplete/CouponTempleteConvert.java deleted
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.templete.vo.CouponTempleteCreateReqVO;  
8 -import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteExcelVO;  
9 -import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteRespVO;  
10 -import cn.iocoder.yudao.module.coupon.controller.admin.templete.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/dal/dataobject/CouponTemplete/CouponTempleteDO.java deleted
1 -package cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete;  
2 -  
3 -import lombok.*;  
4 -  
5 -import java.time.LocalDateTime;  
6 -import java.math.BigDecimal;  
7 -import com.baomidou.mybatisplus.annotation.*;  
8 -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;  
9 -  
10 -/**  
11 - * 优惠券模板 DO  
12 - *  
13 - * @author wxr  
14 - */  
15 -@TableName("coupon_templete")  
16 -@KeySequence("coupon_templete_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。  
17 -@Data  
18 -@EqualsAndHashCode(callSuper = true)  
19 -@ToString(callSuper = true)  
20 -@Builder  
21 -@NoArgsConstructor  
22 -@AllArgsConstructor  
23 -public class CouponTempleteDO extends BaseDO {  
24 -  
25 - /**  
26 - * 用户ID  
27 - */  
28 - @TableId  
29 - private Long id;  
30 - /**  
31 - * 优惠券类型 reward-满减 discount-折扣 random-随机  
32 - */  
33 - private String type;  
34 - /**  
35 - * 优惠券名称  
36 - */  
37 - private String name;  
38 - /**  
39 - * 名称备注  
40 - */  
41 - private String couponNameRemark;  
42 - /**  
43 - * 优惠券图片  
44 - */  
45 - private String image;  
46 - /**  
47 - * 发放数量  
48 - */  
49 - private Integer count;  
50 - /**  
51 - * 已领取数量  
52 - */  
53 - private Integer leadCount;  
54 - /**  
55 - * 已使用数量  
56 - */  
57 - private Integer usedCount;  
58 - /**  
59 - * 适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用  
60 - */  
61 - private Integer goodsType;  
62 - /**  
63 - * 适用商品id  
64 - */  
65 - private String productIds;  
66 - /**  
67 - * 使用门槛0-无门槛 1-有门槛  
68 - */  
69 - private Boolean hasUseLimit;  
70 - /**  
71 - * 满多少元使用 0代表无限制  
72 - */  
73 - private BigDecimal atLeast;  
74 - /**  
75 - * 发放面额 当type为reward时需要添加  
76 - */  
77 - private BigDecimal money;  
78 - /**  
79 - * 1 =< 折扣 <= 9.9 当type为discount时需要添加  
80 - */  
81 - private BigDecimal discount;  
82 - /**  
83 - * 最多折扣金额 当type为discount时可选择性添加  
84 - */  
85 - private BigDecimal discountLimit;  
86 - /**  
87 - * 最低金额 当type为radom时需要添加  
88 - */  
89 - private BigDecimal minMoney;  
90 - /**  
91 - * 最大金额 当type为radom时需要添加  
92 - */  
93 - private BigDecimal maxMoney;  
94 - /**  
95 - * 过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期  
96 - */  
97 - private Integer validityType;  
98 - /**  
99 - * 使用开始日期 过期类型1时必填  
100 - */  
101 - private LocalDateTime startUseTime;  
102 - /**  
103 - * 使用结束日期 过期类型1时必填  
104 - */  
105 - private LocalDateTime endUseTime;  
106 - /**  
107 - * 当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效  
108 - */  
109 - private Integer fixedTerm;  
110 - /**  
111 - * 是否无限制0-否 1是  
112 - */  
113 - private Boolean whetherLimitless;  
114 - /**  
115 - * 每人最大领取个数  
116 - */  
117 - private Integer maxFetch;  
118 - /**  
119 - * 是否开启过期提醒0-不开启 1-开启  
120 - */  
121 - private Boolean whetherExpireNotice;  
122 - /**  
123 - * 过期前N天提醒  
124 - */  
125 - private Integer expireNoticeFixedTerm;  
126 - /**  
127 - * 优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用  
128 - */  
129 - private Boolean whetherForbidPreference;  
130 - /**  
131 - * 是否显示  
132 - */  
133 - private Integer whetherShow;  
134 - /**  
135 - * 订单的优惠总金额  
136 - */  
137 - private BigDecimal discountOrderMoney;  
138 - /**  
139 - * 用券总成交额  
140 - */  
141 - private BigDecimal orderMoney;  
142 - /**  
143 - * 是否禁止发放0-否 1-是  
144 - */  
145 - private Boolean whetherForbidden;  
146 - /**  
147 - * 使用优惠券购买的商品数量  
148 - */  
149 - private Integer orderGoodsNum;  
150 - /**  
151 - * 状态(1进行中2已结束-1已关闭)  
152 - */  
153 - private Integer status;  
154 - /**  
155 - * 有效日期结束时间  
156 - */  
157 - private LocalDateTime endTime;  
158 -  
159 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/coupon/CouponDO.java deleted
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 -  
6 -import java.time.LocalDateTime;  
7 -import java.math.BigDecimal;  
8 -import com.baomidou.mybatisplus.annotation.*;  
9 -  
10 -/**  
11 - * 优惠券 DO  
12 - *  
13 - * @author wxr  
14 - */  
15 -@TableName("coupon")  
16 -@KeySequence("coupon_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。  
17 -@Data  
18 -@EqualsAndHashCode(callSuper = true)  
19 -@ToString(callSuper = true)  
20 -@Builder  
21 -@NoArgsConstructor  
22 -@AllArgsConstructor  
23 -public class CouponDO extends BaseDO {  
24 -  
25 - /**  
26 - * 用户ID  
27 - */  
28 - @TableId  
29 - private Long id;  
30 - /**  
31 - * 优惠券类型 reward-满减 discount-折扣 random-随机  
32 - */  
33 - private String type;  
34 - /**  
35 - * 优惠券名称  
36 - */  
37 - private String name;  
38 - /**  
39 - * 优惠券类型id  
40 - */  
41 - private Long couponTypeId;  
42 - /**  
43 - * 优惠券编码  
44 - */  
45 - private String couponCode;  
46 - /**  
47 - * 领用人  
48 - */  
49 - private Long memberId;  
50 - /**  
51 - * 优惠券使用订单id  
52 - */  
53 - private Long useOrderId;  
54 - /**  
55 - * 适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用  
56 - */  
57 - private Boolean goodsType;  
58 - /**  
59 - * 适用商品id  
60 - */  
61 - private String goodsIds;  
62 - /**  
63 - * 最小金额  
64 - */  
65 - private BigDecimal atLeast;  
66 - /**  
67 - * 面额  
68 - */  
69 - private BigDecimal money;  
70 - /**  
71 - * 1 =< 折扣 <= 9.9 当type为discount时需要添加  
72 - */  
73 - private BigDecimal discount;  
74 - /**  
75 - * 最多折扣金额 当type为discount时可选择性添加  
76 - */  
77 - private BigDecimal discountLimit;  
78 - /**  
79 - * 优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用  
80 - */  
81 - private Boolean whetherForbidPreference;  
82 - /**  
83 - * 是否开启过期提醒0-不开启 1-开启  
84 - */  
85 - private Boolean whetherExpireNotice;  
86 - /**  
87 - * 过期前N天提醒  
88 - */  
89 - private Integer expireNoticeFixedTerm;  
90 - /**  
91 - * 是否已提醒  
92 - */  
93 - private Boolean whetherNoticed;  
94 - /**  
95 - * 优惠券状态 1已领用(未使用) 2已使用 3已过期  
96 - */  
97 - private Integer state;  
98 - /**  
99 - * 获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取  
100 - */  
101 - private Boolean getType;  
102 - /**  
103 - * 领取时间  
104 - */  
105 - private LocalDateTime fetchTime;  
106 - /**  
107 - * 使用时间  
108 - */  
109 - private LocalDateTime useTime;  
110 - /**  
111 - * 可使用的开始时间  
112 - */  
113 - private LocalDateTime startTime;  
114 - /**  
115 - * 有效期结束时间  
116 - */  
117 - private LocalDateTime endTime;  
118 -  
119 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/mysql/CouponTemplete/CouponTempleteMapper.java deleted
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.templete.vo.CouponTempleteExportReqVO;  
9 -import cn.iocoder.yudao.module.coupon.controller.admin.templete.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 deleted
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-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/package-info.java deleted
1 -/**  
2 - * coupon模块,主要负责麦一些优惠券的额增删  
3 - *  
4 - * 1. Controller URL:以 /coumon/ 开头,避免和其它 Module 冲突  
5 - */  
6 -package cn.iocoder.yudao.module.coupon;  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteServiceImpl.java deleted
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.templete.vo.CouponTempleteCreateReqVO;  
6 -import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteExportReqVO;  
7 -import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempletePageReqVO;  
8 -import cn.iocoder.yudao.module.coupon.controller.admin.templete.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 org.springframework.stereotype.Service;  
13 -import javax.annotation.Resource;  
14 -import org.springframework.validation.annotation.Validated;  
15 -  
16 -import java.util.*;  
17 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
18 -  
19 -  
20 -  
21 -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;  
22 -import static cn.iocoder.yudao.module.CouponTemplete.enums.ErrorCodeConstants.*;  
23 -  
24 -/**  
25 - * 优惠券模板 Service 实现类  
26 - *  
27 - * @author wxr  
28 - */  
29 -@Service  
30 -@Validated  
31 -public class CouponTempleteServiceImpl implements CouponTempleteService {  
32 -  
33 - @Resource  
34 - private CouponTempleteMapper couponTempleteMapper;  
35 -  
36 - @Override  
37 - public Long create(CouponTempleteCreateReqVO createReqVO) {  
38 - // 插入  
39 - CouponTempleteDO couponTempleteDO = CouponTempleteConvert.INSTANCE.convert(createReqVO);  
40 - /* 验证类型、判断必填*/  
41 - checkCouponType(createReqVO);  
42 -  
43 - /*验证过期类型、判断必填*/  
44 - checkValidityType(createReqVO);  
45 -  
46 -  
47 -  
48 - couponTempleteMapper.insert(couponTempleteDO);  
49 - // 返回  
50 - return couponTempleteDO.getId();  
51 - }  
52 -  
53 - /*确认优惠券类型*/  
54 - private void checkValidityType(CouponTempleteCreateReqVO createReqVO) {  
55 - Integer validtyType = createReqVO.getValidityType();  
56 -  
57 - if(CouponValidityTypeEnum.TIME_RANGE_EXPIRTED.getStatus().equals(validtyType)){  
58 - if(createReqVO.getStartUseTime() == null||createReqVO.getEndUseTime() == null){  
59 - throw exception(START_END_TIME_NOT_NULL);  
60 - }  
61 - }else{  
62 - if(createReqVO.getFixedTerm() == null){  
63 - throw exception(FIXED_TERM_NOT_NULL);  
64 - }  
65 - }  
66 - }  
67 -  
68 - private void checkCouponType(CouponTempleteCreateReqVO createReqVO) {  
69 -  
70 - String couponType = createReqVO.getType();  
71 - //当type=reward时候,需要添加  
72 - if(couponType.equals(CouponTypeEnum.REWARD.getName())){  
73 - if(createReqVO.getMoney()==null){  
74 - throw exception(MONEY_NOT_NULL);  
75 - }  
76 - }else if(couponType.equals(CouponTypeEnum.DISCOUNT.getName())){  
77 - if(createReqVO.getDiscount()==null){  
78 - throw exception(DISCOUNT_NOT_NULL);  
79 - }  
80 - if(createReqVO.getDiscountLimit()==null){  
81 - throw exception(DISCOUNT_LIMIT_NOT_NULL);  
82 - }  
83 - }else if (couponType.equals(CouponTypeEnum.RANDOW.getName())){  
84 - //当type为radom时需要添加不能为空  
85 - if(createReqVO.getMinMoney()==null||createReqVO.getMaxMoney()==null){  
86 - throw exception(MIN_MAX_NOT_NULL);  
87 - }  
88 - }  
89 - }  
90 -  
91 - @Override  
92 - public void update(CouponTempleteUpdateReqVO updateReqVO) {  
93 - // 校验存在  
94 - this.validateExists(updateReqVO.getId());  
95 - // 更新  
96 - CouponTempleteDO updateObj = CouponTempleteConvert.INSTANCE.convert(updateReqVO);  
97 - couponTempleteMapper.updateById(updateObj);  
98 - }  
99 -  
100 - @Override  
101 - public void delete(Long id) {  
102 - // 校验存在  
103 - this.validateExists(id);  
104 - // 删除  
105 - couponTempleteMapper.deleteById(id);  
106 - }  
107 -  
108 - private void validateExists(Long id) {  
109 - if (couponTempleteMapper.selectById(id) == null) {  
110 - throw exception(COUPON_TEMPLETE_NOT_EXISTS);  
111 - }  
112 - }  
113 -  
114 - @Override  
115 - public CouponTempleteDO get(Long id) {  
116 - return couponTempleteMapper.selectById(id);  
117 - }  
118 -  
119 - @Override  
120 - public List<CouponTempleteDO> getList(Collection<Long> ids) {  
121 - return couponTempleteMapper.selectBatchIds(ids);  
122 - }  
123 -  
124 - @Override  
125 - public PageResult<CouponTempleteDO> getPage(CouponTempletePageReqVO pageReqVO) {  
126 - return couponTempleteMapper.selectPage(pageReqVO);  
127 - }  
128 -  
129 - @Override  
130 - public List<CouponTempleteDO> getList(CouponTempleteExportReqVO exportReqVO) {  
131 - return couponTempleteMapper.selectList(exportReqVO);  
132 - }  
133 -  
134 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/coupon/CouponService.java deleted
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 deleted
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 org.springframework.stereotype.Service;  
8 -import javax.annotation.Resource;  
9 -import org.springframework.validation.annotation.Validated;  
10 -  
11 -import java.util.*;  
12 -import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;  
13 -import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;  
14 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
15 -  
16 -import cn.iocoder.yudao.module.coupon.convert.coupon.CouponConvert;  
17 -import cn.iocoder.yudao.module.coupon.dal.mysql.coupon.CouponMapper;  
18 -  
19 -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;  
20 -import static cn.iocoder.yudao.module.CouponTemplete.enums.ErrorCodeConstants.COUPON_NOT_EXISTS;  
21 -  
22 -/**  
23 - * 优惠券 Service 实现类  
24 - *  
25 - * @author wxr  
26 - */  
27 -@Service  
28 -@Validated  
29 -public class CouponServiceImpl implements CouponService {  
30 -  
31 - @Resource  
32 - private CouponMapper couponMapper;  
33 -  
34 - @Resource  
35 - private CouponTempleteMapper couponTempleteMapper;  
36 -  
37 - public Long create(CouponCreateReqVO createReqVO) {  
38 - // 插入  
39 - CouponDO couponDO = CouponConvert.INSTANCE.convert(createReqVO);  
40 - couponMapper.insert(couponDO);  
41 - // 返回  
42 - return couponDO.getId();  
43 - }  
44 -  
45 -  
46 - /**  
47 - *todo 获取用户id收获优惠券  
48 - *@author:wxr  
49 - *@date:2022-08-13 3:11  
50 - *@Description  
51 - */  
52 - @Override  
53 - public Long create(Long templateId) {  
54 - Long userid = SecurityFrameworkUtils.getLoginUserId();  
55 - CouponDO couponDO = CouponDO.builder().memberId(userid).build();  
56 - CouponTempleteDO couponTempleteDO = couponTempleteMapper.selectById(templateId);  
57 - //todo 缺少判空  
58 - BeanUtil.copyProperties(couponTempleteDO,couponTempleteDO);  
59 - couponMapper.insert(couponDO);  
60 - return couponDO.getId();  
61 - }  
62 -  
63 - @Override  
64 - public void update(CouponUpdateReqVO updateReqVO) {  
65 - // 校验存在  
66 - this.validateExists(updateReqVO.getId());  
67 - // 更新  
68 - CouponDO updateObj = CouponConvert.INSTANCE.convert(updateReqVO);  
69 - couponMapper.updateById(updateObj);  
70 - }  
71 -  
72 - @Override  
73 - public void delete(Long id) {  
74 - // 校验存在  
75 - this.validateExists(id);  
76 - // 删除  
77 - couponMapper.deleteById(id);  
78 - }  
79 -  
80 - private void validateExists(Long id) {  
81 - if (couponMapper.selectById(id) == null) {  
82 - throw exception(COUPON_NOT_EXISTS);  
83 - }  
84 - }  
85 -  
86 - @Override  
87 - public CouponDO get(Long id) {  
88 - return couponMapper.selectById(id);  
89 - }  
90 -  
91 - @Override  
92 - public List<CouponDO> getList(Collection<Long> ids) {  
93 - return couponMapper.selectBatchIds(ids);  
94 - }  
95 -  
96 - @Override  
97 - public PageResult<CouponDO> getPage(CouponPageReqVO pageReqVO) {  
98 - return couponMapper.selectPage(pageReqVO);  
99 - }  
100 -  
101 - @Override  
102 - public List<CouponDO> getList(CouponExportReqVO exportReqVO) {  
103 - return couponMapper.selectList(exportReqVO);  
104 - }  
105 -  
106 -}  
yudao-module-mall/yudao-module-coupon-biz/src/main/resources/mapper/CouponTemplete/CouponTempleteMapper.xml deleted
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 deleted
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/src/main/java/cn/iocoder/yudao/module/market/enums/ErrorCodeConstants.java deleted
1 -package cn.iocoder.yudao.module.market.enums;  
2 -  
3 -import cn.iocoder.yudao.framework.common.exception.ErrorCode;  
4 -  
5 -/**  
6 - * market 错误码枚举类  
7 - * <p>  
8 - * market 系统,使用 1-003-000-000 段  
9 - */  
10 -public interface ErrorCodeConstants {  
11 -  
12 -  
13 - // ========== 促销活动相关 1003001000============  
14 - ErrorCode ACTIVITY_NOT_EXISTS = new ErrorCode(1003001000, "促销活动不存在");  
15 -  
16 - // ========== banner相关 1003002000============  
17 - ErrorCode BANNER_NOT_EXISTS = new ErrorCode(1003002000, "Banner不存在");  
18 -}  
yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/convert/discount/package-info.java deleted
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/mysql/discount/package-info.java deleted
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/service/discount/package-info.java deleted
1 -/**  
2 - * TODO 占位  
3 - */  
4 -package cn.iocoder.yudao.module.market.service.discount;  
yudao-module-mall/yudao-module-market-biz/src/test/resources/sql/clean.sql deleted
1 -DELETE FROM "market_activity";  
yudao-module-mall/yudao-module-market-biz/src/test/resources/sql/create_tables.sql deleted
1 -CREATE TABLE IF NOT EXISTS "market_activity" (  
2 - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,  
3 - "title" varchar(50) NOT NULL,  
4 - "activity_type" tinyint(4) NOT NULL,  
5 - "status" tinyint(4) NOT NULL,  
6 - "start_time" datetime NOT NULL,  
7 - "end_time" datetime NOT NULL,  
8 - "invalid_time" datetime,  
9 - "delete_time" datetime,  
10 - "time_limited_discount" varchar(2000),  
11 - "full_privilege" varchar(2000),  
12 - "creator" varchar(64) DEFAULT '',  
13 - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,  
14 - "updater" varchar(64) DEFAULT '',  
15 - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,  
16 - "deleted" bit NOT NULL DEFAULT FALSE,  
17 - "tenant_id" bigint(20) NOT NULL,  
18 - PRIMARY KEY ("id")  
19 - ) COMMENT '促销活动';  
20 \ No newline at end of file 0 \ No newline at end of file
yudao-module-mall/yudao-module-product-api/pom.xml
@@ -22,6 +22,13 @@ @@ -22,6 +22,13 @@
22 <groupId>cn.iocoder.boot</groupId> 22 <groupId>cn.iocoder.boot</groupId>
23 <artifactId>yudao-common</artifactId> 23 <artifactId>yudao-common</artifactId>
24 </dependency> 24 </dependency>
  25 +
  26 + <!-- 参数校验 -->
  27 + <dependency>
  28 + <groupId>org.springframework.boot</groupId>
  29 + <artifactId>spring-boot-starter-validation</artifactId>
  30 + <optional>true</optional>
  31 + </dependency>
25 </dependencies> 32 </dependencies>
26 33
27 -</project>  
28 \ No newline at end of file 34 \ No newline at end of file
  35 +</project>
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApi.java
1 package cn.iocoder.yudao.module.product.api.sku; 1 package cn.iocoder.yudao.module.product.api.sku;
2 2
3 -import cn.iocoder.yudao.module.product.api.sku.dto.SkuDecrementStockBatchReqDTO;  
4 -import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO; 3 +import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
  4 +import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
5 5
6 import java.util.Collection; 6 import java.util.Collection;
7 import java.util.List; 7 import java.util.List;
8 8
9 /** 9 /**
  10 + * 商品 SKU API 接口
  11 + *
10 * @author LeeYan9 12 * @author LeeYan9
11 * @since 2022-08-26 13 * @since 2022-08-26
12 */ 14 */
13 public interface ProductSkuApi { 15 public interface ProductSkuApi {
14 16
  17 + /**
  18 + * 查询 SKU 信息
  19 + *
  20 + * @param id SKU 编号
  21 + * @return SKU 信息
  22 + */
  23 + ProductSkuRespDTO getSku(Long id);
15 24
16 /** 25 /**
17 - * 根据skuId列表 查询sku信息 26 + * 批量查询 SKU 数组
18 * 27 *
19 - * @param skuIds sku ID列表  
20 - * @return sku信息列表 28 + * @param ids SKU 编号列表
  29 + * @return SKU 数组
21 */ 30 */
22 - List<SkuInfoRespDTO> getSkusByIds(Collection<Long> skuIds); 31 + List<ProductSkuRespDTO> getSkuList(Collection<Long> ids);
23 32
24 /** 33 /**
25 - * 批量扣减sku库存 34 + * 更新 SKU 库存
26 * 35 *
27 - * @param batchReqDTO sku库存信息列表 36 + * @param updateStockReqDTO 更新请求
28 */ 37 */
29 - void decrementStockBatch(SkuDecrementStockBatchReqDTO batchReqDTO); 38 + void updateSkuStock(ProductSkuUpdateStockReqDTO updateStockReqDTO);
  39 +
30 } 40 }
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/dto/SkuInfoRespDTO.java renamed to yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/dto/ProductSkuRespDTO.java
@@ -6,11 +6,13 @@ import lombok.Data; @@ -6,11 +6,13 @@ import lombok.Data;
6 import java.util.List; 6 import java.util.List;
7 7
8 /** 8 /**
  9 + * 商品 SKU 信息 Response DTO
  10 + *
9 * @author LeeYan9 11 * @author LeeYan9
10 * @since 2022-08-26 12 * @since 2022-08-26
11 */ 13 */
12 @Data 14 @Data
13 -public class SkuInfoRespDTO { 15 +public class ProductSkuRespDTO {
14 16
15 /** 17 /**
16 * 商品 SKU 编号,自增 18 * 商品 SKU 编号,自增
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/dto/SkuDecrementStockBatchReqDTO.java renamed to yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/dto/ProductSkuUpdateStockReqDTO.java
@@ -4,42 +4,44 @@ import lombok.AllArgsConstructor; @@ -4,42 +4,44 @@ import lombok.AllArgsConstructor;
4 import lombok.Data; 4 import lombok.Data;
5 import lombok.NoArgsConstructor; 5 import lombok.NoArgsConstructor;
6 6
  7 +import javax.validation.constraints.NotNull;
7 import java.util.List; 8 import java.util.List;
8 9
9 /** 10 /**
  11 + * 商品 SKU 更新库存 Request DTO
  12 + *
10 * @author LeeYan9 13 * @author LeeYan9
11 * @since 2022-08-26 14 * @since 2022-08-26
12 */ 15 */
13 @Data 16 @Data
14 @NoArgsConstructor 17 @NoArgsConstructor
15 @AllArgsConstructor 18 @AllArgsConstructor
16 -public class SkuDecrementStockBatchReqDTO {  
17 - 19 +public class ProductSkuUpdateStockReqDTO {
18 20
  21 + /**
  22 + * 商品 SKU
  23 + */
  24 + @NotNull(message = "商品 SKU 不能为空")
19 private List<Item> items; 25 private List<Item> items;
20 26
21 @Data 27 @Data
22 public static class Item { 28 public static class Item {
23 29
24 /** 30 /**
25 - * 商品 SPU 编号,自增  
26 - */  
27 - private Long productId;  
28 -  
29 - /**  
30 - * 商品 SKU 编号,自增 31 + * 商品 SKU 编号
31 */ 32 */
32 - private Long skuId; 33 + @NotNull(message = "商品 SKU 编号不能为空")
  34 + private Long id;
33 35
34 /** 36 /**
35 - * 数量 37 + * 库存变化数量
  38 + *
  39 + * 正数:增加库存
  40 + * 负数:扣减库存
36 */ 41 */
37 - private Integer count;  
38 -  
39 - } 42 + @NotNull(message = "库存变化数量不能为空")
  43 + private Integer incrCount;
40 44
41 - public static SkuDecrementStockBatchReqDTO of(List<Item> items) {  
42 - return new SkuDecrementStockBatchReqDTO(items);  
43 } 45 }
44 46
45 } 47 }
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApi.java
1 package cn.iocoder.yudao.module.product.api.spu; 1 package cn.iocoder.yudao.module.product.api.spu;
2 2
3 -import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO;  
4 -import cn.iocoder.yudao.module.product.api.spu.dto.SpuInfoRespDTO; 3 +import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
5 4
6 import java.util.Collection; 5 import java.util.Collection;
7 import java.util.List; 6 import java.util.List;
8 7
9 /** 8 /**
  9 + * 商品 SPU API 接口
  10 + *
10 * @author LeeYan9 11 * @author LeeYan9
11 * @since 2022-08-26 12 * @since 2022-08-26
12 */ 13 */
13 public interface ProductSpuApi { 14 public interface ProductSpuApi {
14 15
15 -  
16 /** 16 /**
17 - * 根据spuId列表 查询spu信息 17 + * 批量查询 SPU 数组
18 * 18 *
19 - * @param spuIds spu ID列表  
20 - * @return spu信息列表 19 + * @param ids SPU 编号列表
  20 + * @return SPU 数组
21 */ 21 */
22 - List<SpuInfoRespDTO> getSpusByIds(Collection<Long> spuIds); 22 + List<ProductSpuRespDTO> getSpuList(Collection<Long> ids);
  23 +
23 } 24 }
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/dto/SpuInfoRespDTO.java renamed to yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/dto/ProductSpuRespDTO.java
1 package cn.iocoder.yudao.module.product.api.spu.dto; 1 package cn.iocoder.yudao.module.product.api.spu.dto;
2 2
3 -import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO; 3 +import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
4 import cn.iocoder.yudao.module.product.enums.spu.ProductSpuSpecTypeEnum; 4 import cn.iocoder.yudao.module.product.enums.spu.ProductSpuSpecTypeEnum;
5 import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; 5 import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
6 import lombok.Data; 6 import lombok.Data;
7 7
8 import java.util.List; 8 import java.util.List;
9 9
  10 +// TODO @LeeYan9: ProductSpuRespDTO
10 /** 11 /**
  12 + * 商品 SPU 信息 Response DTO
  13 + *
11 * @author LeeYan9 14 * @author LeeYan9
12 * @since 2022-08-26 15 * @since 2022-08-26
13 */ 16 */
14 @Data 17 @Data
15 -public class SpuInfoRespDTO { 18 +public class ProductSpuRespDTO {
16 19
17 /** 20 /**
18 * 商品 SPU 编号,自增 21 * 商品 SPU 编号,自增
@@ -30,7 +33,7 @@ public class SpuInfoRespDTO { @@ -30,7 +33,7 @@ public class SpuInfoRespDTO {
30 */ 33 */
31 private String code; 34 private String code;
32 /** 35 /**
33 - * 商品卖点 36 + * 促销语
34 */ 37 */
35 private String sellPoint; 38 private String sellPoint;
36 /** 39 /**
@@ -80,25 +83,25 @@ public class SpuInfoRespDTO { @@ -80,25 +83,25 @@ public class SpuInfoRespDTO {
80 /** 83 /**
81 * 最小价格,单位使用:分 84 * 最小价格,单位使用:分
82 * <p> 85 * <p>
83 - * 基于其对应的 {@link SkuInfoRespDTO#getPrice()} 最小值 86 + * 基于其对应的 {@link ProductSkuRespDTO#getPrice()} 最小值
84 */ 87 */
85 private Integer minPrice; 88 private Integer minPrice;
86 /** 89 /**
87 * 最大价格,单位使用:分 90 * 最大价格,单位使用:分
88 * <p> 91 * <p>
89 - * 基于其对应的 {@link SkuInfoRespDTO#getPrice()} 最大值 92 + * 基于其对应的 {@link ProductSkuRespDTO#getPrice()} 最大值
90 */ 93 */
91 private Integer maxPrice; 94 private Integer maxPrice;
92 /** 95 /**
93 * 市场价,单位使用:分 96 * 市场价,单位使用:分
94 * <p> 97 * <p>
95 - * 基于其对应的 {@link SkuInfoRespDTO#getMarketPrice()} 最大值 98 + * 基于其对应的 {@link ProductSkuRespDTO#getMarketPrice()} 最大值
96 */ 99 */
97 private Integer marketPrice; 100 private Integer marketPrice;
98 /** 101 /**
99 * 总库存 102 * 总库存
100 * <p> 103 * <p>
101 - * 基于其对应的 {@link SkuInfoRespDTO#getStock()} 求和 104 + * 基于其对应的 {@link ProductSkuRespDTO#getStock()} 求和
102 */ 105 */
103 private Integer totalStock; 106 private Integer totalStock;
104 /** 107 /**
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java
@@ -24,9 +24,11 @@ public interface ErrorCodeConstants { @@ -24,9 +24,11 @@ public interface ErrorCodeConstants {
24 24
25 // ========== 商品规格名称 1008003000 ========== 25 // ========== 商品规格名称 1008003000 ==========
26 ErrorCode PROPERTY_NOT_EXISTS = new ErrorCode(1008003000, "规格名称不存在"); 26 ErrorCode PROPERTY_NOT_EXISTS = new ErrorCode(1008003000, "规格名称不存在");
  27 + ErrorCode PROPERTY_EXISTS = new ErrorCode(1008003001, "规格名称已存在");
27 28
28 // ========== 规格值 1008004000 ========== 29 // ========== 规格值 1008004000 ==========
29 ErrorCode PROPERTY_VALUE_NOT_EXISTS = new ErrorCode(1008004000, "规格值不存在"); 30 ErrorCode PROPERTY_VALUE_NOT_EXISTS = new ErrorCode(1008004000, "规格值不存在");
  31 + ErrorCode PROPERTY_VALUE_EXISTS = new ErrorCode(1008004001, "规格值已存在");
30 32
31 // ========== 商品 SPU 1008005000 ========== 33 // ========== 商品 SPU 1008005000 ==========
32 ErrorCode SPU_NOT_EXISTS = new ErrorCode(1008005000, "商品 SPU 不存在"); 34 ErrorCode SPU_NOT_EXISTS = new ErrorCode(1008005000, "商品 SPU 不存在");
@@ -36,5 +38,6 @@ public interface ErrorCodeConstants { @@ -36,5 +38,6 @@ public interface ErrorCodeConstants {
36 ErrorCode SKU_PROPERTIES_DUPLICATED = new ErrorCode(1008006001, "商品 SKU 的属性组合存在重复"); 38 ErrorCode SKU_PROPERTIES_DUPLICATED = new ErrorCode(1008006001, "商品 SKU 的属性组合存在重复");
37 ErrorCode SPU_ATTR_NUMBERS_MUST_BE_EQUALS = new ErrorCode(1008006002, "一个 SPU 下的每个 SKU,其规格数必须一致"); 39 ErrorCode SPU_ATTR_NUMBERS_MUST_BE_EQUALS = new ErrorCode(1008006002, "一个 SPU 下的每个 SKU,其规格数必须一致");
38 ErrorCode SPU_SKU_NOT_DUPLICATE = new ErrorCode(1008006003, "一个 SPU 下的每个 SKU,必须不重复"); 40 ErrorCode SPU_SKU_NOT_DUPLICATE = new ErrorCode(1008006003, "一个 SPU 下的每个 SKU,必须不重复");
  41 + ErrorCode SKU_STOCK_NOT_ENOUGH = new ErrorCode(1008006004, "商品 SKU 库存不足");
39 42
40 } 43 }
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/spu/ProductSpuStatusEnum.java
@@ -19,12 +19,12 @@ public enum ProductSpuStatusEnum implements IntArrayValuable { @@ -19,12 +19,12 @@ public enum ProductSpuStatusEnum implements IntArrayValuable {
19 DISABLE(0, "下架"), 19 DISABLE(0, "下架"),
20 ENABLE(1, "上架"),; 20 ENABLE(1, "上架"),;
21 21
22 - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductSpuStatusEnum::getStyle).toArray(); 22 + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductSpuStatusEnum::getStatus).toArray();
23 23
24 /** 24 /**
25 * 状态 25 * 状态
26 */ 26 */
27 - private final Integer style; 27 + private final Integer status;
28 /** 28 /**
29 * 状态名 29 * 状态名
30 */ 30 */
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApiImpl.java
1 package cn.iocoder.yudao.module.product.api.sku; 1 package cn.iocoder.yudao.module.product.api.sku;
2 2
3 -import cn.iocoder.yudao.module.product.api.sku.dto.SkuDecrementStockBatchReqDTO;  
4 -import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO; 3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
  5 +import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
  6 +import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert;
  7 +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
  8 +import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
5 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
  10 +import org.springframework.validation.annotation.Validated;
6 11
  12 +import javax.annotation.Resource;
7 import java.util.Collection; 13 import java.util.Collection;
  14 +import java.util.Collections;
8 import java.util.List; 15 import java.util.List;
9 16
10 /** 17 /**
11 - * todo 注释 18 + * TODO LeeYan9: 类注释;
  19 + * @author LeeYan9
  20 + * @since 2022-09-06
12 */ 21 */
13 @Service 22 @Service
  23 +@Validated
14 public class ProductSkuApiImpl implements ProductSkuApi { 24 public class ProductSkuApiImpl implements ProductSkuApi {
15 25
  26 + @Resource
  27 + private ProductSkuService productSkuService;
  28 +
16 @Override 29 @Override
17 - public List<SkuInfoRespDTO> getSkusByIds(Collection<Long> skuIds) { 30 + public ProductSkuRespDTO getSku(Long id) {
  31 + // TODO TODO LeeYan9: 需要实现
18 return null; 32 return null;
19 } 33 }
20 34
21 @Override 35 @Override
22 - public void decrementStockBatch(SkuDecrementStockBatchReqDTO batchReqDTO) { 36 + public List<ProductSkuRespDTO> getSkuList(Collection<Long> ids) {
  37 + if (CollUtil.isEmpty(ids)) {
  38 + return Collections.emptyList();
  39 + }
  40 + List<ProductSkuDO> skus = productSkuService.getSkuList(ids);
  41 + return ProductSkuConvert.INSTANCE.convertList04(skus);
  42 + }
23 43
  44 + @Override
  45 + public void updateSkuStock(ProductSkuUpdateStockReqDTO updateStockReqDTO) {
  46 + productSkuService.updateSkuStock(updateStockReqDTO);
24 } 47 }
25 48
26 } 49 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApiImpl.java
1 package cn.iocoder.yudao.module.product.api.spu; 1 package cn.iocoder.yudao.module.product.api.spu;
2 2
3 -import cn.iocoder.yudao.module.product.api.spu.dto.SpuInfoRespDTO; 3 +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
  4 +import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
  5 +import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert;
  6 +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
  7 +import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper;
4 import org.springframework.stereotype.Service; 8 import org.springframework.stereotype.Service;
  9 +import org.springframework.validation.annotation.Validated;
5 10
  11 +import javax.annotation.Resource;
6 import java.util.Collection; 12 import java.util.Collection;
  13 +import java.util.Collections;
7 import java.util.List; 14 import java.util.List;
8 15
9 /** 16 /**
10 - * todo 注释 17 + * TODO LeeYan9: 类注释;
  18 + *
  19 + * @author LeeYan9
  20 + * @since 2022-09-06
11 */ 21 */
12 @Service 22 @Service
  23 +@Validated
13 public class ProductSpuApiImpl implements ProductSpuApi { 24 public class ProductSpuApiImpl implements ProductSpuApi {
14 25
  26 + @Resource
  27 + private ProductSpuMapper productSpuMapper;
  28 +
15 @Override 29 @Override
16 - public List<SpuInfoRespDTO> getSpusByIds(Collection<Long> spuIds) {  
17 - return null; 30 + public List<ProductSpuRespDTO> getSpuList(Collection<Long> spuIds) {
  31 + // TODO TODO LeeYan9: AllEmpty?
  32 + if (CollectionUtils.isAnyEmpty(spuIds)) {
  33 + return Collections.emptyList();
  34 + }
  35 + List<ProductSpuDO> productSpuDOList = productSpuMapper.selectBatchIds(spuIds);
  36 + return ProductSpuConvert.INSTANCE.convertList2(productSpuDOList);
18 } 37 }
19 -  
20 } 38 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java
@@ -2,10 +2,7 @@ package cn.iocoder.yudao.module.product.controller.admin.property; @@ -2,10 +2,7 @@ package cn.iocoder.yudao.module.product.controller.admin.property;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 -import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyAndValueRespVO;  
6 -import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyCreateReqVO;  
7 -import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyPageReqVO;  
8 -import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyUpdateReqVO; 5 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.*;
9 import cn.iocoder.yudao.module.product.service.property.ProductPropertyService; 6 import cn.iocoder.yudao.module.product.service.property.ProductPropertyService;
10 import io.swagger.annotations.Api; 7 import io.swagger.annotations.Api;
11 import io.swagger.annotations.ApiImplicitParam; 8 import io.swagger.annotations.ApiImplicitParam;
@@ -17,6 +14,8 @@ import org.springframework.web.bind.annotation.*; @@ -17,6 +14,8 @@ import org.springframework.web.bind.annotation.*;
17 import javax.annotation.Resource; 14 import javax.annotation.Resource;
18 import javax.validation.Valid; 15 import javax.validation.Valid;
19 16
  17 +import java.util.List;
  18 +
20 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 19 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
21 20
22 @Api(tags = "管理后台 - 规格名称") 21 @Api(tags = "管理后台 - 规格名称")
@@ -56,15 +55,29 @@ public class ProductPropertyController { @@ -56,15 +55,29 @@ public class ProductPropertyController {
56 @ApiOperation("获得规格名称") 55 @ApiOperation("获得规格名称")
57 @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) 56 @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
58 @PreAuthorize("@ss.hasPermission('product:property:query')") 57 @PreAuthorize("@ss.hasPermission('product:property:query')")
59 - public CommonResult<ProductPropertyAndValueRespVO> getProperty(@RequestParam("id") Long id) {  
60 - return success(productPropertyService.getPropertyResp(id)); 58 + public CommonResult<ProductPropertyRespVO> getProperty(@RequestParam("id") Long id) {
  59 + return success(productPropertyService.getProperty(id));
  60 + }
  61 +
  62 + @GetMapping("/list")
  63 + @ApiOperation("获得规格名称列表")
  64 + @PreAuthorize("@ss.hasPermission('product:property:query')")
  65 + public CommonResult<List<ProductPropertyRespVO>> getPropertyList(@Valid ProductPropertyListReqVO listReqVO) {
  66 + return success(productPropertyService.getPropertyList(listReqVO));
61 } 67 }
62 68
63 @GetMapping("/page") 69 @GetMapping("/page")
64 @ApiOperation("获得规格名称分页") 70 @ApiOperation("获得规格名称分页")
65 @PreAuthorize("@ss.hasPermission('product:property:query')") 71 @PreAuthorize("@ss.hasPermission('product:property:query')")
66 - public CommonResult<PageResult<ProductPropertyAndValueRespVO>> getPropertyPage(@Valid ProductPropertyPageReqVO pageVO) {  
67 - return success(productPropertyService.getPropertyListPage(pageVO)); 72 + public CommonResult<PageResult<ProductPropertyRespVO>> getPropertyPage(@Valid ProductPropertyPageReqVO pageVO) {
  73 + return success(productPropertyService.getPropertyPage(pageVO));
  74 + }
  75 +
  76 + @GetMapping("/listAndValue")
  77 + @ApiOperation("获得规格名称列表")
  78 + @PreAuthorize("@ss.hasPermission('product:property:query')")
  79 + public CommonResult<List<ProductPropertyAndValueRespVO>> getPropertyAndValueList(@Valid ProductPropertyListReqVO listReqVO) {
  80 + return success(productPropertyService.getPropertyAndValueList(listReqVO));
68 } 81 }
69 82
70 } 83 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyValueController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.product.controller.admin.property;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyPageReqVO;
  6 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;
  7 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO;
  8 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;
  9 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
  10 +import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService;
  11 +import io.swagger.annotations.Api;
  12 +import io.swagger.annotations.ApiImplicitParam;
  13 +import io.swagger.annotations.ApiOperation;
  14 +import org.springframework.security.access.prepost.PreAuthorize;
  15 +import org.springframework.validation.annotation.Validated;
  16 +import org.springframework.web.bind.annotation.*;
  17 +
  18 +import javax.annotation.Resource;
  19 +import javax.validation.Valid;
  20 +
  21 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  22 +
  23 +@Api(tags = "管理后台 - 规格值名称")
  24 +@RestController
  25 +@RequestMapping("/product/property/value")
  26 +@Validated
  27 +public class ProductPropertyValueController {
  28 +
  29 + @Resource
  30 + private ProductPropertyValueService productPropertyValueService;
  31 +
  32 + @PostMapping("/create")
  33 + @ApiOperation("创建规格名称")
  34 + @PreAuthorize("@ss.hasPermission('product:property:create')")
  35 + public CommonResult<Long> createProperty(@Valid @RequestBody ProductPropertyValueCreateReqVO createReqVO) {
  36 + return success(productPropertyValueService.createPropertyValue(createReqVO));
  37 + }
  38 +
  39 + @PutMapping("/update")
  40 + @ApiOperation("更新规格名称")
  41 + @PreAuthorize("@ss.hasPermission('product:property:update')")
  42 + public CommonResult<Boolean> updateProperty(@Valid @RequestBody ProductPropertyValueUpdateReqVO updateReqVO) {
  43 + productPropertyValueService.updatePropertyValue(updateReqVO);
  44 + return success(true);
  45 + }
  46 +
  47 + @DeleteMapping("/delete")
  48 + @ApiOperation("删除规格名称")
  49 + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
  50 + @PreAuthorize("@ss.hasPermission('product:property:delete')")
  51 + public CommonResult<Boolean> deleteProperty(@RequestParam("id") Long id) {
  52 + productPropertyValueService.deletePropertyValue(id);
  53 + return success(true);
  54 + }
  55 +
  56 + @GetMapping("/get")
  57 + @ApiOperation("获得规格名称")
  58 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
  59 + @PreAuthorize("@ss.hasPermission('product:property:query')")
  60 + public CommonResult<ProductPropertyValueRespVO> getProperty(@RequestParam("id") Long id) {
  61 + return success(productPropertyValueService.getPropertyValue(id));
  62 + }
  63 +
  64 + @GetMapping("/page")
  65 + @ApiOperation("获得规格名称分页")
  66 + @PreAuthorize("@ss.hasPermission('product:property:query')")
  67 + public CommonResult<PageResult<ProductPropertyValueRespVO>> getPropertyValuePage(@Valid ProductPropertyValuePageReqVO pageVO) {
  68 + return success(productPropertyValueService.getPropertyValueListPage(pageVO));
  69 + }
  70 +}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyBaseVO.java
@@ -3,21 +3,25 @@ package cn.iocoder.yudao.module.product.controller.admin.property.vo.property; @@ -3,21 +3,25 @@ package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
3 import io.swagger.annotations.ApiModelProperty; 3 import io.swagger.annotations.ApiModelProperty;
4 import lombok.Data; 4 import lombok.Data;
5 5
6 -import javax.validation.constraints.NotEmpty; 6 +import javax.validation.constraints.NotBlank;
  7 +import javax.validation.constraints.NotNull;
7 8
8 /** 9 /**
9 -* 规格名称 Base VO,提供给添加、修改、详细的子 VO 使用  
10 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
11 -*/ 10 + * 规格名称 Base VO,提供给添加、修改、详细的子 VO 使用
  11 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  12 + */
12 @Data 13 @Data
13 public class ProductPropertyBaseVO { 14 public class ProductPropertyBaseVO {
14 15
15 @ApiModelProperty(value = "规格名称", required = true, example = "颜色") 16 @ApiModelProperty(value = "规格名称", required = true, example = "颜色")
16 - @NotEmpty(message = "规格名称不能为空") 17 + @NotBlank(message = "规格名称不能为空")
17 private String name; 18 private String name;
18 19
  20 + @ApiModelProperty(value = "备注", example = "颜色")
  21 + private String remark;
  22 +
19 @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举") 23 @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
20 - @NotEmpty(message = "状态不能为空") 24 + @NotNull(message = "状态不能为空")
21 private Integer status; 25 private Integer status;
22 26
23 } 27 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyCreateReqVO.java
1 package cn.iocoder.yudao.module.product.controller.admin.property.vo.property; 1 package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
2 2
3 -import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;  
4 -import lombok.*;  
5 -import io.swagger.annotations.*;  
6 -  
7 -import javax.validation.constraints.NotNull;  
8 -import java.util.List; 3 +import io.swagger.annotations.ApiModel;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +import lombok.ToString;
9 7
10 @ApiModel("管理后台 - 规格名称创建 Request VO") 8 @ApiModel("管理后台 - 规格名称创建 Request VO")
11 @Data 9 @Data
@@ -13,9 +11,5 @@ import java.util.List; @@ -13,9 +11,5 @@ import java.util.List;
13 @ToString(callSuper = true) 11 @ToString(callSuper = true)
14 public class ProductPropertyCreateReqVO extends ProductPropertyBaseVO { 12 public class ProductPropertyCreateReqVO extends ProductPropertyBaseVO {
15 13
16 - // TODO @Luowenfeng:规格值的 CRUD 可以单独;前端 + 后端,改成类似字典类型、字典数据的这种交互;在加一个 ProductPropertyValueController  
17 - @ApiModelProperty(value = "属性值")  
18 - @NotNull(message = "属性值不能为空")  
19 - List<ProductPropertyValueCreateReqVO> propertyValueList;  
20 14
21 } 15 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyListReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +import lombok.ToString;
  7 +
  8 +@ApiModel("管理后台 - 规格名称 List Request VO")
  9 +@Data
  10 +@ToString(callSuper = true)
  11 +public class ProductPropertyListReqVO {
  12 +
  13 + @ApiModelProperty(value = "规格名称", example = "颜色")
  14 + private String name;
  15 +
  16 + @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
  17 + private Integer status;
  18 +
  19 +}
yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteRespVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyRespVO.java
1 -package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo; 1 +package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
2 2
3 -import lombok.*; 3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +import lombok.EqualsAndHashCode;
  7 +import lombok.ToString;
4 8
5 import java.time.LocalDateTime; 9 import java.time.LocalDateTime;
6 -import io.swagger.annotations.*;  
7 10
8 -@ApiModel("管理后台 - 优惠券模板 Response VO") 11 +@ApiModel("管理后台 - 规格 + 规格值 Response VO")
9 @Data 12 @Data
10 @EqualsAndHashCode(callSuper = true) 13 @EqualsAndHashCode(callSuper = true)
11 @ToString(callSuper = true) 14 @ToString(callSuper = true)
12 -public class CouponTempleteRespVO extends CouponTempleteBaseVO { 15 +public class ProductPropertyRespVO extends ProductPropertyBaseVO {
13 16
14 - @ApiModelProperty(value = "用户ID", required = true) 17 + @ApiModelProperty(value = "规格的编号", required = true, example = "1024")
15 private Long id; 18 private Long id;
16 19
17 @ApiModelProperty(value = "创建时间", required = true) 20 @ApiModelProperty(value = "创建时间", required = true)
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyUpdateReqVO.java
@@ -16,8 +16,4 @@ public class ProductPropertyUpdateReqVO extends ProductPropertyBaseVO { @@ -16,8 +16,4 @@ public class ProductPropertyUpdateReqVO extends ProductPropertyBaseVO {
16 @NotNull(message = "主键不能为空") 16 @NotNull(message = "主键不能为空")
17 private Long id; 17 private Long id;
18 18
19 - @ApiModelProperty(value = "属性值")  
20 - @NotNull(message = "属性值不能为空")  
21 - List<ProductPropertyValueCreateReqVO> propertyValueList;  
22 -  
23 } 19 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueBaseVO.java
@@ -22,7 +22,10 @@ public class ProductPropertyValueBaseVO { @@ -22,7 +22,10 @@ public class ProductPropertyValueBaseVO {
22 private String name; 22 private String name;
23 23
24 @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举") 24 @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
25 - @NotEmpty(message = "状态不能为空") 25 + @NotNull(message = "状态不能为空")
26 private Integer status; 26 private Integer status;
27 27
  28 + @ApiModelProperty(value = "备注", example = "颜色")
  29 + private String remark;
  30 +
28 } 31 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValuePageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.product.controller.admin.property.vo.value;
  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 +import lombok.ToString;
  9 +import org.springframework.format.annotation.DateTimeFormat;
  10 +
  11 +import javax.validation.constraints.NotEmpty;
  12 +import java.util.Date;
  13 +
  14 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  15 +
  16 +@ApiModel("管理后台 - 规格名称值分页 Request VO")
  17 +@Data
  18 +@EqualsAndHashCode(callSuper = true)
  19 +@ToString(callSuper = true)
  20 +public class ProductPropertyValuePageReqVO extends PageParam {
  21 +
  22 + @ApiModelProperty(value = "规格id", example = "1024")
  23 + private String propertyId;
  24 +
  25 + @ApiModelProperty(value = "规格值", example = "红色")
  26 + private String name;
  27 +
  28 + @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
  29 + private Integer status;
  30 +
  31 +}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueUpdateReqVO.java
@@ -12,6 +12,6 @@ public class ProductPropertyValueUpdateReqVO extends ProductPropertyValueBaseVO @@ -12,6 +12,6 @@ public class ProductPropertyValueUpdateReqVO extends ProductPropertyValueBaseVO
12 12
13 @ApiModelProperty(value = "主键", required = true, example = "1024") 13 @ApiModelProperty(value = "主键", required = true, example = "1024")
14 @NotNull(message = "主键不能为空") 14 @NotNull(message = "主键不能为空")
15 - private Integer id; 15 + private Long id;
16 16
17 } 17 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java
1 package cn.iocoder.yudao.module.product.controller.admin.sku; 1 package cn.iocoder.yudao.module.product.controller.admin.sku;
2 2
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  5 +import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
  6 +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuOptionRespVO;
  7 +import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert;
  8 +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
  9 +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
  10 +import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
  11 +import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
3 import io.swagger.annotations.Api; 12 import io.swagger.annotations.Api;
  13 +import io.swagger.annotations.ApiOperation;
4 import org.springframework.validation.annotation.Validated; 14 import org.springframework.validation.annotation.Validated;
  15 +import org.springframework.web.bind.annotation.GetMapping;
5 import org.springframework.web.bind.annotation.RequestMapping; 16 import org.springframework.web.bind.annotation.RequestMapping;
6 import org.springframework.web.bind.annotation.RestController; 17 import org.springframework.web.bind.annotation.RestController;
7 18
  19 +import javax.annotation.Resource;
  20 +import java.util.Collections;
  21 +import java.util.List;
  22 +import java.util.Map;
  23 +
  24 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  25 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
  26 +
8 @Api(tags = "管理后台 - 商品 sku") 27 @Api(tags = "管理后台 - 商品 sku")
9 @RestController 28 @RestController
10 @RequestMapping("/product/sku") 29 @RequestMapping("/product/sku")
11 @Validated 30 @Validated
12 public class ProductSkuController { 31 public class ProductSkuController {
13 32
  33 + @Resource
  34 + private ProductSkuService productSkuService;
  35 + @Resource
  36 + private ProductSpuService productSpuService;
  37 +
  38 + @GetMapping("/get-option-list")
  39 + @ApiOperation("获得商品 SKU 选项的列表")
  40 +// @PreAuthorize("@ss.hasPermission('product:sku:query')")
  41 + public CommonResult<List<ProductSkuOptionRespVO>> getSkuOptionList() {
  42 + // 获得 SKU 列表
  43 + List<ProductSkuDO> skus = productSkuService.getSkuList();
  44 + if (CollUtil.isEmpty(skus)) {
  45 + return success(Collections.emptyList());
  46 + }
  47 +
  48 + // 获得对应的 SPU 映射
  49 + Map<Long, ProductSpuDO> spuMap = productSpuService.getSpuMap(convertSet(skus, ProductSkuDO::getSpuId));
  50 + // 转换为返回结果
  51 + List<ProductSkuOptionRespVO> skuVOs = ProductSkuConvert.INSTANCE.convertList05(skus);
  52 + skuVOs.forEach(sku -> MapUtils.findAndThen(spuMap, sku.getSpuId(),
  53 + spu -> sku.setSpuId(spu.getId()).setSpuName(spu.getName())));
  54 + return success(skuVOs);
  55 + }
  56 +
14 } 57 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java
@@ -33,7 +33,7 @@ public class ProductSkuBaseVO { @@ -33,7 +33,7 @@ public class ProductSkuBaseVO {
33 @ApiModelProperty(value = "条形码", example = "haha") 33 @ApiModelProperty(value = "条形码", example = "haha")
34 private String barCode; 34 private String barCode;
35 35
36 - @ApiModelProperty(value = "图片地址") 36 + @ApiModelProperty(value = "图片地址", required = true, example = "https://www.iocoder.cn/xx.png")
37 @NotNull(message = "图片地址不能为空") 37 @NotNull(message = "图片地址不能为空")
38 private String picUrl; 38 private String picUrl;
39 39
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java
@@ -14,8 +14,7 @@ import java.util.List; @@ -14,8 +14,7 @@ import java.util.List;
14 @ToString(callSuper = true) 14 @ToString(callSuper = true)
15 public class ProductSkuCreateOrUpdateReqVO extends ProductSkuBaseVO { 15 public class ProductSkuCreateOrUpdateReqVO extends ProductSkuBaseVO {
16 16
17 - // TODO @Luowenfeng:可以不用哈,如果基于规格匹配  
18 - @ApiModelProperty(value = "商品 id 更新时须有", example = "1") 17 + @ApiModelProperty(value = "商品 SKU 编号", example = "1")
19 private Long id; 18 private Long id;
20 19
21 /** 20 /**
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuOptionRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.product.controller.admin.sku.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +@ApiModel(value = "管理后台 - 商品 SKU 选项 Response VO", description = "用于前端 SELECT 选项")
  8 +@Data
  9 +public class ProductSkuOptionRespVO {
  10 +
  11 + @ApiModelProperty(value = "主键", required = true, example = "1024")
  12 + private Long id;
  13 +
  14 + @ApiModelProperty(value = "商品 SKU 名字", example = "红色")
  15 + private String name;
  16 +
  17 + @ApiModelProperty(value = "销售价格", required = true, example = "100", notes = "单位:分")
  18 + private String price;
  19 +
  20 + @ApiModelProperty(value = "库存", required = true, example = "100")
  21 + private Integer stock;
  22 +
  23 + // ========== 商品 SPU 信息 ==========
  24 +
  25 + @ApiModelProperty(value = "商品 SPU 编号", required = true, example = "1")
  26 + private Long spuId;
  27 +
  28 + @ApiModelProperty(value = "商品 SPU 名字", required = true, example = "iPhone 11")
  29 + private String spuName;
  30 +
  31 +}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java
@@ -9,7 +9,7 @@ import lombok.ToString; @@ -9,7 +9,7 @@ import lombok.ToString;
9 import java.time.LocalDateTime; 9 import java.time.LocalDateTime;
10 import java.util.List; 10 import java.util.List;
11 11
12 -@ApiModel("管理后台 - 商品sku Response VO") 12 +@ApiModel("管理后台 - 商品 SKU Response VO")
13 @Data 13 @Data
14 @EqualsAndHashCode(callSuper = true) 14 @EqualsAndHashCode(callSuper = true)
15 @ToString(callSuper = true) 15 @ToString(callSuper = true)
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java
@@ -2,10 +2,7 @@ package cn.iocoder.yudao.module.product.controller.admin.spu; @@ -2,10 +2,7 @@ package cn.iocoder.yudao.module.product.controller.admin.spu;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuCreateReqVO;  
6 -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuRespVO;  
7 -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuUpdateReqVO;  
8 -import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageReqVO; 5 +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*;
9 import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; 6 import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert;
10 import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; 7 import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
11 import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; 8 import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
@@ -56,6 +53,15 @@ public class ProductSpuController { @@ -56,6 +53,15 @@ public class ProductSpuController {
56 return success(true); 53 return success(true);
57 } 54 }
58 55
  56 + // TODO 芋艿:修改接口
  57 + @GetMapping("/get/detail")
  58 + @ApiOperation("获得商品 SPU")
  59 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
  60 + @PreAuthorize("@ss.hasPermission('product:spu:query')")
  61 + public CommonResult<ProductSpuDetailRespVO> getSpuDetail(@RequestParam("id") Long id) {
  62 + return success(spuService.getSpuDetail(id));
  63 + }
  64 +
59 @GetMapping("/get") 65 @GetMapping("/get")
60 @ApiOperation("获得商品 SPU") 66 @ApiOperation("获得商品 SPU")
61 @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) 67 @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@@ -64,7 +70,6 @@ public class ProductSpuController { @@ -64,7 +70,6 @@ public class ProductSpuController {
64 return success(spuService.getSpu(id)); 70 return success(spuService.getSpu(id));
65 } 71 }
66 72
67 - // TODO @luowenfeng:新增 get-detail,返回 SpuDetailRespVO  
68 73
69 @GetMapping("/list") 74 @GetMapping("/list")
70 @ApiOperation("获得商品 SPU 列表") 75 @ApiOperation("获得商品 SPU 列表")
@@ -75,6 +80,14 @@ public class ProductSpuController { @@ -75,6 +80,14 @@ public class ProductSpuController {
75 return success(ProductSpuConvert.INSTANCE.convertList(list)); 80 return success(ProductSpuConvert.INSTANCE.convertList(list));
76 } 81 }
77 82
  83 + @GetMapping("/get-simple-list")
  84 + @ApiOperation("获得商品 SPU 精简列表")
  85 + @PreAuthorize("@ss.hasPermission('product:spu:query')")
  86 + public CommonResult<List<ProductSpuSimpleRespVO>> getSpuSimpleList() {
  87 + List<ProductSpuDO> list = spuService.getSpuList();
  88 + return success(ProductSpuConvert.INSTANCE.convertList02(list));
  89 + }
  90 +
78 @GetMapping("/page") 91 @GetMapping("/page")
79 @ApiOperation("获得商品 SPU 分页") 92 @ApiOperation("获得商品 SPU 分页")
80 @PreAuthorize("@ss.hasPermission('product:spu:query')") 93 @PreAuthorize("@ss.hasPermission('product:spu:query')")
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java
@@ -24,7 +24,7 @@ public class ProductSpuBaseVO { @@ -24,7 +24,7 @@ public class ProductSpuBaseVO {
24 @ApiModelProperty(value = "商品编码", example = "yudaoyuanma") 24 @ApiModelProperty(value = "商品编码", example = "yudaoyuanma")
25 private String code; 25 private String code;
26 26
27 - @ApiModelProperty(value = "商品卖点", example = "好吃!") 27 + @ApiModelProperty(value = "促销语", example = "好吃!")
28 private String sellPoint; 28 private String sellPoint;
29 29
30 @ApiModelProperty(value = "商品详情", required = true, example = "我是商品描述") 30 @ApiModelProperty(value = "商品详情", required = true, example = "我是商品描述")
@@ -67,6 +67,9 @@ public class ProductSpuBaseVO { @@ -67,6 +67,9 @@ public class ProductSpuBaseVO {
67 @ApiModelProperty(value = "库存", required = true, example = "true") 67 @ApiModelProperty(value = "库存", required = true, example = "true")
68 private Integer totalStock; 68 private Integer totalStock;
69 69
  70 + @ApiModelProperty(value = "市场价", example = "1024")
  71 + private Integer marketPrice;
  72 +
70 @ApiModelProperty(value = " 最小价格,单位使用:分", required = true, example = "1024") 73 @ApiModelProperty(value = " 最小价格,单位使用:分", required = true, example = "1024")
71 private Integer minPrice; 74 private Integer minPrice;
72 75
@@ -75,10 +78,14 @@ public class ProductSpuBaseVO { @@ -75,10 +78,14 @@ public class ProductSpuBaseVO {
75 78
76 // ========== 统计相关字段 ========= 79 // ========== 统计相关字段 =========
77 80
  81 + @ApiModelProperty(value = "商品销量", example = "1024")
  82 + private Integer salesCount;
  83 +
78 @ApiModelProperty(value = "虚拟销量", required = true, example = "1024") 84 @ApiModelProperty(value = "虚拟销量", required = true, example = "1024")
79 @NotNull(message = "虚拟销量不能为空") 85 @NotNull(message = "虚拟销量不能为空")
80 private Integer virtualSalesCount; 86 private Integer virtualSalesCount;
81 87
82 @ApiModelProperty(value = "点击量", example = "1024") 88 @ApiModelProperty(value = "点击量", example = "1024")
83 private Integer clickCount; 89 private Integer clickCount;
  90 +
84 } 91 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java
1 package cn.iocoder.yudao.module.product.controller.admin.spu.vo; 1 package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
2 2
  3 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPropertyViewRespVO;
3 import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuBaseVO; 4 import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuBaseVO;
4 import io.swagger.annotations.ApiModel; 5 import io.swagger.annotations.ApiModel;
5 import io.swagger.annotations.ApiModelProperty; 6 import io.swagger.annotations.ApiModelProperty;
@@ -54,4 +55,11 @@ public class ProductSpuDetailRespVO extends ProductSpuBaseVO { @@ -54,4 +55,11 @@ public class ProductSpuDetailRespVO extends ProductSpuBaseVO {
54 55
55 } 56 }
56 57
  58 + @ApiModelProperty(value = "分类 id 数组,一直递归到一级父节点", example = "4")
  59 + private Long categoryId;
  60 +
  61 + // TODO @芋艿:在瞅瞅~
  62 + @ApiModelProperty(value = "规格属性修改和详情展示组合", example = "[{\"propertyId\":2,\"name\":\"内存\",\"propertyValues\":[{\"v1\":11,\"v2\":\"64G\"},{\"v1\":10,\"v2\":\"32G\"}]},{\"propertyId\":3,\"name\":\"尺寸\",\"propertyValues\":[{\"v1\":16,\"v2\":\"6.1\"},{\"v1\":15,\"v2\":\"5.7\"}]}]")
  63 + private List<ProductPropertyViewRespVO> productPropertyViews;
  64 +
57 } 65 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java
1 package cn.iocoder.yudao.module.product.controller.admin.spu.vo; 1 package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
2 2
3 -import lombok.*;  
4 -  
5 -import java.time.LocalDateTime;  
6 -import io.swagger.annotations.*;  
7 import cn.iocoder.yudao.framework.common.pojo.PageParam; 3 import cn.iocoder.yudao.framework.common.pojo.PageParam;
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; 4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +import lombok.EqualsAndHashCode;
  8 +import lombok.ToString;
11 9
12 @ApiModel("管理后台 - 商品 SPU 分页 Request VO") 10 @ApiModel("管理后台 - 商品 SPU 分页 Request VO")
13 @Data 11 @Data
@@ -15,38 +13,34 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -15,38 +13,34 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
15 @ToString(callSuper = true) 13 @ToString(callSuper = true)
16 public class ProductSpuPageReqVO extends PageParam { 14 public class ProductSpuPageReqVO extends PageParam {
17 15
18 - @ApiModelProperty(value = "商品名称") 16 + @ApiModelProperty(value = "商品名称", example = "yutou")
19 private String name; 17 private String name;
20 18
21 - @ApiModelProperty(value = "卖点")  
22 - private String sellPoint;  
23 -  
24 - @ApiModelProperty(value = "描述")  
25 - private String description; 19 + @ApiModelProperty(value = "商品编码", example = "yudaoyuanma")
  20 + private String code;
26 21
27 - @ApiModelProperty(value = "分类id") 22 + @ApiModelProperty(value = "分类id", example = "1")
28 private Long categoryId; 23 private Long categoryId;
29 24
30 - @ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张")  
31 - private String picUrls; 25 + @ApiModelProperty(value = "商品品牌编号", example = "1")
  26 + private Long brandId;
32 27
33 - @ApiModelProperty(value = "排序字段")  
34 - private Integer sort; 28 + @ApiModelProperty(value = "上下架状态", example = "1", notes = "参见 ProductSpuStatusEnum 枚举值")
  29 + private Integer status;
35 30
36 - @ApiModelProperty(value = "点赞初始人数")  
37 - private Integer likeCount; 31 + @ApiModelProperty(value = "销量最小值", example = "1")
  32 + private Integer salesCountMin;
38 33
39 - @ApiModelProperty(value = "价格 单位使用:分")  
40 - private Integer price; 34 + @ApiModelProperty(value = "销量最大值", example = "1024")
  35 + private Integer salesCountMax;
41 36
42 - @ApiModelProperty(value = "库存数量")  
43 - private Integer quantity; 37 + @ApiModelProperty(value = "市场价最小值", example = "1")
  38 + private Integer marketPriceMin;
44 39
45 - @ApiModelProperty(value = "上下架状态: 0 上架(开启) 1 下架(禁用)")  
46 - private Integer status; 40 + @ApiModelProperty(value = "市场价最大值", example = "1024")
  41 + private Integer marketPriceMax;
47 42
48 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
49 - @ApiModelProperty(value = "创建时间")  
50 - private LocalDateTime[] createTime; 43 + @ApiModelProperty(value = "是否库存告警", example = "true")
  44 + private Boolean alarmStock;
51 45
52 } 46 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java
1 package cn.iocoder.yudao.module.product.controller.admin.spu.vo; 1 package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
2 2
3 -import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPropertyViewRespVO;  
4 -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO;  
5 import io.swagger.annotations.ApiModel; 3 import io.swagger.annotations.ApiModel;
6 import io.swagger.annotations.ApiModelProperty; 4 import io.swagger.annotations.ApiModelProperty;
7 import lombok.Data; 5 import lombok.Data;
@@ -11,7 +9,6 @@ import lombok.ToString; @@ -11,7 +9,6 @@ import lombok.ToString;
11 import java.time.LocalDateTime; 9 import java.time.LocalDateTime;
12 import java.util.List; 10 import java.util.List;
13 11
14 -// TODO @Luowenfeng:这个类只返回 SPU 相关的信息,删除 skus、categoryIds、productPropertyViews;明细使用 SpuDetailRespVO 替代  
15 @ApiModel("管理后台 - 商品 SPU Response VO") 12 @ApiModel("管理后台 - 商品 SPU Response VO")
16 @Data 13 @Data
17 @EqualsAndHashCode(callSuper = true) 14 @EqualsAndHashCode(callSuper = true)
@@ -24,18 +21,4 @@ public class ProductSpuRespVO extends ProductSpuBaseVO { @@ -24,18 +21,4 @@ public class ProductSpuRespVO extends ProductSpuBaseVO {
24 @ApiModelProperty(value = "创建时间") 21 @ApiModelProperty(value = "创建时间")
25 private LocalDateTime createTime; 22 private LocalDateTime createTime;
26 23
27 - /**  
28 - * SKU 数组  
29 - */  
30 - @ApiModelProperty(value = "sku 数组", example = "[{\"spuId\":4,\"properties\":[{\"propertyId\":3,\"valueId\":15},{\"propertyId\":2,\"valueId\":10}],\"price\":12,\"originalPrice\":32,\"costPrice\":22,\"barCode\":\"765670123123\",\"picUrl\":\"http://test.yudao.iocoder.cn/72938088f1ca8438837c3b51394aea43.jpg\",\"status\":0,\"id\":7,\"createTime\":1656683270000},{\"spuId\":4,\"properties\":[{\"propertyId\":3,\"valueId\":15},{\"propertyId\":2,\"valueId\":11}],\"price\":13,\"originalPrice\":33,\"costPrice\":23,\"barCode\":\"888788770999\",\"picUrl\":\"http://test.yudao.iocoder.cn/6b902c700e5d32e862b6fd9af2e1c0e4.jpg\",\"status\":0,\"id\":8,\"createTime\":1656683270000},{\"spuId\":4,\"properties\":[{\"propertyId\":3,\"valueId\":16},{\"propertyId\":2,\"valueId\":10}],\"price\":14,\"originalPrice\":34,\"costPrice\":24,\"barCode\":\"9999981212\",\"picUrl\":\"http://test.yudao.iocoder.cn/eddf3c79b1917160d94d05244e1f47da.jpg\",\"status\":0,\"id\":9,\"createTime\":1656683270000},{\"spuId\":4,\"properties\":[{\"propertyId\":3,\"valueId\":16},{\"propertyId\":2,\"valueId\":11}],\"price\":15,\"originalPrice\":35,\"costPrice\":25,\"barCode\":\"4444121212\",\"picUrl\":\"http://test.yudao.iocoder.cn/88ac3eb068ea9cfac4726879b2776ccf.jpg\",\"status\":0,\"id\":10,\"createTime\":1656683270000}]")  
31 - private List<ProductSkuRespVO> skus;  
32 -  
33 - @ApiModelProperty(value = "分类id数组,一直递归到一级父节点", example = "[1,2,4]")  
34 - private List<Long> categoryIds;  
35 -  
36 - // TODO @芋艿:再琢磨下 这个 VO 类,其实变成 SpuRespVO 内嵌的 VO 类会更好一点;然后把 SpuRespVO 改成 SpuDetailSpuVO  
37 -  
38 - @ApiModelProperty(value = "规格属性修改和详情展示组合", example = "[{\"propertyId\":2,\"name\":\"内存\",\"propertyValues\":[{\"v1\":11,\"v2\":\"64G\"},{\"v1\":10,\"v2\":\"32G\"}]},{\"propertyId\":3,\"name\":\"尺寸\",\"propertyValues\":[{\"v1\":16,\"v2\":\"6.1\"},{\"v1\":15,\"v2\":\"5.7\"}]}]")  
39 - private List<ProductPropertyViewRespVO> productPropertyViews;  
40 -  
41 } 24 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuSimpleRespVO.java 0 → 100755
  1 +package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +import lombok.EqualsAndHashCode;
  7 +import lombok.ToString;
  8 +
  9 +@ApiModel("管理后台 - 商品 SPU 精简 Response VO")
  10 +@Data
  11 +@EqualsAndHashCode(callSuper = true)
  12 +@ToString(callSuper = true)
  13 +public class ProductSpuSimpleRespVO extends ProductSpuBaseVO {
  14 +
  15 + @ApiModelProperty(value = "主键", required = true, example = "1")
  16 + private Long id;
  17 +
  18 + @ApiModelProperty(value = "商品名称", required = true, example = "芋道")
  19 + private String name;
  20 +
  21 + @ApiModelProperty(value = " 最小价格,单位使用:分", required = true, example = "1024")
  22 + private Integer minPrice;
  23 +
  24 + @ApiModelProperty(value = "最大价格,单位使用:分", required = true, example = "1024")
  25 + private Integer maxPrice;
  26 +
  27 +}
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java
@@ -3,8 +3,11 @@ package cn.iocoder.yudao.module.product.convert.property; @@ -3,8 +3,11 @@ package cn.iocoder.yudao.module.product.convert.property;
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyAndValueRespVO; 4 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyAndValueRespVO;
5 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyCreateReqVO; 5 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyCreateReqVO;
  6 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyRespVO;
6 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyUpdateReqVO; 7 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyUpdateReqVO;
  8 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;
7 import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; 9 import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
  10 +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO;
8 import org.mapstruct.Mapper; 11 import org.mapstruct.Mapper;
9 import org.mapstruct.factory.Mappers; 12 import org.mapstruct.factory.Mappers;
10 13
@@ -24,10 +27,12 @@ public interface ProductPropertyConvert { @@ -24,10 +27,12 @@ public interface ProductPropertyConvert {
24 27
25 ProductPropertyDO convert(ProductPropertyUpdateReqVO bean); 28 ProductPropertyDO convert(ProductPropertyUpdateReqVO bean);
26 29
27 - ProductPropertyAndValueRespVO convert(ProductPropertyDO bean); 30 + ProductPropertyAndValueRespVO convert(ProductPropertyRespVO bean);
28 31
29 - List<ProductPropertyAndValueRespVO> convertList(List<ProductPropertyDO> list); 32 + ProductPropertyRespVO convert(ProductPropertyDO bean);
30 33
31 - PageResult<ProductPropertyAndValueRespVO> convertPage(PageResult<ProductPropertyDO> page); 34 + List<ProductPropertyRespVO> convertList(List<ProductPropertyDO> list);
  35 +
  36 + PageResult<ProductPropertyRespVO> convertPage(PageResult<ProductPropertyDO> page);
32 37
33 } 38 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java
1 package cn.iocoder.yudao.module.product.convert.sku; 1 package cn.iocoder.yudao.module.product.convert.sku;
2 2
  3 +import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
  4 +import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
3 import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; 5 import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO;
  6 +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuOptionRespVO;
4 import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO; 7 import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO;
  8 +import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuDetailRespVO;
5 import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; 9 import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
6 import org.mapstruct.Mapper; 10 import org.mapstruct.Mapper;
7 -import org.mapstruct.Mapping;  
8 import org.mapstruct.factory.Mappers; 11 import org.mapstruct.factory.Mappers;
9 12
  13 +import java.util.HashMap;
10 import java.util.List; 14 import java.util.List;
  15 +import java.util.Map;
  16 +
  17 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
11 18
12 /** 19 /**
13 - * 商品sku Convert 20 + * 商品 SKU Convert
14 * 21 *
15 * @author 芋道源码 22 * @author 芋道源码
16 */ 23 */
@@ -21,11 +28,42 @@ public interface ProductSkuConvert { @@ -21,11 +28,42 @@ public interface ProductSkuConvert {
21 28
22 ProductSkuDO convert(ProductSkuCreateOrUpdateReqVO bean); 29 ProductSkuDO convert(ProductSkuCreateOrUpdateReqVO bean);
23 30
24 - @Mapping(source = "properties", target = "properties")  
25 ProductSkuRespVO convert(ProductSkuDO bean); 31 ProductSkuRespVO convert(ProductSkuDO bean);
26 32
27 List<ProductSkuRespVO> convertList(List<ProductSkuDO> list); 33 List<ProductSkuRespVO> convertList(List<ProductSkuDO> list);
28 34
29 List<ProductSkuDO> convertSkuDOList(List<ProductSkuCreateOrUpdateReqVO> list); 35 List<ProductSkuDO> convertSkuDOList(List<ProductSkuCreateOrUpdateReqVO> list);
30 36
  37 + ProductSkuRespDTO convert02(ProductSkuDO bean);
  38 +
  39 + List<ProductSkuRespDTO> convertList02(List<ProductSkuDO> list);
  40 +
  41 + List<ProductSpuDetailRespVO.Sku> convertList03(List<ProductSkuDO> list);
  42 +
  43 + List<ProductSkuRespDTO> convertList04(List<ProductSkuDO> list);
  44 +
  45 + List<ProductSkuOptionRespVO> convertList05(List<ProductSkuDO> skus);
  46 +
  47 + /**
  48 + * 获得 SPU 的库存变化 Map
  49 + *
  50 + * @param items SKU 库存变化
  51 + * @param skus SKU 列表
  52 + * @return SPU 的库存变化 Map
  53 + */
  54 + default Map<Long, Integer> convertSpuStockMap(List<ProductSkuUpdateStockReqDTO.Item> items,
  55 + List<ProductSkuDO> skus) {
  56 + Map<Long, Long> skuIdAndSpuIdMap = convertMap(skus, ProductSkuDO::getId, ProductSkuDO::getSpuId); // SKU 与 SKU 编号的 Map 关系
  57 + Map<Long, Integer> spuIdAndStockMap = new HashMap<>(); // SPU 的库存变化 Map 关系
  58 + items.forEach(item -> {
  59 + Long spuId = skuIdAndSpuIdMap.get(item.getId());
  60 + if (spuId == null) {
  61 + return;
  62 + }
  63 + Integer stock = spuIdAndStockMap.getOrDefault(spuId, 0) + item.getIncrCount();
  64 + spuIdAndStockMap.put(spuId, stock);
  65 + });
  66 + return spuIdAndStockMap;
  67 + }
  68 +
31 } 69 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java
1 package cn.iocoder.yudao.module.product.convert.spu; 1 package cn.iocoder.yudao.module.product.convert.spu;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
4 import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; 5 import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*;
5 import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageReqVO; 6 import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageReqVO;
6 import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageRespVO; 7 import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageRespVO;
@@ -34,4 +35,8 @@ public interface ProductSpuConvert { @@ -34,4 +35,8 @@ public interface ProductSpuConvert {
34 35
35 AppSpuPageRespVO convertAppResp(ProductSpuDO list); 36 AppSpuPageRespVO convertAppResp(ProductSpuDO list);
36 37
  38 + List<ProductSpuRespDTO> convertList2(List<ProductSpuDO> list);
  39 +
  40 + List<ProductSpuSimpleRespVO> convertList02(List<ProductSpuDO> list);
  41 +
37 } 42 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java
@@ -64,6 +64,4 @@ public class ProductCategoryDO extends BaseDO { @@ -64,6 +64,4 @@ public class ProductCategoryDO extends BaseDO {
64 */ 64 */
65 private Integer status; 65 private Integer status;
66 66
67 - // TODO 芋艿:is_recommend 是否首页推荐:1-是;0-否  
68 -  
69 } 67 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java
@@ -37,6 +37,10 @@ public class ProductPropertyDO extends BaseDO { @@ -37,6 +37,10 @@ public class ProductPropertyDO extends BaseDO {
37 * 枚举 {@link CommonStatusEnum} 37 * 枚举 {@link CommonStatusEnum}
38 */ 38 */
39 private Integer status; 39 private Integer status;
  40 + /**
  41 + * 备注
  42 + */
  43 + private String remark;
40 44
41 // TODO 芋艿:rule;规格属性 (发布商品时,和 SKU 关联);规格参数(搜索商品时,与 Category 关联搜索) 45 // TODO 芋艿:rule;规格属性 (发布商品时,和 SKU 关联);规格参数(搜索商品时,与 Category 关联搜索)
42 46
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java
@@ -44,5 +44,10 @@ public class ProductPropertyValueDO extends BaseDO { @@ -44,5 +44,10 @@ public class ProductPropertyValueDO extends BaseDO {
44 * 枚举 {@link CommonStatusEnum} 44 * 枚举 {@link CommonStatusEnum}
45 */ 45 */
46 private Integer status; 46 private Integer status;
  47 + /**
  48 + * 备注
  49 + *
  50 + */
  51 + private String remark;
47 52
48 } 53 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java
@@ -97,6 +97,8 @@ public class ProductSkuDO extends BaseDO { @@ -97,6 +97,8 @@ public class ProductSkuDO extends BaseDO {
97 * 商品属性 97 * 商品属性
98 */ 98 */
99 @Data 99 @Data
  100 + @NoArgsConstructor
  101 + @AllArgsConstructor
100 public static class Property { 102 public static class Property {
101 103
102 /** 104 /**
@@ -129,19 +131,5 @@ public class ProductSkuDO extends BaseDO { @@ -129,19 +131,5 @@ public class ProductSkuDO extends BaseDO {
129 131
130 } 132 }
131 133
132 - // TODO ========== 待定字段:yv =========  
133 - // TODO brokerage:一级返佣  
134 - // TODO brokerage_two:二级返佣  
135 - // TODO pink_price:拼团价  
136 - // TODO pink_stock:拼团库存  
137 - // TODO seckill_price:秒杀价  
138 - // TODO seckill_stock:秒杀库存  
139 - // TODO integral:需要积分  
140 -  
141 - // TODO ========== 待定字段:cf =========  
142 - // TODO type 活动显示排序 0=默认 1=秒 2=砍价 3=拼团  
143 - // TODO quota 活动限购数量  
144 - // TODO quota_show 活动限购数量显示  
145 -  
146 } 134 }
147 135
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java
@@ -47,7 +47,7 @@ public class ProductSpuDO extends BaseDO { @@ -47,7 +47,7 @@ public class ProductSpuDO extends BaseDO {
47 */ 47 */
48 private String code; 48 private String code;
49 /** 49 /**
50 - * 商品卖点 50 + * 促销语
51 */ 51 */
52 private String sellPoint; 52 private String sellPoint;
53 /** 53 /**
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyMapper.java
@@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.Pro @@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.Pro
7 import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; 7 import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
8 import org.apache.ibatis.annotations.Mapper; 8 import org.apache.ibatis.annotations.Mapper;
9 9
  10 +import java.util.List;
  11 +
10 /** 12 /**
11 * 规格名称 Mapper 13 * 规格名称 Mapper
12 * 14 *
@@ -23,4 +25,9 @@ public interface ProductPropertyMapper extends BaseMapperX&lt;ProductPropertyDO&gt; { @@ -23,4 +25,9 @@ public interface ProductPropertyMapper extends BaseMapperX&lt;ProductPropertyDO&gt; {
23 .orderByDesc(ProductPropertyDO::getId)); 25 .orderByDesc(ProductPropertyDO::getId));
24 } 26 }
25 27
  28 + default ProductPropertyDO selectByName(String name) {
  29 + return selectOne(new LambdaQueryWrapperX<ProductPropertyDO>()
  30 + .eqIfPresent(ProductPropertyDO::getName, name));
  31 + }
  32 +
26 } 33 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyValueMapper.java
1 package cn.iocoder.yudao.module.product.dal.mysql.property; 1 package cn.iocoder.yudao.module.product.dal.mysql.property;
2 2
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
3 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
4 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  6 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO;
5 import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; 7 import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO;
6 import org.apache.ibatis.annotations.Mapper; 8 import org.apache.ibatis.annotations.Mapper;
7 9
@@ -15,18 +17,28 @@ import java.util.List; @@ -15,18 +17,28 @@ import java.util.List;
15 @Mapper 17 @Mapper
16 public interface ProductPropertyValueMapper extends BaseMapperX<ProductPropertyValueDO> { 18 public interface ProductPropertyValueMapper extends BaseMapperX<ProductPropertyValueDO> {
17 19
18 - // TODO @franky:方法名,selectListByXXX。mapper 的操作都是 crud  
19 - default List<ProductPropertyValueDO> getPropertyValueListByPropertyId(List<Long> propertyIds){  
20 - // TODO @franky:调用父类的 selectList 20 + default List<ProductPropertyValueDO> selectListByPropertyId(List<Long> propertyIds) {
21 return selectList(new LambdaQueryWrapperX<ProductPropertyValueDO>() 21 return selectList(new LambdaQueryWrapperX<ProductPropertyValueDO>()
22 .inIfPresent(ProductPropertyValueDO::getPropertyId, propertyIds)); 22 .inIfPresent(ProductPropertyValueDO::getPropertyId, propertyIds));
23 } 23 }
24 24
25 - default void deletePropertyValueByPropertyId(Long propertyId){  
26 - // TODO @franky:delete(new ) 即可  
27 - LambdaQueryWrapperX<ProductPropertyValueDO> queryWrapperX = new LambdaQueryWrapperX<>();  
28 - queryWrapperX.eq(ProductPropertyValueDO::getPropertyId, propertyId)  
29 - .eq(ProductPropertyValueDO::getDeleted, false);  
30 - delete(queryWrapperX); 25 + default ProductPropertyValueDO selectByName(Long propertyId, String name) {
  26 + return selectOne(new LambdaQueryWrapperX<ProductPropertyValueDO>()
  27 + .eq(ProductPropertyValueDO::getPropertyId, propertyId)
  28 + .eq(ProductPropertyValueDO::getName, name));
31 } 29 }
  30 +
  31 + default void deletePropertyValueByPropertyId(Long propertyId) {
  32 + delete(new LambdaQueryWrapperX<ProductPropertyValueDO>().eq(ProductPropertyValueDO::getPropertyId, propertyId)
  33 + .eq(ProductPropertyValueDO::getDeleted, false));
  34 + }
  35 +
  36 + default PageResult<ProductPropertyValueDO> selectPage(ProductPropertyValuePageReqVO reqVO) {
  37 + return selectPage(reqVO, new LambdaQueryWrapperX<ProductPropertyValueDO>()
  38 + .eqIfPresent(ProductPropertyValueDO::getPropertyId, reqVO.getPropertyId())
  39 + .likeIfPresent(ProductPropertyValueDO::getName, reqVO.getName())
  40 + .eqIfPresent(ProductPropertyValueDO::getStatus, reqVO.getStatus())
  41 + .orderByDesc(ProductPropertyValueDO::getId));
  42 + }
  43 +
32 } 44 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java
1 package cn.iocoder.yudao.module.product.dal.mysql.sku; 1 package cn.iocoder.yudao.module.product.dal.mysql.sku;
2 2
  3 +import cn.hutool.core.lang.Assert;
3 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
4 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
5 import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; 6 import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
  7 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  8 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
6 import org.apache.ibatis.annotations.Mapper; 9 import org.apache.ibatis.annotations.Mapper;
7 10
8 import java.util.List; 11 import java.util.List;
@@ -15,20 +18,46 @@ import java.util.List; @@ -15,20 +18,46 @@ import java.util.List;
15 @Mapper 18 @Mapper
16 public interface ProductSkuMapper extends BaseMapperX<ProductSkuDO> { 19 public interface ProductSkuMapper extends BaseMapperX<ProductSkuDO> {
17 20
18 - // TODO @franky:方法名 selectList; 可以直接调用 selectList  
19 - default List<ProductSkuDO> selectListBySpuIds(List<Long> spuIds) {  
20 - return selectList(ProductSkuDO::getSpuId, spuIds);  
21 - }  
22 -  
23 default List<ProductSkuDO> selectListBySpuId(Long spuId) { 21 default List<ProductSkuDO> selectListBySpuId(Long spuId) {
24 return selectList(ProductSkuDO::getSpuId, spuId); 22 return selectList(ProductSkuDO::getSpuId, spuId);
25 } 23 }
26 24
27 default void deleteBySpuId(Long spuId) { 25 default void deleteBySpuId(Long spuId) {
28 - // TODO @franky:直接 delete(new XXX) 即可,更简洁一些  
29 - LambdaQueryWrapperX<ProductSkuDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<ProductSkuDO>()  
30 - .eqIfPresent(ProductSkuDO::getSpuId, spuId);  
31 - delete(lambdaQueryWrapperX); 26 + delete(new LambdaQueryWrapperX<ProductSkuDO>().eq(ProductSkuDO::getSpuId, spuId));
  27 + }
  28 +
  29 + /**
  30 + * 更新 SKU 库存(增加)
  31 + *
  32 + * @param id 编号
  33 + * @param incrCount 增加库存(正数)
  34 + */
  35 + default void updateStockIncr(Long id, Integer incrCount) {
  36 + Assert.isTrue(incrCount > 0);
  37 + LambdaUpdateWrapper<ProductSkuDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<ProductSkuDO>()
  38 + .setSql(" stock = stock + " + incrCount)
  39 + .eq(ProductSkuDO::getId, id);
  40 + update(null, lambdaUpdateWrapper);
  41 + }
  42 +
  43 + /**
  44 + * 更新 SKU 库存(减少)
  45 + *
  46 + * @param id 编号
  47 + * @param incrCount 减少库存(负数)
  48 + * @return 更新条数
  49 + */
  50 + default int updateStockDecr(Long id, Integer incrCount) {
  51 + Assert.isTrue(incrCount < 0);
  52 + LambdaUpdateWrapper<ProductSkuDO> updateWrapper = new LambdaUpdateWrapper<ProductSkuDO>()
  53 + .setSql(" stock = stock + " + incrCount) // 负数,所以使用 + 号
  54 + .eq(ProductSkuDO::getId, id)
  55 + .ge(ProductSkuDO::getStock, -incrCount); // cas 逻辑
  56 + return update(null, updateWrapper);
  57 + }
  58 +
  59 + default List<ProductSkuDO> selectListByAlarmStock(){
  60 + return selectList(new QueryWrapper<ProductSkuDO>().apply("stock <= warn_stock"));
32 } 61 }
33 62
34 } 63 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java
@@ -5,8 +5,11 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; @@ -5,8 +5,11 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageReqVO; 6 import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuPageReqVO;
7 import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; 7 import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
  8 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
8 import org.apache.ibatis.annotations.Mapper; 9 import org.apache.ibatis.annotations.Mapper;
9 10
  11 +import java.util.Set;
  12 +
10 /** 13 /**
11 * 商品spu Mapper 14 * 商品spu Mapper
12 * 15 *
@@ -18,12 +21,40 @@ public interface ProductSpuMapper extends BaseMapperX&lt;ProductSpuDO&gt; { @@ -18,12 +21,40 @@ public interface ProductSpuMapper extends BaseMapperX&lt;ProductSpuDO&gt; {
18 default PageResult<ProductSpuDO> selectPage(ProductSpuPageReqVO reqVO) { 21 default PageResult<ProductSpuDO> selectPage(ProductSpuPageReqVO reqVO) {
19 return selectPage(reqVO, new LambdaQueryWrapperX<ProductSpuDO>() 22 return selectPage(reqVO, new LambdaQueryWrapperX<ProductSpuDO>()
20 .likeIfPresent(ProductSpuDO::getName, reqVO.getName()) 23 .likeIfPresent(ProductSpuDO::getName, reqVO.getName())
21 - .eqIfPresent(ProductSpuDO::getSellPoint, reqVO.getSellPoint())  
22 .eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId()) 24 .eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId())
23 - .eqIfPresent(ProductSpuDO::getPicUrls, reqVO.getPicUrls())  
24 .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus()) 25 .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus())
25 - .betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getCreateTime()) 26 + .leIfPresent(ProductSpuDO::getSalesCount, reqVO.getSalesCountMax())
  27 + .geIfPresent(ProductSpuDO::getSalesCount, reqVO.getSalesCountMin())
  28 + .leIfPresent(ProductSpuDO::getMarketPrice, reqVO.getMarketPriceMax())
  29 + .geIfPresent(ProductSpuDO::getMarketPrice, reqVO.getMarketPriceMin())
26 .orderByDesc(ProductSpuDO::getSort)); 30 .orderByDesc(ProductSpuDO::getSort));
27 } 31 }
28 32
  33 + default PageResult<ProductSpuDO> selectPage(ProductSpuPageReqVO reqVO, Set<Long> alarmStockSpuIds) {
  34 + return selectPage(reqVO, new LambdaQueryWrapperX<ProductSpuDO>()
  35 + .likeIfPresent(ProductSpuDO::getName, reqVO.getName())
  36 + .eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId())
  37 + .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus())
  38 + .leIfPresent(ProductSpuDO::getSalesCount, reqVO.getSalesCountMax())
  39 + .geIfPresent(ProductSpuDO::getSalesCount, reqVO.getSalesCountMin())
  40 + .leIfPresent(ProductSpuDO::getMarketPrice, reqVO.getMarketPriceMax())
  41 + .geIfPresent(ProductSpuDO::getMarketPrice, reqVO.getMarketPriceMin())
  42 + .inIfPresent(ProductSpuDO::getId, alarmStockSpuIds) // 库存告警
  43 + .eqIfPresent(ProductSpuDO::getStatus, reqVO.getStatus())
  44 + .orderByDesc(ProductSpuDO::getSort));
  45 + }
  46 +
  47 + /**
  48 + * 更新商品 SPU 库存
  49 + *
  50 + * @param id 商品 SPU 编号
  51 + * @param incrCount 增加的库存数量
  52 + */
  53 + default void updateStock(Long id, Integer incrCount) {
  54 + LambdaUpdateWrapper<ProductSpuDO> updateWrapper = new LambdaUpdateWrapper<ProductSpuDO>()
  55 + .setSql(" total_stock = total_stock +" + incrCount) // 负数,所以使用 + 号
  56 + .eq(ProductSpuDO::getId, id);
  57 + update(null, updateWrapper);
  58 + }
  59 +
29 } 60 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImpl.java
1 package cn.iocoder.yudao.module.product.service.category; 1 package cn.iocoder.yudao.module.product.service.category;
2 2
3 -import cn.hutool.core.util.ObjectUtil;  
4 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 3 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
5 import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryCreateReqVO; 4 import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryCreateReqVO;
6 import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryListReqVO; 5 import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryListReqVO;
@@ -93,33 +92,19 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { @@ -93,33 +92,19 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
93 92
94 @Override 93 @Override
95 public void validateCategoryLevel(Long id) { 94 public void validateCategoryLevel(Long id) {
96 - Integer level = getProductCategoryLevel(id, 1);  
97 - if (level < 3){  
98 - throw exception(CATEGORY_LEVEL_ERROR); 95 + // TODO @芋艿:在看看,杂能优化下
  96 + Long parentId = id;
  97 + int i = 2;
  98 + for (; i >= 0; --i) {
  99 + ProductCategoryDO category = productCategoryMapper.selectById(parentId);
  100 + parentId = category.getParentId();
  101 + if(Objects.equals(parentId, ProductCategoryDO.PARENT_ID_NULL)){
  102 + break;
  103 + }
99 } 104 }
100 - }  
101 -  
102 - // TODO @Luowenfeng:建议使用 for 循环,避免递归  
103 - /**  
104 - * 获得商品分类的级别  
105 - *  
106 - * @param id 商品分类的编号  
107 - * @return 级别  
108 - */  
109 - private Integer getProductCategoryLevel(Long id, int level){  
110 - ProductCategoryDO category = productCategoryMapper.selectById(id);  
111 - if (category == null) {  
112 - throw exception(CATEGORY_NOT_EXISTS);  
113 - }  
114 - // TODO Luowenfeng:去掉是否开启,它不影响级别哈  
115 - if (ObjectUtil.notEqual(category.getStatus(), CommonStatusEnum.ENABLE.getStatus())) {  
116 - throw exception(CATEGORY_DISABLED);  
117 - }  
118 - // TODO Luowenfeng:不使用 0 直接比较哈,使用枚举  
119 - if (category.getParentId() == 0) {  
120 - return level; 105 + if (!Objects.equals(parentId, ProductCategoryDO.PARENT_ID_NULL) || i != 0) {
  106 + throw exception(CATEGORY_LEVEL_ERROR);
121 } 107 }
122 - return getProductCategoryLevel(category.getParentId(), ++level);  
123 } 108 }
124 109
125 @Override 110 @Override
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyService.java
1 package cn.iocoder.yudao.module.product.service.property; 1 package cn.iocoder.yudao.module.product.service.property;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyAndValueRespVO; 4 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyRespVO;
5 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.*; 5 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.*;
6 import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; 6 import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
7 7
@@ -39,44 +39,42 @@ public interface ProductPropertyService { @@ -39,44 +39,42 @@ public interface ProductPropertyService {
39 void deleteProperty(Long id); 39 void deleteProperty(Long id);
40 40
41 /** 41 /**
42 - * 获得规格名称  
43 - *  
44 - * @param id 编号  
45 - * @return 规格名称  
46 - */  
47 - ProductPropertyDO getProperty(Long id);  
48 -  
49 - /**  
50 * 获得规格名称列表 42 * 获得规格名称列表
51 - *  
52 - * @param ids 编号  
53 - * @return 规格名称列表 43 + * @param listReqVO 集合查询
  44 + * @return 规格名称集合
54 */ 45 */
55 - List<ProductPropertyDO> getPropertyList(Collection<Long> ids); 46 + List<ProductPropertyRespVO> getPropertyList(ProductPropertyListReqVO listReqVO);
56 47
57 /** 48 /**
58 - * 获得规格名称分页 49 + * 获取属性名称分页
59 * 50 *
60 - * @param pageReqVO 分页查询 51 + * @param pageReqVO 分页条件
61 * @return 规格名称分页 52 * @return 规格名称分页
62 */ 53 */
63 - PageResult<ProductPropertyDO> getPropertyPage(ProductPropertyPageReqVO pageReqVO); 54 + PageResult<ProductPropertyRespVO> getPropertyPage(ProductPropertyPageReqVO pageReqVO);
64 55
65 /** 56 /**
66 - * 获取属性及属性值列表 分页  
67 - * @param pageReqVO  
68 - * @return 57 + * 获得指定编号的规格名称
  58 + *
  59 + * @param id 编号
  60 + * @return 规格名称
69 */ 61 */
70 - PageResult<ProductPropertyAndValueRespVO> getPropertyListPage(ProductPropertyPageReqVO pageReqVO);  
71 -  
72 - ProductPropertyAndValueRespVO getPropertyResp(Long id); 62 + ProductPropertyRespVO getProperty(Long id);
73 63
74 /** 64 /**
75 * 根据规格属性编号的集合,获得对应的规格 + 规格值的集合 65 * 根据规格属性编号的集合,获得对应的规格 + 规格值的集合
76 * 66 *
77 * @param ids 规格编号的集合 67 * @param ids 规格编号的集合
78 - * @return 对应的规格 + 规格值的集合 68 + * @return 对应的规格
  69 + */
  70 + List<ProductPropertyRespVO> getPropertyList(Collection<Long> ids);
  71 +
  72 + /**
  73 + * 获得规格名称 + 值的列表
  74 + *
  75 + * @param listReqVO 列表查询
  76 + * @return 规格名称 + 值的列表
79 */ 77 */
80 - List<ProductPropertyAndValueRespVO> getPropertyAndValueList(Collection<Long> ids); 78 + List<ProductPropertyAndValueRespVO> getPropertyAndValueList(ProductPropertyListReqVO listReqVO);
81 79
82 } 80 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java
1 package cn.iocoder.yudao.module.product.service.property; 1 package cn.iocoder.yudao.module.product.service.property;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyAndValueRespVO; 4 +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
  5 +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
5 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.*; 7 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.*;
6 -import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;  
7 -import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;  
8 import cn.iocoder.yudao.module.product.convert.property.ProductPropertyConvert; 8 import cn.iocoder.yudao.module.product.convert.property.ProductPropertyConvert;
9 import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert; 9 import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert;
10 import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; 10 import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
@@ -16,13 +16,13 @@ import org.springframework.transaction.annotation.Transactional; @@ -16,13 +16,13 @@ import org.springframework.transaction.annotation.Transactional;
16 import org.springframework.validation.annotation.Validated; 16 import org.springframework.validation.annotation.Validated;
17 17
18 import javax.annotation.Resource; 18 import javax.annotation.Resource;
19 -import java.util.Arrays;  
20 import java.util.Collection; 19 import java.util.Collection;
21 import java.util.List; 20 import java.util.List;
22 import java.util.Map; 21 import java.util.Map;
23 -import java.util.stream.Collectors; 22 +import java.util.Objects;
24 23
25 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 24 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  25 +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_EXISTS;
26 import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_NOT_EXISTS; 26 import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_NOT_EXISTS;
27 27
28 /** 28 /**
@@ -43,15 +43,13 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { @@ -43,15 +43,13 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
43 @Override 43 @Override
44 @Transactional(rollbackFor = Exception.class) 44 @Transactional(rollbackFor = Exception.class)
45 public Long createProperty(ProductPropertyCreateReqVO createReqVO) { 45 public Long createProperty(ProductPropertyCreateReqVO createReqVO) {
  46 + // 校验存在
  47 + if (productPropertyMapper.selectByName(createReqVO.getName()) != null) {
  48 + throw exception(PROPERTY_EXISTS);
  49 + }
46 // 插入 50 // 插入
47 ProductPropertyDO property = ProductPropertyConvert.INSTANCE.convert(createReqVO); 51 ProductPropertyDO property = ProductPropertyConvert.INSTANCE.convert(createReqVO);
48 productPropertyMapper.insert(property); 52 productPropertyMapper.insert(property);
49 -  
50 - //插入属性值  
51 - List<ProductPropertyValueCreateReqVO> propertyValueList = createReqVO.getPropertyValueList();  
52 - List<ProductPropertyValueDO> productPropertyValueDOList = ProductPropertyValueConvert.INSTANCE.convertList03(propertyValueList);  
53 - productPropertyValueDOList.forEach(x-> x.setPropertyId(property.getId()));  
54 - productPropertyValueMapper.insertBatch(productPropertyValueDOList);  
55 // 返回 53 // 返回
56 return property.getId(); 54 return property.getId();
57 } 55 }
@@ -61,15 +59,13 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { @@ -61,15 +59,13 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
61 public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) { 59 public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) {
62 // 校验存在 60 // 校验存在
63 this.validatePropertyExists(updateReqVO.getId()); 61 this.validatePropertyExists(updateReqVO.getId());
  62 + ProductPropertyDO productPropertyDO = productPropertyMapper.selectByName(updateReqVO.getName());
  63 + if (productPropertyDO != null && !productPropertyDO.getId().equals(updateReqVO.getId())) {
  64 + throw exception(PROPERTY_EXISTS);
  65 + }
64 // 更新 66 // 更新
65 ProductPropertyDO updateObj = ProductPropertyConvert.INSTANCE.convert(updateReqVO); 67 ProductPropertyDO updateObj = ProductPropertyConvert.INSTANCE.convert(updateReqVO);
66 productPropertyMapper.updateById(updateObj); 68 productPropertyMapper.updateById(updateObj);
67 - //更新属性值,先删后加  
68 - productPropertyValueMapper.deletePropertyValueByPropertyId(updateReqVO.getId());  
69 - List<ProductPropertyValueCreateReqVO> propertyValueList = updateReqVO.getPropertyValueList();  
70 - List<ProductPropertyValueDO> productPropertyValueDOList = ProductPropertyValueConvert.INSTANCE.convertList03(propertyValueList);  
71 - productPropertyValueDOList.forEach(x-> x.setPropertyId(updateReqVO.getId()));  
72 - productPropertyValueMapper.insertBatch(productPropertyValueDOList);  
73 } 69 }
74 70
75 @Override 71 @Override
@@ -89,63 +85,41 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { @@ -89,63 +85,41 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
89 } 85 }
90 86
91 @Override 87 @Override
92 - public ProductPropertyDO getProperty(Long id) {  
93 - return productPropertyMapper.selectById(id);  
94 - }  
95 -  
96 - @Override  
97 - public List<ProductPropertyDO> getPropertyList(Collection<Long> ids) {  
98 - return productPropertyMapper.selectBatchIds(ids); 88 + public List<ProductPropertyRespVO> getPropertyList(ProductPropertyListReqVO listReqVO) {
  89 + return ProductPropertyConvert.INSTANCE.convertList(productPropertyMapper.selectList(new LambdaQueryWrapperX<ProductPropertyDO>()
  90 + .likeIfPresent(ProductPropertyDO::getName, listReqVO.getName())
  91 + .eqIfPresent(ProductPropertyDO::getStatus, listReqVO.getStatus())));
99 } 92 }
100 93
101 @Override 94 @Override
102 - public PageResult<ProductPropertyDO> getPropertyPage(ProductPropertyPageReqVO pageReqVO) {  
103 - return productPropertyMapper.selectPage(pageReqVO);  
104 - }  
105 -  
106 - @Override  
107 - public PageResult<ProductPropertyAndValueRespVO> getPropertyListPage(ProductPropertyPageReqVO pageReqVO) { 95 + public PageResult<ProductPropertyRespVO> getPropertyPage(ProductPropertyPageReqVO pageReqVO) {
108 //获取属性列表 96 //获取属性列表
109 PageResult<ProductPropertyDO> pageResult = productPropertyMapper.selectPage(pageReqVO); 97 PageResult<ProductPropertyDO> pageResult = productPropertyMapper.selectPage(pageReqVO);
110 - PageResult<ProductPropertyAndValueRespVO> propertyRespVOPageResult = ProductPropertyConvert.INSTANCE.convertPage(pageResult);  
111 - List<Long> propertyIds = propertyRespVOPageResult.getList().stream().map(ProductPropertyAndValueRespVO::getId).collect(Collectors.toList());  
112 -  
113 - //获取属性值列表  
114 - List<ProductPropertyValueDO> productPropertyValueDOList = productPropertyValueMapper.getPropertyValueListByPropertyId(propertyIds);  
115 - List<ProductPropertyValueRespVO> propertyValueRespVOList = ProductPropertyValueConvert.INSTANCE.convertList(productPropertyValueDOList);  
116 - //组装一对多  
117 - propertyRespVOPageResult.getList().forEach(x->{  
118 - Long propertyId = x.getId();  
119 - List<ProductPropertyValueRespVO> valueDOList = propertyValueRespVOList.stream().filter(v -> v.getPropertyId().equals(propertyId)).collect(Collectors.toList());  
120 - x.setValues(valueDOList);  
121 - });  
122 - return propertyRespVOPageResult; 98 + return ProductPropertyConvert.INSTANCE.convertPage(pageResult);
123 } 99 }
124 100
125 - private List<ProductPropertyValueDO> getPropertyValueListByPropertyId(List<Long> propertyIds) {  
126 - return productPropertyValueMapper.getPropertyValueListByPropertyId(propertyIds); 101 + @Override
  102 + public ProductPropertyRespVO getProperty(Long id) {
  103 + ProductPropertyDO property = productPropertyMapper.selectById(id);
  104 + return ProductPropertyConvert.INSTANCE.convert(property);
127 } 105 }
128 106
129 @Override 107 @Override
130 - public ProductPropertyAndValueRespVO getPropertyResp(Long id) {  
131 - //查询规格  
132 - ProductPropertyDO property = getProperty(id);  
133 - ProductPropertyAndValueRespVO propertyRespVO = ProductPropertyConvert.INSTANCE.convert(property);  
134 - //查询属性值  
135 - List<ProductPropertyValueDO> valueDOList = productPropertyValueMapper.getPropertyValueListByPropertyId(Arrays.asList(id));  
136 - List<ProductPropertyValueRespVO> propertyValueRespVOS = ProductPropertyValueConvert.INSTANCE.convertList(valueDOList);  
137 - //组装  
138 - propertyRespVO.setValues(propertyValueRespVOS);  
139 - return propertyRespVO; 108 + public List<ProductPropertyRespVO> getPropertyList(Collection<Long> ids) {
  109 + return ProductPropertyConvert.INSTANCE.convertList(productPropertyMapper.selectBatchIds(ids));
140 } 110 }
141 111
142 @Override 112 @Override
143 - public List<ProductPropertyAndValueRespVO> getPropertyAndValueList(Collection<Long> ids) {  
144 - List<ProductPropertyAndValueRespVO> productPropertyRespVO = ProductPropertyConvert.INSTANCE.convertList(productPropertyMapper.selectBatchIds(ids));  
145 - //查询属性值  
146 - List<ProductPropertyValueDO> valueDOList = productPropertyValueMapper.selectBatchIds(ids);  
147 - Map<Long, List<ProductPropertyValueDO>> propertyValuesMap = valueDOList.stream().collect(Collectors.groupingBy(ProductPropertyValueDO::getPropertyId));  
148 - productPropertyRespVO.forEach(p -> p.setValues(ProductPropertyValueConvert.INSTANCE.convertList(propertyValuesMap.get(p.getId()))));  
149 - return productPropertyRespVO; 113 + public List<ProductPropertyAndValueRespVO> getPropertyAndValueList(ProductPropertyListReqVO listReqVO) {
  114 + List<ProductPropertyRespVO> propertyList = getPropertyList(listReqVO);
  115 +
  116 + // 查询属性值
  117 + List<ProductPropertyValueDO> valueDOList = productPropertyValueMapper.selectListByPropertyId(CollectionUtils.convertList(propertyList, ProductPropertyRespVO::getId));
  118 + Map<Long, List<ProductPropertyValueDO>> valueDOMap = CollectionUtils.convertMultiMap(valueDOList, ProductPropertyValueDO::getPropertyId);
  119 + return CollectionUtils.convertList(propertyList, m -> {
  120 + ProductPropertyAndValueRespVO productPropertyAndValueRespVO = ProductPropertyConvert.INSTANCE.convert(m);
  121 + productPropertyAndValueRespVO.setValues(ProductPropertyValueConvert.INSTANCE.convertList(valueDOMap.get(m.getId())));
  122 + return productPropertyAndValueRespVO;
  123 + });
150 } 124 }
151 } 125 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.product.service.property;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;
  5 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO;
  6 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;
  7 +import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
  8 +
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * <p>
  13 + * 规格值 Service 接口
  14 + * </p>
  15 + *
  16 + * @author LuoWenFeng
  17 + */
  18 +public interface ProductPropertyValueService {
  19 +
  20 + /**
  21 + * 创建规格值
  22 + *
  23 + * @param createReqVO 创建信息
  24 + * @return 编号
  25 + */
  26 + Long createPropertyValue(ProductPropertyValueCreateReqVO createReqVO);
  27 +
  28 + /**
  29 + * 更新规格值
  30 + *
  31 + * @param updateReqVO 更新信息
  32 + */
  33 + void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO);
  34 +
  35 + /**
  36 + * 删除规格值
  37 + *
  38 + * @param id 编号
  39 + */
  40 + void deletePropertyValue(Long id);
  41 +
  42 + /**
  43 + * 获得规格值
  44 + *
  45 + * @param id 编号
  46 + * @return 规格名称
  47 + */
  48 + ProductPropertyValueRespVO getPropertyValue(Long id);
  49 +
  50 + /**
  51 + * 获得规格值
  52 + *
  53 + * @param id 编号
  54 + * @return 规格名称
  55 + */
  56 + List<ProductPropertyValueRespVO> getPropertyValueListByPropertyId(List<Long> id);
  57 +
  58 + /**
  59 + * 获取规格值 分页
  60 + *
  61 + * @param pageReqVO 查询条件
  62 + * @return
  63 + */
  64 + PageResult<ProductPropertyValueRespVO> getPropertyValueListPage(ProductPropertyValuePageReqVO pageReqVO);
  65 +}