list() {
- return defines;
+ return DEFINES;
}
public static int size() {
- return defines.size();
+ return DEFINES.size();
}
}
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
index c9a789f41..1e7518787 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
@@ -81,7 +81,7 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
/**
* 配置 URL 的安全配置
- *
+ *
* anyRequest | 匹配所有请求路径
* access | SpringEl表达式结果为true时可以访问
* anonymous | 匿名可以访问
@@ -109,8 +109,8 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
.headers().frameOptions().disable().and()
// 一堆自定义的 Spring Security 处理器
.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint)
- .accessDeniedHandler(accessDeniedHandler);
- // 登录、登录暂时不使用 Spring Security 的拓展点,主要考虑一方面拓展多用户、多种登录方式相对复杂,一方面用户的学习成本较高
+ .accessDeniedHandler(accessDeniedHandler);
+ // 登录、登录暂时不使用 Spring Security 的拓展点,主要考虑一方面拓展多用户、多种登录方式相对复杂,一方面用户的学习成本较高
// 获得 @PermitAll 带来的 URL 列表,免登录
Multimap permitAllUrls = getPermitAllUrlsFromAnnotations();
@@ -118,23 +118,25 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
httpSecurity
// ①:全局共享规则
.authorizeRequests()
- // 1.1 静态资源,可匿名访问
- .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
- // 1.2 设置 @PermitAll 无需认证
- .antMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll()
- .antMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll()
- .antMatchers(HttpMethod.PUT, permitAllUrls.get(HttpMethod.PUT).toArray(new String[0])).permitAll()
- .antMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
- // 1.3 基于 yudao.security.permit-all-urls 无需认证
- .antMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
- // 1.4 设置 App API 无需认证
- .antMatchers(buildAppApi("/**")).permitAll()
+ // 1.1 静态资源,可匿名访问
+ .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
+ // 1.2 设置 @PermitAll 无需认证
+ .antMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll()
+ .antMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll()
+ .antMatchers(HttpMethod.PUT, permitAllUrls.get(HttpMethod.PUT).toArray(new String[0])).permitAll()
+ .antMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
+ // 1.3 基于 yudao.security.permit-all-urls 无需认证
+ .antMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
+ // 1.4 设置 App API 无需认证
+ .antMatchers(buildAppApi("/**")).permitAll()
+ // 1.5 验证码captcha 允许匿名访问
+ .antMatchers("/captcha/get", "/captcha/check").permitAll()
// ②:每个项目的自定义规则
.and().authorizeRequests(registry -> // 下面,循环设置自定义规则
authorizeRequestsCustomizers.forEach(customizer -> customizer.customize(registry)))
// ③:兜底规则,必须认证
.authorizeRequests()
- .anyRequest().authenticated()
+ .anyRequest().authenticated()
;
// 添加 Token Filter
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/context/TransmittableThreadLocalSecurityContextHolderStrategy.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/context/TransmittableThreadLocalSecurityContextHolderStrategy.java
index 5e46daa1e..1bdbe712f 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/context/TransmittableThreadLocalSecurityContextHolderStrategy.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/context/TransmittableThreadLocalSecurityContextHolderStrategy.java
@@ -17,19 +17,19 @@ public class TransmittableThreadLocalSecurityContextHolderStrategy implements Se
/**
* 使用 TransmittableThreadLocal 作为上下文
*/
- private static final ThreadLocal contextHolder = new TransmittableThreadLocal<>();
+ private static final ThreadLocal CONTEXT_HOLDER = new TransmittableThreadLocal<>();
@Override
public void clearContext() {
- contextHolder.remove();
+ CONTEXT_HOLDER.remove();
}
@Override
public SecurityContext getContext() {
- SecurityContext ctx = contextHolder.get();
+ SecurityContext ctx = CONTEXT_HOLDER.get();
if (ctx == null) {
ctx = createEmptyContext();
- contextHolder.set(ctx);
+ CONTEXT_HOLDER.set(ctx);
}
return ctx;
}
@@ -37,7 +37,7 @@ public class TransmittableThreadLocalSecurityContextHolderStrategy implements Se
@Override
public void setContext(SecurityContext context) {
Assert.notNull(context, "Only non-null SecurityContext instances are permitted");
- contextHolder.set(context);
+ CONTEXT_HOLDER.set(context);
}
@Override
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java
index 89dfd1227..032370158 100644
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java
+++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java
@@ -57,7 +57,7 @@ public class BpmMessageServiceImpl implements BpmMessageService {
templateParams.put("taskName", reqDTO.getTaskName());
templateParams.put("startUserNickname", reqDTO.getStartUserNickname());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
- smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(),
+ smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(),
BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams));
}
diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenServiceImpl.java
index 333dbefa6..b2c1998c8 100644
--- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenServiceImpl.java
+++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenServiceImpl.java
@@ -154,12 +154,12 @@ public class CodegenServiceImpl implements CodegenService {
// 构建 CodegenColumnDO 数组,只同步新增的字段
List codegenColumns = codegenColumnMapper.selectListByTableId(tableId);
Set codegenColumnNames = CollectionUtils.convertSet(codegenColumns, CodegenColumnDO::getColumnName);
- // 移除已经存在的字段
- tableFields.removeIf(column -> codegenColumnNames.contains(column.getColumnName()));
// 计算需要删除的字段
Set tableFieldNames = CollectionUtils.convertSet(tableFields, TableField::getName);
Set deleteColumnIds = codegenColumns.stream().filter(column -> !tableFieldNames.contains(column.getColumnName()))
.map(CodegenColumnDO::getId).collect(Collectors.toSet());
+ // 移除已经存在的字段
+ tableFields.removeIf(column -> codegenColumnNames.contains(column.getColumnName()));
if (CollUtil.isEmpty(tableFields) && CollUtil.isEmpty(deleteColumnIds)) {
throw exception(CODEGEN_SYNC_NONE_CHANGE);
}
diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenBuilder.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenBuilder.java
index 7523fab6d..90f5816f3 100644
--- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenBuilder.java
+++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenBuilder.java
@@ -31,7 +31,7 @@ public class CodegenBuilder {
* 字段名与 {@link CodegenColumnListConditionEnum} 的默认映射
* 注意,字段的匹配以后缀的方式
*/
- private static final Map columnListOperationConditionMappings =
+ private static final Map COLUMN_LIST_OPERATION_CONDITION_MAPPINGS =
MapUtil.builder()
.put("name", CodegenColumnListConditionEnum.LIKE)
.put("time", CodegenColumnListConditionEnum.BETWEEN)
@@ -42,7 +42,7 @@ public class CodegenBuilder {
* 字段名与 {@link CodegenColumnHtmlTypeEnum} 的默认映射
* 注意,字段的匹配以后缀的方式
*/
- private static final Map columnHtmlTypeMappings =
+ private static final Map COLUMN_HTML_TYPE_MAPPINGS =
MapUtil.builder()
.put("status", CodegenColumnHtmlTypeEnum.RADIO)
.put("sex", CodegenColumnHtmlTypeEnum.RADIO)
@@ -143,7 +143,7 @@ public class CodegenBuilder {
column.setListOperation(!LIST_OPERATION_EXCLUDE_COLUMN.contains(column.getJavaField())
&& !column.getPrimaryKey()); // 对于主键,列表过滤不需要传递
// 处理 listOperationCondition 字段
- columnListOperationConditionMappings.entrySet().stream()
+ COLUMN_LIST_OPERATION_CONDITION_MAPPINGS.entrySet().stream()
.filter(entry -> StrUtil.endWithIgnoreCase(column.getJavaField(), entry.getKey()))
.findFirst().ifPresent(entry -> column.setListOperationCondition(entry.getValue().getCondition()));
if (column.getListOperationCondition() == null) {
@@ -155,7 +155,7 @@ public class CodegenBuilder {
private void processColumnUI(CodegenColumnDO column) {
// 基于后缀进行匹配
- columnHtmlTypeMappings.entrySet().stream()
+ COLUMN_HTML_TYPE_MAPPINGS.entrySet().stream()
.filter(entry -> StrUtil.endWithIgnoreCase(column.getJavaField(), entry.getKey()))
.findFirst().ifPresent(entry -> column.setHtmlType(entry.getValue().getType()));
// 如果是 Boolean 类型时,设置为 radio 类型.
diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm
index 95f7d66a2..c84a510ac 100644
--- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm
+++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm
@@ -96,7 +96,7 @@
@pagination="getList"/>
-
+
#foreach($column in $columns)
#if ($column.createOperation || $column.updateOperation)
diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm
index b37365a07..69da81493 100644
--- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm
+++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm
@@ -5,31 +5,31 @@ const request = useAxios()
#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")
// 查询${table.classComment}列表
-export const getPostPageApi = async (params: ${simpleClassName}PageReqVO) => {
+export const get${simpleClassName}PageApi = async (params: ${simpleClassName}PageReqVO) => {
return await request.get({ url: '${baseURL}/page', params })
}
// 查询${table.classComment}详情
-export const getPostApi = async (id: number) => {
+export const get${simpleClassName}Api = async (id: number) => {
return await request.get({ url: '${baseURL}/get?id=' + id })
}
// 新增${table.classComment}
-export const createPostApi = async (data: ${simpleClassName}VO) => {
+export const create${simpleClassName}Api = async (data: ${simpleClassName}VO) => {
return await request.post({ url: '${baseURL}/create', data })
}
// 修改${table.classComment}
-export const updatePostApi = async (data: ${simpleClassName}VO) => {
+export const update${simpleClassName}Api = async (data: ${simpleClassName}VO) => {
return await request.put({ url: '${baseURL}/update', data })
}
// 删除${table.classComment}
-export const deletePostApi = async (id: number) => {
+export const delete${simpleClassName}Api = async (id: number) => {
return await request.delete({ url: '${baseURL}/delete?id=' + id })
}
// 导出${table.classComment} Excel
-export const exportPostApi = async (params: ${simpleClassName}ExcelReqVO) => {
+export const export${simpleClassName}Api = async (params: ${simpleClassName}ExcelReqVO) => {
return await request.download({ url: '${baseURL}/export-excel', params })
}
diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm
index 7d1b18b4f..c497a1801 100644
--- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm
+++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm
@@ -6,9 +6,9 @@
import { useTable } from '@/hooks/web/useTable'
import { useI18n } from '@/hooks/web/useI18n'
import { FormExpose } from '@/components/Form'
- import type { ${simpleClassName}VO } from '@/api/system/post/types'
- import { rules, allSchemas } from './post.data'
- import * as ${simpleClassName}Api from '@/api/system/post'
+ import type { ${simpleClassName}VO } from '@/api/${table.moduleName}/${simpleClassName}/types'
+ import { rules, allSchemas } from './${simpleClassName}.data'
+ import * as ${simpleClassName}Api from '@/api/${table.moduleName}/${simpleClassName}'
const { t } = useI18n() // 国际化
// ========== 列表相关 ==========
diff --git a/yudao-module-mall/pom.xml b/yudao-module-mall/pom.xml
index 23812b4cc..68c1825cc 100644
--- a/yudao-module-mall/pom.xml
+++ b/yudao-module-mall/pom.xml
@@ -15,17 +15,18 @@
${project.artifactId}
- 商城大模块,由 product 商品、market 营销、trade 交易等组成
+ 商城大模块,由 product 商品、market 营销、trade 交易 coupon等组成
+ yudao-module-coupon-api
+ yudao-module-coupon-biz
yudao-module-market-api
yudao-module-market-biz
yudao-module-product-api
yudao-module-product-biz
yudao-module-trade-api
yudao-module-trade-biz
- yudao-module-coupon-api
- yudao-module-coupon-biz
+
diff --git a/yudao-module-mall/yudao-module-coupon-api/pom.xml b/yudao-module-mall/yudao-module-coupon-api/pom.xml
index e98526f9c..6dab80613 100644
--- a/yudao-module-mall/yudao-module-coupon-api/pom.xml
+++ b/yudao-module-mall/yudao-module-coupon-api/pom.xml
@@ -23,6 +23,13 @@
cn.iocoder.boot
yudao-common
+
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+ true
+
\ No newline at end of file
diff --git a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponExpireTimeTypeEnum.java b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponExpireTimeTypeEnum.java
index be6d2a90e..0e1e17ece 100644
--- a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponExpireTimeTypeEnum.java
+++ b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponExpireTimeTypeEnum.java
@@ -14,7 +14,8 @@ import lombok.RequiredArgsConstructor;
@Getter
public enum CouponExpireTimeTypeEnum {
- OPEN(1,"不开启"),CLOSE(0,"开启"),;
+ OPEN(1,"不开启"),
+ CLOSE(0,"开启"),;
/**
* 是否开启过期提醒
diff --git a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponFetchTypeEnum.java b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponFetchTypeEnum.java
index ffdd99c28..66a86bc84 100644
--- a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponFetchTypeEnum.java
+++ b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponFetchTypeEnum.java
@@ -14,7 +14,8 @@ import lombok.RequiredArgsConstructor;
@Getter
public enum CouponFetchTypeEnum {
- LIMIT(0,"否"),NOT_LIMIT(0,"开启"),;
+ LIMIT(1,"限制"),
+ NOT_LIMIT(0,"不限制"),;
/**
* 是否开启过期提醒
diff --git a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponProductTypeEnum.java b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponForbidPreferenceEnum.java
similarity index 66%
rename from yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponProductTypeEnum.java
rename to yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponForbidPreferenceEnum.java
index f5e6cf995..1ac9e9f68 100644
--- a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponProductTypeEnum.java
+++ b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponForbidPreferenceEnum.java
@@ -6,17 +6,16 @@ import lombok.RequiredArgsConstructor;
/**
- * 优惠券 - 优惠券类型
+ * 优惠券 - 优惠叠加类型
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
-public enum CouponProductTypeEnum {
+public enum CouponForbidPreferenceEnum {
- PROCESSING(1,"进行中"),
- END(2,"已结束"),
- CLOSE(3,"已关闭"),;
+ UN_FORBID(0,"不限制"),
+ FORBID(1,"优惠券仅原价购买商品时可用");
/**
* 优惠券类型
diff --git a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponGoodsTypeEnum.java b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponGoodsTypeEnum.java
new file mode 100644
index 000000000..e0946b7a0
--- /dev/null
+++ b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponGoodsTypeEnum.java
@@ -0,0 +1,30 @@
+package cn.iocoder.yudao.module.CouponTemplete.enums;
+
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+
+/**
+ * 优惠券 - 优惠券商品使用类型
+ *
+ * @author Sin
+ */
+@RequiredArgsConstructor
+@Getter
+public enum CouponGoodsTypeEnum {
+
+ ALL(1,"全部商品可用"),
+ POINT_PRODUCT(2,"指定商品可用"),
+ POINT_PRODUCT_NOT(3,"指定商品不可用"),;
+
+ /**
+ * 优惠券商品使用类型
+ */
+ private final Integer type;
+ /**
+ * 优惠券商品使用类型名
+ */
+ private final String name;
+
+}
diff --git a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponStatusTypeEnum.java b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponStatusTypeEnum.java
index c58ce36b4..813084731 100644
--- a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponStatusTypeEnum.java
+++ b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponStatusTypeEnum.java
@@ -6,7 +6,7 @@ import lombok.RequiredArgsConstructor;
/**
- * 优惠券 - 优惠券类型
+ * 优惠券 - 优惠券状态类型
*
* @author Sin
*/
@@ -14,9 +14,9 @@ import lombok.RequiredArgsConstructor;
@Getter
public enum CouponStatusTypeEnum {
- ALL(1,"全部商品可用"),
- POINT_PRODUCT(2,"指定商品可用"),
- POINT_PRODUCT_NOT(3,"指定商品不可用不能为空"),;
+ PROCESSING(1,"进行中"),
+ END(2,"已结束"),
+ CLOSE(3,"已关闭"),;
/**
* 优惠券类型
diff --git a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponUseLimitEnum.java b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponUseLimitEnum.java
index 61d2f429b..beb530f0c 100644
--- a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponUseLimitEnum.java
+++ b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponUseLimitEnum.java
@@ -6,7 +6,7 @@ import lombok.RequiredArgsConstructor;
/**
- * 优惠券 - 优惠券类型
+ * 优惠券使用类型 - 优惠券使用类型类型
*
* @author Sin
*/
@@ -18,11 +18,11 @@ public enum CouponUseLimitEnum {
NO_LIMIT(2,"有门槛"),;
/**
- * 优惠券类型
+ * 优惠券使用类型
*/
private final Integer type;
/**
- * 优惠券类型名
+ * 优惠券使用类型名
*/
private final String name;
diff --git a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponValidityTypeEnum.java b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponValidityTypeEnum.java
index 6411ecbf9..798cf1e0f 100644
--- a/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponValidityTypeEnum.java
+++ b/yudao-module-mall/yudao-module-coupon-api/src/main/java/cn/iocoder/yudao/module/CouponTemplete/enums/CouponValidityTypeEnum.java
@@ -14,7 +14,7 @@ public enum CouponValidityTypeEnum {
TIME_RANGE_EXPIRTED(1,"时间范围过期"),
EXPIRES_AFTER_FIXED_DATE(2,"领取之日固定日期后过期"),
- EXPIRES_DATE_NEXT_FIEXD_DATE(3,"领取次日固定日期后过期不能为空"),;
+ EXPIRES_DATE_NEXT_FIEXD_DATE(3,"领取次日固定日期后过期"),;
/**
diff --git a/yudao-module-mall/yudao-module-coupon-biz/pom.xml b/yudao-module-mall/yudao-module-coupon-biz/pom.xml
index 735d5180d..eda16bd16 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/pom.xml
+++ b/yudao-module-mall/yudao-module-coupon-biz/pom.xml
@@ -3,19 +3,18 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- yudao-module-mall
cn.iocoder.boot
+ yudao-module-mall
${revision}
4.0.0
- yudao-module-coupon-biz
jar
-
+ yudao-module-coupon-biz
${project.artifactId}
+
- trade 模块,主要实现交易相关功能
- 例如:订单、退款、购物车等功能。
+ coupon模块,主要负责优惠券的一些业务,含发布优惠券模板,分发优惠券等
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/CouponController.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/CouponController.java
index 6e099269a..8ee02c366 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/CouponController.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/CouponController.java
@@ -21,7 +21,7 @@ import cn.iocoder.yudao.module.coupon.service.coupon.CouponService;
@Api(tags = "管理后台 - 优惠券")
@RestController
-@RequestMapping("/coupon/coupon/")
+@RequestMapping("/coupon/item")
@Validated
public class CouponController {
@@ -69,7 +69,7 @@ public class CouponController {
@GetMapping("/list")
@ApiOperation("获得优惠券列表")
-// @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
+ @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('coupon::query')")
public CommonResult> getList(@RequestParam("ids") Collection ids) {
List list = couponService.getList(ids);
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponBaseVO.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponBaseVO.java
index 20dba42d8..31cc828f7 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponBaseVO.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponBaseVO.java
@@ -68,7 +68,7 @@ public class CouponBaseVO {
private Boolean whetherForbidPreference;
@ApiModelProperty(value = "是否开启过期提醒0-不开启 1-开启", required = true)
- @NotNull(message = "是否开启过期提醒0-不开启 1-开启不能为空")
+ @NotNull(message = "是否开启过期提醒0-不开启 1-开启")
private Boolean whetherExpireNotice;
@ApiModelProperty(value = "过期前N天提醒", required = true)
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/CouponTempleteController.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/CouponTempleteController.java
deleted file mode 100644
index 40d9ac429..000000000
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/CouponTempleteController.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete;
-
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.*;
-import cn.iocoder.yudao.module.coupon.convert.CouponTemplete.CouponTempleteConvert;
-import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
-import cn.iocoder.yudao.module.coupon.service.CouponTemplete.CouponTempleteService;
-import org.springframework.web.bind.annotation.*;
-import javax.annotation.Resource;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.security.access.prepost.PreAuthorize;
-import io.swagger.annotations.*;
-
-import javax.validation.*;
-import java.util.*;
-
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-
-@Api(tags = "管理后台 - 优惠券模板")
-@RestController
-@RequestMapping("/coupon/CouponTemplete/")
-@Validated
-public class CouponTempleteController {
-
- @Resource
- private CouponTempleteService Service;
-
- @PostMapping("/create")
- @ApiOperation("创建优惠券模板")
- @PreAuthorize("@ss.hasPermission('CouponTemplete::create')")
- public CommonResult create(@Valid @RequestBody CouponTempleteCreateReqVO createReqVO) {
- return success(Service.create(createReqVO));
- }
-
- @PutMapping("/update")
- @ApiOperation("更新优惠券模板")
- @PreAuthorize("@ss.hasPermission('CouponTemplete::update')")
- public CommonResult update(@Valid @RequestBody CouponTempleteUpdateReqVO updateReqVO) {
- Service.update(updateReqVO);
- return success(true);
- }
-
- @DeleteMapping("/delete")
- @ApiOperation("删除优惠券模板")
- @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
- @PreAuthorize("@ss.hasPermission('CouponTemplete::delete')")
- public CommonResult delete(@RequestParam("id") Long id) {
- Service.delete(id);
- return success(true);
- }
-
- @GetMapping("/get")
- @ApiOperation("获得优惠券模板")
-// @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
- @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
- public CommonResult get(@RequestParam("id") Long id) {
- CouponTempleteDO couponTempleteDO = Service.get(id);
- return success(CouponTempleteConvert.INSTANCE.convert(couponTempleteDO));
- }
-
- @GetMapping("/list")
- @ApiOperation("获得优惠券模板列表")
-// @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
- @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
- public CommonResult> getList(@RequestParam("ids") Collection ids) {
- List list = Service.getList(ids);
- return success(CouponTempleteConvert.INSTANCE.convertList(list));
- }
-
- @GetMapping("/page")
- @ApiOperation("获得优惠券模板分页")
- @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
- public CommonResult> getPage(@Valid CouponTempletePageReqVO pageVO) {
- PageResult pageResult = Service.getPage(pageVO);
- return success(CouponTempleteConvert.INSTANCE.convertPage(pageResult));
- }
-
-
-
-}
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/CouponTempleteController.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/CouponTempleteController.java
new file mode 100644
index 000000000..a81f53c09
--- /dev/null
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/CouponTempleteController.java
@@ -0,0 +1,81 @@
+package cn.iocoder.yudao.module.coupon.controller.admin.templete;
+
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.*;
+import cn.iocoder.yudao.module.coupon.convert.CouponTemplete.CouponTempleteConvert;
+import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
+import cn.iocoder.yudao.module.coupon.service.CouponTemplete.CouponTempleteService;
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.annotations.*;
+
+import javax.validation.*;
+import java.util.*;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Api(tags = "管理后台 - 优惠券模板")
+@RestController
+@RequestMapping("/coupon/template")
+@Validated
+public class CouponTempleteController {
+
+ @Resource
+ private CouponTempleteService couponTempleteServiceService;
+
+ @PostMapping("/create")
+ @ApiOperation("创建优惠券模板")
+ @PreAuthorize("@ss.hasPermission('CouponTemplete::create')")
+ public CommonResult create(@Valid @RequestBody CouponTempleteCreateReqVO createReqVO) {
+ return success(couponTempleteServiceService.create(createReqVO));
+ }
+
+// @PutMapping("/update")
+// @ApiOperation("更新优惠券模板")
+// @PreAuthorize("@ss.hasPermission('CouponTemplete::update')")
+// public CommonResult update(@Valid @RequestBody CouponTempleteUpdateReqVO updateReqVO) {
+// couponTempleteServiceService.update(updateReqVO);
+// return success(true);
+// }
+//
+// @DeleteMapping("/delete")
+// @ApiOperation("删除优惠券模板")
+// @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
+// @PreAuthorize("@ss.hasPermission('CouponTemplete::delete')")
+// public CommonResult delete(@RequestParam("id") Long id) {
+// couponTempleteServiceService.delete(id);
+// return success(true);
+// }
+//
+// @GetMapping("/get")
+// @ApiOperation("获得优惠券模板")
+// @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
+// @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
+// public CommonResult get(@RequestParam("id") Long id) {
+// CouponTempleteDO couponTempleteDO = couponTempleteServiceService.get(id);
+// return success(CouponTempleteConvert.INSTANCE.convert(couponTempleteDO));
+// }
+//
+// @GetMapping("/list")
+// @ApiOperation("获得优惠券模板列表")
+// @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
+// @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
+// public CommonResult> getList(@RequestParam("ids") Collection ids) {
+// List list = couponTempleteServiceService.getList(ids);
+// return success(CouponTempleteConvert.INSTANCE.convertList(list));
+// }
+//
+ @GetMapping("/page")
+ @ApiOperation("获得优惠券模板分页")
+ @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
+ public CommonResult> getPage(@Valid CouponTempletePageReqVO pageVO) {
+ PageResult pageResult = couponTempleteServiceService.getPage(pageVO);
+ return success(CouponTempleteConvert.INSTANCE.convertPage(pageResult));
+ }
+
+
+
+}
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteBaseVO.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteBaseVO.java
similarity index 97%
rename from yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteBaseVO.java
rename to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteBaseVO.java
index d9818344f..942abe896 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteBaseVO.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteBaseVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
+package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import java.util.*;
@@ -34,7 +34,7 @@ public class CouponTempleteBaseVO {
@ApiModelProperty(value = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用", required = true)
@NotNull(message = "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用不能为空")
- private Boolean goodsType;
+ private Integer goodsType;
@ApiModelProperty(value = "适用商品id")
private String productIds;
@@ -104,7 +104,7 @@ public class CouponTempleteBaseVO {
@ApiModelProperty(value = "领取是否无限制0-否 1是", required = true)
- @NotNull(message = "是否无限制0-否 1是 不能为空")
+ @NotNull(message = "是否无限制0-否 1是")
private Boolean whetherLimitless;
@ApiModelProperty(value = "每人最大领取个数", required = true)
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteCreateReqVO.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteCreateReqVO.java
similarity index 77%
rename from yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteCreateReqVO.java
rename to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteCreateReqVO.java
index fa13b77a5..8e1d9a51a 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteCreateReqVO.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteCreateReqVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
+package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import io.swagger.annotations.*;
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteExcelVO.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteExcelVO.java
similarity index 95%
rename from yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteExcelVO.java
rename to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteExcelVO.java
index a09b3ff71..1101f9b61 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteExcelVO.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteExcelVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
+package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import java.util.*;
@@ -39,7 +39,7 @@ public class CouponTempleteExcelVO {
private Integer usedCount;
@ExcelProperty("适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用")
- private Boolean goodsType;
+ private Integer goodsType;
@ExcelProperty("适用商品id")
private String productIds;
@@ -66,7 +66,7 @@ public class CouponTempleteExcelVO {
private BigDecimal maxMoney;
@ExcelProperty("过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期")
- private Boolean validityType;
+ private Integer validityType;
@ExcelProperty("使用开始日期 过期类型1时必填")
private Date startUseTime;
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteExportReqVO.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteExportReqVO.java
similarity index 98%
rename from yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteExportReqVO.java
rename to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteExportReqVO.java
index b8b8fced1..0420e3d9e 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteExportReqVO.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteExportReqVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
+package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempletePageReqVO.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempletePageReqVO.java
similarity index 98%
rename from yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempletePageReqVO.java
rename to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempletePageReqVO.java
index 92622d793..3ff5710c7 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempletePageReqVO.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempletePageReqVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
+package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteRespVO.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteRespVO.java
similarity index 85%
rename from yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteRespVO.java
rename to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteRespVO.java
index 318492a24..b65f7c259 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteRespVO.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteRespVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
+package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import java.util.*;
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteUpdateReqVO.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteUpdateReqVO.java
similarity index 84%
rename from yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteUpdateReqVO.java
rename to yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteUpdateReqVO.java
index 7d0fb7544..1ee8b539d 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupontemplete/vo/CouponTempleteUpdateReqVO.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteUpdateReqVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo;
+package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
import lombok.*;
import io.swagger.annotations.*;
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/convert/CouponTemplete/CouponTempleteConvert.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/convert/CouponTemplete/CouponTempleteConvert.java
index ddd774053..a7f37919d 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/convert/CouponTemplete/CouponTempleteConvert.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/convert/CouponTemplete/CouponTempleteConvert.java
@@ -4,10 +4,10 @@ import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteCreateReqVO;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteExcelVO;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteRespVO;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteUpdateReqVO;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteCreateReqVO;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteExcelVO;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteRespVO;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteUpdateReqVO;
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/CouponTemplete/CouponTempleteDO.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/CouponTemplete/CouponTempleteDO.java
index 106c459a1..e33771808 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/CouponTemplete/CouponTempleteDO.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/CouponTemplete/CouponTempleteDO.java
@@ -57,7 +57,7 @@ public class CouponTempleteDO extends BaseDO {
/**
* 适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用
*/
- private Boolean goodsType;
+ private Integer goodsType;
/**
* 适用商品id
*/
@@ -93,7 +93,7 @@ public class CouponTempleteDO extends BaseDO {
/**
* 过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期
*/
- private Boolean validityType;
+ private Integer validityType;
/**
* 使用开始日期 过期类型1时必填
*/
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/mysql/CouponTemplete/CouponTempleteMapper.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/mysql/CouponTemplete/CouponTempleteMapper.java
index b930f113f..3243ce17a 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/mysql/CouponTemplete/CouponTempleteMapper.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/mysql/CouponTemplete/CouponTempleteMapper.java
@@ -5,8 +5,8 @@ import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteExportReqVO;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempletePageReqVO;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteExportReqVO;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempletePageReqVO;
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
import org.apache.ibatis.annotations.Mapper;
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/package-info.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/package-info.java
new file mode 100644
index 000000000..6743fd141
--- /dev/null
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/package-info.java
@@ -0,0 +1,6 @@
+/**
+ * coupon模块,主要负责麦一些优惠券的额增删
+ *
+ * 1. Controller URL:以 /coumon/ 开头,避免和其它 Module 冲突
+ */
+package cn.iocoder.yudao.module.coupon;
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteService.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteService.java
index f0ad215c8..0527d11b7 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteService.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteService.java
@@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.coupon.service.CouponTemplete;
import java.util.*;
import javax.validation.*;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.*;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
diff --git a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteServiceImpl.java b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteServiceImpl.java
index f3f826b81..6f07c4b2a 100644
--- a/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteServiceImpl.java
+++ b/yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/service/CouponTemplete/CouponTempleteServiceImpl.java
@@ -2,14 +2,13 @@ package cn.iocoder.yudao.module.coupon.service.CouponTemplete;
import cn.iocoder.yudao.module.CouponTemplete.enums.CouponTypeEnum;
import cn.iocoder.yudao.module.CouponTemplete.enums.CouponValidityTypeEnum;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteCreateReqVO;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteExportReqVO;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempletePageReqVO;
-import cn.iocoder.yudao.module.coupon.controller.admin.coupontemplete.vo.CouponTempleteUpdateReqVO;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteCreateReqVO;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteExportReqVO;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempletePageReqVO;
+import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteUpdateReqVO;
import cn.iocoder.yudao.module.coupon.convert.CouponTemplete.CouponTempleteConvert;
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
import cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete.CouponTempleteMapper;
-import cn.iocoder.yudao.module.coupon.service.CouponTemplete.CouponTempleteService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -41,7 +40,7 @@ public class CouponTempleteServiceImpl implements CouponTempleteService {
/* 验证类型、判断必填*/
checkCouponType(createReqVO);
- /*todo 验证过期类型、判断必填*/
+ /*验证过期类型、判断必填*/
checkValidityType(createReqVO);
diff --git a/yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/api/price/dto/PriceCalculateRespDTO.java b/yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/api/price/dto/PriceCalculateRespDTO.java
index dc4f10a10..3fc247a02 100644
--- a/yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/api/price/dto/PriceCalculateRespDTO.java
+++ b/yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/api/price/dto/PriceCalculateRespDTO.java
@@ -19,15 +19,10 @@ public class PriceCalculateRespDTO {
*/
private Order order;
- /**
- * 商品 SKU 数组
- */
- private List- items;
-
/**
* 营销活动数组
*
- * 只对应 {@link #items} 商品匹配的活动
+ * 只对应 {@link Order#items} 商品匹配的活动
*/
private List promotions;
@@ -40,13 +35,13 @@ public class PriceCalculateRespDTO {
/**
* 商品原价(总),单位:分
*
- * 基于 {@link Item#getTotalOriginalPrice()} 求和
+ * 基于 {@link OrderItem#getTotalOriginalPrice()} 求和
*/
private Integer skuOriginalPrice;
/**
* 商品优惠(总),单位:分
*
- * 基于 {@link Item#getTotalPromotionPrice()} 求和
+ * 基于 {@link OrderItem#getTotalPromotionPrice()} 求和
*/
private Integer skuPromotionPrice;
/**
@@ -69,6 +64,10 @@ public class PriceCalculateRespDTO {
*/
// * - {@link #couponPrice} // TODO 芋艿:靠营销表记录
private Integer payPrice;
+ /**
+ * 商品 SKU 数组
+ */
+ private List items;
// ========== 营销基本信息 ==========
/**
@@ -85,10 +84,15 @@ public class PriceCalculateRespDTO {
}
/**
- * 商品 SKU
+ * 订单商品 SKU
*/
@Data
- public static class Item extends PriceCalculateReqDTO.Item {
+ public static class OrderItem extends PriceCalculateReqDTO.Item {
+
+ /**
+ * 购买数量
+ */
+ private Integer count;
/**
* 商品原价(单),单位:分
@@ -140,6 +144,10 @@ public class PriceCalculateRespDTO {
* 例如说:营销活动的编号、优惠劵的编号
*/
private Long id;
+ /**
+ * 营销名字
+ */
+ private String name;
/**
* 营销类型
*
@@ -152,10 +160,6 @@ public class PriceCalculateRespDTO {
* 枚举 {@link PromotionLevelEnum}
*/
private Integer level;
- /**
- * 匹配的商品 SKU 数组
- */
- private List
- items;
/**
* 计算时的原价(总),单位:分
*/
@@ -164,6 +168,13 @@ public class PriceCalculateRespDTO {
* 计算时的优惠(总),单位:分
*/
private Integer totalPromotionPrice;
+ /**
+ * 匹配的商品 SKU 数组
+ */
+ private List items;
+
+ // ========== 匹配情况 ==========
+
/**
* 是否满足优惠条件
*/
@@ -176,26 +187,26 @@ public class PriceCalculateRespDTO {
*/
private String meetTip;
+ }
+
+ /**
+ * 营销匹配的商品 SKU
+ */
+ @Data
+ public static class PromotionItem {
+
/**
- * 匹配的商品 SKU
+ * 商品 SKU 编号
*/
- @Data
- public static class Item {
-
- /**
- * 商品 SKU 编号
- */
- private Long skuId;
- /**
- * 计算时的原价(总),单位:分
- */
- private Integer totalOriginalPrice;
- /**
- * 计算时的优惠(总),单位:分
- */
- private Integer totalPromotionPrice;
-
- }
+ private Long skuId;
+ /**
+ * 计算时的原价(总),单位:分
+ */
+ private Integer totalOriginalPrice;
+ /**
+ * 计算时的优惠(总),单位:分
+ */
+ private Integer totalPromotionPrice;
}
diff --git a/yudao-module-mall/yudao-module-market-biz/pom.xml b/yudao-module-mall/yudao-module-market-biz/pom.xml
index e7fa33e9d..669e9ed63 100644
--- a/yudao-module-mall/yudao-module-market-biz/pom.xml
+++ b/yudao-module-mall/yudao-module-market-biz/pom.xml
@@ -24,6 +24,11 @@
yudao-module-market-api
${revision}
+
+ cn.iocoder.boot
+ yudao-module-product-api
+ ${revision}
+
diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/api/discount/package-info.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/api/discount/package-info.java
new file mode 100644
index 000000000..47820ec86
--- /dev/null
+++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/api/discount/package-info.java
@@ -0,0 +1 @@
+package cn.iocoder.yudao.module.market.api.discount;
diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/api/price/PriceApiImpl.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/api/price/PriceApiImpl.java
index 5b37322ce..74806dc0a 100644
--- a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/api/price/PriceApiImpl.java
+++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/api/price/PriceApiImpl.java
@@ -2,19 +2,25 @@ package cn.iocoder.yudao.module.market.api.price;
import cn.iocoder.yudao.module.market.api.price.dto.PriceCalculateReqDTO;
import cn.iocoder.yudao.module.market.api.price.dto.PriceCalculateRespDTO;
+import cn.iocoder.yudao.module.market.service.price.PriceService;
import org.springframework.stereotype.Service;
-import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
/**
- * @author LeeYan9
- * @since 2022-09-06
+ * 价格 API 实现类
+ *
+ * @author 芋道源码
*/
@Service
-@Validated
public class PriceApiImpl implements PriceApi {
+ @Resource
+ private PriceService priceService;
+
@Override
public PriceCalculateRespDTO calculatePrice(PriceCalculateReqDTO calculateReqDTO) {
- return null;
+ return priceService.calculatePrice(calculateReqDTO);
}
+
}
diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/convert/price/PriceConvert.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/convert/price/PriceConvert.java
new file mode 100644
index 000000000..c88c2a2c4
--- /dev/null
+++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/convert/price/PriceConvert.java
@@ -0,0 +1,40 @@
+package cn.iocoder.yudao.module.market.convert.price;
+
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
+import cn.iocoder.yudao.module.market.api.price.dto.PriceCalculateReqDTO;
+import cn.iocoder.yudao.module.market.api.price.dto.PriceCalculateRespDTO;
+import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface PriceConvert {
+
+ PriceConvert INSTANCE = Mappers.getMapper(PriceConvert.class);
+
+ default PriceCalculateRespDTO convert(PriceCalculateReqDTO calculateReqDTO, List skuList) {
+ // 创建 PriceCalculateRespDTO 对象
+ PriceCalculateRespDTO priceCalculate = new PriceCalculateRespDTO();
+ priceCalculate.setOrder(new PriceCalculateRespDTO.Order().setSkuOriginalPrice(0).setSkuPromotionPrice(0)
+ .setOrderPromotionPrice(0).setDeliveryPrice(0).setPayPrice(0).setItems(new ArrayList<>())
+ .setCouponId(calculateReqDTO.getCouponId()));
+ priceCalculate.setPromotions(new ArrayList<>());
+ // 创建它的 OrderItem 属性
+ Map skuIdCountMap = CollectionUtils.convertMap(calculateReqDTO.getItems(),
+ PriceCalculateReqDTO.Item::getSkuId, PriceCalculateReqDTO.Item::getCount);
+ skuList.forEach(sku -> {
+ Integer count = skuIdCountMap.get(sku.getId());
+ PriceCalculateRespDTO.OrderItem orderItem = new PriceCalculateRespDTO.OrderItem().setCount(count)
+ .setOriginalPrice(sku.getPrice()).setTotalOriginalPrice(sku.getPrice() * count).setTotalPromotionPrice(0);
+ orderItem.setTotalPresentPrice(orderItem.getTotalPresentPrice()).setPresentPrice(orderItem.getOriginalPrice())
+ .setTotalPayPrice(orderItem.getTotalPayPrice());
+ priceCalculate.getOrder().getItems().add(orderItem);
+ });
+ return priceCalculate;
+ }
+
+}
diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/price/PriceService.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/price/PriceService.java
new file mode 100644
index 000000000..9158199d9
--- /dev/null
+++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/price/PriceService.java
@@ -0,0 +1,21 @@
+package cn.iocoder.yudao.module.market.service.price;
+
+import cn.iocoder.yudao.module.market.api.price.dto.PriceCalculateReqDTO;
+import cn.iocoder.yudao.module.market.api.price.dto.PriceCalculateRespDTO;
+
+/**
+ * 价格计算 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface PriceService {
+
+ /**
+ * 计算商品的价格
+ *
+ * @param calculateReqDTO 价格请求
+ * @return 价格相应
+ */
+ PriceCalculateRespDTO calculatePrice(PriceCalculateReqDTO calculateReqDTO);
+
+}
diff --git a/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/price/PriceServiceImpl.java b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/price/PriceServiceImpl.java
new file mode 100644
index 000000000..9c6649ec1
--- /dev/null
+++ b/yudao-module-mall/yudao-module-market-biz/src/main/java/cn/iocoder/yudao/module/market/service/price/PriceServiceImpl.java
@@ -0,0 +1,64 @@
+package cn.iocoder.yudao.module.market.service.price;
+
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
+import cn.iocoder.yudao.module.market.api.price.dto.PriceCalculateReqDTO;
+import cn.iocoder.yudao.module.market.api.price.dto.PriceCalculateRespDTO;
+import cn.iocoder.yudao.module.market.convert.price.PriceConvert;
+import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi;
+import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SKU_NOT_EXISTS;
+import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SKU_STOCK_NOT_ENOUGH;
+
+/**
+ * 价格计算 Service 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+@Validated
+public class PriceServiceImpl implements PriceService {
+
+ @Resource
+ private ProductSkuApi productSkuApi;
+
+ @Override
+ public PriceCalculateRespDTO calculatePrice(PriceCalculateReqDTO calculateReqDTO) {
+ // 获得商品 SKU 数组
+ List skuList = checkProductSkus(calculateReqDTO);
+ // 初始化 PriceCalculateRespDTO 对象
+ PriceCalculateRespDTO priceCalculate = PriceConvert.INSTANCE.convert(calculateReqDTO, skuList);
+
+ // 计算【限时折扣】促销 TODO 待实现
+ // 计算【满减送】促销 TODO 待实现
+ // 计算【优惠劵】促销 TODO 待实现
+ return priceCalculate;
+ }
+
+ private List checkProductSkus(PriceCalculateReqDTO calculateReqDTO) {
+ // 获得商品 SKU 数组
+ Map skuIdCountMap = CollectionUtils.convertMap(calculateReqDTO.getItems(),
+ PriceCalculateReqDTO.Item::getSkuId, PriceCalculateReqDTO.Item::getCount);
+ List skus = productSkuApi.getSkuList(skuIdCountMap.keySet());
+
+ // 校验商品 SKU
+ skus.forEach(sku -> {
+ Integer count = skuIdCountMap.get(sku.getId());
+ if (count == null) {
+ throw exception(SKU_NOT_EXISTS);
+ }
+ if (count > sku.getStock()) {
+ throw exception(SKU_STOCK_NOT_ENOUGH);
+ }
+ });
+ return skus;
+ }
+
+}
diff --git a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApi.java b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApi.java
index b3915407f..1c69ea490 100644
--- a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApi.java
+++ b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApi.java
@@ -1,25 +1,34 @@
package cn.iocoder.yudao.module.product.api.sku;
import cn.iocoder.yudao.module.product.api.sku.dto.SkuDecrementStockBatchReqDTO;
-import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO;
+import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
import java.util.Collection;
import java.util.List;
/**
+ * 商品 SKU API 接口
+ *
* @author LeeYan9
* @since 2022-08-26
*/
public interface ProductSkuApi {
+ /**
+ * 查询 SKU 信息
+ *
+ * @param id SKU 编号
+ * @return SKU 信息
+ */
+ ProductSkuRespDTO getSku(Long id);
/**
- * 根据skuId列表 查询sku信息
+ * 批量查询 SKU 数组
*
- * @param skuIds sku ID列表
- * @return sku信息列表
+ * @param ids SKU 编号列表
+ * @return SKU 数组
*/
- List getSkusByIds(Collection skuIds);
+ List getSkuList(Collection ids);
/**
* 批量扣减sku库存
@@ -27,4 +36,5 @@ public interface ProductSkuApi {
* @param batchReqDTO sku库存信息列表
*/
void decrementStockBatch(SkuDecrementStockBatchReqDTO batchReqDTO);
+
}
diff --git a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/dto/SkuInfoRespDTO.java b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/dto/ProductSkuRespDTO.java
similarity index 95%
rename from yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/dto/SkuInfoRespDTO.java
rename to yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/dto/ProductSkuRespDTO.java
index f9d349e48..4b324149b 100644
--- a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/dto/SkuInfoRespDTO.java
+++ b/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;
import java.util.List;
/**
+ * 商品 SKU 信息 Response DTO
+ *
* @author LeeYan9
* @since 2022-08-26
*/
@Data
-public class SkuInfoRespDTO {
+public class ProductSkuRespDTO {
/**
* 商品 SKU 编号,自增
diff --git a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApi.java b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApi.java
index 0aa2fc732..461fbe935 100644
--- a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApi.java
+++ b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApi.java
@@ -6,17 +6,19 @@ import java.util.Collection;
import java.util.List;
/**
+ * 商品 SPU API 接口
+ *
* @author LeeYan9
* @since 2022-08-26
*/
public interface ProductSpuApi {
-
/**
- * 根据spuId列表 查询spu信息
+ * 批量查询 SPU 数组
*
- * @param spuIds spu ID列表
- * @return spu信息列表
+ * @param ids SPU 编号列表
+ * @return SPU 数组
*/
- List getSpusByIds(Collection spuIds);
+ List getSpuList(Collection ids);
+
}
diff --git a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/dto/SpuInfoRespDTO.java b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/dto/SpuInfoRespDTO.java
index 6d0206b7d..4392d9ad0 100644
--- a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/dto/SpuInfoRespDTO.java
+++ b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/dto/SpuInfoRespDTO.java
@@ -1,6 +1,6 @@
package cn.iocoder.yudao.module.product.api.spu.dto;
-import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO;
+import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuSpecTypeEnum;
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
import lombok.Data;
@@ -80,25 +80,25 @@ public class SpuInfoRespDTO {
/**
* 最小价格,单位使用:分
*
- * 基于其对应的 {@link SkuInfoRespDTO#getPrice()} 最小值
+ * 基于其对应的 {@link ProductSkuRespDTO#getPrice()} 最小值
*/
private Integer minPrice;
/**
* 最大价格,单位使用:分
*
- * 基于其对应的 {@link SkuInfoRespDTO#getPrice()} 最大值
+ * 基于其对应的 {@link ProductSkuRespDTO#getPrice()} 最大值
*/
private Integer maxPrice;
/**
* 市场价,单位使用:分
*
- * 基于其对应的 {@link SkuInfoRespDTO#getMarketPrice()} 最大值
+ * 基于其对应的 {@link ProductSkuRespDTO#getMarketPrice()} 最大值
*/
private Integer marketPrice;
/**
* 总库存
*
- * 基于其对应的 {@link SkuInfoRespDTO#getStock()} 求和
+ * 基于其对应的 {@link ProductSkuRespDTO#getStock()} 求和
*/
private Integer totalStock;
/**
diff --git a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java
index 454314e78..a3d64d42c 100644
--- a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java
+++ b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java
@@ -10,30 +10,32 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
// ========== 商品分类相关 1008001000 ============
- ErrorCode PRODUCT_CATEGORY_NOT_EXISTS = new ErrorCode(1008001000, "商品分类不存在");
- ErrorCode PRODUCT_CATEGORY_PARENT_NOT_EXISTS = new ErrorCode(1008001001, "父分类不存在");
- ErrorCode PRODUCT_CATEGORY_PARENT_NOT_FIRST_LEVEL = new ErrorCode(1008001002, "父分类不能是二级分类");
- ErrorCode PRODUCT_CATEGORY_EXISTS_CHILDREN = new ErrorCode(1008001003, "存在子分类,无法删除");
- ErrorCode PRODUCT_CATEGORY_DISABLED = new ErrorCode(1008001004, "商品分类({})已禁用,无法使用");
- ErrorCode PRODUCT_CATEGORY_LEVEL = new ErrorCode(1008001005, "商品需挂在三级分类下");
+ ErrorCode CATEGORY_NOT_EXISTS = new ErrorCode(1008001000, "商品分类不存在");
+ ErrorCode CATEGORY_PARENT_NOT_EXISTS = new ErrorCode(1008001001, "父分类不存在");
+ ErrorCode CATEGORY_PARENT_NOT_FIRST_LEVEL = new ErrorCode(1008001002, "父分类不能是二级分类");
+ ErrorCode CATEGORY_EXISTS_CHILDREN = new ErrorCode(1008001003, "存在子分类,无法删除");
+ ErrorCode CATEGORY_DISABLED = new ErrorCode(1008001004, "商品分类({})已禁用,无法使用");
+ ErrorCode CATEGORY_LEVEL_ERROR = new ErrorCode(1008001005, "商品分类不正确,原因:必须使用第三级的商品分类下");
- // ========== 品牌相关编号 1008002000 ==========
- ErrorCode PRODUCT_BRAND_NOT_EXISTS = new ErrorCode(1008002000, "品牌不存在");
+ // ========== 商品品牌相关编号 1008002000 ==========
+ ErrorCode BRAND_NOT_EXISTS = new ErrorCode(1008002000, "品牌不存在");
+ ErrorCode BRAND_DISABLED = new ErrorCode(1008002001, "品牌不存在");
+ ErrorCode BRAND_NAME_EXISTS = new ErrorCode(1008002002, "品牌名称已存在");
- // ========== 规格名称 1008003000 ==========
+ // ========== 商品规格名称 1008003000 ==========
ErrorCode PROPERTY_NOT_EXISTS = new ErrorCode(1008003000, "规格名称不存在");
// ========== 规格值 1008004000 ==========
ErrorCode PROPERTY_VALUE_NOT_EXISTS = new ErrorCode(1008004000, "规格值不存在");
- // ========== 商品spu 1008005000 ==========
- ErrorCode SPU_NOT_EXISTS = new ErrorCode(1008005000, "商品spu不存在");
+ // ========== 商品 SPU 1008005000 ==========
+ ErrorCode SPU_NOT_EXISTS = new ErrorCode(1008005000, "商品 SPU 不存在");
- // ========== 商品sku 1008006000 ==========
- ErrorCode SKU_NOT_EXISTS = new ErrorCode(1008006000, "商品sku不存在");
- ErrorCode SKU_PROPERTIES_DUPLICATED = new ErrorCode(1008006001, "商品sku的属性组合存在重复");
+ // ========== 商品 SKU 1008006000 ==========
+ ErrorCode SKU_NOT_EXISTS = new ErrorCode(1008006000, "商品 SKU 不存在");
+ ErrorCode SKU_PROPERTIES_DUPLICATED = new ErrorCode(1008006001, "商品 SKU 的属性组合存在重复");
+ ErrorCode SPU_ATTR_NUMBERS_MUST_BE_EQUALS = new ErrorCode(1008006002, "一个 SPU 下的每个 SKU,其规格数必须一致");
+ ErrorCode SPU_SKU_NOT_DUPLICATE = new ErrorCode(1008006003, "一个 SPU 下的每个 SKU,必须不重复");
+ ErrorCode SKU_STOCK_NOT_ENOUGH = new ErrorCode(1008006004, "商品 SKU 库存不足");
- ErrorCode PRODUCT_SPU_ATTR_NUMBERS_MUST_BE_EQUALS = new ErrorCode(1008006002, "一个 Spu 下的每个 SKU ,其规格数必须一致");
-
- ErrorCode PRODUCT_SPU_SKU_NOT_DUPLICATE = new ErrorCode(1008006003, "一个 SPU 下的每个 SKU ,必须不重复");
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/package-info.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/package-info.java
new file mode 100644
index 000000000..162453c3c
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/package-info.java
@@ -0,0 +1 @@
+package cn.iocoder.yudao.module.product.api;
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/ProductBrandController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/ProductBrandController.java
index 14ffef881..2227afeaf 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/ProductBrandController.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/ProductBrandController.java
@@ -2,8 +2,6 @@ package cn.iocoder.yudao.module.product.controller.admin.brand;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
-import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.product.controller.admin.brand.vo.*;
import cn.iocoder.yudao.module.product.convert.brand.ProductBrandConvert;
import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO;
@@ -16,13 +14,11 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
-import java.io.IOException;
+import java.util.Comparator;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "管理后台 - 商品品牌")
@RestController
@@ -37,7 +33,7 @@ public class ProductBrandController {
@ApiOperation("创建品牌")
@PreAuthorize("@ss.hasPermission('product:brand:create')")
public CommonResult createBrand(@Valid @RequestBody ProductBrandCreateReqVO createReqVO) {
- return success(brandService.createProductBrand(createReqVO));
+ return success(brandService.createBrand(createReqVO));
}
@PutMapping("/update")
@@ -74,4 +70,13 @@ public class ProductBrandController {
return success(ProductBrandConvert.INSTANCE.convertPage(pageResult));
}
+ @GetMapping("/list")
+ @ApiOperation("获得品牌列表")
+ @PreAuthorize("@ss.hasPermission('product:brand:query')")
+ public CommonResult> getBrandList(@Valid ProductBrandListReqVO listVO) {
+ List list = brandService.getBrandList(listVO);
+ list.sort(Comparator.comparing(ProductBrandDO::getSort));
+ return success(ProductBrandConvert.INSTANCE.convertList(list));
+ }
+
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandBaseVO.java
index 3ad5d45ee..fa5ecd2d1 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandBaseVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandBaseVO.java
@@ -20,7 +20,8 @@ public class ProductBrandBaseVO {
@NotNull(message = "品牌图片不能为空")
private String picUrl;
- @ApiModelProperty(value = "品牌排序", example = "1")
+ @ApiModelProperty(value = "品牌排序", required = true, example = "1")
+ @NotNull(message = "品牌排序不能为空")
private Integer sort;
@ApiModelProperty(value = "品牌描述", example = "描述")
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandListReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandListReqVO.java
new file mode 100644
index 000000000..5367e2dfe
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandListReqVO.java
@@ -0,0 +1,14 @@
+package cn.iocoder.yudao.module.product.controller.admin.brand.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@ApiModel(value = "管理后台 - 商品品牌分页 Request VO")
+@Data
+public class ProductBrandListReqVO {
+
+ @ApiModelProperty(value = "品牌名称", example = "芋道")
+ private String name;
+
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandPageReqVO.java
index 8dae40244..3b3d829de 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandPageReqVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandPageReqVO.java
@@ -21,7 +21,7 @@ public class ProductBrandPageReqVO extends PageParam {
@ApiModelProperty(value = "品牌名称", example = "芋道")
private String name;
- @ApiModelProperty(value = "状态", example = "0")
+ @ApiModelProperty(value = "状态", example = "0", notes = "参考 CommonStatusEnum 枚举")
private Integer status;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/category/ProductCategoryController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/category/ProductCategoryController.java
index 4467d392a..4144e6a57 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/category/ProductCategoryController.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/category/ProductCategoryController.java
@@ -34,15 +34,15 @@ public class ProductCategoryController {
@PostMapping("/create")
@ApiOperation("创建商品分类")
@PreAuthorize("@ss.hasPermission('product:category:create')")
- public CommonResult createProductCategory(@Valid @RequestBody ProductCategoryCreateReqVO createReqVO) {
- return success(categoryService.createProductCategory(createReqVO));
+ public CommonResult createCategory(@Valid @RequestBody ProductCategoryCreateReqVO createReqVO) {
+ return success(categoryService.createCategory(createReqVO));
}
@PutMapping("/update")
@ApiOperation("更新商品分类")
@PreAuthorize("@ss.hasPermission('product:category:update')")
- public CommonResult updateProductCategory(@Valid @RequestBody ProductCategoryUpdateReqVO updateReqVO) {
- categoryService.updateProductCategory(updateReqVO);
+ public CommonResult updateCategory(@Valid @RequestBody ProductCategoryUpdateReqVO updateReqVO) {
+ categoryService.updateCategory(updateReqVO);
return success(true);
}
@@ -50,8 +50,8 @@ public class ProductCategoryController {
@ApiOperation("删除商品分类")
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('product:category:delete')")
- public CommonResult deleteProductCategory(@RequestParam("id") Long id) {
- categoryService.deleteProductCategory(id);
+ public CommonResult deleteCategory(@RequestParam("id") Long id) {
+ categoryService.deleteCategory(id);
return success(true);
}
@@ -59,16 +59,16 @@ public class ProductCategoryController {
@ApiOperation("获得商品分类")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('product:category:query')")
- public CommonResult getProductCategory(@RequestParam("id") Long id) {
- ProductCategoryDO category = categoryService.getProductCategory(id);
+ public CommonResult getCategory(@RequestParam("id") Long id) {
+ ProductCategoryDO category = categoryService.getCategory(id);
return success(ProductCategoryConvert.INSTANCE.convert(category));
}
@GetMapping("/list")
@ApiOperation("获得商品分类列表")
@PreAuthorize("@ss.hasPermission('product:category:query')")
- public CommonResult> getProductCategoryList(@Valid ProductCategoryListReqVO treeListReqVO) {
- List list = categoryService.getEnableProductCategoryList(treeListReqVO);
+ public CommonResult> getCategoryList(@Valid ProductCategoryListReqVO treeListReqVO) {
+ List list = categoryService.getEnableCategoryList(treeListReqVO);
list.sort(Comparator.comparing(ProductCategoryDO::getSort));
return success(ProductCategoryConvert.INSTANCE.convertList(list));
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java
index f1d31acab..72a8bf603 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java
@@ -1,29 +1,22 @@
package cn.iocoder.yudao.module.product.controller.admin.property;
-import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
-import org.springframework.web.bind.annotation.*;
-import javax.annotation.Resource;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.security.access.prepost.PreAuthorize;
-import io.swagger.annotations.*;
-
-import javax.validation.*;
-import javax.servlet.http.*;
-import java.util.*;
-import java.io.IOException;
-
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-
-import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
-
-import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
-import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
-
-import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
-import cn.iocoder.yudao.module.product.convert.property.ProductPropertyConvert;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.*;
import cn.iocoder.yudao.module.product.service.property.ProductPropertyService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Api(tags = "管理后台 - 规格名称")
@RestController
@@ -68,30 +61,23 @@ public class ProductPropertyController {
@GetMapping("/list")
@ApiOperation("获得规格名称列表")
- @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('product:property:query')")
- public CommonResult> getPropertyList(@RequestParam("ids") Collection ids) {
- List list = productPropertyService.getPropertyList(ids);
- return success(ProductPropertyConvert.INSTANCE.convertList(list));
+ public CommonResult> getPropertyList(@Valid ProductPropertyListReqVO listReqVO) {
+ return success(productPropertyService.getPropertyList(listReqVO));
}
@GetMapping("/page")
@ApiOperation("获得规格名称分页")
@PreAuthorize("@ss.hasPermission('product:property:query')")
public CommonResult> getPropertyPage(@Valid ProductPropertyPageReqVO pageVO) {
- return success(productPropertyService.getPropertyListPage(pageVO));
+ return success(productPropertyService.getPropertyPage(pageVO));
}
- @GetMapping("/export-excel")
- @ApiOperation("导出规格名称 Excel")
- @PreAuthorize("@ss.hasPermission('product:property:export')")
- @OperateLog(type = EXPORT)
- public void exportPropertyExcel(@Valid ProductPropertyExportReqVO exportReqVO,
- HttpServletResponse response) throws IOException {
- List list = productPropertyService.getPropertyList(exportReqVO);
- // 导出 Excel
- List datas = ProductPropertyConvert.INSTANCE.convertList02(list);
- ExcelUtils.write(response, "规格名称.xls", "数据", ProductPropertyExcelVO.class, datas);
+ @GetMapping("/listAndValue")
+ @ApiOperation("获得规格名称列表")
+ @PreAuthorize("@ss.hasPermission('product:property:query')")
+ public CommonResult> getPropertyAndValueList(@Valid ProductPropertyListReqVO listReqVO) {
+ return success(productPropertyService.getPropertyAndValueList(listReqVO));
}
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyValueController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyValueController.java
new file mode 100644
index 000000000..e88c91415
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyValueController.java
@@ -0,0 +1,70 @@
+package cn.iocoder.yudao.module.product.controller.admin.property;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyPageReqVO;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
+import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Api(tags = "管理后台 - 规格值名称")
+@RestController
+@RequestMapping("/product/property/value")
+@Validated
+public class ProductPropertyValueController {
+
+ @Resource
+ private ProductPropertyValueService productPropertyValueService;
+
+ @PostMapping("/create")
+ @ApiOperation("创建规格名称")
+ @PreAuthorize("@ss.hasPermission('product:property:create')")
+ public CommonResult createProperty(@Valid @RequestBody ProductPropertyValueCreateReqVO createReqVO) {
+ return success(productPropertyValueService.createPropertyValue(createReqVO));
+ }
+
+ @PutMapping("/update")
+ @ApiOperation("更新规格名称")
+ @PreAuthorize("@ss.hasPermission('product:property:update')")
+ public CommonResult updateProperty(@Valid @RequestBody ProductPropertyValueUpdateReqVO updateReqVO) {
+ productPropertyValueService.updatePropertyValue(updateReqVO);
+ return success(true);
+ }
+
+ @DeleteMapping("/delete")
+ @ApiOperation("删除规格名称")
+ @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
+ @PreAuthorize("@ss.hasPermission('product:property:delete')")
+ public CommonResult deleteProperty(@RequestParam("id") Long id) {
+ productPropertyValueService.deletePropertyValue(id);
+ return success(true);
+ }
+
+ @GetMapping("/get")
+ @ApiOperation("获得规格名称")
+ @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
+ @PreAuthorize("@ss.hasPermission('product:property:query')")
+ public CommonResult getProperty(@RequestParam("id") Long id) {
+ return success(productPropertyValueService.getPropertyValue(id));
+ }
+
+ @GetMapping("/page")
+ @ApiOperation("获得规格名称分页")
+ @PreAuthorize("@ss.hasPermission('product:property:query')")
+ public CommonResult> getPropertyValuePage(@Valid ProductPropertyValuePageReqVO pageVO) {
+ return success(productPropertyValueService.getPropertyValueListPage(pageVO));
+ }
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyBaseVO.java
deleted file mode 100644
index 4d38763f9..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyBaseVO.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.property.vo;
-
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
-import javax.validation.constraints.*;
-
-/**
-* 规格名称 Base VO,提供给添加、修改、详细的子 VO 使用
-* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
-*/
-@Data
-public class ProductPropertyBaseVO {
-
- @ApiModelProperty(value = "规格名称")
- private String name;
-
- @ApiModelProperty(value = "状态: 0 开启 ,1 禁用")
- private Integer status;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyCreateReqVO.java
deleted file mode 100644
index 54d72da8a..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyCreateReqVO.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.property.vo;
-
-import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueCreateReqVO;
-import lombok.*;
-import io.swagger.annotations.*;
-
-import javax.validation.constraints.NotNull;
-import java.util.List;
-
-@ApiModel("管理后台 - 规格名称创建 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class ProductPropertyCreateReqVO extends ProductPropertyBaseVO {
-
- @ApiModelProperty(value = "属性值")
- @NotNull(message = "属性值不能为空")
- List propertyValueList;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyExcelVO.java
deleted file mode 100644
index c935c1001..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyExcelVO.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.property.vo;
-
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
-
-import com.alibaba.excel.annotation.ExcelProperty;
-
-/**
- * 规格名称 Excel VO
- *
- * @author 芋道源码
- */
-@Data
-public class ProductPropertyExcelVO {
-
- @ExcelProperty("主键")
- private Long id;
-
- @ExcelProperty("规格名称")
- private String name;
-
- @ExcelProperty("状态: 0 开启 ,1 禁用")
- private Integer status;
-
- @ExcelProperty("创建时间")
- private Date createTime;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyExportReqVO.java
deleted file mode 100644
index 119c76e03..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyExportReqVO.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.property.vo;
-
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-@ApiModel(value = "管理后台 - 规格名称 Excel 导出 Request VO", description = "参数和 PropertyPageReqVO 是一致的")
-@Data
-public class ProductPropertyExportReqVO {
-
- @ApiModelProperty(value = "规格名称")
- private String name;
-
- @ApiModelProperty(value = "状态: 0 开启 ,1 禁用")
- private Integer status;
-
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- @ApiModelProperty(value = "创建时间")
- private Date[] createTime;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyRespVO.java
deleted file mode 100644
index 978f26308..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyRespVO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.property.vo;
-
-import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueRespVO;
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
-
-@ApiModel("管理后台 - 规格名称 Response VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class ProductPropertyRespVO extends ProductPropertyBaseVO {
-
- @ApiModelProperty(value = "主键", required = true)
- private Long id;
-
- @ApiModelProperty(value = "创建时间")
- private Date createTime;
-
- @ApiModelProperty(value = "属性值")
- private List propertyValueList;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyViewRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyViewRespVO.java
index 0499138a9..9bdc70bd7 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyViewRespVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyViewRespVO.java
@@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
-import java.util.Set;
+import java.util.List;
/**
* @Description: ProductPropertyViewRespVO
@@ -25,16 +25,17 @@ public class ProductPropertyViewRespVO {
public String name;
@ApiModelProperty(value = "规格属性值集合", example = "[{\"v1\":11,\"v2\":\"64G\"},{\"v1\":10,\"v2\":\"32G\"}]")
- public Set propertyValues;
+ public List propertyValues;
@Data
@ApiModel(value = "规格属性值元组")
public static class Tuple2 {
- private final long v1;
- private final String v2;
- public Tuple2(Long v1, String v2) {
- this.v1 = v1;
- this.v2 = v2;
+ private final long id;
+ private final String name;
+
+ public Tuple2(Long id, String name) {
+ this.id = id;
+ this.name = name;
}
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyAndValueRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyAndValueRespVO.java
new file mode 100644
index 000000000..7684d4ea7
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyAndValueRespVO.java
@@ -0,0 +1,30 @@
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
+
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import java.util.Date;
+import java.util.List;
+
+@ApiModel("管理后台 - 规格 + 规格值 Response VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ProductPropertyAndValueRespVO extends ProductPropertyBaseVO {
+
+ @ApiModelProperty(value = "规格的编号", required = true, example = "1024")
+ private Long id;
+
+ @ApiModelProperty(value = "创建时间", required = true)
+ private Date createTime;
+
+ /**
+ * 规格值的集合
+ */
+ private List values;
+
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyBaseVO.java
new file mode 100644
index 000000000..25fc4c01a
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyBaseVO.java
@@ -0,0 +1,27 @@
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 规格名称 Base VO,提供给添加、修改、详细的子 VO 使用
+ * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
+ */
+@Data
+public class ProductPropertyBaseVO {
+
+ @ApiModelProperty(value = "规格名称", required = true, example = "颜色")
+ @NotBlank(message = "规格名称不能为空")
+ private String name;
+
+ @ApiModelProperty(value = "备注", example = "颜色")
+ private String remark;
+
+ @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
+ @NotNull(message = "状态不能为空")
+ private Integer status;
+
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyCreateReqVO.java
new file mode 100644
index 000000000..8dfd58a5d
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyCreateReqVO.java
@@ -0,0 +1,15 @@
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@ApiModel("管理后台 - 规格名称创建 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ProductPropertyCreateReqVO extends ProductPropertyBaseVO {
+
+
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyListReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyListReqVO.java
new file mode 100644
index 000000000..314288ffb
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyListReqVO.java
@@ -0,0 +1,19 @@
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.ToString;
+
+@ApiModel("管理后台 - 规格名称 List Request VO")
+@Data
+@ToString(callSuper = true)
+public class ProductPropertyListReqVO {
+
+ @ApiModelProperty(value = "规格名称", example = "颜色")
+ private String name;
+
+ @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
+ private Integer status;
+
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyPageReqVO.java
similarity index 64%
rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyPageReqVO.java
rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyPageReqVO.java
index 360a0a5e1..1902fb205 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyPageReqVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyPageReqVO.java
@@ -1,11 +1,15 @@
-package cn.iocoder.yudao.module.product.controller.admin.property.vo;
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
+import java.util.Date;
+
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 规格名称分页 Request VO")
@@ -14,10 +18,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true)
public class ProductPropertyPageReqVO extends PageParam {
- @ApiModelProperty(value = "规格名称")
+ @ApiModelProperty(value = "规格名称", example = "颜色")
private String name;
- @ApiModelProperty(value = "状态: 0 开启 ,1 禁用")
+ @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
private Integer status;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyRespVO.java
new file mode 100644
index 000000000..e42cfaba0
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyRespVO.java
@@ -0,0 +1,24 @@
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import java.util.Date;
+
+@ApiModel("管理后台 - 规格 + 规格值 Response VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ProductPropertyRespVO extends ProductPropertyBaseVO {
+
+ @ApiModelProperty(value = "规格的编号", required = true, example = "1024")
+ private Long id;
+
+ @ApiModelProperty(value = "创建时间", required = true)
+ private Date createTime;
+
+
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyUpdateReqVO.java
similarity index 66%
rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyUpdateReqVO.java
rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyUpdateReqVO.java
index ed190e8b0..f4630d874 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyUpdateReqVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyUpdateReqVO.java
@@ -1,6 +1,6 @@
-package cn.iocoder.yudao.module.product.controller.admin.property.vo;
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
-import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueCreateReqVO;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;
import lombok.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@@ -12,12 +12,8 @@ import java.util.List;
@ToString(callSuper = true)
public class ProductPropertyUpdateReqVO extends ProductPropertyBaseVO {
- @ApiModelProperty(value = "主键", required = true)
+ @ApiModelProperty(value = "主键", required = true, example = "1")
@NotNull(message = "主键不能为空")
private Long id;
- @ApiModelProperty(value = "属性值")
- @NotNull(message = "属性值不能为空")
- List propertyValueList;
-
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueBaseVO.java
new file mode 100644
index 000000000..c289e7c61
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueBaseVO.java
@@ -0,0 +1,30 @@
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.value;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+/**
+* 规格值 Base VO,提供给添加、修改、详细的子 VO 使用
+* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
+*/
+@Data
+public class ProductPropertyValueBaseVO {
+
+ @ApiModelProperty(value = "规格编号", required = true, example = "1024")
+ @NotNull(message = "规格编号不能为空")
+ private Long propertyId;
+
+ @ApiModelProperty(value = "规格值名字", required = true, example = "红色")
+ @NotEmpty(message = "规格值名字不能为空")
+ private String name;
+
+ @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
+ @NotNull(message = "状态不能为空")
+ private Integer status;
+
+ @ApiModelProperty(value = "备注", example = "颜色")
+ private String remark;
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueCreateReqVO.java
similarity index 96%
rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueCreateReqVO.java
rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueCreateReqVO.java
index 23ea0690c..f7237f9cd 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueCreateReqVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueCreateReqVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo;
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.value;
import lombok.*;
import io.swagger.annotations.*;
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValuePageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValuePageReqVO.java
new file mode 100644
index 000000000..ae77d822b
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValuePageReqVO.java
@@ -0,0 +1,31 @@
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.value;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.validation.constraints.NotEmpty;
+import java.util.Date;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@ApiModel("管理后台 - 规格名称值分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ProductPropertyValuePageReqVO extends PageParam {
+
+ @ApiModelProperty(value = "规格id", example = "1024")
+ private String propertyId;
+
+ @ApiModelProperty(value = "规格值", example = "红色")
+ private String name;
+
+ @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
+ private Integer status;
+
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueRespVO.java
similarity index 57%
rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueRespVO.java
rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueRespVO.java
index 25fa25f02..17eedaae9 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueRespVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueRespVO.java
@@ -1,8 +1,12 @@
-package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo;
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.value;
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import java.util.Date;
@ApiModel("管理后台 - 规格值 Response VO")
@Data
@@ -10,7 +14,7 @@ import io.swagger.annotations.*;
@ToString(callSuper = true)
public class ProductPropertyValueRespVO extends ProductPropertyValueBaseVO {
- @ApiModelProperty(value = "主键", required = true)
+ @ApiModelProperty(value = "主键", required = true, example = "10")
private Long id;
@ApiModelProperty(value = "创建时间")
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueUpdateReqVO.java
similarity index 83%
rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueUpdateReqVO.java
rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueUpdateReqVO.java
index 894d6f6eb..4a1bc5778 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueUpdateReqVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueUpdateReqVO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo;
+package cn.iocoder.yudao.module.product.controller.admin.property.vo.value;
import lombok.*;
import io.swagger.annotations.*;
@@ -10,7 +10,7 @@ import javax.validation.constraints.*;
@ToString(callSuper = true)
public class ProductPropertyValueUpdateReqVO extends ProductPropertyValueBaseVO {
- @ApiModelProperty(value = "主键", required = true)
+ @ApiModelProperty(value = "主键", required = true, example = "1024")
@NotNull(message = "主键不能为空")
private Integer id;
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueBaseVO.java
deleted file mode 100644
index ed600a9ac..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueBaseVO.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo;
-
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
-import javax.validation.constraints.*;
-
-/**
-* 规格值 Base VO,提供给添加、修改、详细的子 VO 使用
-* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
-*/
-@Data
-public class ProductPropertyValueBaseVO {
-
- @ApiModelProperty(value = "规格键id")
- private Long propertyId;
-
- @ApiModelProperty(value = "规格值名字")
- private String name;
-
- @ApiModelProperty(value = "状态: 1 开启 ,2 禁用")
- private Integer status;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java
index cefa6afe0..2081e7da8 100755
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java
@@ -1,27 +1,9 @@
package cn.iocoder.yudao.module.product.controller.admin.sku;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO;
-import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuPageReqVO;
-import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO;
-import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuUpdateReqVO;
-import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert;
-import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
-import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import javax.validation.Valid;
-import java.util.Collection;
-import java.util.List;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
@Api(tags = "管理后台 - 商品 sku")
@RestController
@@ -29,57 +11,4 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
public class ProductSkuController {
- @Resource
- private ProductSkuService ProductSkuService;
-
- @PostMapping("/create")
- @ApiOperation("创建商品sku")
- @PreAuthorize("@ss.hasPermission('product:sku:create')")
- public CommonResult createSku(@Valid @RequestBody ProductSkuCreateOrUpdateReqVO createReqVO) {
- return success(ProductSkuService.createSku(createReqVO));
- }
-
- @PutMapping("/update")
- @ApiOperation("更新商品sku")
- @PreAuthorize("@ss.hasPermission('product:sku:update')")
- public CommonResult updateSku(@Valid @RequestBody ProductSkuUpdateReqVO updateReqVO) {
- ProductSkuService.updateSku(updateReqVO);
- return success(true);
- }
-
- @DeleteMapping("/delete")
- @ApiOperation("删除商品sku")
- @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
- @PreAuthorize("@ss.hasPermission('product:sku:delete')")
- public CommonResult deleteSku(@RequestParam("id") Long id) {
- ProductSkuService.deleteSku(id);
- return success(true);
- }
-
- @GetMapping("/get")
- @ApiOperation("获得商品sku")
- @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
- @PreAuthorize("@ss.hasPermission('product:sku:query')")
- public CommonResult getSku(@RequestParam("id") Long id) {
- ProductSkuDO sku = ProductSkuService.getSku(id);
- return success(ProductSkuConvert.INSTANCE.convert(sku));
- }
-
- @GetMapping("/list")
- @ApiOperation("获得商品sku列表")
- @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
- @PreAuthorize("@ss.hasPermission('product:sku:query')")
- public CommonResult> getSkuList(@RequestParam("ids") Collection ids) {
- List list = ProductSkuService.getSkuList(ids);
- return success(ProductSkuConvert.INSTANCE.convertList(list));
- }
-
- @GetMapping("/page")
- @ApiOperation("获得商品sku分页")
- @PreAuthorize("@ss.hasPermission('product:sku:query')")
- public CommonResult> getSkuPage(@Valid ProductSkuPageReqVO pageVO) {
- PageResult pageResult = ProductSkuService.getSkuPage(pageVO);
- return success(ProductSkuConvert.INSTANCE.convertPage(pageResult));
- }
-
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java
index c6d8b5459..45cb447b8 100755
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java
@@ -8,7 +8,6 @@ import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
-import java.util.List;
/**
* 商品 SKU Base VO,提供给添加、修改、详细的子 VO 使用
@@ -21,11 +20,6 @@ public class ProductSkuBaseVO {
@NotEmpty(message = "商品 SKU 名字不能为空")
private String name;
- /**
- * 规格值数组
- */
- private List properties;
-
@ApiModelProperty(value = "销售价格,单位:分", required = true, example = "1024", notes = "单位:分")
@NotNull(message = "销售价格,单位:分不能为空")
private Integer price;
@@ -39,7 +33,7 @@ public class ProductSkuBaseVO {
@ApiModelProperty(value = "条形码", example = "haha")
private String barCode;
- @ApiModelProperty(value = "图片地址")
+ @ApiModelProperty(value = "图片地址", required = true, example = "https://www.iocoder.cn/xx.png")
@NotNull(message = "图片地址不能为空")
private String picUrl;
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java
index 01a09fd39..84d71d9b7 100755
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuCreateOrUpdateReqVO.java
@@ -1,14 +1,26 @@
package cn.iocoder.yudao.module.product.controller.admin.sku.vo;
import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
+import java.util.List;
+
@ApiModel("管理后台 - 商品 SKU 创建/更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ProductSkuCreateOrUpdateReqVO extends ProductSkuBaseVO {
+ // TODO @Luowenfeng:可以不用哈,如果基于规格匹配
+ @ApiModelProperty(value = "商品 id 更新时须有", example = "1")
+ private Long id;
+
+ /**
+ * 规格值数组
+ */
+ private List properties;
+
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExcelVO.java
deleted file mode 100755
index 7caf1313d..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExcelVO.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.sku.vo;
-
-import com.alibaba.excel.annotation.ExcelProperty;
-import lombok.Data;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * 商品sku Excel VO
- *
- * @author 芋道源码
- */
-@Data
-public class ProductSkuExcelVO {
-
- @ExcelProperty("主键")
- private Long id;
-
- @ExcelProperty("spu编号")
- private Long spuId;
-
- // TODO @franky:这个单元格,可能会有点展示的问题
- @ExcelProperty("规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]")
- private List properties;
-
- @ExcelProperty("销售价格,单位:分")
- private Integer price;
-
- @ExcelProperty("原价, 单位: 分")
- private Integer originalPrice;
-
- @ExcelProperty("成本价,单位: 分")
- private Integer costPrice;
-
- @ExcelProperty("条形码")
- private String barCode;
-
- @ExcelProperty("图片地址")
- private String picUrl;
-
- @ExcelProperty("状态: 0-正常 1-禁用")
- private Integer status;
-
- @ExcelProperty("创建时间")
- private Date createTime;
-
- @Data
- public static class Property {
- private Integer propertyId;
- private Integer valueId;
- }
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExportReqVO.java
deleted file mode 100755
index 0bf34a67d..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuExportReqVO.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.sku.vo;
-
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-@ApiModel(value = "管理后台 - 商品sku Excel 导出 Request VO", description = "参数和 SkuPageReqVO 是一致的")
-@Data
-public class ProductSkuExportReqVO {
-
- @ApiModelProperty(value = "spu编号")
- private Long spuId;
-
- @ApiModelProperty(value = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]")
- private String properties;
-
- @ApiModelProperty(value = "销售价格,单位:分")
- private Integer price;
-
- @ApiModelProperty(value = "原价, 单位: 分")
- private Integer originalPrice;
-
- @ApiModelProperty(value = "成本价,单位: 分")
- private Integer costPrice;
-
- @ApiModelProperty(value = "条形码")
- private String barCode;
-
- @ApiModelProperty(value = "图片地址")
- private String picUrl;
-
- @ApiModelProperty(value = "状态: 0-正常 1-禁用")
- private Integer status;
-
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- @ApiModelProperty(value = "创建时间")
- private Date[] createTime;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuPageReqVO.java
deleted file mode 100755
index b5a494902..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuPageReqVO.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.sku.vo;
-
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-@ApiModel("管理后台 - 商品sku分页 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class ProductSkuPageReqVO extends PageParam {
-
- @ApiModelProperty(value = "spu编号")
- private Long spuId;
-
- @ApiModelProperty(value = "规格值数组-json格式, [{propertId: , valueId: }, {propertId: , valueId: }]")
- private String properties;
-
- @ApiModelProperty(value = "销售价格,单位:分")
- private Integer price;
-
- @ApiModelProperty(value = "原价, 单位: 分")
- private Integer originalPrice;
-
- @ApiModelProperty(value = "成本价,单位: 分")
- private Integer costPrice;
-
- @ApiModelProperty(value = "条形码")
- private String barCode;
-
- @ApiModelProperty(value = "图片地址")
- private String picUrl;
-
- @ApiModelProperty(value = "状态: 0-正常 1-禁用")
- private Integer status;
-
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- @ApiModelProperty(value = "创建时间")
- private Date[] createTime;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java
index 3b12ba21c..46e76cc63 100755
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuRespVO.java
@@ -1,8 +1,13 @@
package cn.iocoder.yudao.module.product.controller.admin.sku.vo;
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import java.util.Date;
+import java.util.List;
@ApiModel("管理后台 - 商品sku Response VO")
@Data
@@ -10,10 +15,15 @@ import io.swagger.annotations.*;
@ToString(callSuper = true)
public class ProductSkuRespVO extends ProductSkuBaseVO {
- @ApiModelProperty(value = "主键", required = true)
+ @ApiModelProperty(value = "主键", required = true, example = "1024")
private Long id;
@ApiModelProperty(value = "创建时间")
private Date createTime;
+ /**
+ * 规格值数组
+ */
+ private List properties;
+
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuUpdateReqVO.java
deleted file mode 100755
index 984976eee..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuUpdateReqVO.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.sku.vo;
-
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
-import javax.validation.constraints.*;
-
-@ApiModel("管理后台 - 商品sku更新 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class ProductSkuUpdateReqVO extends ProductSkuBaseVO {
-
- @ApiModelProperty(value = "主键", required = true)
- @NotNull(message = "主键不能为空")
- private Long id;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java
index 565a20c7b..0e5f57ec6 100755
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java
+++ b/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;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuCreateReqVO;
-import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuUpdateReqVO;
-import cn.iocoder.yudao.module.product.controller.admin.spu.vo.SpuPageReqVO;
-import cn.iocoder.yudao.module.product.controller.admin.spu.vo.SpuRespVO;
+import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*;
import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert;
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
@@ -36,19 +33,19 @@ public class ProductSpuController {
@ApiOperation("创建商品 SPU")
@PreAuthorize("@ss.hasPermission('product:spu:create')")
public CommonResult createProductSpu(@Valid @RequestBody ProductSpuCreateReqVO createReqVO) {
- return success(spuService.createProductSpu(createReqVO));
+ return success(spuService.createSpu(createReqVO));
}
@PutMapping("/update")
@ApiOperation("更新商品 SPU")
@PreAuthorize("@ss.hasPermission('product:spu:update')")
public CommonResult updateSpu(@Valid @RequestBody ProductSpuUpdateReqVO updateReqVO) {
- spuService.updateProductSpu(updateReqVO);
+ spuService.updateSpu(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
- @ApiOperation("删除商品spu")
+ @ApiOperation("删除商品 SPU")
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('product:spu:delete')")
public CommonResult deleteSpu(@RequestParam("id") Long id) {
@@ -56,27 +53,36 @@ public class ProductSpuController {
return success(true);
}
- @GetMapping("/get")
- @ApiOperation("获得商品spu")
+ @GetMapping("/get/detail")
+ @ApiOperation("获得商品 SPU")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('product:spu:query')")
- public CommonResult getSpu(@RequestParam("id") Long id) {
+ public CommonResult getSpuDetail(@RequestParam("id") Long id) {
+ return success(spuService.getSpuDetail(id));
+ }
+
+ @GetMapping("/get")
+ @ApiOperation("获得商品 SPU")
+ @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
+ @PreAuthorize("@ss.hasPermission('product:spu:query')")
+ public CommonResult getSpu(@RequestParam("id") Long id) {
return success(spuService.getSpu(id));
}
+
@GetMapping("/list")
- @ApiOperation("获得商品spu列表")
- @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = Long.class)
+ @ApiOperation("获得商品 SPU 列表")
+ @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('product:spu:query')")
- public CommonResult> getSpuList(@RequestParam("ids") Collection ids) {
+ public CommonResult> getSpuList(@RequestParam("ids") Collection ids) {
List list = spuService.getSpuList(ids);
return success(ProductSpuConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
- @ApiOperation("获得商品spu分页")
+ @ApiOperation("获得商品 SPU 分页")
@PreAuthorize("@ss.hasPermission('product:spu:query')")
- public CommonResult> getSpuPage(@Valid SpuPageReqVO pageVO) {
+ public CommonResult> getSpuPage(@Valid ProductSpuPageReqVO pageVO) {
return success(spuService.getSpuPage(pageVO));
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java
index c320f902f..826cdd6c4 100755
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
import cn.iocoder.yudao.framework.common.validation.InEnum;
+import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuSpecTypeEnum;
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
import io.swagger.annotations.ApiModelProperty;
@@ -35,8 +36,7 @@ public class ProductSpuBaseVO {
@NotNull(message = "商品分类编号不能为空")
private Long categoryId;
- @ApiModelProperty(value = "商品品牌编号", required = true, example = "1")
-// @NotNull(message = "商品品牌编号不能为空")
+ @ApiModelProperty(value = "商品品牌编号", example = "1")
private Long brandId;
@ApiModelProperty(value = "商品图片的数组", required = true)
@@ -65,10 +65,28 @@ public class ProductSpuBaseVO {
@NotNull(message = "是否展示库存不能为空")
private Boolean showStock;
+ @ApiModelProperty(value = "库存", required = true, example = "true")
+ private Integer totalStock;
+
+ @ApiModelProperty(value = "市场价", example = "1024")
+ private Integer marketPrice;
+
+ @ApiModelProperty(value = " 最小价格,单位使用:分", required = true, example = "1024")
+ private Integer minPrice;
+
+ @ApiModelProperty(value = "最大价格,单位使用:分", required = true, example = "1024")
+ private Integer maxPrice;
+
// ========== 统计相关字段 =========
+ @ApiModelProperty(value = "商品销量", example = "1024")
+ private Integer salesCount;
+
@ApiModelProperty(value = "虚拟销量", required = true, example = "1024")
@NotNull(message = "虚拟销量不能为空")
private Integer virtualSalesCount;
+ @ApiModelProperty(value = "点击量", example = "1024")
+ private Integer clickCount;
+
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java
new file mode 100644
index 000000000..8986a93c8
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java
@@ -0,0 +1,64 @@
+package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
+
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPropertyViewRespVO;
+import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuBaseVO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import java.util.Date;
+import java.util.List;
+
+@ApiModel(value = "管理后台 - 商品 SPU 详细 Response VO", description = "包括关联的 SKU 等信息")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ProductSpuDetailRespVO extends ProductSpuBaseVO {
+
+ @ApiModelProperty(value = "主键", required = true, example = "1")
+ private Long id;
+
+ @ApiModelProperty(value = "创建时间")
+ private Date createTime;
+
+ /**
+ * SKU 数组
+ */
+ private List skus;
+
+ @ApiModel(value = "管理后台 - 商品 SKU 详细 Response VO")
+ @Data
+ @EqualsAndHashCode(callSuper = true)
+ @ToString(callSuper = true)
+ public static class Sku extends ProductSkuBaseVO {
+
+ /**
+ * 规格的数组
+ */
+ private List properties;
+
+ }
+
+ @ApiModel(value = "管理后台 - 商品规格的详细 Response VO")
+ @Data
+ @EqualsAndHashCode(callSuper = true)
+ @ToString(callSuper = true)
+ public static class Property extends ProductSkuBaseVO.Property {
+
+ @ApiModelProperty(value = "规格的名字", required = true, example = "颜色")
+ private String propertyName;
+
+ @ApiModelProperty(value = "规格值的名字", required = true, example = "蓝色")
+ private String valueName;
+
+ }
+
+ @ApiModelProperty(value = "分类id数组,一直递归到一级父节点", example = "[1,2,4]")
+ private List categoryIds;
+
+ @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\"}]}]")
+ private List productPropertyViews;
+
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java
new file mode 100755
index 000000000..2f0dd57e0
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java
@@ -0,0 +1,32 @@
+package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.annotations.*;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@ApiModel("管理后台 - 商品 SPU 分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ProductSpuPageReqVO extends PageParam {
+
+ @ApiModelProperty(value = "商品名称")
+ private String name;
+
+ @ApiModelProperty(value = "商品编码", example = "yudaoyuanma")
+ private String code;
+
+ @ApiModelProperty(value = "分类id")
+ private Long categoryId;
+
+ @ApiModelProperty(value = "商品品牌编号", example = "1")
+ private Long brandId;
+
+ @ApiModelProperty(value = "上下架状态: 0 上架(开启) 1 下架(禁用)")
+ private Integer status;
+
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java
new file mode 100755
index 000000000..222288770
--- /dev/null
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java
@@ -0,0 +1,23 @@
+package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import java.util.Date;
+
+@ApiModel("管理后台 - 商品 SPU Response VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ProductSpuRespVO extends ProductSpuBaseVO {
+
+ @ApiModelProperty(value = "主键", required = true, example = "1")
+ private Long id;
+
+ @ApiModelProperty(value = "创建时间")
+ private Date createTime;
+
+}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuPageReqVO.java
deleted file mode 100755
index 12eff36c7..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuPageReqVO.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
-
-import lombok.*;
-import java.util.*;
-import io.swagger.annotations.*;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-@ApiModel("管理后台 - 商品spu分页 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class SpuPageReqVO extends PageParam {
-
- @ApiModelProperty(value = "商品名称")
- private String name;
-
- @ApiModelProperty(value = "卖点")
- private String sellPoint;
-
- @ApiModelProperty(value = "描述")
- private String description;
-
- @ApiModelProperty(value = "分类id")
- private Long categoryId;
-
- @ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张")
- private String picUrls;
-
- @ApiModelProperty(value = "排序字段")
- private Integer sort;
-
- @ApiModelProperty(value = "点赞初始人数")
- private Integer likeCount;
-
- @ApiModelProperty(value = "价格 单位使用:分")
- private Integer price;
-
- @ApiModelProperty(value = "库存数量")
- private Integer quantity;
-
- @ApiModelProperty(value = "上下架状态: 0 上架(开启) 1 下架(禁用)")
- private Boolean status;
-
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- @ApiModelProperty(value = "创建时间")
- private Date[] createTime;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java
deleted file mode 100755
index 0121aec47..000000000
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/SpuRespVO.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
-
-import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPropertyViewRespVO;
-import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-
-@ApiModel("管理后台 - 商品spu Response VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class SpuRespVO extends ProductSpuBaseVO {
-
- // TODO @franky:注解要完整
-
- @ApiModelProperty(value = "主键", required = true, example = "1")
- private Long id;
-
- @ApiModelProperty(value = "创建时间")
- private Date createTime;
-
- /**
- * SKU 数组
- */
- @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}]")
- private List skus;
-
- @ApiModelProperty(value = "分类id数组,一直递归到一级父节点", example = "[1,2,4]")
- private LinkedList categoryIds;
-
- @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\"}]}]")
- private List productPropertyViews;
-
-}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/category/AppCategoryController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/category/AppCategoryController.java
index 1b5664b85..fec882c48 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/category/AppCategoryController.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/category/AppCategoryController.java
@@ -30,7 +30,7 @@ public class AppCategoryController {
@GetMapping("/list")
@ApiOperation("获得商品分类列表")
public CommonResult> getProductCategoryList() {
- List list = categoryService.getEnableProductCategoryList();
+ List list = categoryService.getEnableCategoryList();
list.sort(Comparator.comparing(ProductCategoryDO::getSort));
return success(ProductCategoryConvert.INSTANCE.convertList03(list));
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java
index 1cb07eec5..7e0f912b4 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.product.controller.app.spu;
import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.product.controller.admin.spu.vo.SpuRespVO;
import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageReqVO;
import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageRespVO;
import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuRespVO;
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppSpuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppSpuRespVO.java
index 7f638a704..b45987370 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppSpuRespVO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppSpuRespVO.java
@@ -1,10 +1,9 @@
package cn.iocoder.yudao.module.product.controller.app.spu.vo;
-import cn.iocoder.yudao.module.product.controller.admin.spu.vo.SpuRespVO;
+import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuRespVO;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
-import lombok.ToString;
/**
*
@@ -16,7 +15,7 @@ import lombok.ToString;
@ApiModel("App - 商品spu Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
-public class AppSpuRespVO extends SpuRespVO {
+public class AppSpuRespVO extends ProductSpuRespVO {
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java
index c44cdc841..9f7c46745 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java
@@ -1,13 +1,14 @@
package cn.iocoder.yudao.module.product.convert.property;
-import java.util.*;
-
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyCreateReqVO;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyRespVO;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyUpdateReqVO;
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
-import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
+
+import java.util.List;
/**
* 规格名称 Convert
@@ -29,6 +30,4 @@ public interface ProductPropertyConvert {
PageResult convertPage(PageResult page);
- List convertList02(List list);
-
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/ProductPropertyValueConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/ProductPropertyValueConvert.java
index 447b9a5ea..331ad623f 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/ProductPropertyValueConvert.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/ProductPropertyValueConvert.java
@@ -4,10 +4,12 @@ import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;
+import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
-import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*;
/**
* 规格值 Convert
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java
index 6d8d272ce..f77e1f60f 100755
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/sku/ProductSkuConvert.java
@@ -2,13 +2,12 @@ package cn.iocoder.yudao.module.product.convert.sku;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO;
+import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO;
-import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuExcelVO;
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO;
-import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuUpdateReqVO;
+import cn.iocoder.yudao.module.product.controller.admin.spu.vo.ProductSpuDetailRespVO;
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;
@@ -25,18 +24,17 @@ public interface ProductSkuConvert {
ProductSkuDO convert(ProductSkuCreateOrUpdateReqVO bean);
- ProductSkuDO convert(ProductSkuUpdateReqVO bean);
-
- @Mapping(source = "properties", target = "properties")
ProductSkuRespVO convert(ProductSkuDO bean);
List convertList(List list);
List convertSkuDOList(List list);
- PageResult convertPage(PageResult page);
+ ProductSkuRespDTO convert02(ProductSkuDO bean);
- List convertList02(List list);
+ List convertList02(List list);
+
+ List convertList03(List list);
List convertList03(List list);
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java
index 10155ef29..4eb584893 100755
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java
@@ -25,13 +25,13 @@ public interface ProductSpuConvert {
ProductSpuDO convert(ProductSpuUpdateReqVO bean);
- SpuRespVO convert(ProductSpuDO bean);
+ ProductSpuRespVO convert(ProductSpuDO bean);
- List convertList(List list);
+ List convertList(List list);
- PageResult convertPage(PageResult page);
+ PageResult convertPage(PageResult page);
- SpuPageReqVO convert(AppSpuPageReqVO bean);
+ ProductSpuPageReqVO convert(AppSpuPageReqVO bean);
AppSpuPageRespVO convertAppResp(ProductSpuDO list);
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java
index 608b248fe..b3831491e 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java
+++ b/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 {
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
+ /**
+ * 备注
+ */
+ private String remark;
// TODO 芋艿:rule;规格属性 (发布商品时,和 SKU 关联);规格参数(搜索商品时,与 Category 关联搜索)
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java
index 007b95a4f..b75f0d592 100644
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java
+++ b/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 {
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
+ /**
+ * 备注
+ *
+ */
+ private String remark;
}
diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java
index 2057aa1ae..fc7bbe9ec 100755
--- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java
+++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/sku/ProductSkuDO.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.product.dal.dataobject.sku;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
+import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO;
@@ -9,7 +10,7 @@ import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
+import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import lombok.*;
import java.util.List;
@@ -19,7 +20,7 @@ import java.util.List;
*
* @author 芋道源码
*/
-@TableName("product_sku")
+@TableName(value = "product_sku",autoResultMap = true)
@KeySequence("product_sku_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@@ -40,14 +41,14 @@ public class ProductSkuDO extends BaseDO {
private String name;
/**
* SPU 编号
- *
+ *
* 关联 {@link ProductSpuDO#getId()}
*/
private Long spuId;
/**
* 规格值数组,JSON 格式
*/
- @TableField(typeHandler = JacksonTypeHandler.class)
+ @TableField(typeHandler = PropertyTypeHandler.class)
private List properties;
/**
* 销售价格,单位:分
@@ -71,7 +72,7 @@ public class ProductSkuDO extends BaseDO {
private String picUrl;
/**
* SKU 状态
- *
+ *
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
@@ -100,19 +101,34 @@ public class ProductSkuDO extends BaseDO {
/**
* 属性编号
- *
+ *
* 关联 {@link ProductPropertyDO#getId()}
*/
private Long propertyId;
/**
* 属性值编号
- *
+ *
* 关联 {@link ProductPropertyValueDO#getId()}
*/
private Long valueId;
}
+ // TODO @芋艿:可以找一些新的思路
+ public static class PropertyTypeHandler extends AbstractJsonTypeHandler