| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.api.domain.GetLotteryEventList; |
| | | import com.ruoyi.goods.api.domain.TLotteryEvent; |
| | | import com.ruoyi.goods.api.domain.TLotteryEventUser; |
| | | import com.ruoyi.goods.api.service.LotteryEventClient; |
| | | import com.ruoyi.member.domain.dto.AppMemberCouponPageDto; |
| | | import com.ruoyi.member.domain.pojo.coupon.Coupon; |
| | |
| | | @PostMapping("/getCouponInfo/{couponId}") |
| | | @ApiOperation(value = "获取优惠券详情【2.0】", tags = "领券中心") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "优惠券id", required = true, dataType = "String", paramType = "path") |
| | | @ApiImplicitParam(name = "couponId", value = "优惠券id", required = true, dataType = "String", paramType = "path") |
| | | }) |
| | | public R<CouponInfoVo> getCouponInfo(@PathVariable("couponId") String couponId) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | |
| | | @PostMapping("/shareCoupon/{couponId}") |
| | | @ApiOperation(value = "分享优惠券【2.0】", tags = "领券中心") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "优惠券id", required = true, dataType = "String", paramType = "path") |
| | | @ApiImplicitParam(name = "couponId", value = "优惠券id", required = true, dataType = "String", paramType = "path") |
| | | }) |
| | | public R<String> shareCoupon(@PathVariable("couponId") String couponId) { |
| | | //检测是否可以抽奖 |
| | |
| | | getLotteryEventList.setUserId(SecurityUtils.getUserId()); |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(getLotteryEventList).getData(); |
| | | if (data.size() > 0) { |
| | | return R.ok(data.get(0).getId()); |
| | | //将数据添加到普通抽奖列表中 |
| | | String id = data.get(0).getId(); |
| | | TLotteryEventUser lotteryEventUser = new TLotteryEventUser(); |
| | | lotteryEventUser.setId(IdUtils.simpleUUID()); |
| | | lotteryEventUser.setLotteryEventId(id); |
| | | lotteryEventUser.setUser_id(SecurityUtils.getUserId()); |
| | | lotteryEventClient.addLotteryEventUser(lotteryEventUser); |
| | | return R.ok(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/shareCoupon/determineClaimCoupon/{couponId}") |
| | | @ApiOperation(value = "判断是否领取了该优惠券【2.0】", tags = "领券中心") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "couponId", value = "优惠券id", required = true, dataType = "String", paramType = "path") |
| | | }) |
| | | public R<Boolean> determineClaimCoupon(@PathVariable("couponId") String couponId){ |
| | | Long userId = SecurityUtils.getUserId(); |
| | | int count = memberCouponService.count(new QueryWrapper<MemberCoupon>().eq("coupon_id", couponId) |
| | | .eq("user_id", userId).ne("coupon_status", -1)); |
| | | return R.ok(0 < count); |
| | | } |
| | | } |