| Line 113... |
Line 113... |
| 113 |
|
113 |
|
| 114 |
@Autowired
|
114 |
@Autowired
|
| 115 |
private CacheManager thirtyMinsTimeOutCacheManager;
|
115 |
private CacheManager thirtyMinsTimeOutCacheManager;
|
| 116 |
|
116 |
|
| 117 |
@Autowired
|
117 |
@Autowired
|
| - |
|
118 |
private Gson gson;
|
| - |
|
119 |
|
| - |
|
120 |
@Autowired
|
| 118 |
BrandsService brandsService;
|
121 |
BrandsService brandsService;
|
| 119 |
|
122 |
|
| 120 |
@Autowired
|
123 |
@Autowired
|
| 121 |
private CatalogRepository catalogRepository;
|
124 |
private CatalogRepository catalogRepository;
|
| 122 |
|
125 |
|
| Line 193... |
Line 196... |
| 193 |
for (YearMonth ymToEvict : yearMonthsToEvict) {
|
196 |
for (YearMonth ymToEvict : yearMonthsToEvict) {
|
| 194 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(ymToEvict);
|
197 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(ymToEvict);
|
| 195 |
oneDayCacheManager.getCache("allOffers").evict(ymToEvict);
|
198 |
oneDayCacheManager.getCache("allOffers").evict(ymToEvict);
|
| 196 |
}
|
199 |
}
|
| 197 |
redisShortCacheManager.getCache("publishedOffersWithAchievement").clear();
|
200 |
redisShortCacheManager.getCache("publishedOffersWithAchievement").clear();
|
| - |
|
201 |
// Evict partnerOffers cache for involved partners + admin view
|
| - |
|
202 |
for (Offer offer : offers) {
|
| - |
|
203 |
PartnerCriteria partnerCriteria = gson.fromJson(offer.getPartnerCriteria(), PartnerCriteria.class);
|
| - |
|
204 |
if (partnerCriteria != null && partnerCriteria.getFofoIds() != null) {
|
| - |
|
205 |
for (Integer fofoId : partnerCriteria.getFofoIds()) {
|
| - |
|
206 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(fofoId, offer.getId()));
|
| - |
|
207 |
}
|
| - |
|
208 |
}
|
| - |
|
209 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(0, offer.getId()));
|
| - |
|
210 |
}
|
| 198 |
if (active) {
|
211 |
if (active) {
|
| 199 |
for (Offer offer : offers) {
|
212 |
for (Offer offer : offers) {
|
| 200 |
this.sendNotification(offer);
|
213 |
this.sendNotification(offer);
|
| 201 |
}
|
214 |
}
|
| 202 |
}
|
215 |
}
|
| Line 212... |
Line 225... |
| 212 |
List<Offer> published = offerService.publishAllUnpublished(yearMonth);
|
225 |
List<Offer> published = offerService.publishAllUnpublished(yearMonth);
|
| 213 |
if (!published.isEmpty()) {
|
226 |
if (!published.isEmpty()) {
|
| 214 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(yearMonth);
|
227 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(yearMonth);
|
| 215 |
oneDayCacheManager.getCache("allOffers").evict(yearMonth);
|
228 |
oneDayCacheManager.getCache("allOffers").evict(yearMonth);
|
| 216 |
redisShortCacheManager.getCache("publishedOffersWithAchievement").clear();
|
229 |
redisShortCacheManager.getCache("publishedOffersWithAchievement").clear();
|
| - |
|
230 |
// Evict partnerOffers cache for involved partners + admin view
|
| - |
|
231 |
for (Offer offer : published) {
|
| - |
|
232 |
PartnerCriteria pc = gson.fromJson(offer.getPartnerCriteria(), PartnerCriteria.class);
|
| - |
|
233 |
if (pc != null && pc.getFofoIds() != null) {
|
| - |
|
234 |
for (Integer fofoId : pc.getFofoIds()) {
|
| - |
|
235 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(fofoId, offer.getId()));
|
| - |
|
236 |
}
|
| - |
|
237 |
}
|
| - |
|
238 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(0, offer.getId()));
|
| - |
|
239 |
}
|
| 217 |
for (Offer offer : published) {
|
240 |
for (Offer offer : published) {
|
| 218 |
this.sendNotification(offer);
|
241 |
this.sendNotification(offer);
|
| 219 |
}
|
242 |
}
|
| 220 |
}
|
243 |
}
|
| 221 |
return responseSender.ok(published.size() + " offers published");
|
244 |
return responseSender.ok(published.size() + " offers published");
|
| Line 710... |
Line 733... |
| 710 |
YearMonth ym = YearMonth.from(offer.getStartDate());
|
733 |
YearMonth ym = YearMonth.from(offer.getStartDate());
|
| 711 |
oneDayCacheManager.getCache("allOffers").evict(ym);
|
734 |
oneDayCacheManager.getCache("allOffers").evict(ym);
|
| 712 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(ym);
|
735 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(ym);
|
| 713 |
redisShortCacheManager.getCache("publishedOffersWithAchievement").clear();
|
736 |
redisShortCacheManager.getCache("publishedOffersWithAchievement").clear();
|
| 714 |
// Evict partnerOffers cache for all partners of this offer + admin view
|
737 |
// Evict partnerOffers cache for all partners of this offer + admin view
|
| 715 |
PartnerCriteria partnerCriteria = new Gson().fromJson(offer.getPartnerCriteria(), PartnerCriteria.class);
|
738 |
PartnerCriteria partnerCriteria = gson.fromJson(offer.getPartnerCriteria(), PartnerCriteria.class);
|
| 716 |
if (partnerCriteria != null && partnerCriteria.getFofoIds() != null) {
|
739 |
if (partnerCriteria != null && partnerCriteria.getFofoIds() != null) {
|
| 717 |
for (Integer fofoId : partnerCriteria.getFofoIds()) {
|
740 |
for (Integer fofoId : partnerCriteria.getFofoIds()) {
|
| 718 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(fofoId, offerId));
|
741 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(fofoId, offerId));
|
| 719 |
}
|
742 |
}
|
| 720 |
}
|
743 |
}
|