Authored by wangnan9279

预售库存判断是否为有效的时候不考虑比价上限

... ... @@ -91,27 +91,32 @@ public class UfoStoragePriceFieldBuilder implements UfoIndexFieldBuilder {
/**
* 获取所有有效的StoragePrice列表
* 条件为:1.status为1(可售) 2.价格小于等于库存规定的最高价
* 条件为:1.status为1(可售) 2.如果是现货类型,价格小于等于库存规定的最高价
*/
private List<StoragePrice> getValidStoragePriceList(List<StoragePrice> storagePriceList, Map<Integer, Storage> ufoStorageMap) {
List<StoragePrice> validStoragePriceList = new ArrayList<>();
for (StoragePrice storagePrice : storagePriceList) {
//库存项状态要为可售
if (storagePrice.getStatus() != 1) {
continue;
}
Integer storageId = storagePrice.getStorageId();
if (!ufoStorageMap.containsKey(storageId)) {
continue;
}
Storage storage = ufoStorageMap.get(storageId);
BigDecimal suggestHighPrice = storage.getSuggestHighPrice();
if (suggestHighPrice == null) {
validStoragePriceList.add(storagePrice);
continue;
}
if (storagePrice.getPrice().compareTo(suggestHighPrice) <= 0) {
validStoragePriceList.add(storagePrice);
//现货类型的库存项要去对比建议最高价,超过最高价则为无效库存
if (storagePrice.getPreSaleFlag() == 0) {
Integer storageId = storagePrice.getStorageId();
if (!ufoStorageMap.containsKey(storageId)) {
continue;
}
Storage storage = ufoStorageMap.get(storageId);
BigDecimal suggestHighPrice = storage.getSuggestHighPrice();
if (suggestHighPrice == null) {
validStoragePriceList.add(storagePrice);
continue;
}
if (storagePrice.getPrice().compareTo(suggestHighPrice) <= 0) {
validStoragePriceList.add(storagePrice);
}
}
validStoragePriceList.add(storagePrice);
}
if (CollectionUtils.isEmpty(validStoragePriceList)) {
return null;
... ...