| | |
| | | */ |
| | | @PostMapping("/grantCoupon") |
| | | public R grantCoupon(@RequestBody GrantCouponDto dto){ |
| | | dto.setWaysToObtain(3); |
| | | List<TAppCoupon> res = new ArrayList<>(); |
| | | TCoupon coupon = otherClient.getCouponById(dto.getCouponId()).getData(); |
| | | |
| | |
| | | break; |
| | | case 2: |
| | | // 根据市codes 查询用户ids |
| | | List<Long> collect1 = appUserService.list(new QueryWrapper<TAppUser>() |
| | | .in("city_code", Arrays.asList(dto.getCityCode().split(",")))) |
| | | .stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | List<Long> collect1 = new ArrayList<>(); |
| | | // 根据市codes 查询用户ids |
| | | if (StringUtils.hasLength(dto.getProvinceCode())){ |
| | | List<Long> collect2 = appUserService.list(new QueryWrapper<TAppUser>() |
| | | .in("province_code", Arrays.asList(dto.getProvinceCode().split(",")))) |
| | | .stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | collect1.addAll(collect2); |
| | | } |
| | | if (StringUtils.hasLength(dto.getCityCode())){ |
| | | List<Long> collect2 = appUserService.list(new QueryWrapper<TAppUser>() |
| | | .in("city_code", Arrays.asList(dto.getCityCode().split(",")))) |
| | | .stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | collect1.addAll(collect2); |
| | | } |
| | | for (Long l : collect1) { |
| | | TAppCoupon tAppCoupon = new TAppCoupon(); |
| | | tAppCoupon.setAppUserId(l); |