|
@@ -2,12 +2,17 @@ package com.chelvc.cloud.admin.controller;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import javax.validation.constraints.Min;
|
|
|
+import javax.validation.constraints.NotEmpty;
|
|
|
|
|
|
+import com.chelvc.cloud.vehicle.api.constant.GoodsStatus;
|
|
|
+import com.chelvc.cloud.vehicle.api.dto.CouponDTO;
|
|
|
import com.chelvc.cloud.vehicle.api.dto.MerchantDTO;
|
|
|
import com.chelvc.cloud.vehicle.api.param.MerchantModifyParam;
|
|
|
import com.chelvc.cloud.vehicle.api.param.MerchantPagingParam;
|
|
|
+import com.chelvc.cloud.vehicle.api.service.GoodsService;
|
|
|
import com.chelvc.cloud.vehicle.api.service.MerchantService;
|
|
|
import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
+import com.chelvc.framework.base.util.ResourceUtils;
|
|
|
import com.chelvc.framework.common.model.Pagination;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -19,6 +24,8 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* 商家接口
|
|
|
*
|
|
@@ -32,6 +39,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
public class MerchantController {
|
|
|
@DubboReference
|
|
|
private MerchantService merchantService;
|
|
|
+ @DubboReference
|
|
|
+ private GoodsService goodsService;
|
|
|
|
|
|
/**
|
|
|
* 新增商家
|
|
@@ -66,4 +75,35 @@ public class MerchantController {
|
|
|
public Pagination<MerchantDTO> getMerchantPaging(@Valid MerchantPagingParam param) {
|
|
|
return this.merchantService.getMerchantPaging(param);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取商家信息
|
|
|
+ *
|
|
|
+ * @param id 商家主键
|
|
|
+ * @return 商家信息
|
|
|
+ */
|
|
|
+ @GetMapping("/merchant/{id}")
|
|
|
+ public MerchantDTO getMerchant(@PathVariable("id") @Min(value = 1, message = "商家主键不能小于1") Long id) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上架商品
|
|
|
+ *
|
|
|
+ * @param goodsIds 商品ID集合
|
|
|
+ */
|
|
|
+ @PutMapping("/merchant/list-goods/{goodsIds}")
|
|
|
+ public void listGoods(@PathVariable("goodsIds") @NotEmpty(message = "商品ID不能为空") List<Long> goodsIds) {
|
|
|
+ this.goodsService.updateGoodsStatus(goodsIds, GoodsStatus.ONLINE);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下架商品
|
|
|
+ *
|
|
|
+ * @param goodsIds 商品ID集合
|
|
|
+ */
|
|
|
+ @PutMapping("/merchant/delist-goods/{goodsIds}")
|
|
|
+ public void delistGoods(@PathVariable("goodsIds") @NotEmpty(message = "商品ID不能为空") List<Long> goodsIds) {
|
|
|
+ this.goodsService.updateGoodsStatus(goodsIds, GoodsStatus.OFFLINE);
|
|
|
+ }
|
|
|
}
|