Subversion Repositories SmartDukaan

Rev

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

Rev 33102 Rev 33108
Line 188... Line 188...
188
		}
188
		}
189
	}
189
	}
190
 
190
 
191
	@RequestMapping(value = "/downloadCollectionSummary", method = RequestMethod.GET)
191
	@RequestMapping(value = "/downloadCollectionSummary", method = RequestMethod.GET)
192
	public ResponseEntity<?> getDownloadCollectionSummary(HttpServletRequest request,
192
	public ResponseEntity<?> getDownloadCollectionSummary(HttpServletRequest request,
193
														  @RequestParam int fofoId,
193
														  @RequestParam(defaultValue = "0") int fofoId,
194
														  @RequestParam(name = "startDate") LocalDate startDate,
194
														  @RequestParam(name = "startDate") LocalDate startDate,
195
														  @RequestParam(name = "endDate") LocalDate endDate, Model model) throws Exception {
195
														  @RequestParam(name = "endDate") LocalDate endDate, Model model) throws Exception {
196
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
196
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
197
		List<List<?>> rows = new ArrayList<>();
197
		List<List<?>> rows = new ArrayList<>();
198
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
198
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
199
		List<CollectionSummary> collectionSummaryList = null;
199
		List<CollectionSummary> collectionSummaryList = null;
200
		if (isAdmin) {
200
		if (isAdmin) {
-
 
201
			if (fofoId == 0) {
-
 
202
				collectionSummaryList = new ArrayList<>();
-
 
203
			} else {
201
			collectionSummaryList = orderRepository.selectCollectionSummary(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
204
				collectionSummaryList = orderRepository.selectCollectionSummary(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
-
 
205
			}
202
		} else {
206
		} else {
203
			fofoId = fofoDetails.getFofoId();
-
 
204
			collectionSummaryList = orderRepository.selectCollectionSummary(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
207
			collectionSummaryList = orderRepository.selectCollectionSummary(fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
205
		}
208
		}
206
		Logger.info("CollectionSummaryList {}", collectionSummaryList);
209
		Logger.info("CollectionSummaryList {}", collectionSummaryList);
207
		DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
210
		DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
208
		for (CollectionSummary cs : collectionSummaryList) {
211
		for (CollectionSummary cs : collectionSummaryList) {
209
			rows.add(Arrays.asList(cs.getDate().format(
212
			rows.add(Arrays.asList(cs.getDate().format(
Line 288... Line 291...
288
	}
291
	}
289
 
292
 
290
 
293
 
291
	@RequestMapping(value = "/downloadFranchiseeSales", method = RequestMethod.GET)
294
	@RequestMapping(value = "/downloadFranchiseeSales", method = RequestMethod.GET)
292
	public ResponseEntity<?> getdownloadFranchiseeSales(HttpServletRequest request,
295
	public ResponseEntity<?> getdownloadFranchiseeSales(HttpServletRequest request,
293
														@RequestParam int fofoId,
296
														@RequestParam(defaultValue = "0") int fofoId,
294
														@RequestParam(name = "startDate") LocalDate startDate,
297
														@RequestParam(name = "startDate") LocalDate startDate,
295
														@RequestParam(name = "endDate") LocalDate endDate,
298
														@RequestParam(name = "endDate") LocalDate endDate,
296
														Model model)
299
														Model model)
297
			throws Exception {
300
			throws Exception {
298
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
301
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
Line 301... Line 304...
301
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
304
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
302
		List<FocoSaleReportModel> focoSaleReportList = null;
305
		List<FocoSaleReportModel> focoSaleReportList = null;
303
		FofoStore fs = null;
306
		FofoStore fs = null;
304
		if (isAdmin) {
307
		if (isAdmin) {
305
			fs = fofoStoreRepository.selectByRetailerId(fofoId);
308
			fs = fofoStoreRepository.selectByRetailerId(fofoId);
-
 
309
			if (fofoId == 0) {
-
 
310
				focoSaleReportList = new ArrayList<>();
-
 
311
			} else {
-
 
312
 
306
			focoSaleReportList = fofoOrderRepository.selectFocoSaleReport(fofoId,
313
				focoSaleReportList = fofoOrderRepository.selectFocoSaleReport(fofoId,
307
					fs.getCode(), startDate.atStartOfDay(), endDate.atStartOfDay());
314
						fs.getCode(), startDate.atStartOfDay(), endDate.atStartOfDay());
-
 
315
			}
308
 
316
 
309
		} else {
317
		} else {
310
			fofoId = fofoDetails.getFofoId();
-
 
311
			fs = fofoStoreRepository.selectByRetailerId(fofoId);
318
			fs = fofoStoreRepository.selectByRetailerId(fofoDetails.getFofoId());
312
 
319
 
313
			focoSaleReportList = fofoOrderRepository.selectFocoSaleReport(fofoDetails.getFofoId(),
320
			focoSaleReportList = fofoOrderRepository.selectFocoSaleReport(fofoDetails.getFofoId(),
314
					fs.getCode(), startDate.atStartOfDay(), endDate.atStartOfDay());
321
					fs.getCode(), startDate.atStartOfDay(), endDate.atStartOfDay());
315
		}
322
		}
316
		LOGGER.info("FocoSaleReportList {}", focoSaleReportList);
323
		LOGGER.info("FocoSaleReportList {}", focoSaleReportList);
Line 357... Line 364...
357
		List<List<?>> rows = new ArrayList<>();
364
		List<List<?>> rows = new ArrayList<>();
358
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
365
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
359
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
366
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
360
		List<WalletSummaryReportModel> walletSummartList = null;
367
		List<WalletSummaryReportModel> walletSummartList = null;
361
		if (isAdmin) {
368
		if (isAdmin) {
-
 
369
			if (fofoId == 0)
-
 
370
				walletSummartList = new ArrayList<>();
-
 
371
			else
362
			walletSummartList = fofoOrderRepository.selectWalletSummaryReport(
372
				walletSummartList = fofoOrderRepository.selectWalletSummaryReport(
363
					fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
373
					fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
364
		} else {
374
		} else {
365
 
375
 
366
			walletSummartList = fofoOrderRepository.selectWalletSummaryReport(
376
			walletSummartList = fofoOrderRepository.selectWalletSummaryReport(
367
					fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
377
					fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
Line 516... Line 526...
516
	}
526
	}
517
 
527
 
518
 
528
 
519
	@RequestMapping(value = "/pendingIndentReportDownload", method = RequestMethod.GET)
529
	@RequestMapping(value = "/pendingIndentReportDownload", method = RequestMethod.GET)
520
	public ResponseEntity<?> getPendingIndentReportDownload(HttpServletRequest request,
530
	public ResponseEntity<?> getPendingIndentReportDownload(HttpServletRequest request,
521
															@RequestParam int fofoId,
531
															@RequestParam(defaultValue = "0") int fofoId,
522
															@RequestParam(name = "startDate") LocalDate startDate,
532
															@RequestParam(name = "startDate") LocalDate startDate,
523
															@RequestParam(name = "endDate") LocalDate endDate, Model model)
533
															@RequestParam(name = "endDate") LocalDate endDate, Model model)
524
			throws Exception {
534
			throws Exception {
525
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
535
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
526
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
536
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
527
        /*LocalDateTime currentDate = LocalDate.now().atStartOfDay();
537
        /*LocalDateTime currentDate = LocalDate.now().atStartOfDay();
528
        LocalDateTime currentStartMonth = currentDate.minusMonths(2).toLocalDate().atStartOfDay();*/
538
        LocalDateTime currentStartMonth = currentDate.minusMonths(2).toLocalDate().atStartOfDay();*/
529
		List<PendingIndentReportModel> pendingIndentReports = null;
539
		List<PendingIndentReportModel> pendingIndentReports = null;
530
		List<List<?>> rows = new ArrayList<>();
540
		List<List<?>> rows = new ArrayList<>();
531
		if (isAdmin) {
541
		if (isAdmin) {
-
 
542
			if (fofoId == 0)
-
 
543
				pendingIndentReports = new ArrayList<>();
-
 
544
			else
532
			pendingIndentReports = fofoOrderRepository
545
				pendingIndentReports = fofoOrderRepository
533
					.selectPendingIndentReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
546
					.selectPendingIndentReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
534
		} else {
547
		} else {
535
			pendingIndentReports = fofoOrderRepository
548
			pendingIndentReports = fofoOrderRepository
536
					.selectPendingIndentReport(fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
549
					.selectPendingIndentReport(fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
537
 
550
 
Line 764... Line 777...
764
	}
777
	}
765
 
778
 
766
 
779
 
767
	@RequestMapping(value = "/downloadPriceDropReport", method = RequestMethod.GET)
780
	@RequestMapping(value = "/downloadPriceDropReport", method = RequestMethod.GET)
768
	public ResponseEntity<?> getSelectDownloadPriceDropReport(HttpServletRequest request,
781
	public ResponseEntity<?> getSelectDownloadPriceDropReport(HttpServletRequest request,
769
															  @RequestParam() int fofoId,
782
															  @RequestParam(defaultValue = "0") int fofoId,
770
															  @RequestParam(name = "startDate") LocalDate startDate,
783
															  @RequestParam(name = "startDate") LocalDate startDate,
771
															  @RequestParam(name = "endDate") LocalDate endDate, Model model)
784
															  @RequestParam(name = "endDate") LocalDate endDate, Model model)
772
			throws Exception {
785
			throws Exception {
773
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
786
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
774
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
787
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
775
		List<List<?>> rows = new ArrayList<>();
788
		List<List<?>> rows = new ArrayList<>();
776
		List<PriceDropReportModel> priceDropReports = null;
789
		List<PriceDropReportModel> priceDropReports = null;
777
		if (isAdmin) {
790
		if (isAdmin) {
-
 
791
			if (fofoId == 0)
-
 
792
				priceDropReports = new ArrayList<>();
-
 
793
			else
778
			priceDropReports = orderRepository.selectPriceDropReport(fofoId,
794
				priceDropReports = orderRepository.selectPriceDropReport(fofoId,
779
					startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
795
					startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
780
		} else {
796
		} else {
781
			fofoId = fofoDetails.getFofoId();
797
			fofoId = fofoDetails.getFofoId();
782
			priceDropReports = orderRepository.selectPriceDropReport(fofoId,
798
			priceDropReports = orderRepository.selectPriceDropReport(fofoId,
783
					startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
799
					startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
Line 891... Line 907...
891
		return responseEntity;
907
		return responseEntity;
892
	}
908
	}
893
 
909
 
894
	@RequestMapping(value = "/schemePayoutReportDownload", method = RequestMethod.GET)
910
	@RequestMapping(value = "/schemePayoutReportDownload", method = RequestMethod.GET)
895
	public ResponseEntity<?> getSchemePayoutReportDownload(HttpServletRequest request,
911
	public ResponseEntity<?> getSchemePayoutReportDownload(HttpServletRequest request,
896
														   @RequestParam int fofoId,
912
														   @RequestParam(defaultValue = "0") int fofoId,
897
														   @RequestParam(name = "startDate") LocalDate startDate,
913
														   @RequestParam(name = "startDate") LocalDate startDate,
898
														   @RequestParam(name = "endDate") LocalDate endDate, Model model)
914
														   @RequestParam(name = "endDate") LocalDate endDate, Model model)
899
			throws Exception {
915
			throws Exception {
900
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
916
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
901
 
917
 
Line 903... Line 919...
903
 
919
 
904
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
920
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
905
 
921
 
906
		List<SchemePayoutReportModel> schemePayoutReports = null;
922
		List<SchemePayoutReportModel> schemePayoutReports = null;
907
		if (isAdmin) {
923
		if (isAdmin) {
-
 
924
			if (fofoId == 0)
-
 
925
				schemePayoutReports = new ArrayList<>();
-
 
926
			else
908
			schemePayoutReports = fofoOrderRepository
927
				schemePayoutReports = fofoOrderRepository
909
					.selectSchemePayoutReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
928
					.selectSchemePayoutReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
910
		} else {
929
		} else {
911
			fofoId = fofoDetails.getFofoId();
930
			fofoId = fofoDetails.getFofoId();
912
			schemePayoutReports = fofoOrderRepository
931
			schemePayoutReports = fofoOrderRepository
913
					.selectSchemePayoutReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
932
					.selectSchemePayoutReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
Line 934... Line 953...
934
	}
953
	}
935
 
954
 
936
 
955
 
937
	@RequestMapping(value = "/offerPayoutDumpReportDownload", method = RequestMethod.GET)
956
	@RequestMapping(value = "/offerPayoutDumpReportDownload", method = RequestMethod.GET)
938
	public ResponseEntity<?> getOfferPayoutDumpReportDownload(HttpServletRequest request,
957
	public ResponseEntity<?> getOfferPayoutDumpReportDownload(HttpServletRequest request,
939
															  @RequestParam int fofoId,
958
															  @RequestParam(defaultValue = "0") int fofoId,
940
															  @RequestParam(name = "startDate") LocalDate startDate,
959
															  @RequestParam(name = "startDate") LocalDate startDate,
941
															  @RequestParam(name = "endDate") LocalDate endDate, Model model)
960
															  @RequestParam(name = "endDate") LocalDate endDate, Model model)
942
			throws Exception {
961
			throws Exception {
943
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
962
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
944
		List<List<?>> rows = new ArrayList<>();
963
		List<List<?>> rows = new ArrayList<>();
945
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
964
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
946
		List<OfferPayoutDumpReportModel> offerPayoutReports = null;
965
		List<OfferPayoutDumpReportModel> offerPayoutReports = null;
947
		if (isAdmin) {
966
		if (isAdmin) {
-
 
967
			if (fofoId == 0)
-
 
968
				offerPayoutReports = new ArrayList<>();
-
 
969
			else
948
			offerPayoutReports = fofoOrderRepository
970
				offerPayoutReports = fofoOrderRepository
949
					.selectOfferPayoutDumpReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
971
					.selectOfferPayoutDumpReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
950
		} else {
972
		} else {
951
			fofoId = fofoDetails.getFofoId();
973
			fofoId = fofoDetails.getFofoId();
952
			offerPayoutReports = fofoOrderRepository
974
			offerPayoutReports = fofoOrderRepository
953
					.selectOfferPayoutDumpReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
975
					.selectOfferPayoutDumpReport(fofoId, startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));