|
@@ -1,19 +1,18 @@
|
|
package com.chelvc.cloud.maintain.controller;
|
|
package com.chelvc.cloud.maintain.controller;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
-import javax.validation.Valid;
|
|
|
|
-import javax.validation.constraints.Min;
|
|
|
|
-
|
|
|
|
import com.chelvc.cloud.maintain.copier.CommentCopier;
|
|
import com.chelvc.cloud.maintain.copier.CommentCopier;
|
|
import com.chelvc.cloud.maintain.vo.CommentVO;
|
|
import com.chelvc.cloud.maintain.vo.CommentVO;
|
|
|
|
+import com.chelvc.cloud.vehicle.api.param.AddGoodsCommentParam;
|
|
import com.chelvc.cloud.vehicle.api.param.CommentQueryParam;
|
|
import com.chelvc.cloud.vehicle.api.param.CommentQueryParam;
|
|
import com.chelvc.cloud.vehicle.api.service.CommentService;
|
|
import com.chelvc.cloud.vehicle.api.service.CommentService;
|
|
import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
|
+import com.chelvc.framework.base.context.SessionContextHolder;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 商品评价接口
|
|
* 商品评价接口
|
|
@@ -32,13 +31,27 @@ public class CommentController {
|
|
* 获取商品评价列表
|
|
* 获取商品评价列表
|
|
*
|
|
*
|
|
* @param goodsId 商品ID
|
|
* @param goodsId 商品ID
|
|
|
|
+ * @param parentId 父级评论id
|
|
|
|
+ * @param merchantId 商户id
|
|
* @param param 查询参数
|
|
* @param param 查询参数
|
|
* @return 商品评价列表
|
|
* @return 商品评价列表
|
|
*/
|
|
*/
|
|
@GetMapping("/goods/{goodsId}/comments")
|
|
@GetMapping("/goods/{goodsId}/comments")
|
|
public List<CommentVO> listGoodsComments(
|
|
public List<CommentVO> listGoodsComments(
|
|
- @PathVariable("goodsId") @Min(value = 1, message = "商品ID不能小于1") Long goodsId,
|
|
|
|
|
|
+ @PathVariable("goodsId") Long goodsId,
|
|
|
|
+ @PathVariable("parentId") Long parentId,
|
|
|
|
+ @PathVariable("merchantId") Long merchantId,
|
|
@Valid CommentQueryParam param) {
|
|
@Valid CommentQueryParam param) {
|
|
- return CommentCopier.INSTANCE.copying(this.commentService.listGoodsComments(goodsId, param));
|
|
|
|
|
|
+ return CommentCopier.INSTANCE.copying(this.commentService.listGoodsComments(goodsId, parentId, merchantId, param));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增商品评价
|
|
|
|
+ *
|
|
|
|
+ * @param param 新增参数
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/goods/comments/add")
|
|
|
|
+ public void addGoodsComments(@Validated @RequestBody AddGoodsCommentParam param) {
|
|
|
|
+ this.commentService.addGoodsComments(param, SessionContextHolder.getId());
|
|
}
|
|
}
|
|
}
|
|
}
|