...
|
...
|
@@ -43,8 +43,6 @@ public class PromotionCondService { |
|
|
private static final String CACHE_KEY = "CacheKey";
|
|
|
private static final String PROMOTION_COND_LIST_CACHE_KEY = "promotionCondListCacheKey";
|
|
|
private static final String PROMOTION_LIST_CACHE_KEY = "promotionListCacheKey";
|
|
|
private volatile List<PromotionCond> promotionCondList = new ArrayList<>();
|
|
|
private volatile List<PromotionIndexBO> promotionIndexBOList = new ArrayList<>();
|
|
|
|
|
|
//PromotionCondList Guava Cache
|
|
|
LoadingCache<String, JSONObject> promotionCondListCache = CacheBuilder.newBuilder()
|
...
|
...
|
@@ -66,11 +64,11 @@ public class PromotionCondService { |
|
|
try {
|
|
|
JSONObject jsonObject = promotionCondListCache.get(CACHE_KEY);
|
|
|
Assert.isTrue(jsonObject != null, "[cache jsonObject cannot be null][fun=getPromotionCondList]");
|
|
|
promotionCondList = (List<PromotionCond>) jsonObject.get(PROMOTION_COND_LIST_CACHE_KEY);
|
|
|
return (List<PromotionCond>) jsonObject.get(PROMOTION_COND_LIST_CACHE_KEY);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage());
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
return promotionCondList;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -80,18 +78,18 @@ public class PromotionCondService { |
|
|
try {
|
|
|
JSONObject jsonObject = promotionCondListCache.get(CACHE_KEY);
|
|
|
Assert.isTrue(jsonObject != null, "[cache jsonObject cannot be null][fun=getPromotionList]");
|
|
|
promotionIndexBOList = (List<PromotionIndexBO>) jsonObject.get(PROMOTION_LIST_CACHE_KEY);
|
|
|
return (List<PromotionIndexBO>) jsonObject.get(PROMOTION_LIST_CACHE_KEY);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage());
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
return promotionIndexBOList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取PromotionCondList,加入缓存中
|
|
|
*/
|
|
|
public List<PromotionCond> buildPromotionCondList() {
|
|
|
promotionCondList.clear();
|
|
|
List<PromotionCond> promotionCondList = new ArrayList<>();
|
|
|
//去promotionIndex索引查询所有促销数据
|
|
|
List<PromotionIndexBO> promotionIndexBOList = searchAllPromotion();
|
|
|
for (PromotionIndexBO promotionIndexBO : promotionIndexBOList) {
|
...
|
...
|
@@ -106,13 +104,11 @@ public class PromotionCondService { |
|
|
* 获取PromotionList,加入缓存中
|
|
|
*/
|
|
|
public List<PromotionIndexBO> buildPromotionList() {
|
|
|
promotionIndexBOList.clear();
|
|
|
//去promotionIndex索引查询所有促销数据
|
|
|
List<PromotionIndexBO> promotionIndexBOList = searchAllPromotion();
|
|
|
return promotionIndexBOList;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 去promotionIndex索引查询所有促销数据
|
|
|
*/
|
...
|
...
|
|