|
@@ -204,7 +204,13 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -204,7 +204,13 @@ public class ProductServiceImpl implements ProductService { |
204
|
BigDecimal flashLeastPrice = flashLeastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
|
204
|
BigDecimal flashLeastPrice = flashLeastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
|
205
|
productInfo.setFlashLeastPrice(flashLeastPrice);
|
205
|
productInfo.setFlashLeastPrice(flashLeastPrice);
|
206
|
}
|
206
|
}
|
207
|
-
|
207
|
+
|
|
|
208
|
+ List<BigDecimal> quickDeliveryLeastPriceList = goodsSizes.stream().map(GoodsSize::getQuickDeliveryPrice).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
209
|
+ if(!CollectionUtils.isEmpty(quickDeliveryLeastPriceList)) {
|
|
|
210
|
+ BigDecimal quickDeliveryLeastPrice = quickDeliveryLeastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
|
|
|
211
|
+ productInfo.setQuickDeliveryPrice(quickDeliveryLeastPrice);
|
|
|
212
|
+ }
|
|
|
213
|
+
|
208
|
goodsSizes.sort(Comparator.comparing(GoodsSize::getOrderBy));
|
214
|
goodsSizes.sort(Comparator.comparing(GoodsSize::getOrderBy));
|
209
|
List<JSONObject> otherAddSizeList = getOtherSizeList(product.getMaxSortId(), product.getMidSortId(), goodsSizes);
|
215
|
List<JSONObject> otherAddSizeList = getOtherSizeList(product.getMaxSortId(), product.getMidSortId(), goodsSizes);
|
210
|
if(!CollectionUtils.isEmpty(otherAddSizeList)) {
|
216
|
if(!CollectionUtils.isEmpty(otherAddSizeList)) {
|
|
@@ -511,6 +517,50 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -511,6 +517,50 @@ public class ProductServiceImpl implements ProductService { |
511
|
return storagePrices.stream().filter(price -> price.getPreSaleFlag() == 3).collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
|
517
|
return storagePrices.stream().filter(price -> price.getPreSaleFlag() == 3).collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
|
512
|
}
|
518
|
}
|
513
|
|
519
|
|
|
|
520
|
+ public List<StorageInfoResp> queryLeastOnSalePrice(String productCode) {
|
|
|
521
|
+ List<Product> productList = productMapper.selectByProductCode(productCode);
|
|
|
522
|
+ if (productList.isEmpty()) {
|
|
|
523
|
+ return new ArrayList<>();
|
|
|
524
|
+ }
|
|
|
525
|
+ Product product = null;
|
|
|
526
|
+ for (Product p : productList) {
|
|
|
527
|
+ if (p.getDelStatus() == 0 && p.getShelveStatus() == 1) {
|
|
|
528
|
+ product = p;
|
|
|
529
|
+ break;
|
|
|
530
|
+ }
|
|
|
531
|
+ }
|
|
|
532
|
+ if (product == null) {
|
|
|
533
|
+ return new ArrayList<>();
|
|
|
534
|
+ }
|
|
|
535
|
+ List<StoragePrice> storagePrices = storagePriceMapper.selectLeastPricesByProductId(product.getId());
|
|
|
536
|
+ storagePrices = storagePrices.stream().filter(s -> s.getPreSaleFlag() == 0).collect(Collectors.toList());
|
|
|
537
|
+ Map<Integer, StoragePrice> storagePriceMap = storagePrices.stream().collect(Collectors.toMap(StoragePrice::getStorageId, Function.identity(), BinaryOperator.minBy(Comparator.comparing(StoragePrice::getPrice))));
|
|
|
538
|
+ if (storagePriceMap.isEmpty()) {
|
|
|
539
|
+ return new ArrayList<>();
|
|
|
540
|
+ }
|
|
|
541
|
+ List<Storage> storageList = storageMapper.selectByIds(storagePriceMap.keySet());
|
|
|
542
|
+ List<Size> sizeList = sizeMapper.selectByIds(storageList.stream().map(Storage::getSizeId).collect(Collectors.toList()));
|
|
|
543
|
+ Map<Integer, Storage> storageMap = storageList.stream().collect(Collectors.toMap(Storage::getId, Function.identity()));
|
|
|
544
|
+ Map<Integer, Size> sizeMap = sizeList.stream().collect(Collectors.toMap(Size::getId, Function.identity()));
|
|
|
545
|
+ List<StorageInfoResp> resp = new ArrayList<>();
|
|
|
546
|
+ for (Integer spId : storagePriceMap.keySet()) {
|
|
|
547
|
+ StoragePrice sp = storagePriceMap.get(spId);
|
|
|
548
|
+ StorageInfoResp storageInfoResp = new StorageInfoResp();
|
|
|
549
|
+ storageInfoResp.setLeastPrice(sp.getPrice());
|
|
|
550
|
+ storageInfoResp.setStorageId(sp.getStorageId());
|
|
|
551
|
+ Storage storage = storageMap.get(sp.getStorageId());
|
|
|
552
|
+ if (storage == null) {
|
|
|
553
|
+ continue;
|
|
|
554
|
+ }
|
|
|
555
|
+ Size size = sizeMap.get(storage.getSizeId());
|
|
|
556
|
+ if (size != null) {
|
|
|
557
|
+ storageInfoResp.setSizeName(size.getSizeName());
|
|
|
558
|
+ }
|
|
|
559
|
+ resp.add(storageInfoResp);
|
|
|
560
|
+ }
|
|
|
561
|
+ return resp;
|
|
|
562
|
+ }
|
|
|
563
|
+
|
514
|
@Override
|
564
|
@Override
|
515
|
public StoragePrice getStoragePriceBySkup(Integer skup) {
|
565
|
public StoragePrice getStoragePriceBySkup(Integer skup) {
|
516
|
return storagePriceMapper.selectBySkup(skup);
|
566
|
return storagePriceMapper.selectBySkup(skup);
|
|
@@ -976,6 +1026,11 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -976,6 +1026,11 @@ public class ProductServiceImpl implements ProductService { |
976
|
|
1026
|
|
977
|
StoragePrice storagePriceFlash = storagePriceMap.get(storage.getId() + "_3_0");//大陆闪购
|
1027
|
StoragePrice storagePriceFlash = storagePriceMap.get(storage.getId() + "_3_0");//大陆闪购
|
978
|
|
1028
|
|
|
|
1029
|
+
|
|
|
1030
|
+ StoragePrice storagePriceQuickDelivery = storagePriceMap.get(storage.getId() + "_9_0");//大陆极速发货
|
|
|
1031
|
+ StoragePrice storagePriceQuickDeliveryHk = storagePriceMap.get(storage.getId() + "_9_1");//香港极速发货
|
|
|
1032
|
+ storagePriceQuickDelivery = getMinNotNull(storagePriceQuickDelivery, storagePriceQuickDeliveryHk);
|
|
|
1033
|
+
|
979
|
GoodsSize goodsSize = new GoodsSize();
|
1034
|
GoodsSize goodsSize = new GoodsSize();
|
980
|
goodsSize.setId(storage.getId());
|
1035
|
goodsSize.setId(storage.getId());
|
981
|
goodsSize.setSizeId(storage.getSizeId());
|
1036
|
goodsSize.setSizeId(storage.getSizeId());
|
|
@@ -1020,6 +1075,11 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -1020,6 +1075,11 @@ public class ProductServiceImpl implements ProductService { |
1020
|
goodsSize.setFlashStatus(storagePriceFlash == null ? null : storagePriceFlash.getStatus());
|
1075
|
goodsSize.setFlashStatus(storagePriceFlash == null ? null : storagePriceFlash.getStatus());
|
1021
|
goodsSize.setFlashSkup(storagePriceFlash == null ? null : storagePriceFlash.getSkup());
|
1076
|
goodsSize.setFlashSkup(storagePriceFlash == null ? null : storagePriceFlash.getSkup());
|
1022
|
goodsSize.setFlashStorageNum(goodsSize.getFlashSkup() == null || goodsSize.getFlashSkup() == 0 ? 0: 1);
|
1077
|
goodsSize.setFlashStorageNum(goodsSize.getFlashSkup() == null || goodsSize.getFlashSkup() == 0 ? 0: 1);
|
|
|
1078
|
+
|
|
|
1079
|
+ goodsSize.setQuickDeliveryPrice(storagePriceQuickDelivery == null ? null : storagePriceQuickDelivery.getPrice());
|
|
|
1080
|
+ goodsSize.setQuickDeliveryStatus(storagePriceQuickDelivery == null ? null : storagePriceQuickDelivery.getStatus());
|
|
|
1081
|
+ goodsSize.setQuickDeliverySkup(storagePriceQuickDelivery == null ? null : storagePriceQuickDelivery.getSkup());
|
|
|
1082
|
+ goodsSize.setQuickDeliveryNum(goodsSize.getQuickDeliverySkup() == null || goodsSize.getQuickDeliverySkup() == 0 ? 0 : 1);
|
1023
|
}
|
1083
|
}
|
1024
|
}
|
1084
|
}
|
1025
|
}
|
1085
|
}
|
|
@@ -2019,6 +2079,19 @@ public class ProductServiceImpl implements ProductService { |
|
@@ -2019,6 +2079,19 @@ public class ProductServiceImpl implements ProductService { |
2019
|
return resp;
|
2079
|
return resp;
|
2020
|
}
|
2080
|
}
|
2021
|
|
2081
|
|
|
|
2082
|
+ private StoragePrice getMinNotNull(StoragePrice sp1, StoragePrice sp2) {
|
|
|
2083
|
+ if (sp1 == null) {
|
|
|
2084
|
+ return sp2;
|
|
|
2085
|
+ }
|
|
|
2086
|
+ if (sp2 == null) {
|
|
|
2087
|
+ return sp1;
|
|
|
2088
|
+ }
|
|
|
2089
|
+ if (sp1.getPrice().compareTo(sp2.getPrice()) < 0) {
|
|
|
2090
|
+ return sp1;
|
|
|
2091
|
+ }
|
|
|
2092
|
+ return sp2;
|
|
|
2093
|
+ }
|
|
|
2094
|
+
|
2022
|
@Override
|
2095
|
@Override
|
2023
|
public List<StorageCheckResp> getStorageByCodeAndColorName(List<ProductRequestBo> reqList) {
|
2096
|
public List<StorageCheckResp> getStorageByCodeAndColorName(List<ProductRequestBo> reqList) {
|
2024
|
List<StorageCheckResp> result = new ArrayList<>();
|
2097
|
List<StorageCheckResp> result = new ArrayList<>();
|