diff --git a/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/service/impl/SmsCouponServiceImpl.java b/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/service/impl/SmsCouponServiceImpl.java index 364701cf7..374158c09 100644 --- a/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/service/impl/SmsCouponServiceImpl.java +++ b/mall-sms/sms-boot/src/main/java/com/youlai/mall/sms/service/impl/SmsCouponServiceImpl.java @@ -1,16 +1,21 @@ package com.youlai.mall.sms.service.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.youlai.mall.sms.converter.SmsCouponConverter; import com.youlai.mall.sms.mapper.SmsCouponMapper; import com.youlai.mall.sms.pojo.entity.SmsCoupon; +import com.youlai.mall.sms.pojo.entity.SmsCouponSpuCategory; import com.youlai.mall.sms.pojo.form.CouponForm; import com.youlai.mall.sms.pojo.query.CouponPageQuery; import com.youlai.mall.sms.pojo.vo.CouponPageVO; import com.youlai.mall.sms.service.SmsCouponService; +import com.youlai.mall.sms.service.SmsCouponSpuCategoryService; +import com.youlai.mall.sms.service.SmsCouponSpuService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -26,11 +31,14 @@ import java.util.stream.Collectors; */ @Service @RequiredArgsConstructor -public class SmsCouponServiceImpl extends ServiceImpl - implements SmsCouponService { +public class SmsCouponServiceImpl extends ServiceImpl implements SmsCouponService { private final SmsCouponConverter smsCouponConverter; + private final SmsCouponSpuCategoryService smsCouponSpuCategoryService; + + private final SmsCouponSpuService smsCouponSpuService; + /** * 优惠券分页列表 * @@ -72,6 +80,29 @@ public class SmsCouponServiceImpl extends ServiceImpl spuCategoryIds = couponForm.getSpuCategoryIds(); + + Integer applicationScope = couponForm.getApplicationScope(); + + + if (CollectionUtil.isNotEmpty(spuCategoryIds)) { + List smsCouponSpuCategories = spuCategoryIds.stream().map(spuCategoryId -> { + SmsCouponSpuCategory smsCouponSpuCategory = new SmsCouponSpuCategory(); + smsCouponSpuCategory.setCouponId(couponId); + smsCouponSpuCategory.setCouponId(spuCategoryId); + return smsCouponSpuCategory; + }).collect(Collectors.toList()); + + } + + + } + + return result; } @@ -86,6 +117,11 @@ public class SmsCouponServiceImpl extends ServiceImpl list = smsCouponSpuCategoryService.list(new LambdaQueryWrapper().eq(SmsCouponSpuCategory::getCouponId, couponId)); + } + return result; } @@ -99,13 +135,12 @@ public class SmsCouponServiceImpl extends ServiceImpl ids = Arrays.asList(idsStr.split(",")).stream() - .map(idStr -> Long.parseLong(idStr)).collect(Collectors.toList()); + List ids = Arrays.asList(idsStr.split(",")).stream().map(idStr -> Long.parseLong(idStr)).collect(Collectors.toList()); boolean result = this.removeByIds(ids); return result; } - + }