| | |
| | | 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("当前优惠券已全部领取完毕"); |
| | |
| | | if(point > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(15); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(point); |
| | | userPoint.setBalance(byId.getLavePoint()); |
| | | userPoint.setAppUserId(userid); |
| | | userPoint.setObjectId(Long.valueOf(data.getId())); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setChangeDirection(-1); |
| | | userPointService.save(userPoint); |
| | | } |
| | | } |