| | |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | record.setCouponInfoVo(vo); |
| | | if (record.getUseTime()==null){ |
| | | record.setStatus(1); |
| | |
| | | }else { |
| | | record.setStatus(2); |
| | | } |
| | | |
| | | |
| | | AppUser appUser = appUserService.getById(record.getAppUserId()); |
| | | record.setUserName(appUser.getName()); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | record.setCouponInfoVo(vo); |
| | | if (record.getUseTime()==null){ |
| | | record.setStatus(1); |
| | |
| | | }else { |
| | | record.setStatus(2); |
| | | } |
| | | |
| | | |
| | | AppUser appUser = appUserService.getById(record.getAppUserId()); |
| | | record.setUserName(appUser.getName()); |
| | |
| | | if (data==null){ |
| | | 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("当前优惠券已全部领取完毕"); |
| | | } |
| | | count = userCouponService.count(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getCouponId, couponId) |
| | | .eq(UserCoupon::getAppUserId, userid).eq(UserCoupon::getDelFlag, 0)); |
| | | if(data.getMaxNum() <= count){ |
| | | return R.fail("当前优惠券已达到最大领取限制"); |
| | | } |
| | | |
| | | if (data.getSendType()!=1&& byId.getLavePoint().compareTo(data.getNeedPoint().intValue()) < 0){ |
| | | return R.fail("当前积分不足,兑换失败"); |
| | | } |
| | |
| | | appUserService.updateById(byId); |
| | | |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(4); |
| | | userPoint.setType(11); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(point); |
| | | userPoint.setBalance(byId.getLavePoint()); |