耗材关联问题
小程序 商品 问题
This commit is contained in:
@@ -473,8 +473,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
entity.setRelatedRecommend(dto.getRelatedRecommendStr());
|
||||
super.save(entity);
|
||||
dto.setId(entity.getId());
|
||||
// 清除商品分类列表缓存
|
||||
clearProductCache(entity.getCategoryId());
|
||||
List<ProdSkuDTO> skuList = dto.getSkuList();
|
||||
if (CollUtil.isNotEmpty(skuList)) {
|
||||
List<ProdSku> prodSkuList = new ArrayList<>();
|
||||
@@ -491,9 +489,11 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
prodSkuMapper.insertBatch(prodSkuList);
|
||||
}
|
||||
ProdConsBindDTO prodConsBindDTO = new ProdConsBindDTO();
|
||||
prodConsBindDTO.setId(null);
|
||||
prodConsBindDTO.setId(entity.getId());
|
||||
prodConsBindDTO.setConsList(dto.getConsList());
|
||||
prodConsRelationService.saveProdConsRelation(prodConsBindDTO);
|
||||
// 清除商品分类列表缓存
|
||||
clearProductCache(entity.getCategoryId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -551,12 +551,10 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
List<Long> list = skuList.stream().map(ProdSkuDTO::getId).filter(Objects::nonNull).distinct().toList();
|
||||
skuIdList.removeAll(list);
|
||||
}
|
||||
// 清除商品分类列表缓存
|
||||
if (!old.getCategoryId().equals(dto.getCategoryId())) {
|
||||
clearProductCache(old.getCategoryId(), entity.getCategoryId());
|
||||
} else {
|
||||
clearProductCache(old.getCategoryId());
|
||||
}
|
||||
ProdConsBindDTO prodConsBindDTO = new ProdConsBindDTO();
|
||||
prodConsBindDTO.setId(dto.getId());
|
||||
prodConsBindDTO.setConsList(dto.getConsList());
|
||||
prodConsRelationService.saveProdConsRelation(prodConsBindDTO);
|
||||
if (CollUtil.isNotEmpty(skuIdList)) {
|
||||
// 逻辑删除无用的SKU数据
|
||||
UpdateChain.of(ProdSku.class)
|
||||
@@ -565,6 +563,12 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
.eq(ProdSku::getShopId, shopId)
|
||||
.update();
|
||||
}
|
||||
// 清除商品分类列表缓存
|
||||
if (!old.getCategoryId().equals(dto.getCategoryId())) {
|
||||
clearProductCache(old.getCategoryId(), entity.getCategoryId());
|
||||
} else {
|
||||
clearProductCache(old.getCategoryId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,18 +11,15 @@ import com.czg.constants.SystemConstants;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.product.dto.ProdGroupRelationDTO;
|
||||
import com.czg.product.dto.ProdSkuDTO;
|
||||
import com.czg.product.entity.ProdGroup;
|
||||
import com.czg.product.entity.ProdGroupRelation;
|
||||
import com.czg.product.entity.ProdSku;
|
||||
import com.czg.product.entity.Product;
|
||||
import com.czg.product.entity.*;
|
||||
import com.czg.product.param.ShopProductSkuParam;
|
||||
import com.czg.product.service.ProdConsRelationService;
|
||||
import com.czg.product.service.UProductService;
|
||||
import com.czg.product.vo.ShopGroupProductVo;
|
||||
import com.czg.product.vo.ShopProductInfoVo;
|
||||
import com.czg.product.vo.ShopProductSkuInfoVo;
|
||||
import com.czg.product.vo.ShopProductVo;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.service.product.mapper.ProdGroupMapper;
|
||||
import com.czg.service.product.mapper.ProdGroupRelationMapper;
|
||||
import com.czg.service.product.mapper.ProdSkuMapper;
|
||||
@@ -55,7 +52,8 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||
private final ProdSkuMapper prodSkuMapper;
|
||||
private final ProdGroupMapper prodGroupMapper;
|
||||
private final ProdGroupRelationMapper prodGroupRelationMapper;
|
||||
private final RedisService redisService;
|
||||
private final ProdConsRelationService prodConsRelationService;
|
||||
|
||||
|
||||
@Override
|
||||
@Cacheable(value = CacheConstant.USER_CLIENT_HOTS_PRODUCT, key = "#shopId", unless = "#result.isEmpty()")
|
||||
@@ -67,6 +65,9 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||
.eq(ProdSku::getIsGrounding, SystemConstants.OneZero.ONE)
|
||||
.eq(ProdSku::getIsDel, SystemConstants.OneZero.ZERO), ProdSkuDTO.class);
|
||||
item.setSkuList(skuList);
|
||||
item.setProdConsRelations(prodConsRelationService.list(query()
|
||||
.eq(ProdConsRelation::getProductId, item.getId())
|
||||
.eq(ProdConsRelation::getShopId, item.getShopId())));
|
||||
});
|
||||
return list;
|
||||
}
|
||||
@@ -85,6 +86,9 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||
.eq(ProdSku::getIsGrounding, SystemConstants.OneZero.ONE)
|
||||
.eq(ProdSku::getIsDel, SystemConstants.OneZero.ZERO), ProdSkuDTO.class);
|
||||
item.setSkuList(skuList);
|
||||
item.setProdConsRelations(prodConsRelationService.list(query()
|
||||
.eq(ProdConsRelation::getProductId, item.getId())
|
||||
.eq(ProdConsRelation::getShopId, item.getShopId())));
|
||||
});
|
||||
Map<Long, ShopProductVo> productKv = productAllList.stream().collect(Collectors.toMap(ShopProductVo::getId, shopProductVo -> shopProductVo));
|
||||
List<Long> prodGroupIdList = groupList.stream().map(ShopGroupProductVo::getId).distinct().toList();
|
||||
|
||||
Reference in New Issue
Block a user