...
|
...
|
@@ -124,21 +124,36 @@ public class ProductServiceImpl implements ProductService{ |
|
|
|
|
|
@Override
|
|
|
public StorageLeastPriceResp queryStorageLeastPrice(Integer storageId) {
|
|
|
StoragePrice storagePrice = storagePriceMapper.selectLeastPrice(storageId);
|
|
|
if (storagePrice == null) {
|
|
|
return null;
|
|
|
}
|
|
|
StorageLeastPriceResp resp = new StorageLeastPriceResp();
|
|
|
resp.setStorageId(storageId);
|
|
|
resp.setLeastPrice(storagePrice.getPrice());
|
|
|
resp.setSkup(storagePrice.getSkup());
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
|
|
|
public StorageLeastPriceResp querStorageLeastPriceEx(Integer storageId) {
|
|
|
Storage storage = storageMapper.selectByPrimaryKey(storageId);
|
|
|
if (null == storage) {
|
|
|
LOGGER.warn("storageMapper.selectByPrimaryKey is null, storageId is {}", storageId);
|
|
|
return null;
|
|
|
return new StorageLeastPriceResp();
|
|
|
}
|
|
|
StoragePrice storagePrice = storagePriceMapper.selectLeastPrice(storageId);
|
|
|
StorageLeastPriceResp resp = new StorageLeastPriceResp();
|
|
|
if (storagePrice == null) {
|
|
|
resp.setSuggestHighPrice(storage.getSuggestHighPrice());
|
|
|
resp.setSuggestLowPrice(storage.getSuggestLowPrice());
|
|
|
return resp;
|
|
|
}
|
|
|
resp.setStorageId(storageId);
|
|
|
resp.setLeastPrice(storagePrice.getPrice());
|
|
|
resp.setSkup(storagePrice.getSkup());
|
|
|
resp.setSuggestLowPrice(storage.getSuggestLowPrice());
|
|
|
resp.setSuggestHighPrice(storage.getSuggestHighPrice());
|
|
|
|
|
|
// 如果最低价高于建议售价,则相当于没有此库存
|
|
|
if (null != storagePrice && (null == storage.getSuggestHighPrice() || (null != storage.getSuggestHighPrice() && storagePrice.getPrice().compareTo(storage.getSuggestHighPrice()) <= 0))) {
|
|
|
resp.setLeastPrice(storagePrice.getPrice());
|
|
|
resp.setSkup(storagePrice.getSkup());
|
|
|
}
|
|
|
|
|
|
return resp;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -583,13 +598,19 @@ public class ProductServiceImpl implements ProductService{ |
|
|
Map<Integer, StoragePrice> storagePriceMap = getStoragePriceMap(storageList);
|
|
|
|
|
|
for (Storage storage : storageList) {
|
|
|
StoragePrice storagePrice = storagePriceMap.get(storage.getId());
|
|
|
//高于建议价,不展示skup
|
|
|
if(null != storagePrice && null != storage.getSuggestHighPrice() && storagePrice.getPrice().compareTo(storage.getSuggestHighPrice()) > 0) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
GoodsSize goodsSize = new GoodsSize();
|
|
|
goodsSize.setId(storage.getId());
|
|
|
goodsSize.setSizeId(storage.getSizeId());
|
|
|
Size size = sizeMap.get(storage.getSizeId());
|
|
|
goodsSize.setSizeName(size == null ? "" : size.getSizeName());
|
|
|
goodsSize.setOrderBy(size == null ? 0 : size.getOrderBy());
|
|
|
StoragePrice storagePrice = storagePriceMap.get(storage.getId());
|
|
|
|
|
|
goodsSize.setLeastPrice(storagePrice == null ? null : storagePrice.getPrice());
|
|
|
goodsSize.setStatus(storagePrice == null ? null : storagePrice.getStatus());
|
|
|
goodsSize.setStorageNum(storagePrice == null ? 0 : storage.getStorageNum());
|
...
|
...
|
|