Authored by Lixiaodi

清除缓存

@@ -73,7 +73,7 @@ public interface StoragePriceMapper { @@ -73,7 +73,7 @@ public interface StoragePriceMapper {
73 73
74 List<StoragePrice> selectLeastPricesByProductId(@Param("productId") Integer productId); 74 List<StoragePrice> selectLeastPricesByProductId(@Param("productId") Integer productId);
75 75
76 - BigDecimal selectInStockLeastPriceByProductId(@Param("productId") Integer productId); 76 + BigDecimal selectInStockLeastPriceByProductId(@Param("storageId") Integer storageId);
77 77
78 int updateOneSkupHideStatus(@Param("skup") Integer skup, @Param("status") int status); 78 int updateOneSkupHideStatus(@Param("skup") Integer skup, @Param("status") int status);
79 } 79 }
@@ -111,7 +111,7 @@ @@ -111,7 +111,7 @@
111 <select id="selectInStockLeastPriceByProductId" resultType="java.math.BigDecimal"> 111 <select id="selectInStockLeastPriceByProductId" resultType="java.math.BigDecimal">
112 select min(price) as price 112 select min(price) as price
113 from storage_price 113 from storage_price
114 - where status = 1 and product_id = #{productId} and is_hide = 0 and pre_sale_flag=0 114 + where status = 1 and storage_id = #{storageId} and is_hide = 0 and pre_sale_flag=0
115 </select> 115 </select>
116 116
117 <select id="selectBySkupList" resultMap="BaseResultMap"> 117 <select id="selectBySkupList" resultMap="BaseResultMap">
@@ -435,7 +435,23 @@ public class ProductController { @@ -435,7 +435,23 @@ public class ProductController {
435 cacheAop.clearCache( 435 cacheAop.clearCache(
436 ProductController.class.getMethod("queryStorageSuggestPrice", new Class[]{Collection.class}), 436 ProductController.class.getMethod("queryStorageSuggestPrice", new Class[]{Collection.class}),
437 new Object[]{storageId}); 437 new Object[]{storageId});
  438 +
  439 + if (sp.getPreSaleFlag() != null && (sp.getPreSaleFlag() == 5 || sp.getPreSaleFlag() == 6)) {
  440 + LOG.info("clearCache querySecondHandProductData skup = {}, ", skup);
  441 + cacheAop.clearCache(
  442 + ProductController.class.getMethod("querySecondHandProductData", new Class[]{Integer.class}),
  443 + new Object[]{skup});
  444 + LOG.info("clearCache querySecondHandProductListCount skup = {}, ", skup);
  445 + cacheAop.clearCache(
  446 + ProductController.class.getMethod("querySecondHandProductListCount", new Class[]{Integer.class}),
  447 + new Object[]{storageId});
  448 + LOG.info("clearCache querySecondHandProductListFilter skup = {}, ", skup);
  449 + cacheAop.clearCache(
  450 + ProductController.class.getMethod("querySecondHandProductListFilter", new Class[]{Integer.class}),
  451 + new Object[]{storageId});
  452 + }
438 } 453 }
  454 +
439 } catch (Exception e) { 455 } catch (Exception e) {
440 LOG.error("删除商品缓存失败!", e); 456 LOG.error("删除商品缓存失败!", e);
441 } 457 }
@@ -485,6 +501,24 @@ public class ProductController { @@ -485,6 +501,24 @@ public class ProductController {
485 new Object[]{storageId}); 501 new Object[]{storageId});
486 } 502 }
487 } 503 }
  504 + for(StoragePrice sp : spList) {
  505 + Integer skup = sp.getSkup();
  506 + Integer storageId = sp.getStorageId();
  507 + if (sp.getPreSaleFlag() != null && (sp.getPreSaleFlag() == 5 || sp.getPreSaleFlag() == 6)) {
  508 + LOG.info("clearCache querySecondHandProductData skup = {}, ", skup);
  509 + cacheAop.clearCache(
  510 + ProductController.class.getMethod("querySecondHandProductData", new Class[]{Integer.class}),
  511 + new Object[]{skup});
  512 + LOG.info("clearCache querySecondHandProductListCount skup = {}, ", skup);
  513 + cacheAop.clearCache(
  514 + ProductController.class.getMethod("querySecondHandProductListCount", new Class[]{Integer.class}),
  515 + new Object[]{storageId});
  516 + LOG.info("clearCache querySecondHandProductListFilter skup = {}, ", skup);
  517 + cacheAop.clearCache(
  518 + ProductController.class.getMethod("querySecondHandProductListFilter", new Class[]{Integer.class}),
  519 + new Object[]{storageId});
  520 + }
  521 + }
488 } catch (Exception e) { 522 } catch (Exception e) {
489 LOG.error("删除商品缓存失败!", e); 523 LOG.error("删除商品缓存失败!", e);
490 } 524 }
@@ -1361,7 +1361,7 @@ public class ProductServiceImpl implements ProductService { @@ -1361,7 +1361,7 @@ public class ProductServiceImpl implements ProductService {
1361 1361
1362 // 价格 1362 // 价格
1363 resp.setPrice(sp.getPrice().toString()); 1363 resp.setPrice(sp.getPrice().toString());
1364 - BigDecimal inStockLeastPrice = storagePriceMapper.selectInStockLeastPriceByProductId(productId); 1364 + BigDecimal inStockLeastPrice = storagePriceMapper.selectInStockLeastPriceByProductId(storageId);
1365 if (inStockLeastPrice != null && inStockLeastPrice.compareTo(sp.getPrice()) > 0) { 1365 if (inStockLeastPrice != null && inStockLeastPrice.compareTo(sp.getPrice()) > 0) {
1366 resp.setNewProductPrice(inStockLeastPrice.toString()); 1366 resp.setNewProductPrice(inStockLeastPrice.toString());
1367 resp.setSavePrice(inStockLeastPrice.subtract(sp.getPrice()).toString()); 1367 resp.setSavePrice(inStockLeastPrice.subtract(sp.getPrice()).toString());