|
|
|
@ -11,6 +11,7 @@ package co.yixiang.modules.activity.service.impl;
|
|
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.iocoder.yudao.framework.common.exception.YshopException; |
|
|
|
|
import co.yixiang.common.service.impl.BaseServiceImpl; |
|
|
|
|
import co.yixiang.common.utils.QueryHelpPlus; |
|
|
|
@ -30,9 +31,12 @@ import co.yixiang.modules.activity.vo.YxStoreCouponUserQueryVo;
|
|
|
|
|
import co.yixiang.modules.cart.domain.YxStoreBrandCart; |
|
|
|
|
import co.yixiang.modules.cart.service.YxStoreCartService; |
|
|
|
|
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; |
|
|
|
|
import co.yixiang.modules.product.domain.YxStoreProduct; |
|
|
|
|
import co.yixiang.modules.product.service.YxStoreProductService; |
|
|
|
|
import co.yixiang.modules.user.domain.YxUser; |
|
|
|
|
import co.yixiang.modules.user.service.YxUserService; |
|
|
|
|
import co.yixiang.utils.FileUtil; |
|
|
|
|
import co.yixiang.utils.StringUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
@ -74,6 +78,8 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
|
|
|
|
|
private YxStoreCouponService storeCouponService; |
|
|
|
|
@Autowired |
|
|
|
|
private YxStoreCartService yxStoreCartService; |
|
|
|
|
@Autowired |
|
|
|
|
private YxStoreProductService yxStoreProductService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取当前用户优惠券数量 |
|
|
|
@ -185,6 +191,22 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
|
|
|
|
|
long nowTime = System.currentTimeMillis(); |
|
|
|
|
for (YxStoreCouponUser couponUser : storeCouponUsers) { |
|
|
|
|
YxStoreCouponUserQueryVo queryVo = generator.convert(couponUser,YxStoreCouponUserQueryVo.class); |
|
|
|
|
queryVo.setCname(couponUser.getCouponTitle()); |
|
|
|
|
String[] idList= storeCouponService.getById(queryVo.getCid()).getProductId().split(","); |
|
|
|
|
List<String> needIdlist; |
|
|
|
|
if (idList.length>3){ |
|
|
|
|
needIdlist= Arrays.asList(Arrays.copyOf(idList, 3)); |
|
|
|
|
}else { |
|
|
|
|
needIdlist= Arrays.asList(idList); |
|
|
|
|
} |
|
|
|
|
List<String> imageList=new ArrayList<>(); |
|
|
|
|
needIdlist.forEach(id->{ |
|
|
|
|
YxStoreProduct yxStoreProduct=yxStoreProductService.getById(id); |
|
|
|
|
if (ObjectUtil.isNotEmpty(yxStoreProduct)&& StringUtils.isNotBlank(yxStoreProduct.getImage())){ |
|
|
|
|
imageList.add(yxStoreProductService.getById(id).getImage()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
queryVo.setImage(imageList); |
|
|
|
|
if(couponUser.getIsFail() == 1){ |
|
|
|
|
queryVo.set_type(CouponEnum.USE_0.getValue()); |
|
|
|
|
queryVo.set_msg("已失效"); |
|
|
|
|