From 38d7d75f7f13edba2ad169fad6abaf56e870a5f9 Mon Sep 17 00:00:00 2001 From: wangzhs Date: Thu, 23 Mar 2023 14:06:14 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E][=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=AF=84=E4=BB=B7]=E7=AE=A1=E7=90=86=E5=90=8E=E5=8F=B0/APP?= =?UTF-8?q?=E7=AB=AF=201.=20=E5=A2=9E=E5=8A=A0=E5=A4=B4=E5=83=8F=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=AD=97=E6=AE=B5=202.=20=E8=B0=83=E6=95=B4=E5=95=86?= =?UTF-8?q?=E6=88=B7=E8=87=AA=E8=AF=84userId=203.=20=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=9B=BE=E7=89=87=E6=95=B0=E9=87=8F=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/comment/vo/ProductCommentBaseVO.java | 7 ++----- .../controller/admin/comment/vo/ProductCommentRespVO.java | 5 ++++- .../controller/app/comment/AppCommentController.java | 1 - .../app/comment/vo/AppCommentAdditionalReqVO.java | 3 ++- .../controller/app/comment/vo/AppCommentBaseVO.java | 3 ++- .../product/convert/comment/ProductCommentConvert.java | 5 ++--- .../module/member/api/user/dto/MemberUserRespDTO.java | 5 ++++- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentBaseVO.java index 45abd3adc..19dae8777 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentBaseVO.java @@ -4,15 +4,12 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import java.util.List; @Data public class ProductCommentBaseVO { - @Schema(description = "评价人 用户编号", required = true, example = "15721") - @NotNull(message = "评价人 用户编号不能为空") - private Long userId; - @Schema(description = "评价人名称", required = true, example = "张三") @NotNull(message = "评价人名称不能为空") private String userNickname; @@ -54,7 +51,7 @@ public class ProductCommentBaseVO { private String content; @Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true) - @NotNull(message = "评论图片地址数组,以逗号分隔最多上传9张不能为空") + @Size(max = 9, message = "评论图片地址数组长度不能超过9张") private List picUrls; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentRespVO.java index b934c1bf3..8568b4f8c 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentRespVO.java @@ -17,12 +17,15 @@ public class ProductCommentRespVO extends ProductCommentBaseVO { @Schema(description = "订单项编号", required = true, example = "24965") private Long id; - @Schema(description = "是否匿名:[0:不匿名 1:匿名]", required = true) + @Schema(description = "是否匿名:[false:不匿名 true:匿名]", required = true) private Boolean anonymous; @Schema(description = "交易订单编号", required = true, example = "24428") private Long orderId; + @Schema(description = "评价人 用户编号", required = true, example = "15721") + private Long userId; + @Schema(description = "交易订单项编号", required = true, example = "8233") private Long orderItemId; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/AppCommentController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/AppCommentController.java index 9e5e64550..a5621c57a 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/AppCommentController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/AppCommentController.java @@ -44,7 +44,6 @@ public class AppCommentController { @PostMapping(value = "/create") @Operation(summary = "创建商品评价") public CommonResult createComment(@RequestBody AppCommentCreateReqVO createReqVO) { - // 查询会员 todo@艿艿 获取用户头像 // TODO: 2023/3/20 要不要判断订单、商品是否存在 MemberUserRespDTO user = memberUserApi.getUser(getLoginUserId()); productCommentService.createComment(ProductCommentConvert.INSTANCE.convert(user, createReqVO), Boolean.FALSE); diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentAdditionalReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentAdditionalReqVO.java index 2b10b85a2..b989a867d 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentAdditionalReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentAdditionalReqVO.java @@ -5,6 +5,7 @@ import lombok.Data; import lombok.ToString; import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import java.util.List; @Schema(description = "用户APP - 商品追加评价创建 Request VO") @@ -21,7 +22,7 @@ public class AppCommentAdditionalReqVO { private String additionalContent; @Schema(description = "追评评价图片地址数组,以逗号分隔最多上传9张", required = true) - @NotNull(message = "追评评价图片地址数组,以逗号分隔最多上传9张不能为空") + @Size(max = 9, message = "追评评价图片地址数组长度不能超过9张") private List additionalPicUrls; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentBaseVO.java index 49803c4b1..59716b5a6 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentBaseVO.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import java.util.List; @Data @@ -42,7 +43,7 @@ public class AppCommentBaseVO { private String content; @Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true) - @NotNull(message = "评论图片地址数组,以逗号分隔最多上传9张不能为空") + @Size(max = 9, message = "评论图片地址数组长度不能超过9张") private List picUrls; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java index dd88fadcd..a0f5b154d 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java @@ -34,7 +34,7 @@ public interface ProductCommentConvert { ProductCommentDO productComment = new ProductCommentDO(); productComment.setUserId(user.getId()); productComment.setUserNickname(user.getNickname()); -// productComment.setUserAvatar(); + productComment.setUserAvatar(user.getAvatar()); productComment.setAnonymous(createReqVO.getAnonymous()); productComment.setOrderId(createReqVO.getOrderId()); productComment.setOrderItemId(createReqVO.getOrderItemId()); @@ -52,11 +52,10 @@ public interface ProductCommentConvert { default ProductCommentDO convert(ProductCommentCreateReqVO createReq) { ProductCommentDO productComment = new ProductCommentDO(); - productComment.setUserId(createReq.getUserId()); + productComment.setUserId(0L); productComment.setUserNickname(createReq.getUserNickname()); productComment.setUserAvatar(createReq.getUserAvatar()); productComment.setAnonymous(Boolean.FALSE); - // TODO: 2023/3/21 自评订单ID来源 productComment.setOrderId(0L); productComment.setOrderItemId(0L); productComment.setSpuId(createReq.getSpuId()); diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/dto/MemberUserRespDTO.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/dto/MemberUserRespDTO.java index 7b2bac0c9..10d96365f 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/dto/MemberUserRespDTO.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/dto/MemberUserRespDTO.java @@ -25,7 +25,10 @@ public class MemberUserRespDTO { * 枚举 {@link CommonStatusEnum} */ private Integer status; - + /** + * 用户头像 + */ + private String avatar; /** * 手机 */