Merge branch 'master' into recall_config
Showing
1 changed file
with
5 additions
and
9 deletions
@@ -43,8 +43,6 @@ public class PromotionCondService { | @@ -43,8 +43,6 @@ public class PromotionCondService { | ||
43 | private static final String CACHE_KEY = "CacheKey"; | 43 | private static final String CACHE_KEY = "CacheKey"; |
44 | private static final String PROMOTION_COND_LIST_CACHE_KEY = "promotionCondListCacheKey"; | 44 | private static final String PROMOTION_COND_LIST_CACHE_KEY = "promotionCondListCacheKey"; |
45 | private static final String PROMOTION_LIST_CACHE_KEY = "promotionListCacheKey"; | 45 | private static final String PROMOTION_LIST_CACHE_KEY = "promotionListCacheKey"; |
46 | - private volatile List<PromotionCond> promotionCondList = new ArrayList<>(); | ||
47 | - private volatile List<PromotionIndexBO> promotionIndexBOList = new ArrayList<>(); | ||
48 | 46 | ||
49 | //PromotionCondList Guava Cache | 47 | //PromotionCondList Guava Cache |
50 | LoadingCache<String, JSONObject> promotionCondListCache = CacheBuilder.newBuilder() | 48 | LoadingCache<String, JSONObject> promotionCondListCache = CacheBuilder.newBuilder() |
@@ -66,11 +64,11 @@ public class PromotionCondService { | @@ -66,11 +64,11 @@ public class PromotionCondService { | ||
66 | try { | 64 | try { |
67 | JSONObject jsonObject = promotionCondListCache.get(CACHE_KEY); | 65 | JSONObject jsonObject = promotionCondListCache.get(CACHE_KEY); |
68 | Assert.isTrue(jsonObject != null, "[cache jsonObject cannot be null][fun=getPromotionCondList]"); | 66 | Assert.isTrue(jsonObject != null, "[cache jsonObject cannot be null][fun=getPromotionCondList]"); |
69 | - promotionCondList = (List<PromotionCond>) jsonObject.get(PROMOTION_COND_LIST_CACHE_KEY); | 67 | + return (List<PromotionCond>) jsonObject.get(PROMOTION_COND_LIST_CACHE_KEY); |
70 | } catch (Exception e) { | 68 | } catch (Exception e) { |
71 | logger.error(e.getMessage()); | 69 | logger.error(e.getMessage()); |
70 | + return new ArrayList<>(); | ||
72 | } | 71 | } |
73 | - return promotionCondList; | ||
74 | } | 72 | } |
75 | 73 | ||
76 | /** | 74 | /** |
@@ -80,18 +78,18 @@ public class PromotionCondService { | @@ -80,18 +78,18 @@ public class PromotionCondService { | ||
80 | try { | 78 | try { |
81 | JSONObject jsonObject = promotionCondListCache.get(CACHE_KEY); | 79 | JSONObject jsonObject = promotionCondListCache.get(CACHE_KEY); |
82 | Assert.isTrue(jsonObject != null, "[cache jsonObject cannot be null][fun=getPromotionList]"); | 80 | Assert.isTrue(jsonObject != null, "[cache jsonObject cannot be null][fun=getPromotionList]"); |
83 | - promotionIndexBOList = (List<PromotionIndexBO>) jsonObject.get(PROMOTION_LIST_CACHE_KEY); | 81 | + return (List<PromotionIndexBO>) jsonObject.get(PROMOTION_LIST_CACHE_KEY); |
84 | } catch (Exception e) { | 82 | } catch (Exception e) { |
85 | logger.error(e.getMessage()); | 83 | logger.error(e.getMessage()); |
84 | + return new ArrayList<>(); | ||
86 | } | 85 | } |
87 | - return promotionIndexBOList; | ||
88 | } | 86 | } |
89 | 87 | ||
90 | /** | 88 | /** |
91 | * 获取PromotionCondList,加入缓存中 | 89 | * 获取PromotionCondList,加入缓存中 |
92 | */ | 90 | */ |
93 | public List<PromotionCond> buildPromotionCondList() { | 91 | public List<PromotionCond> buildPromotionCondList() { |
94 | - promotionCondList.clear(); | 92 | + List<PromotionCond> promotionCondList = new ArrayList<>(); |
95 | //去promotionIndex索引查询所有促销数据 | 93 | //去promotionIndex索引查询所有促销数据 |
96 | List<PromotionIndexBO> promotionIndexBOList = searchAllPromotion(); | 94 | List<PromotionIndexBO> promotionIndexBOList = searchAllPromotion(); |
97 | for (PromotionIndexBO promotionIndexBO : promotionIndexBOList) { | 95 | for (PromotionIndexBO promotionIndexBO : promotionIndexBOList) { |
@@ -106,13 +104,11 @@ public class PromotionCondService { | @@ -106,13 +104,11 @@ public class PromotionCondService { | ||
106 | * 获取PromotionList,加入缓存中 | 104 | * 获取PromotionList,加入缓存中 |
107 | */ | 105 | */ |
108 | public List<PromotionIndexBO> buildPromotionList() { | 106 | public List<PromotionIndexBO> buildPromotionList() { |
109 | - promotionIndexBOList.clear(); | ||
110 | //去promotionIndex索引查询所有促销数据 | 107 | //去promotionIndex索引查询所有促销数据 |
111 | List<PromotionIndexBO> promotionIndexBOList = searchAllPromotion(); | 108 | List<PromotionIndexBO> promotionIndexBOList = searchAllPromotion(); |
112 | return promotionIndexBOList; | 109 | return promotionIndexBOList; |
113 | } | 110 | } |
114 | 111 | ||
115 | - | ||
116 | /** | 112 | /** |
117 | * 去promotionIndex索引查询所有促销数据 | 113 | * 去promotionIndex索引查询所有促销数据 |
118 | */ | 114 | */ |
-
Please register or login to post a comment