Authored by Lixiaodi

清除缓存

... ... @@ -73,7 +73,7 @@ public interface StoragePriceMapper {
List<StoragePrice> selectLeastPricesByProductId(@Param("productId") Integer productId);
BigDecimal selectInStockLeastPriceByProductId(@Param("productId") Integer productId);
BigDecimal selectInStockLeastPriceByProductId(@Param("storageId") Integer storageId);
int updateOneSkupHideStatus(@Param("skup") Integer skup, @Param("status") int status);
}
\ No newline at end of file
... ...
... ... @@ -111,7 +111,7 @@
<select id="selectInStockLeastPriceByProductId" resultType="java.math.BigDecimal">
select min(price) as price
from storage_price
where status = 1 and product_id = #{productId} and is_hide = 0 and pre_sale_flag=0
where status = 1 and storage_id = #{storageId} and is_hide = 0 and pre_sale_flag=0
</select>
<select id="selectBySkupList" resultMap="BaseResultMap">
... ...
... ... @@ -435,7 +435,23 @@ public class ProductController {
cacheAop.clearCache(
ProductController.class.getMethod("queryStorageSuggestPrice", new Class[]{Collection.class}),
new Object[]{storageId});
if (sp.getPreSaleFlag() != null && (sp.getPreSaleFlag() == 5 || sp.getPreSaleFlag() == 6)) {
LOG.info("clearCache querySecondHandProductData skup = {}, ", skup);
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});
}
}
} catch (Exception e) {
LOG.error("删除商品缓存失败!", e);
}
... ... @@ -485,6 +501,24 @@ public class ProductController {
new Object[]{storageId});
}
}
for(StoragePrice sp : spList) {
Integer skup = sp.getSkup();
Integer storageId = sp.getStorageId();
if (sp.getPreSaleFlag() != null && (sp.getPreSaleFlag() == 5 || sp.getPreSaleFlag() == 6)) {
LOG.info("clearCache querySecondHandProductData skup = {}, ", skup);
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});
}
}
} catch (Exception e) {
LOG.error("删除商品缓存失败!", e);
}
... ...
... ... @@ -1361,7 +1361,7 @@ public class ProductServiceImpl implements ProductService {
// 价格
resp.setPrice(sp.getPrice().toString());
BigDecimal inStockLeastPrice = storagePriceMapper.selectInStockLeastPriceByProductId(productId);
BigDecimal inStockLeastPrice = storagePriceMapper.selectInStockLeastPriceByProductId(storageId);
if (inStockLeastPrice != null && inStockLeastPrice.compareTo(sp.getPrice()) > 0) {
resp.setNewProductPrice(inStockLeastPrice.toString());
resp.setSavePrice(inStockLeastPrice.subtract(sp.getPrice()).toString());
... ...