Просмотр исходного кода

[C端首页][修改][换一换拼团和砍价]

release_toaliyun_real
gongbiao 6 лет назад
Родитель
Сommit
3870d37206
1 измененных файлов: 9 добавлений и 2 удалений
  1. +9
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java

+ 9
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Просмотреть файл

@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.util.*; import java.util.*;
import java.util.stream.Collectors;


@Service @Service
public class WxCouponChannelServiceImpl implements WxCouponChannelService { public class WxCouponChannelServiceImpl implements WxCouponChannelService {
@@ -144,9 +145,15 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
record.setCouponId(null); record.setCouponId(null);
} }
Long finalCouponId = couponId; Long finalCouponId = couponId;
return wxCouponChannelMapper.findVoList(record).parallelStream()
List<WxCouponChannelVo> voList = wxCouponChannelMapper.findVoList(record).stream()
.filter(wxCouponChannelVo -> !wxCouponChannelVo.getCouponId().equals(finalCouponId)) .filter(wxCouponChannelVo -> !wxCouponChannelVo.getCouponId().equals(finalCouponId))
.findAny().orElse(null);
.collect(Collectors.toList());
if (!voList.isEmpty()) {
int size = voList.size() - 1;
Random random = new Random();
return voList.get(random.nextInt(size));
}
return null;
} }


private boolean isCouponMerchantValid(Long couponId) { private boolean isCouponMerchantValid(Long couponId) {


Загрузка…
Отмена
Сохранить