|
@@ -7,13 +7,16 @@ import javax.validation.constraints.Min;
|
|
|
import com.chelvc.cloud.maintain.copier.GoodsCopier;
|
|
|
import com.chelvc.cloud.maintain.vo.GoodsDetailVO;
|
|
|
import com.chelvc.cloud.maintain.vo.SimpleGoodsVO;
|
|
|
+import com.chelvc.cloud.vehicle.api.dto.GoodsDetailDTO;
|
|
|
import com.chelvc.cloud.vehicle.api.param.GoodsQueryParam;
|
|
|
+import com.chelvc.cloud.vehicle.api.service.FavoriteService;
|
|
|
import com.chelvc.cloud.vehicle.api.service.GoodsService;
|
|
|
import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
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.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
/**
|
|
@@ -29,6 +32,9 @@ public class GoodsController {
|
|
|
@DubboReference
|
|
|
private GoodsService goodsService;
|
|
|
|
|
|
+ @DubboReference
|
|
|
+ private FavoriteService favoriteService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取商品详情
|
|
|
*
|
|
@@ -36,8 +42,8 @@ public class GoodsController {
|
|
|
* @return 商品详情
|
|
|
*/
|
|
|
@GetMapping("/goods/{id}")
|
|
|
- public GoodsDetailVO getGoodsDetail(@PathVariable("id") @Min(value = 1, message = "商品ID不能小于1") Long id) {
|
|
|
- return GoodsCopier.INSTANCE.copying(this.goodsService.getGoodsDetail(id));
|
|
|
+ public GoodsDetailDTO getGoodsDetail(@PathVariable("id") @Min(value = 1, message = "商品ID不能小于1") Long id) {
|
|
|
+ return this.goodsService.getGoodsDetail(id);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -53,4 +59,16 @@ public class GoodsController {
|
|
|
@Valid GoodsQueryParam param) {
|
|
|
return GoodsCopier.INSTANCE.copying(this.goodsService.listMerchantSimpleGoods(merchantId, param));
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 收藏商品信息
|
|
|
+ *
|
|
|
+ * @param id 商品ID
|
|
|
+ * @return 收藏ID
|
|
|
+ */
|
|
|
+ @PostMapping("/goods/{id}/favorite")
|
|
|
+ public Long addMerchantFavorite(@PathVariable("id") @Min(value = 1, message = "商家ID不能小于1") Long id) {
|
|
|
+ return this.favoriteService.addMerchantFavorite(id,"GOODS");
|
|
|
+ }
|
|
|
}
|