commit
08535d6019
|
@ -0,0 +1,21 @@
|
||||||
|
package cn.iocoder.yudao.module.product.api.comment;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.product.api.comment.dto.CommentCreateReqDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品评论 API 接口
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
public interface ProductCommentApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建评论
|
||||||
|
*
|
||||||
|
* @param createReqDTO 评论参数
|
||||||
|
* @param orderId 订单 id
|
||||||
|
* @return 返回评论创建后的 id
|
||||||
|
*/
|
||||||
|
Long createComment(CommentCreateReqDTO createReqDTO, Long orderId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package cn.iocoder.yudao.module.product.api.comment.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论创建请求 DTO
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CommentCreateReqDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否匿名
|
||||||
|
*/
|
||||||
|
private Boolean anonymous;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易订单项编号
|
||||||
|
*/
|
||||||
|
private Long orderItemId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品 SPU 编号
|
||||||
|
*/
|
||||||
|
private Long spuId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品 SPU 名称
|
||||||
|
*/
|
||||||
|
private String spuName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品 SKU 编号
|
||||||
|
*/
|
||||||
|
private Long skuId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评分星级 1-5 分
|
||||||
|
*/
|
||||||
|
private Integer scores;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述星级 1-5 分
|
||||||
|
*/
|
||||||
|
private Integer descriptionScores;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务星级 1-5 分
|
||||||
|
*/
|
||||||
|
private Integer benefitScores;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论图片地址数组,以逗号分隔最多上传9张
|
||||||
|
*/
|
||||||
|
private List<String> picUrls;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评价人名称
|
||||||
|
*/
|
||||||
|
private String userNickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评价人头像
|
||||||
|
*/
|
||||||
|
private String userAvatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评价人
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.iocoder.yudao.module.product.api.comment;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.product.api.comment.dto.CommentCreateReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert;
|
||||||
|
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
||||||
|
import cn.iocoder.yudao.module.product.service.comment.ProductCommentService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品评论 API 实现类
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class ProductCommentApiImpl implements ProductCommentApi {
|
||||||
|
@Resource
|
||||||
|
private ProductCommentService productCommentService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createComment(CommentCreateReqDTO createReqDTO, Long orderId) {
|
||||||
|
ProductCommentDO commentDO = ProductCommentConvert.INSTANCE.convert(createReqDTO, orderId);
|
||||||
|
return productCommentService.createComment(commentDO);
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,8 +35,7 @@ public class ProductCommentController {
|
||||||
return success(ProductCommentConvert.INSTANCE.convertPage(pageResult));
|
return success(ProductCommentConvert.INSTANCE.convertPage(pageResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:update-visible
|
@PutMapping("/update-visible")
|
||||||
@PutMapping("/update/visible")
|
|
||||||
@Operation(summary = "显示 / 隐藏评论")
|
@Operation(summary = "显示 / 隐藏评论")
|
||||||
@PreAuthorize("@ss.hasPermission('product:comment:update')")
|
@PreAuthorize("@ss.hasPermission('product:comment:update')")
|
||||||
public CommonResult<Boolean> updateCommentVisible(@Valid @RequestBody ProductCommentUpdateVisibleReqVO updateReqVO) {
|
public CommonResult<Boolean> updateCommentVisible(@Valid @RequestBody ProductCommentUpdateVisibleReqVO updateReqVO) {
|
||||||
|
@ -47,8 +46,8 @@ public class ProductCommentController {
|
||||||
@PutMapping("/reply")
|
@PutMapping("/reply")
|
||||||
@Operation(summary = "商家回复")
|
@Operation(summary = "商家回复")
|
||||||
@PreAuthorize("@ss.hasPermission('product:comment:update')")
|
@PreAuthorize("@ss.hasPermission('product:comment:update')")
|
||||||
public CommonResult<Boolean> commentReply(@Valid @RequestBody ProductCommentReplyVO replyVO) {
|
public CommonResult<Boolean> commentReply(@Valid @RequestBody ProductCommentReplyReqVO replyVO) {
|
||||||
productCommentService.commentReply(replyVO, getLoginUserId());
|
productCommentService.replyComment(replyVO, getLoginUserId());
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +55,7 @@ public class ProductCommentController {
|
||||||
@Operation(summary = "添加自评")
|
@Operation(summary = "添加自评")
|
||||||
@PreAuthorize("@ss.hasPermission('product:comment:update')")
|
@PreAuthorize("@ss.hasPermission('product:comment:update')")
|
||||||
public CommonResult<Boolean> createComment(@Valid @RequestBody ProductCommentCreateReqVO createReqVO) {
|
public CommonResult<Boolean> createComment(@Valid @RequestBody ProductCommentCreateReqVO createReqVO) {
|
||||||
// TODO @puhui999:不用 ProductCommentConvert.INSTANCE.convert(createReqVO) 哈;多写一个 create 方法即可;
|
productCommentService.createComment(createReqVO);
|
||||||
productCommentService.createComment(ProductCommentConvert.INSTANCE.convert(createReqVO), Boolean.TRUE);
|
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,17 +10,15 @@ import java.util.List;
|
||||||
@Data
|
@Data
|
||||||
public class ProductCommentBaseVO {
|
public class ProductCommentBaseVO {
|
||||||
|
|
||||||
// TODO @puhui999:把 example 补充下
|
@Schema(description = "评价人名称", required = true, example = "小姑凉")
|
||||||
|
|
||||||
@Schema(description = "评价人名称", required = true, example = "张三")
|
|
||||||
@NotNull(message = "评价人名称不能为空")
|
@NotNull(message = "评价人名称不能为空")
|
||||||
private String userNickname;
|
private String userNickname;
|
||||||
|
|
||||||
@Schema(description = "评价人头像", required = true)
|
@Schema(description = "评价人头像", required = true, example = "https://www.iocoder.cn/xx.png")
|
||||||
@NotNull(message = "评价人头像不能为空")
|
@NotNull(message = "评价人头像不能为空")
|
||||||
private String userAvatar;
|
private String userAvatar;
|
||||||
|
|
||||||
@Schema(description = "商品 SPU 编号", required = true, example = "29502")
|
@Schema(description = "商品 SPU 编号", required = true, example = "清凉丝滑透气小短袖")
|
||||||
@NotNull(message = "商品 SPU 编号不能为空")
|
@NotNull(message = "商品 SPU 编号不能为空")
|
||||||
private Long spuId;
|
private Long spuId;
|
||||||
|
|
||||||
|
@ -28,27 +26,27 @@ public class ProductCommentBaseVO {
|
||||||
@NotNull(message = "商品 SPU 名称不能为空")
|
@NotNull(message = "商品 SPU 名称不能为空")
|
||||||
private String spuName;
|
private String spuName;
|
||||||
|
|
||||||
@Schema(description = "商品 SKU 编号", required = true, example = "3082")
|
@Schema(description = "商品 SKU 编号", required = true, example = "1")
|
||||||
@NotNull(message = "商品 SKU 编号不能为空")
|
@NotNull(message = "商品 SKU 编号不能为空")
|
||||||
private Long skuId;
|
private Long skuId;
|
||||||
|
|
||||||
@Schema(description = "评分星级 1-5分", required = true)
|
@Schema(description = "评分星级 1-5分", required = true, example = "5")
|
||||||
@NotNull(message = "评分星级不能为空")
|
@NotNull(message = "评分星级不能为空")
|
||||||
private Integer scores;
|
private Integer scores;
|
||||||
|
|
||||||
@Schema(description = "描述星级 1-5分", required = true)
|
@Schema(description = "描述星级 1-5分", required = true, example = "5")
|
||||||
@NotNull(message = "描述星级不能为空")
|
@NotNull(message = "描述星级不能为空")
|
||||||
private Integer descriptionScores;
|
private Integer descriptionScores;
|
||||||
|
|
||||||
@Schema(description = "服务星级 1-5分", required = true)
|
@Schema(description = "服务星级 1-5分", required = true, example = "5")
|
||||||
@NotNull(message = "服务星级分不能为空")
|
@NotNull(message = "服务星级分不能为空")
|
||||||
private Integer benefitScores;
|
private Integer benefitScores;
|
||||||
|
|
||||||
@Schema(description = "评论内容", required = true)
|
@Schema(description = "评论内容", required = true, example = "穿起来非常丝滑凉快")
|
||||||
@NotNull(message = "评论内容不能为空")
|
@NotNull(message = "评论内容不能为空")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
@Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true)
|
@Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
|
||||||
@Size(max = 9, message = "评论图片地址数组长度不能超过9张")
|
@Size(max = 9, message = "评论图片地址数组长度不能超过9张")
|
||||||
private List<String> picUrls;
|
private List<String> picUrls;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package cn.iocoder.yudao.module.product.controller.admin.comment.vo;
|
package cn.iocoder.yudao.module.product.controller.admin.comment.vo;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 商品评价创建 Request VO")
|
@Schema(description = "管理后台 - 商品评价创建 Request VO")
|
||||||
@Data
|
@Data
|
||||||
|
@ -9,4 +13,12 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class ProductCommentCreateReqVO extends ProductCommentBaseVO {
|
public class ProductCommentCreateReqVO extends ProductCommentBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "评价人", required = true, example = "16868")
|
||||||
|
@NotNull(message = "评价人不能为空")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "评价订单项", required = true, example = "19292")
|
||||||
|
@NotNull(message = "评价订单项不能为空")
|
||||||
|
private Long orderItemId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,11 @@ public class ProductCommentPageReqVO extends PageParam {
|
||||||
@Schema(description = "商品SPU名称", example = "感冒药")
|
@Schema(description = "商品SPU名称", example = "感冒药")
|
||||||
private String spuName;
|
private String spuName;
|
||||||
|
|
||||||
@Schema(description = "评分星级 1-5分")
|
@Schema(description = "评分星级 1-5分", example = "5")
|
||||||
@InEnum(ProductCommentScoresEnum.class)
|
@InEnum(ProductCommentScoresEnum.class)
|
||||||
private Integer scores;
|
private Integer scores;
|
||||||
|
|
||||||
@Schema(description = "商家是否回复")
|
@Schema(description = "商家是否回复", example = "true")
|
||||||
private Boolean replied;
|
private Boolean replied;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
|
|
|
@ -7,11 +7,10 @@ import lombok.ToString;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
// TODO @puhui999:ReqVO
|
|
||||||
@Schema(description = "管理后台 - 商品评价可见修改 Request VO")
|
@Schema(description = "管理后台 - 商品评价可见修改 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class ProductCommentReplyVO {
|
public class ProductCommentReplyReqVO {
|
||||||
|
|
||||||
@Schema(description = "评价编号", required = true, example = "15721")
|
@Schema(description = "评价编号", required = true, example = "15721")
|
||||||
@NotNull(message = "评价编号不能为空")
|
@NotNull(message = "评价编号不能为空")
|
|
@ -16,7 +16,7 @@ public class ProductCommentRespVO extends ProductCommentBaseVO {
|
||||||
@Schema(description = "订单项编号", required = true, example = "24965")
|
@Schema(description = "订单项编号", required = true, example = "24965")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "是否匿名:[false:不匿名 true:匿名]", required = true)
|
@Schema(description = "是否匿名:[false:不匿名 true:匿名]", required = true, example = "false")
|
||||||
private Boolean anonymous;
|
private Boolean anonymous;
|
||||||
|
|
||||||
@Schema(description = "交易订单编号", required = true, example = "24428")
|
@Schema(description = "交易订单编号", required = true, example = "24428")
|
||||||
|
|
|
@ -1,51 +1,48 @@
|
||||||
package cn.iocoder.yudao.module.product.controller.app.comment;
|
package cn.iocoder.yudao.module.product.controller.app.comment;
|
||||||
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentCreateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentRespVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO;
|
||||||
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO;
|
import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO;
|
||||||
import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert;
|
|
||||||
import cn.iocoder.yudao.module.product.service.comment.ProductCommentService;
|
import cn.iocoder.yudao.module.product.service.comment.ProductCommentService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
||||||
|
|
||||||
// TODO @puhui999:AppCommentController =》 AppProductCommentController
|
|
||||||
@Tag(name = "用户 APP - 商品评价")
|
@Tag(name = "用户 APP - 商品评价")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/product/comment")
|
@RequestMapping("/product/comment")
|
||||||
@Validated
|
@Validated
|
||||||
public class AppCommentController {
|
public class AppProductCommentController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ProductCommentService productCommentService;
|
private ProductCommentService productCommentService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MemberUserApi memberUserApi;
|
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获得最近的 n 条商品评价")
|
@Operation(summary = "获得最近的 n 条商品评价")
|
||||||
@Parameters({
|
@Parameters({
|
||||||
@Parameter(name = "spuId", description = "商品 SPU 编号", required = true, example = "1024"),
|
@Parameter(name = "spuId", description = "商品 SPU 编号", required = true, example = "1024"),
|
||||||
@Parameter(name = "count", description = "数量", required = true, example = "10")
|
@Parameter(name = "count", description = "数量", required = true, example = "10")
|
||||||
})
|
})
|
||||||
public CommonResult<List<AppCommentRespVO>> getCommentList(@RequestParam("spuId") Long spuId,
|
public CommonResult<List<AppProductCommentRespVO>> getCommentList(@RequestParam("spuId") Long spuId,
|
||||||
@RequestParam(value = "count", defaultValue = "10") Integer count) {
|
@RequestParam(value = "count", defaultValue = "10") Integer count) {
|
||||||
|
|
||||||
List<AppProductPropertyValueDetailRespVO> list = new ArrayList<>();
|
List<AppProductPropertyValueDetailRespVO> list = new ArrayList<>();
|
||||||
|
@ -72,7 +69,7 @@ public class AppCommentController {
|
||||||
list.add(item3);
|
list.add(item3);
|
||||||
|
|
||||||
// TODO 生成 mock 的数据
|
// TODO 生成 mock 的数据
|
||||||
AppCommentRespVO appCommentRespVO = new AppCommentRespVO();
|
AppProductCommentRespVO appCommentRespVO = new AppProductCommentRespVO();
|
||||||
appCommentRespVO.setUserId((long) (new Random().nextInt(100000) + 10000));
|
appCommentRespVO.setUserId((long) (new Random().nextInt(100000) + 10000));
|
||||||
appCommentRespVO.setUserNickname("用户" + new Random().nextInt(100));
|
appCommentRespVO.setUserNickname("用户" + new Random().nextInt(100));
|
||||||
appCommentRespVO.setUserAvatar("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
|
appCommentRespVO.setUserAvatar("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
|
||||||
|
@ -85,7 +82,6 @@ public class AppCommentController {
|
||||||
appCommentRespVO.setReplyContent("回复内容" + new Random().nextInt(100));
|
appCommentRespVO.setReplyContent("回复内容" + new Random().nextInt(100));
|
||||||
appCommentRespVO.setReplyTime(LocalDateTime.now().minusDays(new Random().nextInt(30)));
|
appCommentRespVO.setReplyTime(LocalDateTime.now().minusDays(new Random().nextInt(30)));
|
||||||
appCommentRespVO.setCreateTime(LocalDateTime.now().minusDays(new Random().nextInt(30)));
|
appCommentRespVO.setCreateTime(LocalDateTime.now().minusDays(new Random().nextInt(30)));
|
||||||
appCommentRespVO.setFinalScore(new Random().nextInt(5) + 1);
|
|
||||||
appCommentRespVO.setSpuId((long) (new Random().nextInt(100000) + 10000));
|
appCommentRespVO.setSpuId((long) (new Random().nextInt(100000) + 10000));
|
||||||
appCommentRespVO.setSpuName("商品" + new Random().nextInt(100));
|
appCommentRespVO.setSpuName("商品" + new Random().nextInt(100));
|
||||||
appCommentRespVO.setSkuId((long) (new Random().nextInt(100000) + 10000));
|
appCommentRespVO.setSkuId((long) (new Random().nextInt(100000) + 10000));
|
||||||
|
@ -101,30 +97,14 @@ public class AppCommentController {
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得商品评价分页")
|
@Operation(summary = "获得商品评价分页")
|
||||||
public CommonResult<PageResult<AppCommentRespVO>> getCommentPage(@Valid AppCommentPageReqVO pageVO) {
|
public CommonResult<PageResult<AppProductCommentRespVO>> getCommentPage(@Valid AppCommentPageReqVO pageVO) {
|
||||||
return success(productCommentService.getCommentPage(pageVO, Boolean.TRUE));
|
return success(productCommentService.getCommentPage(pageVO, Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:方法名改成 getCommentStatistics?然后搞个对应的 vo?想了下,这样更优雅
|
@GetMapping("/getCommentStatistics")
|
||||||
@GetMapping("/statistics")
|
@Operation(summary = "获得商品的评价统计")
|
||||||
@Operation(summary = "获得商品的评价统计") // TODO @puhui999:@RequestParam 哈,针对 spuId
|
public CommonResult<AppCommentStatisticsRespVO> getCommentPage(@Valid @RequestParam("spuId") Long spuId) {
|
||||||
public CommonResult<Map<String, Object>> getCommentStatistics(@Valid Long spuId) {
|
return success(productCommentService.getCommentPageTabsCount(spuId, Boolean.TRUE));
|
||||||
// TODO 生成 mock 的数据
|
|
||||||
if (true) {
|
|
||||||
return success(MapUtil.<String, Object>builder("allCount", 10L).put("goodPercent", "10.33").build());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
// return success(productCommentService.getCommentPageTabsCount(spuId, Boolean.TRUE));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(value = "/create")
|
|
||||||
@Operation(summary = "创建商品评价")
|
|
||||||
public CommonResult<Boolean> createComment(@RequestBody AppCommentCreateReqVO createReqVO) {
|
|
||||||
// TODO: 2023/3/20 要不要判断订单、商品是否存在
|
|
||||||
// TODO @ouhui999:这个接口,搞到交易那比较合适;
|
|
||||||
MemberUserRespDTO user = memberUserApi.getUser(getLoginUserId());
|
|
||||||
productCommentService.createComment(ProductCommentConvert.INSTANCE.convert(user, createReqVO), Boolean.FALSE);
|
|
||||||
return success(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,31 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.product.controller.app.comment.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
// TODO @puhui999:不应该继承 AppCommentCreateReqVO
|
|
||||||
@Schema(description = "用户APP - 商品评价创建 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class AppCommentCreateReqVO extends AppCommentBaseVO {
|
|
||||||
|
|
||||||
@Schema(description = "是否匿名", required = true, example = "true")
|
|
||||||
@NotNull(message = "是否匿名不能为空")
|
|
||||||
private Boolean anonymous;
|
|
||||||
|
|
||||||
// TODO @puhui999:不应该传递 orderId
|
|
||||||
|
|
||||||
@Schema(description = "交易订单编号", required = true, example = "12312")
|
|
||||||
@NotNull(message = "交易订单编号不能为空")
|
|
||||||
private Long orderId;
|
|
||||||
|
|
||||||
@Schema(description = "交易订单项编号", required = true, example = "2312312")
|
|
||||||
@NotNull(message = "交易订单项编号不能为空")
|
|
||||||
private Long orderItemId;
|
|
||||||
|
|
||||||
}
|
|
|
@ -8,61 +8,32 @@ import lombok.ToString;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户 APP - 商品评价分页 Request VO
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
@Schema(description = "用户APP - 商品评价分页 Request VO")
|
@Schema(description = "用户APP - 商品评价分页 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class AppCommentPageReqVO extends PageParam {
|
public class AppCommentPageReqVO extends PageParam {
|
||||||
|
|
||||||
// TODO @puhui999:不传递就是 all;
|
|
||||||
/**
|
|
||||||
* 所有
|
|
||||||
*/
|
|
||||||
public static final Integer ALL = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所有数量 key
|
|
||||||
*/
|
|
||||||
public static final String ALL_COUNT = "allCount";
|
|
||||||
|
|
||||||
// TODO @puhui999:good 好评;
|
|
||||||
/**
|
/**
|
||||||
* 好评
|
* 好评
|
||||||
*/
|
*/
|
||||||
public static final Integer FAVOURABLE_COMMENT = 1;
|
public static final Integer GOOD_COMMENT = 1;
|
||||||
|
|
||||||
// TODO @puhui999:medium 中评;然后 mediumCount 就好啦;
|
|
||||||
/**
|
|
||||||
* 好评数量 key
|
|
||||||
*/
|
|
||||||
public static final String FAVOURABLE_COMMENT_COUNT = "favourableCommentCount";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 中评
|
* 中评
|
||||||
*/
|
*/
|
||||||
public static final Integer MEDIOCRE_COMMENT = 2;
|
public static final Integer MEDIOCRE_COMMENT = 2;
|
||||||
|
|
||||||
/**
|
|
||||||
* 中评数量 key
|
|
||||||
*/
|
|
||||||
public static final String MEDIOCRE_COMMENT_COUNT = "mediocreCommentCount";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 差评
|
* 差评
|
||||||
*/
|
*/
|
||||||
public static final Integer NEGATIVE_COMMENT = 3;
|
public static final Integer NEGATIVE_COMMENT = 3;
|
||||||
|
|
||||||
/**
|
|
||||||
* 差评数量 key
|
|
||||||
*/
|
|
||||||
public static final String NEGATIVE_COMMENT_COUNT = "negativeCommentCount";
|
|
||||||
|
|
||||||
// TODO @puhui999:这个挪到 DO 那没问题的哈;NICKNAME_ANONYMOUS
|
|
||||||
/**
|
|
||||||
* 默认匿名昵称
|
|
||||||
*/
|
|
||||||
public static final String ANONYMOUS_NICKNAME = "匿名用户";
|
|
||||||
|
|
||||||
@Schema(description = "商品SPU编号", example = "29502")
|
@Schema(description = "商品SPU编号", example = "29502")
|
||||||
@NotNull(message = "商品SPU编号不能为空")
|
@NotNull(message = "商品SPU编号不能为空")
|
||||||
private Long spuId;
|
private Long spuId;
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.product.controller.app.comment.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Schema(description = "用户APP - 商品评价 Response VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class AppCommentRespVO extends AppCommentBaseVO {
|
|
||||||
|
|
||||||
// TODO puhui999:把 example 也补充下哈
|
|
||||||
|
|
||||||
@Schema(description = "评价人的用户编号", required = true, example = "15721")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
@Schema(description = "评价人名称", required = true, example = "张三")
|
|
||||||
private String userNickname;
|
|
||||||
|
|
||||||
@Schema(description = "评价人头像", required = true)
|
|
||||||
private String userAvatar;
|
|
||||||
|
|
||||||
@Schema(description = "订单项编号", required = true, example = "24965")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "是否匿名", required = true)
|
|
||||||
private Boolean anonymous;
|
|
||||||
|
|
||||||
@Schema(description = "交易订单编号", required = true, example = "24428")
|
|
||||||
private Long orderId;
|
|
||||||
|
|
||||||
@Schema(description = "交易订单项编号", required = true, example = "8233")
|
|
||||||
private Long orderItemId;
|
|
||||||
|
|
||||||
@Schema(description = "商家是否回复", required = true)
|
|
||||||
private Boolean replyStatus;
|
|
||||||
|
|
||||||
@Schema(description = "回复管理员编号", example = "22212")
|
|
||||||
private Long replyUserId;
|
|
||||||
|
|
||||||
@Schema(description = "商家回复内容")
|
|
||||||
private String replyContent;
|
|
||||||
|
|
||||||
@Schema(description = "商家回复时间")
|
|
||||||
private LocalDateTime replyTime;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间", required = true)
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
@Schema(description = "最终评分", required = true)
|
|
||||||
private Integer finalScore;
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package cn.iocoder.yudao.module.product.controller.app.comment.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP 商品评价页评论分类数统计 Response VO
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
@Schema(description = "APP - 商品评价页评论分类数统计 Response VO")
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AppCommentStatisticsRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "所有评论数量", required = true, example = "15721")
|
||||||
|
private Long allCount;
|
||||||
|
|
||||||
|
@Schema(description = "好评数量", required = true, example = "15721")
|
||||||
|
private Long goodCount;
|
||||||
|
|
||||||
|
@Schema(description = "中评数量", required = true, example = "15721")
|
||||||
|
private Long mediocreCount;
|
||||||
|
|
||||||
|
@Schema(description = "差评数量", required = true, example = "15721")
|
||||||
|
private Long negativeCount;
|
||||||
|
|
||||||
|
}
|
|
@ -1,49 +1,60 @@
|
||||||
package cn.iocoder.yudao.module.product.controller.app.comment.vo;
|
package cn.iocoder.yudao.module.product.controller.app.comment.vo;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// TODO @puhui999:C 端可以不要 base 哈。
|
/**
|
||||||
|
* 用户APP - 商品评价创建 Request VO
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户APP - 商品评价创建 Request VO")
|
||||||
@Data
|
@Data
|
||||||
public class AppCommentBaseVO {
|
@ToString(callSuper = true)
|
||||||
|
public class AppProductCommentCreateReqVO {
|
||||||
|
|
||||||
@Schema(description = "商品SPU编号", required = true, example = "29502")
|
@Schema(description = "是否匿名", required = true, example = "true")
|
||||||
|
@NotNull(message = "是否匿名不能为空")
|
||||||
|
private Boolean anonymous;
|
||||||
|
|
||||||
|
@Schema(description = "交易订单项编号", required = true, example = "2312312")
|
||||||
|
@NotNull(message = "交易订单项编号不能为空")
|
||||||
|
private Long orderItemId;
|
||||||
|
|
||||||
|
@Schema(description = "商品SPU编号", required = true, example = "91192")
|
||||||
@NotNull(message = "商品SPU编号不能为空")
|
@NotNull(message = "商品SPU编号不能为空")
|
||||||
private Long spuId;
|
private Long spuId;
|
||||||
|
|
||||||
@Schema(description = "商品SPU名称", required = true, example = "赵六")
|
@Schema(description = "商品SPU名称", required = true, example = "清凉丝滑小短袖")
|
||||||
@NotNull(message = "商品SPU名称不能为空")
|
@NotNull(message = "商品SPU名称不能为空")
|
||||||
private String spuName;
|
private String spuName;
|
||||||
|
|
||||||
@Schema(description = "商品SKU编号", required = true, example = "3082")
|
@Schema(description = "商品SKU编号", required = true, example = "81192")
|
||||||
@NotNull(message = "商品SKU编号不能为空")
|
@NotNull(message = "商品SKU编号不能为空")
|
||||||
private Long skuId;
|
private Long skuId;
|
||||||
|
|
||||||
@Schema(description = "商品 SKU 属性", required = true)
|
@Schema(description = "评分星级 1-5分", required = true, example = "5")
|
||||||
private List<AppProductPropertyValueDetailRespVO> skuProperties; // TODO puhui999:这个需要从数据库查询哈
|
|
||||||
|
|
||||||
@Schema(description = "评分星级 1-5分", required = true)
|
|
||||||
@NotNull(message = "评分星级 1-5分不能为空")
|
@NotNull(message = "评分星级 1-5分不能为空")
|
||||||
private Integer scores;
|
private Integer scores;
|
||||||
|
|
||||||
@Schema(description = "描述星级 1-5分", required = true)
|
@Schema(description = "描述星级 1-5分", required = true, example = "5")
|
||||||
@NotNull(message = "描述星级 1-5分不能为空")
|
@NotNull(message = "描述星级 1-5分不能为空")
|
||||||
private Integer descriptionScores;
|
private Integer descriptionScores;
|
||||||
|
|
||||||
@Schema(description = "服务星级 1-5分", required = true)
|
@Schema(description = "服务星级 1-5分", required = true, example = "5")
|
||||||
@NotNull(message = "服务星级 1-5分不能为空")
|
@NotNull(message = "服务星级 1-5分不能为空")
|
||||||
private Integer benefitScores;
|
private Integer benefitScores;
|
||||||
|
|
||||||
@Schema(description = "评论内容", required = true)
|
@Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评")
|
||||||
@NotNull(message = "评论内容不能为空")
|
@NotNull(message = "评论内容不能为空")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
@Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true)
|
@Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
|
||||||
@Size(max = 9, message = "评论图片地址数组长度不能超过9张")
|
@Size(max = 9, message = "评论图片地址数组长度不能超过9张")
|
||||||
private List<String> picUrls;
|
private List<String> picUrls;
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
package cn.iocoder.yudao.module.product.controller.app.comment.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户APP - 商品评价详情 Response VO
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户APP - 商品评价详情 Response VO")
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AppProductCommentRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "评价人的用户编号", required = true, example = "15721")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "评价人名称", required = true, example = "张三")
|
||||||
|
private String userNickname;
|
||||||
|
|
||||||
|
@Schema(description = "评价人头像", required = true, example = "https://www.iocoder.cn/xx.png")
|
||||||
|
private String userAvatar;
|
||||||
|
|
||||||
|
@Schema(description = "订单项编号", required = true, example = "24965")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "是否匿名", required = true, example = "false")
|
||||||
|
private Boolean anonymous;
|
||||||
|
|
||||||
|
@Schema(description = "交易订单编号", required = true, example = "24428")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
@Schema(description = "交易订单项编号", required = true, example = "8233")
|
||||||
|
private Long orderItemId;
|
||||||
|
|
||||||
|
@Schema(description = "商家是否回复", required = true, example = "true")
|
||||||
|
private Boolean replyStatus;
|
||||||
|
|
||||||
|
@Schema(description = "回复管理员编号", example = "22212")
|
||||||
|
private Long replyUserId;
|
||||||
|
|
||||||
|
@Schema(description = "商家回复内容", example = "亲,你的好评就是我的动力(*^▽^*)")
|
||||||
|
private String replyContent;
|
||||||
|
|
||||||
|
@Schema(description = "商家回复时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime replyTime;
|
||||||
|
|
||||||
|
@Schema(description = "追加评价内容", example = "穿了很久都很丝滑诶")
|
||||||
|
private String additionalContent;
|
||||||
|
|
||||||
|
@Schema(description = "追评评价图片地址数组,以逗号分隔最多上传9张", example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
|
||||||
|
private List<String> additionalPicUrls;
|
||||||
|
|
||||||
|
@Schema(description = "追加评价时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime additionalTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "商品SPU编号", required = true, example = "91192")
|
||||||
|
@NotNull(message = "商品SPU编号不能为空")
|
||||||
|
private Long spuId;
|
||||||
|
|
||||||
|
@Schema(description = "商品SPU名称", required = true, example = "清凉丝滑小短袖")
|
||||||
|
@NotNull(message = "商品SPU名称不能为空")
|
||||||
|
private String spuName;
|
||||||
|
|
||||||
|
@Schema(description = "商品SKU编号", required = true, example = "81192")
|
||||||
|
@NotNull(message = "商品SKU编号不能为空")
|
||||||
|
private Long skuId;
|
||||||
|
|
||||||
|
@Schema(description = "商品 SKU 属性", required = true)
|
||||||
|
private List<AppProductPropertyValueDetailRespVO> skuProperties;
|
||||||
|
|
||||||
|
@Schema(description = "评分星级 1-5分", required = true, example = "5")
|
||||||
|
@NotNull(message = "评分星级 1-5分不能为空")
|
||||||
|
private Integer scores;
|
||||||
|
|
||||||
|
@Schema(description = "描述星级 1-5分", required = true, example = "5")
|
||||||
|
@NotNull(message = "描述星级 1-5分不能为空")
|
||||||
|
private Integer descriptionScores;
|
||||||
|
|
||||||
|
@Schema(description = "服务星级 1-5分", required = true, example = "5")
|
||||||
|
@NotNull(message = "服务星级 1-5分不能为空")
|
||||||
|
private Integer benefitScores;
|
||||||
|
|
||||||
|
@Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评")
|
||||||
|
@NotNull(message = "评论内容不能为空")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
|
||||||
|
@Size(max = 9, message = "评论图片地址数组长度不能超过9张")
|
||||||
|
private List<String> picUrls;
|
||||||
|
|
||||||
|
}
|
|
@ -1,15 +1,21 @@
|
||||||
package cn.iocoder.yudao.module.product.convert.comment;
|
package cn.iocoder.yudao.module.product.convert.comment;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.product.api.comment.dto.CommentCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentCreateReqVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentRespVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO;
|
||||||
|
import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO;
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
||||||
|
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.Named;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,50 +30,44 @@ public interface ProductCommentConvert {
|
||||||
|
|
||||||
ProductCommentRespVO convert(ProductCommentDO bean);
|
ProductCommentRespVO convert(ProductCommentDO bean);
|
||||||
|
|
||||||
|
@Mapping(target = "allCount", source = "allCount")
|
||||||
|
@Mapping(target = "goodCount", source = "goodCount")
|
||||||
|
@Mapping(target = "mediocreCount", source = "mediocreCount")
|
||||||
|
@Mapping(target = "negativeCount", source = "negativeCount")
|
||||||
|
AppCommentStatisticsRespVO convert(Long allCount, Long goodCount, Long mediocreCount, Long negativeCount);
|
||||||
|
|
||||||
List<ProductCommentRespVO> convertList(List<ProductCommentDO> list);
|
List<ProductCommentRespVO> convertList(List<ProductCommentDO> list);
|
||||||
|
|
||||||
|
List<AppProductPropertyValueDetailRespVO> convertList01(List<ProductSkuDO.Property> properties);
|
||||||
|
|
||||||
PageResult<ProductCommentRespVO> convertPage(PageResult<ProductCommentDO> page);
|
PageResult<ProductCommentRespVO> convertPage(PageResult<ProductCommentDO> page);
|
||||||
|
|
||||||
PageResult<AppCommentRespVO> convertPage02(PageResult<ProductCommentDO> pageResult);
|
PageResult<AppProductCommentRespVO> convertPage02(PageResult<ProductCommentDO> pageResult);
|
||||||
|
|
||||||
// TODO @puhui999:用 mapstruct 的映射
|
/**
|
||||||
default ProductCommentDO convert(MemberUserRespDTO user, AppCommentCreateReqVO createReqVO) {
|
* 计算综合评分
|
||||||
ProductCommentDO productComment = new ProductCommentDO();
|
*
|
||||||
productComment.setUserId(user.getId());
|
* @param descriptionScores 描述星级
|
||||||
productComment.setUserNickname(user.getNickname());
|
* @param benefitScores 服务星级
|
||||||
productComment.setUserAvatar(user.getAvatar());
|
* @return {@link Integer}
|
||||||
productComment.setAnonymous(createReqVO.getAnonymous());
|
*/
|
||||||
productComment.setOrderId(createReqVO.getOrderId());
|
@Named("convertScores")
|
||||||
productComment.setOrderItemId(createReqVO.getOrderItemId());
|
default Integer convertScores(Integer descriptionScores, Integer benefitScores) {
|
||||||
productComment.setSpuId(createReqVO.getSpuId());
|
// 计算评价最终综合评分 最终星数 = (商品评星 + 服务评星) / 2
|
||||||
productComment.setSpuName(createReqVO.getSpuName());
|
BigDecimal sumScore = new BigDecimal(descriptionScores + benefitScores);
|
||||||
productComment.setSkuId(createReqVO.getSkuId());
|
BigDecimal divide = sumScore.divide(BigDecimal.valueOf(2L), 0, RoundingMode.DOWN);
|
||||||
productComment.setScores(createReqVO.getScores());
|
return divide.intValue();
|
||||||
productComment.setDescriptionScores(createReqVO.getDescriptionScores());
|
|
||||||
productComment.setBenefitScores(createReqVO.getBenefitScores());
|
|
||||||
productComment.setContent(createReqVO.getContent());
|
|
||||||
productComment.setPicUrls(createReqVO.getPicUrls());
|
|
||||||
return productComment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:用 mapstruct 的映射
|
@Mapping(target = "orderId", source = "orderId")
|
||||||
default ProductCommentDO convert(ProductCommentCreateReqVO createReq) {
|
@Mapping(target = "scores", expression = "java(convertScores(createReqDTO.getDescriptionScores(), createReqDTO.getBenefitScores()))")
|
||||||
ProductCommentDO productComment = new ProductCommentDO();
|
ProductCommentDO convert(CommentCreateReqDTO createReqDTO, Long orderId);
|
||||||
productComment.setUserId(0L);
|
|
||||||
productComment.setUserNickname(createReq.getUserNickname());
|
@Mapping(target = "userId", constant = "0L")
|
||||||
productComment.setUserAvatar(createReq.getUserAvatar());
|
@Mapping(target = "orderId", constant = "0L")
|
||||||
productComment.setAnonymous(Boolean.FALSE);
|
@Mapping(target = "orderItemId", constant = "0L")
|
||||||
productComment.setOrderId(0L);
|
@Mapping(target = "anonymous", expression = "java(Boolean.FALSE)")
|
||||||
productComment.setOrderItemId(0L);
|
@Mapping(target = "scores", expression = "java(convertScores(createReq.getDescriptionScores(), createReq.getBenefitScores()))")
|
||||||
productComment.setSpuId(createReq.getSpuId());
|
ProductCommentDO convert(ProductCommentCreateReqVO createReq);
|
||||||
productComment.setSpuName(createReq.getSpuName());
|
|
||||||
productComment.setSkuId(createReq.getSkuId());
|
|
||||||
productComment.setScores(createReq.getScores());
|
|
||||||
productComment.setDescriptionScores(createReq.getDescriptionScores());
|
|
||||||
productComment.setBenefitScores(createReq.getBenefitScores());
|
|
||||||
productComment.setContent(createReq.getContent());
|
|
||||||
productComment.setPicUrls(createReq.getPicUrls());
|
|
||||||
return productComment;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,11 @@ import java.util.List;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ProductCommentDO extends BaseDO {
|
public class ProductCommentDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认匿名昵称
|
||||||
|
*/
|
||||||
|
public static final String NICKNAME_ANONYMOUS = "匿名用户";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 评论编号,主键自增
|
* 评论编号,主键自增
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,14 +6,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyVO;
|
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ProductCommentMapper extends BaseMapperX<ProductCommentDO> {
|
public interface ProductCommentMapper extends BaseMapperX<ProductCommentDO> {
|
||||||
|
|
||||||
|
@ -31,7 +27,7 @@ public interface ProductCommentMapper extends BaseMapperX<ProductCommentDO> {
|
||||||
// TODO 芋艿:在看看这块
|
// TODO 芋艿:在看看这块
|
||||||
static void appendTabQuery(LambdaQueryWrapperX<ProductCommentDO> queryWrapper, Integer type) {
|
static void appendTabQuery(LambdaQueryWrapperX<ProductCommentDO> queryWrapper, Integer type) {
|
||||||
// 构建好评查询语句:好评计算 (商品评分星级+服务评分星级) >= 8
|
// 构建好评查询语句:好评计算 (商品评分星级+服务评分星级) >= 8
|
||||||
if (ObjectUtil.equal(type, AppCommentPageReqVO.FAVOURABLE_COMMENT)) {
|
if (ObjectUtil.equal(type, AppCommentPageReqVO.GOOD_COMMENT)) {
|
||||||
queryWrapper.apply("(scores + benefit_scores) >= 8");
|
queryWrapper.apply("(scores + benefit_scores) >= 8");
|
||||||
}
|
}
|
||||||
// 构建中评查询语句:中评计算 (商品评分星级+服务评分星级) > 4 且 (商品评分星级+服务评分星级) < 8
|
// 构建中评查询语句:中评计算 (商品评分星级+服务评分星级) > 4 且 (商品评分星级+服务评分星级) < 8
|
||||||
|
@ -55,33 +51,14 @@ public interface ProductCommentMapper extends BaseMapperX<ProductCommentDO> {
|
||||||
return selectPage(reqVO, queryWrapper);
|
return selectPage(reqVO, queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void updateCommentVisible(Long id, Boolean visible) {
|
default ProductCommentDO selectByUserIdAndOrderIdAndSpuId(Long userId, Long orderId, Long spuId) {
|
||||||
LambdaUpdateWrapper<ProductCommentDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<ProductCommentDO>()
|
|
||||||
.set(ProductCommentDO::getVisible, visible)
|
|
||||||
.eq(ProductCommentDO::getId, id);
|
|
||||||
update(null, lambdaUpdateWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
default void commentReply(ProductCommentReplyVO replyVO, Long loginUserId) {
|
|
||||||
LambdaUpdateWrapper<ProductCommentDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<ProductCommentDO>()
|
|
||||||
.set(ProductCommentDO::getReplyStatus, Boolean.TRUE)
|
|
||||||
.set(ProductCommentDO::getReplyTime, LocalDateTime.now())
|
|
||||||
.set(ProductCommentDO::getReplyUserId, loginUserId)
|
|
||||||
.set(ProductCommentDO::getReplyContent, replyVO.getReplyContent())
|
|
||||||
.eq(ProductCommentDO::getId, replyVO.getId());
|
|
||||||
update(null, lambdaUpdateWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO @puhui999:使用 select 替代 find
|
|
||||||
default ProductCommentDO findByUserIdAndOrderIdAndSpuId(Long userId, Long orderId, Long spuId) {
|
|
||||||
return selectOne(new LambdaQueryWrapperX<ProductCommentDO>()
|
return selectOne(new LambdaQueryWrapperX<ProductCommentDO>()
|
||||||
.eq(ProductCommentDO::getUserId, userId)
|
.eq(ProductCommentDO::getUserId, userId)
|
||||||
.eq(ProductCommentDO::getOrderId, orderId)
|
.eq(ProductCommentDO::getOrderId, orderId)
|
||||||
.eq(ProductCommentDO::getSpuId, spuId));
|
.eq(ProductCommentDO::getSpuId, spuId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:selectCountBySpuId 即可
|
default Long selectCountBySpuId(Long spuId, Boolean visible, Integer type) {
|
||||||
default Long selectTabCount(Long spuId, Boolean visible, Integer type) {
|
|
||||||
LambdaQueryWrapperX<ProductCommentDO> queryWrapper = new LambdaQueryWrapperX<ProductCommentDO>()
|
LambdaQueryWrapperX<ProductCommentDO> queryWrapper = new LambdaQueryWrapperX<ProductCommentDO>()
|
||||||
.eqIfPresent(ProductCommentDO::getSpuId, spuId)
|
.eqIfPresent(ProductCommentDO::getSpuId, spuId)
|
||||||
.eqIfPresent(ProductCommentDO::getVisible, visible);
|
.eqIfPresent(ProductCommentDO::getVisible, visible);
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package cn.iocoder.yudao.module.product.service.comment;
|
package cn.iocoder.yudao.module.product.service.comment;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentRespVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO;
|
||||||
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO;
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品评论 Service 接口
|
* 商品评论 Service 接口
|
||||||
*
|
*
|
||||||
|
@ -36,14 +36,13 @@ public interface ProductCommentService {
|
||||||
*/
|
*/
|
||||||
void updateCommentVisible(ProductCommentUpdateVisibleReqVO updateReqVO);
|
void updateCommentVisible(ProductCommentUpdateVisibleReqVO updateReqVO);
|
||||||
|
|
||||||
// TODO @puhui999:replyComment
|
|
||||||
/**
|
/**
|
||||||
* 商家回复
|
* 商家回复
|
||||||
*
|
*
|
||||||
* @param replyVO 商家回复
|
* @param replyVO 商家回复
|
||||||
* @param loginUserId 管理后台商家登陆人 ID
|
* @param loginUserId 管理后台商家登陆人 ID
|
||||||
*/
|
*/
|
||||||
void commentReply(ProductCommentReplyVO replyVO, Long loginUserId);
|
void replyComment(ProductCommentReplyReqVO replyVO, Long loginUserId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得商品评价分页
|
* 获得商品评价分页
|
||||||
|
@ -52,15 +51,23 @@ public interface ProductCommentService {
|
||||||
* @param visible 是否可见
|
* @param visible 是否可见
|
||||||
* @return 商品评价分页
|
* @return 商品评价分页
|
||||||
*/
|
*/
|
||||||
PageResult<AppCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible);
|
PageResult<AppProductCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建商品评论
|
* 创建商品评论 后台管理员创建评论使用
|
||||||
*
|
*
|
||||||
* @param productComment 创建实体
|
* @param createReqVO 商品评价创建 Request VO 对象
|
||||||
* @param system 是否系统评价
|
|
||||||
*/
|
*/
|
||||||
void createComment(ProductCommentDO productComment, Boolean system);
|
void createComment(ProductCommentCreateReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建评论
|
||||||
|
* 创建商品评论 APP 端创建商品评论使用
|
||||||
|
*
|
||||||
|
* @param commentDO 评论对象
|
||||||
|
* @return 返回评论 id
|
||||||
|
*/
|
||||||
|
Long createComment(ProductCommentDO commentDO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得商品的评价统计
|
* 获得商品的评价统计
|
||||||
|
@ -69,6 +76,6 @@ public interface ProductCommentService {
|
||||||
* @param visible 是否可见
|
* @param visible 是否可见
|
||||||
* @return 评价统计
|
* @return 评价统计
|
||||||
*/
|
*/
|
||||||
Map<String, Long> getCommentPageTabsCount(Long spuId, Boolean visible);
|
AppCommentStatisticsRespVO getCommentPageTabsCount(Long spuId, Boolean visible);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,39 @@
|
||||||
package cn.iocoder.yudao.module.product.service.comment;
|
package cn.iocoder.yudao.module.product.service.comment;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentRespVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO;
|
||||||
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO;
|
||||||
|
import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO;
|
||||||
import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert;
|
import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert;
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
||||||
|
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
||||||
import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper;
|
import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper;
|
||||||
|
import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
|
||||||
import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
|
import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
|
||||||
import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi;
|
import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi;
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.time.LocalDateTime;
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*;
|
||||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品评论 Service 实现类
|
* 商品评论 Service 实现类
|
||||||
|
@ -45,95 +53,120 @@ public class ProductCommentServiceImpl implements ProductCommentService {
|
||||||
@Resource
|
@Resource
|
||||||
private ProductSpuService productSpuService;
|
private ProductSpuService productSpuService;
|
||||||
|
|
||||||
@Override
|
@Resource
|
||||||
public PageResult<ProductCommentDO> getCommentPage(ProductCommentPageReqVO pageReqVO) {
|
@Lazy
|
||||||
return productCommentMapper.selectPage(pageReqVO);
|
private ProductSkuService productSkuService;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateCommentVisible(ProductCommentUpdateVisibleReqVO updateReqVO) {
|
public void updateCommentVisible(ProductCommentUpdateVisibleReqVO updateReqVO) {
|
||||||
// 校验评论是否存在
|
// 校验评论是否存在
|
||||||
validateCommentExists(updateReqVO.getId());
|
ProductCommentDO productCommentDO = validateCommentExists(updateReqVO.getId());
|
||||||
|
productCommentDO.setVisible(updateReqVO.getVisible());
|
||||||
|
|
||||||
// 更新可见状态
|
// 更新可见状态
|
||||||
// TODO @puhui999:直接使用 update 操作
|
productCommentMapper.updateById(productCommentDO);
|
||||||
productCommentMapper.updateCommentVisible(updateReqVO.getId(), updateReqVO.getVisible());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commentReply(ProductCommentReplyVO replyVO, Long loginUserId) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void replyComment(ProductCommentReplyReqVO replyVO, Long loginUserId) {
|
||||||
// 校验评论是否存在
|
// 校验评论是否存在
|
||||||
validateCommentExists(replyVO.getId());
|
ProductCommentDO productCommentDO = validateCommentExists(replyVO.getId());
|
||||||
|
productCommentDO.setReplyTime(LocalDateTime.now());
|
||||||
|
productCommentDO.setReplyUserId(loginUserId);
|
||||||
|
productCommentDO.setReplyStatus(Boolean.TRUE);
|
||||||
|
productCommentDO.setReplyContent(replyVO.getReplyContent());
|
||||||
|
|
||||||
// 回复评论
|
// 回复评论
|
||||||
// TODO @puhui999:直接使用 update 操作
|
productCommentMapper.updateById(productCommentDO);
|
||||||
productCommentMapper.commentReply(replyVO, loginUserId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Long> getCommentPageTabsCount(Long spuId, Boolean visible) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
Map<String, Long> countMap = new HashMap<>(4);
|
public void createComment(ProductCommentCreateReqVO createReqVO) {
|
||||||
|
// 校验订单
|
||||||
|
Long orderId = tradeOrderApi.validateOrder(createReqVO.getUserId(), createReqVO.getOrderItemId());
|
||||||
|
// 校验评论
|
||||||
|
validateComment(createReqVO.getSpuId(), createReqVO.getUserId(), orderId);
|
||||||
|
|
||||||
|
ProductCommentDO commentDO = ProductCommentConvert.INSTANCE.convert(createReqVO);
|
||||||
|
productCommentMapper.insert(commentDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Long createComment(ProductCommentDO commentDO) {
|
||||||
|
// 校验评论
|
||||||
|
validateComment(commentDO.getSpuId(), commentDO.getUserId(), commentDO.getOrderId());
|
||||||
|
|
||||||
|
productCommentMapper.insert(commentDO);
|
||||||
|
return commentDO.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO 只有创建和更新诶 要不要删除接口
|
||||||
|
|
||||||
|
private void validateComment(Long spuId, Long userId, Long orderId) {
|
||||||
|
ProductSpuDO spu = productSpuService.getSpu(spuId);
|
||||||
|
if (null == spu) {
|
||||||
|
throw exception(SPU_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
// 判断当前订单的当前商品用户是否评价过
|
||||||
|
ProductCommentDO exist = productCommentMapper.selectByUserIdAndOrderIdAndSpuId(userId, orderId, spuId);
|
||||||
|
if (null != exist) {
|
||||||
|
throw exception(ORDER_SPU_COMMENT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ProductCommentDO validateCommentExists(Long id) {
|
||||||
|
ProductCommentDO productComment = productCommentMapper.selectById(id);
|
||||||
|
if (productComment == null) {
|
||||||
|
throw exception(COMMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
return productComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppCommentStatisticsRespVO getCommentPageTabsCount(Long spuId, Boolean visible) {
|
||||||
|
return ProductCommentConvert.INSTANCE.convert(
|
||||||
// 查询商品 id = spuId 的所有评论数量
|
// 查询商品 id = spuId 的所有评论数量
|
||||||
countMap.put(AppCommentPageReqVO.ALL_COUNT,
|
productCommentMapper.selectCountBySpuId(spuId, visible, null),
|
||||||
productCommentMapper.selectTabCount(spuId, visible, AppCommentPageReqVO.ALL));
|
|
||||||
// 查询商品 id = spuId 的所有好评数量
|
// 查询商品 id = spuId 的所有好评数量
|
||||||
countMap.put(AppCommentPageReqVO.FAVOURABLE_COMMENT_COUNT,
|
productCommentMapper.selectCountBySpuId(spuId, visible, AppCommentPageReqVO.GOOD_COMMENT),
|
||||||
productCommentMapper.selectTabCount(spuId, visible, AppCommentPageReqVO.FAVOURABLE_COMMENT));
|
|
||||||
// 查询商品 id = spuId 的所有中评数量
|
// 查询商品 id = spuId 的所有中评数量
|
||||||
countMap.put(AppCommentPageReqVO.MEDIOCRE_COMMENT_COUNT,
|
productCommentMapper.selectCountBySpuId(spuId, visible, AppCommentPageReqVO.MEDIOCRE_COMMENT),
|
||||||
productCommentMapper.selectTabCount(spuId, visible, AppCommentPageReqVO.MEDIOCRE_COMMENT));
|
|
||||||
// 查询商品 id = spuId 的所有差评数量
|
// 查询商品 id = spuId 的所有差评数量
|
||||||
countMap.put(AppCommentPageReqVO.NEGATIVE_COMMENT_COUNT,
|
productCommentMapper.selectCountBySpuId(spuId, visible, AppCommentPageReqVO.NEGATIVE_COMMENT)
|
||||||
productCommentMapper.selectTabCount(spuId, visible, AppCommentPageReqVO.NEGATIVE_COMMENT));
|
);
|
||||||
return countMap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<AppCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible) {
|
public PageResult<AppProductCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible) {
|
||||||
// TODO @puhui999:逻辑可以在 controller 做哈。让 service 简介一点;因为是 view 需要不展示昵称
|
PageResult<AppProductCommentRespVO> result = ProductCommentConvert.INSTANCE.convertPage02(
|
||||||
PageResult<AppCommentRespVO> result = ProductCommentConvert.INSTANCE.convertPage02(productCommentMapper.selectPage(pageVO, visible));
|
productCommentMapper.selectPage(pageVO, visible));
|
||||||
|
Set<Long> skuIds = result.getList().stream().map(AppProductCommentRespVO::getSkuId).collect(Collectors.toSet());
|
||||||
|
List<ProductSkuDO> skuList = productSkuService.getSkuList(skuIds);
|
||||||
|
Map<Long, ProductSkuDO> skuDOMap = new HashMap<>(skuIds.size());
|
||||||
|
if (CollUtil.isNotEmpty(skuList)) {
|
||||||
|
skuDOMap.putAll(skuList.stream().collect(Collectors.toMap(ProductSkuDO::getId, c -> c)));
|
||||||
|
}
|
||||||
result.getList().forEach(item -> {
|
result.getList().forEach(item -> {
|
||||||
// 判断用户是否选择匿名
|
// 判断用户是否选择匿名
|
||||||
if (ObjectUtil.equal(item.getAnonymous(), true)) {
|
if (ObjectUtil.equal(item.getAnonymous(), true)) {
|
||||||
item.setUserNickname(AppCommentPageReqVO.ANONYMOUS_NICKNAME);
|
item.setUserNickname(ProductCommentDO.NICKNAME_ANONYMOUS);
|
||||||
|
}
|
||||||
|
ProductSkuDO productSkuDO = skuDOMap.get(item.getSkuId());
|
||||||
|
if (productSkuDO != null) {
|
||||||
|
List<AppProductPropertyValueDetailRespVO> skuProperties = ProductCommentConvert.INSTANCE.convertList01(productSkuDO.getProperties());
|
||||||
|
item.setSkuProperties(skuProperties);
|
||||||
}
|
}
|
||||||
// TODO @puhui999:直接插入的时候,计算到 scores 字段里;这样就去掉 finalScore 字段哈
|
|
||||||
// 计算评价最终综合评分 最终星数 = (商品评星 + 服务评星) / 2
|
|
||||||
BigDecimal sumScore = new BigDecimal(item.getScores() + item.getBenefitScores());
|
|
||||||
BigDecimal divide = sumScore.divide(BigDecimal.valueOf(2L), 0, RoundingMode.DOWN);
|
|
||||||
item.setFinalScore(divide.intValue());
|
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createComment(ProductCommentDO productComment, Boolean system) {
|
public PageResult<ProductCommentDO> getCommentPage(ProductCommentPageReqVO pageReqVO) {
|
||||||
// TODO @puhui999:这里不区分是否为 system;直接都校验
|
return productCommentMapper.selectPage(pageReqVO);
|
||||||
if (!system) {
|
|
||||||
// TODO 判断订单是否存在 fix;
|
|
||||||
// TODO @puhui999:改成 order 那有个 comment 接口,哪里校验下;商品评论这里不校验订单是否存在哈
|
|
||||||
TradeOrderRespDTO order = tradeOrderApi.getOrder(productComment.getOrderId());
|
|
||||||
if (null == order) {
|
|
||||||
throw exception(ORDER_NOT_FOUND);
|
|
||||||
}
|
|
||||||
ProductSpuDO spu = productSpuService.getSpu(productComment.getSpuId());
|
|
||||||
if (null == spu) {
|
|
||||||
throw exception(SPU_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
// 判断当前订单的当前商品用户是否评价过
|
|
||||||
ProductCommentDO exist = productCommentMapper.findByUserIdAndOrderIdAndSpuId(productComment.getId(), productComment.getOrderId(), productComment.getSpuId());
|
|
||||||
if (null != exist) {
|
|
||||||
throw exception(ORDER_SPU_COMMENT_EXISTS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
productCommentMapper.insert(productComment);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateCommentExists(Long id) {
|
|
||||||
ProductCommentDO productComment = productCommentMapper.selectById(id);
|
|
||||||
if (productComment == null) {
|
|
||||||
throw exception(COMMENT_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,17 @@ import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO;
|
import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
|
||||||
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentRespVO;
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO;
|
||||||
|
import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO;
|
||||||
import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert;
|
import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert;
|
||||||
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
|
||||||
import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper;
|
import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper;
|
||||||
import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum;
|
import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum;
|
||||||
|
import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
|
||||||
import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
|
import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
|
||||||
import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi;
|
import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -24,7 +26,6 @@ import org.springframework.context.annotation.Lazy;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
|
@ -52,6 +53,8 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest {
|
||||||
private TradeOrderApi tradeOrderApi;
|
private TradeOrderApi tradeOrderApi;
|
||||||
@MockBean
|
@MockBean
|
||||||
private ProductSpuService productSpuService;
|
private ProductSpuService productSpuService;
|
||||||
|
@MockBean
|
||||||
|
private ProductSkuService productSkuService;
|
||||||
|
|
||||||
public String generateNo() {
|
public String generateNo() {
|
||||||
return DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomInt(100000, 999999);
|
return DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomInt(100000, 999999);
|
||||||
|
@ -135,23 +138,23 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest {
|
||||||
assertEquals(8, all.getTotal());
|
assertEquals(8, all.getTotal());
|
||||||
|
|
||||||
// 测试获取所有商品分页评论数据
|
// 测试获取所有商品分页评论数据
|
||||||
PageResult<AppCommentRespVO> result1 = productCommentService.getCommentPage(new AppCommentPageReqVO(), Boolean.TRUE);
|
PageResult<AppProductCommentRespVO> result1 = productCommentService.getCommentPage(new AppCommentPageReqVO(), Boolean.TRUE);
|
||||||
assertEquals(7, result1.getTotal());
|
assertEquals(7, result1.getTotal());
|
||||||
|
|
||||||
// 测试获取所有商品分页中评数据
|
// 测试获取所有商品分页中评数据
|
||||||
PageResult<AppCommentRespVO> result2 = productCommentService.getCommentPage(new AppCommentPageReqVO().setType(AppCommentPageReqVO.MEDIOCRE_COMMENT), Boolean.TRUE);
|
PageResult<AppProductCommentRespVO> result2 = productCommentService.getCommentPage(new AppCommentPageReqVO().setType(AppCommentPageReqVO.MEDIOCRE_COMMENT), Boolean.TRUE);
|
||||||
assertEquals(2, result2.getTotal());
|
assertEquals(2, result2.getTotal());
|
||||||
|
|
||||||
// 测试获取指定 spuId 商品分页中评数据
|
// 测试获取指定 spuId 商品分页中评数据
|
||||||
PageResult<AppCommentRespVO> result3 = productCommentService.getCommentPage(new AppCommentPageReqVO().setSpuId(spuId).setType(AppCommentPageReqVO.MEDIOCRE_COMMENT), Boolean.TRUE);
|
PageResult<AppProductCommentRespVO> result3 = productCommentService.getCommentPage(new AppCommentPageReqVO().setSpuId(spuId).setType(AppCommentPageReqVO.MEDIOCRE_COMMENT), Boolean.TRUE);
|
||||||
assertEquals(2, result3.getTotal());
|
assertEquals(2, result3.getTotal());
|
||||||
|
|
||||||
// 测试分页 tab count
|
// 测试分页 tab count
|
||||||
Map<String, Long> tabsCount = productCommentService.getCommentPageTabsCount(spuId, Boolean.TRUE);
|
AppCommentStatisticsRespVO tabsCount = productCommentService.getCommentPageTabsCount(spuId, Boolean.TRUE);
|
||||||
assertEquals(6, tabsCount.get(AppCommentPageReqVO.ALL_COUNT));
|
assertEquals(6, tabsCount.getAllCount());
|
||||||
assertEquals(4, tabsCount.get(AppCommentPageReqVO.FAVOURABLE_COMMENT_COUNT));
|
assertEquals(4, tabsCount.getGoodCount());
|
||||||
assertEquals(2, tabsCount.get(AppCommentPageReqVO.MEDIOCRE_COMMENT_COUNT));
|
assertEquals(2, tabsCount.getMediocreCount());
|
||||||
assertEquals(0, tabsCount.get(AppCommentPageReqVO.NEGATIVE_COMMENT_COUNT));
|
assertEquals(0, tabsCount.getNegativeCount());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,10 +186,10 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
Long productCommentId = productComment.getId();
|
Long productCommentId = productComment.getId();
|
||||||
|
|
||||||
ProductCommentReplyVO replyVO = new ProductCommentReplyVO();
|
ProductCommentReplyReqVO replyVO = new ProductCommentReplyReqVO();
|
||||||
replyVO.setId(productCommentId);
|
replyVO.setId(productCommentId);
|
||||||
replyVO.setReplyContent("测试");
|
replyVO.setReplyContent("测试");
|
||||||
productCommentService.commentReply(replyVO, 1L);
|
productCommentService.replyComment(replyVO, 1L);
|
||||||
|
|
||||||
ProductCommentDO productCommentDO = productCommentMapper.selectById(productCommentId);
|
ProductCommentDO productCommentDO = productCommentMapper.selectById(productCommentId);
|
||||||
assertEquals("测试", productCommentDO.getReplyContent());
|
assertEquals("测试", productCommentDO.getReplyContent());
|
||||||
|
|
|
@ -126,36 +126,81 @@ CREATE TABLE IF NOT EXISTS `product_property_value` (
|
||||||
PRIMARY KEY("id")
|
PRIMARY KEY("id")
|
||||||
) COMMENT '规格值';
|
) COMMENT '规格值';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `product_comment` (
|
CREATE TABLE IF NOT EXISTS `product_comment`
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '评价编号',
|
(
|
||||||
`user_id` bigint NOT NULL COMMENT ' 评价ID 用户编号',
|
`id`
|
||||||
`user_nickname` varchar(128) NOT NULL COMMENT '评价人名称',
|
bigint
|
||||||
`user_avatar` varchar(255) NOT NULL COMMENT '评价人头像',
|
NOT
|
||||||
`anonymous` bit(1) NOT NULL DEFAULT 0 COMMENT '是否匿名 0:不匿名 1:匿名',
|
NULL
|
||||||
`order_id` bigint NOT NULL COMMENT '交易订单编号',
|
AUTO_INCREMENT
|
||||||
`order_item_id` bigint NOT NULL COMMENT '交易订单项编号',
|
COMMENT
|
||||||
`spu_id` bigint NOT NULL COMMENT '商品SPU编号',
|
'评论编号,主键自增',
|
||||||
`spu_name` varchar NOT NULL COMMENT '商品SPU名称',
|
`user_id`
|
||||||
`sku_id` bigint NOT NULL COMMENT '商品SKU编号',
|
bigint
|
||||||
`visible` bit(1) NOT NULL DEFAULT 1 COMMENT '是否可见 true:显示 false:隐藏',
|
DEFAULT
|
||||||
`scores` int NOT NULL COMMENT '评分星级 1-5分',
|
NULL
|
||||||
`description_scores` int NOT NULL COMMENT '描述星级 1-5分',
|
COMMENT
|
||||||
`benefit_scores` int NOT NULL COMMENT '服务星级 1-5分',
|
'评价人的用户编号关联 MemberUserDO 的 id 编号',
|
||||||
`delivery_scores` int NOT NULL COMMENT '配送星级 1-5分',
|
`user_nickname`
|
||||||
`content` varchar(2000) NOT NULL COMMENT '评论内容',
|
varchar
|
||||||
`pic_urls` varchar(1024) DEFAULT '' COMMENT '评论图片地址数组,以逗号分隔最多上传9张',
|
(
|
||||||
`replied` bit(1) NOT NULL DEFAULT 0 COMMENT '商家是否回复 1:回复 0:未回复',
|
255
|
||||||
`reply_user_id` bigint COMMENT '回复管理员编号',
|
) DEFAULT NULL COMMENT '评价人名称',
|
||||||
`reply_content` varchar(2000) COMMENT '商家回复内容',
|
`user_avatar` varchar
|
||||||
`reply_time` datetime COMMENT '商家回复时间',
|
(
|
||||||
`additional_content` varchar(2000) COMMENT '追加评价内容',
|
1024
|
||||||
`additional_pic_urls` varchar(1024) COMMENT '追评评价图片地址数组,以逗号分隔最多上传9张',
|
) DEFAULT NULL COMMENT '评价人头像',
|
||||||
`additional_time` datetime COMMENT '追加评价时间',
|
`anonymous` bit
|
||||||
"creator" varchar(64) DEFAULT '',
|
(
|
||||||
"create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
1
|
||||||
"updater" varchar(64) DEFAULT '',
|
) DEFAULT NULL COMMENT '是否匿名',
|
||||||
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`order_id` bigint DEFAULT NULL COMMENT '交易订单编号关联 TradeOrderDO 的 id 编号',
|
||||||
|
`order_item_id` bigint DEFAULT NULL COMMENT '交易订单项编号关联 TradeOrderItemDO 的 id 编号',
|
||||||
|
`spu_id` bigint DEFAULT NULL COMMENT '商品 SPU 编号关联 ProductSpuDO 的 id',
|
||||||
|
`spu_name` varchar
|
||||||
|
(
|
||||||
|
255
|
||||||
|
) DEFAULT NULL COMMENT '商品 SPU 名称',
|
||||||
|
`sku_id` bigint DEFAULT NULL COMMENT '商品 SKU 编号关联 ProductSkuDO 的 id 编号',
|
||||||
|
`visible` bit
|
||||||
|
(
|
||||||
|
1
|
||||||
|
) DEFAULT NULL COMMENT '是否可见true:显示false:隐藏',
|
||||||
|
`scores` tinyint DEFAULT NULL COMMENT '评分星级1-5分',
|
||||||
|
`description_scores` tinyint DEFAULT NULL COMMENT '描述星级1-5 星',
|
||||||
|
`benefit_scores` tinyint DEFAULT NULL COMMENT '服务星级1-5 星',
|
||||||
|
`content` varchar
|
||||||
|
(
|
||||||
|
1024
|
||||||
|
) DEFAULT NULL COMMENT '评论内容',
|
||||||
|
`pic_urls` varchar
|
||||||
|
(
|
||||||
|
4096
|
||||||
|
) DEFAULT NULL COMMENT '评论图片地址数组',
|
||||||
|
`reply_status` bit
|
||||||
|
(
|
||||||
|
1
|
||||||
|
) DEFAULT NULL COMMENT '商家是否回复',
|
||||||
|
`reply_user_id` bigint DEFAULT NULL COMMENT '回复管理员编号关联 AdminUserDO 的 id 编号',
|
||||||
|
`reply_content` varchar
|
||||||
|
(
|
||||||
|
1024
|
||||||
|
) DEFAULT NULL COMMENT '商家回复内容',
|
||||||
|
`reply_time` datetime DEFAULT NULL COMMENT '商家回复时间',
|
||||||
|
`creator` varchar
|
||||||
|
(
|
||||||
|
64
|
||||||
|
) DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`updater` varchar
|
||||||
|
(
|
||||||
|
64
|
||||||
|
) DEFAULT '' COMMENT '更新者',
|
||||||
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
"tenant_id" bigint not null default '0',
|
"tenant_id" bigint not null default '0',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY
|
||||||
) COMMENT '商品评价';
|
(
|
||||||
|
`id`
|
||||||
|
)
|
||||||
|
) COMMENT '产品评论表';
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package cn.iocoder.yudao.module.trade.api.order;
|
package cn.iocoder.yudao.module.trade.api.order;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单 API 接口
|
* 订单 API 接口
|
||||||
*
|
*
|
||||||
|
@ -10,11 +8,12 @@ import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
||||||
public interface TradeOrderApi {
|
public interface TradeOrderApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单通过订单 id
|
* 验证订单
|
||||||
*
|
*
|
||||||
* @param id id
|
* @param userId 用户 id
|
||||||
* @return 订单信息 Response DTO
|
* @param orderItemId 订单项 id
|
||||||
|
* @return 校验通过返回订单 id
|
||||||
*/
|
*/
|
||||||
TradeOrderRespDTO getOrder(Long id);
|
Long validateOrder(Long userId, Long orderItemId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
package cn.iocoder.yudao.module.trade.api.order;
|
package cn.iocoder.yudao.module.trade.api.order;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||||
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
|
||||||
import cn.iocoder.yudao.module.trade.service.order.TradeOrderService;
|
import cn.iocoder.yudao.module.trade.service.order.TradeOrderService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单 API 接口实现类
|
* 订单 API 接口实现类
|
||||||
*
|
*
|
||||||
|
@ -21,8 +23,14 @@ public class TradeOrderApiImpl implements TradeOrderApi {
|
||||||
private TradeOrderService tradeOrderService;
|
private TradeOrderService tradeOrderService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TradeOrderRespDTO getOrder(Long id) {
|
public Long validateOrder(Long userId, Long orderItemId) {
|
||||||
return TradeOrderConvert.INSTANCE.convert(tradeOrderService.getOrder(id));
|
// 校验订单项,订单项存在订单就存在
|
||||||
|
TradeOrderItemDO item = tradeOrderService.getOrderItem(userId, orderItemId);
|
||||||
|
if (item == null) {
|
||||||
|
throw exception(ORDER_ITEM_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
return item.getOrderId();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
|
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
|
||||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
|
import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi;
|
||||||
import cn.iocoder.yudao.module.product.api.property.ProductPropertyValueApi;
|
import cn.iocoder.yudao.module.product.api.property.ProductPropertyValueApi;
|
||||||
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
|
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemCommentCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemRespVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
|
@ -15,6 +17,7 @@ import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
||||||
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
|
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
|
||||||
import cn.iocoder.yudao.module.trade.service.order.TradeOrderService;
|
import cn.iocoder.yudao.module.trade.service.order.TradeOrderService;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
@ -24,14 +27,15 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
@Tag(name = "用户 App - 交易订单")
|
@Tag(name = "用户 App - 交易订单")
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -49,6 +53,9 @@ public class AppTradeOrderController {
|
||||||
@Resource
|
@Resource
|
||||||
private TradeOrderProperties tradeOrderProperties;
|
private TradeOrderProperties tradeOrderProperties;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProductCommentApi productCommentApi;
|
||||||
|
|
||||||
@GetMapping("/settlement")
|
@GetMapping("/settlement")
|
||||||
@Operation(summary = "获得订单结算信息")
|
@Operation(summary = "获得订单结算信息")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
|
@ -106,7 +113,7 @@ public class AppTradeOrderController {
|
||||||
@GetMapping("/get-count")
|
@GetMapping("/get-count")
|
||||||
@Operation(summary = "获得交易订单数量")
|
@Operation(summary = "获得交易订单数量")
|
||||||
public CommonResult<Map<String, Long>> getOrderCount() {
|
public CommonResult<Map<String, Long>> getOrderCount() {
|
||||||
Map<String, Long> orderCount = new HashMap<>();
|
Map<String, Long> orderCount = Maps.newLinkedHashMapWithExpectedSize(5);
|
||||||
// 全部
|
// 全部
|
||||||
orderCount.put("allCount", tradeOrderService.getOrderCount(getLoginUserId(), null, null));
|
orderCount.put("allCount", tradeOrderService.getOrderCount(getLoginUserId(), null, null));
|
||||||
// 待付款(未支付)
|
// 待付款(未支付)
|
||||||
|
@ -130,11 +137,18 @@ public class AppTradeOrderController {
|
||||||
return success(TradeOrderConvert.INSTANCE.convert03(item));
|
return success(TradeOrderConvert.INSTANCE.convert03(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 芋艿:待实现
|
|
||||||
@PostMapping("/item/create-comment")
|
@PostMapping("/item/create-comment")
|
||||||
@Operation(summary = "创建交易订单项的评价")
|
@Operation(summary = "创建交易订单项的评价")
|
||||||
public CommonResult<Long> createOrderItemComment() {
|
public CommonResult<Long> createOrderItemComment(@RequestBody AppTradeOrderItemCommentCreateReqVO createReqVO) {
|
||||||
return success(0L);
|
// 校验订单项,订单项存在订单就存在
|
||||||
|
TradeOrderItemDO item = tradeOrderService.getOrderItem(createReqVO.getUserId(), createReqVO.getOrderItemId());
|
||||||
|
if (item == null) {
|
||||||
|
throw exception(ORDER_ITEM_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return success(productCommentApi.createComment(TradeOrderConvert.INSTANCE.convert04(createReqVO), item.getOrderId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO 合并代码后发现只有商家回复功能 用户追评不要了吗?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
package cn.iocoder.yudao.module.trade.controller.app.order.vo.item;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品评价创建 Request VO
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户APP - 商品评价创建 Request VO")
|
||||||
|
@Data
|
||||||
|
public class AppTradeOrderItemCommentCreateReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "是否匿名", required = true, example = "true")
|
||||||
|
@NotNull(message = "是否匿名不能为空")
|
||||||
|
private Boolean anonymous;
|
||||||
|
|
||||||
|
@Schema(description = "交易订单项编号", required = true, example = "2312312")
|
||||||
|
@NotNull(message = "交易订单项编号不能为空")
|
||||||
|
private Long orderItemId;
|
||||||
|
|
||||||
|
@Schema(description = "商品SPU编号", required = true, example = "29502")
|
||||||
|
@NotNull(message = "商品SPU编号不能为空")
|
||||||
|
private Long spuId;
|
||||||
|
|
||||||
|
@Schema(description = "商品SPU名称", required = true, example = "丝滑飘逸小短裙")
|
||||||
|
@NotNull(message = "商品SPU名称不能为空")
|
||||||
|
private String spuName;
|
||||||
|
|
||||||
|
@Schema(description = "商品SKU编号", required = true, example = "3082")
|
||||||
|
@NotNull(message = "商品SKU编号不能为空")
|
||||||
|
private Long skuId;
|
||||||
|
|
||||||
|
@Schema(description = "评分星级 1-5分", required = true, example = "5")
|
||||||
|
@NotNull(message = "评分星级 1-5分不能为空")
|
||||||
|
private Integer scores;
|
||||||
|
|
||||||
|
@Schema(description = "描述星级 1-5分", required = true, example = "5")
|
||||||
|
@NotNull(message = "描述星级 1-5分不能为空")
|
||||||
|
private Integer descriptionScores;
|
||||||
|
|
||||||
|
@Schema(description = "服务星级 1-5分", required = true, example = "5")
|
||||||
|
@NotNull(message = "服务星级 1-5分不能为空")
|
||||||
|
private Integer benefitScores;
|
||||||
|
|
||||||
|
@Schema(description = "评论内容", required = true, example = "穿身上很漂亮诶(*^▽^*)")
|
||||||
|
@NotNull(message = "评论内容不能为空")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@Schema(description = "评论图片地址数组,以逗号分隔最多上传9张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xx.png]")
|
||||||
|
@Size(max = 9, message = "评论图片地址数组长度不能超过9张")
|
||||||
|
private List<String> picUrls;
|
||||||
|
|
||||||
|
@Schema(description = "评价人名称", required = true, example = "小姑凉")
|
||||||
|
@NotNull(message = "评价人名称不能为空")
|
||||||
|
private String userNickname;
|
||||||
|
|
||||||
|
@Schema(description = "评价人头像", required = true, example = "https://www.iocoder.cn/xx.png")
|
||||||
|
@NotNull(message = "评价人头像不能为空")
|
||||||
|
private String userAvatar;
|
||||||
|
|
||||||
|
@Schema(description = "评价人", required = true, example = "16868")
|
||||||
|
@NotNull(message = "评价人不能为空")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||||
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.product.api.comment.dto.CommentCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
|
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
|
||||||
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
|
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
|
||||||
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateReqDTO;
|
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateReqDTO;
|
||||||
|
@ -18,6 +19,7 @@ import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDetailR
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageItemRespVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageItemRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemCommentCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemRespVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.cart.TradeCartDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.cart.TradeCartDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
|
@ -75,9 +77,10 @@ public interface TradeOrderConvert {
|
||||||
return orderItem;
|
return orderItem;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
TradeOrderItemDO convert(TradePriceCalculateRespBO.OrderItem item);
|
TradeOrderItemDO convert(TradePriceCalculateRespBO.OrderItem item);
|
||||||
|
|
||||||
@Mapping(source = "userId" , target = "userId")
|
@Mapping(source = "userId", target = "userId")
|
||||||
PriceCalculateReqDTO convert(AppTradeOrderCreateReqVO createReqVO, Long userId);
|
PriceCalculateReqDTO convert(AppTradeOrderCreateReqVO createReqVO, Long userId);
|
||||||
|
|
||||||
@Mappings({
|
@Mappings({
|
||||||
|
@ -85,6 +88,7 @@ public interface TradeOrderConvert {
|
||||||
@Mapping(source = "count", target = "incrCount"),
|
@Mapping(source = "count", target = "incrCount"),
|
||||||
})
|
})
|
||||||
ProductSkuUpdateStockReqDTO.Item convert(TradeOrderItemDO bean);
|
ProductSkuUpdateStockReqDTO.Item convert(TradeOrderItemDO bean);
|
||||||
|
|
||||||
List<ProductSkuUpdateStockReqDTO.Item> convertList(List<TradeOrderItemDO> list);
|
List<ProductSkuUpdateStockReqDTO.Item> convertList(List<TradeOrderItemDO> list);
|
||||||
|
|
||||||
default PayOrderCreateReqDTO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
default PayOrderCreateReqDTO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
||||||
|
@ -148,7 +152,9 @@ public interface TradeOrderConvert {
|
||||||
});
|
});
|
||||||
return new PageResult<>(orderVOs, pageResult.getTotal());
|
return new PageResult<>(orderVOs, pageResult.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
TradeOrderPageItemRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> items);
|
TradeOrderPageItemRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||||
|
|
||||||
ProductPropertyValueDetailRespVO convert(ProductPropertyValueDetailRespDTO bean);
|
ProductPropertyValueDetailRespVO convert(ProductPropertyValueDetailRespDTO bean);
|
||||||
|
|
||||||
// TODO 芋艿:可简化
|
// TODO 芋艿:可简化
|
||||||
|
@ -179,7 +185,9 @@ public interface TradeOrderConvert {
|
||||||
orderVO.setUser(convert(user));
|
orderVO.setUser(convert(user));
|
||||||
return orderVO;
|
return orderVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
TradeOrderDetailRespVO convert2(TradeOrderDO order, List<TradeOrderItemDO> items);
|
TradeOrderDetailRespVO convert2(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||||
|
|
||||||
MemberUserRespVO convert(MemberUserRespDTO bean);
|
MemberUserRespVO convert(MemberUserRespDTO bean);
|
||||||
|
|
||||||
// TODO 芋艿:可简化
|
// TODO 芋艿:可简化
|
||||||
|
@ -214,7 +222,9 @@ public interface TradeOrderConvert {
|
||||||
});
|
});
|
||||||
return new PageResult<>(orderVOs, pageResult.getTotal());
|
return new PageResult<>(orderVOs, pageResult.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
AppTradeOrderPageItemRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> items);
|
AppTradeOrderPageItemRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||||
|
|
||||||
AppProductPropertyValueDetailRespVO convert02(ProductPropertyValueDetailRespDTO bean);
|
AppProductPropertyValueDetailRespVO convert02(ProductPropertyValueDetailRespDTO bean);
|
||||||
|
|
||||||
default AppTradeOrderDetailRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
default AppTradeOrderDetailRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
||||||
|
@ -243,10 +253,13 @@ public interface TradeOrderConvert {
|
||||||
orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId()));
|
orderVO.setReceiverAreaName(AreaUtils.format(order.getReceiverAreaId()));
|
||||||
return orderVO;
|
return orderVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppTradeOrderDetailRespVO convert3(TradeOrderDO order, List<TradeOrderItemDO> items);
|
AppTradeOrderDetailRespVO convert3(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||||
|
|
||||||
AppTradeOrderItemRespVO convert03(TradeOrderItemDO bean);
|
AppTradeOrderItemRespVO convert03(TradeOrderItemDO bean);
|
||||||
|
|
||||||
|
CommentCreateReqDTO convert04(AppTradeOrderItemCommentCreateReqVO createReqVO);
|
||||||
|
|
||||||
default TradePriceCalculateReqBO convert(Long userId, AppTradeOrderSettlementReqVO settlementReqVO,
|
default TradePriceCalculateReqBO convert(Long userId, AppTradeOrderSettlementReqVO settlementReqVO,
|
||||||
List<TradeCartDO> cartList) {
|
List<TradeCartDO> cartList) {
|
||||||
TradePriceCalculateReqBO reqBO = new TradePriceCalculateReqBO();
|
TradePriceCalculateReqBO reqBO = new TradePriceCalculateReqBO();
|
||||||
|
@ -286,6 +299,8 @@ public interface TradeOrderConvert {
|
||||||
}
|
}
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppTradeOrderSettlementRespVO convert0(TradePriceCalculateRespBO calculate, AddressRespDTO address);
|
AppTradeOrderSettlementRespVO convert0(TradePriceCalculateRespBO calculate, AddressRespDTO address);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue