Browse Source

添加获取用户可用优惠券接口

master
dy-hu 3 years ago
parent
commit
e4e1f11218
  1. 26
      yshop-mall/src/main/java/co/yixiang/modules/user/param/UsableCouponParam.java
  2. 14
      yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponController.java

26
yshop-mall/src/main/java/co/yixiang/modules/user/param/UsableCouponParam.java

@ -0,0 +1,26 @@
package co.yixiang.modules.user.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 描述
*
* @author stevenhu
* @version 2021/9/30 11:32
*/
@Data
public class UsableCouponParam {
@ApiModelProperty(value = "用户id")
private Long uid;
@ApiModelProperty(value = "下单金额")
private double price;
@ApiModelProperty(value = "下单产品Ids")
private List<String> productIds;
}

14
yshop-shop/src/main/java/co/yixiang/modules/activity/rest/StoreCouponController.java

@ -13,9 +13,11 @@ import co.yixiang.modules.activity.domain.YxStoreCoupon;
import co.yixiang.modules.activity.service.YxStoreCouponService;
import co.yixiang.modules.activity.service.YxStoreCouponUserService;
import co.yixiang.modules.activity.service.dto.YxStoreCouponQueryCriteria;
import co.yixiang.modules.activity.vo.StoreCouponUserVo;
import co.yixiang.modules.activity.vo.YxStoreCouponUserQueryVo;
import co.yixiang.modules.aop.ForbidSubmit;
import co.yixiang.modules.shop.service.dto.YxMaterialDto;
import co.yixiang.modules.user.param.UsableCouponParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Pageable;
@ -25,6 +27,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -106,4 +109,15 @@ public class StoreCouponController {
yxStoreCouponService.removeById(id);
return new ResponseEntity(HttpStatus.OK);
}
@Log("获取可用的优惠券列表")
@ApiOperation(value = "获取优惠券")
@PostMapping(value = "/getUsableCouponList")
// @PreAuthorize("@el.check('admin','YXSTORECOUPON_ALL','YXSTORECOUPON_SELECT')")
public ResponseEntity getUsableCouponList(@Validated @RequestBody UsableCouponParam param){
Map<String, Object> map = new HashMap<>();
List<StoreCouponUserVo> list = storeCouponUserService.getUsableCouponList(param.getUid(),param.getPrice(),param.getProductIds());
map.put("content", list);
return new ResponseEntity<>(map,HttpStatus.OK);
}
}
Loading…
Cancel
Save