Commit 437185cb1d5fa96fd7fe35a413f40882a15034f3
Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product
Showing
159 changed files
with
2428 additions
and
972 deletions
Too many changes.
To preserve performance only 100 of 159 files are displayed.
sql/mysql/brokerage.sql
| 1 | 1 | -- 增加配置表 |
| 2 | -create table trade_config | |
| 2 | +CREATE TABLE trade_config | |
| 3 | 3 | ( |
| 4 | - id bigint auto_increment comment '自增主键' primary key, | |
| 5 | - brokerage_enabled bit default 1 not null comment '是否启用分佣', | |
| 6 | - brokerage_enabled_condition tinyint default 0 not null comment '分佣模式:1-人人分销 2-指定分销', | |
| 7 | - brokerage_bind_mode tinyint default 0 not null comment '分销关系绑定模式: 1-没有推广人,2-新用户, 3-扫码覆盖', | |
| 8 | - brokerage_post_urls varchar(2000) default '' null comment '分销海报图地址数组', | |
| 9 | - brokerage_first_percent int default 0 not null comment '一级返佣比例', | |
| 10 | - brokerage_second_percent int default 0 not null comment '二级返佣比例', | |
| 11 | - brokerage_withdraw_min_price int default 0 not null comment '用户提现最低金额', | |
| 12 | - brokerage_bank_names varchar(200) default '' not null comment '提现银行(字典类型=brokerage_bank_name)', | |
| 13 | - brokerage_frozen_days int default 7 not null comment '佣金冻结时间(天)', | |
| 14 | - brokerage_withdraw_type varchar(32) default '1,2,3,4' not null comment '提现方式:1-钱包;2-银行卡;3-微信;4-支付宝', | |
| 15 | - creator varchar(64) default '' null comment '创建者', | |
| 16 | - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', | |
| 17 | - updater varchar(64) default '' null comment '更新者', | |
| 18 | - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间', | |
| 19 | - deleted bit default b'0' not null comment '是否删除', | |
| 20 | - tenant_id bigint default 0 not null comment '租户编号' | |
| 21 | -) comment '交易中心配置'; | |
| 4 | + id BIGINT AUTO_INCREMENT COMMENT '自增主键' PRIMARY KEY, | |
| 5 | + brokerage_enabled BIT DEFAULT 1 NOT NULL COMMENT '是否启用分佣', | |
| 6 | + brokerage_enabled_condition TINYINT DEFAULT 1 NOT NULL COMMENT '分佣模式:1-人人分销 2-指定分销', | |
| 7 | + brokerage_bind_mode TINYINT DEFAULT 1 NOT NULL COMMENT '分销关系绑定模式: 1-没有推广人,2-新用户, 3-扫码覆盖', | |
| 8 | + brokerage_poster_urls VARCHAR(2000) DEFAULT '' NULL COMMENT '分销海报图地址数组', | |
| 9 | + brokerage_first_percent INT DEFAULT 0 NOT NULL COMMENT '一级返佣比例', | |
| 10 | + brokerage_second_percent INT DEFAULT 0 NOT NULL COMMENT '二级返佣比例', | |
| 11 | + brokerage_withdraw_min_price INT DEFAULT 0 NOT NULL COMMENT '用户提现最低金额', | |
| 12 | + brokerage_withdraw_fee_percent INT DEFAULT 0 NOT NULL COMMENT '提现手续费百分比', | |
| 13 | + brokerage_bank_names VARCHAR(200) DEFAULT '' NOT NULL COMMENT '提现银行(字典类型=brokerage_bank_name)', | |
| 14 | + brokerage_frozen_days INT DEFAULT 7 NOT NULL COMMENT '佣金冻结时间(天)', | |
| 15 | + brokerage_withdraw_types VARCHAR(32) DEFAULT '1,2,3,4' NOT NULL COMMENT '提现方式:1-钱包;2-银行卡;3-微信;4-支付宝', | |
| 16 | + creator VARCHAR(64) DEFAULT '' NULL COMMENT '创建者', | |
| 17 | + create_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间', | |
| 18 | + updater VARCHAR(64) DEFAULT '' NULL COMMENT '更新者', | |
| 19 | + update_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 20 | + deleted BIT DEFAULT b'0' NOT NULL COMMENT '是否删除', | |
| 21 | + tenant_id BIGINT DEFAULT 0 NOT NULL COMMENT '租户编号' | |
| 22 | +) COMMENT '交易中心配置'; | |
| 23 | + | |
| 24 | +# alter table trade_config | |
| 25 | +# add brokerage_withdraw_fee_percent int default 0 not null comment '提现手续费百分比' after brokerage_withdraw_min_price; | |
| 22 | 26 | |
| 23 | 27 | # alter table trade_brokerage_user |
| 24 | 28 | # add level int not null default 1 comment '等级' after frozen_price; |
| ... | ... | @@ -36,8 +40,6 @@ create table trade_brokerage_user |
| 36 | 40 | brokerage_time datetime null comment '成为分销员时间', |
| 37 | 41 | price int default 0 not null comment '可用佣金', |
| 38 | 42 | frozen_price int default 0 not null comment '冻结佣金', |
| 39 | - level int default 1 not null comment '等级', | |
| 40 | - path varchar(2000) null comment '路径', | |
| 41 | 43 | creator varchar(64) default '' null comment '创建者', |
| 42 | 44 | create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', |
| 43 | 45 | updater varchar(64) default '' null comment '更新者', |
| ... | ... | @@ -83,7 +85,7 @@ create index idx_status on trade_brokerage_record (status) comment '状态'; |
| 83 | 85 | |
| 84 | 86 | create table trade_brokerage_withdraw |
| 85 | 87 | ( |
| 86 | - id int auto_increment comment '编号' | |
| 88 | + id bigint auto_increment comment '编号' | |
| 87 | 89 | primary key, |
| 88 | 90 | user_id bigint not null comment '用户编号', |
| 89 | 91 | price int default 0 not null comment '提现金额', |
| ... | ... | @@ -137,7 +139,8 @@ insert into system_dict_type(type, name) |
| 137 | 139 | values ('brokerage_record_biz_type', '佣金记录业务类型'); |
| 138 | 140 | insert into system_dict_data(dict_type, label, value, sort) |
| 139 | 141 | values ('brokerage_record_biz_type', '订单返佣', 1, 1), |
| 140 | - ('brokerage_record_biz_type', '申请提现', 2, 2); | |
| 142 | + ('brokerage_record_biz_type', '申请提现', 2, 2), | |
| 143 | + ('brokerage_record_biz_type', '申请提现驳回', 3, 3); | |
| 141 | 144 | |
| 142 | 145 | insert into system_dict_type(type, name) |
| 143 | 146 | values ('brokerage_record_status', '佣金记录状态'); | ... | ... |
sql/mysql/point.sql
0 → 100644
| 1 | +ALTER TABLE trade_order ADD COLUMN use_point int NOT NULL DEFAULT 0 COMMENT '使用的积分' AFTER point_price; | |
| 2 | +ALTER TABLE trade_order ADD COLUMN refund_point int NOT NULL DEFAULT 0 COMMENT '退还的使用积分' AFTER use_point; | |
| 3 | +ALTER TABLE trade_order ADD COLUMN give_point int NOT NULL DEFAULT 0 COMMENT '赠送的积分' AFTER refund_point; | |
| 4 | + | |
| 5 | +ALTER TABLE trade_order_item ADD COLUMN use_point int NOT NULL DEFAULT 0 COMMENT '使用的积分' AFTER point_price; | |
| 6 | +ALTER TABLE trade_order_item ADD COLUMN give_point int NOT NULL DEFAULT 0 COMMENT '赠送的积分' AFTER use_point; | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java
| ... | ... | @@ -43,17 +43,6 @@ public class LocalDateTimeUtils { |
| 43 | 43 | return LocalDateTime.of(year, mouth, day, 0, 0, 0); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - /** | |
| 47 | - * 创建指定时间 | |
| 48 | - * | |
| 49 | - * @param timeStr 时间字符串 | |
| 50 | - * @return 指定时间 | |
| 51 | - */ | |
| 52 | - public static LocalDateTime buildTime(String timeStr) { | |
| 53 | - // TODO @puhui999:这个方法的实现,和 LocalDateTimeUtil.parse() 的差异点是啥呀 | |
| 54 | - return LocalDateTime.of(LocalDate.now(), LocalTime.parse(timeStr)); | |
| 55 | - } | |
| 56 | - | |
| 57 | 46 | public static LocalDateTime[] buildBetweenTime(int year1, int mouth1, int day1, |
| 58 | 47 | int year2, int mouth2, int day2) { |
| 59 | 48 | return new LocalDateTime[]{buildTime(year1, mouth1, day1), buildTime(year2, mouth2, day2)}; | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/MoneyUtils.java
| 1 | 1 | package cn.iocoder.yudao.framework.common.util.number; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.math.Money; | |
| 3 | 4 | import cn.hutool.core.util.NumberUtil; |
| 4 | 5 | |
| 5 | 6 | import java.math.BigDecimal; |
| ... | ... | @@ -16,7 +17,7 @@ public class MoneyUtils { |
| 16 | 17 | * 计算百分比金额,四舍五入 |
| 17 | 18 | * |
| 18 | 19 | * @param price 金额 |
| 19 | - * @param rate 百分比,例如说 56.77% 则传入 56.77 | |
| 20 | + * @param rate 百分比,例如说 56.77% 则传入 56.77 | |
| 20 | 21 | * @return 百分比金额 |
| 21 | 22 | */ |
| 22 | 23 | public static Integer calculateRatePrice(Integer price, Double rate) { |
| ... | ... | @@ -27,24 +28,46 @@ public class MoneyUtils { |
| 27 | 28 | * 计算百分比金额,向下传入 |
| 28 | 29 | * |
| 29 | 30 | * @param price 金额 |
| 30 | - * @param rate 百分比,例如说 56.77% 则传入 56.77 | |
| 31 | + * @param rate 百分比,例如说 56.77% 则传入 56.77 | |
| 31 | 32 | * @return 百分比金额 |
| 32 | 33 | */ |
| 33 | 34 | public static Integer calculateRatePriceFloor(Integer price, Double rate) { |
| 34 | 35 | return calculateRatePrice(price, rate, 0, RoundingMode.FLOOR).intValue(); |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | - /** | |
| 38 | - * 计算百分比金额 | |
| 39 | - * | |
| 40 | - * @param price 金额 | |
| 41 | - * @param rate 百分比,例如说 56.77% 则传入 56.77 | |
| 42 | - * @param scale 保留小数位数 | |
| 43 | - * @param roundingMode 舍入模式 | |
| 44 | - */ | |
| 45 | - public static BigDecimal calculateRatePrice(Number price, Number rate, int scale, RoundingMode roundingMode) { | |
| 46 | - return NumberUtil.toBigDecimal(price).multiply(NumberUtil.toBigDecimal(rate)) // 乘以 | |
| 47 | - .divide(BigDecimal.valueOf(100), scale, roundingMode); // 除以 100 | |
| 48 | - } | |
| 38 | + /** | |
| 39 | + * 计算百分比金额 | |
| 40 | + * | |
| 41 | + * @param price 金额 | |
| 42 | + * @param rate 百分比,例如说 56.77% 则传入 56.77 | |
| 43 | + * @param scale 保留小数位数 | |
| 44 | + * @param roundingMode 舍入模式 | |
| 45 | + */ | |
| 46 | + public static BigDecimal calculateRatePrice(Number price, Number rate, int scale, RoundingMode roundingMode) { | |
| 47 | + return NumberUtil.toBigDecimal(price).multiply(NumberUtil.toBigDecimal(rate)) // 乘以 | |
| 48 | + .divide(BigDecimal.valueOf(100), scale, roundingMode); // 除以 100 | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 分转元 | |
| 53 | + * | |
| 54 | + * @param fen 分 | |
| 55 | + * @return 元 | |
| 56 | + */ | |
| 57 | + public static BigDecimal fenToYuan(int fen) { | |
| 58 | + return new Money(0, fen).getAmount(); | |
| 59 | + } | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 分转元(字符串) | |
| 63 | + * | |
| 64 | + * 例如说 fen 为 1 时,则结果为 0.01 | |
| 65 | + * | |
| 66 | + * @param fen 分 | |
| 67 | + * @return 元 | |
| 68 | + */ | |
| 69 | + public static String fenToYuanStr(int fen) { | |
| 70 | + return new Money(0, fen).toString(); | |
| 71 | + } | |
| 49 | 72 | |
| 50 | 73 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-error-code/pom.xml
| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | <name>${project.artifactId}</name> |
| 15 | 15 | <description> |
| 16 | 16 | 错误码 ErrorCode 的自动配置功能,提供如下功能: |
| 17 | - 1. 远程读取:项目启动时,从 system-server 服务,读取数据库中的 ErrorCode 错误码,实现错误码的提水可配置; | |
| 17 | + 1. 远程读取:项目启动时,从 system-server 服务,读取数据库中的 ErrorCode 错误码,实现错误码的提示可配置; | |
| 18 | 18 | 2. 自动更新:管理员在管理后台修数据库中的 ErrorCode 错误码时,项目自动从 system-server 服务加载最新的 ErrorCode 错误码; |
| 19 | 19 | 3. 自动写入:项目启动时,将项目本地的错误码写到 system-server 服务中,方便管理员在管理后台编辑; |
| 20 | 20 | </description> | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java
| ... | ... | @@ -100,14 +100,6 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> { |
| 100 | 100 | return betweenIfPresent(column, val1, val2); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - // TODO @疯狂:这个是 mysql 独有的,不好做成通用的哈。如果多层级,有没可能先查询一个层级,再查询一个层级;形成 set 后,直接去 in? | |
| 104 | - public LambdaQueryWrapperX<T> findInSetIfPresent(SFunction<T, ?> column, Object val) { | |
| 105 | - if (val != null) { | |
| 106 | - return (LambdaQueryWrapperX<T>) super.apply("FIND_IN_SET({0}, " + columnToString(column) + ")", val); | |
| 107 | - } | |
| 108 | - return this; | |
| 109 | - } | |
| 110 | - | |
| 111 | 103 | // ========== 重写父类方法,方便链式调用 ========== |
| 112 | 104 | |
| 113 | 105 | @Override | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/config/YudaoJacksonAutoConfiguration.java
| 1 | 1 | package cn.iocoder.yudao.framework.jackson.config; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.jackson.core.databind.NumberSerializer; | |
| 3 | +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | |
| 4 | 4 | import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeDeserializer; |
| 5 | 5 | import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeSerializer; |
| 6 | -import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | |
| 6 | +import cn.iocoder.yudao.framework.jackson.core.databind.NumberSerializer; | |
| 7 | 7 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 8 | 8 | import com.fasterxml.jackson.databind.module.SimpleModule; |
| 9 | +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; | |
| 10 | +import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; | |
| 11 | +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; | |
| 12 | +import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; | |
| 9 | 13 | import lombok.extern.slf4j.Slf4j; |
| 10 | 14 | import org.springframework.beans.BeansException; |
| 11 | 15 | import org.springframework.beans.factory.config.BeanPostProcessor; |
| 12 | 16 | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| 13 | 17 | import org.springframework.context.annotation.Bean; |
| 14 | 18 | |
| 19 | +import java.time.LocalDate; | |
| 15 | 20 | import java.time.LocalDateTime; |
| 21 | +import java.time.LocalTime; | |
| 16 | 22 | |
| 17 | 23 | @AutoConfiguration |
| 18 | 24 | @Slf4j |
| ... | ... | @@ -36,6 +42,10 @@ public class YudaoJacksonAutoConfiguration { |
| 36 | 42 | simpleModule |
| 37 | 43 | .addSerializer(Long.class, NumberSerializer.INSTANCE) |
| 38 | 44 | .addSerializer(Long.TYPE, NumberSerializer.INSTANCE) |
| 45 | + .addSerializer(LocalDate.class, LocalDateSerializer.INSTANCE) | |
| 46 | + .addDeserializer(LocalDate.class, LocalDateDeserializer.INSTANCE) | |
| 47 | + .addSerializer(LocalTime.class, LocalTimeSerializer.INSTANCE) | |
| 48 | + .addDeserializer(LocalTime.class, LocalTimeDeserializer.INSTANCE) | |
| 39 | 49 | .addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE) |
| 40 | 50 | .addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE); |
| 41 | 51 | ... | ... |
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/spu/dto/ProductSpuRespDTO.java
| ... | ... | @@ -111,6 +111,11 @@ public class ProductSpuRespDTO { |
| 111 | 111 | // ========== 物流相关字段 ========= |
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | + * 赠送积分 | |
| 115 | + */ | |
| 116 | + private Integer giveIntegral; | |
| 117 | + | |
| 118 | + /** | |
| 114 | 119 | * 物流配置模板编号 |
| 115 | 120 | * |
| 116 | 121 | * 对应 TradeDeliveryExpressTemplateDO 的 id 编号 |
| ... | ... | @@ -132,4 +137,15 @@ public class ProductSpuRespDTO { |
| 132 | 137 | */ |
| 133 | 138 | private Integer clickCount; |
| 134 | 139 | |
| 140 | + | |
| 141 | + // ========== 分销相关字段 ========= | |
| 142 | + | |
| 143 | + /** | |
| 144 | + * 分销类型 | |
| 145 | + * | |
| 146 | + * false - 默认 | |
| 147 | + * true - 自行设置 | |
| 148 | + */ | |
| 149 | + private Boolean subCommissionType; | |
| 150 | + | |
| 135 | 151 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/pom.xml
| ... | ... | @@ -23,12 +23,6 @@ |
| 23 | 23 | <artifactId>yudao-module-product-api</artifactId> |
| 24 | 24 | <version>${revision}</version> |
| 25 | 25 | </dependency> |
| 26 | - <!-- TODO 芋艿:看看~~~ --> | |
| 27 | - <dependency> | |
| 28 | - <groupId>cn.iocoder.boot</groupId> | |
| 29 | - <artifactId>yudao-module-trade-api</artifactId> | |
| 30 | - <version>${revision}</version> | |
| 31 | - </dependency> | |
| 32 | 26 | <dependency> |
| 33 | 27 | <groupId>cn.iocoder.boot</groupId> |
| 34 | 28 | <artifactId>yudao-module-member-api</artifactId> | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/property/ProductPropertyValueApiImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.product.api.property; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO; |
| 4 | -import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert; | |
| 4 | +import cn.iocoder.yudao.module.product.convert.property.ProductPropertyValueConvert; | |
| 5 | 5 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; |
| 6 | 6 | import org.springframework.stereotype.Service; |
| 7 | 7 | import org.springframework.validation.annotation.Validated; | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyValueController.java
| 1 | 1 | package cn.iocoder.yudao.module.product.controller.admin.property; |
| 2 | 2 | |
| 3 | -import cn.hutool.core.collection.CollectionUtil; | |
| 4 | -import cn.hutool.crypto.symmetric.AES; | |
| 5 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 5 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO; |
| 8 | 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO; |
| 9 | 7 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO; |
| 10 | 8 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO; |
| 11 | -import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert; | |
| 9 | +import cn.iocoder.yudao.module.product.convert.property.ProductPropertyValueConvert; | |
| 12 | 10 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; |
| 13 | 11 | import io.swagger.v3.oas.annotations.Operation; |
| 14 | 12 | import io.swagger.v3.oas.annotations.Parameter; |
| ... | ... | @@ -20,9 +18,6 @@ import org.springframework.web.bind.annotation.*; |
| 20 | 18 | import javax.annotation.Resource; |
| 21 | 19 | import javax.validation.Valid; |
| 22 | 20 | |
| 23 | -import java.util.Arrays; | |
| 24 | -import java.util.List; | |
| 25 | - | |
| 26 | 21 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 27 | 22 | |
| 28 | 23 | @Tag(name = "管理后台 - 商品属性值") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java
| 1 | 1 | package cn.iocoder.yudao.module.product.controller.app.spu; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | +import cn.iocoder.yudao.module.member.api.level.MemberLevelApi; | |
| 7 | +import cn.iocoder.yudao.module.member.api.level.dto.MemberLevelRespDTO; | |
| 8 | +import cn.iocoder.yudao.module.member.api.user.MemberUserApi; | |
| 9 | +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | |
| 5 | 10 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO; |
| 6 | -import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRespVO; | |
| 7 | 11 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; |
| 12 | +import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRespVO; | |
| 8 | 13 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; |
| 9 | 14 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 10 | 15 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| ... | ... | @@ -23,10 +28,12 @@ import org.springframework.web.bind.annotation.RestController; |
| 23 | 28 | |
| 24 | 29 | import javax.annotation.Resource; |
| 25 | 30 | import javax.validation.Valid; |
| 31 | +import java.util.Collections; | |
| 26 | 32 | import java.util.List; |
| 27 | 33 | |
| 28 | 34 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 29 | 35 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 36 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | |
| 30 | 37 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_NOT_ENABLE; |
| 31 | 38 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_NOT_EXISTS; |
| 32 | 39 | |
| ... | ... | @@ -41,6 +48,11 @@ public class AppProductSpuController { |
| 41 | 48 | @Resource |
| 42 | 49 | private ProductSkuService productSkuService; |
| 43 | 50 | |
| 51 | + @Resource | |
| 52 | + private MemberLevelApi memberLevelApi; | |
| 53 | + @Resource | |
| 54 | + private MemberUserApi memberUserApi; | |
| 55 | + | |
| 44 | 56 | @GetMapping("/list") |
| 45 | 57 | @Operation(summary = "获得商品 SPU 列表") |
| 46 | 58 | @Parameters({ |
| ... | ... | @@ -51,14 +63,32 @@ public class AppProductSpuController { |
| 51 | 63 | @RequestParam("recommendType") String recommendType, |
| 52 | 64 | @RequestParam(value = "count", defaultValue = "10") Integer count) { |
| 53 | 65 | List<ProductSpuDO> list = productSpuService.getSpuList(recommendType, count); |
| 54 | - return success(ProductSpuConvert.INSTANCE.convertListForGetSpuList(list)); | |
| 66 | + if (CollUtil.isEmpty(list)) { | |
| 67 | + return success(Collections.emptyList()); | |
| 68 | + } | |
| 69 | + | |
| 70 | + // 拼接返回 | |
| 71 | + List<AppProductSpuPageRespVO> voList = ProductSpuConvert.INSTANCE.convertListForGetSpuList(list); | |
| 72 | + // 处理 vip 价格 | |
| 73 | + MemberLevelRespDTO memberLevel = getMemberLevel(); | |
| 74 | + voList.forEach(vo -> vo.setVipPrice(calculateVipPrice(vo.getPrice(), memberLevel))); | |
| 75 | + return success(voList); | |
| 55 | 76 | } |
| 56 | 77 | |
| 57 | 78 | @GetMapping("/page") |
| 58 | 79 | @Operation(summary = "获得商品 SPU 分页") |
| 59 | 80 | public CommonResult<PageResult<AppProductSpuPageRespVO>> getSpuPage(@Valid AppProductSpuPageReqVO pageVO) { |
| 60 | 81 | PageResult<ProductSpuDO> pageResult = productSpuService.getSpuPage(pageVO); |
| 61 | - return success(ProductSpuConvert.INSTANCE.convertPageForGetSpuPage(pageResult)); | |
| 82 | + if (CollUtil.isEmpty(pageResult.getList())) { | |
| 83 | + return success(PageResult.empty(pageResult.getTotal())); | |
| 84 | + } | |
| 85 | + | |
| 86 | + // 拼接返回 | |
| 87 | + PageResult<AppProductSpuPageRespVO> voPageResult = ProductSpuConvert.INSTANCE.convertPageForGetSpuPage(pageResult); | |
| 88 | + // 处理 vip 价格 | |
| 89 | + MemberLevelRespDTO memberLevel = getMemberLevel(); | |
| 90 | + voPageResult.getList().forEach(vo -> vo.setVipPrice(calculateVipPrice(vo.getPrice(), memberLevel))); | |
| 91 | + return success(voPageResult); | |
| 62 | 92 | } |
| 63 | 93 | |
| 64 | 94 | @GetMapping("/get-detail") |
| ... | ... | @@ -74,10 +104,40 @@ public class AppProductSpuController { |
| 74 | 104 | throw exception(SPU_NOT_ENABLE); |
| 75 | 105 | } |
| 76 | 106 | |
| 77 | - // 查询商品 SKU | |
| 107 | + // 拼接返回 | |
| 78 | 108 | List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spu.getId()); |
| 79 | - // 拼接 | |
| 80 | - return success(ProductSpuConvert.INSTANCE.convertForGetSpuDetail(spu, skus)); | |
| 109 | + AppProductSpuDetailRespVO detailVO = ProductSpuConvert.INSTANCE.convertForGetSpuDetail(spu, skus); | |
| 110 | + // 处理 vip 价格 | |
| 111 | + MemberLevelRespDTO memberLevel = getMemberLevel(); | |
| 112 | + detailVO.setVipPrice(calculateVipPrice(detailVO.getPrice(), memberLevel)); | |
| 113 | + return success(detailVO); | |
| 114 | + } | |
| 115 | + | |
| 116 | + private MemberLevelRespDTO getMemberLevel() { | |
| 117 | + Long userId = getLoginUserId(); | |
| 118 | + if (userId == null) { | |
| 119 | + return null; | |
| 120 | + } | |
| 121 | + MemberUserRespDTO user = memberUserApi.getUser(userId); | |
| 122 | + if (user.getLevelId() == null || user.getLevelId() <= 0) { | |
| 123 | + return null; | |
| 124 | + } | |
| 125 | + return memberLevelApi.getMemberLevel(user.getLevelId()); | |
| 126 | + } | |
| 127 | + | |
| 128 | + /** | |
| 129 | + * 计算会员 VIP 优惠价格 | |
| 130 | + * | |
| 131 | + * @param price 原价 | |
| 132 | + * @param memberLevel 会员等级 | |
| 133 | + * @return 优惠价格 | |
| 134 | + */ | |
| 135 | + public Integer calculateVipPrice(Integer price, MemberLevelRespDTO memberLevel) { | |
| 136 | + if (memberLevel == null || memberLevel.getDiscountPercent() == null) { | |
| 137 | + return 0; | |
| 138 | + } | |
| 139 | + Integer newPrice = price * memberLevel.getDiscountPercent() / 100; | |
| 140 | + return price - newPrice; | |
| 81 | 141 | } |
| 82 | 142 | |
| 83 | 143 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/ProductPropertyValueConvert.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyValueConvert.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java
| ... | ... | @@ -79,8 +79,6 @@ public interface ProductSpuConvert { |
| 79 | 79 | ProductSpuDO spu = list.get(i); |
| 80 | 80 | AppProductSpuPageRespVO spuVO = voList.get(i); |
| 81 | 81 | spuVO.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); |
| 82 | - // 计算 vip 价格 TODO 芋艿:临时的逻辑,等 vip 支持后 | |
| 83 | - spuVO.setVipPrice((int) (spuVO.getPrice() * 0.9)); | |
| 84 | 82 | } |
| 85 | 83 | return voList; |
| 86 | 84 | } |
| ... | ... | @@ -95,11 +93,6 @@ public interface ProductSpuConvert { |
| 95 | 93 | .setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); |
| 96 | 94 | // 处理 SKU |
| 97 | 95 | spuVO.setSkus(convertListForGetSpuDetail(skus)); |
| 98 | - // 计算 vip 价格 TODO 芋艿:临时的逻辑,等 vip 支持后 | |
| 99 | - if (true) { | |
| 100 | - spuVO.setVipPrice((int) (spuVO.getPrice() * 0.9)); | |
| 101 | - spuVO.getSkus().forEach(sku -> sku.setVipPrice((int) (sku.getPrice() * 0.9))); | |
| 102 | - } | |
| 103 | 96 | return spuVO; |
| 104 | 97 | } |
| 105 | 98 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/package-info.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueServiceImpl.java
| ... | ... | @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO; |
| 8 | -import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert; | |
| 8 | +import cn.iocoder.yudao.module.product.convert.property.ProductPropertyValueConvert; | |
| 9 | 9 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; |
| 10 | 10 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; |
| 11 | 11 | import cn.iocoder.yudao.module.product.dal.mysql.property.ProductPropertyValueMapper; | ... | ... |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainActivityApi.java
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApi.java
| ... | ... | @@ -7,14 +7,13 @@ package cn.iocoder.yudao.module.promotion.api.seckill; |
| 7 | 7 | */ |
| 8 | 8 | public interface SeckillActivityApi { |
| 9 | 9 | |
| 10 | - // TODO @puhui999:activityId 改成 id 好点哈; | |
| 11 | 10 | /** |
| 12 | 11 | * 更新秒杀库存 |
| 13 | 12 | * |
| 14 | - * @param activityId 活动编号 | |
| 13 | + * @param id 活动编号 | |
| 15 | 14 | * @param skuId sku 编号 |
| 16 | 15 | * @param count 数量 |
| 17 | 16 | */ |
| 18 | - void updateSeckillStock(Long activityId, Long skuId, Integer count); | |
| 17 | + void updateSeckillStock(Long id, Long skuId, Integer count); | |
| 19 | 18 | |
| 20 | 19 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java
| ... | ... | @@ -56,7 +56,6 @@ public interface ErrorCodeConstants { |
| 56 | 56 | ErrorCode SECKILL_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1013008004, "秒杀活动未关闭或未结束,不能删除"); |
| 57 | 57 | ErrorCode SECKILL_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1013008005, "秒杀活动已关闭,不能重复关闭"); |
| 58 | 58 | ErrorCode SECKILL_ACTIVITY_UPDATE_STOCK_FAIL = new ErrorCode(1013008006, "秒杀失败,原因秒杀库存不足"); |
| 59 | - ErrorCode SECKILL_ACTIVITY_FAIL_STATUS_CLOSED = new ErrorCode(1013008007, "秒杀活动已关闭"); | |
| 60 | 59 | |
| 61 | 60 | // ========== 秒杀时段 1013009000 ========== |
| 62 | 61 | ErrorCode SECKILL_CONFIG_NOT_EXISTS = new ErrorCode(1013009000, "秒杀时段不存在"); | ... | ... |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/common/PromotionTypeEnum.java
| ... | ... | @@ -22,8 +22,9 @@ public enum PromotionTypeEnum implements IntArrayValuable { |
| 22 | 22 | DISCOUNT_ACTIVITY(4, "限时折扣"), |
| 23 | 23 | REWARD_ACTIVITY(5, "满减送"), |
| 24 | 24 | |
| 25 | - MEMBER(6, "会员折扣"), | |
| 26 | - COUPON(7, "优惠劵") | |
| 25 | + MEMBER_LEVEL(6, "会员折扣"), | |
| 26 | + COUPON(7, "优惠劵"), | |
| 27 | + POINT(8, "积分") | |
| 27 | 28 | ; |
| 28 | 29 | |
| 29 | 30 | public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PromotionTypeEnum::getType).toArray(); | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApiImpl.java
| ... | ... | @@ -17,8 +17,8 @@ public class SeckillActivityApiImpl implements SeckillActivityApi { |
| 17 | 17 | private SeckillActivityService activityService; |
| 18 | 18 | |
| 19 | 19 | @Override |
| 20 | - public void updateSeckillStock(Long activityId, Long skuId, Integer count) { | |
| 21 | - activityService.updateSeckillStock(activityId, skuId, count); | |
| 20 | + public void updateSeckillStock(Long id, Long skuId, Integer count) { | |
| 21 | + activityService.updateSeckillStock(id, skuId, count); | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainActivityController.java
| ... | ... | @@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController; |
| 23 | 23 | import javax.annotation.Resource; |
| 24 | 24 | import java.util.List; |
| 25 | 25 | |
| 26 | +import static cn.hutool.core.util.ObjectUtil.defaultIfNull; | |
| 26 | 27 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 27 | 28 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| 28 | 29 | |
| ... | ... | @@ -39,7 +40,7 @@ public class AppBargainActivityController { |
| 39 | 40 | @GetMapping("/page") |
| 40 | 41 | @Operation(summary = "获得砍价活动分页") |
| 41 | 42 | public CommonResult<PageResult<AppBargainActivityRespVO>> getBargainActivityPage(PageParam pageReqVO) { |
| 42 | - PageResult<BargainActivityDO> result = bargainActivityService.getBargainActivityPageForApp(pageReqVO); | |
| 43 | + PageResult<BargainActivityDO> result = bargainActivityService.getBargainActivityPage(pageReqVO); | |
| 43 | 44 | if (CollUtil.isEmpty(result.getList())) { |
| 44 | 45 | return success(PageResult.empty(result.getTotal())); |
| 45 | 46 | } |
| ... | ... | @@ -54,7 +55,7 @@ public class AppBargainActivityController { |
| 54 | 55 | @Parameter(name = "count", description = "需要展示的数量", example = "6") |
| 55 | 56 | public CommonResult<List<AppBargainActivityRespVO>> getBargainActivityList( |
| 56 | 57 | @RequestParam(name = "count", defaultValue = "6") Integer count) { |
| 57 | - List<BargainActivityDO> list = bargainActivityService.getBargainActivityListForApp(count); | |
| 58 | + List<BargainActivityDO> list = bargainActivityService.getBargainActivityListByCount(defaultIfNull(count, 6)); | |
| 58 | 59 | if (CollUtil.isEmpty(list)) { |
| 59 | 60 | return success(BargainActivityConvert.INSTANCE.convertAppList(list)); |
| 60 | 61 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.controller.app.combination; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.hutool.core.util.ObjectUtil; | |
| 5 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 3 | 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 5 | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | +import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; | |
| 10 | +import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | |
| 6 | 11 | import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityDetailRespVO; |
| 7 | 12 | import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityRespVO; |
| 13 | +import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert; | |
| 14 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; | |
| 15 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; | |
| 16 | +import cn.iocoder.yudao.module.promotion.service.combination.CombinationActivityService; | |
| 8 | 17 | import io.swagger.v3.oas.annotations.Operation; |
| 9 | 18 | import io.swagger.v3.oas.annotations.Parameter; |
| 10 | 19 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -14,11 +23,13 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 14 | 23 | import org.springframework.web.bind.annotation.RequestParam; |
| 15 | 24 | import org.springframework.web.bind.annotation.RestController; |
| 16 | 25 | |
| 17 | -import java.time.LocalDateTime; | |
| 18 | -import java.util.ArrayList; | |
| 26 | +import javax.annotation.Resource; | |
| 27 | +import java.util.Collections; | |
| 19 | 28 | import java.util.List; |
| 20 | 29 | |
| 30 | +import static cn.hutool.core.util.ObjectUtil.defaultIfNull; | |
| 21 | 31 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 32 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 22 | 33 | |
| 23 | 34 | @Tag(name = "用户 APP - 拼团活动") |
| 24 | 35 | @RestController |
| ... | ... | @@ -26,104 +37,51 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 26 | 37 | @Validated |
| 27 | 38 | public class AppCombinationActivityController { |
| 28 | 39 | |
| 40 | + @Resource | |
| 41 | + private CombinationActivityService activityService; | |
| 42 | + @Resource | |
| 43 | + private ProductSpuApi spuApi; | |
| 44 | + | |
| 45 | + // TODO 芋艿:增加 Spring Cache | |
| 29 | 46 | @GetMapping("/list") |
| 30 | 47 | @Operation(summary = "获得拼团活动列表", description = "用于小程序首页") |
| 31 | - // TODO 芋艿:增加 Spring Cache | |
| 32 | - // TODO 芋艿:缺少 swagger 注解 | |
| 48 | + @Parameter(name = "count", description = "需要展示的数量", example = "6") | |
| 33 | 49 | public CommonResult<List<AppCombinationActivityRespVO>> getCombinationActivityList( |
| 34 | 50 | @RequestParam(name = "count", defaultValue = "6") Integer count) { |
| 35 | - List<AppCombinationActivityRespVO> activityList = new ArrayList<>(); | |
| 36 | - AppCombinationActivityRespVO activity1 = new AppCombinationActivityRespVO(); | |
| 37 | - activity1.setId(1L); | |
| 38 | - activity1.setName("618 大拼团"); | |
| 39 | - activity1.setUserSize(3); | |
| 40 | - activity1.setSpuId(2048L); | |
| 41 | - activity1.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); | |
| 42 | - activity1.setMarketPrice(50); | |
| 43 | - activity1.setCombinationPrice(100); | |
| 44 | - activityList.add(activity1); | |
| 45 | - | |
| 46 | - AppCombinationActivityRespVO activity2 = new AppCombinationActivityRespVO(); | |
| 47 | - activity2.setId(2L); | |
| 48 | - activity2.setName("双十一拼团"); | |
| 49 | - activity2.setUserSize(5); | |
| 50 | - activity2.setSpuId(4096L); | |
| 51 | - activity2.setPicUrl("https://static.iocoder.cn/mall/132.jpeg"); | |
| 52 | - activity2.setMarketPrice(100); | |
| 53 | - activity2.setCombinationPrice(200); | |
| 54 | - activityList.add(activity2); | |
| 55 | - | |
| 56 | - return success(activityList); | |
| 51 | + List<CombinationActivityDO> list = activityService.getCombinationActivityListByCount(defaultIfNull(count, 6)); | |
| 52 | + if (CollUtil.isEmpty(list)) { | |
| 53 | + return success(Collections.emptyList()); | |
| 54 | + } | |
| 55 | + // 拼接返回 | |
| 56 | + List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(list, CombinationActivityDO::getSpuId)); | |
| 57 | + return success(CombinationActivityConvert.INSTANCE.convertAppList(list, spuList)); | |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | 60 | @GetMapping("/page") |
| 60 | 61 | @Operation(summary = "获得拼团活动分页") |
| 61 | 62 | public CommonResult<PageResult<AppCombinationActivityRespVO>> getCombinationActivityPage(PageParam pageParam) { |
| 62 | - List<AppCombinationActivityRespVO> activityList = new ArrayList<>(); | |
| 63 | - AppCombinationActivityRespVO activity1 = new AppCombinationActivityRespVO(); | |
| 64 | - activity1.setId(1L); | |
| 65 | - activity1.setName("618 大拼团"); | |
| 66 | - activity1.setUserSize(3); | |
| 67 | - activity1.setSpuId(2048L); | |
| 68 | - activity1.setPicUrl("商品图片地址"); | |
| 69 | - activity1.setMarketPrice(50); | |
| 70 | - activity1.setCombinationPrice(100); | |
| 71 | - activityList.add(activity1); | |
| 72 | - | |
| 73 | - AppCombinationActivityRespVO activity2 = new AppCombinationActivityRespVO(); | |
| 74 | - activity2.setId(2L); | |
| 75 | - activity2.setName("双十一拼团"); | |
| 76 | - activity2.setUserSize(5); | |
| 77 | - activity2.setSpuId(4096L); | |
| 78 | - activity2.setPicUrl("商品图片地址"); | |
| 79 | - activity2.setMarketPrice(100); | |
| 80 | - activity2.setCombinationPrice(200); | |
| 81 | - activityList.add(activity2); | |
| 82 | - | |
| 83 | - return success(new PageResult<>(activityList, 2L)); | |
| 63 | + PageResult<CombinationActivityDO> result = activityService.getCombinationActivityPage(pageParam); | |
| 64 | + if (CollUtil.isEmpty(result.getList())) { | |
| 65 | + return success(PageResult.empty(result.getTotal())); | |
| 66 | + } | |
| 67 | + // 拼接返回 | |
| 68 | + List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(result.getList(), CombinationActivityDO::getSpuId)); | |
| 69 | + return success(CombinationActivityConvert.INSTANCE.convertAppPage(result, spuList)); | |
| 84 | 70 | } |
| 85 | 71 | |
| 86 | 72 | @GetMapping("/get-detail") |
| 87 | 73 | @Operation(summary = "获得拼团活动明细") |
| 88 | 74 | @Parameter(name = "id", description = "活动编号", required = true, example = "1024") |
| 89 | 75 | public CommonResult<AppCombinationActivityDetailRespVO> getCombinationActivityDetail(@RequestParam("id") Long id) { |
| 90 | - // TODO 芋艿:如果禁用的时候,需要抛出异常; | |
| 91 | - AppCombinationActivityDetailRespVO obj = new AppCombinationActivityDetailRespVO(); | |
| 92 | - // 设置其属性的值 | |
| 93 | - obj.setId(id); | |
| 94 | - obj.setName("晚九点限时秒杀"); | |
| 95 | - obj.setStatus(1); | |
| 96 | - obj.setStartTime(LocalDateTime.of(2023, 6, 15, 0, 0, 0)); | |
| 97 | - obj.setEndTime(LocalDateTime.of(2023, 6, 20, 23, 59, 0)); | |
| 98 | - obj.setUserSize(2); | |
| 99 | - obj.setSuccessCount(100); | |
| 100 | - obj.setSpuId(633L); | |
| 101 | - obj.setSingleLimitCount(2); | |
| 102 | - obj.setTotalLimitCount(3); | |
| 103 | - | |
| 104 | - // 创建一个Product对象的列表 | |
| 105 | - List<AppCombinationActivityDetailRespVO.Product> productList = new ArrayList<>(); | |
| 106 | - // 创建三个新的Product对象并设置其属性的值 | |
| 107 | - AppCombinationActivityDetailRespVO.Product product1 = new AppCombinationActivityDetailRespVO.Product(); | |
| 108 | - product1.setSkuId(1L); | |
| 109 | - product1.setCombinationPrice(100); | |
| 110 | - // 将第一个Product对象添加到列表中 | |
| 111 | - productList.add(product1); | |
| 112 | - // 创建第二个Product对象并设置其属性的值 | |
| 113 | - AppCombinationActivityDetailRespVO.Product product2 = new AppCombinationActivityDetailRespVO.Product(); | |
| 114 | - product2.setSkuId(2L); | |
| 115 | - product2.setCombinationPrice(200); | |
| 116 | - // 将第二个Product对象添加到列表中 | |
| 117 | - productList.add(product2); | |
| 118 | - // 创建第三个Product对象并设置其属性的值 | |
| 119 | - AppCombinationActivityDetailRespVO.Product product3 = new AppCombinationActivityDetailRespVO.Product(); | |
| 120 | - product3.setSkuId(3L); | |
| 121 | - product3.setCombinationPrice(300); | |
| 122 | - // 将第三个Product对象添加到列表中 | |
| 123 | - productList.add(product3); | |
| 124 | - // 将Product列表设置为对象的属性值 | |
| 125 | - obj.setProducts(productList); | |
| 126 | - return success(obj); | |
| 76 | + // 1、获取活动 | |
| 77 | + CombinationActivityDO combinationActivity = activityService.getCombinationActivity(id); | |
| 78 | + if (combinationActivity == null | |
| 79 | + || ObjectUtil.equal(combinationActivity.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { | |
| 80 | + return success(null); | |
| 81 | + } | |
| 82 | + // 2、获取活动商品 | |
| 83 | + List<CombinationProductDO> products = activityService.getCombinationProductsByActivityId(combinationActivity.getId()); | |
| 84 | + return success(CombinationActivityConvert.INSTANCE.convert3(combinationActivity, products)); | |
| 127 | 85 | } |
| 128 | 86 | |
| 129 | 87 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/activity/AppCombinationActivityRespVO.java
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.controller.app.seckill; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.hutool.core.util.ObjectUtil; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 5 | 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| ... | ... | @@ -27,14 +28,10 @@ import org.springframework.web.bind.annotation.RequestParam; |
| 27 | 28 | import org.springframework.web.bind.annotation.RestController; |
| 28 | 29 | |
| 29 | 30 | import javax.annotation.Resource; |
| 30 | -import java.util.Arrays; | |
| 31 | 31 | import java.util.List; |
| 32 | 32 | |
| 33 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 34 | 33 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 35 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | |
| 36 | -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.isBetween; | |
| 37 | -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.SECKILL_ACTIVITY_FAIL_STATUS_CLOSED; | |
| 34 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 38 | 35 | |
| 39 | 36 | @Tag(name = "用户 App - 秒杀活动") |
| 40 | 37 | @RestController |
| ... | ... | @@ -50,27 +47,21 @@ public class AppSeckillActivityController { |
| 50 | 47 | @Resource |
| 51 | 48 | private ProductSpuApi spuApi; |
| 52 | 49 | |
| 53 | - @GetMapping("/get-now") | |
| 54 | - @Operation(summary = "获得当前秒杀活动") // 提供给首页使用 | |
| 55 | 50 | // TODO 芋艿:需要增加 spring cache |
| 51 | + @GetMapping("/get-now") | |
| 52 | + @Operation(summary = "获得当前秒杀活动", description = "获取当前正在进行的活动,提供给首页使用") | |
| 56 | 53 | public CommonResult<AppSeckillActivityNowRespVO> getNowSeckillActivity() { |
| 57 | 54 | // 1. 获取当前时间处在哪个秒杀阶段 |
| 58 | - // TODO @puhui999:可以考虑在 service 写个方法;这样 controller 不用关注过多逻辑 | |
| 59 | - List<SeckillConfigDO> configList = configService.getSeckillConfigList(); | |
| 60 | - SeckillConfigDO filteredConfig = findFirst(configList, config -> ObjectUtil.equal(config.getStatus(), | |
| 61 | - CommonStatusEnum.ENABLE.getStatus()) && isBetween(config.getStartTime(), config.getEndTime())); | |
| 62 | - if (filteredConfig == null) { // 时段不存在直接返回 null | |
| 55 | + SeckillConfigDO configList = configService.getSeckillConfigListByStatusOnCurrentTime(CommonStatusEnum.ENABLE.getStatus()); | |
| 56 | + if (configList == null) { // 时段不存在直接返回 null | |
| 63 | 57 | return success(null); |
| 64 | 58 | } |
| 65 | 59 | |
| 66 | 60 | // 2. 查询满足当前阶段的活动 |
| 67 | - // TODO @puhui999:最好直接返回开启的;不多查询数据 | |
| 68 | - List<SeckillActivityDO> activityList = activityService.getSeckillActivityListByConfigIds(Arrays.asList(filteredConfig.getId())); | |
| 69 | - List<SeckillActivityDO> filteredList = filterList(activityList, item -> ObjectUtil.equal(item.getStatus(), CommonStatusEnum.ENABLE.getStatus())); | |
| 70 | - | |
| 71 | - // 3. 拼接数据 | |
| 72 | - List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(filteredList, SeckillActivityDO::getSpuId)); | |
| 73 | - return success(SeckillActivityConvert.INSTANCE.convert(filteredConfig, filteredList, spuList)); | |
| 61 | + List<SeckillActivityDO> activityList = activityService.getSeckillActivityListByConfigIdAndStatus(configList.getId(), CommonStatusEnum.ENABLE.getStatus()); | |
| 62 | + // 3 获取 spu 信息 | |
| 63 | + List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(activityList, SeckillActivityDO::getSpuId)); | |
| 64 | + return success(SeckillActivityConvert.INSTANCE.convert(configList, activityList, spuList)); | |
| 74 | 65 | } |
| 75 | 66 | |
| 76 | 67 | @GetMapping("/page") |
| ... | ... | @@ -78,7 +69,9 @@ public class AppSeckillActivityController { |
| 78 | 69 | public CommonResult<PageResult<AppSeckillActivityRespVO>> getSeckillActivityPage(AppSeckillActivityPageReqVO pageReqVO) { |
| 79 | 70 | // 1. 查询满足当前阶段的活动 |
| 80 | 71 | PageResult<SeckillActivityDO> pageResult = activityService.getSeckillActivityAppPageByConfigId(pageReqVO); |
| 81 | - | |
| 72 | + if (CollUtil.isEmpty(pageResult.getList())) { | |
| 73 | + return success(PageResult.empty(pageResult.getTotal())); | |
| 74 | + } | |
| 82 | 75 | // 2. 拼接数据 |
| 83 | 76 | List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(pageResult.getList(), SeckillActivityDO::getSpuId)); |
| 84 | 77 | return success(SeckillActivityConvert.INSTANCE.convertPage(pageResult, spuList)); |
| ... | ... | @@ -88,28 +81,22 @@ public class AppSeckillActivityController { |
| 88 | 81 | @Operation(summary = "获得秒杀活动明细") |
| 89 | 82 | @Parameter(name = "id", description = "活动编号", required = true, example = "1024") |
| 90 | 83 | public CommonResult<AppSeckillActivityDetailRespVO> getSeckillActivity(@RequestParam("id") Long id) { |
| 91 | - // 1、获取当前时间处在哪个秒杀阶段 | |
| 92 | - // TODO puhui999:这里,和 58 行是雷同的 | |
| 93 | - List<SeckillConfigDO> configList = configService.getSeckillConfigList(); | |
| 94 | - SeckillConfigDO filteredConfig = findFirst(configList, config -> ObjectUtil.equal(config.getStatus(), | |
| 95 | - CommonStatusEnum.ENABLE.getStatus()) && isBetween(config.getStartTime(), config.getEndTime())); | |
| 96 | - if (filteredConfig == null) { // 时段不存在直接返回 null | |
| 84 | + // 1. 获取当前时间处在哪个秒杀阶段 | |
| 85 | + SeckillConfigDO configList = configService.getSeckillConfigListByStatusOnCurrentTime(CommonStatusEnum.ENABLE.getStatus()); | |
| 86 | + if (configList == null) { // 时段不存在直接返回 null | |
| 97 | 87 | return success(null); |
| 98 | 88 | } |
| 99 | 89 | |
| 100 | 90 | // 2. 获取活动 |
| 101 | 91 | SeckillActivityDO seckillActivity = activityService.getSeckillActivity(id); |
| 102 | - if (seckillActivity == null) { | |
| 92 | + if (seckillActivity == null | |
| 93 | + || ObjectUtil.equal(seckillActivity.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { | |
| 103 | 94 | return success(null); |
| 104 | 95 | } |
| 105 | - // TODO 芋艿:如果禁用的时候,需要抛出异常; | |
| 106 | - if (ObjectUtil.equal(seckillActivity.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { | |
| 107 | - throw exception(SECKILL_ACTIVITY_FAIL_STATUS_CLOSED); | |
| 108 | - } | |
| 109 | 96 | |
| 110 | 97 | // 3. 拼接数据 |
| 111 | - List<SeckillProductDO> products = activityService.getSeckillProductListByActivityId(seckillActivity.getId()); | |
| 112 | - return success(SeckillActivityConvert.INSTANCE.convert3(seckillActivity, products, filteredConfig)); | |
| 98 | + List<SeckillProductDO> productList = activityService.getSeckillProductListByActivityId(seckillActivity.getId()); | |
| 99 | + return success(SeckillActivityConvert.INSTANCE.convert3(seckillActivity, productList, configList)); | |
| 113 | 100 | } |
| 114 | 101 | |
| 115 | 102 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillConfigController.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.controller.app.seckill; |
| 2 | 2 | |
| 3 | -import cn.hutool.core.collection.CollectionUtil; | |
| 4 | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 5 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | 5 | import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.config.AppSeckillConfigRespVO; |
| 7 | 6 | import cn.iocoder.yudao.module.promotion.convert.seckill.seckillconfig.SeckillConfigConvert; |
| 8 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillconfig.SeckillConfigDO; | |
| 9 | 7 | import cn.iocoder.yudao.module.promotion.service.seckill.SeckillConfigService; |
| 10 | 8 | import io.swagger.v3.oas.annotations.Operation; |
| 11 | 9 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -15,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 15 | 13 | import org.springframework.web.bind.annotation.RestController; |
| 16 | 14 | |
| 17 | 15 | import javax.annotation.Resource; |
| 18 | -import java.util.Collections; | |
| 19 | 16 | import java.util.List; |
| 20 | 17 | |
| 21 | 18 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| ... | ... | @@ -31,13 +28,8 @@ public class AppSeckillConfigController { |
| 31 | 28 | @GetMapping("/list") |
| 32 | 29 | @Operation(summary = "获得秒杀时间段列表") |
| 33 | 30 | public CommonResult<List<AppSeckillConfigRespVO>> getSeckillConfigList() { |
| 34 | - List<SeckillConfigDO> list = configService.getSeckillConfigListByStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 35 | - // TODO @puhui999:如果这种,不用判空也问题不大; | |
| 36 | - if (CollectionUtil.isEmpty(list)) { | |
| 37 | - return success(Collections.emptyList()); | |
| 38 | - } | |
| 39 | - | |
| 40 | - return success(SeckillConfigConvert.INSTANCE.convertList2(list)); | |
| 31 | + return success(SeckillConfigConvert.INSTANCE.convertList2( | |
| 32 | + configService.getSeckillConfigListByStatus(CommonStatusEnum.ENABLE.getStatus()))); | |
| 41 | 33 | } |
| 42 | 34 | |
| 43 | 35 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityRespVO.java
| ... | ... | @@ -25,6 +25,9 @@ public class AppSeckillActivityRespVO { |
| 25 | 25 | // 从 SPU 的 marketPrice 读取 |
| 26 | 26 | private Integer marketPrice; |
| 27 | 27 | |
| 28 | + @Schema(description = "秒杀活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 29 | + private Integer status; | |
| 30 | + | |
| 28 | 31 | @Schema(description = "秒杀库存(剩余)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| 29 | 32 | private Integer stock; |
| 30 | 33 | @Schema(description = "秒杀库存(总共)", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainActivityConvert.java
| ... | ... | @@ -46,9 +46,7 @@ public interface BargainActivityConvert { |
| 46 | 46 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 47 | 47 | List<BargainActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { |
| 48 | 48 | findAndThen(spuMap, item.getSpuId(), spu -> { |
| 49 | - // TODO @puhui999:这里可以使用链式哈 | |
| 50 | - item.setPicUrl(spu.getPicUrl()); | |
| 51 | - item.setSpuName(spu.getName()); | |
| 49 | + item.setPicUrl(spu.getPicUrl()).setSpuName(spu.getName()); | |
| 52 | 50 | }); |
| 53 | 51 | return item; |
| 54 | 52 | }); |
| ... | ... | @@ -75,11 +73,7 @@ public interface BargainActivityConvert { |
| 75 | 73 | // 拼接关联属性 |
| 76 | 74 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 77 | 75 | List<AppBargainActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { |
| 78 | - findAndThen(spuMap, item.getSpuId(), spu -> { | |
| 79 | - // TODO @puhui999:这里可以使用链式哈 | |
| 80 | - item.setPicUrl(spu.getPicUrl()); | |
| 81 | - item.setMarketPrice(spu.getMarketPrice()); | |
| 82 | - }); | |
| 76 | + findAndThen(spuMap, item.getSpuId(), spu -> item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); | |
| 83 | 77 | return item; |
| 84 | 78 | }); |
| 85 | 79 | result.setList(list); |
| ... | ... | @@ -92,11 +86,7 @@ public interface BargainActivityConvert { |
| 92 | 86 | List<AppBargainActivityRespVO> activityList = convertAppList(list); |
| 93 | 87 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 94 | 88 | return CollectionUtils.convertList(activityList, item -> { |
| 95 | - findAndThen(spuMap, item.getSpuId(), spu -> { | |
| 96 | - // TODO @puhui999:这里可以使用链式哈 | |
| 97 | - item.setPicUrl(spu.getPicUrl()); | |
| 98 | - item.setMarketPrice(spu.getMarketPrice()); | |
| 99 | - }); | |
| 89 | + findAndThen(spuMap, item.getSpuId(), spu -> item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); | |
| 100 | 90 | return item; |
| 101 | 91 | }); |
| 102 | 92 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java
| ... | ... | @@ -13,6 +13,8 @@ import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activit |
| 13 | 13 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityUpdateReqVO; |
| 14 | 14 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductBaseVO; |
| 15 | 15 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductRespVO; |
| 16 | +import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityDetailRespVO; | |
| 17 | +import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityRespVO; | |
| 16 | 18 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; |
| 17 | 19 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; |
| 18 | 20 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; |
| ... | ... | @@ -25,6 +27,7 @@ import java.util.List; |
| 25 | 27 | import java.util.Map; |
| 26 | 28 | |
| 27 | 29 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| 30 | +import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; | |
| 28 | 31 | |
| 29 | 32 | /** |
| 30 | 33 | * 拼团活动 Convert |
| ... | ... | @@ -58,10 +61,7 @@ public interface CombinationActivityConvert { |
| 58 | 61 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 59 | 62 | PageResult<CombinationActivityRespVO> pageResult = convertPage(page); |
| 60 | 63 | pageResult.getList().forEach(item -> { |
| 61 | - MapUtils.findAndThen(spuMap, item.getSpuId(), spu -> { | |
| 62 | - item.setSpuName(spu.getName()); | |
| 63 | - item.setPicUrl(spu.getPicUrl()); | |
| 64 | - }); | |
| 64 | + MapUtils.findAndThen(spuMap, item.getSpuId(), spu -> item.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl())); | |
| 65 | 65 | item.setProducts(convertList2(productList)); |
| 66 | 66 | }); |
| 67 | 67 | return pageResult; |
| ... | ... | @@ -97,18 +97,51 @@ public interface CombinationActivityConvert { |
| 97 | 97 | default CombinationRecordDO convert(CombinationRecordCreateReqDTO reqDTO, |
| 98 | 98 | CombinationActivityDO activity, MemberUserRespDTO user, |
| 99 | 99 | ProductSpuRespDTO spu, ProductSkuRespDTO sku) { |
| 100 | - // TODO @puhui999:搞成链式的 set;这样会更规整一点; | |
| 101 | - CombinationRecordDO record = convert(reqDTO); | |
| 102 | - record.setVirtualGroup(false); | |
| 103 | - record.setExpireTime(record.getStartTime().plusHours(activity.getLimitDuration())); | |
| 104 | - record.setUserSize(activity.getUserSize()); | |
| 105 | - record.setNickname(user.getNickname()); | |
| 106 | - record.setAvatar(user.getAvatar()); | |
| 107 | - record.setSpuName(spu.getName()); | |
| 108 | - record.setPicUrl(sku.getPicUrl()); | |
| 109 | - return record; | |
| 100 | + // TODO @puhui999:订单付款后需要设置开始时间和结束时间; | |
| 101 | + return convert(reqDTO) | |
| 102 | + .setVirtualGroup(false) | |
| 103 | + .setExpireTime(activity.getStartTime().plusHours(activity.getLimitDuration())) | |
| 104 | + .setUserSize(activity.getUserSize()) | |
| 105 | + .setNickname(user.getNickname()) | |
| 106 | + .setAvatar(user.getAvatar()) | |
| 107 | + .setSpuName(spu.getName()) | |
| 108 | + .setPicUrl(sku.getPicUrl()); | |
| 110 | 109 | } |
| 111 | 110 | |
| 112 | 111 | List<CombinationRecordRespDTO> convert(List<CombinationRecordDO> bean); |
| 113 | 112 | |
| 113 | + List<AppCombinationActivityRespVO> convertAppList(List<CombinationActivityDO> list); | |
| 114 | + | |
| 115 | + default List<AppCombinationActivityRespVO> convertAppList(List<CombinationActivityDO> list, List<ProductSpuRespDTO> spuList) { | |
| 116 | + List<AppCombinationActivityRespVO> activityList = convertAppList(list); | |
| 117 | + Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); | |
| 118 | + return CollectionUtils.convertList(activityList, item -> { | |
| 119 | + findAndThen(spuMap, item.getSpuId(), spu -> item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); | |
| 120 | + return item; | |
| 121 | + }); | |
| 122 | + } | |
| 123 | + | |
| 124 | + PageResult<AppCombinationActivityRespVO> convertAppPage(PageResult<CombinationActivityDO> result); | |
| 125 | + | |
| 126 | + default PageResult<AppCombinationActivityRespVO> convertAppPage(PageResult<CombinationActivityDO> result, List<ProductSpuRespDTO> spuList) { | |
| 127 | + PageResult<AppCombinationActivityRespVO> appPage = convertAppPage(result); | |
| 128 | + Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); | |
| 129 | + List<AppCombinationActivityRespVO> list = CollectionUtils.convertList(appPage.getList(), item -> { | |
| 130 | + findAndThen(spuMap, item.getSpuId(), spu -> { | |
| 131 | + item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()); | |
| 132 | + }); | |
| 133 | + return item; | |
| 134 | + }); | |
| 135 | + appPage.setList(list); | |
| 136 | + return appPage; | |
| 137 | + } | |
| 138 | + | |
| 139 | + AppCombinationActivityDetailRespVO convert2(CombinationActivityDO combinationActivity); | |
| 140 | + | |
| 141 | + List<AppCombinationActivityDetailRespVO.Product> convertList1(List<CombinationProductDO> products); | |
| 142 | + | |
| 143 | + default AppCombinationActivityDetailRespVO convert3(CombinationActivityDO combinationActivity, List<CombinationProductDO> products) { | |
| 144 | + return convert2(combinationActivity).setProducts(convertList1(products)); | |
| 145 | + } | |
| 146 | + | |
| 114 | 147 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | 6 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| ... | ... | @@ -29,7 +30,6 @@ import java.util.Map; |
| 29 | 30 | |
| 30 | 31 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| 31 | 32 | import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; |
| 32 | -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * 秒杀活动 Convert |
| ... | ... | @@ -98,10 +98,9 @@ public interface SeckillActivityConvert { |
| 98 | 98 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 99 | 99 | respVO.setActivities(CollectionUtils.convertList(convertList3(activityList), item -> { |
| 100 | 100 | findAndThen(spuMap, item.getSpuId(), spu -> { |
| 101 | - // TODO @puhui999:可以尝试链式 set 哈; | |
| 102 | - item.setPicUrl(spu.getPicUrl()); | |
| 103 | - item.setMarketPrice(spu.getMarketPrice()); | |
| 104 | - item.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); | |
| 101 | + item.setPicUrl(spu.getPicUrl()) | |
| 102 | + .setMarketPrice(spu.getMarketPrice()) | |
| 103 | + .setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); | |
| 105 | 104 | }); |
| 106 | 105 | return item; |
| 107 | 106 | })); |
| ... | ... | @@ -114,12 +113,8 @@ public interface SeckillActivityConvert { |
| 114 | 113 | PageResult<AppSeckillActivityRespVO> result = convertPage1(pageResult); |
| 115 | 114 | Map<Long, ProductSpuRespDTO> spuMap = convertMap(spuList, ProductSpuRespDTO::getId); |
| 116 | 115 | List<AppSeckillActivityRespVO> list = CollectionUtils.convertList(result.getList(), item -> { |
| 117 | - findAndThen(spuMap, item.getSpuId(), spu -> { | |
| 118 | - // TODO @puhui999:可以尝试链式 set 哈; | |
| 119 | - item.setPicUrl(spu.getPicUrl()); | |
| 120 | - item.setMarketPrice(spu.getMarketPrice()); | |
| 121 | - item.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); | |
| 122 | - }); | |
| 116 | + findAndThen(spuMap, item.getSpuId(), spu -> item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()) | |
| 117 | + .setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit()))); | |
| 123 | 118 | return item; |
| 124 | 119 | }); |
| 125 | 120 | result.setList(list); |
| ... | ... | @@ -131,12 +126,13 @@ public interface SeckillActivityConvert { |
| 131 | 126 | List<AppSeckillActivityDetailRespVO.Product> convertList1(List<SeckillProductDO> products); |
| 132 | 127 | |
| 133 | 128 | default AppSeckillActivityDetailRespVO convert3(SeckillActivityDO seckillActivity, List<SeckillProductDO> products, SeckillConfigDO filteredConfig) { |
| 134 | - AppSeckillActivityDetailRespVO respVO = convert2(seckillActivity); | |
| 135 | - respVO.setProducts(convertList1(products)); | |
| 136 | - // TODO @puhui999:可以尝试链式 set 哈; | |
| 137 | - respVO.setStartTime(buildTime(filteredConfig.getStartTime())); | |
| 138 | - respVO.setEndTime(buildTime(filteredConfig.getEndTime())); | |
| 139 | - return respVO; | |
| 129 | + return convert2(seckillActivity) | |
| 130 | + .setProducts(convertList1(products)) | |
| 131 | + // TODO @puhui999:要不要在里面 default 一个方法,处理这个事件;简洁一点; | |
| 132 | + .setStartTime(LocalDateTimeUtil.parse(LocalDateTimeUtil.format(seckillActivity.getStartTime(), "yyyy-MM-dd") + " " + filteredConfig.getStartTime(), | |
| 133 | + "yyyy-MM-dd HH:mm:ss")) // 活动开始日期和时段结合 | |
| 134 | + .setEndTime(LocalDateTimeUtil.parse(LocalDateTimeUtil.format(seckillActivity.getEndTime(), "yyyy-MM-dd") + " " + filteredConfig.getEndTime(), | |
| 135 | + "yyyy-MM-dd HH:mm:ss")); // 活动结束日期和时段结合 | |
| 140 | 136 | } |
| 141 | 137 | |
| 142 | 138 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java
| ... | ... | @@ -38,18 +38,41 @@ public interface BargainActivityMapper extends BaseMapperX<BargainActivityDO> { |
| 38 | 38 | * @param count 扣减的库存数量 |
| 39 | 39 | * @return 影响的行数 |
| 40 | 40 | */ |
| 41 | - default int updateActivityStock(Long id, int count) { | |
| 41 | + default int updateStock(Long id, int count) { | |
| 42 | 42 | return update(null, new LambdaUpdateWrapper<BargainActivityDO>() |
| 43 | 43 | .eq(BargainActivityDO::getId, id) |
| 44 | 44 | .ge(BargainActivityDO::getStock, count) |
| 45 | 45 | .setSql("stock = stock - " + count)); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - default PageResult<BargainActivityDO> selectAppPage(PageParam pageReqVO, Integer status, LocalDateTime now) { | |
| 48 | + /** | |
| 49 | + * 查询处在 now 日期时间且是 status 状态的活动分页 | |
| 50 | + * | |
| 51 | + * @param pageReqVO 分页参数 | |
| 52 | + * @param status 状态 | |
| 53 | + * @param now 当前日期时间 | |
| 54 | + * @return 活动分页 | |
| 55 | + */ | |
| 56 | + default PageResult<BargainActivityDO> selectPage(PageParam pageReqVO, Integer status, LocalDateTime now) { | |
| 49 | 57 | return selectPage(pageReqVO, new LambdaQueryWrapperX<BargainActivityDO>() |
| 50 | 58 | .eq(BargainActivityDO::getStatus, status) |
| 51 | 59 | .le(BargainActivityDO::getStartTime, now) |
| 52 | 60 | .ge(BargainActivityDO::getEndTime, now)); |
| 53 | 61 | } |
| 54 | 62 | |
| 63 | + /** | |
| 64 | + * 查询处在 now 日期时间且是 status 状态的活动分页 | |
| 65 | + * | |
| 66 | + * @param status 状态 | |
| 67 | + * @param now 当前日期时间 | |
| 68 | + * @return 活动分页 | |
| 69 | + */ | |
| 70 | + default List<BargainActivityDO> selectList(Integer count, Integer status, LocalDateTime now) { | |
| 71 | + return selectList(new LambdaQueryWrapperX<BargainActivityDO>() | |
| 72 | + .eq(BargainActivityDO::getStatus, status) | |
| 73 | + .le(BargainActivityDO::getStartTime, now) | |
| 74 | + .ge(BargainActivityDO::getEndTime, now) | |
| 75 | + .last("LIMIT " + count)); | |
| 76 | + } | |
| 77 | + | |
| 55 | 78 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.dal.mysql.combination; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| ... | ... | @@ -28,4 +29,15 @@ public interface CombinationActivityMapper extends BaseMapperX<CombinationActivi |
| 28 | 29 | return selectList(CombinationActivityDO::getStatus, status); |
| 29 | 30 | } |
| 30 | 31 | |
| 32 | + default PageResult<CombinationActivityDO> selectPage(PageParam pageParam, Integer status) { | |
| 33 | + return selectPage(pageParam, new LambdaQueryWrapperX<CombinationActivityDO>() | |
| 34 | + .eq(CombinationActivityDO::getStatus, status)); | |
| 35 | + } | |
| 36 | + | |
| 37 | + default List<CombinationActivityDO> selectListByStatus(Integer status, Integer count) { | |
| 38 | + return selectList(new LambdaQueryWrapperX<CombinationActivityDO>() | |
| 39 | + .eq(CombinationActivityDO::getStatus, status) | |
| 40 | + .last("LIMIT " + count)); | |
| 41 | + } | |
| 42 | + | |
| 31 | 43 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java
| ... | ... | @@ -41,7 +41,7 @@ public interface SeckillActivityMapper extends BaseMapperX<SeckillActivityDO> { |
| 41 | 41 | * @param count 扣减的库存数量 |
| 42 | 42 | * @return 影响的行数 |
| 43 | 43 | */ |
| 44 | - default int updateActivityStock(Long id, int count) { | |
| 44 | + default int updateStock(Long id, int count) { | |
| 45 | 45 | return update(null, new LambdaUpdateWrapper<SeckillActivityDO>() |
| 46 | 46 | .eq(SeckillActivityDO::getId, id) |
| 47 | 47 | .gt(SeckillActivityDO::getTotalStock, 0) | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillProductMapper.java
| ... | ... | @@ -16,8 +16,13 @@ import java.util.List; |
| 16 | 16 | @Mapper |
| 17 | 17 | public interface SeckillProductMapper extends BaseMapperX<SeckillProductDO> { |
| 18 | 18 | |
| 19 | - default List<SeckillProductDO> selectListByActivityId(Long id) { | |
| 20 | - return selectList(SeckillProductDO::getActivityId, id); | |
| 19 | + default List<SeckillProductDO> selectListByActivityId(Long activityId) { | |
| 20 | + return selectList(SeckillProductDO::getActivityId, activityId); | |
| 21 | + } | |
| 22 | + | |
| 23 | + default SeckillProductDO selectByActivityIdAndSkuId(Long activityId, Long skuId) { | |
| 24 | + return selectOne(SeckillProductDO::getActivityId, activityId, | |
| 25 | + SeckillProductDO::getSkuId, skuId); | |
| 21 | 26 | } |
| 22 | 27 | |
| 23 | 28 | default List<SeckillProductDO> selectListByActivityId(Collection<Long> ids) { |
| ... | ... | @@ -31,7 +36,7 @@ public interface SeckillProductMapper extends BaseMapperX<SeckillProductDO> { |
| 31 | 36 | * @param count 扣减的库存数量 |
| 32 | 37 | * @return 影响的行数 |
| 33 | 38 | */ |
| 34 | - default int updateActivityStock(Long id, int count) { | |
| 39 | + default int updateStock(Long id, int count) { | |
| 35 | 40 | return update(null, new LambdaUpdateWrapper<SeckillProductDO>() |
| 36 | 41 | .eq(SeckillProductDO::getId, id) |
| 37 | 42 | .gt(SeckillProductDO::getStock, count) | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityService.java
| ... | ... | @@ -63,22 +63,20 @@ public interface BargainActivityService { |
| 63 | 63 | */ |
| 64 | 64 | PageResult<BargainActivityDO> getBargainActivityPage(BargainActivityPageReqVO pageReqVO); |
| 65 | 65 | |
| 66 | - // TODO @puhui999:这里可以改成进行中的活动;尽量避免专门为 app 定制,或者类似的名字哈;mapper 那也是 | |
| 67 | - | |
| 68 | 66 | /** |
| 69 | - * 获取 APP 端活动分页数据 | |
| 67 | + * 获取正在进行的活动分页数据 | |
| 70 | 68 | * |
| 71 | 69 | * @param pageReqVO 分页请求 |
| 72 | 70 | * @return 砍价活动分页 |
| 73 | 71 | */ |
| 74 | - PageResult<BargainActivityDO> getBargainActivityPageForApp(PageParam pageReqVO); | |
| 72 | + PageResult<BargainActivityDO> getBargainActivityPage(PageParam pageReqVO); | |
| 75 | 73 | |
| 76 | 74 | /** |
| 77 | - * 获取 APP 端活动展示数据 | |
| 75 | + * 获取正在进行的活动分页数据 | |
| 78 | 76 | * |
| 79 | 77 | * @param count 需要的数量 |
| 80 | 78 | * @return 砍价活动分页 |
| 81 | 79 | */ |
| 82 | - List<BargainActivityDO> getBargainActivityListForApp(Integer count); | |
| 80 | + List<BargainActivityDO> getBargainActivityListByCount(Integer count); | |
| 83 | 81 | |
| 84 | 82 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityServiceImpl.java
| ... | ... | @@ -75,16 +75,18 @@ public class BargainActivityServiceImpl implements BargainActivityService { |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | @Override |
| 78 | - @Transactional(rollbackFor = Exception.class) | |
| 79 | 78 | public void updateBargainActivityStock(Long id, Integer count) { |
| 80 | 79 | // 查询砍价活动 |
| 81 | 80 | BargainActivityDO activity = getBargainActivity(id); |
| 82 | 81 | if (activity == null) { |
| 83 | 82 | throw exception(BARGAIN_ACTIVITY_NOT_EXISTS); |
| 84 | 83 | } |
| 84 | + if (count > activity.getStock()) { | |
| 85 | + throw exception(BARGAIN_ACTIVITY_UPDATE_STOCK_FAIL); | |
| 86 | + } | |
| 85 | 87 | |
| 86 | 88 | // 更新砍价库存 |
| 87 | - int updateCount = bargainActivityMapper.updateActivityStock(id, count); | |
| 89 | + int updateCount = bargainActivityMapper.updateStock(id, count); | |
| 88 | 90 | if (updateCount == 0) { |
| 89 | 91 | throw exception(BARGAIN_ACTIVITY_UPDATE_STOCK_FAIL); |
| 90 | 92 | } |
| ... | ... | @@ -114,7 +116,7 @@ public class BargainActivityServiceImpl implements BargainActivityService { |
| 114 | 116 | public void deleteBargainActivity(Long id) { |
| 115 | 117 | // 校验存在 |
| 116 | 118 | BargainActivityDO activityDO = validateBargainActivityExists(id); |
| 117 | - // 校验状态 | |
| 119 | + // 校验状态 TODO puhui: 测试完成后需要恢复校验 | |
| 118 | 120 | //if (ObjectUtil.equal(activityDO.getStatus(), CommonStatusEnum.ENABLE.getStatus())) { |
| 119 | 121 | // throw exception(BARGAIN_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END); |
| 120 | 122 | //} |
| ... | ... | @@ -142,21 +144,14 @@ public class BargainActivityServiceImpl implements BargainActivityService { |
| 142 | 144 | } |
| 143 | 145 | |
| 144 | 146 | @Override |
| 145 | - public PageResult<BargainActivityDO> getBargainActivityPageForApp(PageParam pageReqVO) { | |
| 147 | + public PageResult<BargainActivityDO> getBargainActivityPage(PageParam pageReqVO) { | |
| 146 | 148 | // 只查询进行中,且在时间范围内的 |
| 147 | - return bargainActivityMapper.selectAppPage(pageReqVO, CommonStatusEnum.ENABLE.getStatus(), LocalDateTime.now()); | |
| 149 | + return bargainActivityMapper.selectPage(pageReqVO, CommonStatusEnum.ENABLE.getStatus(), LocalDateTime.now()); | |
| 148 | 150 | } |
| 149 | 151 | |
| 150 | 152 | @Override |
| 151 | - public List<BargainActivityDO> getBargainActivityListForApp(Integer count) { | |
| 152 | - // TODO @puhui999:这种 default count 的逻辑,可以放到 controller 哈;然后可以使用 ObjectUtils.default 方法 | |
| 153 | - if (count == null) { | |
| 154 | - count = 6; | |
| 155 | - } | |
| 156 | - // TODO @puhui999:这种不要用 page;会浪费一次 count; | |
| 157 | - PageResult<BargainActivityDO> result = bargainActivityMapper.selectAppPage(new PageParam().setPageSize(count), | |
| 158 | - CommonStatusEnum.ENABLE.getStatus(), LocalDateTime.now()); | |
| 159 | - return result.getList(); | |
| 153 | + public List<BargainActivityDO> getBargainActivityListByCount(Integer count) { | |
| 154 | + return bargainActivityMapper.selectList(count, CommonStatusEnum.ENABLE.getStatus(), LocalDateTime.now()); | |
| 160 | 155 | } |
| 161 | 156 | |
| 162 | 157 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityService.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.service.combination; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 5 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityCreateReqVO; |
| 5 | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageReqVO; |
| ... | ... | @@ -9,6 +10,7 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationP |
| 9 | 10 | |
| 10 | 11 | import javax.validation.Valid; |
| 11 | 12 | import java.util.Collection; |
| 13 | +import java.util.Collections; | |
| 12 | 14 | import java.util.List; |
| 13 | 15 | |
| 14 | 16 | /** |
| ... | ... | @@ -67,6 +69,16 @@ public interface CombinationActivityService { |
| 67 | 69 | /** |
| 68 | 70 | * 获得拼团活动商品列表 |
| 69 | 71 | * |
| 72 | + * @param activityId 拼团活动 id | |
| 73 | + * @return 拼团活动的商品列表 | |
| 74 | + */ | |
| 75 | + default List<CombinationProductDO> getCombinationProductsByActivityId(Long activityId) { | |
| 76 | + return getCombinationProductsByActivityIds(Collections.singletonList(activityId)); | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 获得拼团活动商品列表 | |
| 81 | + * | |
| 70 | 82 | * @param activityIds 拼团活动 ids |
| 71 | 83 | * @return 拼团活动的商品列表 |
| 72 | 84 | */ |
| ... | ... | @@ -83,4 +95,20 @@ public interface CombinationActivityService { |
| 83 | 95 | */ |
| 84 | 96 | void validateCombination(Long activityId, Long userId, Long skuId, Integer count); |
| 85 | 97 | |
| 98 | + /** | |
| 99 | + * 获取正在进行的活动分页数据 | |
| 100 | + * | |
| 101 | + * @param count 需要的数量 | |
| 102 | + * @return 拼团活动分页 | |
| 103 | + */ | |
| 104 | + List<CombinationActivityDO> getCombinationActivityListByCount(Integer count); | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * 获取正在进行的活动分页数据 | |
| 108 | + * | |
| 109 | + * @param pageParam 分页请求 | |
| 110 | + * @return 拼团活动分页 | |
| 111 | + */ | |
| 112 | + PageResult<CombinationActivityDO> getCombinationActivityPage(PageParam pageParam); | |
| 113 | + | |
| 86 | 114 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.promotion.service.combination; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.util.ObjectUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 6 | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 8 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 8 | 9 | import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; |
| ... | ... | @@ -223,8 +224,7 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic |
| 223 | 224 | throw exception(COMBINATION_ACTIVITY_STATUS_DISABLE); |
| 224 | 225 | } |
| 225 | 226 | // 1.3 校验是否超出单次限购数量 |
| 226 | - // TODO puhui999:count > activity.getSingleLimitCount() 会更好理解点; | |
| 227 | - if (activity.getSingleLimitCount() < count) { | |
| 227 | + if (count > activity.getSingleLimitCount()) { | |
| 228 | 228 | throw exception(COMBINATION_RECORD_FAILED_SINGLE_LIMIT_COUNT_EXCEED); |
| 229 | 229 | } |
| 230 | 230 | |
| ... | ... | @@ -245,4 +245,14 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | + @Override | |
| 249 | + public List<CombinationActivityDO> getCombinationActivityListByCount(Integer count) { | |
| 250 | + return combinationActivityMapper.selectListByStatus(CommonStatusEnum.ENABLE.getStatus(), count); | |
| 251 | + } | |
| 252 | + | |
| 253 | + @Override | |
| 254 | + public PageResult<CombinationActivityDO> getCombinationActivityPage(PageParam pageParam) { | |
| 255 | + return combinationActivityMapper.selectPage(pageParam, CommonStatusEnum.ENABLE.getStatus()); | |
| 256 | + } | |
| 257 | + | |
| 248 | 258 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java
| ... | ... | @@ -96,12 +96,15 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { |
| 96 | 96 | return recordDO; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | + // TODO @puhui999:有一个应该在创建那要做下;就是当前 activityId 已经有未支付的订单,不允许在发起新的;要么支付,要么去掉先; | |
| 100 | + | |
| 99 | 101 | @Override |
| 100 | 102 | @Transactional(rollbackFor = Exception.class) |
| 101 | 103 | public void createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { |
| 102 | 104 | // 1.1 校验拼团活动 |
| 103 | 105 | CombinationActivityDO activity = combinationActivityService.validateCombinationActivityExists(reqDTO.getActivityId()); |
| 104 | 106 | // 1.2 需要校验下,他当前是不是已经参加了该拼团; |
| 107 | + // TODO @puhui999:拼团应该可以重复参加;应该去校验总共的上限哈,就是 activity.totalLimitCount | |
| 105 | 108 | CombinationRecordDO recordDO = recordMapper.selectByUserIdAndOrderId(reqDTO.getUserId(), reqDTO.getOrderId()); |
| 106 | 109 | if (recordDO != null) { |
| 107 | 110 | throw exception(COMBINATION_RECORD_EXISTS); |
| ... | ... | @@ -111,6 +114,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { |
| 111 | 114 | if (CollUtil.isNotEmpty(recordDOList)) { |
| 112 | 115 | throw exception(COMBINATION_RECORD_FAILED_HAVE_JOINED); |
| 113 | 116 | } |
| 117 | + // TODO @puhui999:有个开始时间未校验 | |
| 114 | 118 | // 1.4 校验当前活动是否过期 |
| 115 | 119 | if (LocalDateTime.now().isAfter(activity.getEndTime())) { |
| 116 | 120 | throw exception(COMBINATION_RECORD_FAILED_TIME_END); |
| ... | ... | @@ -128,6 +132,8 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { |
| 128 | 132 | } |
| 129 | 133 | } |
| 130 | 134 | |
| 135 | + // TODO @puhui999:单次限购 | |
| 136 | + | |
| 131 | 137 | // 2. 创建拼团记录 |
| 132 | 138 | MemberUserRespDTO user = memberUserApi.getUser(reqDTO.getUserId()); |
| 133 | 139 | ProductSpuRespDTO spu = productSpuApi.getSpu(reqDTO.getSpuId()); | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityService.java
| ... | ... | @@ -37,11 +37,11 @@ public interface SeckillActivityService { |
| 37 | 37 | /** |
| 38 | 38 | * 更新秒杀库存 |
| 39 | 39 | * |
| 40 | - * @param activityId 活动编号 | |
| 40 | + * @param id 活动编号 | |
| 41 | 41 | * @param skuId sku 编号 |
| 42 | 42 | * @param count 数量 |
| 43 | 43 | */ |
| 44 | - void updateSeckillStock(Long activityId, Long skuId, Integer count); | |
| 44 | + void updateSeckillStock(Long id, Long skuId, Integer count); | |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * 关闭秒杀活动 |
| ... | ... | @@ -98,6 +98,15 @@ public interface SeckillActivityService { |
| 98 | 98 | List<SeckillActivityDO> getSeckillActivityListByConfigIds(Collection<Long> ids); |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | + * 通过活动时段编号获取指定 status 的秒杀活动 | |
| 102 | + * | |
| 103 | + * @param configId 时段配置编号 | |
| 104 | + * @param status 状态 | |
| 105 | + * @return 秒杀活动列表 | |
| 106 | + */ | |
| 107 | + List<SeckillActivityDO> getSeckillActivityListByConfigIdAndStatus(Long configId, Integer status); | |
| 108 | + | |
| 109 | + /** | |
| 101 | 110 | * 通过活动时段获取秒杀活动 |
| 102 | 111 | * |
| 103 | 112 | * @param pageReqVO 请求 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java
| ... | ... | @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.promotion.service.seckill; |
| 3 | 3 | import cn.hutool.core.util.ObjectUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 7 | 6 | import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; |
| 8 | 7 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO; |
| 9 | 8 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; |
| ... | ... | @@ -31,6 +30,7 @@ import java.util.Map; |
| 31 | 30 | import static cn.hutool.core.collection.CollUtil.isNotEmpty; |
| 32 | 31 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 33 | 32 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| 33 | +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.isBetween; | |
| 34 | 34 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SKU_NOT_EXISTS; |
| 35 | 35 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_NOT_EXISTS; |
| 36 | 36 | import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*; |
| ... | ... | @@ -148,32 +148,26 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { |
| 148 | 148 | |
| 149 | 149 | @Override |
| 150 | 150 | @Transactional(rollbackFor = Exception.class) |
| 151 | - public void updateSeckillStock(Long activityId, Long skuId, Integer count) { | |
| 152 | - // 1、校验秒杀活动是否存在 | |
| 153 | - SeckillActivityDO seckillActivity = getSeckillActivity(activityId); | |
| 154 | - // 1.1、校验库存是否充足 | |
| 155 | - if (seckillActivity.getTotalStock() < count) { | |
| 151 | + public void updateSeckillStock(Long id, Long skuId, Integer count) { | |
| 152 | + // 1.1 校验活动库存是否充足 | |
| 153 | + SeckillActivityDO seckillActivity = getSeckillActivity(id); | |
| 154 | + if (count > seckillActivity.getTotalStock()) { | |
| 156 | 155 | throw exception(SECKILL_ACTIVITY_UPDATE_STOCK_FAIL); |
| 157 | 156 | } |
| 158 | - | |
| 159 | - // 2、获取活动商品 | |
| 160 | - List<SeckillProductDO> products = getSeckillProductListByActivityId(activityId); | |
| 161 | - // 2.1、过滤出购买的商品 | |
| 162 | - SeckillProductDO product = findFirst(products, item -> ObjectUtil.equal(skuId, item.getSkuId())); | |
| 163 | - // 2.2、检查活动商品库存是否充足 | |
| 164 | - boolean isSufficient = product == null || (product.getStock() == 0 || (product.getStock() < count) || (product.getStock() - count) < 0); | |
| 165 | - if (isSufficient) { | |
| 157 | + // 1.2 校验商品库存是否充足 | |
| 158 | + SeckillProductDO product = seckillProductMapper.selectByActivityIdAndSkuId(id, skuId); | |
| 159 | + if (product == null || count > product.getStock()) { | |
| 166 | 160 | throw exception(SECKILL_ACTIVITY_UPDATE_STOCK_FAIL); |
| 167 | 161 | } |
| 168 | 162 | |
| 169 | - // 3、更新活动商品库存 | |
| 170 | - int updateCount = seckillProductMapper.updateActivityStock(product.getId(), count); | |
| 163 | + // 2.1 更新活动商品库存 | |
| 164 | + int updateCount = seckillProductMapper.updateStock(product.getId(), count); | |
| 171 | 165 | if (updateCount == 0) { |
| 172 | 166 | throw exception(SECKILL_ACTIVITY_UPDATE_STOCK_FAIL); |
| 173 | 167 | } |
| 174 | 168 | |
| 175 | - // 4、更新活动库存 | |
| 176 | - updateCount = seckillActivityMapper.updateActivityStock(seckillActivity.getId(), count); | |
| 169 | + // 2.2 更新活动库存 | |
| 170 | + updateCount = seckillActivityMapper.updateStock(seckillActivity.getId(), count); | |
| 177 | 171 | if (updateCount == 0) { |
| 178 | 172 | throw exception(SECKILL_ACTIVITY_UPDATE_STOCK_FAIL); |
| 179 | 173 | } |
| ... | ... | @@ -268,8 +262,15 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { |
| 268 | 262 | |
| 269 | 263 | @Override |
| 270 | 264 | public List<SeckillActivityDO> getSeckillActivityListByConfigIds(Collection<Long> ids) { |
| 271 | - return CollectionUtils.filterList(seckillActivityMapper.selectList(), | |
| 272 | - item -> CollectionUtils.anyMatch(item.getConfigIds(), ids::contains)); | |
| 265 | + return filterList(seckillActivityMapper.selectList(), | |
| 266 | + item -> anyMatch(item.getConfigIds(), ids::contains)); | |
| 267 | + } | |
| 268 | + | |
| 269 | + @Override | |
| 270 | + public List<SeckillActivityDO> getSeckillActivityListByConfigIdAndStatus(Long configId, Integer status) { | |
| 271 | + return filterList(seckillActivityMapper.selectList(SeckillActivityDO::getStatus, status), | |
| 272 | + item -> anyMatch(item.getConfigIds(), id -> ObjectUtil.equal(id, configId)) // 校验时段 | |
| 273 | + && isBetween(item.getStartTime(), item.getEndTime())); // 追加当前日期是否处在活动日期之间的校验条件 | |
| 273 | 274 | } |
| 274 | 275 | |
| 275 | 276 | @Override | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillConfigService.java
| ... | ... | @@ -54,6 +54,7 @@ public interface SeckillConfigService { |
| 54 | 54 | */ |
| 55 | 55 | List<SeckillConfigDO> getSeckillConfigList(); |
| 56 | 56 | |
| 57 | + | |
| 57 | 58 | /** |
| 58 | 59 | * 校验秒杀时段是否存在 |
| 59 | 60 | * |
| ... | ... | @@ -85,4 +86,12 @@ public interface SeckillConfigService { |
| 85 | 86 | */ |
| 86 | 87 | void updateSeckillConfigStatus(Long id, Integer status); |
| 87 | 88 | |
| 89 | + /** | |
| 90 | + * 获取当前日期时间处于的秒杀时段且状态为 status | |
| 91 | + * | |
| 92 | + * @param status 状态 | |
| 93 | + * @return 时段 | |
| 94 | + */ | |
| 95 | + SeckillConfigDO getSeckillConfigListByStatusOnCurrentTime(Integer status); | |
| 96 | + | |
| 88 | 97 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillConfigServiceImpl.java
| ... | ... | @@ -20,6 +20,8 @@ import java.util.Collection; |
| 20 | 20 | import java.util.List; |
| 21 | 21 | |
| 22 | 22 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 23 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.findFirst; | |
| 24 | +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.isBetween; | |
| 23 | 25 | import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*; |
| 24 | 26 | |
| 25 | 27 | /** |
| ... | ... | @@ -68,6 +70,12 @@ public class SeckillConfigServiceImpl implements SeckillConfigService { |
| 68 | 70 | } |
| 69 | 71 | |
| 70 | 72 | @Override |
| 73 | + public SeckillConfigDO getSeckillConfigListByStatusOnCurrentTime(Integer status) { | |
| 74 | + return findFirst(seckillConfigMapper.selectList(SeckillConfigDO::getStatus, status), | |
| 75 | + config -> isBetween(config.getStartTime(), config.getEndTime())); | |
| 76 | + } | |
| 77 | + | |
| 78 | + @Override | |
| 71 | 79 | public void deleteSeckillConfig(Long id) { |
| 72 | 80 | // 校验存在 |
| 73 | 81 | validateSeckillConfigExists(id); | ... | ... |
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/DictTypeConstants.java
0 → 100644
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/ErrorCodeConstants.java
| ... | ... | @@ -12,12 +12,6 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; |
| 12 | 12 | public interface ErrorCodeConstants { |
| 13 | 13 | |
| 14 | 14 | // ========== Order 模块 1011000000 ========== |
| 15 | - ErrorCode ORDER_CREATE_SKU_NOT_FOUND = new ErrorCode(1011000001, "商品 SKU 不存在"); | |
| 16 | - ErrorCode ORDER_CREATE_SPU_NOT_SALE = new ErrorCode(1011000002, "商品 SPU 不可售卖"); | |
| 17 | - ErrorCode ORDER_CREATE_SKU_STOCK_NOT_ENOUGH = new ErrorCode(1011000004, "商品 SKU 库存不足"); | |
| 18 | - ErrorCode ORDER_CREATE_SPU_NOT_FOUND = new ErrorCode(1011000005, "商品 SPU 不可售卖"); | |
| 19 | - ErrorCode ORDER_CREATE_ADDRESS_NOT_FOUND = new ErrorCode(1011000006, "收货地址不存在"); | |
| 20 | - | |
| 21 | 15 | ErrorCode ORDER_ITEM_NOT_FOUND = new ErrorCode(1011000010, "交易订单项不存在"); |
| 22 | 16 | ErrorCode ORDER_NOT_FOUND = new ErrorCode(1011000011, "交易订单不存在"); |
| 23 | 17 | ErrorCode ORDER_ITEM_UPDATE_AFTER_SALE_STATUS_FAIL = new ErrorCode(1011000012, "交易订单项更新售后状态失败,请重试"); |
| ... | ... | @@ -37,6 +31,7 @@ public interface ErrorCodeConstants { |
| 37 | 31 | ErrorCode ORDER_UPDATE_PRICE_FAIL_PAID = new ErrorCode(1011000026, "支付订单调价失败,原因:支付订单已付款,不能调价"); |
| 38 | 32 | ErrorCode ORDER_UPDATE_PRICE_FAIL_EQUAL = new ErrorCode(1011000027, "支付订单调价失败,原因:价格没有变化"); |
| 39 | 33 | ErrorCode ORDER_UPDATE_PRICE_FAIL_NOT_ITEM = new ErrorCode(1011000028, "支付订单调价失败,原因:订单项不存在"); |
| 34 | + ErrorCode ORDER_DELETE_FAIL_STATUS_NOT_CANCEL = new ErrorCode(1011000029, "交易订单删除失败,订单不是【已取消】状态"); | |
| 40 | 35 | |
| 41 | 36 | // ========== After Sale 模块 1011000100 ========== |
| 42 | 37 | ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1011000100, "售后单不存在"); |
| ... | ... | @@ -58,9 +53,8 @@ public interface ErrorCodeConstants { |
| 58 | 53 | |
| 59 | 54 | // ========== Price 相关 1011003000 ============ |
| 60 | 55 | ErrorCode PRICE_CALCULATE_PAY_PRICE_ILLEGAL = new ErrorCode(1011003000, "支付价格计算异常,原因:价格小于等于 0"); |
| 61 | - ErrorCode PRICE_CALCULATE_DELIVERY_PRICE_USER_ADDRESS_IS_EMPTY = new ErrorCode(1011003001, "计算快递运费异常,收件人地址编号为空"); | |
| 62 | 56 | ErrorCode PRICE_CALCULATE_DELIVERY_PRICE_TEMPLATE_NOT_FOUND = new ErrorCode(1011003002, "计算快递运费异常,找不到对应的运费模板"); |
| 63 | - ErrorCode PRICE_CALCULATE_DELIVERY_PRICE_PICK_UP_STORE_IS_EMPTY = new ErrorCode(1011003003, "计算快递运费异常,自提点为空"); | |
| 57 | + ErrorCode PRICE_CALCULATE_COUPON_NOT_MATCH_NORMAL_ORDER = new ErrorCode(1011003004, "参与秒杀、拼团、砍价的营销商品,无法使用优惠劵"); | |
| 64 | 58 | |
| 65 | 59 | // ========== 物流 Express 模块 1011004000 ========== |
| 66 | 60 | ErrorCode EXPRESS_NOT_EXISTS = new ErrorCode(1011004000, "快递公司不存在"); |
| ... | ... | @@ -93,5 +87,7 @@ public interface ErrorCodeConstants { |
| 93 | 87 | // ========== 分销提现 模块 1011008000 ========== |
| 94 | 88 | ErrorCode BROKERAGE_WITHDRAW_NOT_EXISTS = new ErrorCode(1011008000, "佣金提现记录不存在"); |
| 95 | 89 | ErrorCode BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING = new ErrorCode(1011008001, "佣金提现记录状态不是审核中"); |
| 90 | + ErrorCode BROKERAGE_WITHDRAW_MIN_PRICE = new ErrorCode(1011008002, "提现金额不能低于 {} 元"); | |
| 91 | + ErrorCode BROKERAGE_WITHDRAW_USER_BALANCE_NOT_ENOUGH = new ErrorCode(1011008003, "您当前最多可提现 {} 元"); | |
| 96 | 92 | |
| 97 | 93 | } | ... | ... |
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/brokerage/BrokerageRecordBizTypeEnum.java
| ... | ... | @@ -17,6 +17,7 @@ public enum BrokerageRecordBizTypeEnum implements IntArrayValuable { |
| 17 | 17 | |
| 18 | 18 | ORDER(1, "获得推广佣金", "获得推广佣金 {}", true), |
| 19 | 19 | WITHDRAW(2, "提现申请", "提现申请扣除佣金 {}", false), |
| 20 | + WITHDRAW_REJECT(3, "提现申请驳回", "提现申请驳回返还佣金 {}", true), | |
| 20 | 21 | ; |
| 21 | 22 | |
| 22 | 23 | public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageRecordBizTypeEnum::getType).toArray(); | ... | ... |
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/delivery/DeliveryExpressChargeModeEnum.java
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderOperateTypeEnum.java
| ... | ... | @@ -14,7 +14,10 @@ import lombok.RequiredArgsConstructor; |
| 14 | 14 | public enum TradeOrderOperateTypeEnum { |
| 15 | 15 | |
| 16 | 16 | MEMBER_CREATE(1, "用户下单"), |
| 17 | - TEST(2, "用户({nickname})做了({thing})"), | |
| 17 | + MEMBER_RECEIVE(30, "用户已收货"), | |
| 18 | + MEMBER_COMMENT(31, "用户评价"), | |
| 19 | + MEMBER_CANCEL(40, "取消订单"), | |
| 20 | + MEMBER_DELETE(41, "删除订单"), | |
| 18 | 21 | ; |
| 19 | 22 | |
| 20 | 23 | /** | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/TradeAfterSaleController.java
| ... | ... | @@ -8,11 +8,11 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 8 | 8 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 9 | 9 | import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO; |
| 10 | 10 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.*; |
| 11 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO; | |
| 11 | 12 | import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert; |
| 12 | 13 | import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO; |
| 13 | 14 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; |
| 14 | 15 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; |
| 15 | -import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO; | |
| 16 | 16 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService; |
| 17 | 17 | import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService; |
| 18 | 18 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; |
| ... | ... | @@ -87,13 +87,13 @@ public class TradeAfterSaleController { |
| 87 | 87 | // 拼接数据 |
| 88 | 88 | MemberUserRespDTO user = memberUserApi.getUser(afterSale.getUserId()); |
| 89 | 89 | // 获取售后日志 |
| 90 | - List<TradeAfterSaleLogRespDTO> logs = afterSaleLogService.getLog(afterSale.getId()); | |
| 90 | + List<TradeAfterSaleLogRespVO> logs = afterSaleLogService.getLog(afterSale.getId()); | |
| 91 | 91 | // TODO 方便测试看效果,review 后移除 |
| 92 | 92 | if (logs == null) { |
| 93 | 93 | logs = new ArrayList<>(); |
| 94 | 94 | } |
| 95 | 95 | for (int i = 1; i <= 6; i++) { |
| 96 | - TradeAfterSaleLogRespDTO respVO = new TradeAfterSaleLogRespDTO(); | |
| 96 | + TradeAfterSaleLogRespVO respVO = new TradeAfterSaleLogRespVO(); | |
| 97 | 97 | respVO.setId((long) i); |
| 98 | 98 | respVO.setUserId((long) i); |
| 99 | 99 | respVO.setUserType(i % 2 == 0 ? 2 : 1); | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/record/BrokerageRecordController.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/BrokerageRecordController.java
| 1 | -package cn.iocoder.yudao.module.trade.controller.admin.brokerage.record; | |
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 6 | 6 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 7 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.record.vo.BrokerageRecordPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.record.vo.BrokerageRecordRespVO; | |
| 9 | -import cn.iocoder.yudao.module.trade.convert.brokerage.record.BrokerageRecordConvert; | |
| 10 | -import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.record.BrokerageRecordDO; | |
| 11 | -import cn.iocoder.yudao.module.trade.service.brokerage.record.BrokerageRecordService; | |
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.record.BrokerageRecordPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.record.BrokerageRecordRespVO; | |
| 9 | +import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageRecordConvert; | |
| 10 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO; | |
| 11 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService; | |
| 12 | 12 | import io.swagger.v3.oas.annotations.Operation; |
| 13 | 13 | import io.swagger.v3.oas.annotations.Parameter; |
| 14 | 14 | import io.swagger.v3.oas.annotations.tags.Tag; | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/user/BrokerageUserController.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/BrokerageUserController.java
| 1 | -package cn.iocoder.yudao.module.trade.controller.admin.brokerage.user; | |
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 6 | 6 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 7 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.user.vo.*; | |
| 8 | -import cn.iocoder.yudao.module.trade.convert.brokerage.user.BrokerageUserConvert; | |
| 9 | -import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.user.BrokerageUserDO; | |
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.*; | |
| 8 | +import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageUserConvert; | |
| 9 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO; | |
| 10 | 10 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; |
| 11 | 11 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum; |
| 12 | +import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; | |
| 13 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService; | |
| 12 | 14 | import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO; |
| 13 | -import cn.iocoder.yudao.module.trade.service.brokerage.record.BrokerageRecordService; | |
| 14 | -import cn.iocoder.yudao.module.trade.service.brokerage.user.BrokerageUserService; | |
| 15 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService; | |
| 16 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService; | |
| 17 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO; | |
| 15 | 18 | import io.swagger.v3.oas.annotations.Operation; |
| 16 | 19 | import io.swagger.v3.oas.annotations.Parameter; |
| 17 | 20 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -38,6 +41,8 @@ public class BrokerageUserController { |
| 38 | 41 | private BrokerageUserService brokerageUserService; |
| 39 | 42 | @Resource |
| 40 | 43 | private BrokerageRecordService brokerageRecordService; |
| 44 | + @Resource | |
| 45 | + private BrokerageWithdrawService brokerageWithdrawService; | |
| 41 | 46 | |
| 42 | 47 | @Resource |
| 43 | 48 | private MemberUserApi memberUserApi; |
| ... | ... | @@ -87,6 +92,7 @@ public class BrokerageUserController { |
| 87 | 92 | Set<Long> userIds = convertSet(pageResult.getList(), BrokerageUserDO::getId); |
| 88 | 93 | // 查询用户信息 |
| 89 | 94 | Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(userIds); |
| 95 | + // TODO @疯狂:看看下面两个 getBrokerageUserCountByBindUserId、getWithdrawSummaryByUserId 有没可能一次性出结果,不然 n 次有点太花性能了; | |
| 90 | 96 | // 合计分佣订单 |
| 91 | 97 | Map<Long, UserBrokerageSummaryBO> userOrderSummaryMap = convertMap(userIds, |
| 92 | 98 | userId -> userId, |
| ... | ... | @@ -96,10 +102,13 @@ public class BrokerageUserController { |
| 96 | 102 | Map<Long, Long> brokerageUserCountMap = convertMap(userIds, |
| 97 | 103 | userId -> userId, |
| 98 | 104 | userId -> brokerageUserService.getBrokerageUserCountByBindUserId(userId, null)); |
| 99 | - | |
| 100 | - // todo 合计提现 | |
| 101 | - | |
| 102 | - return success(BrokerageUserConvert.INSTANCE.convertPage(pageResult, userMap, brokerageUserCountMap, userOrderSummaryMap)); | |
| 105 | + // 合计提现 | |
| 106 | + Map<Long, UserWithdrawSummaryBO> withdrawMap = convertMap(userIds, | |
| 107 | + userId -> userId, | |
| 108 | + userId -> brokerageWithdrawService.getWithdrawSummaryByUserId(userId, BrokerageWithdrawStatusEnum.AUDIT_SUCCESS)); | |
| 109 | + // 拼接返回 | |
| 110 | + return success(BrokerageUserConvert.INSTANCE.convertPage(pageResult, userMap, brokerageUserCountMap, | |
| 111 | + userOrderSummaryMap, withdrawMap)); | |
| 103 | 112 | } |
| 104 | 113 | |
| 105 | 114 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/BrokerageWithdrawController.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/BrokerageWithdrawController.java
| 1 | -package cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw; | |
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 6 | 6 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 7 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawRejectReqVO; | |
| 8 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawPageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawRespVO; | |
| 10 | -import cn.iocoder.yudao.module.trade.convert.brokerage.withdraw.BrokerageWithdrawConvert; | |
| 11 | -import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.withdraw.BrokerageWithdrawDO; | |
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawRejectReqVO; | |
| 8 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawRespVO; | |
| 10 | +import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageWithdrawConvert; | |
| 11 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO; | |
| 12 | 12 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; |
| 13 | -import cn.iocoder.yudao.module.trade.service.brokerage.withdraw.BrokerageWithdrawService; | |
| 13 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService; | |
| 14 | 14 | import io.swagger.v3.oas.annotations.Operation; |
| 15 | 15 | import io.swagger.v3.oas.annotations.Parameter; |
| 16 | 16 | import io.swagger.v3.oas.annotations.tags.Tag; | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/record/vo/BrokerageRecordBaseVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/record/BrokerageRecordBaseVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/record/vo/BrokerageRecordPageReqVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/record/BrokerageRecordPageReqVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/record/vo/BrokerageRecordRespVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/record/BrokerageRecordRespVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/user/vo/BrokerageUserBaseVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/user/BrokerageUserBaseVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/user/vo/BrokerageUserClearBrokerageUserReqVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/user/BrokerageUserClearBrokerageUserReqVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/user/vo/BrokerageUserPageReqVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/user/BrokerageUserPageReqVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/user/vo/BrokerageUserRespVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/user/BrokerageUserRespVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/user/vo/BrokerageUserUpdateBrokerageEnabledReqVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/user/BrokerageUserUpdateBrokerageEnabledReqVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/user/vo/BrokerageUserUpdateBrokerageUserReqVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/user/BrokerageUserUpdateBrokerageUserReqVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/vo/BrokerageWithdrawBaseVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/withdraw/BrokerageWithdrawBaseVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/vo/BrokerageWithdrawPageReqVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/withdraw/BrokerageWithdrawPageReqVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/vo/BrokerageWithdrawRejectReqVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/withdraw/BrokerageWithdrawRejectReqVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/withdraw/vo/BrokerageWithdrawRespVO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/vo/withdraw/BrokerageWithdrawRespVO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigBaseVO.java
| ... | ... | @@ -19,6 +19,17 @@ import java.util.List; |
| 19 | 19 | */ |
| 20 | 20 | @Data |
| 21 | 21 | public class TradeConfigBaseVO { |
| 22 | + /** | |
| 23 | + * 是否启用全场包邮 | |
| 24 | + */ | |
| 25 | + @Schema(description = "是否启用全场包邮", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 26 | + @NotNull(message = "是否启用全场包邮不能为空") | |
| 27 | + private Boolean deliveryExpressFreeEnabled; | |
| 28 | + | |
| 29 | + @Schema(description = "全场包邮的最小金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") | |
| 30 | + @NotNull(message = "全场包邮的最小金额不能为空") | |
| 31 | + @PositiveOrZero(message = "全场包邮的最小金额不能是负数") | |
| 32 | + private Integer deliveryExpressFreePrice; | |
| 22 | 33 | |
| 23 | 34 | // ========== 分销相关 ========== |
| 24 | 35 | |
| ... | ... | @@ -37,7 +48,7 @@ public class TradeConfigBaseVO { |
| 37 | 48 | private Integer brokerageBindMode; |
| 38 | 49 | |
| 39 | 50 | @Schema(description = "分销海报图地址数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "[https://www.iocoder.cn/yudao.jpg]") |
| 40 | - private List<String> brokeragePostUrls; | |
| 51 | + private List<String> brokeragePosterUrls; | |
| 41 | 52 | |
| 42 | 53 | @Schema(description = "一级返佣比例", requiredMode = Schema.RequiredMode.REQUIRED, example = "5") |
| 43 | 54 | @NotNull(message = "一级返佣比例不能为空") |
| ... | ... | @@ -54,6 +65,11 @@ public class TradeConfigBaseVO { |
| 54 | 65 | @PositiveOrZero(message = "用户提现最低金额不能是负数") |
| 55 | 66 | private Integer brokerageWithdrawMinPrice; |
| 56 | 67 | |
| 68 | + @Schema(description = "用户提现手续费百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") | |
| 69 | + @NotNull(message = "用户提现手续费百分比不能为空") | |
| 70 | + @PositiveOrZero(message = "用户提现手续费百分比不能是负数") | |
| 71 | + private Integer brokerageWithdrawFeePercent; | |
| 72 | + | |
| 57 | 73 | @Schema(description = "提现银行", requiredMode = Schema.RequiredMode.REQUIRED, example = "[0, 1]") |
| 58 | 74 | @NotEmpty(message = "提现银行不能为空") |
| 59 | 75 | private List<Integer> brokerageBankNames; |
| ... | ... | @@ -66,6 +82,6 @@ public class TradeConfigBaseVO { |
| 66 | 82 | @Schema(description = "提现方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "[0, 1]") |
| 67 | 83 | @NotNull(message = "提现方式不能为空") |
| 68 | 84 | @InEnum(value = BrokerageWithdrawTypeEnum.class, message = "提现方式必须是 {value}") |
| 69 | - private List<Integer> brokerageWithdrawType; | |
| 85 | + private List<Integer> brokerageWithdrawTypes; | |
| 70 | 86 | |
| 71 | 87 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageRecordController.java
| ... | ... | @@ -6,7 +6,9 @@ import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; |
| 6 | 6 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.record.AppBrokerageProductPriceRespVO; |
| 7 | 7 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.record.AppBrokerageRecordPageReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.record.AppBrokerageRecordRespVO; |
| 9 | -import cn.iocoder.yudao.module.trade.service.brokerage.user.BrokerageUserService; | |
| 9 | +import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageRecordConvert; | |
| 10 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO; | |
| 11 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService; | |
| 10 | 12 | import io.swagger.v3.oas.annotations.Operation; |
| 11 | 13 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 12 | 14 | import lombok.extern.slf4j.Slf4j; |
| ... | ... | @@ -18,11 +20,9 @@ import org.springframework.web.bind.annotation.RestController; |
| 18 | 20 | |
| 19 | 21 | import javax.annotation.Resource; |
| 20 | 22 | import javax.validation.Valid; |
| 21 | -import java.time.LocalDateTime; | |
| 22 | 23 | |
| 23 | 24 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 24 | 25 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; |
| 25 | -import static java.util.Arrays.asList; | |
| 26 | 26 | |
| 27 | 27 | @Tag(name = "用户 APP - 分销用户") |
| 28 | 28 | @RestController |
| ... | ... | @@ -31,30 +31,21 @@ import static java.util.Arrays.asList; |
| 31 | 31 | @Slf4j |
| 32 | 32 | public class AppBrokerageRecordController { |
| 33 | 33 | @Resource |
| 34 | - private BrokerageUserService brokerageUserService; | |
| 34 | + private BrokerageRecordService brokerageRecordService; | |
| 35 | 35 | |
| 36 | - // TODO 芋艿:临时 mock => | |
| 37 | 36 | @GetMapping("/page") |
| 38 | 37 | @Operation(summary = "获得分销记录分页") |
| 39 | 38 | @PreAuthenticated |
| 40 | 39 | public CommonResult<PageResult<AppBrokerageRecordRespVO>> getBrokerageRecordPage(@Valid AppBrokerageRecordPageReqVO pageReqVO) { |
| 41 | - AppBrokerageRecordRespVO vo1 = new AppBrokerageRecordRespVO() | |
| 42 | - .setId(1L).setPrice(10).setTitle("收到钱").setCreateTime(LocalDateTime.now()) | |
| 43 | - .setFinishTime(LocalDateTime.now()); | |
| 44 | - AppBrokerageRecordRespVO vo2 = new AppBrokerageRecordRespVO() | |
| 45 | - .setId(2L).setPrice(-20).setTitle("提现钱").setCreateTime(LocalDateTime.now()) | |
| 46 | - .setFinishTime(LocalDateTime.now()); | |
| 47 | - return success(new PageResult<>(asList(vo1, vo2), 10L)); | |
| 40 | + PageResult<BrokerageRecordDO> pageResult = brokerageRecordService.getBrokerageRecordPage( | |
| 41 | + BrokerageRecordConvert.INSTANCE.convert(pageReqVO, getLoginUserId())); | |
| 42 | + return success(BrokerageRecordConvert.INSTANCE.convertPage02(pageResult)); | |
| 48 | 43 | } |
| 49 | 44 | |
| 50 | 45 | @GetMapping("/get-product-brokerage-price") |
| 51 | 46 | @Operation(summary = "获得商品的分销金额") |
| 52 | 47 | public CommonResult<AppBrokerageProductPriceRespVO> getProductBrokeragePrice(@RequestParam("spuId") Long spuId) { |
| 53 | - AppBrokerageProductPriceRespVO respVO = new AppBrokerageProductPriceRespVO(); | |
| 54 | - respVO.setEnabled(brokerageUserService.getUserBrokerageEnabled(getLoginUserId())); | |
| 55 | - respVO.setBrokerageMinPrice(1); | |
| 56 | - respVO.setBrokerageMaxPrice(2); | |
| 57 | - return success(respVO); | |
| 48 | + return success(brokerageRecordService.calculateProductBrokeragePrice(spuId, getLoginUserId())); | |
| 58 | 49 | } |
| 59 | 50 | |
| 60 | 51 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageUserController.java
| 1 | 1 | package cn.iocoder.yudao.module.trade.controller.app.brokerage; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 6 | import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; |
| 7 | +import cn.iocoder.yudao.module.member.api.user.MemberUserApi; | |
| 8 | +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | |
| 6 | 9 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.*; |
| 7 | -import cn.iocoder.yudao.module.trade.service.brokerage.user.BrokerageUserService; | |
| 10 | +import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageRecordConvert; | |
| 11 | +import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageUserConvert; | |
| 12 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO; | |
| 13 | +import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; | |
| 14 | +import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; | |
| 15 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService; | |
| 16 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService; | |
| 17 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService; | |
| 18 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO; | |
| 8 | 19 | import io.swagger.v3.oas.annotations.Operation; |
| 9 | 20 | import io.swagger.v3.oas.annotations.Parameter; |
| 10 | 21 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -16,11 +27,13 @@ import org.springframework.web.bind.annotation.*; |
| 16 | 27 | import javax.annotation.Resource; |
| 17 | 28 | import javax.validation.Valid; |
| 18 | 29 | import java.time.LocalDateTime; |
| 30 | +import java.util.Map; | |
| 31 | +import java.util.Optional; | |
| 19 | 32 | |
| 20 | 33 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 34 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 21 | 35 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 22 | 36 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 23 | -import static java.util.Arrays.asList; | |
| 24 | 37 | |
| 25 | 38 | @Tag(name = "用户 APP - 分销用户") |
| 26 | 39 | @RestController |
| ... | ... | @@ -30,16 +43,24 @@ import static java.util.Arrays.asList; |
| 30 | 43 | public class AppBrokerageUserController { |
| 31 | 44 | @Resource |
| 32 | 45 | private BrokerageUserService brokerageUserService; |
| 46 | + @Resource | |
| 47 | + private BrokerageRecordService brokerageRecordService; | |
| 48 | + @Resource | |
| 49 | + private BrokerageWithdrawService brokerageWithdrawService; | |
| 50 | + | |
| 51 | + @Resource | |
| 52 | + private MemberUserApi memberUserApi; | |
| 33 | 53 | |
| 34 | - // TODO 芋艿:临时 mock => | |
| 35 | 54 | @GetMapping("/get") |
| 36 | 55 | @Operation(summary = "获得个人分销信息") |
| 37 | 56 | @PreAuthenticated |
| 38 | 57 | public CommonResult<AppBrokerageUserRespVO> getBrokerageUser() { |
| 58 | + Optional<BrokerageUserDO> user = Optional.ofNullable(brokerageUserService.getBrokerageUser(getLoginUserId())); | |
| 59 | + // 返回数据 | |
| 39 | 60 | AppBrokerageUserRespVO respVO = new AppBrokerageUserRespVO() |
| 40 | - .setBrokerageEnabled(true) | |
| 41 | - .setPrice(2000) | |
| 42 | - .setFrozenPrice(3000); | |
| 61 | + .setBrokerageEnabled(user.map(BrokerageUserDO::getBrokerageEnabled).orElse(false)) | |
| 62 | + .setBrokeragePrice(user.map(BrokerageUserDO::getBrokeragePrice).orElse(0)) | |
| 63 | + .setFrozenPrice(user.map(BrokerageUserDO::getFrozenPrice).orElse(0)); | |
| 43 | 64 | return success(respVO); |
| 44 | 65 | } |
| 45 | 66 | |
| ... | ... | @@ -47,88 +68,70 @@ public class AppBrokerageUserController { |
| 47 | 68 | @Operation(summary = "绑定推广员") |
| 48 | 69 | @PreAuthenticated |
| 49 | 70 | public CommonResult<Boolean> bindBrokerageUser(@Valid @RequestBody AppBrokerageUserBindReqVO reqVO) { |
| 50 | - return success(brokerageUserService.bindBrokerageUser(getLoginUserId(), reqVO.getBindUserId(), false)); | |
| 71 | + MemberUserRespDTO user = memberUserApi.getUser(getLoginUserId()); | |
| 72 | + return success(brokerageUserService.bindBrokerageUser(user.getId(), reqVO.getBindUserId(), user.getCreateTime())); | |
| 51 | 73 | } |
| 52 | 74 | |
| 53 | - // TODO 芋艿:临时 mock => | |
| 54 | 75 | @GetMapping("/get-summary") |
| 55 | 76 | @Operation(summary = "获得个人分销统计") |
| 56 | 77 | @PreAuthenticated |
| 57 | 78 | public CommonResult<AppBrokerageUserMySummaryRespVO> getBrokerageUserSummary() { |
| 79 | + Long userId = getLoginUserId(); | |
| 80 | + // TODO @疯狂:后面这种,要不也改成 convert;感觉 controller 这样更容易看到整体;核心其实是 86、8/87、9/90、9/91 这阶段 | |
| 81 | + // 统计 yesterdayPrice、withdrawPrice、firstBrokerageUserCount、secondBrokerageUserCount 字段 | |
| 82 | + LocalDateTime yesterday = LocalDateTime.now().minusDays(1); | |
| 83 | + LocalDateTime beginTime = LocalDateTimeUtil.beginOfDay(yesterday); | |
| 84 | + LocalDateTime endTime = LocalDateTimeUtil.endOfDay(yesterday); | |
| 58 | 85 | AppBrokerageUserMySummaryRespVO respVO = new AppBrokerageUserMySummaryRespVO() |
| 59 | - .setYesterdayPrice(1) | |
| 60 | - .setBrokeragePrice(2) | |
| 61 | - .setFrozenPrice(3) | |
| 62 | - .setWithdrawPrice(4) | |
| 63 | - .setFirstBrokerageUserCount(166) | |
| 64 | - .setSecondBrokerageUserCount(233); | |
| 86 | + .setYesterdayPrice(brokerageRecordService.getSummaryPriceByUserId(userId, BrokerageRecordBizTypeEnum.ORDER.getType(), beginTime, endTime)) | |
| 87 | + .setWithdrawPrice(Optional.ofNullable(brokerageWithdrawService.getWithdrawSummaryByUserId(userId, BrokerageWithdrawStatusEnum.AUDIT_SUCCESS)) | |
| 88 | + .map(UserWithdrawSummaryBO::getPrice).orElse(0)) | |
| 89 | + .setBrokeragePrice(0).setFrozenPrice(0) | |
| 90 | + .setFirstBrokerageUserCount(brokerageUserService.getBrokerageUserCountByBindUserId(userId, 1)) | |
| 91 | + .setSecondBrokerageUserCount(brokerageUserService.getBrokerageUserCountByBindUserId(userId, 2)); | |
| 92 | + // 设置 brokeragePrice、frozenPrice 字段 | |
| 93 | + Optional.ofNullable(brokerageUserService.getBrokerageUser(userId)) | |
| 94 | + .ifPresent(user -> respVO.setBrokeragePrice(user.getBrokeragePrice()).setFrozenPrice(user.getFrozenPrice())); | |
| 65 | 95 | return success(respVO); |
| 66 | 96 | } |
| 67 | 97 | |
| 68 | - // TODO 芋艿:临时 mock => | |
| 69 | 98 | @GetMapping("/rank-page-by-user-count") |
| 70 | 99 | @Operation(summary = "获得分销用户排行分页(基于用户量)") |
| 71 | 100 | @PreAuthenticated |
| 72 | 101 | public CommonResult<PageResult<AppBrokerageUserRankByUserCountRespVO>> getBrokerageUserRankPageByUserCount(AppBrokerageUserRankPageReqVO pageReqVO) { |
| 73 | - AppBrokerageUserRankByUserCountRespVO vo1 = new AppBrokerageUserRankByUserCountRespVO() | |
| 74 | - .setId(1L).setNickname("芋1**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") | |
| 75 | - .setBrokerageUserCount(10); | |
| 76 | - AppBrokerageUserRankByUserCountRespVO vo2 = new AppBrokerageUserRankByUserCountRespVO() | |
| 77 | - .setId(2L).setNickname("芋2**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") | |
| 78 | - .setBrokerageUserCount(6); | |
| 79 | - AppBrokerageUserRankByUserCountRespVO vo3 = new AppBrokerageUserRankByUserCountRespVO() | |
| 80 | - .setId(3L).setNickname("芋3**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") | |
| 81 | - .setBrokerageUserCount(4); | |
| 82 | - AppBrokerageUserRankByUserCountRespVO vo4 = new AppBrokerageUserRankByUserCountRespVO() | |
| 83 | - .setId(3L).setNickname("芋3**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") | |
| 84 | - .setBrokerageUserCount(4); | |
| 85 | - return success(new PageResult<>(asList(vo1, vo2, vo3, vo4), 10L)); | |
| 102 | + // 分页查询 | |
| 103 | + PageResult<AppBrokerageUserRankByUserCountRespVO> pageResult = brokerageUserService.getBrokerageUserRankPageByUserCount(pageReqVO); | |
| 104 | + // 拼接数据 | |
| 105 | + Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(convertSet(pageResult.getList(), AppBrokerageUserRankByUserCountRespVO::getId)); | |
| 106 | + return success(BrokerageUserConvert.INSTANCE.convertPage03(pageResult, userMap)); | |
| 86 | 107 | } |
| 87 | 108 | |
| 88 | - // TODO 芋艿:临时 mock => | |
| 89 | 109 | @GetMapping("/rank-page-by-price") |
| 90 | 110 | @Operation(summary = "获得分销用户排行分页(基于佣金)") |
| 91 | 111 | @PreAuthenticated |
| 92 | 112 | public CommonResult<PageResult<AppBrokerageUserRankByPriceRespVO>> getBrokerageUserChildSummaryPageByPrice(AppBrokerageUserRankPageReqVO pageReqVO) { |
| 93 | - AppBrokerageUserRankByPriceRespVO vo1 = new AppBrokerageUserRankByPriceRespVO() | |
| 94 | - .setId(1L).setNickname("芋1**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") | |
| 95 | - .setBrokeragePrice(10); | |
| 96 | - AppBrokerageUserRankByPriceRespVO vo2 = new AppBrokerageUserRankByPriceRespVO() | |
| 97 | - .setId(2L).setNickname("芋2**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") | |
| 98 | - .setBrokeragePrice(6); | |
| 99 | - AppBrokerageUserRankByPriceRespVO vo3 = new AppBrokerageUserRankByPriceRespVO() | |
| 100 | - .setId(3L).setNickname("芋3**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") | |
| 101 | - .setBrokeragePrice(4); | |
| 102 | - AppBrokerageUserRankByPriceRespVO vo4 = new AppBrokerageUserRankByPriceRespVO() | |
| 103 | - .setId(3L).setNickname("芋3**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") | |
| 104 | - .setBrokeragePrice(4); | |
| 105 | - return success(new PageResult<>(asList(vo1, vo2, vo3, vo4), 10L)); | |
| 113 | + // 分页查询 | |
| 114 | + PageResult<AppBrokerageUserRankByPriceRespVO> pageResult = brokerageRecordService.getBrokerageUserChildSummaryPageByPrice(pageReqVO); | |
| 115 | + // 拼接数据 | |
| 116 | + Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(convertSet(pageResult.getList(), AppBrokerageUserRankByPriceRespVO::getId)); | |
| 117 | + return success(BrokerageRecordConvert.INSTANCE.convertPage03(pageResult, userMap)); | |
| 106 | 118 | } |
| 107 | 119 | |
| 108 | - // TODO 芋艿:临时 mock => | |
| 109 | 120 | @GetMapping("/child-summary-page") |
| 110 | 121 | @Operation(summary = "获得下级分销统计分页") |
| 111 | 122 | @PreAuthenticated |
| 112 | 123 | public CommonResult<PageResult<AppBrokerageUserChildSummaryRespVO>> getBrokerageUserChildSummaryPage( |
| 113 | 124 | AppBrokerageUserChildSummaryPageReqVO pageReqVO) { |
| 114 | - AppBrokerageUserChildSummaryRespVO vo1 = new AppBrokerageUserChildSummaryRespVO() | |
| 115 | - .setId(1L).setNickname("芋1**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") | |
| 116 | - .setBrokeragePrice(10).setBrokeragePrice(20).setBrokerageOrderCount(30) | |
| 117 | - .setBrokerageTime(LocalDateTime.now()); | |
| 118 | - AppBrokerageUserChildSummaryRespVO vo2 = new AppBrokerageUserChildSummaryRespVO() | |
| 119 | - .setId(1L).setNickname("芋2**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg") | |
| 120 | - .setBrokeragePrice(20).setBrokeragePrice(30).setBrokerageOrderCount(40) | |
| 121 | - .setBrokerageTime(LocalDateTime.now()); | |
| 122 | - return success(new PageResult<>(asList(vo1, vo2), 10L)); | |
| 125 | + PageResult<AppBrokerageUserChildSummaryRespVO> pageResult = brokerageUserService.getBrokerageUserChildSummaryPage(pageReqVO, getLoginUserId()); | |
| 126 | + return success(pageResult); | |
| 123 | 127 | } |
| 124 | 128 | |
| 125 | - // TODO 芋艿:临时 mock => | |
| 126 | 129 | @GetMapping("/get-rank-by-price") |
| 127 | 130 | @Operation(summary = "获得分销用户排行(基于佣金)") |
| 128 | 131 | @Parameter(name = "times", description = "时间段", required = true) |
| 129 | - public CommonResult<Integer> bindBrokerageUser( | |
| 132 | + public CommonResult<Integer> getRankByPrice( | |
| 130 | 133 | @RequestParam("times") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime[] times) { |
| 131 | - return success(1); | |
| 134 | + return success(brokerageRecordService.getUserRankByPrice(getLoginUserId(), times)); | |
| 132 | 135 | } |
| 133 | 136 | |
| 134 | 137 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageWithdrawController.java
| ... | ... | @@ -3,19 +3,24 @@ package cn.iocoder.yudao.module.trade.controller.app.brokerage; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; |
| 6 | +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; | |
| 6 | 7 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawCreateReqVO; |
| 8 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawPageReqVO; | |
| 7 | 9 | import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawRespVO; |
| 10 | +import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageWithdrawConvert; | |
| 11 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO; | |
| 12 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService; | |
| 8 | 13 | import io.swagger.v3.oas.annotations.Operation; |
| 9 | 14 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 10 | 15 | import lombok.extern.slf4j.Slf4j; |
| 11 | 16 | import org.springframework.validation.annotation.Validated; |
| 12 | 17 | import org.springframework.web.bind.annotation.*; |
| 13 | 18 | |
| 19 | +import javax.annotation.Resource; | |
| 14 | 20 | import javax.validation.Valid; |
| 15 | -import java.time.LocalDateTime; | |
| 16 | 21 | |
| 17 | 22 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 18 | -import static java.util.Arrays.asList; | |
| 23 | +import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; | |
| 19 | 24 | |
| 20 | 25 | @Tag(name = "用户 APP - 分销提现") |
| 21 | 26 | @RestController |
| ... | ... | @@ -24,24 +29,27 @@ import static java.util.Arrays.asList; |
| 24 | 29 | @Slf4j |
| 25 | 30 | public class AppBrokerageWithdrawController { |
| 26 | 31 | |
| 27 | - // TODO 芋艿:临时 mock => | |
| 32 | + @Resource | |
| 33 | + private BrokerageWithdrawService brokerageWithdrawService; | |
| 34 | + | |
| 35 | + @Resource | |
| 36 | + private DictDataApi dictDataApi; | |
| 37 | + | |
| 28 | 38 | @GetMapping("/page") |
| 29 | 39 | @Operation(summary = "获得分销提现分页") |
| 30 | 40 | @PreAuthenticated |
| 31 | - public CommonResult<PageResult<AppBrokerageWithdrawRespVO>> getBrokerageWithdrawPage() { | |
| 32 | - AppBrokerageWithdrawRespVO vo1 = new AppBrokerageWithdrawRespVO() | |
| 33 | - .setId(1L).setStatus(10).setPrice(10).setStatusName("审批通过").setCreateTime(LocalDateTime.now()); | |
| 34 | - AppBrokerageWithdrawRespVO vo2 = new AppBrokerageWithdrawRespVO() | |
| 35 | - .setId(2L).setStatus(0).setPrice(20).setStatusName("审批中").setCreateTime(LocalDateTime.now()); | |
| 36 | - return success(new PageResult<>(asList(vo1, vo2), 10L)); | |
| 41 | + public CommonResult<PageResult<AppBrokerageWithdrawRespVO>> getBrokerageWithdrawPage(AppBrokerageWithdrawPageReqVO pageReqVO) { | |
| 42 | + // 分页查询 | |
| 43 | + PageResult<BrokerageWithdrawDO> pageResult = brokerageWithdrawService.getBrokerageWithdrawPage( | |
| 44 | + BrokerageWithdrawConvert.INSTANCE.convert(pageReqVO, getLoginUserId())); | |
| 45 | + return success(BrokerageWithdrawConvert.INSTANCE.convertPage03(pageResult)); | |
| 37 | 46 | } |
| 38 | 47 | |
| 39 | - // TODO 芋艿:临时 mock => | |
| 40 | 48 | @PostMapping("/create") |
| 41 | 49 | @Operation(summary = "创建分销提现") |
| 42 | 50 | @PreAuthenticated |
| 43 | 51 | public CommonResult<Long> createBrokerageWithdraw(@RequestBody @Valid AppBrokerageWithdrawCreateReqVO createReqVO) { |
| 44 | - return success(1L); | |
| 52 | + return success(brokerageWithdrawService.createBrokerageWithdraw(createReqVO, getLoginUserId())); | |
| 45 | 53 | } |
| 46 | 54 | |
| 47 | 55 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/user/AppBrokerageUserChildSummaryRespVO.java
| ... | ... | @@ -27,7 +27,7 @@ public class AppBrokerageUserChildSummaryRespVO { |
| 27 | 27 | @Schema(description = "分销用户数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "30") |
| 28 | 28 | private Integer brokerageUserCount; |
| 29 | 29 | |
| 30 | - @Schema(description = "成为分销员时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 30 | + @Schema(description = "绑定推广员的时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 31 | 31 | private LocalDateTime brokerageTime; |
| 32 | 32 | |
| 33 | 33 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/user/AppBrokerageUserMySummaryRespVO.java
| ... | ... | @@ -20,9 +20,9 @@ public class AppBrokerageUserMySummaryRespVO { |
| 20 | 20 | private Integer frozenPrice; |
| 21 | 21 | |
| 22 | 22 | @Schema(description = "分销用户数量(一级)", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") |
| 23 | - private Integer firstBrokerageUserCount; | |
| 23 | + private Long firstBrokerageUserCount; | |
| 24 | 24 | |
| 25 | 25 | @Schema(description = "分销用户数量(二级)", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") |
| 26 | - private Integer secondBrokerageUserCount; | |
| 26 | + private Long secondBrokerageUserCount; | |
| 27 | 27 | |
| 28 | 28 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/user/AppBrokerageUserRespVO.java
| ... | ... | @@ -11,7 +11,7 @@ public class AppBrokerageUserRespVO { |
| 11 | 11 | private Boolean brokerageEnabled; |
| 12 | 12 | |
| 13 | 13 | @Schema(description = "可用的佣金,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2408") |
| 14 | - private Integer price; | |
| 14 | + private Integer brokeragePrice; | |
| 15 | 15 | |
| 16 | 16 | @Schema(description = "冻结的佣金,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "234") |
| 17 | 17 | private Integer frozenPrice; | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/withdraw/AppBrokerageWithdrawCreateReqVO.java
| ... | ... | @@ -8,8 +8,9 @@ import lombok.Data; |
| 8 | 8 | import org.hibernate.validator.constraints.URL; |
| 9 | 9 | |
| 10 | 10 | import javax.validation.Validator; |
| 11 | -import javax.validation.constraints.Min; | |
| 12 | 11 | import javax.validation.constraints.NotBlank; |
| 12 | +import javax.validation.constraints.NotNull; | |
| 13 | +import javax.validation.constraints.PositiveOrZero; | |
| 13 | 14 | |
| 14 | 15 | @Schema(description = "用户 App - 分销提现创建 Request VO") |
| 15 | 16 | @Data |
| ... | ... | @@ -20,7 +21,8 @@ public class AppBrokerageWithdrawCreateReqVO { |
| 20 | 21 | private Integer type; |
| 21 | 22 | |
| 22 | 23 | @Schema(description = "提现金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") |
| 23 | - @Min(value = 1, message = "提现金额不能小于 1") | |
| 24 | + @PositiveOrZero(message = "提现金额不能小于 0") | |
| 25 | + @NotNull(message = "提现金额不能为空") | |
| 24 | 26 | private Integer price; |
| 25 | 27 | |
| 26 | 28 | // ========== 银行卡、微信、支付宝 提现相关字段 ========== |
| ... | ... | @@ -41,7 +43,7 @@ public class AppBrokerageWithdrawCreateReqVO { |
| 41 | 43 | @NotBlank(message = "持卡人姓名不能为空", groups = {Bank.class}) |
| 42 | 44 | private String name; |
| 43 | 45 | @Schema(description = "提现银行", example = "1") |
| 44 | - @NotBlank(message = "提现银行不能为空", groups = {Bank.class}) | |
| 46 | + @NotNull(message = "提现银行不能为空", groups = {Bank.class}) | |
| 45 | 47 | private Integer bankName; |
| 46 | 48 | @Schema(description = "开户地址", example = "海淀支行") |
| 47 | 49 | private String bankAddress; | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/withdraw/AppBrokerageWithdrawPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; | |
| 6 | +import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawTypeEnum; | |
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 8 | +import lombok.Data; | |
| 9 | + | |
| 10 | +@Schema(description = "应用 App - 分销提现分页 Request VO") | |
| 11 | +@Data | |
| 12 | +public class AppBrokerageWithdrawPageReqVO extends PageParam { | |
| 13 | + | |
| 14 | + @Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 15 | + @InEnum(value = BrokerageWithdrawTypeEnum.class, message = "类型必须是 {value}") | |
| 16 | + private Integer type; | |
| 17 | + | |
| 18 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 19 | + @InEnum(value = BrokerageWithdrawStatusEnum.class, message = "状态必须是 {value}") | |
| 20 | + private Integer status; | |
| 21 | + | |
| 22 | +} | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/AppTradeConfigController.java
| 1 | 1 | package cn.iocoder.yudao.module.trade.controller.app.config; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.util.ObjUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 5 | import cn.iocoder.yudao.module.trade.controller.app.config.vo.AppTradeConfigRespVO; |
| 6 | +import cn.iocoder.yudao.module.trade.convert.config.TradeConfigConvert; | |
| 7 | +import cn.iocoder.yudao.module.trade.dal.dataobject.config.TradeConfigDO; | |
| 8 | +import cn.iocoder.yudao.module.trade.service.config.TradeConfigService; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 5 | 10 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 6 | 11 | import lombok.RequiredArgsConstructor; |
| 7 | 12 | import lombok.extern.slf4j.Slf4j; |
| ... | ... | @@ -10,8 +15,9 @@ import org.springframework.web.bind.annotation.GetMapping; |
| 10 | 15 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | 16 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 17 | |
| 18 | +import javax.annotation.Resource; | |
| 19 | + | |
| 13 | 20 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 14 | -import static java.util.Arrays.asList; | |
| 15 | 21 | |
| 16 | 22 | @Tag(name = "用户 App - 交易配置") |
| 17 | 23 | @RestController |
| ... | ... | @@ -21,17 +27,14 @@ import static java.util.Arrays.asList; |
| 21 | 27 | @Slf4j |
| 22 | 28 | public class AppTradeConfigController { |
| 23 | 29 | |
| 30 | + @Resource | |
| 31 | + private TradeConfigService tradeConfigService; | |
| 32 | + | |
| 24 | 33 | @GetMapping("/get") |
| 34 | + @Operation(summary = "获得交易配置") | |
| 25 | 35 | public CommonResult<AppTradeConfigRespVO> getTradeConfig() { |
| 26 | - AppTradeConfigRespVO respVO = new AppTradeConfigRespVO(); | |
| 27 | - respVO.setBrokeragePosterUrls(asList( | |
| 28 | - "https://api.java.crmeb.net/crmebimage/product/2020/08/03/755bf516b1ca4b6db3bfeaa4dd5901cdh71kob20re.jpg", | |
| 29 | - "https://api.java.crmeb.net/crmebimage/maintain/2021/03/01/406d729b84ed4ec9a2171bfcf6fd0634ughzbz9kfi.jpg", | |
| 30 | - "https://api.java.crmeb.net/crmebimage/maintain/2021/03/01/efb1e4e7fe604fe1988b4213ce08cb11tdsyijtd2r.jpg" | |
| 31 | - )); | |
| 32 | - respVO.setBrokerageFrozenDays(10); | |
| 33 | - respVO.setBrokerageWithdrawMinPrice(100); | |
| 34 | - return success(respVO); | |
| 36 | + TradeConfigDO tradeConfig = ObjUtil.defaultIfNull(tradeConfigService.getTradeConfig(), new TradeConfigDO()); | |
| 37 | + return success(TradeConfigConvert.INSTANCE.convert02(tradeConfig)); | |
| 35 | 38 | } |
| 36 | 39 | |
| 37 | 40 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/vo/AppTradeConfigRespVO.java
| ... | ... | @@ -18,4 +18,7 @@ public class AppTradeConfigRespVO { |
| 18 | 18 | @Schema(description = "佣金提现最小金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| 19 | 19 | private Integer brokerageWithdrawMinPrice; |
| 20 | 20 | |
| 21 | + @Schema(description = "提现方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1, 2]") | |
| 22 | + private List<Integer> brokerageWithdrawTypes; | |
| 23 | + | |
| 21 | 24 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverConfigController.java
| ... | ... | @@ -17,6 +17,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 17 | 17 | @Validated |
| 18 | 18 | public class AppDeliverConfigController { |
| 19 | 19 | |
| 20 | + // TODO @芋艿:这里后面干掉,合并到 AppTradeConfigController 中 | |
| 20 | 21 | @GetMapping("/get") |
| 21 | 22 | @Operation(summary = "获得配送配置") |
| 22 | 23 | public CommonResult<AppDeliveryConfigRespVO> getDeliveryConfig() { | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java
| ... | ... | @@ -156,7 +156,7 @@ public class AppTradeOrderController { |
| 156 | 156 | @Operation(summary = "删除交易订单") |
| 157 | 157 | @Parameter(name = "id", description = "交易订单编号") |
| 158 | 158 | public CommonResult<Boolean> deleteOrder(@RequestParam("id") Long id) { |
| 159 | - // TODO @芋艿:未实现,mock 用 | |
| 159 | + tradeOrderUpdateService.deleteOrder(getLoginUserId(), id); | |
| 160 | 160 | return success(true); |
| 161 | 161 | } |
| 162 | 162 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementRespVO.java
| ... | ... | @@ -82,6 +82,9 @@ public class AppTradeOrderSettlementRespVO { |
| 82 | 82 | @Schema(description = "积分抵扣的金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "50") |
| 83 | 83 | private Integer pointPrice; |
| 84 | 84 | |
| 85 | + @Schema(description = "VIP 减免金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "30") | |
| 86 | + private Integer vipPrice; | |
| 87 | + | |
| 85 | 88 | @Schema(description = "实际支付金额(总),单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "450") |
| 86 | 89 | private Integer payPrice; |
| 87 | 90 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/TradeAfterSaleConvert.java
| ... | ... | @@ -16,7 +16,6 @@ import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO; |
| 16 | 16 | import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleLogDO; |
| 17 | 17 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; |
| 18 | 18 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; |
| 19 | -import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO; | |
| 20 | 19 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; |
| 21 | 20 | import org.mapstruct.Mapper; |
| 22 | 21 | import org.mapstruct.Mapping; |
| ... | ... | @@ -68,10 +67,10 @@ public interface TradeAfterSaleConvert { |
| 68 | 67 | |
| 69 | 68 | PageResult<AppTradeAfterSaleRespVO> convertPage02(PageResult<TradeAfterSaleDO> page); |
| 70 | 69 | |
| 71 | - List<TradeAfterSaleLogRespDTO> convertList(List<TradeAfterSaleLogDO> list); | |
| 72 | - | |
| 70 | + List<TradeAfterSaleLogRespVO> convertList(List<TradeAfterSaleLogDO> list); | |
| 71 | + | |
| 73 | 72 | default TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, TradeOrderDO order, List<TradeOrderItemDO> orderItems, |
| 74 | - MemberUserRespDTO user, List<TradeAfterSaleLogRespDTO> logs) { | |
| 73 | + MemberUserRespDTO user, List<TradeAfterSaleLogRespVO> logs) { | |
| 75 | 74 | TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems); |
| 76 | 75 | // 处理用户信息 |
| 77 | 76 | respVO.setUser(convert(user)); |
| ... | ... | @@ -81,7 +80,8 @@ public interface TradeAfterSaleConvert { |
| 81 | 80 | respVO.setLogs(convertList1(logs)); |
| 82 | 81 | return respVO; |
| 83 | 82 | } |
| 84 | - List<TradeAfterSaleLogRespVO> convertList1(List<TradeAfterSaleLogRespDTO> list); | |
| 83 | + | |
| 84 | + List<TradeAfterSaleLogRespVO> convertList1(List<TradeAfterSaleLogRespVO> list); | |
| 85 | 85 | @Mapping(target = "id", source = "afterSale.id") |
| 86 | 86 | TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List<TradeOrderItemDO> orderItems); |
| 87 | 87 | TradeOrderBaseVO convert(TradeOrderDO order); | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/record/BrokerageRecordConvert.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/BrokerageRecordConvert.java
| 1 | -package cn.iocoder.yudao.module.trade.convert.brokerage.record; | |
| 1 | +package cn.iocoder.yudao.module.trade.convert.brokerage; | |
| 2 | 2 | |
| 3 | +import cn.hutool.core.math.Money; | |
| 3 | 4 | import cn.hutool.core.util.ObjectUtil; |
| 4 | 5 | import cn.hutool.core.util.StrUtil; |
| 5 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | +import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; | |
| 6 | 8 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 7 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.record.vo.BrokerageRecordRespVO; | |
| 8 | -import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.record.BrokerageRecordDO; | |
| 9 | -import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.user.BrokerageUserDO; | |
| 9 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.record.BrokerageRecordPageReqVO; | |
| 10 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.record.BrokerageRecordRespVO; | |
| 11 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.record.AppBrokerageRecordPageReqVO; | |
| 12 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.record.AppBrokerageRecordRespVO; | |
| 13 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByPriceRespVO; | |
| 14 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO; | |
| 15 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO; | |
| 10 | 16 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; |
| 11 | 17 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum; |
| 12 | 18 | import org.mapstruct.Mapper; |
| 19 | +import org.mapstruct.MappingTarget; | |
| 13 | 20 | import org.mapstruct.factory.Mappers; |
| 14 | 21 | |
| 15 | 22 | import java.time.LocalDateTime; |
| ... | ... | @@ -45,7 +52,7 @@ public interface BrokerageRecordConvert { |
| 45 | 52 | .setBizType(bizType.getType()).setBizId(bizId) |
| 46 | 53 | .setPrice(brokeragePrice).setTotalPrice(user.getBrokeragePrice()) |
| 47 | 54 | .setTitle(title) |
| 48 | - .setDescription(StrUtil.format(bizType.getDescription(), String.format("¥%.2f", brokeragePrice / 100d))) | |
| 55 | + .setDescription(StrUtil.format(bizType.getDescription(), MoneyUtils.fenToYuanStr(Math.abs(brokeragePrice)))) | |
| 49 | 56 | .setStatus(status).setFrozenDays(brokerageFrozenDays).setUnfreezeTime(unfreezeTime) |
| 50 | 57 | .setSourceUserLevel(sourceUserLevel).setSourceUserId(sourceUserId); |
| 51 | 58 | } |
| ... | ... | @@ -60,4 +67,17 @@ public interface BrokerageRecordConvert { |
| 60 | 67 | } |
| 61 | 68 | return result; |
| 62 | 69 | } |
| 70 | + | |
| 71 | + BrokerageRecordPageReqVO convert(AppBrokerageRecordPageReqVO pageReqVO, Long userId); | |
| 72 | + | |
| 73 | + PageResult<AppBrokerageRecordRespVO> convertPage02(PageResult<BrokerageRecordDO> pageResult); | |
| 74 | + | |
| 75 | + default PageResult<AppBrokerageUserRankByPriceRespVO> convertPage03(PageResult<AppBrokerageUserRankByPriceRespVO> pageResult, Map<Long, MemberUserRespDTO> userMap) { | |
| 76 | + for (AppBrokerageUserRankByPriceRespVO vo : pageResult.getList()) { | |
| 77 | + copyTo(userMap.get(vo.getId()), vo); | |
| 78 | + } | |
| 79 | + return pageResult; | |
| 80 | + } | |
| 81 | + | |
| 82 | + void copyTo(MemberUserRespDTO from, @MappingTarget AppBrokerageUserRankByPriceRespVO to); | |
| 63 | 83 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/user/BrokerageUserConvert.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/BrokerageUserConvert.java
| 1 | -package cn.iocoder.yudao.module.trade.convert.brokerage.user; | |
| 1 | +package cn.iocoder.yudao.module.trade.convert.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.map.MapUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 6 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.user.vo.BrokerageUserRespVO; | |
| 7 | -import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.user.BrokerageUserDO; | |
| 6 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.BrokerageUserRespVO; | |
| 7 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO; | |
| 8 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO; | |
| 8 | 9 | import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO; |
| 10 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO; | |
| 9 | 11 | import org.mapstruct.Mapper; |
| 12 | +import org.mapstruct.MappingTarget; | |
| 10 | 13 | import org.mapstruct.factory.Mappers; |
| 11 | 14 | |
| 12 | 15 | import java.util.List; |
| ... | ... | @@ -27,13 +30,14 @@ public interface BrokerageUserConvert { |
| 27 | 30 | |
| 28 | 31 | List<BrokerageUserRespVO> convertList(List<BrokerageUserDO> list); |
| 29 | 32 | |
| 30 | - PageResult<BrokerageUserRespVO> convertPage(PageResult<BrokerageUserDO> page); | |
| 33 | + PageResult<BrokerageUserRespVO> convertPage(PageResult<BrokerageUserDO> page, Map<Long, MemberUserRespDTO> userMap, Map<Long, Long> brokerageUserCountMap, Map<Long, UserBrokerageSummaryBO> userOrderSummaryMap); | |
| 31 | 34 | |
| 32 | 35 | default PageResult<BrokerageUserRespVO> convertPage(PageResult<BrokerageUserDO> pageResult, |
| 33 | 36 | Map<Long, MemberUserRespDTO> userMap, |
| 34 | 37 | Map<Long, Long> brokerageUserCountMap, |
| 35 | - Map<Long, UserBrokerageSummaryBO> userOrderSummaryMap) { | |
| 36 | - PageResult<BrokerageUserRespVO> result = convertPage(pageResult); | |
| 38 | + Map<Long, UserBrokerageSummaryBO> userOrderSummaryMap, | |
| 39 | + Map<Long, UserWithdrawSummaryBO> withdrawMap) { | |
| 40 | + PageResult<BrokerageUserRespVO> result = convertPage(pageResult, userMap, brokerageUserCountMap, userOrderSummaryMap); | |
| 37 | 41 | for (BrokerageUserRespVO userVO : result.getList()) { |
| 38 | 42 | // 用户信息 |
| 39 | 43 | copyTo(userMap.get(userVO.getId()), userVO); |
| ... | ... | @@ -44,7 +48,10 @@ public interface BrokerageUserConvert { |
| 44 | 48 | Optional<UserBrokerageSummaryBO> orderSummaryOptional = Optional.ofNullable(userOrderSummaryMap.get(userVO.getId())); |
| 45 | 49 | userVO.setBrokerageOrderCount(orderSummaryOptional.map(UserBrokerageSummaryBO::getCount).orElse(0)) |
| 46 | 50 | .setBrokerageOrderPrice(orderSummaryOptional.map(UserBrokerageSummaryBO::getPrice).orElse(0)); |
| 47 | - // todo 已提现次数、已提现金额 | |
| 51 | + // 已提现次数、已提现金额 | |
| 52 | + Optional<UserWithdrawSummaryBO> withdrawSummaryOptional = Optional.ofNullable(withdrawMap.get(userVO.getId())); | |
| 53 | + userVO.setWithdrawCount(withdrawSummaryOptional.map(UserWithdrawSummaryBO::getCount).orElse(0)) | |
| 54 | + .setWithdrawPrice(withdrawSummaryOptional.map(UserWithdrawSummaryBO::getPrice).orElse(0)); | |
| 48 | 55 | userVO.setWithdrawCount(0).setWithdrawPrice(0); |
| 49 | 56 | } |
| 50 | 57 | return result; |
| ... | ... | @@ -55,4 +62,13 @@ public interface BrokerageUserConvert { |
| 55 | 62 | user -> target.setNickname(user.getNickname()).setAvatar(user.getAvatar())); |
| 56 | 63 | return target; |
| 57 | 64 | } |
| 65 | + | |
| 66 | + default PageResult<AppBrokerageUserRankByUserCountRespVO> convertPage03(PageResult<AppBrokerageUserRankByUserCountRespVO> pageResult, | |
| 67 | + Map<Long, MemberUserRespDTO> userMap) { | |
| 68 | + pageResult.getList().forEach(vo -> copyTo(userMap.get(vo.getId()), vo)); | |
| 69 | + return pageResult; | |
| 70 | + } | |
| 71 | + | |
| 72 | + void copyTo(MemberUserRespDTO from, @MappingTarget AppBrokerageUserRankByUserCountRespVO to); | |
| 73 | + | |
| 58 | 74 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/withdraw/BrokerageWithdrawConvert.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/BrokerageWithdrawConvert.java
| 1 | -package cn.iocoder.yudao.module.trade.convert.brokerage.withdraw; | |
| 1 | +package cn.iocoder.yudao.module.trade.convert.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | +import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils; | |
| 4 | 5 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 5 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawRejectReqVO; | |
| 6 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawRespVO; | |
| 7 | -import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.withdraw.BrokerageWithdrawDO; | |
| 6 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawRespVO; | |
| 8 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawCreateReqVO; | |
| 9 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawPageReqVO; | |
| 10 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawRespVO; | |
| 11 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO; | |
| 12 | +import cn.iocoder.yudao.module.trade.enums.DictTypeConstants; | |
| 8 | 13 | import org.mapstruct.Mapper; |
| 9 | 14 | import org.mapstruct.factory.Mappers; |
| 10 | 15 | |
| ... | ... | @@ -22,7 +27,7 @@ public interface BrokerageWithdrawConvert { |
| 22 | 27 | |
| 23 | 28 | BrokerageWithdrawConvert INSTANCE = Mappers.getMapper(BrokerageWithdrawConvert.class); |
| 24 | 29 | |
| 25 | - BrokerageWithdrawDO convert(BrokerageWithdrawRejectReqVO bean); | |
| 30 | + BrokerageWithdrawDO convert(AppBrokerageWithdrawCreateReqVO createReqVO, Long userId, Integer feePrice); | |
| 26 | 31 | |
| 27 | 32 | BrokerageWithdrawRespVO convert(BrokerageWithdrawDO bean); |
| 28 | 33 | |
| ... | ... | @@ -38,4 +43,15 @@ public interface BrokerageWithdrawConvert { |
| 38 | 43 | return result; |
| 39 | 44 | } |
| 40 | 45 | |
| 46 | + PageResult<AppBrokerageWithdrawRespVO> convertPage02(PageResult<BrokerageWithdrawDO> pageResult); | |
| 47 | + | |
| 48 | + default PageResult<AppBrokerageWithdrawRespVO> convertPage03(PageResult<BrokerageWithdrawDO> pageResult) { | |
| 49 | + PageResult<AppBrokerageWithdrawRespVO> result = convertPage02(pageResult); | |
| 50 | + for (AppBrokerageWithdrawRespVO vo : result.getList()) { | |
| 51 | + vo.setStatusName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.BROKERAGE_WITHDRAW_STATUS, vo.getStatus())); | |
| 52 | + } | |
| 53 | + return result; | |
| 54 | + } | |
| 55 | + | |
| 56 | + BrokerageWithdrawPageReqVO convert(AppBrokerageWithdrawPageReqVO pageReqVO, Long userId); | |
| 41 | 57 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/config/TradeConfigConvert.java
| ... | ... | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.convert.config; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.module.trade.controller.admin.config.vo.TradeConfigRespVO; |
| 4 | 4 | import cn.iocoder.yudao.module.trade.controller.admin.config.vo.TradeConfigSaveReqVO; |
| 5 | +import cn.iocoder.yudao.module.trade.controller.app.config.vo.AppTradeConfigRespVO; | |
| 5 | 6 | import cn.iocoder.yudao.module.trade.dal.dataobject.config.TradeConfigDO; |
| 6 | 7 | import org.mapstruct.Mapper; |
| 7 | 8 | import org.mapstruct.factory.Mappers; |
| ... | ... | @@ -20,4 +21,5 @@ public interface TradeConfigConvert { |
| 20 | 21 | |
| 21 | 22 | TradeConfigRespVO convert(TradeConfigDO bean); |
| 22 | 23 | |
| 24 | + AppTradeConfigRespVO convert02(TradeConfigDO tradeConfig); | |
| 23 | 25 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.trade.convert.order; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.util.BooleanUtil; | |
| 3 | 4 | import cn.hutool.core.util.StrUtil; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| ... | ... | @@ -14,6 +15,7 @@ import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDT |
| 14 | 15 | import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO; |
| 15 | 16 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO; |
| 16 | 17 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; |
| 18 | +import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | |
| 17 | 19 | import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; |
| 18 | 20 | import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; |
| 19 | 21 | import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO; |
| ... | ... | @@ -65,6 +67,7 @@ public interface TradeOrderConvert { |
| 65 | 67 | @Mapping(source = "calculateRespBO.price.deliveryPrice", target = "deliveryPrice"), |
| 66 | 68 | @Mapping(source = "calculateRespBO.price.couponPrice", target = "couponPrice"), |
| 67 | 69 | @Mapping(source = "calculateRespBO.price.pointPrice", target = "pointPrice"), |
| 70 | + @Mapping(source = "calculateRespBO.price.vipPrice", target = "vipPrice"), | |
| 68 | 71 | @Mapping(source = "calculateRespBO.price.payPrice", target = "payPrice") |
| 69 | 72 | }) |
| 70 | 73 | TradeOrderDO convert(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO, |
| ... | ... | @@ -265,11 +268,16 @@ public interface TradeOrderConvert { |
| 265 | 268 | |
| 266 | 269 | TradeOrderDO convert(TradeOrderRemarkReqVO reqVO); |
| 267 | 270 | |
| 268 | - default BrokerageAddReqBO convert(MemberUserRespDTO user, TradeOrderItemDO item, ProductSkuRespDTO sku) { | |
| 269 | - return new BrokerageAddReqBO().setBizId(String.valueOf(item.getId())).setSourceUserId(item.getUserId()) | |
| 271 | + default BrokerageAddReqBO convert(MemberUserRespDTO user, TradeOrderItemDO item, | |
| 272 | + ProductSpuRespDTO spu, ProductSkuRespDTO sku) { | |
| 273 | + BrokerageAddReqBO bo = new BrokerageAddReqBO().setBizId(String.valueOf(item.getId())).setSourceUserId(item.getUserId()) | |
| 270 | 274 | .setBasePrice(item.getPayPrice() * item.getCount()) |
| 271 | 275 | .setTitle(StrUtil.format("{}成功购买{}", user.getNickname(), item.getSpuName())) |
| 272 | - .setFirstFixedPrice(sku.getFirstBrokeragePrice()).setSecondFixedPrice(sku.getSecondBrokeragePrice()); | |
| 276 | + .setFirstFixedPrice(0).setSecondFixedPrice(0); | |
| 277 | + if (BooleanUtil.isTrue(spu.getSubCommissionType())) { | |
| 278 | + bo.setFirstFixedPrice(sku.getFirstBrokeragePrice()).setSecondFixedPrice(sku.getSecondBrokeragePrice()); | |
| 279 | + } | |
| 280 | + return bo; | |
| 273 | 281 | } |
| 274 | 282 | |
| 275 | 283 | TradeBeforeOrderCreateReqBO convert(AppTradeOrderCreateReqVO createReqVO); | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/record/BrokerageRecordDO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageRecordDO.java
| 1 | -package cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.record; | |
| 1 | +package cn.iocoder.yudao.module.trade.dal.dataobject.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 4 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum; | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/user/BrokerageUserDO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageUserDO.java
| 1 | -package cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.user; | |
| 1 | +package cn.iocoder.yudao.module.trade.dal.dataobject.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 4 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| ... | ... | @@ -59,13 +59,4 @@ public class BrokerageUserDO extends BaseDO { |
| 59 | 59 | * 冻结佣金 |
| 60 | 60 | */ |
| 61 | 61 | private Integer frozenPrice; |
| 62 | - | |
| 63 | - /** | |
| 64 | - * 等级 | |
| 65 | - */ | |
| 66 | - private Integer level; | |
| 67 | - /** | |
| 68 | - * 路径 | |
| 69 | - */ | |
| 70 | - private String path; | |
| 71 | 62 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/withdraw/BrokerageWithdrawDO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageWithdrawDO.java
| 1 | -package cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.withdraw; | |
| 1 | +package cn.iocoder.yudao.module.trade.dal.dataobject.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 4 | import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum; |
| ... | ... | @@ -29,7 +29,7 @@ public class BrokerageWithdrawDO extends BaseDO { |
| 29 | 29 | * 编号 |
| 30 | 30 | */ |
| 31 | 31 | @TableId |
| 32 | - private Integer id; | |
| 32 | + private Long id; | |
| 33 | 33 | /** |
| 34 | 34 | * 用户编号 |
| 35 | 35 | * | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/config/TradeConfigDO.java
| ... | ... | @@ -36,7 +36,7 @@ public class TradeConfigDO extends BaseDO { |
| 36 | 36 | private Long id; |
| 37 | 37 | |
| 38 | 38 | // ========== 配送相关 ========== |
| 39 | - // TODO 芋艿:未配置 | |
| 39 | + | |
| 40 | 40 | /** |
| 41 | 41 | * 是否启用全场包邮 |
| 42 | 42 | */ |
| ... | ... | @@ -68,7 +68,7 @@ public class TradeConfigDO extends BaseDO { |
| 68 | 68 | * 分销海报图地址数组 |
| 69 | 69 | */ |
| 70 | 70 | @TableField(typeHandler = JacksonTypeHandler.class) |
| 71 | - private List<String> brokeragePostUrls; | |
| 71 | + private List<String> brokeragePosterUrls; | |
| 72 | 72 | /** |
| 73 | 73 | * 一级返佣比例 |
| 74 | 74 | */ |
| ... | ... | @@ -82,6 +82,10 @@ public class TradeConfigDO extends BaseDO { |
| 82 | 82 | */ |
| 83 | 83 | private Integer brokerageWithdrawMinPrice; |
| 84 | 84 | /** |
| 85 | + * 用户提现手续费百分比 | |
| 86 | + */ | |
| 87 | + private Integer brokerageWithdrawFeePercent; | |
| 88 | + /** | |
| 85 | 89 | * 提现银行 |
| 86 | 90 | */ |
| 87 | 91 | @TableField(typeHandler = IntegerListTypeHandler.class) |
| ... | ... | @@ -96,6 +100,6 @@ public class TradeConfigDO extends BaseDO { |
| 96 | 100 | * 枚举 {@link BrokerageWithdrawTypeEnum 对应的类} |
| 97 | 101 | */ |
| 98 | 102 | @TableField(typeHandler = IntegerListTypeHandler.class) |
| 99 | - private List<Integer> brokerageWithdrawType; | |
| 103 | + private List<Integer> brokerageWithdrawTypes; | |
| 100 | 104 | |
| 101 | 105 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java
| ... | ... | @@ -168,6 +168,7 @@ public class TradeOrderDO extends BaseDO { |
| 168 | 168 | * - {@link #discountPrice} |
| 169 | 169 | * + {@link #deliveryPrice} |
| 170 | 170 | * + {@link #adjustPrice} |
| 171 | + * - {@link #vipPrice} | |
| 171 | 172 | */ |
| 172 | 173 | private Integer payPrice; |
| 173 | 174 | |
| ... | ... | @@ -265,9 +266,17 @@ public class TradeOrderDO extends BaseDO { |
| 265 | 266 | * 对应 taobao 的 trade.point_fee 字段 |
| 266 | 267 | */ |
| 267 | 268 | private Integer pointPrice; |
| 268 | -// /** | |
| 269 | -// * 奖励的积分 TODO 疯狂:可以使用这个字段哈; | |
| 270 | -// */ | |
| 271 | -// private Integer rewardPoint; | |
| 269 | + /** | |
| 270 | + * 赠送的积分 | |
| 271 | + */ | |
| 272 | + private Integer givePoint; | |
| 273 | + /** | |
| 274 | + * 退还的使用的积分 | |
| 275 | + */ | |
| 276 | + private Integer refundPoint; | |
| 277 | + /** | |
| 278 | + * VIP 减免金额,单位:分 | |
| 279 | + */ | |
| 280 | + private Integer vipPrice; | |
| 272 | 281 | |
| 273 | 282 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java
| ... | ... | @@ -126,6 +126,7 @@ public class TradeOrderItemDO extends BaseDO { |
| 126 | 126 | * - {@link #discountPrice} |
| 127 | 127 | * + {@link #deliveryPrice} |
| 128 | 128 | * + {@link #adjustPrice} |
| 129 | + * - {@link #vipPrice} | |
| 129 | 130 | */ |
| 130 | 131 | private Integer payPrice; |
| 131 | 132 | |
| ... | ... | @@ -143,6 +144,18 @@ public class TradeOrderItemDO extends BaseDO { |
| 143 | 144 | * 对应 taobao 的 trade.point_fee 字段 |
| 144 | 145 | */ |
| 145 | 146 | private Integer pointPrice; |
| 147 | + /** | |
| 148 | + * 使用的积分 | |
| 149 | + */ | |
| 150 | + private Integer usePoint; | |
| 151 | + /** | |
| 152 | + * 赠送的积分 | |
| 153 | + */ | |
| 154 | + private Integer givePoint; | |
| 155 | + /** | |
| 156 | + * VIP 减免金额,单位:分 | |
| 157 | + */ | |
| 158 | + private Integer vipPrice; | |
| 146 | 159 | // TODO @芋艿:如果商品 vip 折扣时,到底是新增一个 vipPrice 记录优惠记录,还是 vipDiscountPrice,记录 vip 的优惠;还是直接使用 vipPrice; |
| 147 | 160 | // 目前 crmeb 的选择,单独一个 vipPrice 记录优惠价格;感觉不一定合理,可以在看看有赞的; |
| 148 | 161 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/record/BrokerageRecordMapper.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageRecordMapper.java
| 1 | -package cn.iocoder.yudao.module.trade.dal.mysql.brokerage.record; | |
| 1 | +package cn.iocoder.yudao.module.trade.dal.mysql.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.record.vo.BrokerageRecordPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.record.BrokerageRecordDO; | |
| 6 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.record.BrokerageRecordPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByPriceRespVO; | |
| 8 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO; | |
| 8 | 9 | import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO; |
| 9 | 10 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 11 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
| 10 | 12 | import org.apache.ibatis.annotations.Mapper; |
| 11 | 13 | import org.apache.ibatis.annotations.Param; |
| 12 | 14 | import org.apache.ibatis.annotations.Select; |
| ... | ... | @@ -23,7 +25,6 @@ import java.util.List; |
| 23 | 25 | public interface BrokerageRecordMapper extends BaseMapperX<BrokerageRecordDO> { |
| 24 | 26 | |
| 25 | 27 | default PageResult<BrokerageRecordDO> selectPage(BrokerageRecordPageReqVO reqVO) { |
| 26 | - // 分页查询 | |
| 27 | 28 | return selectPage(reqVO, new LambdaQueryWrapperX<BrokerageRecordDO>() |
| 28 | 29 | .eqIfPresent(BrokerageRecordDO::getUserId, reqVO.getUserId()) |
| 29 | 30 | .eqIfPresent(BrokerageRecordDO::getBizType, reqVO.getBizType()) |
| ... | ... | @@ -52,9 +53,28 @@ public interface BrokerageRecordMapper extends BaseMapperX<BrokerageRecordDO> { |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | @Select("SELECT COUNT(1), SUM(price) FROM trade_brokerage_record " + |
| 55 | - "WHERE user_id = #{userId} AND biz_type = #{bizType} AND status = #{status}") | |
| 56 | + "WHERE user_id = #{userId} AND biz_type = #{bizType} AND status = #{status} AND deleted = FALSE") | |
| 56 | 57 | UserBrokerageSummaryBO selectCountAndSumPriceByUserIdAndBizTypeAndStatus(@Param("userId") Long userId, |
| 57 | 58 | @Param("bizType") Integer bizType, |
| 58 | 59 | @Param("status") Integer status); |
| 59 | 60 | |
| 61 | + @Select("SELECT SUM(price) FROM trade_brokerage_record " + | |
| 62 | + "WHERE user_id = #{userId} AND biz_type = #{bizType} " + | |
| 63 | + "AND create_time BETWEEN #{beginTime} AND #{endTime} AND deleted = FALSE") | |
| 64 | + Integer selectSummaryPriceByUserIdAndBizTypeAndCreateTimeBetween(@Param("userId") Long userId, | |
| 65 | + @Param("bizType") Integer bizType, | |
| 66 | + @Param("beginTime") LocalDateTime beginTime, | |
| 67 | + @Param("endTime") LocalDateTime endTime); | |
| 68 | + | |
| 69 | + @Select("SELECT user_id AS id, SUM(price) AS brokeragePrice FROM trade_brokerage_record " + | |
| 70 | + "WHERE biz_type = #{bizType} AND status = #{status} AND deleted = FALSE " + | |
| 71 | + "AND unfreeze_time BETWEEN #{beginTime} AND #{endTime} " + | |
| 72 | + "GROUP BY user_id " + | |
| 73 | + "ORDER BY brokeragePrice DESC") | |
| 74 | + IPage<AppBrokerageUserRankByPriceRespVO> selectSummaryPricePageGroupByUserId(IPage<?> page, | |
| 75 | + @Param("bizType") Integer bizType, | |
| 76 | + @Param("status") Integer status, | |
| 77 | + @Param("beginTime") LocalDateTime beginTime, | |
| 78 | + @Param("endTime") LocalDateTime endTime); | |
| 79 | + | |
| 60 | 80 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/user/BrokerageUserMapper.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageUserMapper.java
| 1 | -package cn.iocoder.yudao.module.trade.dal.mysql.brokerage.user; | |
| 1 | +package cn.iocoder.yudao.module.trade.dal.mysql.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.lang.Assert; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.user.vo.BrokerageUserPageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.user.BrokerageUserDO; | |
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.BrokerageUserPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryPageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryRespVO; | |
| 10 | +import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO; | |
| 11 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO; | |
| 9 | 12 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 13 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
| 14 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 10 | 15 | import org.apache.ibatis.annotations.Mapper; |
| 16 | +import org.apache.ibatis.annotations.Param; | |
| 17 | +import org.apache.ibatis.annotations.Select; | |
| 11 | 18 | |
| 19 | +import java.time.LocalDateTime; | |
| 12 | 20 | import java.util.List; |
| 13 | 21 | |
| 14 | 22 | /** |
| ... | ... | @@ -19,13 +27,12 @@ import java.util.List; |
| 19 | 27 | @Mapper |
| 20 | 28 | public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> { |
| 21 | 29 | |
| 22 | - default PageResult<BrokerageUserDO> selectPage(BrokerageUserPageReqVO reqVO, List<Integer> levels) { | |
| 30 | + default PageResult<BrokerageUserDO> selectPage(BrokerageUserPageReqVO reqVO, List<Long> bindUserIds) { | |
| 23 | 31 | return selectPage(reqVO, new LambdaQueryWrapperX<BrokerageUserDO>() |
| 24 | 32 | .eqIfPresent(BrokerageUserDO::getBrokerageEnabled, reqVO.getBrokerageEnabled()) |
| 25 | 33 | .betweenIfPresent(BrokerageUserDO::getCreateTime, reqVO.getCreateTime()) |
| 26 | 34 | .betweenIfPresent(BrokerageUserDO::getBindUserTime, reqVO.getBindUserTime()) |
| 27 | - .findInSetIfPresent(BrokerageUserDO::getPath, reqVO.getBindUserId()) | |
| 28 | - .inIfPresent(BrokerageUserDO::getLevel, levels) | |
| 35 | + .inIfPresent(BrokerageUserDO::getBindUserId, bindUserIds) | |
| 29 | 36 | .orderByDesc(BrokerageUserDO::getId)); |
| 30 | 37 | } |
| 31 | 38 | |
| ... | ... | @@ -38,7 +45,7 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> { |
| 38 | 45 | default void updatePriceIncr(Long id, Integer incrCount) { |
| 39 | 46 | Assert.isTrue(incrCount > 0); |
| 40 | 47 | LambdaUpdateWrapper<BrokerageUserDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<BrokerageUserDO>() |
| 41 | - .setSql(" price = price + " + incrCount) | |
| 48 | + .setSql(" brokerage_price = brokerage_price + " + incrCount) | |
| 42 | 49 | .eq(BrokerageUserDO::getId, id); |
| 43 | 50 | update(null, lambdaUpdateWrapper); |
| 44 | 51 | } |
| ... | ... | @@ -49,13 +56,14 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> { |
| 49 | 56 | * |
| 50 | 57 | * @param id 用户编号 |
| 51 | 58 | * @param incrCount 增加佣金(负数) |
| 59 | + * @return 更新行数 | |
| 52 | 60 | */ |
| 53 | - default void updatePriceDecr(Long id, Integer incrCount) { | |
| 61 | + default int updatePriceDecr(Long id, Integer incrCount) { | |
| 54 | 62 | Assert.isTrue(incrCount < 0); |
| 55 | 63 | LambdaUpdateWrapper<BrokerageUserDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<BrokerageUserDO>() |
| 56 | - .setSql(" price = price + " + incrCount) // 负数,所以使用 + 号 | |
| 64 | + .setSql(" brokerage_price = brokerage_price + " + incrCount) // 负数,所以使用 + 号 | |
| 57 | 65 | .eq(BrokerageUserDO::getId, id); |
| 58 | - update(null, lambdaUpdateWrapper); | |
| 66 | + return update(null, lambdaUpdateWrapper); | |
| 59 | 67 | } |
| 60 | 68 | |
| 61 | 69 | /** |
| ... | ... | @@ -98,7 +106,7 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> { |
| 98 | 106 | Assert.isTrue(incrCount < 0); |
| 99 | 107 | LambdaUpdateWrapper<BrokerageUserDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<BrokerageUserDO>() |
| 100 | 108 | .setSql(" frozen_price = frozen_price + " + incrCount + // 负数,所以使用 + 号 |
| 101 | - ", price = price + " + -incrCount) // 负数,所以使用 - 号 | |
| 109 | + ", brokerage_price = brokerage_price + " + -incrCount) // 负数,所以使用 - 号 | |
| 102 | 110 | .eq(BrokerageUserDO::getId, id) |
| 103 | 111 | .ge(BrokerageUserDO::getFrozenPrice, -incrCount); // cas 逻辑 |
| 104 | 112 | return update(null, lambdaUpdateWrapper); |
| ... | ... | @@ -107,8 +115,7 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> { |
| 107 | 115 | default void updateBindUserIdAndBindUserTimeToNull(Long id) { |
| 108 | 116 | update(null, new LambdaUpdateWrapper<BrokerageUserDO>() |
| 109 | 117 | .eq(BrokerageUserDO::getId, id) |
| 110 | - .set(BrokerageUserDO::getBindUserId, null).set(BrokerageUserDO::getBindUserTime, null) | |
| 111 | - .set(BrokerageUserDO::getLevel, 1).set(BrokerageUserDO::getPath, "")); | |
| 118 | + .set(BrokerageUserDO::getBindUserId, null).set(BrokerageUserDO::getBindUserTime, null)); | |
| 112 | 119 | } |
| 113 | 120 | |
| 114 | 121 | default void updateEnabledFalseAndBrokerageTimeToNull(Long id) { |
| ... | ... | @@ -117,10 +124,26 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> { |
| 117 | 124 | .set(BrokerageUserDO::getBrokerageEnabled, false).set(BrokerageUserDO::getBrokerageTime, null)); |
| 118 | 125 | } |
| 119 | 126 | |
| 120 | - default Long selectCountByBindUserIdAndLevelIn(Long bindUserId, List<Integer> levels) { | |
| 127 | + default Long selectCountByBindUserIdIn(List<Long> bindUserIds) { | |
| 121 | 128 | return selectCount(new LambdaQueryWrapperX<BrokerageUserDO>() |
| 122 | - .findInSetIfPresent(BrokerageUserDO::getPath, bindUserId) | |
| 123 | - .inIfPresent(BrokerageUserDO::getLevel, levels)); | |
| 129 | + .inIfPresent(BrokerageUserDO::getBindUserId, bindUserIds)); | |
| 130 | + } | |
| 131 | + | |
| 132 | + @Select("SELECT bind_user_id AS id, COUNT(1) AS brokerageUserCount FROM trade_brokerage_user " + | |
| 133 | + "WHERE bind_user_id IS NOT NULL AND deleted = FALSE " + | |
| 134 | + "AND bind_user_time BETWEEN #{beginTime} AND #{endTime} " + | |
| 135 | + "GROUP BY bind_user_id " + | |
| 136 | + "ORDER BY brokerageUserCount DESC") | |
| 137 | + IPage<AppBrokerageUserRankByUserCountRespVO> selectCountPageGroupByBindUserId(Page<?> page, | |
| 138 | + @Param("beginTime") LocalDateTime beginTime, | |
| 139 | + @Param("endTime") LocalDateTime endTime); | |
| 140 | + | |
| 141 | + IPage<AppBrokerageUserChildSummaryRespVO> selectSummaryPageByUserId(Page<?> page, | |
| 142 | + @Param("param") AppBrokerageUserChildSummaryPageReqVO param, | |
| 143 | + @Param("userId") Long userId); | |
| 144 | + | |
| 145 | + default List<BrokerageUserDO> selectListByBindUserId(Long bindUserId) { | |
| 146 | + return selectList(BrokerageUserDO::getBindUserId, bindUserId); | |
| 124 | 147 | } |
| 125 | 148 | |
| 126 | 149 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/withdraw/BrokerageWithdrawMapper.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/brokerage/BrokerageWithdrawMapper.java
| 1 | -package cn.iocoder.yudao.module.trade.dal.mysql.brokerage.withdraw; | |
| 1 | +package cn.iocoder.yudao.module.trade.dal.mysql.brokerage; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.trade.controller.admin.brokerage.withdraw.vo.BrokerageWithdrawPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.withdraw.BrokerageWithdrawDO; | |
| 6 | +import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO; | |
| 8 | +import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserWithdrawSummaryBO; | |
| 8 | 9 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 9 | 10 | import org.apache.ibatis.annotations.Mapper; |
| 11 | +import org.apache.ibatis.annotations.Param; | |
| 12 | +import org.apache.ibatis.annotations.Select; | |
| 10 | 13 | |
| 11 | 14 | /** |
| 12 | 15 | * 佣金提现 Mapper |
| ... | ... | @@ -34,4 +37,9 @@ public interface BrokerageWithdrawMapper extends BaseMapperX<BrokerageWithdrawDO |
| 34 | 37 | .eq(BrokerageWithdrawDO::getStatus, status)); |
| 35 | 38 | } |
| 36 | 39 | |
| 40 | + @Select("SELECT COUNT(1) AS count, SUM(price) AS price FROM trade_brokerage_withdraw " + | |
| 41 | + "WHERE user_id = #{userId} AND status = #{status} AND deleted = FALSE") | |
| 42 | + UserWithdrawSummaryBO selectCountAndSumPriceByUserIdAndStatus(@Param("userId") Long userId, | |
| 43 | + @Param("status") Integer status); | |
| 44 | + | |
| 37 | 45 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/dto/TradeAfterSaleLogRespDTO.java deleted
| 1 | -package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.AllArgsConstructor; | |
| 5 | -import lombok.Data; | |
| 6 | -import lombok.NoArgsConstructor; | |
| 7 | - | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 9 | -import java.time.LocalDateTime; | |
| 10 | - | |
| 11 | -// TODO @puhui999:这个是不是应该搞成 vo 啊? | |
| 12 | -/** | |
| 13 | - * 贸易售后日志详情 DTO | |
| 14 | - * | |
| 15 | - * @author HUIHUI | |
| 16 | - */ | |
| 17 | -@Data | |
| 18 | -@NoArgsConstructor | |
| 19 | -@AllArgsConstructor | |
| 20 | -public class TradeAfterSaleLogRespDTO { | |
| 21 | - | |
| 22 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20669") | |
| 23 | - private Long id; | |
| 24 | - | |
| 25 | - @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22634") | |
| 26 | - @NotNull(message = "用户编号不能为空") | |
| 27 | - private Long userId; | |
| 28 | - | |
| 29 | - @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 30 | - @NotNull(message = "用户类型不能为空") | |
| 31 | - private Integer userType; | |
| 32 | - | |
| 33 | - @Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3023") | |
| 34 | - @NotNull(message = "售后编号不能为空") | |
| 35 | - private Long afterSaleId; | |
| 36 | - | |
| 37 | - @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25870") | |
| 38 | - @NotNull(message = "订单编号不能为空") | |
| 39 | - private Long orderId; | |
| 40 | - | |
| 41 | - @Schema(description = "订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23154") | |
| 42 | - @NotNull(message = "订单项编号不能为空") | |
| 43 | - private Long orderItemId; | |
| 44 | - | |
| 45 | - @Schema(description = "售后状态(之前)", example = "2") | |
| 46 | - private Integer beforeStatus; | |
| 47 | - | |
| 48 | - @Schema(description = "售后状态(之后)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 49 | - @NotNull(message = "售后状态(之后)不能为空") | |
| 50 | - private Integer afterStatus; | |
| 51 | - | |
| 52 | - @Schema(description = "操作明细", requiredMode = Schema.RequiredMode.REQUIRED, example = "维权完成,退款金额:¥37776.00") | |
| 53 | - @NotNull(message = "操作明细不能为空") | |
| 54 | - private String content; | |
| 55 | - | |
| 56 | - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 57 | - private LocalDateTime createTime; | |
| 58 | - | |
| 59 | -} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/service/AfterSaleLogService.java
| 1 | 1 | package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO; | |
| 4 | 5 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO; |
| 5 | -import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO; | |
| 6 | 6 | |
| 7 | 7 | import java.util.List; |
| 8 | 8 | |
| ... | ... | @@ -29,6 +29,6 @@ public interface AfterSaleLogService { |
| 29 | 29 | * @param afterSaleId 售后编号 |
| 30 | 30 | * @return 售后日志 |
| 31 | 31 | */ |
| 32 | - List<TradeAfterSaleLogRespDTO> getLog(Long afterSaleId); | |
| 32 | + List<TradeAfterSaleLogRespVO> getLog(Long afterSaleId); | |
| 33 | 33 | |
| 34 | 34 | } | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/order/core/aop/TradeOrderLogAspect.java
| ... | ... | @@ -63,6 +63,9 @@ public class TradeOrderLogAspect { |
| 63 | 63 | Long userId = getUserId(); |
| 64 | 64 | // 1.2 订单信息 |
| 65 | 65 | Long orderId = ORDER_ID.get(); |
| 66 | + if (orderId == null) { // 如果未设置,只有注解,说明不需要记录订单日志 | |
| 67 | + return; | |
| 68 | + } | |
| 66 | 69 | Integer beforeStatus = BEFORE_STATUS.get(); |
| 67 | 70 | Integer afterStatus = AFTER_STATUS.get(); |
| 68 | 71 | Map<String, Object> exts = ObjectUtil.defaultIfNull(EXTS.get(), emptyMap()); | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/job/brokerage/BrokerageRecordUnfreezeJob.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.trade.job.brokerage; |
| 3 | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; |
| 5 | 5 | import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; |
| 6 | -import cn.iocoder.yudao.module.trade.service.brokerage.record.BrokerageRecordService; | |
| 6 | +import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService; | |
| 7 | 7 | import org.springframework.stereotype.Component; |
| 8 | 8 | |
| 9 | 9 | import javax.annotation.Resource; | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java
| ... | ... | @@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| 11 | 11 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDisagreeReqVO; |
| 12 | 12 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSalePageReqVO; |
| 13 | 13 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRefuseReqVO; |
| 14 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO; | |
| 14 | 15 | import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleCreateReqVO; |
| 15 | 16 | import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleDeliveryReqVO; |
| 16 | 17 | import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert; |
| ... | ... | @@ -26,7 +27,6 @@ import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleWayEnum; |
| 26 | 27 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum; |
| 27 | 28 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; |
| 28 | 29 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO; |
| 29 | -import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO; | |
| 30 | 30 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService; |
| 31 | 31 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; |
| 32 | 32 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; |
| ... | ... | @@ -449,8 +449,9 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa |
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | + // TODO @puhui999:应该返回 do 哈。 | |
| 452 | 453 | @Override |
| 453 | - public List<TradeAfterSaleLogRespDTO> getLog(Long afterSaleId) { | |
| 454 | + public List<TradeAfterSaleLogRespVO> getLog(Long afterSaleId) { | |
| 454 | 455 | // TODO 不熟悉流程先这么滴 |
| 455 | 456 | List<TradeAfterSaleLogDO> saleLogDOs = tradeAfterSaleLogMapper.selectList(TradeAfterSaleLogDO::getAfterSaleId, afterSaleId); |
| 456 | 457 | return TradeAfterSaleConvert.INSTANCE.convertList(saleLogDOs); | ... | ... |