Subversion Repositories SmartDukaan

Rev

Rev 24312 | Rev 24321 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21615 kshitij.so 1
package com.spice.profitmandi.web.controller;
2
 
23568 govind 3
import java.io.IOException;
4
import java.net.URISyntaxException;
24288 amit.gupta 5
import java.time.DayOfWeek;
6
import java.time.LocalDate;
24276 amit.gupta 7
import java.time.LocalDateTime;
24288 amit.gupta 8
import java.time.temporal.TemporalAdjusters;
9
import java.time.temporal.WeekFields;
24312 amit.gupta 10
import java.util.ArrayList;
23884 amit.gupta 11
import java.util.List;
23568 govind 12
 
22086 amit.gupta 13
import javax.servlet.http.HttpServletRequest;
14
 
23786 amit.gupta 15
import org.apache.logging.log4j.LogManager;
23568 govind 16
import org.apache.logging.log4j.Logger;
22481 ashik.ali 17
import org.springframework.beans.factory.annotation.Autowired;
23379 ashik.ali 18
import org.springframework.beans.factory.annotation.Value;
21615 kshitij.so 19
import org.springframework.stereotype.Controller;
22481 ashik.ali 20
import org.springframework.transaction.annotation.Transactional;
22073 ashik.ali 21
import org.springframework.ui.Model;
21615 kshitij.so 22
import org.springframework.web.bind.annotation.RequestMapping;
23
import org.springframework.web.bind.annotation.RequestMethod;
24098 tejbeer 24
import org.springframework.web.bind.annotation.RequestParam;
21615 kshitij.so 25
 
22481 ashik.ali 26
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
24203 amit.gupta 27
import com.spice.profitmandi.common.model.ProfitMandiConstants;
24098 tejbeer 28
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
22654 ashik.ali 29
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
24288 amit.gupta 30
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
23884 amit.gupta 31
import com.spice.profitmandi.dao.entity.transaction.Order;
22481 ashik.ali 32
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
24098 tejbeer 33
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
24203 amit.gupta 34
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
24288 amit.gupta 35
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
24271 amit.gupta 36
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
23884 amit.gupta 37
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
23844 amit.gupta 38
import com.spice.profitmandi.service.authentication.RoleManager;
23884 amit.gupta 39
import com.spice.profitmandi.service.inventory.InventoryService;
24271 amit.gupta 40
import com.spice.profitmandi.service.slab.TargetSlabService;
23884 amit.gupta 41
import com.spice.profitmandi.service.transaction.TransactionService;
42
import com.spice.profitmandi.service.wallet.WalletService;
22481 ashik.ali 43
import com.spice.profitmandi.web.model.LoginDetails;
44
import com.spice.profitmandi.web.util.CookiesProcessor;
24263 tejbeer 45
import com.spice.profitmandi.web.util.MVCResponseSender;
22481 ashik.ali 46
 
24312 amit.gupta 47
import be.ceau.chart.BarChart;
24315 amit.gupta 48
import be.ceau.chart.color.Color;
24312 amit.gupta 49
import be.ceau.chart.data.BarData;
50
import be.ceau.chart.dataset.BarDataset;
51
import be.ceau.chart.options.BarOptions;
52
import be.ceau.chart.options.Title;
53
import be.ceau.chart.options.scales.BarScale;
54
import be.ceau.chart.options.scales.XAxis;
55
import be.ceau.chart.options.scales.YAxis;
56
import be.ceau.chart.options.ticks.LinearTicks;
57
 
21615 kshitij.so 58
@Controller
22481 ashik.ali 59
@Transactional(rollbackFor = Throwable.class)
21615 kshitij.so 60
public class DashboardController {
23923 amit.gupta 61
 
23379 ashik.ali 62
	@Value("${web.api.host}")
63
	private String webApiHost;
23923 amit.gupta 64
 
24072 amit.gupta 65
	@Value("${web.api.scheme}")
66
	private String webApiScheme;
24288 amit.gupta 67
 
24078 amit.gupta 68
	@Value("${web.api.root}")
69
	private String webApiRoot;
70
 
23379 ashik.ali 71
	@Value("${web.api.port}")
72
	private int webApiPort;
21615 kshitij.so 73
 
22481 ashik.ali 74
	@Autowired
22927 ashik.ali 75
	private CookiesProcessor cookiesProcessor;
23923 amit.gupta 76
 
23568 govind 77
	@Autowired
23786 amit.gupta 78
	private RoleManager roleManager;
23923 amit.gupta 79
 
23838 ashik.ali 80
	@Autowired
81
	private FofoStoreRepository fofoStoreRepository;
23884 amit.gupta 82
 
83
	@Autowired
84
	private WalletService walletService;
23923 amit.gupta 85
 
23884 amit.gupta 86
	@Autowired
87
	private InventoryService inventoryService;
24288 amit.gupta 88
 
24271 amit.gupta 89
	@Autowired
90
	private TargetSlabService targetSlabService;
23923 amit.gupta 91
 
23884 amit.gupta 92
	@Autowired
93
	private OrderRepository orderRepository;
24288 amit.gupta 94
 
23951 amit.gupta 95
	@Autowired
24271 amit.gupta 96
	private PurchaseReturnItemRepository purchaseReturnItemRepository;
24288 amit.gupta 97
 
98
	@Autowired
99
	private PartnerDailyInvestmentRepository partnerDailyInvestmentRepository;
100
 
23923 amit.gupta 101
	/*
102
	 * @Autowired private ScanRepository scanRepository;
103
	 */
104
 
23884 amit.gupta 105
	@Autowired
106
	private TransactionService transactionService;
24263 tejbeer 107
 
24098 tejbeer 108
	@Autowired
24263 tejbeer 109
	private MVCResponseSender mvcResponseSender;
110
 
111
	@Autowired
24098 tejbeer 112
	private NotificationPanelRepository notificationPanelRepository;
23923 amit.gupta 113
 
24203 amit.gupta 114
	@Autowired
115
	private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
116
 
23568 govind 117
	private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
23923 amit.gupta 118
 
21615 kshitij.so 119
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
24312 amit.gupta 120
	public String dashboard(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
24098 tejbeer 121
			@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
23923 amit.gupta 122
			throws ProfitMandiBusinessException, URISyntaxException, IOException {
123
		// LOGGER.info("scanRepository.selectScansByInventoryItemId(1)",
124
		// scanRepository.selectScansByInventoryItemId(1));
23884 amit.gupta 125
		LOGGER.info("In Dashboard");
22927 ashik.ali 126
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
23923 amit.gupta 127
 
22481 ashik.ali 128
		FofoStore fofoStore = null;
129
		try {
22927 ashik.ali 130
			fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
22481 ashik.ali 131
		} catch (ProfitMandiBusinessException e) {
22927 ashik.ali 132
			LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
22481 ashik.ali 133
		}
23884 amit.gupta 134
 
23923 amit.gupta 135
		float walletAmount = 0;
136
		float inStockAmount = 0;
137
		float unbilledStockAmount = 0;
138
		float grnPendingStockAmount = 0;
139
		float shortPercentage = 100;
140
		float totalInvestedAmount = 0;
23936 tejbeer 141
		float minimumInvestment = 0;
24312 amit.gupta 142
		float returnedStockInTransit = 0;
143
		float sale = 0;
23923 amit.gupta 144
		if (roleManager.isAdmin(loginDetails.getRoleIds())) {
145
			model.addAttribute("showAlert", false);
24263 tejbeer 146
			model.addAttribute("sale", sale);
147
			List<NotificationData> notificationData = null;
148
			long size = 0;
149
 
150
			notificationData = notificationPanelRepository.selectAllNotificationData(offset, limit);
151
			size = notificationPanelRepository.selectAllCount();
152
			LOGGER.info("notification_data {}", notificationData);
153
 
154
			LOGGER.info("notification_data {}", size);
155
 
156
			if (!notificationData.isEmpty()) {
157
 
158
				model.addAttribute("notificationData", notificationData);
159
				LOGGER.info("notificationdata", notificationData);
160
				model.addAttribute("start", offset + 1);
161
				model.addAttribute("size", size);
162
				model.addAttribute("url", "/getPaginatedNotificationData");
163
 
164
				LOGGER.info("start {}", offset + 1);
165
				LOGGER.info("SIZE {}", size);
166
 
167
				if (notificationData.size() < limit) {
168
					model.addAttribute("end", offset + notificationData.size());
169
					LOGGER.info("SIZE2 {}", offset + notificationData.size());
170
				} else {
171
					model.addAttribute("end", offset + limit);
172
 
173
					LOGGER.info("end {}", size);
174
 
175
				}
176
 
177
			} else {
178
 
179
				model.addAttribute("notificationData", notificationData);
180
				model.addAttribute("size", size);
181
				LOGGER.info("sizeOriginal {}", size);
182
 
183
			}
23923 amit.gupta 184
		} else if (roleManager.isPartner(loginDetails.getRoleIds())) {
185
			walletAmount = walletService.getUserWallet(loginDetails.getFofoId()).getAmount();
186
			inStockAmount = inventoryService.getTotalAmountInStock(loginDetails.getFofoId());
24312 amit.gupta 187
 
23884 amit.gupta 188
			List<Order> unbilledOrders = transactionService.getInTransitOrders(loginDetails.getFofoId());
23923 amit.gupta 189
			for (Order unBilledOrder : unbilledOrders) {
23884 amit.gupta 190
				unbilledStockAmount += unBilledOrder.getTotalAmount();
191
			}
192
 
23904 amit.gupta 193
			List<Order> grnPendingOrders = orderRepository.selectPendingGrnOrders(loginDetails.getFofoId());
23923 amit.gupta 194
			for (Order grnPendingOrder : grnPendingOrders) {
23884 amit.gupta 195
				grnPendingStockAmount += grnPendingOrder.getTotalAmount();
196
			}
24271 amit.gupta 197
			totalInvestedAmount = walletAmount + inStockAmount + unbilledStockAmount + grnPendingStockAmount + sale;
23923 amit.gupta 198
			shortPercentage = ((fofoStore.getMinimumInvestment() - totalInvestedAmount)
199
					/ fofoStore.getMinimumInvestment()) * 100;
23944 amit.gupta 200
			model.addAttribute("showAlert", shortPercentage > 10);
23936 tejbeer 201
			minimumInvestment = fofoStore.getMinimumInvestment();
24263 tejbeer 202
 
203
			// debitNoteRepository.se
204
			List<NotificationData> notificationData = null;
205
			long size = 0;
206
 
207
			notificationData = notificationPanelRepository.selectAllNotificationDataByActiveFlag(offset, limit, true);
208
			size = notificationPanelRepository.selectCountByActiveFlag(true);
209
			LOGGER.info("notification_data {}", notificationData);
210
 
211
			LOGGER.info("notification_data {}", size);
212
 
213
			if (!notificationData.isEmpty()) {
214
 
215
				model.addAttribute("notificationData", notificationData);
216
				LOGGER.info("notificationdata", notificationData);
217
				model.addAttribute("start", offset + 1);
218
				model.addAttribute("size", size);
219
				model.addAttribute("url", "/getPaginatedNotificationData");
220
 
221
				LOGGER.info("start {}", offset + 1);
222
				LOGGER.info("SIZE {}", size);
223
 
224
				if (notificationData.size() < limit) {
225
					model.addAttribute("end", offset + notificationData.size());
226
					LOGGER.info("SIZE2 {}", offset + notificationData.size());
227
				} else {
228
					model.addAttribute("end", offset + limit);
229
 
230
					LOGGER.info("end {}", size);
231
 
232
				}
233
 
234
			} else {
235
 
236
				model.addAttribute("notificationData", notificationData);
237
				model.addAttribute("size", size);
238
				LOGGER.info("sizeOriginal {}", size);
239
 
240
			}
23884 amit.gupta 241
		}
24288 amit.gupta 242
		LocalDate endDate = LocalDate.now().minusDays(1);
243
		LocalDate weekStartDate = endDate.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
24312 amit.gupta 244
		LocalDate startDate = weekStartDate.minusWeeks(5);
245
		List<PartnerDailyInvestment> partnerInvestments = partnerDailyInvestmentRepository
246
				.selectAll(loginDetails.getFofoId(), startDate, endDate);
247
 
248
		model.addAttribute("investmentChart", this.getInvestmentChartData(partnerInvestments));
24271 amit.gupta 249
		model.addAttribute("sale", sale);
23923 amit.gupta 250
		model.addAttribute("walletAmount", walletAmount);
251
		model.addAttribute("inStockAmount", inStockAmount);
252
		model.addAttribute("unbilledStockAmount", unbilledStockAmount);
253
		model.addAttribute("grnPendingStockAmount", grnPendingStockAmount);
254
		model.addAttribute("shortPercentage", shortPercentage);
255
		model.addAttribute("totalInvestedAmount", totalInvestedAmount);
23936 tejbeer 256
		model.addAttribute("minimumInvestmentAmount", minimumInvestment);
23951 amit.gupta 257
		model.addAttribute("returnedStockInTransit", returnedStockInTransit);
23923 amit.gupta 258
 
23848 ashik.ali 259
		model.addAttribute("fofoStore", fofoStore);
23918 amit.gupta 260
		model.addAttribute("walletAmount");
22086 amit.gupta 261
		model.addAttribute("appContextPath", request.getContextPath());
23796 amit.gupta 262
		model.addAttribute("isAdmin", roleManager.isAdmin(loginDetails.getRoleIds()));
23379 ashik.ali 263
		model.addAttribute("webApiHost", webApiHost);
264
		model.addAttribute("webApiPort", webApiPort);
24072 amit.gupta 265
		model.addAttribute("webApiScheme", webApiScheme);
24077 amit.gupta 266
		model.addAttribute("webApiRoot", webApiRoot);
24203 amit.gupta 267
		model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
268
		model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
24248 govind 269
		model.addAttribute("sale", sale);
24098 tejbeer 270
 
23923 amit.gupta 271
		// LOGGER.info("loginDetails.getFofoId()"+loginDetails.getFofoId());
272
		// inventoryService.prebookingAvailabilitySendMessage(loginDetails.getFofoId());
21615 kshitij.so 273
		return "dashboard";
274
	}
23923 amit.gupta 275
 
24312 amit.gupta 276
	private String getInvestmentChartData(List<PartnerDailyInvestment> partnerInvestments) {
277
 
278
		List<List<Integer>> walletStackList = new ArrayList<>();
279
		List<List<Integer>> inStockStackList = new ArrayList<>();
280
		List<List<Integer>> salesStackList = new ArrayList<>();
281
		List<List<Integer>> grnPendingStackList = new ArrayList<>();
282
		List<List<Integer>> billingPendingStackList = new ArrayList<>();
283
		List<List<Integer>> inTransitStackList = new ArrayList<>();
284
		List<List<LocalDate>> datesList = new ArrayList<>();
285
 
286
		int currentWeekOfYear = 0;
24315 amit.gupta 287
		List<Integer> walletStack = null;
288
		List<Integer> inStockStack = null;
289
		List<Integer> salesStack = null;
290
		List<Integer> grnPendingStack = null;
291
		List<Integer> billingPendingStack = null;
292
		List<Integer> inTransitStack = null;
293
		List<LocalDate> dates = null;
24312 amit.gupta 294
		for (PartnerDailyInvestment pdi : partnerInvestments) {
295
			int weekOfYear = pdi.getDate().get(WeekFields.ISO.weekOfYear());
296
			if (weekOfYear != currentWeekOfYear) {
297
				walletStack = new ArrayList<>();
298
				inStockStack = new ArrayList<>();
299
				salesStack = new ArrayList<>();
300
				grnPendingStack = new ArrayList<>();
301
				billingPendingStack = new ArrayList<>();
302
				inTransitStack = new ArrayList<>();
303
				dates = new ArrayList<>();
304
				currentWeekOfYear = weekOfYear;
305
				walletStackList.add(walletStack);
306
				inStockStackList.add(inStockStack);
307
				salesStackList.add(salesStack);
308
				grnPendingStackList.add(grnPendingStack);
309
				billingPendingStackList.add(billingPendingStack);
310
				inTransitStackList.add(inTransitStack);
311
			}
312
			walletStack.add((int)pdi.getWalletAmount());
313
			inStockStack.add((int)pdi.getInStockAmount());
314
			salesStack.add((int)pdi.getSalesAmount());
315
			grnPendingStack.add((int)pdi.getGrnPendingAmount());
316
			billingPendingStack.add((int)pdi.getUnbilledAmount());
317
			inTransitStack.add((int)pdi.getReturnInTransitAmount());
318
			datesList.add(dates);
319
 
320
		}
321
 
322
		int counter = 0;
323
		BarData barData = new BarData();
324
		while(counter < walletStackList.size()) {
325
			barData
24315 amit.gupta 326
			.addDataset(new BarDataset().setData(walletStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Wallet").addBackgroundColor(Color.BLUE))
327
			.addDataset(new BarDataset().setData(inStockStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("In Stock").addBackgroundColor(Color.LIGHT_BLUE))
328
			.addDataset(new BarDataset().setData(salesStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Sales").addBackgroundColor(Color.YELLOW))
329
			.addDataset(new BarDataset().setData(grnPendingStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Grn Pending").addBackgroundColor(Color.LIGHT_YELLOW))
330
			.addDataset(new BarDataset().setData(billingPendingStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("Billing Pending").addBackgroundColor(Color.GREEN))
331
			.addDataset(new BarDataset().setData(inTransitStackList.get(counter).stream().mapToInt(i -> i).toArray()).setLabel("In Transit").addBackgroundColor(Color.GREEN_YELLOW));
24312 amit.gupta 332
			counter++;
333
		}
334
		BarOptions barOptions = new BarOptions()
24315 amit.gupta 335
				.setTitle(new Title().setDisplay(true).setText("Daily Investment Summary"))
336
				.setResponsive(true)
337
 
24312 amit.gupta 338
				.setScales(new BarScale().addxAxes(new XAxis<LinearTicks>().setStacked(true))
339
										 .addyAxes(new YAxis<LinearTicks>().setStacked(true))
340
										 );
341
 
342
		BarChart barChart = new BarChart(barData, barOptions);
343
		return barChart.toJson();
344
	}
345
 
24288 amit.gupta 346
	// This method is currently hardcoded to faciliate watches sold as gift.
24203 amit.gupta 347
	private boolean hasGift(int fofoId) {
348
		try {
24288 amit.gupta 349
			return currentInventorySnapshotRepository.selectByItemIdAndFofoId(ProfitMandiConstants.GIFT_ID, fofoId)
350
					.getAvailability() > 0;
24203 amit.gupta 351
		} catch (ProfitMandiBusinessException e) {
352
			return false;
353
		}
354
	}
24288 amit.gupta 355
 
24098 tejbeer 356
	@RequestMapping(value = "/getPaginatedNotificationData", method = RequestMethod.GET)
357
	public String getPaginatedNotificationData(HttpServletRequest request,
358
			@RequestParam(name = "offset", defaultValue = "0") int offset,
359
			@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws Exception {
24263 tejbeer 360
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
24098 tejbeer 361
 
24263 tejbeer 362
		FofoStore fofoStore = null;
363
		try {
364
			fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
365
		} catch (ProfitMandiBusinessException e) {
366
			LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
367
		}
368
		if (roleManager.isAdmin(loginDetails.getRoleIds())) {
369
			List<NotificationData> notificationData = null;
24098 tejbeer 370
 
24263 tejbeer 371
			notificationData = notificationPanelRepository.selectAllNotificationData(offset, limit);
24098 tejbeer 372
 
24263 tejbeer 373
			LOGGER.info("notification_data {}", notificationData);
24098 tejbeer 374
 
24263 tejbeer 375
			if (!notificationData.isEmpty()) {
24098 tejbeer 376
 
24263 tejbeer 377
				model.addAttribute("notificationData", notificationData);
378
				model.addAttribute("url", "/getPaginatedNotificationData");
379
 
380
			} else {
381
				model.addAttribute("notificationData", notificationData);
382
 
383
			}
384
		} else if (roleManager.isPartner(loginDetails.getRoleIds())) {
385
 
386
			List<NotificationData> notificationData = null;
387
 
388
			notificationData = notificationPanelRepository.selectAllNotificationDataByActiveFlag(offset, limit, true);
389
			LOGGER.info("notification_data {}", notificationData);
390
 
391
			if (!notificationData.isEmpty()) {
392
 
393
				model.addAttribute("notificationData", notificationData);
394
				model.addAttribute("url", "/getPaginatedNotificationData");
395
 
396
			} else {
397
				model.addAttribute("notificationData", notificationData);
398
 
399
			}
24098 tejbeer 400
		}
401
 
402
		return "dashboard-paginated";
403
	}
24288 amit.gupta 404
 
22354 ashik.ali 405
	@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
23923 amit.gupta 406
	public String contactUs(HttpServletRequest request, Model model) throws Throwable {
22354 ashik.ali 407
		model.addAttribute("appContextPath", request.getContextPath());
408
		return "contact-us";
409
	}
23923 amit.gupta 410
 
411
	/*
412
	 * private List<PaymentOption> getPaymentOptions(int fofoId){ List<Integer>
413
	 * paymentOptionIds =
24288 amit.gupta 414
	 * fofoPartnerPaymentOptionRepository.selectPaymentOptionIdsByFofoId(fofoId) ;
415
	 * if(paymentOptionIds.isEmpty()){ return new ArrayList<>(); } return
23923 amit.gupta 416
	 * paymentOptionRepository.selectByIds(new HashSet<>(paymentOptionIds)); }
417
	 */
418
 
24263 tejbeer 419
	@RequestMapping(value = "/inactiveNotificationData", method = RequestMethod.POST)
420
	public String inactiveNotificationData(HttpServletRequest request,
421
			@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
422
 
423
		NotificationData notificationData = notificationPanelRepository.selectById(id);
424
		if (notificationData != null) {
425
 
426
			notificationData.setActive(false);
427
			LOGGER.info("notification" + notificationData);
428
			notificationPanelRepository.persist(notificationData);
429
 
430
			model.addAttribute("response", mvcResponseSender.createResponseString(true));
431
		} else {
432
			model.addAttribute("response", mvcResponseSender.createResponseString(false));
433
 
434
		}
435
		return "response";
436
	}
437
 
438
	@RequestMapping(value = "/activeNotificationData", method = RequestMethod.POST)
439
	public String activeNotificationData(HttpServletRequest request,
440
			@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
441
 
442
		NotificationData notificationData = notificationPanelRepository.selectById(id);
443
		if (notificationData != null) {
444
 
445
			notificationData.setActive(true);
446
			notificationData.setCreated_timestamp(LocalDateTime.now());
447
			LOGGER.info("notification" + notificationData);
448
			notificationPanelRepository.persist(notificationData);
449
 
450
			model.addAttribute("response", mvcResponseSender.createResponseString(true));
451
		} else {
452
			model.addAttribute("response", mvcResponseSender.createResponseString(false));
453
 
454
		}
455
		return "response";
456
	}
457
 
21615 kshitij.so 458
}