| Line 176... |
Line 176... |
| 176 |
return "scheme_offer/published";
|
176 |
return "scheme_offer/published";
|
| 177 |
|
177 |
|
| 178 |
}
|
178 |
}
|
| 179 |
|
179 |
|
| 180 |
@RequestMapping(value = "/offer/active/{offerId}", method = RequestMethod.GET)
|
180 |
@RequestMapping(value = "/offer/active/{offerId}", method = RequestMethod.GET)
|
| 181 |
public String activateOffer(HttpServletRequest request, @PathVariable int offerId, Model model)
|
181 |
public String activateOffer(HttpServletRequest request, @PathVariable int offerId, Model model, @RequestParam(defaultValue = "true") boolean active)
|
| 182 |
throws ProfitMandiBusinessException, Exception {
|
182 |
throws ProfitMandiBusinessException, Exception {
|
| 183 |
Offer offer = offerRepository.selectById(offerId);
|
183 |
Offer offer = offerRepository.selectById(offerId);
|
| 184 |
boolean alreadyActive = false;
|
184 |
boolean alreadyActive = offer.isActive();
|
| 185 |
offer.setActive(true);
|
185 |
if(alreadyActive != active) {
|
| 186 |
if(alreadyActive) {
|
186 |
offer.setActive(active);
|
| 187 |
oneDayCacheManager.getCache("catalog.published_yearmonth").evict(YearMonth.now());
|
187 |
oneDayCacheManager.getCache("catalog.published_yearmonth").evict(YearMonth.now());
|
| 188 |
}
|
188 |
}
|
| - |
|
189 |
if(active && !alreadyActive) {
|
| 189 |
this.sendNotification(offer);
|
190 |
this.sendNotification(offer);
|
| - |
|
191 |
}
|
| 190 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
192 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 191 |
return "response";
|
193 |
return "response";
|
| 192 |
//CreateOfferRequest createOfferRequest = offerService.getCreateOfferRequest(offer);
|
194 |
//CreateOfferRequest createOfferRequest = offerService.getCreateOfferRequest(offer);
|
| 193 |
//model.addAttribute("offer", createOfferRequest);
|
195 |
//model.addAttribute("offer", createOfferRequest);
|
| 194 |
//return "offer_margin_detail_partner2";
|
196 |
//return "offer_margin_detail_partner2";
|