| | |
| | | private void count(Long userid, List<CouponInfo> list1, List<CouponInfo> returnList) { |
| | | for (CouponInfo couponInfo : list1) { |
| | | Long count = appUserClient.getCouponCount(-1L, couponInfo.getId()).getData(); |
| | | if(couponInfo.getSendNum() <= count){ |
| | | couponInfo.setMaxNum(count.intValue() - couponInfo.getSendNum()); |
| | | for (int i = 0; i < couponInfo.getMaxNum(); i++) { |
| | | returnList.add(couponInfo); |
| | | } |
| | | if(count >= couponInfo.getSendNum()){ |
| | | continue; |
| | | } |
| | | count = appUserClient.getCouponCount(userid, couponInfo.getId()).getData(); |
| | | couponInfo.setMaxNum(couponInfo.getMaxNum() - count.intValue()); |
| | | for (int i = 0; i < couponInfo.getMaxNum(); i++) { |
| | | returnList.add(couponInfo); |
| | | if((couponInfo.getSendNum() - count) >= couponInfo.getMaxNum()){ |
| | | for (int i = 0; i < couponInfo.getMaxNum(); i++) { |
| | | returnList.add(couponInfo); |
| | | } |
| | | }else{ |
| | | for (int i = 0; i < (couponInfo.getSendNum() - count); i++) { |
| | | returnList.add(couponInfo); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |