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
Showing
2 changed files
with
3 additions
and
22 deletions
@@ -597,27 +597,8 @@ public class ProductController { | @@ -597,27 +597,8 @@ public class ProductController { | ||
597 | if (CollectionUtils.isNotEmpty(productIdList)) { | 597 | if (CollectionUtils.isNotEmpty(productIdList)) { |
598 | for (Integer productId : productIdList) { | 598 | for (Integer productId : productIdList) { |
599 | LOG.info("Batch clearCache queryProductDetailById productId = {}, ", productId); | 599 | LOG.info("Batch clearCache queryProductDetailById productId = {}, ", productId); |
600 | - storagePriceService.publishPriceUpdateEventWithDeleteCache(productId); | ||
601 | -// storagePriceService.publishPriceUpdateEventIf(productId, oldSkupList -> { | ||
602 | -// // 缓存不存在,需要更新 | ||
603 | -// if (CollectionUtils.isEmpty(oldSkupList)) { | ||
604 | -// return true; | ||
605 | -// } | ||
606 | -// // 比最低价要低,需要更新 | ||
607 | -// Predicate<StoragePrice> pricePredicate = newPrice -> oldSkupList.stream() | ||
608 | -// .filter(oldPrice -> Objects.equals(newPrice.getStorageId(), oldPrice.getStorageId())) | ||
609 | -// .anyMatch(oldPrice -> newPrice.getPrice().compareTo(oldPrice.getPrice()) < 0); | ||
610 | -// if(storagePriceList.stream().anyMatch(pricePredicate)){ | ||
611 | -// return true; | ||
612 | -// } | ||
613 | -// // 如果当前skup为缓存中商品,需要更新 | ||
614 | -// Predicate<StoragePrice> sameSkupPredicate = newSkup -> oldSkupList.stream() | ||
615 | -// .anyMatch(oldSkup -> Objects.equals(newSkup.getSkup(), oldSkup.getSkup())); | ||
616 | -// if(storagePriceList.stream().anyMatch(sameSkupPredicate)){ | ||
617 | -// return true; | ||
618 | -// } | ||
619 | -// return false; | ||
620 | -// }); | 600 | + |
601 | + storagePriceService.publishPriceUpdateEventOfClearCache(productId); | ||
621 | 602 | ||
622 | //商品详情 | 603 | //商品详情 |
623 | cacheAop.clearCache( | 604 | cacheAop.clearCache( |
@@ -116,7 +116,7 @@ public class StoragePriceService { | @@ -116,7 +116,7 @@ public class StoragePriceService { | ||
116 | return storagePriceMapper.selectLeastPricesByProductId(productId); | 116 | return storagePriceMapper.selectLeastPricesByProductId(productId); |
117 | } | 117 | } |
118 | 118 | ||
119 | - public void publishPriceUpdateEventWithDeleteCache(Integer productId) { | 119 | + public void publishPriceUpdateEventOfClearCache(Integer productId) { |
120 | LOGGER.info("method com.yohoufo.product.service.impl.StoragePriceService.publishPriceUpdateEvent in productId is 【{}】", productId); | 120 | LOGGER.info("method com.yohoufo.product.service.impl.StoragePriceService.publishPriceUpdateEvent in productId is 【{}】", productId); |
121 | StoragePriceUpdateEvent storagePriceUpdateEvent = new StoragePriceUpdateEvent(event->{ | 121 | StoragePriceUpdateEvent storagePriceUpdateEvent = new StoragePriceUpdateEvent(event->{ |
122 | productCacheService.deleteCacheByString(UfoProductCacheKeyEnum.STORAGE_PRICE_IN_STOCK_INFO_KEY, productId.toString()); | 122 | productCacheService.deleteCacheByString(UfoProductCacheKeyEnum.STORAGE_PRICE_IN_STOCK_INFO_KEY, productId.toString()); |
-
Please register or login to post a comment