Subversion Repositories SmartDukaan

Rev

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

Rev 26030 Rev 26131
Line 327... Line 327...
327
	@PostMapping(value = "/deactivateStore")
327
	@PostMapping(value = "/deactivateStore")
328
	public String deActivateStore(HttpServletRequest request,
328
	public String deActivateStore(HttpServletRequest request,
329
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
329
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
330
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
330
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
331
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
331
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
332
		if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com").contains(loginDetails.getEmailId())) {
332
		if (!Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com")
-
 
333
				.contains(loginDetails.getEmailId())) {
333
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access", "You are not authorise to deactivate retailer");
334
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
-
 
335
					"You are not authorise to deactivate retailer");
334
		}
336
		}
335
		fofoStore.setActive(false);
337
		fofoStore.setActive(false);
336
		fofoStoreRepository.persist(fofoStore);
338
		fofoStoreRepository.persist(fofoStore);
337
		LOGGER.info("inserted into InActiveFofoStore successfully");
339
		LOGGER.info("inserted into InActiveFofoStore successfully");
338
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
340
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
Line 355... Line 357...
355
	@PostMapping(value = "/extendBilling")
357
	@PostMapping(value = "/extendBilling")
356
	public String extendBilling(HttpServletRequest request,
358
	public String extendBilling(HttpServletRequest request,
357
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
359
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
358
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
360
		FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
359
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
361
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
360
		if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "prakash.rai@smartdukaan.com").contains(loginDetails.getEmailId())) {
362
		if (Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "prakash.rai@smartdukaan.com")
-
 
363
				.contains(loginDetails.getEmailId())) {
361
			fofoStore.setGraceDate(LocalDate.now().plusDays(2));
364
			fofoStore.setGraceDate(LocalDate.now().plusDays(2));
362
			fofoStore.setGraceCount(fofoStore.getGraceCount() + 1);
365
			fofoStore.setGraceCount(fofoStore.getGraceCount() + 1);
363
			fofoStoreRepository.persist(fofoStore);
366
			fofoStoreRepository.persist(fofoStore);
364
			model.addAttribute("response", mvcResponseSender.createResponseString(fofoStore.getGraceCount()));
367
			model.addAttribute("response", mvcResponseSender.createResponseString(fofoStore.getGraceCount()));
365
		} else {
368
		} else {
366
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access", "You are not authorise to extend billing");
369
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
-
 
370
					"You are not authorise to extend billing");
367
		}
371
		}
368
		return "response";
372
		return "response";
369
 
373
 
370
	}
374
	}
371
 
375
 
Line 462... Line 466...
462
	@RequestMapping(value = "/createPromoter", method = RequestMethod.POST)
466
	@RequestMapping(value = "/createPromoter", method = RequestMethod.POST)
463
	public String createPromoter(HttpServletRequest request, @RequestBody PromoterDetailModel promoterdetailModel,
467
	public String createPromoter(HttpServletRequest request, @RequestBody PromoterDetailModel promoterdetailModel,
464
			Model model) throws Exception {
468
			Model model) throws Exception {
465
		LOGGER.info("requested url : " + request.getRequestURL().toString());
469
		LOGGER.info("requested url : " + request.getRequestURL().toString());
466
		LOGGER.info("requested url : " + promoterdetailModel);
470
		LOGGER.info("requested url : " + promoterdetailModel);
-
 
471
		Promoter promoter = promoterRepository.selectById(promoterdetailModel.getId());
467
		if (promoterdetailModel.getId() == 0) {
472
		if (promoter == null) {
468
			Promoter promoter = new Promoter();
473
			promoter = new Promoter();
469
			promoter.setName(promoterdetailModel.getName());
474
			promoter.setName(promoterdetailModel.getName());
470
			promoter.setBrand(promoterdetailModel.getBrand());
475
			promoter.setBrand(promoterdetailModel.getBrand());
471
			promoter.setEmail(promoterdetailModel.getEmail());
476
			promoter.setEmail(promoterdetailModel.getEmail());
472
			promoter.setMobile(promoterdetailModel.getMobile());
477
			promoter.setMobile(promoterdetailModel.getMobile());
473
			promoter.setRetailerId(promoterdetailModel.getRetailerId());
478
			promoter.setRetailerId(promoterdetailModel.getRetailerId());
474
			promoter.setCreatedTimestamp(LocalDateTime.now());
479
			promoter.setCreatedTimestamp(LocalDateTime.now());
-
 
480
			promoter.setStatus(promoterdetailModel.isStatus());
475
			promoter.setSdPortalAccess(promoterdetailModel.isSdPortalAccess());
481
			promoter.setSdPortalAccess(promoterdetailModel.isSdPortalAccess());
476
			promoterRepository.persist(promoter);
482
			promoterRepository.persist(promoter);
477
		} else {
483
		} else {
-
 
484
 
478
			Promoter updatePromoter = promoterRepository.selectById(promoterdetailModel.getId());
485
			promoter.setRetailerId(promoterdetailModel.getRetailerId());
479
			updatePromoter.setRetailerId(promoterdetailModel.getRetailerId());
486
			promoter.setSdPortalAccess(promoterdetailModel.isSdPortalAccess());
480
			updatePromoter.setSdPortalAccess(promoterdetailModel.isSdPortalAccess());
487
			promoter.setStatus(promoter.isStatus());
481
			LOGGER.info("sdport" + promoterdetailModel.isSdPortalAccess());
488
			LOGGER.info("sdport" + promoterdetailModel.isSdPortalAccess());
482
			LOGGER.info("sdport" + updatePromoter);
-
 
483
			promoterRepository.persist(updatePromoter);
489
			promoterRepository.persist(promoter);
484
 
490
 
485
		}
491
		}
486
 
492
 
487
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
493
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
488
 
494
 
Line 494... Line 500...
494
	public String removePromoterfromPartnerStore(HttpServletRequest request,
500
	public String removePromoterfromPartnerStore(HttpServletRequest request,
495
			@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
501
			@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
496
 
502
 
497
		Promoter promoter = promoterRepository.selectById(id);
503
		Promoter promoter = promoterRepository.selectById(id);
498
 
504
 
499
		promoter.setRetailerId(0);
505
		promoter.setStatus(false);
500
		promoterRepository.persist(promoter);
506
		promoterRepository.persist(promoter);
501
 
507
 
502
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
508
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
503
 
509
 
504
		return "response";
510
		return "response";