Subversion Repositories SmartDukaan

Rev

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

Rev 31238 Rev 31321
Line 432... Line 432...
432
		return "response";
432
		return "response";
433
	}
433
	}
434
 
434
 
435
	@GetMapping(value = "/partners")
435
	@GetMapping(value = "/partners")
436
	public String getStoreName(HttpServletRequest request, Model model, @RequestParam String query) throws Exception {
436
	public String getStoreName(HttpServletRequest request, Model model, @RequestParam String query) throws Exception {
437
		model.addAttribute("response1", mvcResponseSender
437
		model.addAttribute("response1",
438
				.createResponseString(retailerService.getFofoRetailers(false).values().stream()
438
				mvcResponseSender.createResponseString(retailerService.getFofoRetailers(false).values().stream()
439
						.filter(x -> x.getDisplayName().toLowerCase().matches(".*?" + query.toLowerCase() + ".*?"))
439
						.filter(x -> x.getDisplayName().toLowerCase().matches(".*?" + query.toLowerCase() + ".*?"))
440
						.collect(Collectors.toList())));
440
						.collect(Collectors.toList())));
441
		return "response";
441
		return "response";
442
	}
442
	}
443
 
443
 
Line 446... Line 446...
446
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
446
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
447
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
447
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
448
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
448
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
449
		if (!Arrays
449
		if (!Arrays
450
				.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
450
				.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
451
						"rahul.katyal@smartdukaan.com", "tejbeer.kaur@smartdukaan.com")
451
						"rahul.katyal@smartdukaan.com", "tejbeer.kaur@smartdukaan.com", "sm@smartdukaan.com")
452
				.contains(loginDetails.getEmailId())) {
452
				.contains(loginDetails.getEmailId())) {
453
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
453
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
454
					"You are not authorise to deactivate retailer");
454
					"You are not authorise to deactivate retailer");
455
		}
455
		}
456
		fofoStore.setActive(false);
456
		fofoStore.setActive(false);
Line 464... Line 464...
464
	public String activateStoreForever(HttpServletRequest request,
464
	public String activateStoreForever(HttpServletRequest request,
465
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
465
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
466
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
466
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
467
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
467
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
468
		if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
468
		if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
469
				"rahul.katyal@smartdukaan.com").contains(loginDetails.getEmailId())) {
469
				"rahul.katyal@smartdukaan.com", "sm@smartdukaan.com").contains(loginDetails.getEmailId())) {
470
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
470
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
471
					"You are not authorise to activate retailer");
471
					"You are not authorise to activate retailer");
472
		}
472
		}
473
		fofoStore.setActive(true);
473
		fofoStore.setActive(true);
474
		fofoStoreRepository.persist(fofoStore);
474
		fofoStoreRepository.persist(fofoStore);
Line 483... Line 483...
483
			@RequestParam(name = "days", required = true) int days, Model model) throws Exception {
483
			@RequestParam(name = "days", required = true) int days, Model model) throws Exception {
484
 
484
 
485
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
485
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
486
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
486
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
487
		if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
487
		if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
488
				"rahul.katyal@smartdukaan.com").contains(loginDetails.getEmailId())) {
488
				"rahul.katyal@smartdukaan.com", "sm@smartdukaan.com").contains(loginDetails.getEmailId())) {
489
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
489
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
490
					"You are not authorise to deactivate retailer");
490
					"You are not authorise to deactivate retailer");
491
		}
491
		}
492
 
492
 
493
		LocalDateTime currentDate = LocalDate.now().atStartOfDay();
493
		LocalDateTime currentDate = LocalDate.now().atStartOfDay();
Line 534... Line 534...
534
	public String extendBilling(HttpServletRequest request,
534
	public String extendBilling(HttpServletRequest request,
535
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
535
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
536
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
536
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
537
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
537
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
538
		if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
538
		if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
539
				"rahul.katyal@smartdukaan.com").contains(loginDetails.getEmailId())) {
539
				"rahul.katyal@smartdukaan.com", "sm@smartdukaan.com").contains(loginDetails.getEmailId())) {
540
			fofoStore.setGraceDate(LocalDate.now().plusDays(2));
540
			fofoStore.setGraceDate(LocalDate.now().plusDays(2));
541
			fofoStore.setGraceCount(fofoStore.getGraceCount() + 1);
541
			fofoStore.setGraceCount(fofoStore.getGraceCount() + 1);
542
			fofoStoreRepository.persist(fofoStore);
542
			fofoStoreRepository.persist(fofoStore);
543
			model.addAttribute("response1", mvcResponseSender.createResponseString(fofoStore.getGraceCount()));
543
			model.addAttribute("response1", mvcResponseSender.createResponseString(fofoStore.getGraceCount()));
544
		} else {
544
		} else {