| | |
| | | @ApiOperation(value = "已领取列表", tags = {"管理后台-优惠劵"}) |
| | | public R<Page<UserCoupon>> list1(@RequestParam Integer pageNum, |
| | | @RequestParam Integer pageSize, |
| | | String userName, |
| | | @ApiParam("1未使用2已使用3已过期") Integer status, |
| | | String phone, |
| | | Integer id) { |
| | | |
| | | List<Long> appUserIds = null; |
| | | LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>(); |
| | | |
| | | if (!StringUtils.isEmpty(phone)){ |
| | | List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .like(AppUser::getPhone, phone)); |
| | | if (!CollectionUtils.isEmpty(appUserList)){ |
| | | appUserIds = appUserList.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | }else { |
| | | queryWrapper.like(AppUser::getPhone, phone); |
| | | } |
| | | if (!StringUtils.isEmpty(userName)) { |
| | | queryWrapper.like(AppUser::getName, userName); |
| | | } |
| | | |
| | | List<AppUser> appUserList = appUserService.list(queryWrapper); |
| | | |
| | | if (CollectionUtils.isEmpty(appUserList)) { |
| | | return R.ok(Page.of(pageNum, pageSize)); |
| | | } |
| | | } |
| | | |
| | | List<Long> appUserIds = appUserList.stream().map(AppUser::getId).distinct().collect(Collectors.toList()); |
| | | |
| | | |
| | | Page<UserCoupon> page = userCouponService.lambdaQuery() |
| | | .isNull(status!=null&&(status==1||status==3),UserCoupon::getUseTime) |
| | | .isNotNull(status!=null&&status==2,UserCoupon::getUseTime) |
| | | .eq(UserCoupon::getCouponId, id) |
| | | .in(appUserIds != null,UserCoupon::getAppUserId, appUserIds) |
| | | .in(!CollectionUtils.isEmpty(appUserIds),UserCoupon::getAppUserId, appUserIds) |
| | | .lt(status!=null&&status==3,UserCoupon::getEndTime, LocalDateTime.now()).page(Page.of(pageNum-1, pageSize)); |
| | | for (UserCoupon record : page.getRecords()) { |
| | | record.setIdStr(record.getId().toString()); |