|
@@ -608,7 +608,13 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -608,7 +608,13 @@ public class ProductServiceImpl implements ProductService { |
608
|
}
|
608
|
}
|
609
|
return storagePriceMap;
|
609
|
return storagePriceMap;
|
610
|
}
|
610
|
}
|
611
|
-
|
611
|
+
|
|
|
612
|
+ private Map<String, StoragePrice> getStorageLeastPriceInfo(Integer productId) {
|
|
|
613
|
+ List<StoragePrice> storagePrices = storagePriceMapper.selectLeastPricesByProductId(productId);
|
|
|
614
|
+ return storagePrices.stream()
|
|
|
615
|
+ .collect(Collectors.toMap(s -> s.getStorageId() + "_" + s.getPreSaleFlag(), Function.identity()));
|
|
|
616
|
+ }
|
|
|
617
|
+
|
612
|
private List<GoodsBO> getGoodsList(Integer productId, BigDecimal sellMinPrice, BigDecimal maxPrice) {
|
618
|
private List<GoodsBO> getGoodsList(Integer productId, BigDecimal sellMinPrice, BigDecimal maxPrice) {
|
613
|
List<GoodsBO> goodsBOs = new ArrayList<>();
|
619
|
List<GoodsBO> goodsBOs = new ArrayList<>();
|
614
|
|
620
|
|
|
@@ -629,10 +635,11 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -629,10 +635,11 @@ public class ProductServiceImpl implements ProductService { |
629
|
List<Storage> storageList = storageMapper.selectByGoodsId(goods.getId());
|
635
|
List<Storage> storageList = storageMapper.selectByGoodsId(goods.getId());
|
630
|
if (!CollectionUtils.isEmpty(storageList)) {
|
636
|
if (!CollectionUtils.isEmpty(storageList)) {
|
631
|
Map<Integer, Size> sizeMap = getSizeMap(storageList);
|
637
|
Map<Integer, Size> sizeMap = getSizeMap(storageList);
|
632
|
- Map<Integer, StoragePrice> storagePriceMap = getStoragePriceMap(storageList);
|
638
|
+ Map<String, StoragePrice> storagePriceMap = getStorageLeastPriceInfo(productId);
|
633
|
|
639
|
|
634
|
for (Storage storage : storageList) {
|
640
|
for (Storage storage : storageList) {
|
635
|
- StoragePrice storagePrice = storagePriceMap.get(storage.getId());
|
641
|
+ StoragePrice storagePrice = storagePriceMap.get(storage.getId() + "_0");
|
|
|
642
|
+ StoragePrice storagePricePre = storagePriceMap.get(storage.getId() + "_1");
|
636
|
|
643
|
|
637
|
GoodsSize goodsSize = new GoodsSize();
|
644
|
GoodsSize goodsSize = new GoodsSize();
|
638
|
goodsSize.setId(storage.getId());
|
645
|
goodsSize.setId(storage.getId());
|
|
@@ -641,7 +648,6 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -641,7 +648,6 @@ public class ProductServiceImpl implements ProductService { |
641
|
goodsSize.setSizeName(size == null ? "" : size.getSizeName());
|
648
|
goodsSize.setSizeName(size == null ? "" : size.getSizeName());
|
642
|
goodsSize.setOrderBy(size == null ? Integer.valueOf(0) : size.getOrderBy());
|
649
|
goodsSize.setOrderBy(size == null ? Integer.valueOf(0) : size.getOrderBy());
|
643
|
|
650
|
|
644
|
-
|
|
|
645
|
goodsSize.setSellLeastPrice(sellMinPrice);
|
651
|
goodsSize.setSellLeastPrice(sellMinPrice);
|
646
|
goodsSize.setMaxPrice(maxPrice);
|
652
|
goodsSize.setMaxPrice(maxPrice);
|
647
|
goodsSize.setSuggestLowPrice(storage.getSuggestLowPrice());
|
653
|
goodsSize.setSuggestLowPrice(storage.getSuggestLowPrice());
|
|
@@ -652,13 +658,18 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -652,13 +658,18 @@ public class ProductServiceImpl implements ProductService { |
652
|
if (null != storagePrice && null != storage.getSuggestHighPrice() && storagePrice.getPrice().compareTo(storage.getSuggestHighPrice()) > 0) {
|
658
|
if (null != storagePrice && null != storage.getSuggestHighPrice() && storagePrice.getPrice().compareTo(storage.getSuggestHighPrice()) > 0) {
|
653
|
goodsSize.setStorageNum(0);
|
659
|
goodsSize.setStorageNum(0);
|
654
|
goodsSize.setSkup(0);
|
660
|
goodsSize.setSkup(0);
|
655
|
- continue;
|
661
|
+ } else {
|
|
|
662
|
+ goodsSize.setLeastPrice(storagePrice == null ? null : storagePrice.getPrice());
|
|
|
663
|
+ goodsSize.setStatus(storagePrice == null ? null : storagePrice.getStatus());
|
|
|
664
|
+ //goodsSize.setStorageNum(storagePrice == null ? 0 : storage.getStorageNum());
|
|
|
665
|
+ goodsSize.setSkup(storagePrice == null ? 0 : storagePrice.getSkup());
|
|
|
666
|
+ goodsSize.setStorageNum(goodsSize.getSkup() == null || goodsSize.getSkup() == 0 ? 0 : 1);
|
656
|
}
|
667
|
}
|
657
|
- goodsSize.setLeastPrice(storagePrice == null ? null : storagePrice.getPrice());
|
|
|
658
|
- goodsSize.setStatus(storagePrice == null ? null : storagePrice.getStatus());
|
|
|
659
|
- //goodsSize.setStorageNum(storagePrice == null ? 0 : storage.getStorageNum());
|
|
|
660
|
- goodsSize.setSkup(storagePrice == null ? 0 : storagePrice.getSkup());
|
|
|
661
|
- goodsSize.setStorageNum(goodsSize.getSkup() == null || goodsSize.getSkup() == 0 ? 0 : 1);
|
668
|
+
|
|
|
669
|
+ goodsSize.setPreSaleLeastPrice(storagePricePre == null ? null : storagePrice.getPrice());
|
|
|
670
|
+ goodsSize.setPreSaleStatus(storagePrice == null ? null : storagePricePre.getStatus());
|
|
|
671
|
+ goodsSize.setPreSaleSkup(storagePrice == null ? 0 : storagePricePre.getSkup());
|
|
|
672
|
+ goodsSize.setPreSaleStorageNum(goodsSize.getPreSaleSkup() == null || goodsSize.getPreSaleSkup() == 0 ? 0 : 1);
|
662
|
}
|
673
|
}
|
663
|
}
|
674
|
}
|
664
|
}
|
675
|
}
|