Merge remote-tracking branch 'origin/master'

This commit is contained in:
sin-ning@aliyun.com 2019-05-29 23:30:42 +08:00
commit 816f088a1b
14 changed files with 158 additions and 95 deletions

View File

@ -0,0 +1,44 @@
package cn.iocoder.mall.order.application.controller.users;
import cn.iocoder.common.framework.constant.MallConstants;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.order.api.OrderCommentService;
import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO;
import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO;
import cn.iocoder.mall.user.sdk.annotation.RequiresLogin;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
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;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
*
* 订单评论 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;
@PostMapping("create_order_comment")
//@RequiresLogin
@ApiOperation(value = "创建订单")
public CommonResult<OrderCommentCreateBO> createOrder(@RequestBody @Validated OrderCommentCreateDTO orderCommentCreateDTO) {
return success(orderCommentService.createOrderComment(orderCommentCreateDTO));
}
}

View File

@ -1,6 +1,8 @@
package cn.iocoder.mall.order.api; package cn.iocoder.mall.order.api;
import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO;
import cn.iocoder.mall.order.api.bo.OrderCommentReplyPageBO; import cn.iocoder.mall.order.api.bo.OrderCommentReplyPageBO;
import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO;
import cn.iocoder.mall.order.api.dto.OrderCommentReplyPageDTO; import cn.iocoder.mall.order.api.dto.OrderCommentReplyPageDTO;
import java.util.List; import java.util.List;
@ -21,4 +23,12 @@ public interface OrderCommentReplyService {
* @return * @return
*/ */
List<OrderCommentReplyPageBO> getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO); List<OrderCommentReplyPageBO> getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO);
/**
* 评论回复创建
* @param orderCommentReplyCreateDTO
* @return
*/
OrderCommentReplyCreateBO createOrderCommentReply(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO);
} }

View File

@ -3,10 +3,8 @@ package cn.iocoder.mall.order.api;
import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO; import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO;
import cn.iocoder.mall.order.api.bo.OrderCommentInfoAndMerchantReplyBO; import cn.iocoder.mall.order.api.bo.OrderCommentInfoAndMerchantReplyBO;
import cn.iocoder.mall.order.api.bo.OrderCommentPageBO; import cn.iocoder.mall.order.api.bo.OrderCommentPageBO;
import cn.iocoder.mall.order.api.constant.OrderReplyUserTypeEnum;
import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO;
import cn.iocoder.mall.order.api.dto.OrderCommentPageDTO; import cn.iocoder.mall.order.api.dto.OrderCommentPageDTO;
import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO;
/** /**
* 订单评论模块 * 订单评论模块
@ -24,12 +22,6 @@ public interface OrderCommentService {
OrderCommentCreateBO createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO); OrderCommentCreateBO createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO);
/**
* 评论回复创建
* @param orderCommentReplyCreateDTO
* @return
*/
Boolean createOrderCommentReply(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO);
/** /**
* 获取评论列表的分页 * 获取评论列表的分页

View File

@ -5,7 +5,6 @@ import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* *

View File

@ -1,5 +1,10 @@
package cn.iocoder.mall.order.api.bo; package cn.iocoder.mall.order.api.bo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/** /**
* *
* 订单评论创建 * 订单评论创建
@ -8,10 +13,12 @@ package cn.iocoder.mall.order.api.bo;
* @time 2019-05-19 18:32 * @time 2019-05-19 18:32
* *
*/ */
public class OrderCommentCreateBO { @Data
@Accessors(chain = true)
public class OrderCommentCreateBO implements Serializable {
/** /**
* 订单评论 id * 订单评论 id
*/ */
private Integer commentId; private Integer id;
} }

View File

@ -86,7 +86,7 @@ public class OrderCommentInfoAndMerchantReplyBO {
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
private static class OrderCommentReplayMerchantItem{ public static class OrderCommentReplayMerchantItem{
/** /**
* 回复的内容 * 回复的内容
*/ */

View File

@ -24,20 +24,21 @@ public class OrderCommentPageBO implements Serializable {
*/ */
private Integer total; private Integer total;
/** // 评论标签化等等在做
* 好评 // /**
*/ // * 好评
private Integer positiveTotal; // */
// private Integer positiveTotal;
/** //
* 中评 // /**
*/ // * 中评
private Integer moderateTotal; // */
// private Integer moderateTotal;
/** //
* 差评 // /**
*/ // * 差评
private Integer negativeTotal; // */
// private Integer negativeTotal;
/** /**
* 评论列表 * 评论列表
@ -47,7 +48,7 @@ public class OrderCommentPageBO implements Serializable {
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
private static class OrderCommentItem{ public static class OrderCommentItem{
/** /**
* 评论 id * 评论 id
*/ */

View File

@ -1,8 +1,12 @@
package cn.iocoder.mall.order.api.dto; package cn.iocoder.mall.order.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -12,92 +16,70 @@ import java.io.Serializable;
* @time 2019-05-15 20:42 * @time 2019-05-15 20:42
* *
*/ */
@ApiModel("订单创建 DTO")
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
public class OrderCommentCreateDTO implements Serializable { public class OrderCommentCreateDTO implements Serializable {
/**
* 订单 id
*/
private int orderId;
/** @ApiModelProperty(value = "订单 id", required = true)
* 订单编号 @NotNull(message = "订单 id 不能为空")
*/ private Integer orderId;
@ApiModelProperty(value = "订单编号", required = true)
@NotEmpty(message = "订单编号不能为空")
private String orderNo; private String orderNo;
/** @ApiModelProperty(value = "商品 spu id", required = true)
* 商品 spu id @NotNull(message = "商品的 spu id 不能为空")
*/ private Integer productSpuId;
private int productSpuId;
/** @ApiModelProperty(value = "商品 spu name", required = true)
* 商品 spu 名字 spu 这两个属性待考量我认为加入进去以后后期一些分析可能好做一些 @NotEmpty(message = "商品的 spu name 不能为空")
*/
private String productSpuName; private String productSpuName;
/** @ApiModelProperty(value = "商品 sku id", required = true)
* 商品 sku id @NotNull(message = "商品的 sku id 不能为空")
*/ private Integer productSkuId;
private int productSkuId;
/** @ApiModelProperty(value = "商品 sku attrs", required = true)
* 商品 sku 属性 @NotEmpty(message = "商品的 sku attrs 不能为空")
*/
private String productSkuAttrs; private String productSkuAttrs;
/** @ApiModelProperty(value = "商品 sku price", required = true)
* 商品 sku 价格 @NotNull(message = "商品的 sku price 不能为空")
*/ private Integer productSkuPrice;
private int productSkuPrice;
/** @ApiModelProperty(value = "商品 sku url", required = true)
* 商品 sku 地址 @NotEmpty(message = "商品的 sku url 不能为空")
*/
private String productSkuPicUrl; private String productSkuPicUrl;
/** @ApiModelProperty(value = "用户 id", required = true)
* 用户 id @NotNull(message = "用户 id 不能为空")
*/
private Integer userId; private Integer userId;
/** @ApiModelProperty(value = "用户头像", required = true)
* 用户头像
*/
private String userAvatar; private String userAvatar;
/** @ApiModelProperty(value = "用户昵称", required = true)
* 用户昵称 @NotEmpty(message = "用户昵称不能为空")
*/
private String userNickName; private String userNickName;
/** @ApiModelProperty(value = "评价星级", required = true,example = "1-5")
*
*/
private Integer star; private Integer star;
/** @ApiModelProperty(value = "商品描述星级", required = true,example = "1-5")
* 产品描述
*/
private Integer productDescriptionStar; private Integer productDescriptionStar;
/** @ApiModelProperty(value = "物流评价星级", required = true,example = "1-5")
* 物流评价
*/
private Integer logisticsStar; private Integer logisticsStar;
/** @ApiModelProperty(value = "商家评价星级", required = true,example = "1-5")
* 商家评价
*/
private Integer merchantStar; private Integer merchantStar;
/** @ApiModelProperty(value = "商家评价内容", required = true,example = "1-5")
* 评论内容
*/
private String commentContent; private String commentContent;
/** @ApiModelProperty(value = "评价图片", required = true)
* 评论图片
*/
private String commentPics; private String commentPics;
} }

View File

@ -1,13 +1,15 @@
package cn.iocoder.mall.order.biz.convert; 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.bo.OrderCommentCreateBO;
import cn.iocoder.mall.order.api.bo.OrderCommentPageBO;
import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO;
import cn.iocoder.mall.order.biz.dataobject.OrderCommentDO; import cn.iocoder.mall.order.biz.dataobject.OrderCommentDO;
import org.apache.ibatis.annotations.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.List;
/** /**
* 订单评论 convert * 订单评论 convert
*/ */
@ -21,4 +23,7 @@ public interface OrderCommentConvert {
@Mappings({}) @Mappings({})
OrderCommentCreateBO convert(OrderCommentDO orderCommentDO); OrderCommentCreateBO convert(OrderCommentDO orderCommentDO);
@Mappings({})
List<OrderCommentPageBO.OrderCommentItem> convert(List<OrderCommentDO> orderCommentDOList);
} }

View File

@ -7,6 +7,7 @@ import cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
@ -50,4 +51,13 @@ public interface OrderCommentReplayMapper {
int selectCommentReplyTotalCountByCommentId(@Param("commentId") Integer commentId, int selectCommentReplyTotalCountByCommentId(@Param("commentId") Integer commentId,
@Param("userType") Integer userType); @Param("userType") Integer userType);
/**
* 根据评论 id 查询最新的商家回复
* @param commentIds
* @return
*/
List<OrderCommentReplyDO> selectCommentNewMerchantReplyByCommentIds(@Param("commentIds") Collection<Integer> commentIds,
@Param("userType") Integer userType);
} }

View File

@ -12,9 +12,9 @@ import lombok.experimental.Accessors;
* @time 2019-05-14 20:48 * @time 2019-05-14 20:48
* *
*/ */
@TableName(value = "order_comment")
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName(value = "order_comment")
public class OrderCommentDO extends BaseDO { public class OrderCommentDO extends BaseDO {
/** /**

View File

@ -6,7 +6,6 @@ import cn.iocoder.mall.order.api.bo.OrderCommentInfoAndMerchantReplyBO;
import cn.iocoder.mall.order.api.bo.OrderCommentPageBO; import cn.iocoder.mall.order.api.bo.OrderCommentPageBO;
import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO;
import cn.iocoder.mall.order.api.dto.OrderCommentPageDTO; 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.convert.OrderCommentConvert;
import cn.iocoder.mall.order.biz.dao.OrderCommentMapper; import cn.iocoder.mall.order.biz.dao.OrderCommentMapper;
import cn.iocoder.mall.order.biz.dao.OrderCommentReplayMapper; import cn.iocoder.mall.order.biz.dao.OrderCommentReplayMapper;
@ -15,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* *
@ -24,14 +24,15 @@ import java.util.Date;
* @time 2019 * @time 2019
*/ */
@Service @Service
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.OrderService.version}") @org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.OrderCommentService.version}")
public class OrderCommentServiceImpl implements OrderCommentService { public class OrderCommentServiceImpl implements OrderCommentService {
@Autowired @Autowired
private OrderCommentMapper orderCommentMapper; private OrderCommentMapper orderCommentMapper;
@Autowired @Autowired
private OrderCommentReplayMapper orderCommentReplayMapper; private OrderCommentService orderCommentService;
@Override @Override
public OrderCommentCreateBO createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO) { public OrderCommentCreateBO createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO) {
@ -40,18 +41,22 @@ public class OrderCommentServiceImpl implements OrderCommentService {
//接下来就是入库 //接下来就是入库
OrderCommentDO orderCommentDO=OrderCommentConvert.INSTANCE.convert(orderCommentCreateDTO); OrderCommentDO orderCommentDO=OrderCommentConvert.INSTANCE.convert(orderCommentCreateDTO);
orderCommentDO.setCreateTime(new Date()); orderCommentDO.setCreateTime(new Date());
orderCommentDO.setUpdateTime(new Date());
orderCommentMapper.insert(orderCommentDO); orderCommentMapper.insert(orderCommentDO);
return OrderCommentConvert.INSTANCE.convert(orderCommentDO); return OrderCommentConvert.INSTANCE.convert(orderCommentDO);
} }
@Override
public Boolean createOrderCommentReply(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO) {
return null;
}
@Override @Override
public OrderCommentPageBO getOrderCommentPage(OrderCommentPageDTO orderCommentPageDTO) { public OrderCommentPageBO getOrderCommentPage(OrderCommentPageDTO orderCommentPageDTO) {
return null; OrderCommentPageBO orderCommentPageBO=new OrderCommentPageBO();
//分页内容
List<OrderCommentDO> orderCommentDOList=orderCommentMapper.selectCommentPage(orderCommentPageDTO);
//查询商家的回复
//总数
int totalCount=orderCommentMapper.selectCommentTotalCountByProductSkuId(orderCommentPageDTO.getProductSkuId());
orderCommentPageBO.setOrderCommentItems(OrderCommentConvert.INSTANCE.convert(orderCommentDOList));
orderCommentPageBO.setTotal(totalCount);
return orderCommentPageBO;
} }
@Override @Override

View File

@ -43,6 +43,8 @@ dubbo:
version: 1.0.0 version: 1.0.0
OrderLogisticsService: OrderLogisticsService:
version: 1.0.0 version: 1.0.0
OrderCommentService:
version: 1.0.0
consumer: consumer:
timeout: 120000 # 设置长一点,方便调试代码 timeout: 120000 # 设置长一点,方便调试代码
ProductSpuService: ProductSpuService:

View File

@ -9,7 +9,7 @@
<!--插入--> <!--插入-->
<insert id="insert" parameterType="OrderCommentReplyDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> <insert id="insert" parameterType="OrderCommentReplyDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
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 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) reply_user_nick_name,reply_user_avatar,user_type,create_time,update_time)
VALUES (#{commentId},#{replyType},#{parentId},#{parentUserId},#{parentUserNickName},#{parentUserAvatar},#{replyContent},#{replyUserId}, VALUES (#{commentId},#{replyType},#{parentId},#{parentUserId},#{parentUserNickName},#{parentUserAvatar},#{replyContent},#{replyUserId},
#{replyUserNickName},#{replyUserAvatar},#{userType},#{createTime},#{updateTime}) #{replyUserNickName},#{replyUserAvatar},#{userType},#{createTime},#{updateTime})
@ -51,4 +51,10 @@
LIMIT ${pageNo * pageSize}, ${pageSize} LIMIT ${pageNo * pageSize}, ${pageSize}
</select> </select>
<!--根据评论 id 查询商家最新的评论列表-->
<select id="selectCommentNewMerchantReplyByCommentIds" resultType="cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO">
</select>
</mapper> </mapper>