添加订单评论和MONGODB

This commit is contained in:
xiaofeng
2020-05-19 23:28:19 +08:00
parent e47029cff2
commit c8a7e35731
19 changed files with 275 additions and 143 deletions

View File

@@ -1,4 +1,4 @@
package cn.iocoder.mall.order.rest.controller.users;
package cn.iocoder.mall.order.rest.controller.cart;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

View File

@@ -1,4 +1,4 @@
package cn.iocoder.mall.order.rest.controller.users;
package cn.iocoder.mall.order.rest.controller.comment;
import cn.iocoder.common.framework.constant.MallConstants;
import io.swagger.annotations.Api;

View File

@@ -0,0 +1,48 @@
package cn.iocoder.mall.order.rest.controller.comment;
import cn.iocoder.common.framework.constant.MallConstants;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.order.biz.service.comment.OrderCommentService;
import cn.iocoder.mall.order.rest.convert.comment.UsersOrderCommentConvert;
import cn.iocoder.mall.order.rest.request.comment.UsersOrderCommentAddRequest;
import cn.iocoder.mall.security.core.context.UserSecurityContextHolder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* UsersOrderCommentController
*
* @author xiaofeng
* @version 1.0
* @date 2020/05/12 22:56
*/
@RestController
@RequestMapping(MallConstants.ROOT_PATH_USER + "/order_comment")
@Api("订单商品评论模块")
public class UsersOrderCommentController {
private final OrderCommentService orderCommentService;
public UsersOrderCommentController(
OrderCommentService orderCommentService) {
this.orderCommentService = orderCommentService;
}
@PostMapping("/add")
@ApiOperation(value = "添加订单评论")
public CommonResult<Boolean> add(
@RequestBody @Validated UsersOrderCommentAddRequest request) {
Integer userId = UserSecurityContextHolder.getContext().getUserId();
request.setUserId(userId);
return CommonResult.success(orderCommentService.addOrderComment(
UsersOrderCommentConvert.INSTANCE.convert(request)));
}
}

View File

@@ -1,4 +1,4 @@
package cn.iocoder.mall.order.rest.controller.admins;
package cn.iocoder.mall.order.rest.controller.order;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@@ -1,4 +1,4 @@
package cn.iocoder.mall.order.rest.controller.admins;
package cn.iocoder.mall.order.rest.controller.order;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@@ -1,4 +1,4 @@
package cn.iocoder.mall.order.rest.controller.users;
package cn.iocoder.mall.order.rest.controller.order;
import io.swagger.annotations.Api;
@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("users/order")
@Api(description = "用户订单") // TODO FROM 芋艿 to 小范description 已经废弃啦
public class OrderController {
public class UsersOrderController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderReturnService.version}")
// private OrderService orderService;

View File

@@ -1,4 +1,4 @@
package cn.iocoder.mall.order.rest.controller.users;
package cn.iocoder.mall.order.rest.controller.order;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("users/order_logistics")
@Api(description = "订单物流信息")
public class OrderLogisticsController {
public class UsersOrderLogisticsController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderLogisticsService.version}")
// private OrderLogisticsService orderLogisticsService;

View File

@@ -1,4 +1,4 @@
package cn.iocoder.mall.order.rest.controller.users;
package cn.iocoder.mall.order.rest.controller.order;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("users/order_return")
public class OrderReturnController {
public class UsersOrderReturnController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderReturnService.version}")
// private OrderReturnService orderReturnService;

View File

@@ -1,61 +0,0 @@
package cn.iocoder.mall.order.rest.controller.users;
import cn.iocoder.common.framework.constant.MallConstants;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* 订单评论 Api(user)
*
* @author wtz
* @time 2019-05-27 20:46
*/
@RestController
@RequestMapping(MallConstants.ROOT_PATH_USER + "/order_comment")
@Api("用户评论模块")
public class OrderCommentController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderCommentService.version}")
// private OrderCommentService orderCommentService;
//
// @Reference(validation = "true", version = "${dubbo.provider.OrderCommentReplyService.version}")
// private OrderCommentReplyService orderCommentReplyService;
//
//
// @PostMapping("create_order_comment")
// //@RequiresLogin
// @ApiOperation(value = "创建订单评论")
// public CommonResult<OrderCommentCreateBO> createOrderComment(@RequestBody @Validated OrderCommentCreateDTO orderCommentCreateDTO) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// orderCommentCreateDTO.setUserId(userId);
// return success(orderCommentService.createOrderComment(orderCommentCreateDTO));
// }
//
// @GetMapping("order_comment_page")
// @ApiOperation(value = "获取评论分页")
// public CommonResult<OrderCommentPageBO> getOrderCommentPage(@Validated OrderCommentPageDTO orderCommentPageDTO){
// return success(orderCommentService.getOrderCommentPage(orderCommentPageDTO));
// }
//
// @GetMapping("order_comment_info_merchant_reply")
// @ApiOperation(value = "获取评论和商家回复")
// public CommonResult<OrderCommentInfoAndMerchantReplyBO> geOrderCommentInfoAndMerchantReply(@RequestParam("commentId") Integer commentId){
// OrderCommentInfoAndMerchantReplyBO orderCommentInfoAndMerchantReplyBO=new OrderCommentInfoAndMerchantReplyBO();
// orderCommentInfoAndMerchantReplyBO.setOrderCommentInfoBO(orderCommentService.getOrderCommentInfo(commentId));
// orderCommentInfoAndMerchantReplyBO.setOrderCommentMerchantReplyBOS(orderCommentReplyService.getOrderCommentMerchantReply(commentId));
// return success(orderCommentInfoAndMerchantReplyBO);
// }
//
// @GetMapping
// //@RequiresLogin
// @ApiOperation(value = "获取订单评论状态分页")
// public CommonResult<OrderCommentStateInfoPageBO> getOrderCommentStateInfoPage(@Validated OrderCommentStateInfoPageDTO orderCommentStateInfoPageDTO){
// //Integer userId = UserSecurityContextHolder.getContext().getUserId();
// //orderCommentStateInfoPageDTO.setUserId(userId);
// return success(orderCommentService.getOrderCommentStateInfoPage(orderCommentStateInfoPageDTO));
// }
}

View File

@@ -0,0 +1,29 @@
package cn.iocoder.mall.order.rest.convert.comment;
import cn.iocoder.mall.order.biz.dto.comment.OrderCommentAddDTO;
import cn.iocoder.mall.order.rest.request.comment.UsersOrderCommentAddRequest;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* UsersOrderCommentConvert
*
* @author xiaofeng
* @version 1.0
* @date 2020/05/13 0:15
*/
@Mapper
public interface UsersOrderCommentConvert {
UsersOrderCommentConvert INSTANCE = Mappers.getMapper(UsersOrderCommentConvert.class);
/**
* 保存订单评论参数转换
*
* @param request
* @return
*/
OrderCommentAddDTO convert(UsersOrderCommentAddRequest request);
}

View File

@@ -0,0 +1,82 @@
package cn.iocoder.mall.order.rest.request.comment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 添加订单评论
*
* @author xiaofeng
* @version 1.0
* @date 2020/05/12 23:02
*/
@ApiModel("用户 - Order 模块 - 添加订单评论")
@Data
@Accessors(chain = true)
public class UsersOrderCommentAddRequest {
@ApiModelProperty(value = "订单 id", required = true)
@NotNull(message = "订单 id 不能为空")
private Integer orderId;
@ApiModelProperty(value = "订单编号", required = true)
@NotEmpty(message = "订单编号不能为空")
private String orderNo;
@ApiModelProperty(value = "商品 spu id", required = true)
@NotNull(message = "商品的 spu id 不能为空")
private Integer productSpuId;
@ApiModelProperty(value = "商品 spu name", required = true)
@NotEmpty(message = "商品的 spu name 不能为空")
private String productSpuName;
@ApiModelProperty(value = "商品 sku id", required = true)
@NotNull(message = "商品的 sku id 不能为空")
private Integer productSkuId;
@ApiModelProperty(value = "商品 sku attrs", required = true)
@NotEmpty(message = "商品的 sku attrs 不能为空")
private String productSkuAttrs;
@ApiModelProperty(value = "商品 sku price", required = true)
@NotNull(message = "商品的 sku price 不能为空")
private Integer productSkuPrice;
@ApiModelProperty(value = "商品 sku url", required = true)
@NotEmpty(message = "商品的 sku url 不能为空")
private String productSkuPicUrl;
@ApiModelProperty(value = "用户 id", required = true)
private Integer userId;
@ApiModelProperty(value = "用户头像", required = true)
private String userAvatar;
@ApiModelProperty(value = "用户昵称", required = true)
@NotEmpty(message = "用户昵称不能为空")
private String userNickName;
@ApiModelProperty(value = "评价星级", required = true, example = "1-5")
private Integer star;
@ApiModelProperty(value = "商品描述星级", required = true, example = "1-5")
private Integer productDescriptionStar;
@ApiModelProperty(value = "物流评价星级", required = true, example = "1-5")
private Integer logisticsStar;
@ApiModelProperty(value = "商家评价星级", required = true, example = "1-5")
private Integer merchantStar;
@ApiModelProperty(value = "商家评价内容", required = true, example = "1-5")
private String commentContent;
@ApiModelProperty(value = "评价图片", required = true)
private String commentPics;
}