code review:商品评价哈

This commit is contained in:
YunaiV
2023-06-17 21:57:52 +08:00
parent 08535d6019
commit 35df912be7
21 changed files with 80 additions and 99 deletions

View File

@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.trade.controller.app.order;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi;
@@ -49,13 +48,12 @@ public class AppTradeOrderController {
@Resource
private ProductPropertyValueApi productPropertyValueApi;
@Resource
private ProductCommentApi productCommentApi;
@Resource
private TradeOrderProperties tradeOrderProperties;
@Resource
private ProductCommentApi productCommentApi;
@GetMapping("/settlement")
@Operation(summary = "获得订单结算信息")
@PreAuthenticated
@@ -141,6 +139,7 @@ public class AppTradeOrderController {
@Operation(summary = "创建交易订单项的评价")
public CommonResult<Long> createOrderItemComment(@RequestBody AppTradeOrderItemCommentCreateReqVO createReqVO) {
// 校验订单项,订单项存在订单就存在
// TODO @puhui999要去查询订单是不是自己的不然别人模拟请求哈
TradeOrderItemDO item = tradeOrderService.getOrderItem(createReqVO.getUserId(), createReqVO.getOrderItemId());
if (item == null) {
throw exception(ORDER_ITEM_NOT_FOUND);
@@ -149,6 +148,6 @@ public class AppTradeOrderController {
return success(productCommentApi.createComment(TradeOrderConvert.INSTANCE.convert04(createReqVO), item.getOrderId()));
}
// TODO 合并代码后发现只有商家回复功能 用户追评不要了吗?
// TODO 合并代码后发现只有商家回复功能 用户追评不要了吗?不要了哈;
}

View File

@@ -7,11 +7,6 @@ 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 {
@@ -24,6 +19,7 @@ public class AppTradeOrderItemCommentCreateReqVO {
@NotNull(message = "交易订单项编号不能为空")
private Long orderItemId;
// TODO @puhuispuId、spuName、skuId 直接查询出来;
@Schema(description = "商品SPU编号", required = true, example = "29502")
@NotNull(message = "商品SPU编号不能为空")
private Long spuId;
@@ -36,30 +32,32 @@ public class AppTradeOrderItemCommentCreateReqVO {
@NotNull(message = "商品SKU编号不能为空")
private Long skuId;
@Schema(description = "评分星级 1-5分", required = true, example = "5")
@NotNull(message = "评分星级 1-5分不能为空")
@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分不能为空")
@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分不能为空")
@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")
@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;
// TODO @puhuiuserAvatar、userAvatar、userId 直接查询出来;
@Schema(description = "评价人头像", required = true, example = "https://www.iocoder.cn/xx.png")
@NotNull(message = "评价人头像不能为空")
private String userAvatar;

View File

@@ -8,7 +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.user.dto.MemberUserRespDTO;
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.comment.dto.ProductCommentCreateReqDTO;
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.promotion.api.price.dto.PriceCalculateReqDTO;
@@ -227,6 +227,7 @@ public interface TradeOrderConvert {
AppProductPropertyValueDetailRespVO convert02(ProductPropertyValueDetailRespDTO bean);
// TODO 芋艿:可简化
default AppTradeOrderDetailRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
List<ProductPropertyValueDetailRespDTO> propertyValueDetails, TradeOrderProperties tradeOrderProperties) {
AppTradeOrderDetailRespVO orderVO = convert3(order, orderItems);
@@ -258,7 +259,7 @@ public interface TradeOrderConvert {
AppTradeOrderItemRespVO convert03(TradeOrderItemDO bean);
CommentCreateReqDTO convert04(AppTradeOrderItemCommentCreateReqVO createReqVO);
ProductCommentCreateReqDTO convert04(AppTradeOrderItemCommentCreateReqVO createReqVO);
default TradePriceCalculateReqBO convert(Long userId, AppTradeOrderSettlementReqVO settlementReqVO,
List<TradeCartDO> cartList) {
@@ -302,5 +303,4 @@ public interface TradeOrderConvert {
AppTradeOrderSettlementRespVO convert0(TradePriceCalculateRespBO calculate, AddressRespDTO address);
}