|
@@ -1,18 +1,9 @@
|
|
|
package com.chelvc.cloud.admin.controller;
|
|
|
|
|
|
-import com.chelvc.cloud.vehicle.api.dto.CouponDTO;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.CouponModifyParam;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.CouponPagingParam;
|
|
|
-import com.chelvc.cloud.vehicle.api.service.CouponService;
|
|
|
import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
-import com.chelvc.framework.common.model.Pagination;
|
|
|
-import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
-import javax.validation.Valid;
|
|
|
-import javax.validation.constraints.Min;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
/**
|
|
|
* 促销活动接口
|
|
@@ -25,50 +16,4 @@ import javax.validation.constraints.Min;
|
|
|
@ResponseWrapping
|
|
|
@PreAuthorize("isScope('EMPLOYEE')")
|
|
|
public class PromotionController {
|
|
|
- @DubboReference
|
|
|
- private CouponService couponService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增商品优惠券
|
|
|
- *
|
|
|
- * @param param 新增参数
|
|
|
- * @return 商品优惠券主键
|
|
|
- */
|
|
|
- @PostMapping("/coupon")
|
|
|
- public Long addCoupon(@RequestBody @Valid CouponModifyParam param) {
|
|
|
- return this.couponService.addCoupon(param);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 修改商品优惠券
|
|
|
- *
|
|
|
- * @param id 商品优惠券主键
|
|
|
- * @param param 修改参数
|
|
|
- */
|
|
|
- @PutMapping("/coupon/{id}")
|
|
|
- public void updateCoupon(@PathVariable("id") @Min(value = 1, message = "商品优惠券主键不能小于1") Long id,
|
|
|
- @RequestBody @Valid CouponModifyParam param) {
|
|
|
- this.couponService.updateCoupon(id, param);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除商品优惠券
|
|
|
- *
|
|
|
- * @param id 商品优惠券主键
|
|
|
- */
|
|
|
- @PutMapping("/coupon/delete/{id}")
|
|
|
- public void deleteCoupon(@PathVariable("id") @Min(value = 1, message = "商品优惠券主键不能小于1") Long id) {
|
|
|
- this.couponService.deleteCoupon(id);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询商品优惠券分页
|
|
|
- *
|
|
|
- * @param param 查询参数
|
|
|
- * @return 商品优惠券分页信息
|
|
|
- */
|
|
|
- @GetMapping("/coupon/paging")
|
|
|
- public Pagination<CouponDTO> getCouponPaging(@Valid CouponPagingParam param) {
|
|
|
- return this.couponService.getCouponPaging(param);
|
|
|
- }
|
|
|
}
|