| Line 201... |
Line 201... |
| 201 |
oneDayCacheManager.getCache("allOffers").evict(ymToEvict);
|
201 |
oneDayCacheManager.getCache("allOffers").evict(ymToEvict);
|
| 202 |
}
|
202 |
}
|
| 203 |
// Evict partner's published offer list with achievement data
|
203 |
// Evict partner's published offer list with achievement data
|
| 204 |
oneDayCacheManager.getCache("publishedOffersWithAchievement").clear();
|
204 |
oneDayCacheManager.getCache("publishedOffersWithAchievement").clear();
|
| 205 |
redisShortCacheManager.getCache("todayOffers").clear();
|
205 |
redisShortCacheManager.getCache("todayOffers").clear();
|
| 206 |
// Evict offer detail (price circular) for each involved partner; key=(fofoId, offerId), 0=admin
|
- |
|
| 207 |
for (Offer offer : offers) {
|
- |
|
| 208 |
PartnerCriteria partnerCriteria = gson.fromJson(offer.getPartnerCriteria(), PartnerCriteria.class);
|
- |
|
| 209 |
if (partnerCriteria != null && partnerCriteria.getFofoIds() != null) {
|
- |
|
| 210 |
for (Integer fofoId : partnerCriteria.getFofoIds()) {
|
206 |
// Evict all partner offer caches (price circular)
|
| 211 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(fofoId, offer.getId()));
|
- |
|
| 212 |
}
|
- |
|
| 213 |
}
|
- |
|
| 214 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(0, offer.getId()));
|
207 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").clear();
|
| 215 |
}
|
- |
|
| 216 |
if (active) {
|
208 |
if (active) {
|
| 217 |
for (Offer offer : offers) {
|
209 |
for (Offer offer : offers) {
|
| 218 |
this.sendNotification(offer);
|
210 |
this.sendNotification(offer);
|
| 219 |
}
|
211 |
}
|
| 220 |
}
|
212 |
}
|
| Line 232... |
Line 224... |
| 232 |
// Evict partner-to-offer mapping and offer listing
|
224 |
// Evict partner-to-offer mapping and offer listing
|
| 233 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(yearMonth);
|
225 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(yearMonth);
|
| 234 |
oneDayCacheManager.getCache("allOffers").evict(yearMonth);
|
226 |
oneDayCacheManager.getCache("allOffers").evict(yearMonth);
|
| 235 |
oneDayCacheManager.getCache("publishedOffersWithAchievement").clear();
|
227 |
oneDayCacheManager.getCache("publishedOffersWithAchievement").clear();
|
| 236 |
redisShortCacheManager.getCache("todayOffers").clear();
|
228 |
redisShortCacheManager.getCache("todayOffers").clear();
|
| 237 |
// Evict offer detail (price circular) for each involved partner; key=(fofoId, offerId), 0=admin
|
- |
|
| 238 |
for (Offer offer : published) {
|
- |
|
| 239 |
PartnerCriteria pc = gson.fromJson(offer.getPartnerCriteria(), PartnerCriteria.class);
|
- |
|
| 240 |
if (pc != null && pc.getFofoIds() != null) {
|
- |
|
| 241 |
for (Integer fofoId : pc.getFofoIds()) {
|
229 |
// Evict all partner offer caches (price circular)
|
| 242 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(fofoId, offer.getId()));
|
- |
|
| 243 |
}
|
- |
|
| 244 |
}
|
- |
|
| 245 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(0, offer.getId()));
|
230 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").clear();
|
| 246 |
}
|
- |
|
| 247 |
for (Offer offer : published) {
|
231 |
for (Offer offer : published) {
|
| 248 |
this.sendNotification(offer);
|
232 |
this.sendNotification(offer);
|
| 249 |
}
|
233 |
}
|
| 250 |
}
|
234 |
}
|
| 251 |
return responseSender.ok(published.size() + " offers published");
|
235 |
return responseSender.ok(published.size() + " offers published");
|
| Line 694... |
Line 678... |
| 694 |
// Evict partner-to-offer mapping (removed partners no longer see this offer)
|
678 |
// Evict partner-to-offer mapping (removed partners no longer see this offer)
|
| 695 |
oneDayCacheManager.getCache("allOffers").evict(ym);
|
679 |
oneDayCacheManager.getCache("allOffers").evict(ym);
|
| 696 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(ym);
|
680 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(ym);
|
| 697 |
oneDayCacheManager.getCache("publishedOffersWithAchievement").clear();
|
681 |
oneDayCacheManager.getCache("publishedOffersWithAchievement").clear();
|
| 698 |
redisShortCacheManager.getCache("todayOffers").clear();
|
682 |
redisShortCacheManager.getCache("todayOffers").clear();
|
| 699 |
// Evict offer detail (price circular) for removed partners; key=(fofoId, offerId), 0=admin
|
- |
|
| 700 |
for (Integer fofoId : fofoIds) {
|
- |
|
| 701 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(fofoId, offerId));
|
- |
|
| 702 |
}
|
- |
|
| 703 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(0, offerId));
|
683 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").clear();
|
| 704 |
|
684 |
|
| 705 |
Map<String, Object> response = new HashMap<>();
|
685 |
Map<String, Object> response = new HashMap<>();
|
| 706 |
response.put("message", message);
|
686 |
response.put("message", message);
|
| 707 |
response.put("newOfferId", newOfferId);
|
687 |
response.put("newOfferId", newOfferId);
|
| 708 |
response.put("yearMonth", ym.toString());
|
688 |
response.put("yearMonth", ym.toString());
|
| Line 723... |
Line 703... |
| 723 |
// Evict partner-to-offer mapping (added partners now see this offer)
|
703 |
// Evict partner-to-offer mapping (added partners now see this offer)
|
| 724 |
oneDayCacheManager.getCache("allOffers").evict(ym);
|
704 |
oneDayCacheManager.getCache("allOffers").evict(ym);
|
| 725 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(ym);
|
705 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(ym);
|
| 726 |
oneDayCacheManager.getCache("publishedOffersWithAchievement").clear();
|
706 |
oneDayCacheManager.getCache("publishedOffersWithAchievement").clear();
|
| 727 |
redisShortCacheManager.getCache("todayOffers").clear();
|
707 |
redisShortCacheManager.getCache("todayOffers").clear();
|
| 728 |
// Evict offer detail (price circular) for added partners; key=(fofoId, offerId), 0=admin
|
- |
|
| 729 |
for (Integer fofoId : fofoIds) {
|
- |
|
| 730 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(fofoId, offerId));
|
- |
|
| 731 |
}
|
- |
|
| 732 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(0, offerId));
|
708 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").clear();
|
| 733 |
|
709 |
|
| 734 |
Map<String, Object> response = new HashMap<>();
|
710 |
Map<String, Object> response = new HashMap<>();
|
| 735 |
response.put("message", "Partner(s) added to Offer #" + offerId + ".");
|
711 |
response.put("message", "Partner(s) added to Offer #" + offerId + ".");
|
| 736 |
response.put("yearMonth", ym.toString());
|
712 |
response.put("yearMonth", ym.toString());
|
| 737 |
return responseSender.ok(response);
|
713 |
return responseSender.ok(response);
|
| Line 766... |
Line 742... |
| 766 |
YearMonth ym = YearMonth.from(offer.getStartDate());
|
742 |
YearMonth ym = YearMonth.from(offer.getStartDate());
|
| 767 |
oneDayCacheManager.getCache("allOffers").evict(ym);
|
743 |
oneDayCacheManager.getCache("allOffers").evict(ym);
|
| 768 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(ym);
|
744 |
redisCacheManager.getCache("catalog.published_yearmonth").evict(ym);
|
| 769 |
oneDayCacheManager.getCache("publishedOffersWithAchievement").clear();
|
745 |
oneDayCacheManager.getCache("publishedOffersWithAchievement").clear();
|
| 770 |
redisShortCacheManager.getCache("todayOffers").clear();
|
746 |
redisShortCacheManager.getCache("todayOffers").clear();
|
| 771 |
PartnerCriteria partnerCriteria = gson.fromJson(offer.getPartnerCriteria(), PartnerCriteria.class);
|
- |
|
| 772 |
if (partnerCriteria != null && partnerCriteria.getFofoIds() != null) {
|
- |
|
| 773 |
for (Integer fofoId : partnerCriteria.getFofoIds()) {
|
- |
|
| 774 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(fofoId, offerId));
|
- |
|
| 775 |
}
|
- |
|
| 776 |
}
|
- |
|
| 777 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").evict(new SimpleKey(0, offerId));
|
747 |
thirtyMinsTimeOutCacheManager.getCache("partnerOffers").clear();
|
| 778 |
}
|
748 |
}
|
| 779 |
|
749 |
|
| 780 |
}
|
750 |
}
|
| 781 |
|
751 |
|