| Line 165... |
Line 165... |
| 165 |
@RequestParam(defaultValue = "true") boolean active) throws ProfitMandiBusinessException, Exception {
|
165 |
@RequestParam(defaultValue = "true") boolean active) throws ProfitMandiBusinessException, Exception {
|
| 166 |
List<Integer> offerIds = Arrays.stream(offerIdsString.split(",")).map(x -> Integer.parseInt(x)).collect(Collectors.toList());
|
166 |
List<Integer> offerIds = Arrays.stream(offerIdsString.split(",")).map(x -> Integer.parseInt(x)).collect(Collectors.toList());
|
| 167 |
List<Offer> offers = offerRepository.selectAllByIds(offerIds);
|
167 |
List<Offer> offers = offerRepository.selectAllByIds(offerIds);
|
| 168 |
boolean shouldEvict = false;
|
168 |
boolean shouldEvict = false;
|
| 169 |
for (Offer offer : offers) {
|
169 |
for (Offer offer : offers) {
|
| 170 |
boolean alreadyActive = offer.isActive();
|
170 |
offer.setAlreadyActive(offer.isActive());
|
| 171 |
if (alreadyActive != active) {
|
171 |
if (offer.isActive() != active) {
|
| 172 |
offer.setActive(active);
|
172 |
offer.setActive(active);
|
| 173 |
shouldEvict = true;
|
173 |
shouldEvict = true;
|
| 174 |
}
|
174 |
}
|
| 175 |
if (active && !alreadyActive) {
|
- |
|
| 176 |
this.sendNotification(offer);
|
- |
|
| 177 |
}
|
- |
|
| 178 |
}
|
175 |
}
|
| 179 |
if (shouldEvict) {
|
176 |
if (shouldEvict) {
|
| 180 |
oneDayCacheManager.getCache("catalog.published_yearmonth").evict(YearMonth.now());
|
177 |
oneDayCacheManager.getCache("catalog.published_yearmonth").evict(YearMonth.now());
|
| 181 |
}
|
178 |
}
|
| - |
|
179 |
for (Offer offer : offers) {
|
| - |
|
180 |
if (active && !offer.isAlreadyActive()) {
|
| - |
|
181 |
this.sendNotification(offer);
|
| - |
|
182 |
}
|
| - |
|
183 |
}
|
| 182 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
184 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 183 |
return "response";
|
185 |
return "response";
|
| 184 |
// CreateOfferRequest createOfferRequest =
|
186 |
// CreateOfferRequest createOfferRequest =
|
| 185 |
// offerService.getCreateOfferRequest(offer);
|
187 |
// offerService.getCreateOfferRequest(offer);
|
| 186 |
// model.addAttribute("offer", createOfferRequest);
|
188 |
// model.addAttribute("offer", createOfferRequest);
|