...
|
...
|
@@ -10,10 +10,7 @@ import com.yoho.core.common.helpers.ImagesHelper; |
|
|
import com.yohoufo.common.utils.UfoStringUtils;
|
|
|
import com.yohoufo.dal.product.*;
|
|
|
import com.yohoufo.dal.product.model.*;
|
|
|
import com.yohoufo.product.model.GoodsImageBO;
|
|
|
import com.yohoufo.product.model.GoodsSize;
|
|
|
import com.yohoufo.product.model.GoodsBO;
|
|
|
import com.yohoufo.product.model.ProductInfo;
|
|
|
import com.yohoufo.product.model.*;
|
|
|
import com.yohoufo.product.response.ProductSeriesTemplateResp;
|
|
|
import com.yohoufo.product.response.StorageDataResp;
|
|
|
import com.yohoufo.product.response.StorageLeastPriceResp;
|
...
|
...
|
@@ -141,24 +138,33 @@ public class ProductServiceImpl implements ProductService{ |
|
|
@Override
|
|
|
public ProductSeriesTemplateResp querySortTemplateData(String skns) {
|
|
|
ProductSeriesTemplateResp resp = new ProductSeriesTemplateResp();
|
|
|
|
|
|
List<Integer> sknlist = UfoStringUtils.string2IntegerList(skns);
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(sknlist)) {
|
|
|
List<Product> products = productMapper.selectByIds(sknlist);
|
|
|
if (!CollectionUtils.isEmpty(products)) {
|
|
|
List<Goods> goodsList = goodsMapper.selectByProductIds(sknlist);
|
|
|
Map<Integer, List<Goods>> productGoodsMap = goodsList.stream().collect(Collectors.groupingBy(Goods::getProductId));
|
|
|
Map<Integer, String> seriesMap = new HashMap<>();
|
|
|
List<Integer> seriesIds = products.stream().map(Product::getSeriesId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
if (!CollectionUtils.isEmpty(seriesIds)) {
|
|
|
List<BrandSeries> seriesList = brandSeriesMapper.selectByIds(seriesIds);
|
|
|
seriesMap = seriesList.stream().collect(Collectors.toMap(BrandSeries::getId, BrandSeries::getSeriesName));
|
|
|
}
|
|
|
List<ProductSeriesTemplate> list = new ArrayList<>();
|
|
|
resp.setList(list);
|
|
|
for (Product product : products) {
|
|
|
List<Goods> pgList = productGoodsMap.get(product.getId());
|
|
|
if (StringUtils.isNotBlank(seriesMap.get(product.getSeriesId())) && !CollectionUtils.isEmpty(pgList) && pgList.get(0) != null && StringUtils.isNotBlank(pgList.get(0).getColorImage())) {
|
|
|
ProductSeriesTemplate productSeriesTemplate = new ProductSeriesTemplate();
|
|
|
productSeriesTemplate.setImageUrl(pgList.get(0).getColorImage());
|
|
|
productSeriesTemplate.setSeriesId(product.getSeriesId().toString());
|
|
|
productSeriesTemplate.setSeriesName(seriesMap.get(product.getSeriesId()));
|
|
|
list.add(productSeriesTemplate);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
List<Goods> goodsList = goodsMapper.selectByProductIds(sknlist);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
@Override
|
...
|
...
|
@@ -210,7 +216,7 @@ public class ProductServiceImpl implements ProductService{ |
|
|
if (storageId == null) {
|
|
|
StoragePrice sp = storagePriceMapper.selectBySkup(skup);
|
|
|
storageId = sp.getStorageId();
|
|
|
if (storageId == null) {
|
|
|
if (sp == null || (storageId = sp.getStorageId()) == null) {
|
|
|
LOGGER.error("addStorageNum skup={}, storageId={}, num={}, find storageId is null", skup, storageId,
|
|
|
num);
|
|
|
}
|
...
|
...
|
|