Subversion Repositories SmartDukaan

Rev

Rev 29943 | Rev 29949 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29943 Rev 29948
Line 159... Line 159...
159
		return "scheme_offer/published";
159
		return "scheme_offer/published";
160
 
160
 
161
	}
161
	}
162
 
162
 
163
	@RequestMapping(value = "/offer/active/{offerId}", method = RequestMethod.GET)
163
	@RequestMapping(value = "/offer/active/{offerId}", method = RequestMethod.GET)
164
	public String activateOffer(HttpServletRequest request, @PathVariable String offerIdsString, Model model,
164
	public String activateOffer(HttpServletRequest request, @PathVariable(name = "offerId") String offerIdsString, Model model,
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) {
Line 215... Line 215...
215
	@Autowired
215
	@Autowired
216
	UserAccountRepository userAccountRepository;
216
	UserAccountRepository userAccountRepository;
217
 
217
 
218
	private void sendNotification(Offer offer) throws Exception {
218
	private void sendNotification(Offer offer) throws Exception {
219
		String fileName = "offer-" + offer.getId() + ".png";
219
		String fileName = "offer-" + offer.getId() + ".png";
-
 
220
		String htmlFileName = fileName.replace("png", "html");
220
		CreateOfferRequest createOfferRequest = offerService.getCreateOfferRequest(offer);
221
		CreateOfferRequest createOfferRequest = offerService.getCreateOfferRequest(offer);
221
		SendNotificationModel sendNotificationModel = new SendNotificationModel();
222
		SendNotificationModel sendNotificationModel = new SendNotificationModel();
222
		sendNotificationModel.setCampaignName("SchemeOffer");
223
		sendNotificationModel.setCampaignName("SchemeOffer");
223
		sendNotificationModel.setTitle(offer.getName());
224
		sendNotificationModel.setTitle(offer.getName());
224
		sendNotificationModel.setMessage(createOfferRequest.getSchemeType().name() + " of select models, "
225
		sendNotificationModel.setMessage(createOfferRequest.getSchemeType().name() + " of select models, "
Line 238... Line 239...
238
		Map<String, Object> model = new HashMap<>();
239
		Map<String, Object> model = new HashMap<>();
239
		model.put("offer", createOfferRequest);
240
		model.put("offer", createOfferRequest);
240
		String htmlContent = this.getContentFromTemplate("offer_margin_detail_partner.vm", model);
241
		String htmlContent = this.getContentFromTemplate("offer_margin_detail_partner.vm", model);
241
		LOGGER.info("this.getContentFromTemplate {}", htmlContent);
242
		LOGGER.info("this.getContentFromTemplate {}", htmlContent);
242
		fileStreamsMap.put(fileName, this.getImageBuffer(htmlContent));
243
		fileStreamsMap.put(fileName, this.getImageBuffer(htmlContent));
-
 
244
		//fileStreamsMap.put(htmlFileName, new ByteArrayInputStream(htmlContent.getBytes()));
243
 
245
 
244
		this.uploadFile(fileStreamsMap);
246
		this.uploadFile(fileStreamsMap);
245
		notificationService.sendNotification(sendNotificationModel);
247
		notificationService.sendNotification(sendNotificationModel);
246
 
248
 
247
	}
249
	}