|
|
@@ -33,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/*
|
|
|
*项目名: netflix
|
|
|
@@ -92,8 +93,6 @@ public class CouponFontServiceImpl implements CouponFontService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
|
- @NoSubmit
|
|
|
- @Deprecated
|
|
|
public void collectRecommendCoupon(CouponCollectReq couponCollectReq, Long userId) {
|
|
|
collectCommonCheck(couponCollectReq, userId);
|
|
|
CouponUser couponUser = new CouponUser();
|
|
|
@@ -220,6 +219,19 @@ public class CouponFontServiceImpl implements CouponFontService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Integer collectRecommendCouponNum(CouponCollectReq couponCollectReq, Long userId) {
|
|
|
+ CouponNewUserView couponNewUserView = beanSearcher.searchFirst(CouponNewUserView.class, MapUtils.builder().field(CouponNewUserView::getUserId, userId).op(Operator.Equal).build());
|
|
|
+ List<CouponAvailableRecommendView> couponAvailableRecommendViews = beanSearcher.searchAll(CouponAvailableRecommendView.class, MapUtils.builder().field(CouponAvailableRecommendView::getUserCouponId).op(Operator.IsNull).build());
|
|
|
+ List<CouponAvailableRecommendView> collect = couponAvailableRecommendViews.stream().filter(data -> {
|
|
|
+ if (data.getScope() == Coupon.Scope.newUser && couponNewUserView != null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return collect.size();
|
|
|
+ }
|
|
|
+
|
|
|
public void collectCommonCheck(CouponCollectReq couponCollectReq, Long userId) {
|
|
|
Coupon coupon = couponMapper.selectById(couponCollectReq.getCouponId());
|
|
|
if (coupon == null || !coupon.getDeleted()) {
|