| | |
| | | if (data==null){ |
| | | return R.fail("当前优惠券不存在,请刷新后重试"); |
| | | } |
| | | if(data.getDelFlag() == 1 || data.getShelfStatus() == 0){ |
| | | return R.fail("当前优惠券不存在,请刷新后重试"); |
| | | } |
| | | long count = userCouponService.count(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getCouponId, couponId).eq(UserCoupon::getDelFlag, 0)); |
| | | if(data.getSendNum() <= count){ |
| | | return R.fail("当前优惠券已全部领取完毕"); |
| | |
| | | @PostMapping("/getCouponInfo") |
| | | public R<CouponInfoVo> getCouponInfo(@RequestParam("userCouponId") Long userCouponId){ |
| | | UserCoupon userCoupon = userCouponService.getById(userCouponId); |
| | | CouponInfo data = couponClient.detail(userCoupon.getCouponId()).getData(); |
| | | CouponInfoVo couponInfoVo = new CouponInfoVo(); |
| | | BeanUtils.copyProperties(data, couponInfoVo); |
| | | String jsonStr = userCoupon.getCouponInfo(); |
| | | CouponInfoVo couponInfoVo = JSON.parseObject(jsonStr, CouponInfoVo.class); |
| | | return R.ok(couponInfoVo); |
| | | } |
| | | |