Authored by LUOXC

Merge branch 'hotfix-20191028' into test6.9.14

# Conflicts:
#	product/src/main/java/com/yohoufo/product/controller/ProductController.java
#	product/src/main/java/com/yohoufo/product/service/impl/StoragePriceService.java
... ... @@ -597,27 +597,8 @@ public class ProductController {
if (CollectionUtils.isNotEmpty(productIdList)) {
for (Integer productId : productIdList) {
LOG.info("Batch clearCache queryProductDetailById productId = {}, ", productId);
storagePriceService.publishPriceUpdateEventWithDeleteCache(productId);
// storagePriceService.publishPriceUpdateEventIf(productId, oldSkupList -> {
// // 缓存不存在,需要更新
// if (CollectionUtils.isEmpty(oldSkupList)) {
// return true;
// }
// // 比最低价要低,需要更新
// Predicate<StoragePrice> pricePredicate = newPrice -> oldSkupList.stream()
// .filter(oldPrice -> Objects.equals(newPrice.getStorageId(), oldPrice.getStorageId()))
// .anyMatch(oldPrice -> newPrice.getPrice().compareTo(oldPrice.getPrice()) < 0);
// if(storagePriceList.stream().anyMatch(pricePredicate)){
// return true;
// }
// // 如果当前skup为缓存中商品,需要更新
// Predicate<StoragePrice> sameSkupPredicate = newSkup -> oldSkupList.stream()
// .anyMatch(oldSkup -> Objects.equals(newSkup.getSkup(), oldSkup.getSkup()));
// if(storagePriceList.stream().anyMatch(sameSkupPredicate)){
// return true;
// }
// return false;
// });
storagePriceService.publishPriceUpdateEventOfClearCache(productId);
//商品详情
cacheAop.clearCache(
... ...
... ... @@ -116,7 +116,7 @@ public class StoragePriceService {
return storagePriceMapper.selectLeastPricesByProductId(productId);
}
public void publishPriceUpdateEventWithDeleteCache(Integer productId) {
public void publishPriceUpdateEventOfClearCache(Integer productId) {
LOGGER.info("method com.yohoufo.product.service.impl.StoragePriceService.publishPriceUpdateEvent in productId is 【{}】", productId);
StoragePriceUpdateEvent storagePriceUpdateEvent = new StoragePriceUpdateEvent(event->{
productCacheService.deleteCacheByString(UfoProductCacheKeyEnum.STORAGE_PRICE_IN_STOCK_INFO_KEY, productId.toString());
... ...