| | |
| | | .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()) { |
| | |
| | | coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints())); |
| | | break; |
| | | case 2: |
| | | coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints())); |
| | | coupon.setCash(dataVo.getRequiredCash()); |
| | | if (dataVo.getRequiredCash() != null){ |
| | | coupon.setCash(dataVo.getRequiredCash()); |
| | | }else{ |
| | | coupon.setCash(BigDecimal.ZERO); |
| | | |
| | | } |
| | | if (dataVo.getRequiredPoints() != null){ |
| | | coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints())); |
| | | |
| | | }else{ |
| | | coupon.setIntegral(BigDecimal.ZERO); |
| | | |
| | | } |
| | | break; |
| | | case 3: |
| | | coupon.setCash(dataVo.getRequiredCash()); |
| | |
| | | Integer pickUpQuantity = dataVo.getPickUpQuantity(); |
| | | // 赠送用户数量 |
| | | int count = quantityIssued / pickUpQuantity; |
| | | |
| | | // 自动发券 |
| | | if (dataVo.getDistributionMethod() == 3) { |
| | | // 判断用户人群 再判断限领数量 |
| | |
| | | // 全部用户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(); |
| | |
| | | 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(); |
| | |
| | | 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(); |