puzhibing
2024-09-29 07aa59cf3e26a25792f40ec8e92f316e907aec9c
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java
@@ -223,6 +223,7 @@
     */
    @PostMapping("/grantCoupon")
    public R  grantCoupon(@RequestBody GrantCouponDto dto){
        dto.setWaysToObtain(3);
        List<TAppCoupon> res = new ArrayList<>();
        TCoupon coupon = otherClient.getCouponById(dto.getCouponId()).getData();
@@ -246,9 +247,20 @@
                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);