Commit 35df912be789ff96958b31c0eee5ac689b95c087
1 parent
08535d60
code review:商品评价哈
Showing
21 changed files
with
80 additions
and
99 deletions
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/comment/ProductCommentApi.java
| 1 | package cn.iocoder.yudao.module.product.api.comment; | 1 | package cn.iocoder.yudao.module.product.api.comment; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.product.api.comment.dto.CommentCreateReqDTO; | 3 | +import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO; |
| 4 | 4 | ||
| 5 | /** | 5 | /** |
| 6 | * 产品评论 API 接口 | 6 | * 产品评论 API 接口 |
| @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.product.api.comment.dto.CommentCreateReqDTO; | @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.product.api.comment.dto.CommentCreateReqDTO; | ||
| 9 | */ | 9 | */ |
| 10 | public interface ProductCommentApi { | 10 | public interface ProductCommentApi { |
| 11 | 11 | ||
| 12 | + // TODO @puhui:Long orderId 放到 createReqDTO 里噶? | ||
| 12 | /** | 13 | /** |
| 13 | * 创建评论 | 14 | * 创建评论 |
| 14 | * | 15 | * |
| @@ -16,6 +17,6 @@ public interface ProductCommentApi { | @@ -16,6 +17,6 @@ public interface ProductCommentApi { | ||
| 16 | * @param orderId 订单 id | 17 | * @param orderId 订单 id |
| 17 | * @return 返回评论创建后的 id | 18 | * @return 返回评论创建后的 id |
| 18 | */ | 19 | */ |
| 19 | - Long createComment(CommentCreateReqDTO createReqDTO, Long orderId); | 20 | + Long createComment(ProductCommentCreateReqDTO createReqDTO, Long orderId); |
| 20 | 21 | ||
| 21 | } | 22 | } |
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/comment/dto/CommentCreateReqDTO.java renamed to yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/comment/dto/ProductCommentCreateReqDTO.java
| @@ -10,71 +10,64 @@ import java.util.List; | @@ -10,71 +10,64 @@ import java.util.List; | ||
| 10 | * @author HUIHUI | 10 | * @author HUIHUI |
| 11 | */ | 11 | */ |
| 12 | @Data | 12 | @Data |
| 13 | -public class CommentCreateReqDTO { | 13 | +public class ProductCommentCreateReqDTO { |
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | - * 是否匿名 | 16 | + * 商品 SKU 编号 |
| 17 | */ | 17 | */ |
| 18 | - private Boolean anonymous; | ||
| 19 | - | 18 | + private Long skuId; |
| 20 | /** | 19 | /** |
| 21 | * 交易订单项编号 | 20 | * 交易订单项编号 |
| 22 | */ | 21 | */ |
| 23 | private Long orderItemId; | 22 | private Long orderItemId; |
| 24 | 23 | ||
| 24 | + // TODO @huihui:spuId、spuName 去查询哇?通过 skuId | ||
| 25 | /** | 25 | /** |
| 26 | * 商品 SPU 编号 | 26 | * 商品 SPU 编号 |
| 27 | */ | 27 | */ |
| 28 | private Long spuId; | 28 | private Long spuId; |
| 29 | - | ||
| 30 | /** | 29 | /** |
| 31 | * 商品 SPU 名称 | 30 | * 商品 SPU 名称 |
| 32 | */ | 31 | */ |
| 33 | private String spuName; | 32 | private String spuName; |
| 34 | 33 | ||
| 35 | /** | 34 | /** |
| 36 | - * 商品 SKU 编号 | ||
| 37 | - */ | ||
| 38 | - private Long skuId; | ||
| 39 | - | ||
| 40 | - /** | ||
| 41 | * 评分星级 1-5 分 | 35 | * 评分星级 1-5 分 |
| 42 | */ | 36 | */ |
| 43 | private Integer scores; | 37 | private Integer scores; |
| 44 | - | ||
| 45 | /** | 38 | /** |
| 46 | * 描述星级 1-5 分 | 39 | * 描述星级 1-5 分 |
| 47 | */ | 40 | */ |
| 48 | private Integer descriptionScores; | 41 | private Integer descriptionScores; |
| 49 | - | ||
| 50 | /** | 42 | /** |
| 51 | * 服务星级 1-5 分 | 43 | * 服务星级 1-5 分 |
| 52 | */ | 44 | */ |
| 53 | private Integer benefitScores; | 45 | private Integer benefitScores; |
| 54 | - | ||
| 55 | /** | 46 | /** |
| 56 | * 评论内容 | 47 | * 评论内容 |
| 57 | */ | 48 | */ |
| 58 | private String content; | 49 | private String content; |
| 59 | - | ||
| 60 | /** | 50 | /** |
| 61 | - * 评论图片地址数组,以逗号分隔最多上传9张 | 51 | + * 评论图片地址数组,以逗号分隔最多上传 9 张 |
| 62 | */ | 52 | */ |
| 63 | private List<String> picUrls; | 53 | private List<String> picUrls; |
| 64 | 54 | ||
| 65 | /** | 55 | /** |
| 56 | + * 是否匿名 | ||
| 57 | + */ | ||
| 58 | + private Boolean anonymous; | ||
| 59 | + /** | ||
| 60 | + * 评价人 | ||
| 61 | + */ | ||
| 62 | + private Long userId; | ||
| 63 | + // TODO @puhui999:是不是 userNickname、userAvatar 去掉?通过 userId 查询 | ||
| 64 | + /** | ||
| 66 | * 评价人名称 | 65 | * 评价人名称 |
| 67 | */ | 66 | */ |
| 68 | private String userNickname; | 67 | private String userNickname; |
| 69 | - | ||
| 70 | /** | 68 | /** |
| 71 | * 评价人头像 | 69 | * 评价人头像 |
| 72 | */ | 70 | */ |
| 73 | private String userAvatar; | 71 | private String userAvatar; |
| 74 | 72 | ||
| 75 | - /** | ||
| 76 | - * 评价人 | ||
| 77 | - */ | ||
| 78 | - private Long userId; | ||
| 79 | - | ||
| 80 | } | 73 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/comment/ProductCommentApiImpl.java
| 1 | package cn.iocoder.yudao.module.product.api.comment; | 1 | package cn.iocoder.yudao.module.product.api.comment; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.product.api.comment.dto.CommentCreateReqDTO; | 3 | +import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO; |
| 4 | import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert; | 4 | import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert; |
| 5 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; | 5 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; |
| 6 | import cn.iocoder.yudao.module.product.service.comment.ProductCommentService; | 6 | import cn.iocoder.yudao.module.product.service.comment.ProductCommentService; |
| @@ -17,12 +17,14 @@ import javax.annotation.Resource; | @@ -17,12 +17,14 @@ import javax.annotation.Resource; | ||
| 17 | @Service | 17 | @Service |
| 18 | @Validated | 18 | @Validated |
| 19 | public class ProductCommentApiImpl implements ProductCommentApi { | 19 | public class ProductCommentApiImpl implements ProductCommentApi { |
| 20 | + | ||
| 20 | @Resource | 21 | @Resource |
| 21 | private ProductCommentService productCommentService; | 22 | private ProductCommentService productCommentService; |
| 22 | 23 | ||
| 23 | @Override | 24 | @Override |
| 24 | - public Long createComment(CommentCreateReqDTO createReqDTO, Long orderId) { | 25 | + public Long createComment(ProductCommentCreateReqDTO createReqDTO, Long orderId) { |
| 25 | ProductCommentDO commentDO = ProductCommentConvert.INSTANCE.convert(createReqDTO, orderId); | 26 | ProductCommentDO commentDO = ProductCommentConvert.INSTANCE.convert(createReqDTO, orderId); |
| 26 | return productCommentService.createComment(commentDO); | 27 | return productCommentService.createComment(commentDO); |
| 27 | } | 28 | } |
| 29 | + | ||
| 28 | } | 30 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentBaseVO.java
| @@ -30,15 +30,15 @@ public class ProductCommentBaseVO { | @@ -30,15 +30,15 @@ public class ProductCommentBaseVO { | ||
| 30 | @NotNull(message = "商品 SKU 编号不能为空") | 30 | @NotNull(message = "商品 SKU 编号不能为空") |
| 31 | private Long skuId; | 31 | private Long skuId; |
| 32 | 32 | ||
| 33 | - @Schema(description = "评分星级 1-5分", required = true, example = "5") | 33 | + @Schema(description = "评分星级 1-5 分", required = true, example = "5") |
| 34 | @NotNull(message = "评分星级不能为空") | 34 | @NotNull(message = "评分星级不能为空") |
| 35 | private Integer scores; | 35 | private Integer scores; |
| 36 | 36 | ||
| 37 | - @Schema(description = "描述星级 1-5分", required = true, example = "5") | 37 | + @Schema(description = "描述星级 1-5 分", required = true, example = "5") |
| 38 | @NotNull(message = "描述星级不能为空") | 38 | @NotNull(message = "描述星级不能为空") |
| 39 | private Integer descriptionScores; | 39 | private Integer descriptionScores; |
| 40 | 40 | ||
| 41 | - @Schema(description = "服务星级 1-5分", required = true, example = "5") | 41 | + @Schema(description = "服务星级 1-5 分", required = true, example = "5") |
| 42 | @NotNull(message = "服务星级分不能为空") | 42 | @NotNull(message = "服务星级分不能为空") |
| 43 | private Integer benefitScores; | 43 | private Integer benefitScores; |
| 44 | 44 | ||
| @@ -46,8 +46,8 @@ public class ProductCommentBaseVO { | @@ -46,8 +46,8 @@ public class ProductCommentBaseVO { | ||
| 46 | @NotNull(message = "评论内容不能为空") | 46 | @NotNull(message = "评论内容不能为空") |
| 47 | private String content; | 47 | private String content; |
| 48 | 48 | ||
| 49 | - @Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]") | ||
| 50 | - @Size(max = 9, message = "评论图片地址数组长度不能超过9张") | 49 | + @Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]") |
| 50 | + @Size(max = 9, message = "评论图片地址数组长度不能超过 9 张") | ||
| 51 | private List<String> picUrls; | 51 | private List<String> picUrls; |
| 52 | 52 | ||
| 53 | } | 53 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentCreateReqVO.java
| @@ -13,6 +13,7 @@ import javax.validation.constraints.NotNull; | @@ -13,6 +13,7 @@ import javax.validation.constraints.NotNull; | ||
| 13 | @ToString(callSuper = true) | 13 | @ToString(callSuper = true) |
| 14 | public class ProductCommentCreateReqVO extends ProductCommentBaseVO { | 14 | public class ProductCommentCreateReqVO extends ProductCommentBaseVO { |
| 15 | 15 | ||
| 16 | + // TODO @puhui999:是不是也放到父类里? | ||
| 16 | @Schema(description = "评价人", required = true, example = "16868") | 17 | @Schema(description = "评价人", required = true, example = "16868") |
| 17 | @NotNull(message = "评价人不能为空") | 18 | @NotNull(message = "评价人不能为空") |
| 18 | private Long userId; | 19 | private Long userId; |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentPageReqVO.java
| @@ -31,7 +31,7 @@ public class ProductCommentPageReqVO extends PageParam { | @@ -31,7 +31,7 @@ public class ProductCommentPageReqVO extends PageParam { | ||
| 31 | @Schema(description = "商品SPU名称", example = "感冒药") | 31 | @Schema(description = "商品SPU名称", example = "感冒药") |
| 32 | private String spuName; | 32 | private String spuName; |
| 33 | 33 | ||
| 34 | - @Schema(description = "评分星级 1-5分", example = "5") | 34 | + @Schema(description = "评分星级 1-5 分", example = "5") |
| 35 | @InEnum(ProductCommentScoresEnum.class) | 35 | @InEnum(ProductCommentScoresEnum.class) |
| 36 | private Integer scores; | 36 | private Integer scores; |
| 37 | 37 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentRespVO.java
| @@ -16,7 +16,7 @@ public class ProductCommentRespVO extends ProductCommentBaseVO { | @@ -16,7 +16,7 @@ public class ProductCommentRespVO extends ProductCommentBaseVO { | ||
| 16 | @Schema(description = "订单项编号", required = true, example = "24965") | 16 | @Schema(description = "订单项编号", required = true, example = "24965") |
| 17 | private Long id; | 17 | private Long id; |
| 18 | 18 | ||
| 19 | - @Schema(description = "是否匿名:[false:不匿名 true:匿名]", required = true, example = "false") | 19 | + @Schema(description = "是否匿名", required = true, example = "false") |
| 20 | private Boolean anonymous; | 20 | private Boolean anonymous; |
| 21 | 21 | ||
| 22 | @Schema(description = "交易订单编号", required = true, example = "24428") | 22 | @Schema(description = "交易订单编号", required = true, example = "24428") |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/AppProductCommentController.java
| @@ -36,6 +36,7 @@ public class AppProductCommentController { | @@ -36,6 +36,7 @@ public class AppProductCommentController { | ||
| 36 | @Resource | 36 | @Resource |
| 37 | private ProductCommentService productCommentService; | 37 | private ProductCommentService productCommentService; |
| 38 | 38 | ||
| 39 | + // TODO @puhui999:可以实现下 | ||
| 39 | @GetMapping("/list") | 40 | @GetMapping("/list") |
| 40 | @Operation(summary = "获得最近的 n 条商品评价") | 41 | @Operation(summary = "获得最近的 n 条商品评价") |
| 41 | @Parameters({ | 42 | @Parameters({ |
| @@ -44,7 +45,6 @@ public class AppProductCommentController { | @@ -44,7 +45,6 @@ public class AppProductCommentController { | ||
| 44 | }) | 45 | }) |
| 45 | public CommonResult<List<AppProductCommentRespVO>> getCommentList(@RequestParam("spuId") Long spuId, | 46 | public CommonResult<List<AppProductCommentRespVO>> getCommentList(@RequestParam("spuId") Long spuId, |
| 46 | @RequestParam(value = "count", defaultValue = "10") Integer count) { | 47 | @RequestParam(value = "count", defaultValue = "10") Integer count) { |
| 47 | - | ||
| 48 | List<AppProductPropertyValueDetailRespVO> list = new ArrayList<>(); | 48 | List<AppProductPropertyValueDetailRespVO> list = new ArrayList<>(); |
| 49 | 49 | ||
| 50 | AppProductPropertyValueDetailRespVO item1 = new AppProductPropertyValueDetailRespVO(); | 50 | AppProductPropertyValueDetailRespVO item1 = new AppProductPropertyValueDetailRespVO(); |
| @@ -101,6 +101,7 @@ public class AppProductCommentController { | @@ -101,6 +101,7 @@ public class AppProductCommentController { | ||
| 101 | return success(productCommentService.getCommentPage(pageVO, Boolean.TRUE)); | 101 | return success(productCommentService.getCommentPage(pageVO, Boolean.TRUE)); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | + // TODO @puhui:get-statistics;方法改成 getCommentStatistics;getCommentPageTabsCount 也改掉哈 | ||
| 104 | @GetMapping("/getCommentStatistics") | 105 | @GetMapping("/getCommentStatistics") |
| 105 | @Operation(summary = "获得商品的评价统计") | 106 | @Operation(summary = "获得商品的评价统计") |
| 106 | public CommonResult<AppCommentStatisticsRespVO> getCommentPage(@Valid @RequestParam("spuId") Long spuId) { | 107 | public CommonResult<AppCommentStatisticsRespVO> getCommentPage(@Valid @RequestParam("spuId") Long spuId) { |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentPageReqVO.java
| @@ -8,11 +8,6 @@ import lombok.ToString; | @@ -8,11 +8,6 @@ import lombok.ToString; | ||
| 8 | 8 | ||
| 9 | import javax.validation.constraints.NotNull; | 9 | import javax.validation.constraints.NotNull; |
| 10 | 10 | ||
| 11 | -/** | ||
| 12 | - * 用户 APP - 商品评价分页 Request VO | ||
| 13 | - * | ||
| 14 | - * @author HUIHUI | ||
| 15 | - */ | ||
| 16 | @Schema(description = "用户APP - 商品评价分页 Request VO") | 11 | @Schema(description = "用户APP - 商品评价分页 Request VO") |
| 17 | @Data | 12 | @Data |
| 18 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| @@ -23,12 +18,10 @@ public class AppCommentPageReqVO extends PageParam { | @@ -23,12 +18,10 @@ public class AppCommentPageReqVO extends PageParam { | ||
| 23 | * 好评 | 18 | * 好评 |
| 24 | */ | 19 | */ |
| 25 | public static final Integer GOOD_COMMENT = 1; | 20 | public static final Integer GOOD_COMMENT = 1; |
| 26 | - | ||
| 27 | /** | 21 | /** |
| 28 | * 中评 | 22 | * 中评 |
| 29 | */ | 23 | */ |
| 30 | public static final Integer MEDIOCRE_COMMENT = 2; | 24 | public static final Integer MEDIOCRE_COMMENT = 2; |
| 31 | - | ||
| 32 | /** | 25 | /** |
| 33 | * 差评 | 26 | * 差评 |
| 34 | */ | 27 | */ |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentStatisticsRespVO.java
| @@ -4,11 +4,6 @@ import io.swagger.v3.oas.annotations.media.Schema; | @@ -4,11 +4,6 @@ import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | import lombok.ToString; | 5 | import lombok.ToString; |
| 6 | 6 | ||
| 7 | -/** | ||
| 8 | - * APP 商品评价页评论分类数统计 Response VO | ||
| 9 | - * | ||
| 10 | - * @author HUIHUI | ||
| 11 | - */ | ||
| 12 | @Schema(description = "APP - 商品评价页评论分类数统计 Response VO") | 7 | @Schema(description = "APP - 商品评价页评论分类数统计 Response VO") |
| 13 | @Data | 8 | @Data |
| 14 | @ToString(callSuper = true) | 9 | @ToString(callSuper = true) |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppProductCommentCreateReqVO.java
| @@ -8,11 +8,6 @@ import javax.validation.constraints.NotNull; | @@ -8,11 +8,6 @@ import javax.validation.constraints.NotNull; | ||
| 8 | import javax.validation.constraints.Size; | 8 | import javax.validation.constraints.Size; |
| 9 | import java.util.List; | 9 | import java.util.List; |
| 10 | 10 | ||
| 11 | -/** | ||
| 12 | - * 用户APP - 商品评价创建 Request VO | ||
| 13 | - * | ||
| 14 | - * @author HUIHUI | ||
| 15 | - */ | ||
| 16 | @Schema(description = "用户APP - 商品评价创建 Request VO") | 11 | @Schema(description = "用户APP - 商品评价创建 Request VO") |
| 17 | @Data | 12 | @Data |
| 18 | @ToString(callSuper = true) | 13 | @ToString(callSuper = true) |
| @@ -26,36 +21,36 @@ public class AppProductCommentCreateReqVO { | @@ -26,36 +21,36 @@ public class AppProductCommentCreateReqVO { | ||
| 26 | @NotNull(message = "交易订单项编号不能为空") | 21 | @NotNull(message = "交易订单项编号不能为空") |
| 27 | private Long orderItemId; | 22 | private Long orderItemId; |
| 28 | 23 | ||
| 29 | - @Schema(description = "商品SPU编号", required = true, example = "91192") | 24 | + @Schema(description = "商品 SPU 编号", required = true, example = "91192") |
| 30 | @NotNull(message = "商品SPU编号不能为空") | 25 | @NotNull(message = "商品SPU编号不能为空") |
| 31 | private Long spuId; | 26 | private Long spuId; |
| 32 | 27 | ||
| 33 | - @Schema(description = "商品SPU名称", required = true, example = "清凉丝滑小短袖") | 28 | + @Schema(description = "商品 SPU 名称", required = true, example = "清凉丝滑小短袖") |
| 34 | @NotNull(message = "商品SPU名称不能为空") | 29 | @NotNull(message = "商品SPU名称不能为空") |
| 35 | private String spuName; | 30 | private String spuName; |
| 36 | 31 | ||
| 37 | - @Schema(description = "商品SKU编号", required = true, example = "81192") | 32 | + @Schema(description = "商品 SKU 编号", required = true, example = "81192") |
| 38 | @NotNull(message = "商品SKU编号不能为空") | 33 | @NotNull(message = "商品SKU编号不能为空") |
| 39 | private Long skuId; | 34 | private Long skuId; |
| 40 | 35 | ||
| 41 | - @Schema(description = "评分星级 1-5分", required = true, example = "5") | ||
| 42 | - @NotNull(message = "评分星级 1-5分不能为空") | 36 | + @Schema(description = "评分星级 1-5 分", required = true, example = "5") |
| 37 | + @NotNull(message = "评分星级 1-5 分不能为空") | ||
| 43 | private Integer scores; | 38 | private Integer scores; |
| 44 | 39 | ||
| 45 | - @Schema(description = "描述星级 1-5分", required = true, example = "5") | ||
| 46 | - @NotNull(message = "描述星级 1-5分不能为空") | 40 | + @Schema(description = "描述星级 1-5 分", required = true, example = "5") |
| 41 | + @NotNull(message = "描述星级 1-5 分不能为空") | ||
| 47 | private Integer descriptionScores; | 42 | private Integer descriptionScores; |
| 48 | 43 | ||
| 49 | - @Schema(description = "服务星级 1-5分", required = true, example = "5") | ||
| 50 | - @NotNull(message = "服务星级 1-5分不能为空") | 44 | + @Schema(description = "服务星级 1-5 分", required = true, example = "5") |
| 45 | + @NotNull(message = "服务星级 1-5 分不能为空") | ||
| 51 | private Integer benefitScores; | 46 | private Integer benefitScores; |
| 52 | 47 | ||
| 53 | @Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评") | 48 | @Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评") |
| 54 | @NotNull(message = "评论内容不能为空") | 49 | @NotNull(message = "评论内容不能为空") |
| 55 | private String content; | 50 | private String content; |
| 56 | 51 | ||
| 57 | - @Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]") | ||
| 58 | - @Size(max = 9, message = "评论图片地址数组长度不能超过9张") | 52 | + @Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]") |
| 53 | + @Size(max = 9, message = "评论图片地址数组长度不能超过 9 张") | ||
| 59 | private List<String> picUrls; | 54 | private List<String> picUrls; |
| 60 | 55 | ||
| 61 | } | 56 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppProductCommentRespVO.java
| @@ -60,7 +60,7 @@ public class AppProductCommentRespVO { | @@ -60,7 +60,7 @@ public class AppProductCommentRespVO { | ||
| 60 | @Schema(description = "追加评价内容", example = "穿了很久都很丝滑诶") | 60 | @Schema(description = "追加评价内容", example = "穿了很久都很丝滑诶") |
| 61 | private String additionalContent; | 61 | private String additionalContent; |
| 62 | 62 | ||
| 63 | - @Schema(description = "追评评价图片地址数组,以逗号分隔最多上传9张", example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]") | 63 | + @Schema(description = "追评评价图片地址数组,以逗号分隔最多上传 9 张", example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]") |
| 64 | private List<String> additionalPicUrls; | 64 | private List<String> additionalPicUrls; |
| 65 | 65 | ||
| 66 | @Schema(description = "追加评价时间") | 66 | @Schema(description = "追加评价时间") |
| @@ -86,24 +86,24 @@ public class AppProductCommentRespVO { | @@ -86,24 +86,24 @@ public class AppProductCommentRespVO { | ||
| 86 | @Schema(description = "商品 SKU 属性", required = true) | 86 | @Schema(description = "商品 SKU 属性", required = true) |
| 87 | private List<AppProductPropertyValueDetailRespVO> skuProperties; | 87 | private List<AppProductPropertyValueDetailRespVO> skuProperties; |
| 88 | 88 | ||
| 89 | - @Schema(description = "评分星级 1-5分", required = true, example = "5") | ||
| 90 | - @NotNull(message = "评分星级 1-5分不能为空") | 89 | + @Schema(description = "评分星级 1-5 分", required = true, example = "5") |
| 90 | + @NotNull(message = "评分星级 1-5 分不能为空") | ||
| 91 | private Integer scores; | 91 | private Integer scores; |
| 92 | 92 | ||
| 93 | - @Schema(description = "描述星级 1-5分", required = true, example = "5") | ||
| 94 | - @NotNull(message = "描述星级 1-5分不能为空") | 93 | + @Schema(description = "描述星级 1-5 分", required = true, example = "5") |
| 94 | + @NotNull(message = "描述星级 1-5 分不能为空") | ||
| 95 | private Integer descriptionScores; | 95 | private Integer descriptionScores; |
| 96 | 96 | ||
| 97 | - @Schema(description = "服务星级 1-5分", required = true, example = "5") | ||
| 98 | - @NotNull(message = "服务星级 1-5分不能为空") | 97 | + @Schema(description = "服务星级 1-5 分", required = true, example = "5") |
| 98 | + @NotNull(message = "服务星级 1-5 分不能为空") | ||
| 99 | private Integer benefitScores; | 99 | private Integer benefitScores; |
| 100 | 100 | ||
| 101 | @Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评") | 101 | @Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评") |
| 102 | @NotNull(message = "评论内容不能为空") | 102 | @NotNull(message = "评论内容不能为空") |
| 103 | private String content; | 103 | private String content; |
| 104 | 104 | ||
| 105 | - @Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]") | ||
| 106 | - @Size(max = 9, message = "评论图片地址数组长度不能超过9张") | 105 | + @Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]") |
| 106 | + @Size(max = 9, message = "评论图片地址数组长度不能超过 9 张") | ||
| 107 | private List<String> picUrls; | 107 | private List<String> picUrls; |
| 108 | 108 | ||
| 109 | } | 109 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java
| 1 | package cn.iocoder.yudao.module.product.convert.comment; | 1 | package cn.iocoder.yudao.module.product.convert.comment; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.product.api.comment.dto.CommentCreateReqDTO; | 4 | +import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO; |
| 5 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO; | 5 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO; |
| 6 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO; | 6 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO; |
| 7 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO; | 7 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO; |
| @@ -49,7 +49,7 @@ public interface ProductCommentConvert { | @@ -49,7 +49,7 @@ public interface ProductCommentConvert { | ||
| 49 | * | 49 | * |
| 50 | * @param descriptionScores 描述星级 | 50 | * @param descriptionScores 描述星级 |
| 51 | * @param benefitScores 服务星级 | 51 | * @param benefitScores 服务星级 |
| 52 | - * @return {@link Integer} | 52 | + * @return 综合评分 |
| 53 | */ | 53 | */ |
| 54 | @Named("convertScores") | 54 | @Named("convertScores") |
| 55 | default Integer convertScores(Integer descriptionScores, Integer benefitScores) { | 55 | default Integer convertScores(Integer descriptionScores, Integer benefitScores) { |
| @@ -61,7 +61,7 @@ public interface ProductCommentConvert { | @@ -61,7 +61,7 @@ public interface ProductCommentConvert { | ||
| 61 | 61 | ||
| 62 | @Mapping(target = "orderId", source = "orderId") | 62 | @Mapping(target = "orderId", source = "orderId") |
| 63 | @Mapping(target = "scores", expression = "java(convertScores(createReqDTO.getDescriptionScores(), createReqDTO.getBenefitScores()))") | 63 | @Mapping(target = "scores", expression = "java(convertScores(createReqDTO.getDescriptionScores(), createReqDTO.getBenefitScores()))") |
| 64 | - ProductCommentDO convert(CommentCreateReqDTO createReqDTO, Long orderId); | 64 | + ProductCommentDO convert(ProductCommentCreateReqDTO createReqDTO, Long orderId); |
| 65 | 65 | ||
| 66 | @Mapping(target = "userId", constant = "0L") | 66 | @Mapping(target = "userId", constant = "0L") |
| 67 | @Mapping(target = "orderId", constant = "0L") | 67 | @Mapping(target = "orderId", constant = "0L") |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/comment/ProductCommentDO.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/comment/ProductCommentMapper.java
| @@ -25,6 +25,7 @@ public interface ProductCommentMapper extends BaseMapperX<ProductCommentDO> { | @@ -25,6 +25,7 @@ public interface ProductCommentMapper extends BaseMapperX<ProductCommentDO> { | ||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | // TODO 芋艿:在看看这块 | 27 | // TODO 芋艿:在看看这块 |
| 28 | + // TODO @puhui999:直接使用 scores 来算好评、中评、差评 | ||
| 28 | static void appendTabQuery(LambdaQueryWrapperX<ProductCommentDO> queryWrapper, Integer type) { | 29 | static void appendTabQuery(LambdaQueryWrapperX<ProductCommentDO> queryWrapper, Integer type) { |
| 29 | // 构建好评查询语句:好评计算 (商品评分星级+服务评分星级) >= 8 | 30 | // 构建好评查询语句:好评计算 (商品评分星级+服务评分星级) >= 8 |
| 30 | if (ObjectUtil.equal(type, AppCommentPageReqVO.GOOD_COMMENT)) { | 31 | if (ObjectUtil.equal(type, AppCommentPageReqVO.GOOD_COMMENT)) { |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentService.java
| @@ -54,7 +54,8 @@ public interface ProductCommentService { | @@ -54,7 +54,8 @@ public interface ProductCommentService { | ||
| 54 | PageResult<AppProductCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible); | 54 | PageResult<AppProductCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible); |
| 55 | 55 | ||
| 56 | /** | 56 | /** |
| 57 | - * 创建商品评论 后台管理员创建评论使用 | 57 | + * 创建商品评论 |
| 58 | + * 后台管理员创建评论使用 | ||
| 58 | * | 59 | * |
| 59 | * @param createReqVO 商品评价创建 Request VO 对象 | 60 | * @param createReqVO 商品评价创建 Request VO 对象 |
| 60 | */ | 61 | */ |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImpl.java
| @@ -86,6 +86,7 @@ public class ProductCommentServiceImpl implements ProductCommentService { | @@ -86,6 +86,7 @@ public class ProductCommentServiceImpl implements ProductCommentService { | ||
| 86 | @Transactional(rollbackFor = Exception.class) | 86 | @Transactional(rollbackFor = Exception.class) |
| 87 | public void createComment(ProductCommentCreateReqVO createReqVO) { | 87 | public void createComment(ProductCommentCreateReqVO createReqVO) { |
| 88 | // 校验订单 | 88 | // 校验订单 |
| 89 | + // TODO @puhui999:不校验哈;尽可能解耦 | ||
| 89 | Long orderId = tradeOrderApi.validateOrder(createReqVO.getUserId(), createReqVO.getOrderItemId()); | 90 | Long orderId = tradeOrderApi.validateOrder(createReqVO.getUserId(), createReqVO.getOrderItemId()); |
| 90 | // 校验评论 | 91 | // 校验评论 |
| 91 | validateComment(createReqVO.getSpuId(), createReqVO.getUserId(), orderId); | 92 | validateComment(createReqVO.getSpuId(), createReqVO.getUserId(), orderId); |
| @@ -104,8 +105,6 @@ public class ProductCommentServiceImpl implements ProductCommentService { | @@ -104,8 +105,6 @@ public class ProductCommentServiceImpl implements ProductCommentService { | ||
| 104 | return commentDO.getId(); | 105 | return commentDO.getId(); |
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | - // TODO 只有创建和更新诶 要不要删除接口 | ||
| 108 | - | ||
| 109 | private void validateComment(Long spuId, Long userId, Long orderId) { | 108 | private void validateComment(Long spuId, Long userId, Long orderId) { |
| 110 | ProductSpuDO spu = productSpuService.getSpu(spuId); | 109 | ProductSpuDO spu = productSpuService.getSpu(spuId); |
| 111 | if (null == spu) { | 110 | if (null == spu) { |
| @@ -144,6 +143,7 @@ public class ProductCommentServiceImpl implements ProductCommentService { | @@ -144,6 +143,7 @@ public class ProductCommentServiceImpl implements ProductCommentService { | ||
| 144 | public PageResult<AppProductCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible) { | 143 | public PageResult<AppProductCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible) { |
| 145 | PageResult<AppProductCommentRespVO> result = ProductCommentConvert.INSTANCE.convertPage02( | 144 | PageResult<AppProductCommentRespVO> result = ProductCommentConvert.INSTANCE.convertPage02( |
| 146 | productCommentMapper.selectPage(pageVO, visible)); | 145 | productCommentMapper.selectPage(pageVO, visible)); |
| 146 | + // TODO @puhui999:要不这块放到 controller 里拼接? | ||
| 147 | Set<Long> skuIds = result.getList().stream().map(AppProductCommentRespVO::getSkuId).collect(Collectors.toSet()); | 147 | Set<Long> skuIds = result.getList().stream().map(AppProductCommentRespVO::getSkuId).collect(Collectors.toSet()); |
| 148 | List<ProductSkuDO> skuList = productSkuService.getSkuList(skuIds); | 148 | List<ProductSkuDO> skuList = productSkuService.getSkuList(skuIds); |
| 149 | Map<Long, ProductSkuDO> skuDOMap = new HashMap<>(skuIds.size()); | 149 | Map<Long, ProductSkuDO> skuDOMap = new HashMap<>(skuIds.size()); |
yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/create_tables.sql
| @@ -126,6 +126,7 @@ CREATE TABLE IF NOT EXISTS `product_property_value` ( | @@ -126,6 +126,7 @@ CREATE TABLE IF NOT EXISTS `product_property_value` ( | ||
| 126 | PRIMARY KEY("id") | 126 | PRIMARY KEY("id") |
| 127 | ) COMMENT '规格值'; | 127 | ) COMMENT '规格值'; |
| 128 | 128 | ||
| 129 | +-- TODO @puhui999:格式不太对哈 | ||
| 129 | CREATE TABLE IF NOT EXISTS `product_comment` | 130 | CREATE TABLE IF NOT EXISTS `product_comment` |
| 130 | ( | 131 | ( |
| 131 | `id` | 132 | `id` |
| @@ -166,7 +167,7 @@ CREATE TABLE IF NOT EXISTS `product_comment` | @@ -166,7 +167,7 @@ CREATE TABLE IF NOT EXISTS `product_comment` | ||
| 166 | ( | 167 | ( |
| 167 | 1 | 168 | 1 |
| 168 | ) DEFAULT NULL COMMENT '是否可见true:显示false:隐藏', | 169 | ) DEFAULT NULL COMMENT '是否可见true:显示false:隐藏', |
| 169 | - `scores` tinyint DEFAULT NULL COMMENT '评分星级1-5分', | 170 | + `scores` tinyint DEFAULT NULL COMMENT '评分星级1-5 分', |
| 170 | `description_scores` tinyint DEFAULT NULL COMMENT '描述星级1-5 星', | 171 | `description_scores` tinyint DEFAULT NULL COMMENT '描述星级1-5 星', |
| 171 | `benefit_scores` tinyint DEFAULT NULL COMMENT '服务星级1-5 星', | 172 | `benefit_scores` tinyint DEFAULT NULL COMMENT '服务星级1-5 星', |
| 172 | `content` varchar | 173 | `content` varchar |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.trade.controller.app.order; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.trade.controller.app.order; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | -import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; | ||
| 6 | import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; | 5 | import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; |
| 7 | import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO; | 6 | import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO; |
| 8 | import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi; | 7 | import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi; |
| @@ -49,12 +48,11 @@ public class AppTradeOrderController { | @@ -49,12 +48,11 @@ public class AppTradeOrderController { | ||
| 49 | 48 | ||
| 50 | @Resource | 49 | @Resource |
| 51 | private ProductPropertyValueApi productPropertyValueApi; | 50 | private ProductPropertyValueApi productPropertyValueApi; |
| 52 | - | ||
| 53 | @Resource | 51 | @Resource |
| 54 | - private TradeOrderProperties tradeOrderProperties; | 52 | + private ProductCommentApi productCommentApi; |
| 55 | 53 | ||
| 56 | @Resource | 54 | @Resource |
| 57 | - private ProductCommentApi productCommentApi; | 55 | + private TradeOrderProperties tradeOrderProperties; |
| 58 | 56 | ||
| 59 | @GetMapping("/settlement") | 57 | @GetMapping("/settlement") |
| 60 | @Operation(summary = "获得订单结算信息") | 58 | @Operation(summary = "获得订单结算信息") |
| @@ -141,6 +139,7 @@ public class AppTradeOrderController { | @@ -141,6 +139,7 @@ public class AppTradeOrderController { | ||
| 141 | @Operation(summary = "创建交易订单项的评价") | 139 | @Operation(summary = "创建交易订单项的评价") |
| 142 | public CommonResult<Long> createOrderItemComment(@RequestBody AppTradeOrderItemCommentCreateReqVO createReqVO) { | 140 | public CommonResult<Long> createOrderItemComment(@RequestBody AppTradeOrderItemCommentCreateReqVO createReqVO) { |
| 143 | // 校验订单项,订单项存在订单就存在 | 141 | // 校验订单项,订单项存在订单就存在 |
| 142 | + // TODO @puhui999:要去查询订单是不是自己的;不然别人模拟请求哈; | ||
| 144 | TradeOrderItemDO item = tradeOrderService.getOrderItem(createReqVO.getUserId(), createReqVO.getOrderItemId()); | 143 | TradeOrderItemDO item = tradeOrderService.getOrderItem(createReqVO.getUserId(), createReqVO.getOrderItemId()); |
| 145 | if (item == null) { | 144 | if (item == null) { |
| 146 | throw exception(ORDER_ITEM_NOT_FOUND); | 145 | throw exception(ORDER_ITEM_NOT_FOUND); |
| @@ -149,6 +148,6 @@ public class AppTradeOrderController { | @@ -149,6 +148,6 @@ public class AppTradeOrderController { | ||
| 149 | return success(productCommentApi.createComment(TradeOrderConvert.INSTANCE.convert04(createReqVO), item.getOrderId())); | 148 | return success(productCommentApi.createComment(TradeOrderConvert.INSTANCE.convert04(createReqVO), item.getOrderId())); |
| 150 | } | 149 | } |
| 151 | 150 | ||
| 152 | - // TODO 合并代码后发现只有商家回复功能 用户追评不要了吗? | 151 | + // TODO 合并代码后发现只有商家回复功能 用户追评不要了吗?不要了哈; |
| 153 | 152 | ||
| 154 | } | 153 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/item/AppTradeOrderItemCommentCreateReqVO.java
| @@ -7,11 +7,6 @@ import javax.validation.constraints.NotNull; | @@ -7,11 +7,6 @@ import javax.validation.constraints.NotNull; | ||
| 7 | import javax.validation.constraints.Size; | 7 | import javax.validation.constraints.Size; |
| 8 | import java.util.List; | 8 | import java.util.List; |
| 9 | 9 | ||
| 10 | -/** | ||
| 11 | - * 商品评价创建 Request VO | ||
| 12 | - * | ||
| 13 | - * @author HUIHUI | ||
| 14 | - */ | ||
| 15 | @Schema(description = "用户APP - 商品评价创建 Request VO") | 10 | @Schema(description = "用户APP - 商品评价创建 Request VO") |
| 16 | @Data | 11 | @Data |
| 17 | public class AppTradeOrderItemCommentCreateReqVO { | 12 | public class AppTradeOrderItemCommentCreateReqVO { |
| @@ -24,6 +19,7 @@ public class AppTradeOrderItemCommentCreateReqVO { | @@ -24,6 +19,7 @@ public class AppTradeOrderItemCommentCreateReqVO { | ||
| 24 | @NotNull(message = "交易订单项编号不能为空") | 19 | @NotNull(message = "交易订单项编号不能为空") |
| 25 | private Long orderItemId; | 20 | private Long orderItemId; |
| 26 | 21 | ||
| 22 | + // TODO @puhui:spuId、spuName、skuId 直接查询出来; | ||
| 27 | @Schema(description = "商品SPU编号", required = true, example = "29502") | 23 | @Schema(description = "商品SPU编号", required = true, example = "29502") |
| 28 | @NotNull(message = "商品SPU编号不能为空") | 24 | @NotNull(message = "商品SPU编号不能为空") |
| 29 | private Long spuId; | 25 | private Long spuId; |
| @@ -36,30 +32,32 @@ public class AppTradeOrderItemCommentCreateReqVO { | @@ -36,30 +32,32 @@ public class AppTradeOrderItemCommentCreateReqVO { | ||
| 36 | @NotNull(message = "商品SKU编号不能为空") | 32 | @NotNull(message = "商品SKU编号不能为空") |
| 37 | private Long skuId; | 33 | private Long skuId; |
| 38 | 34 | ||
| 39 | - @Schema(description = "评分星级 1-5分", required = true, example = "5") | ||
| 40 | - @NotNull(message = "评分星级 1-5分不能为空") | 35 | + @Schema(description = "评分星级 1-5 分", required = true, example = "5") |
| 36 | + @NotNull(message = "评分星级 1-5 分不能为空") | ||
| 41 | private Integer scores; | 37 | private Integer scores; |
| 42 | 38 | ||
| 43 | - @Schema(description = "描述星级 1-5分", required = true, example = "5") | ||
| 44 | - @NotNull(message = "描述星级 1-5分不能为空") | 39 | + @Schema(description = "描述星级 1-5 分", required = true, example = "5") |
| 40 | + @NotNull(message = "描述星级 1-5 分不能为空") | ||
| 45 | private Integer descriptionScores; | 41 | private Integer descriptionScores; |
| 46 | 42 | ||
| 47 | - @Schema(description = "服务星级 1-5分", required = true, example = "5") | ||
| 48 | - @NotNull(message = "服务星级 1-5分不能为空") | 43 | + @Schema(description = "服务星级 1-5 分", required = true, example = "5") |
| 44 | + @NotNull(message = "服务星级 1-5 分不能为空") | ||
| 49 | private Integer benefitScores; | 45 | private Integer benefitScores; |
| 50 | 46 | ||
| 51 | @Schema(description = "评论内容", required = true, example = "穿身上很漂亮诶(*^▽^*)") | 47 | @Schema(description = "评论内容", required = true, example = "穿身上很漂亮诶(*^▽^*)") |
| 52 | @NotNull(message = "评论内容不能为空") | 48 | @NotNull(message = "评论内容不能为空") |
| 53 | private String content; | 49 | private String content; |
| 54 | 50 | ||
| 55 | - @Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xx.png]") | ||
| 56 | - @Size(max = 9, message = "评论图片地址数组长度不能超过9张") | 51 | + @Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xx.png]") |
| 52 | + @Size(max = 9, message = "评论图片地址数组长度不能超过 9 张") | ||
| 57 | private List<String> picUrls; | 53 | private List<String> picUrls; |
| 58 | 54 | ||
| 59 | @Schema(description = "评价人名称", required = true, example = "小姑凉") | 55 | @Schema(description = "评价人名称", required = true, example = "小姑凉") |
| 60 | @NotNull(message = "评价人名称不能为空") | 56 | @NotNull(message = "评价人名称不能为空") |
| 61 | private String userNickname; | 57 | private String userNickname; |
| 62 | 58 | ||
| 59 | + // TODO @puhui:userAvatar、userAvatar、userId 直接查询出来; | ||
| 60 | + | ||
| 63 | @Schema(description = "评价人头像", required = true, example = "https://www.iocoder.cn/xx.png") | 61 | @Schema(description = "评价人头像", required = true, example = "https://www.iocoder.cn/xx.png") |
| 64 | @NotNull(message = "评价人头像不能为空") | 62 | @NotNull(message = "评价人头像不能为空") |
| 65 | private String userAvatar; | 63 | private String userAvatar; |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java
| @@ -8,7 +8,7 @@ import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | @@ -8,7 +8,7 @@ import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | ||
| 8 | import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO; | 8 | import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO; |
| 9 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | 9 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 10 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; | 10 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 11 | -import cn.iocoder.yudao.module.product.api.comment.dto.CommentCreateReqDTO; | 11 | +import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO; |
| 12 | import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO; | 12 | import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO; |
| 13 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; | 13 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; |
| 14 | import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateReqDTO; | 14 | import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateReqDTO; |
| @@ -227,6 +227,7 @@ public interface TradeOrderConvert { | @@ -227,6 +227,7 @@ public interface TradeOrderConvert { | ||
| 227 | 227 | ||
| 228 | AppProductPropertyValueDetailRespVO convert02(ProductPropertyValueDetailRespDTO bean); | 228 | AppProductPropertyValueDetailRespVO convert02(ProductPropertyValueDetailRespDTO bean); |
| 229 | 229 | ||
| 230 | + // TODO 芋艿:可简化 | ||
| 230 | default AppTradeOrderDetailRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> orderItems, | 231 | default AppTradeOrderDetailRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> orderItems, |
| 231 | List<ProductPropertyValueDetailRespDTO> propertyValueDetails, TradeOrderProperties tradeOrderProperties) { | 232 | List<ProductPropertyValueDetailRespDTO> propertyValueDetails, TradeOrderProperties tradeOrderProperties) { |
| 232 | AppTradeOrderDetailRespVO orderVO = convert3(order, orderItems); | 233 | AppTradeOrderDetailRespVO orderVO = convert3(order, orderItems); |
| @@ -258,7 +259,7 @@ public interface TradeOrderConvert { | @@ -258,7 +259,7 @@ public interface TradeOrderConvert { | ||
| 258 | 259 | ||
| 259 | AppTradeOrderItemRespVO convert03(TradeOrderItemDO bean); | 260 | AppTradeOrderItemRespVO convert03(TradeOrderItemDO bean); |
| 260 | 261 | ||
| 261 | - CommentCreateReqDTO convert04(AppTradeOrderItemCommentCreateReqVO createReqVO); | 262 | + ProductCommentCreateReqDTO convert04(AppTradeOrderItemCommentCreateReqVO createReqVO); |
| 262 | 263 | ||
| 263 | default TradePriceCalculateReqBO convert(Long userId, AppTradeOrderSettlementReqVO settlementReqVO, | 264 | default TradePriceCalculateReqBO convert(Long userId, AppTradeOrderSettlementReqVO settlementReqVO, |
| 264 | List<TradeCartDO> cartList) { | 265 | List<TradeCartDO> cartList) { |
| @@ -302,5 +303,4 @@ public interface TradeOrderConvert { | @@ -302,5 +303,4 @@ public interface TradeOrderConvert { | ||
| 302 | 303 | ||
| 303 | AppTradeOrderSettlementRespVO convert0(TradePriceCalculateRespBO calculate, AddressRespDTO address); | 304 | AppTradeOrderSettlementRespVO convert0(TradePriceCalculateRespBO calculate, AddressRespDTO address); |
| 304 | 305 | ||
| 305 | - | ||
| 306 | } | 306 | } |