Browse Source

增加商品id搜索,修复规格太长时,数据库报错

zyj
sj 2 years ago
parent
commit
bcdd99eb4a
  1. 22
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java
  2. 6
      zsw-bxg/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponUserQueryVo.java
  3. 3
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductQueryCriteria.java

22
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java

@ -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("已失效");

6
zsw-bxg/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponUserQueryVo.java

@ -8,6 +8,7 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* <p>
@ -28,11 +29,14 @@ public class YxStoreCouponUserQueryVo implements Serializable {
@ApiModelProperty(value = "兑换的项目id")
private Integer cid;
@ApiModelProperty(value = "优惠券图片")
private List<String> image;
@ApiModelProperty(value = "优惠券所属用户")
private Long uid;
@ApiModelProperty(value = "优惠券名称")
private String couponTitle;
private String cname;
@ApiModelProperty(value = "优惠券的面值")
private BigDecimal couponPrice;

3
zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/YxStoreProductQueryCriteria.java

@ -26,6 +26,9 @@ public class YxStoreProductQueryCriteria{
@Query
private Integer isShow;
@Query
private Integer id;
@Query
private Integer cateId;

Loading…
Cancel
Save