...
|
...
|
@@ -609,6 +609,12 @@ public class ProductServiceImpl implements ProductService { |
|
|
return storagePriceMap;
|
|
|
}
|
|
|
|
|
|
private Map<String, StoragePrice> getStorageLeastPriceInfo(Integer productId) {
|
|
|
List<StoragePrice> storagePrices = storagePriceMapper.selectLeastPricesByProductId(productId);
|
|
|
return storagePrices.stream()
|
|
|
.collect(Collectors.toMap(s -> s.getStorageId() + "_" + s.getPreSaleFlag(), Function.identity()));
|
|
|
}
|
|
|
|
|
|
private List<GoodsBO> getGoodsList(Integer productId, BigDecimal sellMinPrice, BigDecimal maxPrice) {
|
|
|
List<GoodsBO> goodsBOs = new ArrayList<>();
|
|
|
|
...
|
...
|
@@ -629,10 +635,11 @@ public class ProductServiceImpl implements ProductService { |
|
|
List<Storage> storageList = storageMapper.selectByGoodsId(goods.getId());
|
|
|
if (!CollectionUtils.isEmpty(storageList)) {
|
|
|
Map<Integer, Size> sizeMap = getSizeMap(storageList);
|
|
|
Map<Integer, StoragePrice> storagePriceMap = getStoragePriceMap(storageList);
|
|
|
Map<String, StoragePrice> storagePriceMap = getStorageLeastPriceInfo(productId);
|
|
|
|
|
|
for (Storage storage : storageList) {
|
|
|
StoragePrice storagePrice = storagePriceMap.get(storage.getId());
|
|
|
StoragePrice storagePrice = storagePriceMap.get(storage.getId() + "_0");
|
|
|
StoragePrice storagePricePre = storagePriceMap.get(storage.getId() + "_1");
|
|
|
|
|
|
GoodsSize goodsSize = new GoodsSize();
|
|
|
goodsSize.setId(storage.getId());
|
...
|
...
|
@@ -641,7 +648,6 @@ public class ProductServiceImpl implements ProductService { |
|
|
goodsSize.setSizeName(size == null ? "" : size.getSizeName());
|
|
|
goodsSize.setOrderBy(size == null ? Integer.valueOf(0) : size.getOrderBy());
|
|
|
|
|
|
|
|
|
goodsSize.setSellLeastPrice(sellMinPrice);
|
|
|
goodsSize.setMaxPrice(maxPrice);
|
|
|
goodsSize.setSuggestLowPrice(storage.getSuggestLowPrice());
|
...
|
...
|
@@ -652,14 +658,19 @@ public class ProductServiceImpl implements ProductService { |
|
|
if (null != storagePrice && null != storage.getSuggestHighPrice() && storagePrice.getPrice().compareTo(storage.getSuggestHighPrice()) > 0) {
|
|
|
goodsSize.setStorageNum(0);
|
|
|
goodsSize.setSkup(0);
|
|
|
continue;
|
|
|
}
|
|
|
} else {
|
|
|
goodsSize.setLeastPrice(storagePrice == null ? null : storagePrice.getPrice());
|
|
|
goodsSize.setStatus(storagePrice == null ? null : storagePrice.getStatus());
|
|
|
//goodsSize.setStorageNum(storagePrice == null ? 0 : storage.getStorageNum());
|
|
|
goodsSize.setSkup(storagePrice == null ? 0 : storagePrice.getSkup());
|
|
|
goodsSize.setStorageNum(goodsSize.getSkup() == null || goodsSize.getSkup() == 0 ? 0 : 1);
|
|
|
}
|
|
|
|
|
|
goodsSize.setPreSaleLeastPrice(storagePricePre == null ? null : storagePrice.getPrice());
|
|
|
goodsSize.setPreSaleStatus(storagePrice == null ? null : storagePricePre.getStatus());
|
|
|
goodsSize.setPreSaleSkup(storagePrice == null ? 0 : storagePricePre.getSkup());
|
|
|
goodsSize.setPreSaleStorageNum(goodsSize.getPreSaleSkup() == null || goodsSize.getPreSaleSkup() == 0 ? 0 : 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|