Subversion Repositories SmartDukaan

Rev

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

Rev 29927 Rev 30043
Line 464... Line 464...
464
		return "response";
464
		return "response";
465
	}
465
	}
466
 
466
 
467
	@RequestMapping(value = "/schemes/delete", method = RequestMethod.DELETE)
467
	@RequestMapping(value = "/schemes/delete", method = RequestMethod.DELETE)
468
	public String deleteShcemes(HttpServletRequest request,
468
	public String deleteShcemes(HttpServletRequest request,
469
			@RequestParam(name = "schemeId", required = false, defaultValue = "0") int schemeId,
469
								@RequestParam(name = "schemeId", required = false, defaultValue = "0") int schemeId,
470
			@RequestParam(name = "itemId", required = false, defaultValue = "0") int itemId, Model model)
470
								@RequestParam(name = "itemId", required = false, defaultValue = "0") int itemId, Model model)
471
			throws Exception {
471
			throws Exception {
472
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
472
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
473
		if (!(schemeId == 0 && itemId == 0) || (!(schemeId == 0 || itemId == 0))) {
473
		if (!(schemeId == 0 && itemId == 0) || (!(schemeId == 0 || itemId == 0))) {
474
			schemeItemRepository.deletebyItemIdsandSchemeIds(itemId, schemeId);
474
			schemeItemRepository.deletebyItemIdsandSchemeIds(itemId, schemeId);
475
 
475
 
Line 501... Line 501...
501
	}
501
	}
502
 
502
 
503
	@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
503
	@RequestMapping(value = "/extendSchemeById", method = RequestMethod.POST)
504
	public String extendSchemeById(HttpServletRequest request,
504
	public String extendSchemeById(HttpServletRequest request,
505
 
505
 
506
			@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
506
								   @RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
507
			@RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
507
								   @RequestBody LocalDateTime extendDatetime, Model model) throws Exception {
508
		extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), Utils.MAX_TIME);
508
		extendDatetime = LocalDateTime.of(extendDatetime.toLocalDate(), Utils.MAX_TIME);
509
		Scheme scheme = schemeRepository.selectById(schemeId);
509
		Scheme scheme = schemeRepository.selectById(schemeId);
510
		if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
510
		if ((!(scheme.getActiveTimestamp() == null)) && scheme.getExpireTimestamp() == null) {
511
			scheme.setEndDateTime(extendDatetime);
511
			scheme.setEndDateTime(extendDatetime);
512
			schemeRepository.persist(scheme);
512
			schemeRepository.persist(scheme);
Line 517... Line 517...
517
		return "response";
517
		return "response";
518
	}
518
	}
519
 
519
 
520
	@RequestMapping(value = "/createScheme", method = RequestMethod.POST)
520
	@RequestMapping(value = "/createScheme", method = RequestMethod.POST)
521
	public String createScheme(HttpServletRequest request, @RequestBody CreateSchemeRequest createSchemeRequest,
521
	public String createScheme(HttpServletRequest request, @RequestBody CreateSchemeRequest createSchemeRequest,
522
			@RequestParam(name = "offset", defaultValue = "0") int offset,
522
							   @RequestParam(name = "offset", defaultValue = "0") int offset,
523
			@RequestParam(name = "limit", defaultValue = "10") int limit,
523
							   @RequestParam(name = "limit", defaultValue = "10") int limit,
524
			@RequestParam(name = "searchItem", required = false, defaultValue = "") String searchItem,
524
							   @RequestParam(name = "searchItem", required = false, defaultValue = "") String searchItem,
525
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
525
							   @RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
526
			throws ProfitMandiBusinessException {
526
			throws ProfitMandiBusinessException {
527
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
527
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
528
		LOGGER.info("CreateSchemeRequest {}", createSchemeRequest);
528
		LOGGER.info("CreateSchemeRequest {}", createSchemeRequest);
529
		schemeService.saveScheme(loginDetails.getFofoId(), createSchemeRequest);
529
		schemeService.saveScheme(loginDetails.getFofoId(), createSchemeRequest);
530
		LOGGER.info("Scheme saved successfully");
530
		LOGGER.info("Scheme saved successfully");
Line 555... Line 555...
555
 
555
 
556
	}
556
	}
557
 
557
 
558
	@RequestMapping(value = "/getSchemes", method = RequestMethod.GET)
558
	@RequestMapping(value = "/getSchemes", method = RequestMethod.GET)
559
	public String getSchemes(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
559
	public String getSchemes(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
560
			@RequestParam(required = false) LocalDate date,
560
							 @RequestParam(required = false) LocalDate date,
561
			@RequestParam(name = "limit", defaultValue = "10") int limit,
561
							 @RequestParam(name = "limit", defaultValue = "10") int limit,
562
			@RequestParam(name = "searchItem", required = false, defaultValue = "0") int searchItem,
562
							 @RequestParam(name = "searchItem", required = false, defaultValue = "0") int searchItem,
563
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
563
							 @RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
564
			@RequestParam(name = "partnerType", required = false, defaultValue = "") PartnerType partnerType,
564
							 @RequestParam(name = "partnerType", required = false, defaultValue = "") PartnerType partnerType,
565
			@RequestParam(name = "searchImei", required = false, defaultValue = "") String searchImei, Model model)
565
							 @RequestParam(name = "searchImei", required = false, defaultValue = "") String searchImei, Model model)
566
			throws ProfitMandiBusinessException {
566
			throws ProfitMandiBusinessException {
567
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
567
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
568
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
568
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
569
		if (date == null) {
569
		if (date == null) {
570
			date = LocalDate.now();
570
			date = LocalDate.now();
Line 603... Line 603...
603
				if (schemes.size() < limit) {
603
				if (schemes.size() < limit) {
604
					model.addAttribute("end", offset + schemes.size());
604
					model.addAttribute("end", offset + schemes.size());
605
				} else {
605
				} else {
606
					model.addAttribute("end", offset + limit);
606
					model.addAttribute("end", offset + limit);
607
				}
607
				}
608
			}
-
 
609
 
-
 
610
			else {
608
			} else {
611
				throw new ProfitMandiBusinessException("SchemeId", searchTerm, "SchemeId Not Found");
609
				throw new ProfitMandiBusinessException("SchemeId", searchTerm, "SchemeId Not Found");
612
			}
610
			}
613
		}
-
 
614
 
-
 
615
		else if (searchItem > 0) {
611
		} else if (searchItem > 0) {
616
			TagListing tagListing = null;
612
			TagListing tagListing = null;
617
			tagListing = tagListingRepository.selectByItemId(searchItem);
613
			tagListing = tagListingRepository.selectByItemId(searchItem);
618
			Item item = itemRepository.selectById(searchItem);
614
			Item item = itemRepository.selectById(searchItem);
619
			if (tagListing != null) {
615
			if (tagListing != null) {
620
				model.addAttribute("dp", tagListing.getSellingPrice());
616
				model.addAttribute("dp", tagListing.getSellingPrice());
Line 702... Line 698...
702
 
698
 
703
			model.addAttribute("fullAccess", fullAccess);
699
			model.addAttribute("fullAccess", fullAccess);
704
 
700
 
705
			return "schemes";
701
			return "schemes";
706
		} else {
702
		} else {
707
			List<CreateOfferRequest> offers = new ArrayList<>();
703
			List<CreateOfferRequest> offers = null;
708
			Map<Integer, Map<Integer, Long>> offerSlabPayoutMap = new HashMap<>();
704
			Map<Integer, Map<Integer, Long>> offerSlabPayoutMap = new HashMap<>();
709
			List<PriceDropIMEI> priceDropImeis = new ArrayList<>();
705
			List<PriceDropIMEI> priceDropImeis = new ArrayList<>();
710
			if (searchItem > 0) {
706
			if (searchItem > 0) {
711
				offers = offerService.getPublishedOffers(date, loginDetails.getFofoId(), searchItem);
707
				offers = offerService.getPublishedOffers(date, loginDetails.getFofoId(), searchItem);
712
				for (CreateOfferRequest createOfferRequest : offers) {
708
				for (CreateOfferRequest createOfferRequest : offers) {
713
					Map<Integer, Map<Integer, Long>> itemSlabPayoutMap = offerService
709
					Map<Integer, Map<Integer, Long>> itemSlabPayoutMap = offerService
714
							.getSlabPayoutMap(createOfferRequest);
710
							.getSlabPayoutMap(createOfferRequest);
715
					Map<Integer, Long> slabPayoutMap = itemSlabPayoutMap.get(searchItem);
711
					Map<Integer, Long> slabPayoutMap = itemSlabPayoutMap.get(searchItem);
716
					offerSlabPayoutMap.put(createOfferRequest.getId(), slabPayoutMap);
712
					offerSlabPayoutMap.put(createOfferRequest.getId(), slabPayoutMap);
717
				}
713
				}
-
 
714
			} else {
-
 
715
				offers = new ArrayList<>();
718
			}
716
			}
719
			if (!(searchImei.equals(""))) {
717
			if (!(searchImei.equals(""))) {
720
				InventoryItem inventoryItem = inventoryItemRepository.selectBySerialNumberFofoId(searchImei,
718
				InventoryItem inventoryItem = inventoryItemRepository.selectBySerialNumberFofoId(searchImei,
721
						loginDetails.getFofoId());
719
						loginDetails.getFofoId());
722
 
720
 
Line 756... Line 754...
756
					float taxableSellingPrice = tagListing.getSellingPrice() / (1 + taxRate / 100);
754
					float taxableSellingPrice = tagListing.getSellingPrice() / (1 + taxRate / 100);
757
					float amount = taxableSellingPrice * scheme.getAmount() / 100;
755
					float amount = taxableSellingPrice * scheme.getAmount() / 100;
758
					scheme.setAmountModel(
756
					scheme.setAmountModel(
759
							FormattingUtils.formatDecimal(amount) + " (" + scheme.getAmount() + "%)");
757
							FormattingUtils.formatDecimal(amount) + " (" + scheme.getAmount() + "%)");
760
					nlc -= amount;
758
					nlc -= amount;
761
				}
-
 
762
 
-
 
763
				else {
759
				} else {
764
					scheme.setAmountModel(scheme.getAmount() + "%");
760
					scheme.setAmountModel(scheme.getAmount() + "%");
765
				}
761
				}
766
			} else {
762
			} else {
767
				scheme.setAmountModel(scheme.getAmount() + "");
763
				scheme.setAmountModel(scheme.getAmount() + "");
768
				nlc -= scheme.getAmount();
764
				nlc -= scheme.getAmount();
Line 773... Line 769...
773
 
769
 
774
	}
770
	}
775
 
771
 
776
	@RequestMapping(value = "/getPaginatedSchemes", method = RequestMethod.GET)
772
	@RequestMapping(value = "/getPaginatedSchemes", method = RequestMethod.GET)
777
	public String getPaginatedSchemes(HttpServletRequest request, @RequestParam(required = false) LocalDate date,
773
	public String getPaginatedSchemes(HttpServletRequest request, @RequestParam(required = false) LocalDate date,
778
			@RequestParam(name = "offset", defaultValue = "0") int offset,
774
									  @RequestParam(name = "offset", defaultValue = "0") int offset,
779
			@RequestParam(name = "limit", defaultValue = "10") int limit,
775
									  @RequestParam(name = "limit", defaultValue = "10") int limit,
780
			@RequestParam(name = "partnerType", required = false, defaultValue = "ALL") PartnerType partnerType,
776
									  @RequestParam(name = "partnerType", required = false, defaultValue = "ALL") PartnerType partnerType,
781
			Model model) throws ProfitMandiBusinessException {
777
									  Model model) throws ProfitMandiBusinessException {
782
 
778
 
783
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
779
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
784
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
780
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
785
		if (date == null) {
781
		if (date == null) {
786
			date = LocalDate.now();
782
			date = LocalDate.now();
Line 817... Line 813...
817
		return "schemes-download";
813
		return "schemes-download";
818
	}
814
	}
819
 
815
 
820
	@RequestMapping(value = "/schemes/download", method = RequestMethod.GET)
816
	@RequestMapping(value = "/schemes/download", method = RequestMethod.GET)
821
	public ResponseEntity<?> downloadInventoryItemAgingByInterval(HttpServletRequest request,
817
	public ResponseEntity<?> downloadInventoryItemAgingByInterval(HttpServletRequest request,
822
			@RequestParam(name = ProfitMandiConstants.START_DATE_TIME) String startDateTimeString,
818
																  @RequestParam(name = ProfitMandiConstants.START_DATE_TIME) String startDateTimeString,
823
			@RequestParam(name = ProfitMandiConstants.END_DATE_TIME) String endDateTimeString, Model model)
819
																  @RequestParam(name = ProfitMandiConstants.END_DATE_TIME) String endDateTimeString, Model model)
824
			throws ProfitMandiBusinessException {
820
			throws ProfitMandiBusinessException {
825
		LocalDateTime startDateTime = StringUtils.toDateTime(startDateTimeString,
821
		LocalDateTime startDateTime = StringUtils.toDateTime(startDateTimeString,
826
				DateTimePattern.DD_MM_yyyy_T_HH_MM_SS);
822
				DateTimePattern.DD_MM_yyyy_T_HH_MM_SS);
827
		LocalDateTime endDateTime = StringUtils.toDateTime(endDateTimeString, DateTimePattern.DD_MM_yyyy_T_HH_MM_SS);
823
		LocalDateTime endDateTime = StringUtils.toDateTime(endDateTimeString, DateTimePattern.DD_MM_yyyy_T_HH_MM_SS);
828
 
824
 
Line 840... Line 836...
840
		return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
836
		return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
841
	}
837
	}
842
 
838
 
843
	@RequestMapping(value = "/getSchemeById", method = RequestMethod.GET)
839
	@RequestMapping(value = "/getSchemeById", method = RequestMethod.GET)
844
	public String getSchemeById(HttpServletRequest request,
840
	public String getSchemeById(HttpServletRequest request,
845
			@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId, Model model)
841
								@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId, Model model)
846
			throws ProfitMandiBusinessException {
842
			throws ProfitMandiBusinessException {
847
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
843
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
848
 
844
 
849
		boolean fullAccess = this.getAccess(loginDetails.getEmailId());
845
		boolean fullAccess = this.getAccess(loginDetails.getEmailId());
850
		Scheme scheme = schemeService.getSchemeById(schemeId);
846
		Scheme scheme = schemeService.getSchemeById(schemeId);
Line 855... Line 851...
855
 
851
 
856
	}
852
	}
857
 
853
 
858
	@RequestMapping(value = "/activeSchemeById", method = RequestMethod.PUT)
854
	@RequestMapping(value = "/activeSchemeById", method = RequestMethod.PUT)
859
	public String activeSchemeById(HttpServletRequest request,
855
	public String activeSchemeById(HttpServletRequest request,
860
			@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
856
								   @RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
861
			@RequestParam(name = "offset", defaultValue = "0") int offset,
857
								   @RequestParam(name = "offset", defaultValue = "0") int offset,
862
			@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
858
								   @RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
863
			throws ProfitMandiBusinessException {
859
			throws ProfitMandiBusinessException {
864
		schemeService.activeSchemeById(schemeId);
860
		schemeService.activeSchemeById(schemeId);
865
		List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
861
		List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
866
		model.addAttribute("schemes", schemes);
862
		model.addAttribute("schemes", schemes);
867
		return "schemes-paginated";
863
		return "schemes-paginated";
868
	}
864
	}
869
 
865
 
870
	@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
866
	@RequestMapping(value = "/expireSchemeById", method = RequestMethod.PUT)
871
	public String expireSchemeById(HttpServletRequest request,
867
	public String expireSchemeById(HttpServletRequest request,
872
			@RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
868
								   @RequestParam(name = ProfitMandiConstants.SCHEME_ID) int schemeId,
873
			@RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp,
869
								   @RequestParam(name = ProfitMandiConstants.EXPIRE_TIMESTAMP) LocalDateTime expiryTimestamp,
874
			@RequestParam(name = "offset", defaultValue = "0") int offset,
870
								   @RequestParam(name = "offset", defaultValue = "0") int offset,
875
			@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
871
								   @RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
876
			throws ProfitMandiBusinessException {
872
			throws ProfitMandiBusinessException {
877
		expiryTimestamp = LocalDateTime.of(expiryTimestamp.toLocalDate(), Utils.MAX_TIME);
873
		expiryTimestamp = LocalDateTime.of(expiryTimestamp.toLocalDate(), Utils.MAX_TIME);
878
		schemeService.expireSchemeById(schemeId, expiryTimestamp);
874
		schemeService.expireSchemeById(schemeId, expiryTimestamp);
879
		List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
875
		List<Scheme> schemes = schemeRepository.selectAll(offset, limit);
880
		model.addAttribute("schemes", schemes);
876
		model.addAttribute("schemes", schemes);
881
		return "schemes-paginated";
877
		return "schemes-paginated";
882
	}
878
	}
883
 
879
 
884
	@RequestMapping(value = "/getSchemesJson", method = RequestMethod.GET)
880
	@RequestMapping(value = "/getSchemesJson", method = RequestMethod.GET)
885
	public ResponseEntity<?> getSchemesJson(HttpServletRequest request,
881
	public ResponseEntity<?> getSchemesJson(HttpServletRequest request,
886
			@RequestParam(name = "offset", defaultValue = "0") int offset,
882
											@RequestParam(name = "offset", defaultValue = "0") int offset,
887
			@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
883
											@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
888
			throws ProfitMandiBusinessException {
884
			throws ProfitMandiBusinessException {
889
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
885
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
890
		return responseSender.ok(schemeService.getSchemes(loginDetails.getRoleIds(), offset, limit));
886
		return responseSender.ok(schemeService.getSchemes(loginDetails.getRoleIds(), offset, limit));
891
	}
887
	}
892
 
888
 
893
	@RequestMapping(value = "/searchSchemeByCategory")
889
	@RequestMapping(value = "/searchSchemeByCategory")
894
	public String getSchemeByCategory(HttpServletRequest request,
890
	public String getSchemeByCategory(HttpServletRequest request,
895
			@RequestParam(name = "offset", defaultValue = "0") int offset,
891
									  @RequestParam(name = "offset", defaultValue = "0") int offset,
896
			@RequestParam(name = "limit", defaultValue = "10") int limit,
892
									  @RequestParam(name = "limit", defaultValue = "10") int limit,
897
			@RequestParam(name = "searchItem", required = false, defaultValue = "") String searchItem,
893
									  @RequestParam(name = "searchItem", required = false, defaultValue = "") String searchItem,
898
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
894
									  @RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
899
			@RequestParam(name = "category", required = true, defaultValue = "") PartnerType category, Model model)
895
									  @RequestParam(name = "category", required = true, defaultValue = "") PartnerType category, Model model)
900
			throws ProfitMandiBusinessException {
896
			throws ProfitMandiBusinessException {
901
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
897
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
902
		List<Scheme> schemes = null;
898
		List<Scheme> schemes = null;
903
		long size = 0;
899
		long size = 0;
904
 
900
 
Line 923... Line 919...
923
		return "schemes";
919
		return "schemes";
924
	}
920
	}
925
 
921
 
926
	@RequestMapping(value = "/getSchemeByCategoryPaginated")
922
	@RequestMapping(value = "/getSchemeByCategoryPaginated")
927
	public String getSchemeByCategoryPaginated(HttpServletRequest request,
923
	public String getSchemeByCategoryPaginated(HttpServletRequest request,
928
			@RequestParam(name = "offset", defaultValue = "0") int offset,
924
											   @RequestParam(name = "offset", defaultValue = "0") int offset,
929
			@RequestParam(name = "limit", defaultValue = "10") int limit,
925
											   @RequestParam(name = "limit", defaultValue = "10") int limit,
930
			@RequestParam(name = "searchItem", required = false, defaultValue = "") String searchItem,
926
											   @RequestParam(name = "searchItem", required = false, defaultValue = "") String searchItem,
931
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
927
											   @RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
932
			@RequestParam(name = "category", required = true, defaultValue = "") PartnerType category, Model model)
928
											   @RequestParam(name = "category", required = true, defaultValue = "") PartnerType category, Model model)
933
			throws ProfitMandiBusinessException {
929
			throws ProfitMandiBusinessException {
934
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
930
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
935
		LOGGER.info("In search Item....");
931
		LOGGER.info("In search Item....");
936
		List<Scheme> schemes = null;
932
		List<Scheme> schemes = null;
937
 
933
 
Line 943... Line 939...
943
		return "schemes-paginated";
939
		return "schemes-paginated";
944
	}
940
	}
945
 
941
 
946
	@RequestMapping(value = "/searchScheme")
942
	@RequestMapping(value = "/searchScheme")
947
	public String getSchemeBySchemeId(HttpServletRequest request,
943
	public String getSchemeBySchemeId(HttpServletRequest request,
948
			@RequestParam(name = "offset", defaultValue = "0") int offset,
944
									  @RequestParam(name = "offset", defaultValue = "0") int offset,
949
			@RequestParam(name = "limit", defaultValue = "10") int limit,
945
									  @RequestParam(name = "limit", defaultValue = "10") int limit,
950
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
946
									  @RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
951
			@RequestParam(name = "searchItem", required = false, defaultValue = "") String searchItem, Model model)
947
									  @RequestParam(name = "searchItem", required = false, defaultValue = "") String searchItem, Model model)
952
			throws ProfitMandiBusinessException {
948
			throws ProfitMandiBusinessException {
953
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
949
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
954
		List<Scheme> schemes = null;
950
		List<Scheme> schemes = null;
955
		long size = 0;
951
		long size = 0;
956
		if (!(searchTerm.equals("")) && searchItem.equals("")) {
952
		if (!(searchTerm.equals("")) && searchItem.equals("")) {
Line 1017... Line 1013...
1017
		return "schemes";
1013
		return "schemes";
1018
	}
1014
	}
1019
 
1015
 
1020
	@RequestMapping(value = "/searchItemSchemePanigated")
1016
	@RequestMapping(value = "/searchItemSchemePanigated")
1021
	public String getSchemeByItemPanigated(HttpServletRequest request,
1017
	public String getSchemeByItemPanigated(HttpServletRequest request,
1022
			@RequestParam(name = "offset", defaultValue = "0") int offset,
1018
										   @RequestParam(name = "offset", defaultValue = "0") int offset,
1023
			@RequestParam(name = "limit", defaultValue = "10") int limit,
1019
										   @RequestParam(name = "limit", defaultValue = "10") int limit,
1024
			@RequestParam(name = "searchItem", required = false, defaultValue = "") String searchItem, Model model)
1020
										   @RequestParam(name = "searchItem", required = false, defaultValue = "") String searchItem, Model model)
1025
			throws ProfitMandiBusinessException {
1021
			throws ProfitMandiBusinessException {
1026
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1022
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1027
		LOGGER.info("In search Item....");
1023
		LOGGER.info("In search Item....");
1028
		List<Scheme> schemes = null;
1024
		List<Scheme> schemes = null;
1029
		if (!searchItem.equals("")) {
1025
		if (!searchItem.equals("")) {
Line 1051... Line 1047...
1051
 
1047
 
1052
	}
1048
	}
1053
 
1049
 
1054
	@RequestMapping(value = "/createCustomerOffer", method = RequestMethod.POST)
1050
	@RequestMapping(value = "/createCustomerOffer", method = RequestMethod.POST)
1055
	public String createCustomerOffer(HttpServletRequest request, @RequestParam String offerName,
1051
	public String createCustomerOffer(HttpServletRequest request, @RequestParam String offerName,
1056
			@RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model) throws Exception {
1052
									  @RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model) throws Exception {
1057
 
1053
 
1058
		CustomerOffer co = new CustomerOffer();
1054
		CustomerOffer co = new CustomerOffer();
1059
		co.setOfferName(offerName);
1055
		co.setOfferName(offerName);
1060
		co.setStartDate(startDate);
1056
		co.setStartDate(startDate);
1061
		co.setEndDate(endDate);
1057
		co.setEndDate(endDate);
Line 1087... Line 1083...
1087
 
1083
 
1088
	}
1084
	}
1089
 
1085
 
1090
	@RequestMapping(value = "/customerOfferItem/upload", method = RequestMethod.POST)
1086
	@RequestMapping(value = "/customerOfferItem/upload", method = RequestMethod.POST)
1091
	public String uploadCustomerOfferItem(HttpServletRequest request, Model model, @RequestParam int offerId,
1087
	public String uploadCustomerOfferItem(HttpServletRequest request, Model model, @RequestParam int offerId,
1092
			HttpServletResponse response, @RequestPart MultipartFile file) throws Throwable {
1088
										  HttpServletResponse response, @RequestPart MultipartFile file) throws Throwable {
1093
 
1089
 
1094
		List<CSVRecord> records = FileUtil.readFile(file);
1090
		List<CSVRecord> records = FileUtil.readFile(file);
1095
 
1091
 
1096
		for (CSVRecord record : records) {
1092
		for (CSVRecord record : records) {
1097
			if (Integer.parseInt(record.get(0)) == 0) {
1093
			if (Integer.parseInt(record.get(0)) == 0) {
Line 1145... Line 1141...
1145
 
1141
 
1146
	}
1142
	}
1147
 
1143
 
1148
	@RequestMapping(value = "/extendCustomerOffer", method = RequestMethod.POST)
1144
	@RequestMapping(value = "/extendCustomerOffer", method = RequestMethod.POST)
1149
	public String extendCustomerOffer(HttpServletRequest request, @RequestParam int id,
1145
	public String extendCustomerOffer(HttpServletRequest request, @RequestParam int id,
1150
			@RequestParam LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
1146
									  @RequestParam LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
1151
 
1147
 
1152
		CustomerOffer co = customerOfferRepository.selectById(id);
1148
		CustomerOffer co = customerOfferRepository.selectById(id);
1153
		co.setEndDate(endDate);
1149
		co.setEndDate(endDate);
1154
		co.setUpdatedTimestamp(LocalDateTime.now());
1150
		co.setUpdatedTimestamp(LocalDateTime.now());
1155
 
1151