| | |
| | | package com.dsh.activity.controller; |
| | | |
| | | import com.dsh.activity.entity.Coupon; |
| | | import com.dsh.activity.model.CouponListVo; |
| | | import com.dsh.activity.model.request.CouponPackageReq; |
| | | import com.dsh.activity.model.response.CouponPackageResp; |
| | | import com.dsh.activity.service.ICouponService; |
| | | import com.dsh.activity.service.UserCouponService; |
| | | import com.dsh.activity.util.ResultUtil; |
| | | import com.dsh.activity.util.TokenUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | @Autowired |
| | | private TokenUtil tokenUtil; |
| | | |
| | | @Autowired |
| | | private UserCouponService ucService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | @ApiImplicitParam(value = "1=积分购买,2=注册赠送", name = "distributionMethod", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryCouponList(@RequestBody Integer distributionMethod){ |
| | | public ResultUtil<List<CouponListVo>> queryCouponList(Integer distributionMethod){ |
| | | if(null == distributionMethod){ |
| | | return ResultUtil.paranErr("distributionMethod"); |
| | | } |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取优惠券信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coupon/queryCouponById") |
| | | public Coupon queryCouponById(@RequestBody Integer id){ |
| | | try { |
| | | Coupon coupon = couponService.getById(id); |
| | | return coupon; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 我的券包列表 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/coupon/queryCouponPackage") |
| | | @ApiOperation(value = "我的券包列表", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<CouponPackageResp>> queryAppuserCouponList( CouponPackageReq req){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(ucService.queryCouponPackagesList(uid, req)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | | |
| | | } |