Commit 60172274ecaa925236a73d63e4599f4fd014142f
1 parent
5cfcaa1a
fix:合并代码后修改差异完善商品评论相关
Showing
13 changed files
with
212 additions
and
105 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/ProductCommentController.java
| @@ -46,7 +46,7 @@ public class ProductCommentController { | @@ -46,7 +46,7 @@ public class ProductCommentController { | ||
| 46 | @PutMapping("/reply") | 46 | @PutMapping("/reply") |
| 47 | @Operation(summary = "商家回复") | 47 | @Operation(summary = "商家回复") |
| 48 | @PreAuthorize("@ss.hasPermission('product:comment:update')") | 48 | @PreAuthorize("@ss.hasPermission('product:comment:update')") |
| 49 | - public CommonResult<Boolean> commentReply(@Valid @RequestBody ProductCommentReplyVO replyVO) { | 49 | + public CommonResult<Boolean> commentReply(@Valid @RequestBody ProductCommentReplyReqVO replyVO) { |
| 50 | productCommentService.replyComment(replyVO, getLoginUserId()); | 50 | productCommentService.replyComment(replyVO, getLoginUserId()); |
| 51 | return success(true); | 51 | return success(true); |
| 52 | } | 52 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentReplyVO.java renamed to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentReplyReqVO.java
| @@ -7,11 +7,10 @@ import lombok.ToString; | @@ -7,11 +7,10 @@ import lombok.ToString; | ||
| 7 | import javax.validation.constraints.NotEmpty; | 7 | import javax.validation.constraints.NotEmpty; |
| 8 | import javax.validation.constraints.NotNull; | 8 | import javax.validation.constraints.NotNull; |
| 9 | 9 | ||
| 10 | -// TODO @puhui999:ReqVO | ||
| 11 | @Schema(description = "管理后台 - 商品评价可见修改 Request VO") | 10 | @Schema(description = "管理后台 - 商品评价可见修改 Request VO") |
| 12 | @Data | 11 | @Data |
| 13 | @ToString(callSuper = true) | 12 | @ToString(callSuper = true) |
| 14 | -public class ProductCommentReplyVO { | 13 | +public class ProductCommentReplyReqVO { |
| 15 | 14 | ||
| 16 | @Schema(description = "评价编号", required = true, example = "15721") | 15 | @Schema(description = "评价编号", required = true, example = "15721") |
| 17 | @NotNull(message = "评价编号不能为空") | 16 | @NotNull(message = "评价编号不能为空") |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/AppProductCommentController.java
| 1 | package cn.iocoder.yudao.module.product.controller.app.comment; | 1 | package cn.iocoder.yudao.module.product.controller.app.comment; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.util.ObjectUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; | 5 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; |
| 7 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO; | 6 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO; |
| 8 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO; | 7 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO; |
| 9 | -import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; | 8 | +import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO; |
| 10 | import cn.iocoder.yudao.module.product.service.comment.ProductCommentService; | 9 | import cn.iocoder.yudao.module.product.service.comment.ProductCommentService; |
| 11 | import io.swagger.v3.oas.annotations.Operation; | 10 | import io.swagger.v3.oas.annotations.Operation; |
| 11 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 12 | +import io.swagger.v3.oas.annotations.Parameters; | ||
| 12 | import io.swagger.v3.oas.annotations.tags.Tag; | 13 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 13 | import org.springframework.validation.annotation.Validated; | 14 | import org.springframework.validation.annotation.Validated; |
| 14 | import org.springframework.web.bind.annotation.GetMapping; | 15 | import org.springframework.web.bind.annotation.GetMapping; |
| @@ -18,6 +19,11 @@ import org.springframework.web.bind.annotation.RestController; | @@ -18,6 +19,11 @@ import org.springframework.web.bind.annotation.RestController; | ||
| 18 | 19 | ||
| 19 | import javax.annotation.Resource; | 20 | import javax.annotation.Resource; |
| 20 | import javax.validation.Valid; | 21 | import javax.validation.Valid; |
| 22 | +import java.time.LocalDateTime; | ||
| 23 | +import java.util.ArrayList; | ||
| 24 | +import java.util.Arrays; | ||
| 25 | +import java.util.List; | ||
| 26 | +import java.util.Random; | ||
| 21 | 27 | ||
| 22 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 28 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 23 | 29 | ||
| @@ -30,17 +36,69 @@ public class AppProductCommentController { | @@ -30,17 +36,69 @@ public class AppProductCommentController { | ||
| 30 | @Resource | 36 | @Resource |
| 31 | private ProductCommentService productCommentService; | 37 | private ProductCommentService productCommentService; |
| 32 | 38 | ||
| 39 | + @GetMapping("/list") | ||
| 40 | + @Operation(summary = "获得最近的 n 条商品评价") | ||
| 41 | + @Parameters({ | ||
| 42 | + @Parameter(name = "spuId", description = "商品 SPU 编号", required = true, example = "1024"), | ||
| 43 | + @Parameter(name = "count", description = "数量", required = true, example = "10") | ||
| 44 | + }) | ||
| 45 | + public CommonResult<List<AppProductCommentRespVO>> getCommentList(@RequestParam("spuId") Long spuId, | ||
| 46 | + @RequestParam(value = "count", defaultValue = "10") Integer count) { | ||
| 47 | + | ||
| 48 | + List<AppProductPropertyValueDetailRespVO> list = new ArrayList<>(); | ||
| 49 | + | ||
| 50 | + AppProductPropertyValueDetailRespVO item1 = new AppProductPropertyValueDetailRespVO(); | ||
| 51 | + item1.setPropertyId(1L); | ||
| 52 | + item1.setPropertyName("颜色"); | ||
| 53 | + item1.setValueId(1024L); | ||
| 54 | + item1.setValueName("红色"); | ||
| 55 | + list.add(item1); | ||
| 56 | + | ||
| 57 | + AppProductPropertyValueDetailRespVO item2 = new AppProductPropertyValueDetailRespVO(); | ||
| 58 | + item2.setPropertyId(2L); | ||
| 59 | + item2.setPropertyName("尺寸"); | ||
| 60 | + item2.setValueId(2048L); | ||
| 61 | + item2.setValueName("大号"); | ||
| 62 | + list.add(item2); | ||
| 63 | + | ||
| 64 | + AppProductPropertyValueDetailRespVO item3 = new AppProductPropertyValueDetailRespVO(); | ||
| 65 | + item3.setPropertyId(3L); | ||
| 66 | + item3.setPropertyName("重量"); | ||
| 67 | + item3.setValueId(3072L); | ||
| 68 | + item3.setValueName("500克"); | ||
| 69 | + list.add(item3); | ||
| 70 | + | ||
| 71 | + // TODO 生成 mock 的数据 | ||
| 72 | + AppProductCommentRespVO appCommentRespVO = new AppProductCommentRespVO(); | ||
| 73 | + appCommentRespVO.setUserId((long) (new Random().nextInt(100000) + 10000)); | ||
| 74 | + appCommentRespVO.setUserNickname("用户" + new Random().nextInt(100)); | ||
| 75 | + appCommentRespVO.setUserAvatar("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); | ||
| 76 | + appCommentRespVO.setId((long) (new Random().nextInt(100000) + 10000)); | ||
| 77 | + appCommentRespVO.setAnonymous(new Random().nextBoolean()); | ||
| 78 | + appCommentRespVO.setOrderId((long) (new Random().nextInt(100000) + 10000)); | ||
| 79 | + appCommentRespVO.setOrderItemId((long) (new Random().nextInt(100000) + 10000)); | ||
| 80 | + appCommentRespVO.setReplyStatus(new Random().nextBoolean()); | ||
| 81 | + appCommentRespVO.setReplyUserId((long) (new Random().nextInt(100000) + 10000)); | ||
| 82 | + appCommentRespVO.setReplyContent("回复内容" + new Random().nextInt(100)); | ||
| 83 | + appCommentRespVO.setReplyTime(LocalDateTime.now().minusDays(new Random().nextInt(30))); | ||
| 84 | + appCommentRespVO.setCreateTime(LocalDateTime.now().minusDays(new Random().nextInt(30))); | ||
| 85 | + appCommentRespVO.setSpuId((long) (new Random().nextInt(100000) + 10000)); | ||
| 86 | + appCommentRespVO.setSpuName("商品" + new Random().nextInt(100)); | ||
| 87 | + appCommentRespVO.setSkuId((long) (new Random().nextInt(100000) + 10000)); | ||
| 88 | + appCommentRespVO.setSkuProperties(list); | ||
| 89 | + appCommentRespVO.setScores(new Random().nextInt(5) + 1); | ||
| 90 | + appCommentRespVO.setDescriptionScores(new Random().nextInt(5) + 1); | ||
| 91 | + appCommentRespVO.setBenefitScores(new Random().nextInt(5) + 1); | ||
| 92 | + appCommentRespVO.setContent("评论内容" + new Random().nextInt(100)); | ||
| 93 | + appCommentRespVO.setPicUrls(Arrays.asList("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg")); | ||
| 94 | + | ||
| 95 | + return success(Arrays.asList(appCommentRespVO)); | ||
| 96 | + } | ||
| 97 | + | ||
| 33 | @GetMapping("/page") | 98 | @GetMapping("/page") |
| 34 | @Operation(summary = "获得商品评价分页") | 99 | @Operation(summary = "获得商品评价分页") |
| 35 | public CommonResult<PageResult<AppProductCommentRespVO>> getCommentPage(@Valid AppCommentPageReqVO pageVO) { | 100 | public CommonResult<PageResult<AppProductCommentRespVO>> getCommentPage(@Valid AppCommentPageReqVO pageVO) { |
| 36 | - PageResult<AppProductCommentRespVO> result = productCommentService.getCommentPage(pageVO, Boolean.TRUE); | ||
| 37 | - result.getList().forEach(item -> { | ||
| 38 | - // 判断用户是否选择匿名 | ||
| 39 | - if (ObjectUtil.equal(item.getAnonymous(), true)) { | ||
| 40 | - item.setUserNickname(ProductCommentDO.NICKNAME_ANONYMOUS); | ||
| 41 | - } | ||
| 42 | - }); | ||
| 43 | - return success(result); | 101 | + return success(productCommentService.getCommentPage(pageVO, Boolean.TRUE)); |
| 44 | } | 102 | } |
| 45 | 103 | ||
| 46 | @GetMapping("/getCommentStatistics") | 104 | @GetMapping("/getCommentStatistics") |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentPageReqVO.java
| @@ -8,6 +8,11 @@ import lombok.ToString; | @@ -8,6 +8,11 @@ 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 | + */ | ||
| 11 | @Schema(description = "用户APP - 商品评价分页 Request VO") | 16 | @Schema(description = "用户APP - 商品评价分页 Request VO") |
| 12 | @Data | 17 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 18 | @EqualsAndHashCode(callSuper = true) |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppProductCommentBaseVO.java deleted
| 1 | -package cn.iocoder.yudao.module.product.controller.app.comment.vo; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO; | ||
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | -import lombok.Data; | ||
| 6 | - | ||
| 7 | -import javax.validation.constraints.NotNull; | ||
| 8 | -import javax.validation.constraints.Size; | ||
| 9 | -import java.util.List; | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * 商品评论 Base VO | ||
| 13 | - * | ||
| 14 | - * @author HUIHUI | ||
| 15 | - */ | ||
| 16 | -@Data | ||
| 17 | -public class AppProductCommentBaseVO { | ||
| 18 | - | ||
| 19 | - @Schema(description = "商品SPU编号", required = true, example = "91192") | ||
| 20 | - @NotNull(message = "商品SPU编号不能为空") | ||
| 21 | - private Long spuId; | ||
| 22 | - | ||
| 23 | - @Schema(description = "商品SPU名称", required = true, example = "清凉丝滑小短袖") | ||
| 24 | - @NotNull(message = "商品SPU名称不能为空") | ||
| 25 | - private String spuName; | ||
| 26 | - | ||
| 27 | - @Schema(description = "商品SKU编号", required = true, example = "81192") | ||
| 28 | - @NotNull(message = "商品SKU编号不能为空") | ||
| 29 | - private Long skuId; | ||
| 30 | - | ||
| 31 | - @Schema(description = "商品 SKU 属性", required = true) | ||
| 32 | - private List<AppProductPropertyValueDetailRespVO> skuProperties; // TODO puhui999:这个需要从数据库查询哈 | ||
| 33 | - | ||
| 34 | - @Schema(description = "评分星级 1-5分", required = true, example = "5") | ||
| 35 | - @NotNull(message = "评分星级 1-5分不能为空") | ||
| 36 | - private Integer scores; | ||
| 37 | - | ||
| 38 | - @Schema(description = "描述星级 1-5分", required = true, example = "5") | ||
| 39 | - @NotNull(message = "描述星级 1-5分不能为空") | ||
| 40 | - private Integer descriptionScores; | ||
| 41 | - | ||
| 42 | - @Schema(description = "服务星级 1-5分", required = true, example = "5") | ||
| 43 | - @NotNull(message = "服务星级 1-5分不能为空") | ||
| 44 | - private Integer benefitScores; | ||
| 45 | - | ||
| 46 | - @Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评") | ||
| 47 | - @NotNull(message = "评论内容不能为空") | ||
| 48 | - private String content; | ||
| 49 | - | ||
| 50 | - @Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]") | ||
| 51 | - @Size(max = 9, message = "评论图片地址数组长度不能超过9张") | ||
| 52 | - private List<String> picUrls; | ||
| 53 | - | ||
| 54 | -} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppProductCommentCreateReqVO.java
| @@ -2,17 +2,21 @@ package cn.iocoder.yudao.module.product.controller.app.comment.vo; | @@ -2,17 +2,21 @@ package cn.iocoder.yudao.module.product.controller.app.comment.vo; | ||
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | -import lombok.EqualsAndHashCode; | ||
| 6 | import lombok.ToString; | 5 | import lombok.ToString; |
| 7 | 6 | ||
| 8 | import javax.validation.constraints.NotNull; | 7 | import javax.validation.constraints.NotNull; |
| 8 | +import javax.validation.constraints.Size; | ||
| 9 | +import java.util.List; | ||
| 9 | 10 | ||
| 10 | -// TODO @puhui999:不应该继承 AppProductCommentCreateReqVO | 11 | +/** |
| 12 | + * 用户APP - 商品评价创建 Request VO | ||
| 13 | + * | ||
| 14 | + * @author HUIHUI | ||
| 15 | + */ | ||
| 11 | @Schema(description = "用户APP - 商品评价创建 Request VO") | 16 | @Schema(description = "用户APP - 商品评价创建 Request VO") |
| 12 | @Data | 17 | @Data |
| 13 | -@EqualsAndHashCode(callSuper = true) | ||
| 14 | @ToString(callSuper = true) | 18 | @ToString(callSuper = true) |
| 15 | -public class AppProductCommentCreateReqVO extends AppProductCommentBaseVO { | 19 | +public class AppProductCommentCreateReqVO { |
| 16 | 20 | ||
| 17 | @Schema(description = "是否匿名", required = true, example = "true") | 21 | @Schema(description = "是否匿名", required = true, example = "true") |
| 18 | @NotNull(message = "是否匿名不能为空") | 22 | @NotNull(message = "是否匿名不能为空") |
| @@ -22,4 +26,36 @@ public class AppProductCommentCreateReqVO extends AppProductCommentBaseVO { | @@ -22,4 +26,36 @@ public class AppProductCommentCreateReqVO extends AppProductCommentBaseVO { | ||
| 22 | @NotNull(message = "交易订单项编号不能为空") | 26 | @NotNull(message = "交易订单项编号不能为空") |
| 23 | private Long orderItemId; | 27 | private Long orderItemId; |
| 24 | 28 | ||
| 29 | + @Schema(description = "商品SPU编号", required = true, example = "91192") | ||
| 30 | + @NotNull(message = "商品SPU编号不能为空") | ||
| 31 | + private Long spuId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "商品SPU名称", required = true, example = "清凉丝滑小短袖") | ||
| 34 | + @NotNull(message = "商品SPU名称不能为空") | ||
| 35 | + private String spuName; | ||
| 36 | + | ||
| 37 | + @Schema(description = "商品SKU编号", required = true, example = "81192") | ||
| 38 | + @NotNull(message = "商品SKU编号不能为空") | ||
| 39 | + private Long skuId; | ||
| 40 | + | ||
| 41 | + @Schema(description = "评分星级 1-5分", required = true, example = "5") | ||
| 42 | + @NotNull(message = "评分星级 1-5分不能为空") | ||
| 43 | + private Integer scores; | ||
| 44 | + | ||
| 45 | + @Schema(description = "描述星级 1-5分", required = true, example = "5") | ||
| 46 | + @NotNull(message = "描述星级 1-5分不能为空") | ||
| 47 | + private Integer descriptionScores; | ||
| 48 | + | ||
| 49 | + @Schema(description = "服务星级 1-5分", required = true, example = "5") | ||
| 50 | + @NotNull(message = "服务星级 1-5分不能为空") | ||
| 51 | + private Integer benefitScores; | ||
| 52 | + | ||
| 53 | + @Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评") | ||
| 54 | + @NotNull(message = "评论内容不能为空") | ||
| 55 | + private String content; | ||
| 56 | + | ||
| 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张") | ||
| 59 | + private List<String> picUrls; | ||
| 60 | + | ||
| 25 | } | 61 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppProductCommentRespVO.java
| 1 | package cn.iocoder.yudao.module.product.controller.app.comment.vo; | 1 | package cn.iocoder.yudao.module.product.controller.app.comment.vo; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 5 | import lombok.Data; |
| 5 | -import lombok.EqualsAndHashCode; | ||
| 6 | import lombok.ToString; | 6 | import lombok.ToString; |
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | 8 | ||
| 9 | +import javax.validation.constraints.NotNull; | ||
| 10 | +import javax.validation.constraints.Size; | ||
| 9 | import java.time.LocalDateTime; | 11 | import java.time.LocalDateTime; |
| 10 | import java.util.List; | 12 | import java.util.List; |
| 11 | 13 | ||
| 12 | -@Schema(description = "用户APP - 商品评价 Response VO") | 14 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * 用户APP - 商品评价详情 Response VO | ||
| 18 | + * | ||
| 19 | + * @author HUIHUI | ||
| 20 | + */ | ||
| 21 | +@Schema(description = "用户APP - 商品评价详情 Response VO") | ||
| 13 | @Data | 22 | @Data |
| 14 | -@EqualsAndHashCode(callSuper = true) | ||
| 15 | @ToString(callSuper = true) | 23 | @ToString(callSuper = true) |
| 16 | -public class AppProductCommentRespVO extends AppProductCommentBaseVO { | 24 | +public class AppProductCommentRespVO { |
| 17 | 25 | ||
| 18 | @Schema(description = "评价人的用户编号", required = true, example = "15721") | 26 | @Schema(description = "评价人的用户编号", required = true, example = "15721") |
| 19 | private Long userId; | 27 | private Long userId; |
| @@ -63,4 +71,39 @@ public class AppProductCommentRespVO extends AppProductCommentBaseVO { | @@ -63,4 +71,39 @@ public class AppProductCommentRespVO extends AppProductCommentBaseVO { | ||
| 63 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 71 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 64 | private LocalDateTime createTime; | 72 | private LocalDateTime createTime; |
| 65 | 73 | ||
| 74 | + @Schema(description = "商品SPU编号", required = true, example = "91192") | ||
| 75 | + @NotNull(message = "商品SPU编号不能为空") | ||
| 76 | + private Long spuId; | ||
| 77 | + | ||
| 78 | + @Schema(description = "商品SPU名称", required = true, example = "清凉丝滑小短袖") | ||
| 79 | + @NotNull(message = "商品SPU名称不能为空") | ||
| 80 | + private String spuName; | ||
| 81 | + | ||
| 82 | + @Schema(description = "商品SKU编号", required = true, example = "81192") | ||
| 83 | + @NotNull(message = "商品SKU编号不能为空") | ||
| 84 | + private Long skuId; | ||
| 85 | + | ||
| 86 | + @Schema(description = "商品 SKU 属性", required = true) | ||
| 87 | + private List<AppProductPropertyValueDetailRespVO> skuProperties; | ||
| 88 | + | ||
| 89 | + @Schema(description = "评分星级 1-5分", required = true, example = "5") | ||
| 90 | + @NotNull(message = "评分星级 1-5分不能为空") | ||
| 91 | + private Integer scores; | ||
| 92 | + | ||
| 93 | + @Schema(description = "描述星级 1-5分", required = true, example = "5") | ||
| 94 | + @NotNull(message = "描述星级 1-5分不能为空") | ||
| 95 | + private Integer descriptionScores; | ||
| 96 | + | ||
| 97 | + @Schema(description = "服务星级 1-5分", required = true, example = "5") | ||
| 98 | + @NotNull(message = "服务星级 1-5分不能为空") | ||
| 99 | + private Integer benefitScores; | ||
| 100 | + | ||
| 101 | + @Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评") | ||
| 102 | + @NotNull(message = "评论内容不能为空") | ||
| 103 | + private String content; | ||
| 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张") | ||
| 107 | + private List<String> picUrls; | ||
| 108 | + | ||
| 66 | } | 109 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java
| @@ -6,7 +6,9 @@ import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommen | @@ -6,7 +6,9 @@ import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommen | ||
| 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; |
| 8 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO; | 8 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO; |
| 9 | +import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO; | ||
| 9 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; | 10 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; |
| 11 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | ||
| 10 | import org.mapstruct.Mapper; | 12 | import org.mapstruct.Mapper; |
| 11 | import org.mapstruct.Mapping; | 13 | import org.mapstruct.Mapping; |
| 12 | import org.mapstruct.Named; | 14 | import org.mapstruct.Named; |
| @@ -36,6 +38,8 @@ public interface ProductCommentConvert { | @@ -36,6 +38,8 @@ public interface ProductCommentConvert { | ||
| 36 | 38 | ||
| 37 | List<ProductCommentRespVO> convertList(List<ProductCommentDO> list); | 39 | List<ProductCommentRespVO> convertList(List<ProductCommentDO> list); |
| 38 | 40 | ||
| 41 | + List<AppProductPropertyValueDetailRespVO> convertList01(List<ProductSkuDO.Property> properties); | ||
| 42 | + | ||
| 39 | PageResult<ProductCommentRespVO> convertPage(PageResult<ProductCommentDO> page); | 43 | PageResult<ProductCommentRespVO> convertPage(PageResult<ProductCommentDO> page); |
| 40 | 44 | ||
| 41 | PageResult<AppProductCommentRespVO> convertPage02(PageResult<ProductCommentDO> pageResult); | 45 | PageResult<AppProductCommentRespVO> convertPage02(PageResult<ProductCommentDO> pageResult); |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/comment/ProductCommentMapper.java
| @@ -6,14 +6,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -6,14 +6,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 7 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 7 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 8 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; | 8 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; |
| 9 | -import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyVO; | ||
| 10 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; | 9 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; |
| 11 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; | 10 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; |
| 12 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||
| 13 | import org.apache.ibatis.annotations.Mapper; | 11 | import org.apache.ibatis.annotations.Mapper; |
| 14 | 12 | ||
| 15 | -import java.time.LocalDateTime; | ||
| 16 | - | ||
| 17 | @Mapper | 13 | @Mapper |
| 18 | public interface ProductCommentMapper extends BaseMapperX<ProductCommentDO> { | 14 | public interface ProductCommentMapper extends BaseMapperX<ProductCommentDO> { |
| 19 | 15 | ||
| @@ -55,23 +51,6 @@ public interface ProductCommentMapper extends BaseMapperX<ProductCommentDO> { | @@ -55,23 +51,6 @@ public interface ProductCommentMapper extends BaseMapperX<ProductCommentDO> { | ||
| 55 | return selectPage(reqVO, queryWrapper); | 51 | return selectPage(reqVO, queryWrapper); |
| 56 | } | 52 | } |
| 57 | 53 | ||
| 58 | - default void updateCommentVisible(Long id, Boolean visible) { | ||
| 59 | - LambdaUpdateWrapper<ProductCommentDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<ProductCommentDO>() | ||
| 60 | - .set(ProductCommentDO::getVisible, visible) | ||
| 61 | - .eq(ProductCommentDO::getId, id); | ||
| 62 | - update(null, lambdaUpdateWrapper); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - default void commentReply(ProductCommentReplyVO replyVO, Long loginUserId) { | ||
| 66 | - LambdaUpdateWrapper<ProductCommentDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<ProductCommentDO>() | ||
| 67 | - .set(ProductCommentDO::getReplyStatus, Boolean.TRUE) | ||
| 68 | - .set(ProductCommentDO::getReplyTime, LocalDateTime.now()) | ||
| 69 | - .set(ProductCommentDO::getReplyUserId, loginUserId) | ||
| 70 | - .set(ProductCommentDO::getReplyContent, replyVO.getReplyContent()) | ||
| 71 | - .eq(ProductCommentDO::getId, replyVO.getId()); | ||
| 72 | - update(null, lambdaUpdateWrapper); | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | default ProductCommentDO selectByUserIdAndOrderIdAndSpuId(Long userId, Long orderId, Long spuId) { | 54 | default ProductCommentDO selectByUserIdAndOrderIdAndSpuId(Long userId, Long orderId, Long spuId) { |
| 76 | return selectOne(new LambdaQueryWrapperX<ProductCommentDO>() | 55 | return selectOne(new LambdaQueryWrapperX<ProductCommentDO>() |
| 77 | .eq(ProductCommentDO::getUserId, userId) | 56 | .eq(ProductCommentDO::getUserId, userId) |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentService.java
| @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.product.service.comment; | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.product.service.comment; | ||
| 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.controller.admin.comment.vo.ProductCommentCreateReqVO; | 4 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO; |
| 5 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; | 5 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; |
| 6 | -import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyVO; | 6 | +import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO; |
| 7 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO; | 7 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO; |
| 8 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; | 8 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; |
| 9 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO; | 9 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO; |
| @@ -36,15 +36,13 @@ public interface ProductCommentService { | @@ -36,15 +36,13 @@ public interface ProductCommentService { | ||
| 36 | */ | 36 | */ |
| 37 | void updateCommentVisible(ProductCommentUpdateVisibleReqVO updateReqVO); | 37 | void updateCommentVisible(ProductCommentUpdateVisibleReqVO updateReqVO); |
| 38 | 38 | ||
| 39 | - // TODO @puhui999:replyComment | ||
| 40 | - | ||
| 41 | /** | 39 | /** |
| 42 | * 商家回复 | 40 | * 商家回复 |
| 43 | * | 41 | * |
| 44 | * @param replyVO 商家回复 | 42 | * @param replyVO 商家回复 |
| 45 | * @param loginUserId 管理后台商家登陆人 ID | 43 | * @param loginUserId 管理后台商家登陆人 ID |
| 46 | */ | 44 | */ |
| 47 | - void replyComment(ProductCommentReplyVO replyVO, Long loginUserId); | 45 | + void replyComment(ProductCommentReplyReqVO replyVO, Long loginUserId); |
| 48 | 46 | ||
| 49 | /** | 47 | /** |
| 50 | * 获得商品评价分页 | 48 | * 获得商品评价分页 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImpl.java
| 1 | package cn.iocoder.yudao.module.product.service.comment; | 1 | package cn.iocoder.yudao.module.product.service.comment; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.util.ObjectUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO; | 6 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO; |
| 5 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; | 7 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; |
| 6 | -import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyVO; | 8 | +import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO; |
| 7 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO; | 9 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO; |
| 8 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; | 10 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; |
| 9 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO; | 11 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO; |
| 10 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO; | 12 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO; |
| 13 | +import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO; | ||
| 11 | import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert; | 14 | import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert; |
| 12 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; | 15 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; |
| 16 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | ||
| 13 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | 17 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 14 | import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; | 18 | import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; |
| 19 | +import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; | ||
| 15 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; | 20 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; |
| 16 | import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi; | 21 | import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi; |
| 22 | +import org.springframework.context.annotation.Lazy; | ||
| 17 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
| 18 | import org.springframework.transaction.annotation.Transactional; | 24 | import org.springframework.transaction.annotation.Transactional; |
| 19 | import org.springframework.validation.annotation.Validated; | 25 | import org.springframework.validation.annotation.Validated; |
| 20 | 26 | ||
| 21 | import javax.annotation.Resource; | 27 | import javax.annotation.Resource; |
| 22 | import java.time.LocalDateTime; | 28 | import java.time.LocalDateTime; |
| 29 | +import java.util.HashMap; | ||
| 30 | +import java.util.List; | ||
| 31 | +import java.util.Map; | ||
| 32 | +import java.util.Set; | ||
| 33 | +import java.util.stream.Collectors; | ||
| 23 | 34 | ||
| 24 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 35 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 25 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; | 36 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; |
| @@ -42,6 +53,10 @@ public class ProductCommentServiceImpl implements ProductCommentService { | @@ -42,6 +53,10 @@ public class ProductCommentServiceImpl implements ProductCommentService { | ||
| 42 | @Resource | 53 | @Resource |
| 43 | private ProductSpuService productSpuService; | 54 | private ProductSpuService productSpuService; |
| 44 | 55 | ||
| 56 | + @Resource | ||
| 57 | + @Lazy | ||
| 58 | + private ProductSkuService productSkuService; | ||
| 59 | + | ||
| 45 | @Override | 60 | @Override |
| 46 | @Transactional(rollbackFor = Exception.class) | 61 | @Transactional(rollbackFor = Exception.class) |
| 47 | public void updateCommentVisible(ProductCommentUpdateVisibleReqVO updateReqVO) { | 62 | public void updateCommentVisible(ProductCommentUpdateVisibleReqVO updateReqVO) { |
| @@ -55,7 +70,7 @@ public class ProductCommentServiceImpl implements ProductCommentService { | @@ -55,7 +70,7 @@ public class ProductCommentServiceImpl implements ProductCommentService { | ||
| 55 | 70 | ||
| 56 | @Override | 71 | @Override |
| 57 | @Transactional(rollbackFor = Exception.class) | 72 | @Transactional(rollbackFor = Exception.class) |
| 58 | - public void replyComment(ProductCommentReplyVO replyVO, Long loginUserId) { | 73 | + public void replyComment(ProductCommentReplyReqVO replyVO, Long loginUserId) { |
| 59 | // 校验评论是否存在 | 74 | // 校验评论是否存在 |
| 60 | ProductCommentDO productCommentDO = validateCommentExists(replyVO.getId()); | 75 | ProductCommentDO productCommentDO = validateCommentExists(replyVO.getId()); |
| 61 | productCommentDO.setReplyTime(LocalDateTime.now()); | 76 | productCommentDO.setReplyTime(LocalDateTime.now()); |
| @@ -127,7 +142,26 @@ public class ProductCommentServiceImpl implements ProductCommentService { | @@ -127,7 +142,26 @@ public class ProductCommentServiceImpl implements ProductCommentService { | ||
| 127 | 142 | ||
| 128 | @Override | 143 | @Override |
| 129 | public PageResult<AppProductCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible) { | 144 | public PageResult<AppProductCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible) { |
| 130 | - return ProductCommentConvert.INSTANCE.convertPage02(productCommentMapper.selectPage(pageVO, visible)); | 145 | + PageResult<AppProductCommentRespVO> result = ProductCommentConvert.INSTANCE.convertPage02( |
| 146 | + productCommentMapper.selectPage(pageVO, visible)); | ||
| 147 | + Set<Long> skuIds = result.getList().stream().map(AppProductCommentRespVO::getSkuId).collect(Collectors.toSet()); | ||
| 148 | + List<ProductSkuDO> skuList = productSkuService.getSkuList(skuIds); | ||
| 149 | + Map<Long, ProductSkuDO> skuDOMap = new HashMap<>(skuIds.size()); | ||
| 150 | + if (CollUtil.isNotEmpty(skuList)) { | ||
| 151 | + skuDOMap.putAll(skuList.stream().collect(Collectors.toMap(ProductSkuDO::getId, c -> c))); | ||
| 152 | + } | ||
| 153 | + result.getList().forEach(item -> { | ||
| 154 | + // 判断用户是否选择匿名 | ||
| 155 | + if (ObjectUtil.equal(item.getAnonymous(), true)) { | ||
| 156 | + item.setUserNickname(ProductCommentDO.NICKNAME_ANONYMOUS); | ||
| 157 | + } | ||
| 158 | + ProductSkuDO productSkuDO = skuDOMap.get(item.getSkuId()); | ||
| 159 | + if (productSkuDO != null) { | ||
| 160 | + List<AppProductPropertyValueDetailRespVO> skuProperties = ProductCommentConvert.INSTANCE.convertList01(productSkuDO.getProperties()); | ||
| 161 | + item.setSkuProperties(skuProperties); | ||
| 162 | + } | ||
| 163 | + }); | ||
| 164 | + return result; | ||
| 131 | } | 165 | } |
| 132 | 166 | ||
| 133 | @Override | 167 | @Override |
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImplTest.java
| @@ -5,7 +5,7 @@ import cn.hutool.core.util.RandomUtil; | @@ -5,7 +5,7 @@ import cn.hutool.core.util.RandomUtil; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 6 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 7 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; | 7 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; |
| 8 | -import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyVO; | 8 | +import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO; |
| 9 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO; | 9 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO; |
| 10 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO; | 10 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO; |
| 11 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; | 11 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; |
| @@ -15,6 +15,7 @@ import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert; | @@ -15,6 +15,7 @@ import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert; | ||
| 15 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; | 15 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; |
| 16 | import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; | 16 | import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; |
| 17 | import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum; | 17 | import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum; |
| 18 | +import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; | ||
| 18 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; | 19 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; |
| 19 | import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi; | 20 | import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi; |
| 20 | import org.junit.jupiter.api.Test; | 21 | import org.junit.jupiter.api.Test; |
| @@ -52,6 +53,8 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | @@ -52,6 +53,8 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | ||
| 52 | private TradeOrderApi tradeOrderApi; | 53 | private TradeOrderApi tradeOrderApi; |
| 53 | @MockBean | 54 | @MockBean |
| 54 | private ProductSpuService productSpuService; | 55 | private ProductSpuService productSpuService; |
| 56 | + @MockBean | ||
| 57 | + private ProductSkuService productSkuService; | ||
| 55 | 58 | ||
| 56 | public String generateNo() { | 59 | public String generateNo() { |
| 57 | return DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomInt(100000, 999999); | 60 | return DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomInt(100000, 999999); |
| @@ -183,7 +186,7 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | @@ -183,7 +186,7 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | ||
| 183 | 186 | ||
| 184 | Long productCommentId = productComment.getId(); | 187 | Long productCommentId = productComment.getId(); |
| 185 | 188 | ||
| 186 | - ProductCommentReplyVO replyVO = new ProductCommentReplyVO(); | 189 | + ProductCommentReplyReqVO replyVO = new ProductCommentReplyReqVO(); |
| 187 | replyVO.setId(productCommentId); | 190 | replyVO.setId(productCommentId); |
| 188 | replyVO.setReplyContent("测试"); | 191 | replyVO.setReplyContent("测试"); |
| 189 | productCommentService.replyComment(replyVO, 1L); | 192 | productCommentService.replyComment(replyVO, 1L); |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java
| @@ -148,4 +148,6 @@ public class AppTradeOrderController { | @@ -148,4 +148,6 @@ public class AppTradeOrderController { | ||
| 148 | return success(productCommentApi.createComment(TradeOrderConvert.INSTANCE.convert04(createReqVO), item.getOrderId())); | 148 | return success(productCommentApi.createComment(TradeOrderConvert.INSTANCE.convert04(createReqVO), item.getOrderId())); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | + // TODO 合并代码后发现只有商家回复功能 用户追评不要了吗? | ||
| 152 | + | ||
| 151 | } | 153 | } |