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; /** * 手机 */