From 6cdb7e59804d1a7bbf496d863714d046d04d6cae Mon Sep 17 00:00:00 2001 From: wangtongzhou Date: Sun, 19 May 2019 20:28:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=BA=86=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3=E8=AE=A2=E5=8D=95=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E5=92=8C=E8=AF=84=E8=AE=BA=E7=9A=84=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E8=B0=83=E6=95=B4=E4=B8=80=E4=B8=8B=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/order/api/OrderCommentService.java | 3 +- .../order/api/bo/OrderCommentCreateBO.java | 17 +++++ .../api/bo/OrderCommentReplyCreateBO.java | 11 ++++ .../biz/convert/OrderCommentConvert.java | 24 +++++++ .../order/biz/dao/OrderCommentMapper.java | 7 +- .../biz/dao/OrderCommentReplayMapper.java | 6 +- .../biz/service/OrderCommentServiceImpl.java | 66 +++++++++++++++++++ .../resources/mapper/OrderCommentMapper.xml | 2 +- .../mapper/OrderCommentReplayMapper.xml | 2 +- 9 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentCreateBO.java create mode 100644 order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyCreateBO.java create mode 100644 order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java create mode 100644 order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java index 0a72cf65b..62fc8ea70 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java @@ -1,5 +1,6 @@ package cn.iocoder.mall.order.api; +import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO; import cn.iocoder.mall.order.api.bo.OrderCommentInfoAndMerchantReplyBO; import cn.iocoder.mall.order.api.bo.OrderCommentPageBO; import cn.iocoder.mall.order.api.constant.OrderReplyUserTypeEnum; @@ -20,7 +21,7 @@ public interface OrderCommentService { * @param orderCommentCreateDTO * @return */ - Boolean createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO); + OrderCommentCreateBO createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO); /** diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentCreateBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentCreateBO.java new file mode 100644 index 000000000..deac1875f --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentCreateBO.java @@ -0,0 +1,17 @@ +package cn.iocoder.mall.order.api.bo; + +/** + * + * 订单评论创建 + * + * @author wtz + * @time 2019-05-19 18:32 + * + */ +public class OrderCommentCreateBO { + + /** + * 订单评论 id + */ + private Integer commentId; +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyCreateBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyCreateBO.java new file mode 100644 index 000000000..5fcd00ce3 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyCreateBO.java @@ -0,0 +1,11 @@ +package cn.iocoder.mall.order.api.bo; + +/** + * + * 订单回复创建 + * + * @author wtz + * @time 2019-05-19 18:35 + */ +public class OrderCommentReplyCreateBO { +} diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java new file mode 100644 index 000000000..54769cbd9 --- /dev/null +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java @@ -0,0 +1,24 @@ +package cn.iocoder.mall.order.biz.convert; + +import cn.iocoder.mall.order.api.bo.OrderCommentBO; +import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO; +import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; +import cn.iocoder.mall.order.biz.dataobject.OrderCommentDO; +import org.apache.ibatis.annotations.Mapper; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** + * 订单评论 convert + */ +@Mapper +public interface OrderCommentConvert { + + OrderCommentConvert INSTANCE = Mappers.getMapper(OrderCommentConvert.class); + + @Mappings({}) + OrderCommentDO convert(OrderCommentCreateDTO orderCommentCreateDTO); + + @Mappings({}) + OrderCommentCreateBO convert(OrderCommentDO orderCommentDO); +} diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java index b3f1f7f9c..0fabdb377 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java @@ -1,5 +1,6 @@ package cn.iocoder.mall.order.biz.dao; +import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO; import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; import cn.iocoder.mall.order.api.dto.OrderCommentPageDTO; import cn.iocoder.mall.order.biz.dataobject.OrderCommentDO; @@ -17,15 +18,15 @@ import java.util.List; * @time 2019-05-16 20:52 */ @Repository -public interface OrderCommentMapper extends BaseMapper { +public interface OrderCommentMapper{ /** * 插入订单评论 - * @param orderCommentCreateDTO + * @param orderCommentDO * @return */ - int insert(OrderCommentCreateDTO orderCommentCreateDTO); + void insert(OrderCommentDO orderCommentDO); /** diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentReplayMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentReplayMapper.java index 4a328f9e9..b91220312 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentReplayMapper.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentReplayMapper.java @@ -5,6 +5,7 @@ import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO; import cn.iocoder.mall.order.api.dto.OrderCommentReplyPageDTO; import cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO; import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; import java.util.List; @@ -14,14 +15,15 @@ import java.util.List; * @author wtz * @time 2019-05-16 21:33 */ +@Repository public interface OrderCommentReplayMapper { /** * 插入订单评论回复 - * @param orderCommentReplyCreateDTO + * @param orderCommentReplyDO * @return */ - int insert(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO); + void insert(OrderCommentReplyDO orderCommentReplyDO); /** * 根据评论 id 和用户类型获取商家回复 diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java new file mode 100644 index 000000000..434177130 --- /dev/null +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java @@ -0,0 +1,66 @@ +package cn.iocoder.mall.order.biz.service; + +import cn.iocoder.mall.order.api.OrderCommentService; +import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO; +import cn.iocoder.mall.order.api.bo.OrderCommentInfoAndMerchantReplyBO; +import cn.iocoder.mall.order.api.bo.OrderCommentPageBO; +import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; +import cn.iocoder.mall.order.api.dto.OrderCommentPageDTO; +import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO; +import cn.iocoder.mall.order.biz.convert.OrderCommentConvert; +import cn.iocoder.mall.order.biz.dao.OrderCommentMapper; +import cn.iocoder.mall.order.biz.dao.OrderCommentReplayMapper; +import cn.iocoder.mall.order.biz.dataobject.OrderCommentDO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * + * 订单评论 service impl + * + * @author wtz + * @time 2019 + */ +@Service +@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.OrderService.version}") +public class OrderCommentServiceImpl implements OrderCommentService { + + @Autowired + private OrderCommentMapper orderCommentMapper; + + @Autowired + private OrderCommentReplayMapper orderCommentReplayMapper; + + @Override + public OrderCommentCreateBO createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO) { + //首先判断订单状态是否处于待评价状态 + + //接下来就是入库 + OrderCommentDO orderCommentDO=OrderCommentConvert.INSTANCE.convert(orderCommentCreateDTO); + orderCommentDO.setCreateTime(new Date()); + orderCommentMapper.insert(orderCommentDO); + return OrderCommentConvert.INSTANCE.convert(orderCommentDO); + } + + @Override + public Boolean createOrderCommentReply(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO) { + return null; + } + + @Override + public OrderCommentPageBO getOrderCommentPage(OrderCommentPageDTO orderCommentPageDTO) { + return null; + } + + @Override + public OrderCommentInfoAndMerchantReplyBO getOrderCommentInfo(Integer commentId, Integer userType) { + return null; + } + + @Override + public Boolean OrderCommentTimeOutProductCommentTask() { + return null; + } +} diff --git a/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml index 514ccb606..9d96f35ac 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml @@ -9,7 +9,7 @@ - + INSERT INTO order_comment(order_id,order_no,product_spu_id,product_spu_name,product_sku_id, product_sku_attrs,product_sku_price,product_sku_pic_url,user_id,user_avatar,user_nick_name,star, product_description_star,logistics_star,merchant_star,comment_content,comment_pics,create_time,update_time) diff --git a/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml index aa7ed9227..bf3face2b 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml @@ -8,7 +8,7 @@ - + INSERT INTO `order_comment_replay`(comment_id,reply_type,parent_id,parent_user_id,parent_user_nick_name,parent_user_avatar,reply_content,reply_user_id reply_user_nick_name,reply_user_avatar,user_type,create_time,update_time) VALUES (#{commentId},#{replyType},#{parentId},#{parentUserId},#{parentUserNickName},#{parentUserAvatar},#{replyContent},#{replyUserId},