|
@@ -6,20 +6,20 @@ 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.constant.MerchantStatus;
|
|
|
-import com.chelvc.cloud.vehicle.api.dto.MerchantDTO;
|
|
|
-import com.chelvc.cloud.vehicle.api.dto.MerchantRankDTO;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.MerchantModifyParam;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.MerchantPagingParam;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.MerchantRankParam;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.ReportModifyParam;
|
|
|
-import com.chelvc.cloud.vehicle.api.service.GoodsService;
|
|
|
-import com.chelvc.cloud.vehicle.api.service.MerchantService;
|
|
|
+import com.chelvc.cloud.vehicle.client.GoodsClient;
|
|
|
+import com.chelvc.cloud.vehicle.client.MerchantClient;
|
|
|
+import com.chelvc.cloud.vehicle.client.constant.GoodsStatus;
|
|
|
+import com.chelvc.cloud.vehicle.client.constant.MerchantStatus;
|
|
|
+import com.chelvc.cloud.vehicle.client.dto.MerchantDTO;
|
|
|
+import com.chelvc.cloud.vehicle.client.dto.MerchantRankDTO;
|
|
|
+import com.chelvc.cloud.vehicle.client.param.MerchantModifyParam;
|
|
|
+import com.chelvc.cloud.vehicle.client.param.MerchantPagingParam;
|
|
|
+import com.chelvc.cloud.vehicle.client.param.MerchantRankParam;
|
|
|
+import com.chelvc.cloud.vehicle.client.param.ReportModifyParam;
|
|
|
import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
-import com.chelvc.framework.base.context.SessionContextHolder;
|
|
|
import com.chelvc.framework.common.model.Pagination;
|
|
|
-import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
@@ -37,11 +37,10 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@Validated
|
|
|
@RestController
|
|
|
@ResponseWrapping
|
|
|
+@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
|
|
public class MerchantController {
|
|
|
- @DubboReference
|
|
|
- private MerchantService merchantService;
|
|
|
- @DubboReference
|
|
|
- private GoodsService goodsService;
|
|
|
+ private final GoodsClient goodsClient;
|
|
|
+ private final MerchantClient merchantClient;
|
|
|
|
|
|
/**
|
|
|
* 新增商家
|
|
@@ -51,7 +50,7 @@ public class MerchantController {
|
|
|
*/
|
|
|
@PostMapping("/merchant")
|
|
|
public Long addMerchant(@RequestBody @Valid MerchantModifyParam param) {
|
|
|
- return this.merchantService.addMerchant(param);
|
|
|
+ return this.merchantClient.addMerchant(param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -63,7 +62,7 @@ public class MerchantController {
|
|
|
@PutMapping("/merchant/{id}")
|
|
|
public void updateMerchant(@PathVariable("id") @Min(value = 1, message = "商家主键不能小于1") Long id,
|
|
|
@RequestBody @Valid MerchantModifyParam param) {
|
|
|
- this.merchantService.updateMerchant(id, param);
|
|
|
+ this.merchantClient.updateMerchant(id, param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -74,7 +73,7 @@ public class MerchantController {
|
|
|
*/
|
|
|
@GetMapping("/merchant/paging")
|
|
|
public Pagination<MerchantDTO> getMerchantPaging(@Valid MerchantPagingParam param) {
|
|
|
- return this.merchantService.getMerchantPaging(param);
|
|
|
+ return this.merchantClient.getMerchantPaging(param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -95,7 +94,7 @@ public class MerchantController {
|
|
|
*/
|
|
|
@PutMapping("/merchant/list-goods/{goodsIds}")
|
|
|
public void listGoods(@PathVariable("goodsIds") @NotEmpty(message = "商品ID不能为空") List<Long> goodsIds) {
|
|
|
- this.goodsService.updateGoodsStatus(goodsIds, GoodsStatus.ONLINE);
|
|
|
+ this.goodsClient.updateGoodsStatus(goodsIds, GoodsStatus.ONLINE);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -105,7 +104,7 @@ public class MerchantController {
|
|
|
*/
|
|
|
@PutMapping("/merchant/delist-goods/{goodsIds}")
|
|
|
public void delistGoods(@PathVariable("goodsIds") @NotEmpty(message = "商品ID不能为空") List<Long> goodsIds) {
|
|
|
- this.goodsService.updateGoodsStatus(goodsIds, GoodsStatus.OFFLINE);
|
|
|
+ this.goodsClient.updateGoodsStatus(goodsIds, GoodsStatus.OFFLINE);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -118,7 +117,7 @@ public class MerchantController {
|
|
|
@PutMapping("/merchant/updateBusinessStatus/{id}")
|
|
|
public void updateMerchant(@PathVariable("id") @Min(value = 1, message = "商家主键不能小于1") Long id,
|
|
|
String businessStatus) {
|
|
|
- this.merchantService.updateMerchantBusinessStatus(id, businessStatus);
|
|
|
+ this.merchantClient.updateMerchantBusinessStatus(id, businessStatus);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -129,7 +128,7 @@ public class MerchantController {
|
|
|
*/
|
|
|
@GetMapping("/merchants/rank")
|
|
|
public List<MerchantRankDTO> listRankMerchants(@Valid MerchantRankParam param) {
|
|
|
- return this.merchantService.listRankMerchants(param);
|
|
|
+ return this.merchantClient.listRankMerchants(param);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -139,8 +138,8 @@ public class MerchantController {
|
|
|
* @return 获取商家营业状况
|
|
|
*/
|
|
|
@GetMapping("/merchant/operatConditions")
|
|
|
- public Map<String,Object> listRankMerchants() {
|
|
|
- return this.merchantService.operatConditions();
|
|
|
+ public Map<String, Object> listRankMerchants() {
|
|
|
+ return this.merchantClient.operatConditions();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -149,19 +148,19 @@ public class MerchantController {
|
|
|
* @return 获取经营报表状况
|
|
|
*/
|
|
|
@PostMapping("/merchant/operatReport")
|
|
|
- public List<Map<String,Object>> operatReport(@RequestBody @Valid ReportModifyParam param) {
|
|
|
- return this.merchantService.operatReport(param);
|
|
|
+ public List<Map<String, Object>> operatReport(@RequestBody @Valid ReportModifyParam param) {
|
|
|
+ return this.merchantClient.operatReport(param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 商家审核
|
|
|
*
|
|
|
- * @param id 商家主键
|
|
|
+ * @param id 商家主键
|
|
|
* @param
|
|
|
*/
|
|
|
@GetMapping("/merchantAudit/{id}")
|
|
|
public void merchantAudit(@PathVariable("id") @Min(value = 1, message = "商家主键不能小于1") Long id,
|
|
|
- MerchantStatus status ) {
|
|
|
- this.merchantService.merchantAudit(id, status);
|
|
|
+ MerchantStatus status) {
|
|
|
+ this.merchantClient.merchantAudit(id, status);
|
|
|
}
|
|
|
}
|