master:系统调优;

pull/1121/head
liujiang 2025-11-09 22:29:57 +08:00
parent 548f771504
commit 66396df9d6
4 changed files with 15 additions and 16 deletions

View File

@ -158,7 +158,7 @@ public class StoreCustomerProductDiscountServiceImpl implements IStoreCustomerPr
if (CollectionUtils.isEmpty(list)) {
return Page.empty(pageDTO.getPageSize(), pageDTO.getPageNum());
}
// 处理分页的价格及颜色等
// 处理分页的价格及颜色等 此处sql未过滤del_flag=0因为有可能是商品已删除的颜色部分
List<StoreCusProdDiscPageResDTO> relateList = this.cusProdDiscMapper.selectDiscPageRelate(list.stream()
.map(StoreCusProdDiscPageResDTO::getStoreProdColorId).distinct().collect(Collectors.toList()));
Map<Long, StoreCusProdDiscPageResDTO> relateMap = relateList.stream().collect(Collectors

View File

@ -517,14 +517,14 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
if (CollectionUtils.isEmpty(topRightList)) {
// 从latest50ProdList中随机选取最多2条数据
List<StoreProduct> randomProductList = getRandomElements(latest50ProdList, count);
topRightRecommendList = randomProductList.stream().map(x -> {
topRightRecommendList = randomProductList.stream().filter(x -> attrMap.containsKey(x.getId())).map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getId());
return BeanUtil.toBean(dto, StoreHomeTemplateItemResDTO.class)
.setDisplayType(AdDisplayType.PRODUCT.getValue()).setProdPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
.setTags(ObjectUtils.isNotEmpty(dto) && StringUtils.isNotBlank(dto.getTagStr()) ? StrUtil.split(dto.getTagStr(), ",") : null);
}).collect(Collectors.toList());
} else {
topRightRecommendList = topRightList.stream().map(x -> {
topRightRecommendList = topRightList.stream().filter(x -> attrMap.containsKey(x.getBizId())).map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getBizId());
return BeanUtil.toBean(dto, StoreHomeTemplateItemResDTO.class)
.setDisplayType(AdDisplayType.PRODUCT.getValue()).setProdPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
@ -551,14 +551,14 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
if (CollectionUtils.isEmpty(storeRecommendList)) {
// 从latest50ProdList中随机选取最多5条数据
List<StoreProduct> randomProductList = getRandomElements(latest50ProdList, count);
recommendList = randomProductList.stream().map(x -> {
recommendList = randomProductList.stream().filter(x -> attrMap.containsKey(x.getId())).map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getId());
return BeanUtil.toBean(dto, StoreHomeTemplateItemResDTO.class)
.setDisplayType(AdDisplayType.PRODUCT.getValue()).setProdPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
.setTags(ObjectUtils.isNotEmpty(dto) && StringUtils.isNotBlank(dto.getTagStr()) ? StrUtil.split(dto.getTagStr(), ",") : null);
}).collect(Collectors.toList());
} else {
recommendList = storeRecommendList.stream().map(x -> {
recommendList = storeRecommendList.stream().filter(x -> attrMap.containsKey(x.getBizId())).map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getBizId());
return BeanUtil.toBean(dto, StoreHomeTemplateItemResDTO.class)
.setDisplayType(AdDisplayType.PRODUCT.getValue()).setProdPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
@ -586,14 +586,14 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
if (CollectionUtils.isEmpty(popularSaleList)) {
// 从latest50ProdList中随机选取最多5条数据
List<StoreProduct> randomProductList = getRandomElements(latest50ProdList, count);
popularRecommendList = randomProductList.stream().map(x -> {
popularRecommendList = randomProductList.stream().filter(x -> attrMap.containsKey(x.getId())).map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getId());
return BeanUtil.toBean(dto, StoreHomeTemplateItemResDTO.class)
.setDisplayType(AdDisplayType.PRODUCT.getValue()).setProdPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
.setTags(ObjectUtils.isNotEmpty(dto) && StringUtils.isNotBlank(dto.getTagStr()) ? StrUtil.split(dto.getTagStr(), ",") : null);
}).collect(Collectors.toList());
} else {
popularRecommendList = popularSaleList.stream().map(x -> {
popularRecommendList = popularSaleList.stream().filter(x -> attrMap.containsKey(x.getBizId())).map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getBizId());
return BeanUtil.toBean(dto, StoreHomeTemplateItemResDTO.class)
.setDisplayType(AdDisplayType.PRODUCT.getValue()).setProdPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
@ -620,14 +620,14 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
if (CollectionUtils.isEmpty(seasonNewProductsList)) {
// 从latest50ProdList中随机选取最多5条数据
List<StoreProduct> randomProductList = getRandomElements(latest50ProdList, count);
seasonNewRecommendList = randomProductList.stream().map(x -> {
seasonNewRecommendList = randomProductList.stream().filter(x -> attrMap.containsKey(x.getId())).map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getId());
return BeanUtil.toBean(dto, StoreHomeTemplateItemResDTO.class)
.setDisplayType(AdDisplayType.PRODUCT.getValue()).setProdPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
.setTags(ObjectUtils.isNotEmpty(dto) && StringUtils.isNotBlank(dto.getTagStr()) ? StrUtil.split(dto.getTagStr(), ",") : null);
}).collect(Collectors.toList());
} else {
seasonNewRecommendList = seasonNewProductsList.stream().map(x -> {
seasonNewRecommendList = seasonNewProductsList.stream().filter(x -> attrMap.containsKey(x.getBizId())).map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getBizId());
return BeanUtil.toBean(dto, StoreHomeTemplateItemResDTO.class)
.setDisplayType(AdDisplayType.PRODUCT.getValue()).setProdPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
@ -654,14 +654,14 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
if (CollectionUtils.isEmpty(salesRankingList)) {
// 从latest50ProdList中随机选取最多10条数据
List<StoreProduct> randomProductList = getRandomElements(latest50ProdList, count);
saleRankRecommendList = randomProductList.stream().map(x -> {
saleRankRecommendList = randomProductList.stream().filter(x -> attrMap.containsKey(x.getId())).map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getId());
return BeanUtil.toBean(dto, StoreHomeTemplateItemResDTO.class)
.setDisplayType(AdDisplayType.PRODUCT.getValue()).setProdPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
.setTags(ObjectUtils.isNotEmpty(dto) && StringUtils.isNotBlank(dto.getTagStr()) ? StrUtil.split(dto.getTagStr(), ",") : null);
}).collect(Collectors.toList());
} else {
saleRankRecommendList = salesRankingList.stream().map(x -> {
saleRankRecommendList = salesRankingList.stream().filter(x -> attrMap.containsKey(x.getBizId())).map(x -> {
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(x.getBizId());
return BeanUtil.toBean(dto, StoreHomeTemplateItemResDTO.class)
.setDisplayType(AdDisplayType.PRODUCT.getValue()).setProdPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)

View File

@ -573,6 +573,7 @@ public class StoreProductServiceImpl implements IStoreProductService {
storeProduct.setProdStatus(EProductStatus.OFF_SALE.getValue());
// 商品颜色必须全部为已删除,则商品状态为已删除
} else {
deleteProdIdList.add(storeProdId);
storeProduct.setDelFlag(DELETED);
storeProduct.setProdStatus(EProductStatus.REMOVED.getValue());
}

View File

@ -35,12 +35,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
spc.color_name,
MIN(spcs.price) AS price
FROM
store_product_color spc
JOIN
store_product_color_size spcs ON spc.store_prod_id = spcs.store_prod_id AND spcs.store_color_id = spcs.store_color_id AND spcs.del_flag = 0
store_product_color spc JOIN store_product_color_size spcs
ON spc.store_prod_id = spcs.store_prod_id AND spcs.store_color_id = spcs.store_color_id AND spcs.del_flag = 0
WHERE
spc.del_flag = 0
AND spc.id IN
spc.id IN
<foreach item="item" collection="storeProdColorIdList" separator="," open="(" close=")">
#{item}
</foreach>