刘帅
2026-09-29 dcb96821f905f3fd93c059d8703517bdcac4d336
cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
@@ -378,7 +378,8 @@
                    .eq("state", 1)
                    .eq("status", 1)
                    .le("startTime", currentDate)
                    .ge("endTime", currentDate));
                    .ge("endTime", currentDate)
                    .orderByDesc("insertTime", "id"));
            if (couponList.size() > 0) {
                Iterator<Coupon> iterator = couponList.iterator();
                while (iterator.hasNext()) {
@@ -825,6 +826,7 @@
            Integer pickUpQuantity = dataVo.getPickUpQuantity();
            // 赠送用户数量
            int count = quantityIssued / pickUpQuantity;
            // 自动发券
            if (dataVo.getDistributionMethod() == 3) {
                // 判断用户人群 再判断限领数量
@@ -834,6 +836,9 @@
                        // 全部用户ids
                        List<Integer> collect = tAppUsers.stream()
                                .map(TAppUser::getId).collect(Collectors.toList());
                        if (collect.size()<count){
                            count = collect.size();
                        }
                        for (int i = 0; i < count; i++) {
                            for (int j = 0; j < pickUpQuantity; j++) {
                                UserCoupon u1 = new UserCoupon();
@@ -852,6 +857,9 @@
                        List<Integer> collect1 = tAppUsers.stream().filter(t -> t.getVipEndTime().after(new Date()))
                                .map(TAppUser::getId)
                                .collect(Collectors.toList());
                        if (collect1.size()<count){
                            count = collect1.size();
                        }
                        for (int i = 0; i < count; i++) {
                            for (int j = 0; j < pickUpQuantity; j++) {
                                UserCoupon u1 = new UserCoupon();
@@ -868,6 +876,9 @@
                    case 3:
                        // 给已有学员用户发券 获取已有学员的用户ids
                        List<Integer> collect2 = studentClient.getHasStudentUser();
                        if (collect2.size()<count){
                            count = collect2.size();
                        }
                        for (int i = 0; i < count; i++) {
                            for (int j = 0; j < pickUpQuantity; j++) {
                                UserCoupon u1 = new UserCoupon();