|
|
|
@ -8,6 +8,7 @@ import com.bookstore.common.to.SkuReductionTo;
|
|
|
|
|
import com.bookstore.common.to.SpuBoundsTo;
|
|
|
|
|
import com.bookstore.common.utils.R;
|
|
|
|
|
import com.fasterxml.jackson.databind.annotation.JsonAppend;
|
|
|
|
|
import com.mysql.cj.util.StringUtils;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -146,6 +147,9 @@ public class SpuInfoServiceImpl extends ServiceImpl<SpuInfoDao, SpuInfoEntity> i
|
|
|
|
|
skuImagesEntity.setDefaultImg(image.getDefaultImg());
|
|
|
|
|
|
|
|
|
|
return skuImagesEntity;
|
|
|
|
|
}).filter(entity->{
|
|
|
|
|
//返回true是需要,false是舍弃
|
|
|
|
|
return !StringUtils.isNullOrEmpty(entity.getImgUrl());
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
//todo 没有图片路径的无需保存
|
|
|
|
|
skuImagesService.saveBatch(skuImagesEntities);
|
|
|
|
@ -164,10 +168,14 @@ public class SpuInfoServiceImpl extends ServiceImpl<SpuInfoDao, SpuInfoEntity> i
|
|
|
|
|
SkuReductionTo skuReductionTo = new SkuReductionTo();
|
|
|
|
|
BeanUtils.copyProperties(item, skuReductionTo);
|
|
|
|
|
skuReductionTo.setSkuId(skuId);
|
|
|
|
|
R r1 = couponFeignService.saveSkuReduction(skuReductionTo);
|
|
|
|
|
if (r1.getCode() != 0) {
|
|
|
|
|
log.error("远程保存sku优惠满减信息失败");
|
|
|
|
|
if (skuReductionTo.getFullCount() > 0 ||
|
|
|
|
|
skuReductionTo.getFullPrice().compareTo(new BigDecimal("0")) == 1) {
|
|
|
|
|
R r1 = couponFeignService.saveSkuReduction(skuReductionTo);
|
|
|
|
|
if (r1.getCode() != 0) {
|
|
|
|
|
log.error("远程保存sku优惠满减信息失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
log.info("保存完毕");
|
|
|
|
@ -186,5 +194,43 @@ public class SpuInfoServiceImpl extends ServiceImpl<SpuInfoDao, SpuInfoEntity> i
|
|
|
|
|
this.baseMapper.insert(spuInfoEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageUtils queryPageByCondition(Map<String, Object> params) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<SpuInfoEntity> QueryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
|
|
//status: 0,
|
|
|
|
|
//key: "华为",
|
|
|
|
|
//brandId: 9,
|
|
|
|
|
//catelogId: 225
|
|
|
|
|
String key = (String) params.get("key");
|
|
|
|
|
if (!StringUtils.isNullOrEmpty(key)) {
|
|
|
|
|
QueryWrapper.and((w)->{
|
|
|
|
|
w.eq("id",key).or().like("spu_name", key);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String status = (String) params.get("status");
|
|
|
|
|
if (!StringUtils.isNullOrEmpty(status)) {
|
|
|
|
|
QueryWrapper.eq("publish_status",status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String brandId = (String) params.get("brandId");
|
|
|
|
|
if (!StringUtils.isNullOrEmpty(brandId) && !"0".equals(brandId)) {
|
|
|
|
|
QueryWrapper.eq("brand_id", brandId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String catelogId = (String) params.get("catalogId");
|
|
|
|
|
if (!StringUtils.isNullOrEmpty(catelogId) && !"0".equals(catelogId)) {
|
|
|
|
|
QueryWrapper.eq("catalog_id", catelogId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IPage<SpuInfoEntity> page = this.page(
|
|
|
|
|
new Query<SpuInfoEntity>().getPage(params), QueryWrapper);
|
|
|
|
|
|
|
|
|
|
return new PageUtils(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|