...
|
...
|
@@ -19,6 +19,7 @@ import com.yohoufo.common.annotation.IgnoreSession; |
|
|
import com.yohoufo.common.annotation.IgnoreSignature;
|
|
|
import com.yohoufo.common.cache.Cachable;
|
|
|
import com.yohoufo.common.cache.ControllerCacheAop;
|
|
|
import com.yohoufo.common.caller.UfoServiceCaller;
|
|
|
import com.yohoufo.dal.product.model.StoragePrice;
|
|
|
import com.yohoufo.product.model.SkupInfo;
|
|
|
import com.yohoufo.product.response.*;
|
...
|
...
|
@@ -38,6 +39,7 @@ import org.springframework.web.servlet.ModelAndView; |
|
|
import java.lang.reflect.Method;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Collection;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.ExecutorService;
|
...
|
...
|
@@ -56,6 +58,9 @@ public class ProductController { |
|
|
|
|
|
@Autowired
|
|
|
private ProductBatchService productBatchService;
|
|
|
|
|
|
@Autowired
|
|
|
private UfoServiceCaller ufoServiceCaller;
|
|
|
|
|
|
@Autowired
|
|
|
private ConfigReader configReader;
|
...
|
...
|
@@ -534,8 +539,8 @@ public class ProductController { |
|
|
try {
|
|
|
LOG.info("in clearBatchProductCache skupList = {}", skupList);
|
|
|
List<StoragePrice> spList = productService.getStoragePriceBySkupList(skupList);
|
|
|
List<Integer> productIdList = spList.stream().map(StoragePrice::getProductId).collect(Collectors.toList());
|
|
|
List<Integer> storageIdList = spList.stream().map(StoragePrice::getStorageId).collect(Collectors.toList());
|
|
|
List<Integer> productIdList = spList.stream().map(StoragePrice::getProductId).distinct().collect(Collectors.toList());
|
|
|
List<Integer> storageIdList = spList.stream().map(StoragePrice::getStorageId).distinct().collect(Collectors.toList());
|
|
|
if (CollectionUtils.isNotEmpty(productIdList)) {
|
|
|
for (Integer productId : productIdList) {
|
|
|
LOG.info("Batch clearCache queryProductDetailById productId = {}, ", productId);
|
...
|
...
|
@@ -574,8 +579,16 @@ public class ProductController { |
|
|
cacheAop.clearCache(
|
|
|
ProductController.class.getMethod("queryStorageSuggestPrice", new Class[]{Collection.class}),
|
|
|
new Object[]{storageId});
|
|
|
cacheAop.clearCache(
|
|
|
ProductController.class.getMethod("querySecondHandProductListCount", new Class[]{Integer.class}),
|
|
|
new Object[]{storageId});
|
|
|
LOG.info("clearCache querySecondHandProductListFilter skup = {}, ", storageId);
|
|
|
cacheAop.clearCache(
|
|
|
ProductController.class.getMethod("querySecondHandProductListFilter", new Class[]{Integer.class}),
|
|
|
new Object[]{storageId});
|
|
|
}
|
|
|
}
|
|
|
Map<String, StoragePrice> distinctStorage = new HashMap<>();
|
|
|
for(StoragePrice sp : spList) {
|
|
|
Integer skup = sp.getSkup();
|
|
|
Integer storageId = sp.getStorageId();
|
...
|
...
|
@@ -584,15 +597,13 @@ public class ProductController { |
|
|
cacheAop.clearCache(
|
|
|
ProductController.class.getMethod("querySecondHandProductData", new Class[]{Integer.class}),
|
|
|
new Object[]{skup});
|
|
|
LOG.info("clearCache querySecondHandProductListCount skup = {}, ", skup);
|
|
|
cacheAop.clearCache(
|
|
|
ProductController.class.getMethod("querySecondHandProductListCount", new Class[]{Integer.class}),
|
|
|
new Object[]{storageId});
|
|
|
LOG.info("clearCache querySecondHandProductListFilter skup = {}, ", skup);
|
|
|
cacheAop.clearCache(
|
|
|
ProductController.class.getMethod("querySecondHandProductListFilter", new Class[]{Integer.class}),
|
|
|
new Object[]{storageId});
|
|
|
}
|
|
|
if (sp.getPreSaleFlag() != null && (sp.getPreSaleFlag() == 3)) {
|
|
|
distinctStorage.put(sp.getSellerUid() + "_" + sp.getProductId() + "_" + sp.getStorageId(), sp);
|
|
|
}
|
|
|
}
|
|
|
for (StoragePrice sp : distinctStorage.values()) {
|
|
|
ufoServiceCaller.asyncCall("ufo.deposit.innerClearUserDeposit", ApiResponse.class, sp.getSellerUid(), sp.getProductId(), sp.getStorageId());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
LOG.error("删除商品缓存失败!", e);
|
...
|
...
|
|