|
@@ -18,7 +18,10 @@ import shop.alien.store.service.StorePlatformBenefitsService;
|
|
|
import shop.alien.util.common.JwtUtil;
|
|
import shop.alien.util.common.JwtUtil;
|
|
|
import shop.alien.util.common.constant.DiscountCouponEnum;
|
|
import shop.alien.util.common.constant.DiscountCouponEnum;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 福利表 服务实现类
|
|
* 福利表 服务实现类
|
|
@@ -187,7 +190,31 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
|
|
|
throw new RuntimeException("不支持的福利类型");
|
|
throw new RuntimeException("不支持的福利类型");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<StorePlatformBenefitsVo> listBenefits(Integer userId) {
|
|
|
|
|
+ // 查询用户已领取的优惠券记录
|
|
|
|
|
+ QueryWrapper<LifeDiscountCouponUser> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ queryWrapper.eq("user_id", userId);
|
|
|
|
|
+ List<LifeDiscountCouponUser> lifeDiscountCouponUsers = lifeDiscountCouponUserMapper.selectList(queryWrapper);
|
|
|
|
|
+ List<Integer> couponIdList = lifeDiscountCouponUsers.stream().filter(x -> x.getCouponId() != null).map(LifeDiscountCouponUser::getCouponId).collect(Collectors.toList());
|
|
|
|
|
+ List<Integer> ubIdList = lifeDiscountCouponUsers.stream().filter(x -> x.getUbId() != null).map(LifeDiscountCouponUser::getUbId).collect(Collectors.toList());
|
|
|
|
|
+ couponIdList.addAll(ubIdList);
|
|
|
|
|
+ List<StorePlatformBenefits> storePlatformBenefits = super.list();
|
|
|
|
|
+ List<StorePlatformBenefitsVo> result = new ArrayList<>();
|
|
|
|
|
+ for (StorePlatformBenefits storePlatformBenefit : storePlatformBenefits) {
|
|
|
|
|
+ StorePlatformBenefitsVo storePlatformBenefitVo = new StorePlatformBenefitsVo();
|
|
|
|
|
+ cn.hutool.core.bean.BeanUtil.copyProperties(storePlatformBenefit, storePlatformBenefitVo);
|
|
|
|
|
+ if (couponIdList.contains(storePlatformBenefitVo.getId())) {
|
|
|
|
|
+ storePlatformBenefitVo.setClaimed(true);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ storePlatformBenefitVo.setClaimed(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ result.add(storePlatformBenefitVo);
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 领取优惠券
|
|
* 领取优惠券
|
|
|
*/
|
|
*/
|