|
@@ -19,6 +19,7 @@ import com.yohoufo.common.annotation.IgnoreSession; |
|
@@ -19,6 +19,7 @@ import com.yohoufo.common.annotation.IgnoreSession; |
19
|
import com.yohoufo.common.annotation.IgnoreSignature;
|
19
|
import com.yohoufo.common.annotation.IgnoreSignature;
|
20
|
import com.yohoufo.common.cache.Cachable;
|
20
|
import com.yohoufo.common.cache.Cachable;
|
21
|
import com.yohoufo.common.cache.ControllerCacheAop;
|
21
|
import com.yohoufo.common.cache.ControllerCacheAop;
|
|
|
22
|
+import com.yohoufo.common.caller.UfoServiceCaller;
|
22
|
import com.yohoufo.dal.product.model.StoragePrice;
|
23
|
import com.yohoufo.dal.product.model.StoragePrice;
|
23
|
import com.yohoufo.product.model.SkupInfo;
|
24
|
import com.yohoufo.product.model.SkupInfo;
|
24
|
import com.yohoufo.product.response.*;
|
25
|
import com.yohoufo.product.response.*;
|
|
@@ -38,6 +39,7 @@ import org.springframework.web.servlet.ModelAndView; |
|
@@ -38,6 +39,7 @@ import org.springframework.web.servlet.ModelAndView; |
38
|
import java.lang.reflect.Method;
|
39
|
import java.lang.reflect.Method;
|
39
|
import java.math.BigDecimal;
|
40
|
import java.math.BigDecimal;
|
40
|
import java.util.Collection;
|
41
|
import java.util.Collection;
|
|
|
42
|
+import java.util.HashMap;
|
41
|
import java.util.List;
|
43
|
import java.util.List;
|
42
|
import java.util.Map;
|
44
|
import java.util.Map;
|
43
|
import java.util.concurrent.ExecutorService;
|
45
|
import java.util.concurrent.ExecutorService;
|
|
@@ -56,6 +58,9 @@ public class ProductController { |
|
@@ -56,6 +58,9 @@ public class ProductController { |
56
|
|
58
|
|
57
|
@Autowired
|
59
|
@Autowired
|
58
|
private ProductBatchService productBatchService;
|
60
|
private ProductBatchService productBatchService;
|
|
|
61
|
+
|
|
|
62
|
+ @Autowired
|
|
|
63
|
+ private UfoServiceCaller ufoServiceCaller;
|
59
|
|
64
|
|
60
|
@Autowired
|
65
|
@Autowired
|
61
|
private ConfigReader configReader;
|
66
|
private ConfigReader configReader;
|
|
@@ -534,8 +539,8 @@ public class ProductController { |
|
@@ -534,8 +539,8 @@ public class ProductController { |
534
|
try {
|
539
|
try {
|
535
|
LOG.info("in clearBatchProductCache skupList = {}", skupList);
|
540
|
LOG.info("in clearBatchProductCache skupList = {}", skupList);
|
536
|
List<StoragePrice> spList = productService.getStoragePriceBySkupList(skupList);
|
541
|
List<StoragePrice> spList = productService.getStoragePriceBySkupList(skupList);
|
537
|
- List<Integer> productIdList = spList.stream().map(StoragePrice::getProductId).collect(Collectors.toList());
|
|
|
538
|
- List<Integer> storageIdList = spList.stream().map(StoragePrice::getStorageId).collect(Collectors.toList());
|
542
|
+ List<Integer> productIdList = spList.stream().map(StoragePrice::getProductId).distinct().collect(Collectors.toList());
|
|
|
543
|
+ List<Integer> storageIdList = spList.stream().map(StoragePrice::getStorageId).distinct().collect(Collectors.toList());
|
539
|
if (CollectionUtils.isNotEmpty(productIdList)) {
|
544
|
if (CollectionUtils.isNotEmpty(productIdList)) {
|
540
|
for (Integer productId : productIdList) {
|
545
|
for (Integer productId : productIdList) {
|
541
|
LOG.info("Batch clearCache queryProductDetailById productId = {}, ", productId);
|
546
|
LOG.info("Batch clearCache queryProductDetailById productId = {}, ", productId);
|
|
@@ -574,8 +579,16 @@ public class ProductController { |
|
@@ -574,8 +579,16 @@ public class ProductController { |
574
|
cacheAop.clearCache(
|
579
|
cacheAop.clearCache(
|
575
|
ProductController.class.getMethod("queryStorageSuggestPrice", new Class[]{Collection.class}),
|
580
|
ProductController.class.getMethod("queryStorageSuggestPrice", new Class[]{Collection.class}),
|
576
|
new Object[]{storageId});
|
581
|
new Object[]{storageId});
|
|
|
582
|
+ cacheAop.clearCache(
|
|
|
583
|
+ ProductController.class.getMethod("querySecondHandProductListCount", new Class[]{Integer.class}),
|
|
|
584
|
+ new Object[]{storageId});
|
|
|
585
|
+ LOG.info("clearCache querySecondHandProductListFilter skup = {}, ", storageId);
|
|
|
586
|
+ cacheAop.clearCache(
|
|
|
587
|
+ ProductController.class.getMethod("querySecondHandProductListFilter", new Class[]{Integer.class}),
|
|
|
588
|
+ new Object[]{storageId});
|
577
|
}
|
589
|
}
|
578
|
}
|
590
|
}
|
|
|
591
|
+ Map<String, StoragePrice> distinctStorage = new HashMap<>();
|
579
|
for(StoragePrice sp : spList) {
|
592
|
for(StoragePrice sp : spList) {
|
580
|
Integer skup = sp.getSkup();
|
593
|
Integer skup = sp.getSkup();
|
581
|
Integer storageId = sp.getStorageId();
|
594
|
Integer storageId = sp.getStorageId();
|
|
@@ -584,15 +597,13 @@ public class ProductController { |
|
@@ -584,15 +597,13 @@ public class ProductController { |
584
|
cacheAop.clearCache(
|
597
|
cacheAop.clearCache(
|
585
|
ProductController.class.getMethod("querySecondHandProductData", new Class[]{Integer.class}),
|
598
|
ProductController.class.getMethod("querySecondHandProductData", new Class[]{Integer.class}),
|
586
|
new Object[]{skup});
|
599
|
new Object[]{skup});
|
587
|
- LOG.info("clearCache querySecondHandProductListCount skup = {}, ", skup);
|
|
|
588
|
- cacheAop.clearCache(
|
|
|
589
|
- ProductController.class.getMethod("querySecondHandProductListCount", new Class[]{Integer.class}),
|
|
|
590
|
- new Object[]{storageId});
|
|
|
591
|
- LOG.info("clearCache querySecondHandProductListFilter skup = {}, ", skup);
|
|
|
592
|
- cacheAop.clearCache(
|
|
|
593
|
- ProductController.class.getMethod("querySecondHandProductListFilter", new Class[]{Integer.class}),
|
|
|
594
|
- new Object[]{storageId});
|
|
|
595
|
}
|
600
|
}
|
|
|
601
|
+ if (sp.getPreSaleFlag() != null && (sp.getPreSaleFlag() == 3)) {
|
|
|
602
|
+ distinctStorage.put(sp.getSellerUid() + "_" + sp.getProductId() + "_" + sp.getStorageId(), sp);
|
|
|
603
|
+ }
|
|
|
604
|
+ }
|
|
|
605
|
+ for (StoragePrice sp : distinctStorage.values()) {
|
|
|
606
|
+ ufoServiceCaller.asyncCall("ufo.deposit.innerClearUserDeposit", ApiResponse.class, sp.getSellerUid(), sp.getProductId(), sp.getStorageId());
|
596
|
}
|
607
|
}
|
597
|
} catch (Exception e) {
|
608
|
} catch (Exception e) {
|
598
|
LOG.error("删除商品缓存失败!", e);
|
609
|
LOG.error("删除商品缓存失败!", e);
|