|
|
@@ -202,15 +202,15 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
|
|
|
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<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());
|
|
|
+ List<Integer> welfareIdList = lifeDiscountCouponUsers.stream().filter(x->x.getWelfareId() != null).map(LifeDiscountCouponUser::getWelfareId).collect(Collectors.toList());
|
|
|
List<StorePlatformBenefitsVo> storePlatformBenefits = benefitsMapper.selectListAndCoupon();
|
|
|
List<StorePlatformBenefitsVo> result = new ArrayList<>();
|
|
|
for (StorePlatformBenefitsVo storePlatformBenefit : storePlatformBenefits) {
|
|
|
StorePlatformBenefitsVo storePlatformBenefitVo = new StorePlatformBenefitsVo();
|
|
|
cn.hutool.core.bean.BeanUtil.copyProperties(storePlatformBenefit, storePlatformBenefitVo);
|
|
|
- if (couponIdList.contains(storePlatformBenefitVo.getId())) {
|
|
|
+ if (welfareIdList.contains(storePlatformBenefitVo.getId())) {
|
|
|
storePlatformBenefitVo.setClaimed(true);
|
|
|
} else {
|
|
|
storePlatformBenefitVo.setClaimed(false);
|
|
|
@@ -230,7 +230,7 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
|
|
|
if (benefits.getBusinessId() == null || benefits.getBusinessId().isEmpty()) {
|
|
|
throw new RuntimeException("优惠券信息不存在");
|
|
|
}
|
|
|
-
|
|
|
+ // 查询优惠券信息
|
|
|
LifeDiscountCoupon lifeDiscountCoupon = lifeDiscountCouponMapper.selectById(benefits.getBusinessId());
|
|
|
if (lifeDiscountCoupon == null) {
|
|
|
throw new RuntimeException("优惠券不存在");
|
|
|
@@ -263,6 +263,7 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
|
|
|
lifeDiscountCouponUser.setExpirationTime(lifeDiscountCoupon.getEndDate());
|
|
|
// 设置该优惠券的状态为待使用
|
|
|
lifeDiscountCouponUser.setStatus(Integer.parseInt(DiscountCouponEnum.WAITING_USED.getValue()));
|
|
|
+ lifeDiscountCouponUser.setWelfareId(benefitsId);
|
|
|
lifeDiscountCouponUserMapper.insert(lifeDiscountCouponUser);
|
|
|
|
|
|
if (updateResult > 0) {
|
|
|
@@ -310,6 +311,7 @@ public class StorePlatformBenefitsServiceImpl extends ServiceImpl<StorePlatformB
|
|
|
// 把优惠券记录插入到用户优惠券表中
|
|
|
LifeDiscountCouponUser lifeDiscountCouponUser = new LifeDiscountCouponUser();
|
|
|
// 设置该优惠券记录的优惠券 ID
|
|
|
+ lifeDiscountCouponUser.setWelfareId(benefitsId);
|
|
|
lifeDiscountCouponUser.setUbId(benefits.getId());
|
|
|
// 设置该优惠券记录的用户 ID 为当前用户 ID
|
|
|
lifeDiscountCouponUser.setUserId(userId);
|