mall + promotion:review 秒杀、评论代码

This commit is contained in:
YunaiV
2023-06-23 21:14:36 +08:00
parent b16632ea41
commit 2efdbf93cb
34 changed files with 58 additions and 139 deletions

View File

@@ -29,7 +29,6 @@ public class TradeOrderApiImpl implements TradeOrderApi {
if (item == null) {
throw exception(ORDER_ITEM_NOT_FOUND);
}
return item.getOrderId();
}

View File

@@ -140,6 +140,7 @@ public class AppTradeOrderController {
@PostMapping("/item/create-comment")
@Operation(summary = "创建交易订单项的评价")
public CommonResult<Long> createOrderItemComment(@RequestBody AppTradeOrderItemCommentCreateReqVO createReqVO) {
// TODO @puhui999这个逻辑最好写到 service 哈;
Long loginUserId = getLoginUserId();
// 先通过订单项 ID 查询订单项是否存在
TradeOrderItemDO orderItemDO = tradeOrderService.getOrderItemByIdAndUserId(createReqVO.getOrderItemId(), loginUserId);
@@ -151,6 +152,7 @@ public class AppTradeOrderController {
if (orderDO == null) {
throw exception(ORDER_NOT_FOUND);
}
// TODO @puhui999要校验订单已完成但是未评价
ProductCommentCreateReqDTO productCommentCreateReqDTO = TradeOrderConvert.INSTANCE.convert04(createReqVO, orderItemDO);
return success(productCommentApi.createComment(productCommentCreateReqDTO));

View File

@@ -19,6 +19,7 @@ public class AppTradeOrderItemCommentCreateReqVO {
@NotNull(message = "交易订单项编号不能为空")
private Long orderItemId;
// TODO @puhui999貌似不用这个字段哈
@Schema(description = "评分星级 1-5 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
@NotNull(message = "评分星级 1-5 分不能为空")
private Integer scores;
@@ -35,7 +36,7 @@ public class AppTradeOrderItemCommentCreateReqVO {
@NotNull(message = "评论内容不能为空")
private String content;
@Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", requiredMode = Schema.RequiredMode.REQUIRED, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xx.png]")
@Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", requiredMode = Schema.RequiredMode.REQUIRED, example = "[https://www.iocoder.cn/xx.png]")
@Size(max = 9, message = "评论图片地址数组长度不能超过 9 张")
private List<String> picUrls;