| | |
| | | import com.ruoyi.other.api.domain.PointSetting; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.other.api.feignClient.PointSettingClient; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | List<Goods> data1 = goodsClient.getAllGoods().getData(); |
| | | List<String> collect = data1.stream().map(Goods::getName).collect(Collectors.toList()); |
| | | goodNames.addAll(collect); |
| | | }else{ |
| | | }else if(StringUtils.isEmpty(data.getForGoodIds())){ |
| | | goodNames.addAll(JSON.parseArray(data.getGoodsNameJson(), String.class)); |
| | | }else { |
| | | String[] split = vo.getForGoodIds().split(","); |
| | | R<List<Goods>> goodsById = goodsClient.getGoodsById(split); |
| | | if (goodsById.getData()!=null){ |
| | |
| | | goodNames.add(datum.getName()); |
| | | } |
| | | } |
| | | vo.setGoodNames(goodNames); |
| | | } |
| | | vo.setGoodNames(goodNames); |
| | | } |
| | | |
| | | record.setCouponInfoVo(vo); |
| | |
| | | @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) { |
| | | |
| | | Long appUserId = null; |
| | | if (!StringUtils.isEmpty(phone)){ |
| | | AppUser appUser1 = appUserService.getOne(new LambdaQueryWrapper<AppUser>() |
| | | .like(AppUser::getPhone, phone)); |
| | | if (appUser1 != null){ |
| | | appUserId = appUser1.getId(); |
| | | } |
| | | LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>(); |
| | | |
| | | if (!StringUtils.isEmpty(phone)) { |
| | | 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) |
| | | .eq(appUserId != null,UserCoupon::getAppUserId, appUserId) |
| | | .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()); |
| | |
| | | userCouponService.updateById(userCoupon); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑用户优惠券使用时间 |
| | | * @param userCoupon |
| | | * @return |
| | | */ |
| | | @PostMapping("/editReturnUse") |
| | | public R editReturnUse(@RequestBody UserCoupon userCoupon){ |
| | | userCouponService.update(new LambdaUpdateWrapper<UserCoupon>().eq(UserCoupon::getId, userCoupon.getId()) |
| | | .set(UserCoupon::getUseTime, userCoupon.getUseTime())); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |