| | |
| | | StringBuilder couponIds = new StringBuilder(); |
| | | for (TCoupon tCoupon : list) { |
| | | couponIds.append(tCoupon.getId()).append(","); |
| | | // 如果优惠券库存为0 那么将优惠券状态改为下架 不启用 |
| | | if (tCoupon.getInventoryQuantity()==0){ |
| | | tCoupon.setStatus(2); |
| | | this.baseMapper.updateById(tCoupon); |
| | | |
| | | } |
| | | |
| | | } |
| | | if (StringUtils.hasLength(couponIds)){ |
| | | // 去除最后一个字符 |
| | | couponIds.deleteCharAt(couponIds.length()-1); |
| | | } |
| | | List<Integer> data = appCouponClient.getCountByCouponIds(couponIds.toString()).getData(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | list.get(i).setCount(data.get(i)); |
| | | if (!list.isEmpty()){ |
| | | if (StringUtils.hasLength(couponIds)){ |
| | | // 去除最后一个字符 |
| | | couponIds.deleteCharAt(couponIds.length()-1); |
| | | } |
| | | List<Integer> data = appCouponClient.getCountByCouponIds(couponIds.toString()).getData(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | list.get(i).setCount(data.get(i)); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |