|
|
|
@@ -144,16 +144,20 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { |
|
|
|
couponId = record.getCouponId(); |
|
|
|
record.setCouponId(null); |
|
|
|
} |
|
|
|
List<WxCouponChannelVo> voList = wxCouponChannelMapper.findVoList(record); |
|
|
|
if (voList.isEmpty()) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
if (voList.size() == 1) { |
|
|
|
return voList.get(0); |
|
|
|
} |
|
|
|
Long finalCouponId = couponId; |
|
|
|
List<WxCouponChannelVo> voList = wxCouponChannelMapper.findVoList(record).stream() |
|
|
|
voList = voList.stream() |
|
|
|
.filter(wxCouponChannelVo -> !wxCouponChannelVo.getCouponId().equals(finalCouponId)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
if (!voList.isEmpty()) { |
|
|
|
int size = voList.size(); |
|
|
|
Random random = new Random(); |
|
|
|
return voList.get(random.nextInt(size)); |
|
|
|
} |
|
|
|
return null; |
|
|
|
int size = voList.size(); |
|
|
|
Random random = new Random(); |
|
|
|
return voList.get(random.nextInt(size)); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean isCouponMerchantValid(Long couponId) { |
|
|
|
|