diff --git a/order/order-biz/pom.xml b/order/order-biz/pom.xml index 3a30bd194..08e3f4b4f 100644 --- a/order/order-biz/pom.xml +++ b/order/order-biz/pom.xml @@ -48,6 +48,12 @@ 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-data-mongodb + + org.mapstruct diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java deleted file mode 100644 index 8f8ddb4e7..000000000 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.iocoder.mall.order.biz.convert; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -/** - * - * 订单评论 convert - * - * @author wtz - * @time 2019-05-31 18:30 - */ -@Mapper -public interface OrderCommentConvert { - - OrderCommentConvert INSTANCE = Mappers.getMapper(OrderCommentConvert.class); - -// @Mappings({}) -// OrderCommentStateInfoPageBO.OrderCommentStateInfoItem convertOrderCommentStateInfoItem( -// OrderCommentDO orderCommentDO); -// -// @Mappings({}) -// List convertOrderCommentStateInfoItems( -// List orderCommentDOList); -// -// @Mappings({}) -// OrderCommentDO convertOrderCommentDO(OrderCommentCreateDTO orderCommentCreateDTO); -// -// @Mappings({}) -// OrderCommentCreateBO convertOrderCommentCreateBO(OrderCommentDO orderCommentDO); -// -// @Mappings({}) -// OrderCommentInfoBO convertOrderCommentInfoBO(OrderCommentDO orderCommentDO); -// -// @Mappings({}) -// OrderCommentTimeOutBO convertOrderCommentTimeOutBO(OrderCommentDO orderCommentDO); -// -// @Mappings({}) -// List convertOrderCommentTimeOutBOList( -// List orderCommentDOList); - - - -} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/comment/OrderCommentConvert.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/comment/OrderCommentConvert.java new file mode 100644 index 000000000..57a059a10 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/convert/comment/OrderCommentConvert.java @@ -0,0 +1,28 @@ +package cn.iocoder.mall.order.biz.convert.comment; + +import cn.iocoder.mall.order.biz.dataobject.comment.OrderCommentDO; +import cn.iocoder.mall.order.biz.dto.comment.OrderCommentAddDTO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 订单评论转换 + * + * @author xiaofeng + * @version 1.0 + * @date 2020/05/19 23:06 + */ +@Mapper +public interface OrderCommentConvert { + + OrderCommentConvert INSTANCE = Mappers.getMapper(OrderCommentConvert.class); + + /** + * 参数转成 DO + * + * @param orderCommentAddDTO + * @return + */ + OrderCommentDO convert(OrderCommentAddDTO orderCommentAddDTO); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/comment/OrderCommentDO.java similarity index 80% rename from order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java rename to order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/comment/OrderCommentDO.java index 916361748..c551b0b83 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dataobject/comment/OrderCommentDO.java @@ -1,25 +1,24 @@ -package cn.iocoder.mall.order.biz.dataobject; +package cn.iocoder.mall.order.biz.dataobject.comment; import cn.iocoder.mall.mybatis.dataobject.BaseDO; -import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; /** - * 订单评论表 - * - * @author wtz - * @time 2019-05-14 20:48 + * 订单评论 MONGODB * + * @author xiaofeng + * @version 1.0 + * @date 2020/05/19 22:30 */ @Data @Accessors(chain = true) -@TableName(value = "order_comment") +@Document(collection = "order_comment") public class OrderCommentDO extends BaseDO { - /** - * 评论 id // TODO FROM 芋艿 TO wtz 中英文之间,要有空格 - */ + @Id private Integer id; /** @@ -103,7 +102,7 @@ public class OrderCommentDO extends BaseDO { private Integer replayCount; /** - * 点赞数 // TODO FROM 芋艿 TO wtz collect 是收藏的意思,最好换个单词噢。 + * 点赞数 */ private Integer likeCount; diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentAddDTO.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentAddDTO.java new file mode 100644 index 000000000..885960c5b --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentAddDTO.java @@ -0,0 +1,63 @@ +package cn.iocoder.mall.order.biz.dto.comment; + +import java.io.Serializable; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 订单评论创建 + * + * @author wtz + * @update xiaofeng + * @time 2019-05-15 20:42 + * @update time 2020-05-13 0:07 + */ +@Data +@Accessors(chain = true) +public class OrderCommentAddDTO implements Serializable { + + @NotNull(message = "订单 id 不能为空") + private Integer orderId; + + @NotEmpty(message = "订单编号不能为空") + private String orderNo; + + @NotNull(message = "商品的 spu id 不能为空") + private Integer productSpuId; + + @NotEmpty(message = "商品的 spu name 不能为空") + private String productSpuName; + + @NotNull(message = "商品的 sku id 不能为空") + private Integer productSkuId; + + @NotEmpty(message = "商品的 sku attrs 不能为空") + private String productSkuAttrs; + + @NotNull(message = "商品的 sku price 不能为空") + private Integer productSkuPrice; + + @NotEmpty(message = "商品的 sku url 不能为空") + private String productSkuPicUrl; + + private Integer userId; + + private String userAvatar; + + @NotEmpty(message = "用户昵称不能为空") + private String userNickName; + + private Integer star; + + private Integer productDescriptionStar; + + private Integer logisticsStar; + + private Integer merchantStar; + + private String commentContent; + + private String commentPics; +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/comment/OrderCommentService.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/comment/OrderCommentService.java new file mode 100644 index 000000000..6ea648af3 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/comment/OrderCommentService.java @@ -0,0 +1,26 @@ +package cn.iocoder.mall.order.biz.service.comment; + +import cn.iocoder.mall.order.biz.bo.comment.OrderCommentBO; +import cn.iocoder.mall.order.biz.dto.comment.OrderCommentAddDTO; +import javax.validation.Valid; +import org.springframework.validation.annotation.Validated; + +/** + * 订单评论业务 + * + * @author xiaofeng + * @version 1.0 + * @date 2020/05/17 15:24 + */ +@Validated +public interface OrderCommentService { + + /** + * 添加订单评论 + * + * @param orderCommentAddDTO + * @return + */ + Boolean addOrderComment(@Valid OrderCommentAddDTO orderCommentAddDTO); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/comment/OrderCommentServiceImpl.java b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/comment/OrderCommentServiceImpl.java new file mode 100644 index 000000000..d37963593 --- /dev/null +++ b/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/service/comment/OrderCommentServiceImpl.java @@ -0,0 +1,34 @@ +package cn.iocoder.mall.order.biz.service.comment; + +import cn.iocoder.mall.order.biz.convert.comment.OrderCommentConvert; +import cn.iocoder.mall.order.biz.dataobject.comment.OrderCommentDO; +import cn.iocoder.mall.order.biz.dto.comment.OrderCommentAddDTO; +import javax.validation.Valid; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.stereotype.Service; + +/** + * OrderCommentServiceImpl + * + * @author xiaofeng + * @version 1.0 + * @date 2020/05/17 15:32 + */ +@Service +public class OrderCommentServiceImpl implements OrderCommentService { + + private final MongoTemplate mongoTemplate; + + public OrderCommentServiceImpl(final MongoTemplate mongoTemplate) { + this.mongoTemplate = mongoTemplate; + } + + @Override + public Boolean addOrderComment( + @Valid OrderCommentAddDTO orderCommentAddDTO) { + + OrderCommentDO orderCommentDO = mongoTemplate + .save(OrderCommentConvert.INSTANCE.convert(orderCommentAddDTO)); + return null != orderCommentDO ? Boolean.TRUE : Boolean.FALSE; + } +} diff --git a/order/order-biz/src/main/resources/biz.yaml b/order/order-biz/src/main/resources/biz.yaml index fb1c302dd..3adf8f6ea 100644 --- a/order/order-biz/src/main/resources/biz.yaml +++ b/order/order-biz/src/main/resources/biz.yaml @@ -6,6 +6,12 @@ spring: username: root password: 3WLiVUBEwTbvAfsh + #mongodb + data: + mongodb: + uri: mongodb://localhost/order-comment + + # MyBatis Plus 配置项 mybatis-plus: configuration: diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/UsersCartController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/cart/UsersCartController.java similarity index 99% rename from order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/UsersCartController.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/cart/UsersCartController.java index 9b8b4e16a..3f4adc508 100644 --- a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/UsersCartController.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/cart/UsersCartController.java @@ -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; diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentReplyController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/comment/OrderCommentReplyController.java similarity index 96% rename from order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentReplyController.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/comment/OrderCommentReplyController.java index b9787a203..f5e927865 100644 --- a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentReplyController.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/comment/OrderCommentReplyController.java @@ -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; diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/comment/UsersOrderCommentController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/comment/UsersOrderCommentController.java new file mode 100644 index 000000000..2d61e1d90 --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/comment/UsersOrderCommentController.java @@ -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 add( + @RequestBody @Validated UsersOrderCommentAddRequest request) { + Integer userId = UserSecurityContextHolder.getContext().getUserId(); + request.setUserId(userId); + + return CommonResult.success(orderCommentService.addOrderComment( + UsersOrderCommentConvert.INSTANCE.convert(request))); + } + + +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminOrderReturnController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/AdminOrderReturnController.java similarity index 96% rename from order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminOrderReturnController.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/AdminOrderReturnController.java index e0a2e3ba6..029d3a00f 100644 --- a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminOrderReturnController.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/AdminOrderReturnController.java @@ -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; diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminsOrderController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/AdminsOrderController.java similarity index 98% rename from order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminsOrderController.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/AdminsOrderController.java index fa2eb03d6..2d919f2d4 100644 --- a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminsOrderController.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/AdminsOrderController.java @@ -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; diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderController.java similarity index 98% rename from order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderController.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderController.java index ab0d08c95..925d8592b 100644 --- a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderController.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderController.java @@ -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; diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderLogisticsController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderLogisticsController.java similarity index 96% rename from order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderLogisticsController.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderLogisticsController.java index 43bfd8bfd..4eaa37156 100644 --- a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderLogisticsController.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderLogisticsController.java @@ -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; diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderReturnController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderReturnController.java similarity index 95% rename from order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderReturnController.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderReturnController.java index d9ea9dfdd..ab9a1e7db 100644 --- a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderReturnController.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/order/UsersOrderReturnController.java @@ -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; diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentController.java deleted file mode 100644 index d13a233e7..000000000 --- a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentController.java +++ /dev/null @@ -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 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 getOrderCommentPage(@Validated OrderCommentPageDTO orderCommentPageDTO){ -// return success(orderCommentService.getOrderCommentPage(orderCommentPageDTO)); -// } -// -// @GetMapping("order_comment_info_merchant_reply") -// @ApiOperation(value = "获取评论和商家回复") -// public CommonResult 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 getOrderCommentStateInfoPage(@Validated OrderCommentStateInfoPageDTO orderCommentStateInfoPageDTO){ -// //Integer userId = UserSecurityContextHolder.getContext().getUserId(); -// //orderCommentStateInfoPageDTO.setUserId(userId); -// return success(orderCommentService.getOrderCommentStateInfoPage(orderCommentStateInfoPageDTO)); -// } - - -} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/comment/UsersOrderCommentConvert.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/comment/UsersOrderCommentConvert.java new file mode 100644 index 000000000..00d86ec7b --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/comment/UsersOrderCommentConvert.java @@ -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); + +} diff --git a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentCreateDTO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/comment/UsersOrderCommentAddRequest.java similarity index 85% rename from order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentCreateDTO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/comment/UsersOrderCommentAddRequest.java index 5c788825c..4bd07063c 100644 --- a/order/order-biz/src/main/java/cn/iocoder/mall/order/biz/dto/comment/OrderCommentCreateDTO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/comment/UsersOrderCommentAddRequest.java @@ -1,26 +1,23 @@ -package cn.iocoder.mall.order.biz.dto.comment; +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; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - /** - * 订单评论创建 - * - * @author wtz - * @time 2019-05-15 20:42 + * 添加订单评论 * + * @author xiaofeng + * @version 1.0 + * @date 2020/05/12 23:02 */ -@ApiModel("订单创建 DTO") +@ApiModel("用户 - Order 模块 - 添加订单评论") @Data @Accessors(chain = true) -public class OrderCommentCreateDTO implements Serializable { - +public class UsersOrderCommentAddRequest { @ApiModelProperty(value = "订单 id", required = true) @NotNull(message = "订单 id 不能为空") @@ -64,21 +61,22 @@ public class OrderCommentCreateDTO implements Serializable { @NotEmpty(message = "用户昵称不能为空") private String userNickName; - @ApiModelProperty(value = "评价星级", required = true,example = "1-5") + @ApiModelProperty(value = "评价星级", required = true, example = "1-5") private Integer star; - @ApiModelProperty(value = "商品描述星级", required = true,example = "1-5") + @ApiModelProperty(value = "商品描述星级", required = true, example = "1-5") private Integer productDescriptionStar; - @ApiModelProperty(value = "物流评价星级", required = true,example = "1-5") + @ApiModelProperty(value = "物流评价星级", required = true, example = "1-5") private Integer logisticsStar; - @ApiModelProperty(value = "商家评价星级", required = true,example = "1-5") + @ApiModelProperty(value = "商家评价星级", required = true, example = "1-5") private Integer merchantStar; - @ApiModelProperty(value = "商家评价内容", required = true,example = "1-5") + @ApiModelProperty(value = "商家评价内容", required = true, example = "1-5") private String commentContent; @ApiModelProperty(value = "评价图片", required = true) private String commentPics; + }