|
@@ -88,44 +88,6 @@ public class CouponFontServiceImpl implements CouponFontService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- @Transactional(rollbackFor = Throwable.class)
|
|
|
|
|
- public void collectRecommendCoupon(CouponCollectReq couponCollectReq, Long userId) {
|
|
|
|
|
- collectCommonCheck(couponCollectReq.getCouponId(), userId);
|
|
|
|
|
-
|
|
|
|
|
- receiveCouponUser(couponCollectReq.getCouponId(), userId, CouponUser.Channel.recommend);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- @Transactional(rollbackFor = Throwable.class)
|
|
|
|
|
- public void collectWholeRecommendCoupon(Long userId) {
|
|
|
|
|
- CouponNewUserView couponNewUserView = beanSearcher.searchFirst(CouponNewUserView.class, MapUtils.builder().field(CouponNewUserView::getUserId, userId).op(Operator.Equal).build());
|
|
|
|
|
- Boolean isNewUser = true;
|
|
|
|
|
- if (couponNewUserView != null) {
|
|
|
|
|
- isNewUser = false;
|
|
|
|
|
- }
|
|
|
|
|
- //查询所有可领取的推荐优惠券
|
|
|
|
|
- List<CouponAvailableRecommendView> couponAvailableRecommendViews = recommendMapper.getRecommendCouponList(userId, isNewUser);
|
|
|
|
|
- couponAvailableRecommendViews.stream().forEach(data -> {
|
|
|
|
|
- //领取优惠券
|
|
|
|
|
- CouponUser couponUser = new CouponUser();
|
|
|
|
|
- couponUser.setUserId(userId);
|
|
|
|
|
- couponUser.setCouponId(data.getCouponId());
|
|
|
|
|
- //推荐渠道
|
|
|
|
|
- couponUser.setChannel(CouponUser.Channel.recommend);
|
|
|
|
|
- couponUser.setStatus(CouponUser.Status.unused);
|
|
|
|
|
- couponUser.setRecommendId(data.getRecommendId());
|
|
|
|
|
- //优惠券有效时间
|
|
|
|
|
- this.updateCouponUserValidTime(data.getCouponId(), couponUser);
|
|
|
|
|
- try {
|
|
|
|
|
- couponUserMapper.insert(couponUser);
|
|
|
|
|
- } catch (DuplicateKeyException e) {
|
|
|
|
|
- //插入失败继续插入 不影响
|
|
|
|
|
- log.info("用户:{}一键领取推荐优惠券{}插入数据错误", userId, data.getCouponId());
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Page<CouponUserView> getAvailableCouponList(Long skuId, Long couponId, Long userId, Boolean isRenew, Long start, Long limit, String lang) {
|
|
public Page<CouponUserView> getAvailableCouponList(Long skuId, Long couponId, Long userId, Boolean isRenew, Long start, Long limit, String lang) {
|
|
|
DateTime now = DateTime.now();
|
|
DateTime now = DateTime.now();
|