...
|
...
|
@@ -204,7 +204,13 @@ public class ProductServiceImpl implements ProductService { |
|
|
BigDecimal flashLeastPrice = flashLeastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
|
|
|
productInfo.setFlashLeastPrice(flashLeastPrice);
|
|
|
}
|
|
|
|
|
|
|
|
|
List<BigDecimal> quickDeliveryLeastPriceList = goodsSizes.stream().map(GoodsSize::getQuickDeliveryPrice).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
if(!CollectionUtils.isEmpty(quickDeliveryLeastPriceList)) {
|
|
|
BigDecimal quickDeliveryLeastPrice = quickDeliveryLeastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
|
|
|
productInfo.setQuickDeliveryPrice(quickDeliveryLeastPrice);
|
|
|
}
|
|
|
|
|
|
goodsSizes.sort(Comparator.comparing(GoodsSize::getOrderBy));
|
|
|
List<JSONObject> otherAddSizeList = getOtherSizeList(product.getMaxSortId(), product.getMidSortId(), goodsSizes);
|
|
|
if(!CollectionUtils.isEmpty(otherAddSizeList)) {
|
...
|
...
|
@@ -511,6 +517,50 @@ public class ProductServiceImpl implements ProductService { |
|
|
return storagePrices.stream().filter(price -> price.getPreSaleFlag() == 3).collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
|
|
|
}
|
|
|
|
|
|
public List<StorageInfoResp> queryLeastOnSalePrice(String productCode) {
|
|
|
List<Product> productList = productMapper.selectByProductCode(productCode);
|
|
|
if (productList.isEmpty()) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
Product product = null;
|
|
|
for (Product p : productList) {
|
|
|
if (p.getDelStatus() == 0 && p.getShelveStatus() == 1) {
|
|
|
product = p;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (product == null) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
List<StoragePrice> storagePrices = storagePriceMapper.selectLeastPricesByProductId(product.getId());
|
|
|
storagePrices = storagePrices.stream().filter(s -> s.getPreSaleFlag() == 0).collect(Collectors.toList());
|
|
|
Map<Integer, StoragePrice> storagePriceMap = storagePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, Function.identity(), BinaryOperator.minBy(Comparator.comparing(StoragePrice::getPrice))));
|
|
|
if (storagePriceMap.isEmpty()) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
List<Storage> storageList = storageMapper.selectByIds(storagePriceMap.keySet());
|
|
|
List<Size> sizeList = sizeMapper.selectByIds(storageList.stream().map(Storage::getSizeId).collect(Collectors.toList()));
|
|
|
Map<Integer, Storage> storageMap = storageList.stream().collect(Collectors.toMap(Storage::getId, Function.identity()));
|
|
|
Map<Integer, Size> sizeMap = sizeList.stream().collect(Collectors.toMap(Size::getId, Function.identity()));
|
|
|
List<StorageInfoResp> resp = new ArrayList<>();
|
|
|
for (Integer spId : storagePriceMap.keySet()) {
|
|
|
StoragePrice sp = storagePriceMap.get(spId);
|
|
|
StorageInfoResp storageInfoResp = new StorageInfoResp();
|
|
|
storageInfoResp.setLeastPrice(sp.getPrice());
|
|
|
storageInfoResp.setStorageId(sp.getStorageId());
|
|
|
Storage storage = storageMap.get(sp.getStorageId());
|
|
|
if (storage == null) {
|
|
|
continue;
|
|
|
}
|
|
|
Size size = sizeMap.get(storage.getSizeId());
|
|
|
if (size != null) {
|
|
|
storageInfoResp.setSizeName(size.getSizeName());
|
|
|
}
|
|
|
resp.add(storageInfoResp);
|
|
|
}
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public StoragePrice getStoragePriceBySkup(Integer skup) {
|
|
|
return storagePriceMapper.selectBySkup(skup);
|
...
|
...
|
@@ -976,6 +1026,11 @@ public class ProductServiceImpl implements ProductService { |
|
|
|
|
|
StoragePrice storagePriceFlash = storagePriceMap.get(storage.getId() + "_3_0");//大陆闪购
|
|
|
|
|
|
|
|
|
StoragePrice storagePriceQuickDelivery = storagePriceMap.get(storage.getId() + "_9_0");//大陆极速发货
|
|
|
StoragePrice storagePriceQuickDeliveryHk = storagePriceMap.get(storage.getId() + "_9_1");//香港极速发货
|
|
|
storagePriceQuickDelivery = getMinNotNull(storagePriceQuickDelivery, storagePriceQuickDeliveryHk);
|
|
|
|
|
|
GoodsSize goodsSize = new GoodsSize();
|
|
|
goodsSize.setId(storage.getId());
|
|
|
goodsSize.setSizeId(storage.getSizeId());
|
...
|
...
|
@@ -1020,6 +1075,11 @@ public class ProductServiceImpl implements ProductService { |
|
|
goodsSize.setFlashStatus(storagePriceFlash == null ? null : storagePriceFlash.getStatus());
|
|
|
goodsSize.setFlashSkup(storagePriceFlash == null ? null : storagePriceFlash.getSkup());
|
|
|
goodsSize.setFlashStorageNum(goodsSize.getFlashSkup() == null || goodsSize.getFlashSkup() == 0 ? 0: 1);
|
|
|
|
|
|
goodsSize.setQuickDeliveryPrice(storagePriceQuickDelivery == null ? null : storagePriceQuickDelivery.getPrice());
|
|
|
goodsSize.setQuickDeliveryStatus(storagePriceQuickDelivery == null ? null : storagePriceQuickDelivery.getStatus());
|
|
|
goodsSize.setQuickDeliverySkup(storagePriceQuickDelivery == null ? null : storagePriceQuickDelivery.getSkup());
|
|
|
goodsSize.setQuickDeliveryNum(goodsSize.getQuickDeliverySkup() == null || goodsSize.getQuickDeliverySkup() == 0 ? 0 : 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -2019,6 +2079,19 @@ public class ProductServiceImpl implements ProductService { |
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
private StoragePrice getMinNotNull(StoragePrice sp1, StoragePrice sp2) {
|
|
|
if (sp1 == null) {
|
|
|
return sp2;
|
|
|
}
|
|
|
if (sp2 == null) {
|
|
|
return sp1;
|
|
|
}
|
|
|
if (sp1.getPrice().compareTo(sp2.getPrice()) < 0) {
|
|
|
return sp1;
|
|
|
}
|
|
|
return sp2;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<StorageCheckResp> getStorageByCodeAndColorName(List<ProductRequestBo> reqList) {
|
|
|
List<StorageCheckResp> result = new ArrayList<>();
|
...
|
...
|
|