Subversion Repositories SmartDukaan

Rev

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

Rev 30053 Rev 30224
Line 58... Line 58...
58
import org.springframework.http.HttpHeaders;
58
import org.springframework.http.HttpHeaders;
59
import org.springframework.http.HttpStatus;
59
import org.springframework.http.HttpStatus;
60
import org.springframework.http.ResponseEntity;
60
import org.springframework.http.ResponseEntity;
61
import org.springframework.stereotype.Controller;
61
import org.springframework.stereotype.Controller;
62
import org.springframework.ui.Model;
62
import org.springframework.ui.Model;
-
 
63
import org.springframework.web.bind.annotation.PathVariable;
63
import org.springframework.web.bind.annotation.RequestMapping;
64
import org.springframework.web.bind.annotation.RequestMapping;
64
import org.springframework.web.bind.annotation.RequestMethod;
65
import org.springframework.web.bind.annotation.RequestMethod;
65
import org.springframework.web.bind.annotation.RequestParam;
66
import org.springframework.web.bind.annotation.RequestParam;
66
 
67
 
67
import javax.servlet.http.HttpServletRequest;
68
import javax.servlet.http.HttpServletRequest;
Line 120... Line 121...
120
	private AdminUser adminUser;
121
	private AdminUser adminUser;
121
 
122
 
122
	@Autowired
123
	@Autowired
123
	private RoleManager roleManager;
124
	private RoleManager roleManager;
124
 
125
 
125
 
-
 
126
	@Autowired
126
	@Autowired
127
	private FofoStoreRepository fofoStoreRepository;
127
	private FofoStoreRepository fofoStoreRepository;
128
 
128
 
129
	@Autowired
129
	@Autowired
130
	private PartnerInvestmentService partnerInvestmentService;
130
	private PartnerInvestmentService partnerInvestmentService;
Line 376... Line 376...
376
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
376
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
377
 
377
 
378
		LocalDateTime currentMonthStart = curDate.withDayOfMonth(1);
378
		LocalDateTime currentMonthStart = curDate.withDayOfMonth(1);
379
		LocalDateTime lastMonthStart = currentMonthStart.minusMonths(1);
379
		LocalDateTime lastMonthStart = currentMonthStart.minusMonths(1);
380
		LocalDateTime currentMonthEnd = currentMonthStart.withDayOfMonth(1);
380
		LocalDateTime currentMonthEnd = currentMonthStart.withDayOfMonth(1);
381
		
-
 
382
 
381
 
383
		LOGGER.info("lastMonthStart" + lastMonthStart);
382
		LOGGER.info("lastMonthStart" + lastMonthStart);
384
		LOGGER.info("currentMonthEnd" + currentMonthEnd);
383
		LOGGER.info("currentMonthEnd" + currentMonthEnd);
385
 
384
 
386
		model.addAttribute("countOrder", countOrder);
385
		model.addAttribute("countOrder", countOrder);
Line 400... Line 399...
400
				fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
399
				fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
401
				if (!fofoStore.isActive()) {
400
				if (!fofoStore.isActive()) {
402
					return "redirect:/login";
401
					return "redirect:/login";
403
				}
402
				}
404
 
403
 
405
				long pendingIncome = 0;
-
 
406
				long partnerPurchaseIn = 0;
-
 
407
				long partnerCreditedSale = 0;
-
 
408
				long partnerFrontIncome = 0;
-
 
409
				
-
 
410
				LocalDateTime currentDate = LocalDate.now().atStartOfDay();
-
 
411
				LocalDateTime currentStartMonth = LocalDate.now().atStartOfDay().withDayOfMonth(1);
-
 
412
				
-
 
413
				AllPurchaseInventoryModel partnerlPendingSaleAmount = schemeInOutRepository
-
 
414
						.selectAllPendingSaleInventoryByFofoId(loginDetails.getFofoId(), currentStartMonth,
-
 
415
								currentDate);
-
 
416
				AllPurchaseInventoryModel partnerCreditedSaleAmount = schemeInOutRepository
-
 
417
						.selectAllCreditedSaleInventoryByFofoId(loginDetails.getFofoId(), currentStartMonth,
-
 
418
								currentDate);
-
 
419
				AllPurchaseInventoryModel partnerPurchaseInAmount = schemeInOutRepository
-
 
420
						.selectAllPurchaseInventoryByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
-
 
421
 
-
 
422
				AllPurchaseInventoryModel partnerFrontIncomes = schemeInOutRepository
-
 
423
						.selectFrontIncomeByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
-
 
424
 
-
 
425
				LOGGER.info("partnerfrontIncomes" + partnerFrontIncomes);
-
 
426
 
-
 
427
				LOGGER.info("partnerCreditedSaleAmount" + partnerCreditedSaleAmount);
-
 
428
				LOGGER.info("partnerPurchaseInAmount" + partnerPurchaseInAmount);
-
 
429
				LOGGER.info("partnerlPendingSaleAmount" + partnerlPendingSaleAmount);
-
 
430
 
-
 
431
				if (partnerlPendingSaleAmount != null) {
-
 
432
 
-
 
433
					pendingIncome = partnerlPendingSaleAmount.getAmount();
-
 
434
 
-
 
435
					LOGGER.info("pendingIncome" + pendingIncome);
-
 
436
 
-
 
437
				}
-
 
438
 
-
 
439
				if (partnerCreditedSaleAmount != null) {
-
 
440
 
-
 
441
					partnerCreditedSale = partnerCreditedSaleAmount.getAmount();
-
 
442
 
-
 
443
					LOGGER.info("partnerCreditedSale" + partnerCreditedSale);
-
 
444
 
-
 
445
				}
-
 
446
				if (partnerFrontIncomes != null) {
-
 
447
 
-
 
448
					partnerFrontIncome = partnerFrontIncomes.getAmount();
-
 
449
					LOGGER.info("partnerPurchaseIn" + partnerPurchaseIn);
-
 
450
 
-
 
451
				}
-
 
452
				if (partnerPurchaseInAmount != null) {
-
 
453
 
-
 
454
					partnerPurchaseIn = partnerPurchaseInAmount.getAmount();
-
 
455
					LOGGER.info("partnerPurchaseIn" + partnerPurchaseIn);
-
 
456
 
-
 
457
				}
-
 
458
 
-
 
459
				LOGGER.info("partnerPurchaseInTT" + partnerPurchaseIn);
-
 
460
				LOGGER.info("partnerCreditedSaleTT" + partnerCreditedSale);
-
 
461
				LOGGER.info("pendingIncomeTT" + pendingIncome);
-
 
462
 
-
 
463
				long totalIncome = partnerCreditedSale + partnerPurchaseIn + pendingIncome + partnerFrontIncome;
-
 
464
 
-
 
465
				long creditedIncome = partnerCreditedSale + partnerPurchaseIn + partnerFrontIncome;
-
 
466
 
-
 
467
				long pendingTotalIncome = pendingIncome;
-
 
468
				LOGGER.info("totalIncome" + totalIncome);
-
 
469
				LOGGER.info("creditedIncome" + creditedIncome);
-
 
470
				LOGGER.info("pendingTotalIncome" + pendingTotalIncome);
-
 
471
 
-
 
472
				model.addAttribute("totalIncome", totalIncome);
-
 
473
				model.addAttribute("creditedIncome", creditedIncome);
-
 
474
				model.addAttribute("pendingTotalIncome", pendingTotalIncome);
-
 
475
 
-
 
476
				PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
404
				PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
477
				model.addAttribute("partnerType", partnerType);
405
				model.addAttribute("partnerType", partnerType);
478
				model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
406
				model.addAttribute("partnerTypeImage", PartnerType.imageMap.get(partnerType));
479
				model.addAttribute("fofoStore", fofoStore);
407
				model.addAttribute("fofoStore", fofoStore);
480
				model.addAttribute("partnerType", partnerType);
408
				model.addAttribute("partnerType", partnerType);
Line 559... Line 487...
559
	@RequestMapping(value = "/getGrnPendingOrderStatus", method = RequestMethod.GET)
487
	@RequestMapping(value = "/getGrnPendingOrderStatus", method = RequestMethod.GET)
560
	public String getGrnPendingOrderStatus(HttpServletRequest request, Model model) throws Exception {
488
	public String getGrnPendingOrderStatus(HttpServletRequest request, Model model) throws Exception {
561
 
489
 
562
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
490
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
563
		int fofoId = loginDetails.getFofoId();
491
		int fofoId = loginDetails.getFofoId();
564
		List<Order> grnPendingOrders = orderRepository.selectGrnTimestampNull(fofoId, Arrays.asList(in.shop2020.model.v1.order.OrderStatus.DELIVERY_SUCCESS));
492
		List<Order> grnPendingOrders = orderRepository.selectGrnTimestampNull(fofoId,
-
 
493
				Arrays.asList(in.shop2020.model.v1.order.OrderStatus.DELIVERY_SUCCESS));
565
 
494
 
566
		model.addAttribute("grnPendingOrders", grnPendingOrders);
495
		model.addAttribute("grnPendingOrders", grnPendingOrders);
567
		return "purchase-grn-order-status";
496
		return "purchase-grn-order-status";
568
	}
497
	}
569
 
498
 
Line 644... Line 573...
644
			model.addAttribute("shippedLineItemMap", shippedLineItemMap);
573
			model.addAttribute("shippedLineItemMap", shippedLineItemMap);
645
		}
574
		}
646
		return "purchase-shipped-order-status";
575
		return "purchase-shipped-order-status";
647
	}
576
	}
648
 
577
 
-
 
578
	@RequestMapping(value = "/partnerTotalIncomeByMonth/{yearMonth}", method = RequestMethod.GET)
-
 
579
	public String getPartnerTotalIncomeByMonth(HttpServletRequest request, @PathVariable int yearMonth, Model model)
-
 
580
			throws Exception {
-
 
581
 
-
 
582
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
-
 
583
		long pendingIncome = 0;
-
 
584
		long partnerPurchaseIn = 0;
-
 
585
		long partnerCreditedSale = 0;
-
 
586
		long partnerFrontIncome = 0;
-
 
587
 
-
 
588
		LocalDateTime currentStartMonth = LocalDate.now().minusMonths(yearMonth).withDayOfMonth(1).atStartOfDay();
-
 
589
		LocalDateTime currentDate = currentStartMonth.plusMonths(1).withDayOfMonth(1).toLocalDate().atStartOfDay();
-
 
590
 
-
 
591
		AllPurchaseInventoryModel partnerlPendingSaleAmount = schemeInOutRepository
-
 
592
				.selectAllPendingSaleInventoryByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
-
 
593
		AllPurchaseInventoryModel partnerCreditedSaleAmount = schemeInOutRepository
-
 
594
				.selectAllCreditedSaleInventoryByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
-
 
595
		AllPurchaseInventoryModel partnerPurchaseInAmount = schemeInOutRepository
-
 
596
				.selectAllPurchaseInventoryByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
-
 
597
 
-
 
598
		AllPurchaseInventoryModel partnerFrontIncomes = schemeInOutRepository
-
 
599
				.selectFrontIncomeByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate);
-
 
600
 
-
 
601
		LOGGER.info("partnerfrontIncomes" + partnerFrontIncomes);
-
 
602
 
-
 
603
		LOGGER.info("partnerCreditedSaleAmount" + partnerCreditedSaleAmount);
-
 
604
		LOGGER.info("partnerPurchaseInAmount" + partnerPurchaseInAmount);
-
 
605
		LOGGER.info("partnerlPendingSaleAmount" + partnerlPendingSaleAmount);
-
 
606
 
-
 
607
		if (partnerlPendingSaleAmount != null) {
-
 
608
 
-
 
609
			pendingIncome = partnerlPendingSaleAmount.getAmount();
-
 
610
 
-
 
611
			LOGGER.info("pendingIncome" + pendingIncome);
-
 
612
 
-
 
613
		}
-
 
614
 
-
 
615
		if (partnerCreditedSaleAmount != null) {
-
 
616
 
-
 
617
			partnerCreditedSale = partnerCreditedSaleAmount.getAmount();
-
 
618
 
-
 
619
			LOGGER.info("partnerCreditedSale" + partnerCreditedSale);
-
 
620
 
-
 
621
		}
-
 
622
		if (partnerFrontIncomes != null) {
-
 
623
 
-
 
624
			partnerFrontIncome = partnerFrontIncomes.getAmount();
-
 
625
			LOGGER.info("partnerPurchaseIn" + partnerPurchaseIn);
-
 
626
 
-
 
627
		}
-
 
628
		if (partnerPurchaseInAmount != null) {
-
 
629
 
-
 
630
			partnerPurchaseIn = partnerPurchaseInAmount.getAmount();
-
 
631
			LOGGER.info("partnerPurchaseIn" + partnerPurchaseIn);
-
 
632
 
-
 
633
		}
-
 
634
 
-
 
635
		LOGGER.info("partnerPurchaseInTT" + partnerPurchaseIn);
-
 
636
		LOGGER.info("partnerCreditedSaleTT" + partnerCreditedSale);
-
 
637
		LOGGER.info("pendingIncomeTT" + pendingIncome);
-
 
638
 
-
 
639
		long totalIncome = partnerCreditedSale + partnerPurchaseIn + pendingIncome + partnerFrontIncome;
-
 
640
 
-
 
641
		long creditedIncome = partnerCreditedSale + partnerPurchaseIn + partnerFrontIncome;
-
 
642
 
-
 
643
		long pendingTotalIncome = pendingIncome;
-
 
644
		LOGGER.info("totalIncome" + totalIncome);
-
 
645
		LOGGER.info("creditedIncome" + creditedIncome);
-
 
646
		LOGGER.info("pendingTotalIncome" + pendingTotalIncome);
-
 
647
 
-
 
648
		model.addAttribute("totalIncome", totalIncome);
-
 
649
		model.addAttribute("creditedIncome", creditedIncome);
-
 
650
		model.addAttribute("pendingTotalIncome", pendingTotalIncome);
-
 
651
 
-
 
652
		Map<Integer, String> monthValueMap = new HashMap<>();
-
 
653
		for (int i = 0; i <= 5; i++) {
-
 
654
			LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
-
 
655
			monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
-
 
656
		}
-
 
657
 
-
 
658
		model.addAttribute("month", yearMonth);
-
 
659
		model.addAttribute("monthValueMap", monthValueMap);
-
 
660
 
-
 
661
		return "partner-total-income";
-
 
662
	}
-
 
663
 
649
	@RequestMapping(value = "/getMonthsInvestment", method = RequestMethod.GET)
664
	@RequestMapping(value = "/getMonthsInvestment", method = RequestMethod.GET)
650
	public String getMonthsInvestment(HttpServletRequest request,
665
	public String getMonthsInvestment(HttpServletRequest request,
651
									  @RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model)
666
			@RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model)
652
			throws Exception {
667
			throws Exception {
653
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
668
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
654
		int fofoId = loginDetails.getFofoId();
669
		int fofoId = loginDetails.getFofoId();
655
		Map<String, Object> investment = fofoUser.getInvestmentsMonths(fofoId, month);
670
		Map<String, Object> investment = fofoUser.getInvestmentsMonths(fofoId, month);
656
 
671
 
Line 736... Line 751...
736
		return "bar_chart";
751
		return "bar_chart";
737
	}
752
	}
738
 
753
 
739
	@RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
754
	@RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
740
	public String getPriceDropDetails(HttpServletRequest request,
755
	public String getPriceDropDetails(HttpServletRequest request,
741
									  @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
756
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
742
									  @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
757
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
743
									  @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
758
			@RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
744
			throws Exception {
759
			throws Exception {
745
 
760
 
746
		LOGGER.info("params" + fofoId + brand + yearMonth);
761
		LOGGER.info("params" + fofoId + brand + yearMonth);
747
 
762
 
748
		List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository
763
		List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository
Line 755... Line 770...
755
		return "price-drop-details";
770
		return "price-drop-details";
756
	}
771
	}
757
 
772
 
758
	@RequestMapping(value = "/getPriceDropDetailSixMonths", method = RequestMethod.GET)
773
	@RequestMapping(value = "/getPriceDropDetailSixMonths", method = RequestMethod.GET)
759
	public String getPriceDropDetailSixMonths(HttpServletRequest request,
774
	public String getPriceDropDetailSixMonths(HttpServletRequest request,
760
											  @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
775
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
761
											  @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
776
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
762
			throws Exception {
777
			throws Exception {
763
 
778
 
764
		LOGGER.info("params" + fofoId + brand);
779
		LOGGER.info("params" + fofoId + brand);
765
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
780
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
766
		LocalDateTime startfMonthSixMonth = curDate.withDayOfMonth(1).minusMonths(12);
781
		LocalDateTime startfMonthSixMonth = curDate.withDayOfMonth(1).minusMonths(12);
Line 962... Line 977...
962
		return "activation-tabular";
977
		return "activation-tabular";
963
	}
978
	}
964
 
979
 
965
	@RequestMapping(value = "/getMonthlyActivationItemDetail", method = RequestMethod.GET)
980
	@RequestMapping(value = "/getMonthlyActivationItemDetail", method = RequestMethod.GET)
966
	public String getMonthlyActivationItemDetail(HttpServletRequest request,
981
	public String getMonthlyActivationItemDetail(HttpServletRequest request,
967
												 @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
982
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
968
												 @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
983
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
969
												 @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
984
			@RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
970
			throws Exception {
985
			throws Exception {
971
 
986
 
972
		LOGGER.info("params" + fofoId + brand + yearMonth);
987
		LOGGER.info("params" + fofoId + brand + yearMonth);
973
 
988
 
974
		List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository
989
		List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository
Line 999... Line 1014...
999
		return "activation-pending-item-details";
1014
		return "activation-pending-item-details";
1000
	}
1015
	}
1001
 
1016
 
1002
	@RequestMapping(value = "/getMonthlyActivationBeforeSixMonthsItemDetail", method = RequestMethod.GET)
1017
	@RequestMapping(value = "/getMonthlyActivationBeforeSixMonthsItemDetail", method = RequestMethod.GET)
1003
	public String getMonthlyActivationItemDetail(HttpServletRequest request,
1018
	public String getMonthlyActivationItemDetail(HttpServletRequest request,
1004
												 @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1019
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1005
												 @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
1020
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
1006
			throws Exception {
1021
			throws Exception {
1007
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1022
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1008
 
1023
 
1009
		LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1024
		LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1010
 
1025
 
Line 1111... Line 1126...
1111
 
1126
 
1112
	}
1127
	}
1113
 
1128
 
1114
	@RequestMapping(value = "/getMonthlyUpgradeOfferItemDetail", method = RequestMethod.GET)
1129
	@RequestMapping(value = "/getMonthlyUpgradeOfferItemDetail", method = RequestMethod.GET)
1115
	public String getMonthlyUpgradeOfferItemDetail(HttpServletRequest request,
1130
	public String getMonthlyUpgradeOfferItemDetail(HttpServletRequest request,
1116
												   @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1131
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1117
												   @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
1132
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
1118
												   @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
1133
			@RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
1119
			throws Exception {
1134
			throws Exception {
1120
 
1135
 
1121
		LOGGER.info("params" + fofoId + brand + yearMonth);
1136
		LOGGER.info("params" + fofoId + brand + yearMonth);
1122
		List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository
1137
		List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository
1123
				.selectUpgradeOfferItemDetails(fofoId, UpgradeOfferStatus.approved, brand, yearMonth);
1138
				.selectUpgradeOfferItemDetails(fofoId, UpgradeOfferStatus.approved, brand, yearMonth);
Line 1127... Line 1142...
1127
		return "upgrade-offer-item-detail";
1142
		return "upgrade-offer-item-detail";
1128
	}
1143
	}
1129
 
1144
 
1130
	@RequestMapping(value = "/getUpgradeOfferBeforeSixMonthItemDetail", method = RequestMethod.GET)
1145
	@RequestMapping(value = "/getUpgradeOfferBeforeSixMonthItemDetail", method = RequestMethod.GET)
1131
	public String getUpgradeOfferBeforeSixMonthItemDetail(HttpServletRequest request,
1146
	public String getUpgradeOfferBeforeSixMonthItemDetail(HttpServletRequest request,
1132
														  @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1147
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1133
														  @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
1148
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
1134
			throws Exception {
1149
			throws Exception {
1135
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1150
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1136
 
1151
 
1137
		LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1152
		LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1138
 
1153
 
Line 1216... Line 1231...
1216
		return "auth_user_partner_detail";
1231
		return "auth_user_partner_detail";
1217
	}
1232
	}
1218
 
1233
 
1219
	@RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
1234
	@RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
1220
	public String getWarehouseWiseBrandStock(HttpServletRequest request, Model model,
1235
	public String getWarehouseWiseBrandStock(HttpServletRequest request, Model model,
1221
											 @RequestParam List<Integer> warehouseId) throws Exception {
1236
			@RequestParam List<Integer> warehouseId) throws Exception {
1222
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1237
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1223
		String email = loginDetails.getEmailId();
1238
		String email = loginDetails.getEmailId();
1224
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1239
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1225
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1240
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1226
		AuthUser authUser = authRepository.selectByEmailOrMobile(email);
1241
		AuthUser authUser = authRepository.selectByEmailOrMobile(email);
Line 1290... Line 1305...
1290
		return "response";
1305
		return "response";
1291
	}
1306
	}
1292
 
1307
 
1293
	@RequestMapping(value = "/getWarehouseWiseBrandAndCategory", method = RequestMethod.GET)
1308
	@RequestMapping(value = "/getWarehouseWiseBrandAndCategory", method = RequestMethod.GET)
1294
	public String getWarehouseWiseBrandAndCategory(HttpServletRequest request, Model model,
1309
	public String getWarehouseWiseBrandAndCategory(HttpServletRequest request, Model model,
1295
												   @RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category)
1310
			@RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category)
1296
			throws Exception {
1311
			throws Exception {
1297
 
1312
 
1298
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1313
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1299
		List<String> listbrands = saholicInventoryCISRepository.selectAllBrand();
1314
		List<String> listbrands = saholicInventoryCISRepository.selectAllBrand();
1300
		List<String> listCategory = saholicInventoryCISRepository.selectAllSubCategory();
1315
		List<String> listCategory = saholicInventoryCISRepository.selectAllSubCategory();
Line 1310... Line 1325...
1310
		return "warehouse_brand_item_stock";
1325
		return "warehouse_brand_item_stock";
1311
	}
1326
	}
1312
 
1327
 
1313
	@RequestMapping(value = "/getWarehouseWiseItemStock", method = RequestMethod.GET)
1328
	@RequestMapping(value = "/getWarehouseWiseItemStock", method = RequestMethod.GET)
1314
	public String getWarehouseWiseItemStock(HttpServletRequest request, Model model,
1329
	public String getWarehouseWiseItemStock(HttpServletRequest request, Model model,
1315
											@RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category)
1330
			@RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category)
1316
			throws Exception {
1331
			throws Exception {
1317
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1332
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1318
		if (warehouseId.contains(0)) {
1333
		if (warehouseId.contains(0)) {
1319
			warehouseId.addAll(warehouseMap.keySet());
1334
			warehouseId.addAll(warehouseMap.keySet());
1320
		}
1335
		}
Line 1381... Line 1396...
1381
		return "warehousewise_brand_partners_sale";
1396
		return "warehousewise_brand_partners_sale";
1382
	}
1397
	}
1383
 
1398
 
1384
	@RequestMapping(value = "/getWarehouseWiseAccesoriesBrandPartnerSale", method = RequestMethod.GET)
1399
	@RequestMapping(value = "/getWarehouseWiseAccesoriesBrandPartnerSale", method = RequestMethod.GET)
1385
	public String getWarehouseWiseAccesoriesBrandPartnerSale(HttpServletRequest request, Model model,
1400
	public String getWarehouseWiseAccesoriesBrandPartnerSale(HttpServletRequest request, Model model,
1386
															 @RequestParam String brand) throws Exception {
1401
			@RequestParam String brand) throws Exception {
1387
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1402
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1388
		String email = loginDetails.getEmailId();
1403
		String email = loginDetails.getEmailId();
1389
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1404
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1390
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1405
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1391
 
1406
 
Line 1410... Line 1425...
1410
		return "warehousewise_accessoriesbrand_sale";
1425
		return "warehousewise_accessoriesbrand_sale";
1411
	}
1426
	}
1412
 
1427
 
1413
	@RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
1428
	@RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
1414
	public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model model,
1429
	public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model model,
1415
												@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1430
			@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1416
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1431
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1417
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1432
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1418
		String email = loginDetails.getEmailId();
1433
		String email = loginDetails.getEmailId();
1419
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1434
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1420
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1435
		Set<Integer> authfofoIds = storeGuyMap.get(email);
Line 1454... Line 1469...
1454
		return "warehouse_partner_itemwise_sale";
1469
		return "warehouse_partner_itemwise_sale";
1455
	}
1470
	}
1456
 
1471
 
1457
	@RequestMapping(value = "/getWarehouseAccesoriesBrandWiseItemSale", method = RequestMethod.GET)
1472
	@RequestMapping(value = "/getWarehouseAccesoriesBrandWiseItemSale", method = RequestMethod.GET)
1458
	public String getWarehouseAccesoriesBrandWiseItemSale(HttpServletRequest request, Model model,
1473
	public String getWarehouseAccesoriesBrandWiseItemSale(HttpServletRequest request, Model model,
1459
														  @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1474
			@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1460
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1475
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1461
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1476
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1462
		String email = loginDetails.getEmailId();
1477
		String email = loginDetails.getEmailId();
1463
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1478
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1464
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1479
		Set<Integer> authfofoIds = storeGuyMap.get(email);
Line 1475... Line 1490...
1475
		return "contact-us";
1490
		return "contact-us";
1476
	}
1491
	}
1477
 
1492
 
1478
	@RequestMapping(value = "/notifications", method = RequestMethod.GET)
1493
	@RequestMapping(value = "/notifications", method = RequestMethod.GET)
1479
	public String getNotificationsWithType(HttpServletRequest request,
1494
	public String getNotificationsWithType(HttpServletRequest request,
1480
										   @RequestParam(required = false) MessageType messageType,
1495
			@RequestParam(required = false) MessageType messageType,
1481
										   @RequestParam(name = "offset", defaultValue = "0") int offset,
1496
			@RequestParam(name = "offset", defaultValue = "0") int offset,
1482
										   @RequestParam(name = "limit", defaultValue = "20") int limit, Model model) throws Exception {
1497
			@RequestParam(name = "limit", defaultValue = "20") int limit, Model model) throws Exception {
1483
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1498
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1484
		int userId = 0;
1499
		int userId = 0;
1485
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
1500
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
1486
		if (isAdmin) {
1501
		if (isAdmin) {
1487
			userId = loginDetails.getFofoId();
1502
			userId = loginDetails.getFofoId();
Line 1501... Line 1516...
1501
		return "notification-template";
1516
		return "notification-template";
1502
	}
1517
	}
1503
 
1518
 
1504
	@RequestMapping(value = "/notifyDocument/documentId", method = RequestMethod.GET)
1519
	@RequestMapping(value = "/notifyDocument/documentId", method = RequestMethod.GET)
1505
	public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
1520
	public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
1506
												  @RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam int cid)
1521
			@RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam int cid)
1507
			throws ProfitMandiBusinessException {
1522
			throws ProfitMandiBusinessException {
1508
		Document document = documentRepository.selectById(documentId);
1523
		Document document = documentRepository.selectById(documentId);
1509
		NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1524
		NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1510
		if (nc.getDocumentId() == null) {
1525
		if (nc.getDocumentId() == null) {
1511
			throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
1526
			throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
Line 1555... Line 1570...
1555
		return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
1570
		return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
1556
	}
1571
	}
1557
 
1572
 
1558
	@RequestMapping(value = "/getItemWiseTertiary", method = RequestMethod.GET)
1573
	@RequestMapping(value = "/getItemWiseTertiary", method = RequestMethod.GET)
1559
	public String getItemWiseTertiary(HttpServletRequest request,
1574
	public String getItemWiseTertiary(HttpServletRequest request,
1560
									  @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model)
1575
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model)
1561
			throws ProfitMandiBusinessException {
1576
			throws ProfitMandiBusinessException {
1562
		List<ItemWiseTertiaryModel> itemWiseTertiary = fofoOrderRepository.SelectItemWiseTertiary(fofoId);
1577
		List<ItemWiseTertiaryModel> itemWiseTertiary = fofoOrderRepository.SelectItemWiseTertiary(fofoId);
1563
 
1578
 
1564
		LOGGER.info("itemWiseTertiary" + itemWiseTertiary);
1579
		LOGGER.info("itemWiseTertiary" + itemWiseTertiary);
1565
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1580
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
Line 1568... Line 1583...
1568
		return "item-wise-tertiary";
1583
		return "item-wise-tertiary";
1569
	}
1584
	}
1570
 
1585
 
1571
	@RequestMapping(value = "/getItemWiseIndent", method = RequestMethod.GET)
1586
	@RequestMapping(value = "/getItemWiseIndent", method = RequestMethod.GET)
1572
	public String getItemWiseIndent(HttpServletRequest request,
1587
	public String getItemWiseIndent(HttpServletRequest request,
1573
									@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model)
1588
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model)
1574
			throws ProfitMandiBusinessException {
1589
			throws ProfitMandiBusinessException {
1575
 
1590
 
1576
		List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoId);
1591
		List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoId);
1577
		model.addAttribute("unbilledOrders", unbilledOrders);
1592
		model.addAttribute("unbilledOrders", unbilledOrders);
1578
 
1593
 
1579
		return "item-wise-indent";
1594
		return "item-wise-indent";
1580
	}
1595
	}
1581
 
1596
 
1582
	@RequestMapping(value = "/getPartnerInvestment", method = RequestMethod.GET)
1597
	@RequestMapping(value = "/getPartnerInvestment", method = RequestMethod.GET)
1583
	public String getPartnerInvestment(HttpServletRequest request,
1598
	public String getPartnerInvestment(HttpServletRequest request,
1584
									   @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1599
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1585
		Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
1600
		Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
1586
		PartnerDetailModel partnerDetailModel = partnerStats.get(fofoId);
1601
		PartnerDetailModel partnerDetailModel = partnerStats.get(fofoId);
1587
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1602
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1588
		model.addAttribute("partnerDetailModel", partnerDetailModel);
1603
		model.addAttribute("partnerDetailModel", partnerDetailModel);
1589
		model.addAttribute("customRetailer", customRetailer);
1604
		model.addAttribute("customRetailer", customRetailer);
1590
		return "partner-investment";
1605
		return "partner-investment";
1591
	}
1606
	}
1592
 
1607
 
1593
	@RequestMapping(value = "/getPartnerPendingIndentItem", method = RequestMethod.GET)
1608
	@RequestMapping(value = "/getPartnerPendingIndentItem", method = RequestMethod.GET)
1594
	public String getPartnerPendingIndentItem(HttpServletRequest request, @RequestParam int warehouseId,
1609
	public String getPartnerPendingIndentItem(HttpServletRequest request, @RequestParam int warehouseId,
1595
											  @RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
1610
			@RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
1596
		List<PartnerPendingIndentItemModel> partnerPendingIndent = fofoStoreRepository
1611
		List<PartnerPendingIndentItemModel> partnerPendingIndent = fofoStoreRepository
1597
				.selectPartnerPendingIndentItem(itemId, warehouseId);
1612
				.selectPartnerPendingIndentItem(itemId, warehouseId);
1598
 
1613
 
1599
		model.addAttribute("partnerPendingIndent", partnerPendingIndent);
1614
		model.addAttribute("partnerPendingIndent", partnerPendingIndent);
1600
		return "partner-pending-indent-item";
1615
		return "partner-pending-indent-item";
1601
	}
1616
	}
1602
 
1617
 
1603
	@RequestMapping(value = "/getPatnerActivateStock", method = RequestMethod.GET)
1618
	@RequestMapping(value = "/getPatnerActivateStock", method = RequestMethod.GET)
1604
	public String getPartnerActivateStockItem(HttpServletRequest request,
1619
	public String getPartnerActivateStockItem(HttpServletRequest request,
1605
											  @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1620
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1606
		List<ActivateItemModel> activateStocks = new ArrayList<>();
1621
		List<ActivateItemModel> activateStocks = new ArrayList<>();
1607
		List<InventoryItem> inventoryItems = inventoryItemRepository.selectByActivatedNotSold(fofoId);
1622
		List<InventoryItem> inventoryItems = inventoryItemRepository.selectByActivatedNotSold(fofoId);
1608
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1623
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1609
 
1624
 
1610
		for (InventoryItem inventoryItem : inventoryItems) {
1625
		for (InventoryItem inventoryItem : inventoryItems) {
Line 1624... Line 1639...
1624
		return "partner-activate-stock";
1639
		return "partner-activate-stock";
1625
	}
1640
	}
1626
 
1641
 
1627
	@RequestMapping(value = "/getPatnerBrandWiseMTDSale", method = RequestMethod.GET)
1642
	@RequestMapping(value = "/getPatnerBrandWiseMTDSale", method = RequestMethod.GET)
1628
	public String getPatnerBrandWiseMTDSale(HttpServletRequest request,
1643
	public String getPatnerBrandWiseMTDSale(HttpServletRequest request,
1629
											@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1644
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1630
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1645
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1631
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1646
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1632
		Map<String, Double> brandMtdAmount = fofoOrderItemRepository
1647
		Map<String, Double> brandMtdAmount = fofoOrderItemRepository
1633
				.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1648
				.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1634
		Map<String, Long> brandMtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate.withDayOfMonth(1),
1649
		Map<String, Long> brandMtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate.withDayOfMonth(1),
Line 1648... Line 1663...
1648
		return "partner-brand-mtd-sale";
1663
		return "partner-brand-mtd-sale";
1649
	}
1664
	}
1650
 
1665
 
1651
	@RequestMapping(value = "/getPatnerBrandWiseLMTDSale", method = RequestMethod.GET)
1666
	@RequestMapping(value = "/getPatnerBrandWiseLMTDSale", method = RequestMethod.GET)
1652
	public String getPatnerBrandWiseLMTDSale(HttpServletRequest request,
1667
	public String getPatnerBrandWiseLMTDSale(HttpServletRequest request,
1653
											 @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1668
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1654
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1669
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1655
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1670
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1656
		Map<String, Double> brandLMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1671
		Map<String, Double> brandLMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1657
				curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
1672
				curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
1658
		Map<String, Long> brandLmtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(
1673
		Map<String, Long> brandLmtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(
Line 1674... Line 1689...
1674
		return "partner-brand-lmtd-sale";
1689
		return "partner-brand-lmtd-sale";
1675
	}
1690
	}
1676
 
1691
 
1677
	@RequestMapping(value = "/getPatnerBrandWiseLMSSale", method = RequestMethod.GET)
1692
	@RequestMapping(value = "/getPatnerBrandWiseLMSSale", method = RequestMethod.GET)
1678
	public String getPatnerBrandWiseLMSSale(HttpServletRequest request,
1693
	public String getPatnerBrandWiseLMSSale(HttpServletRequest request,
1679
											@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1694
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1680
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1695
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1681
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1696
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1682
		int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1697
		int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1683
 
1698
 
1684
		Map<String, Double> brandLMSAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1699
		Map<String, Double> brandLMSAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
Line 1701... Line 1716...
1701
		return "partner-brand-lms-sale";
1716
		return "partner-brand-lms-sale";
1702
	}
1717
	}
1703
 
1718
 
1704
	@RequestMapping(value = "/getPatnerInStock", method = RequestMethod.GET)
1719
	@RequestMapping(value = "/getPatnerInStock", method = RequestMethod.GET)
1705
	public String getPatnerInStock(HttpServletRequest request,
1720
	public String getPatnerInStock(HttpServletRequest request,
1706
								   @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1721
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1707
 
1722
 
1708
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1723
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1709
 
1724
 
1710
		List<InStockBrandModel> mobileStocks = currentInventorySnapshotRepository
1725
		List<InStockBrandModel> mobileStocks = currentInventorySnapshotRepository
1711
				.selectSumInStockMobileGroupByBrand(fofoId);
1726
				.selectSumInStockMobileGroupByBrand(fofoId);
Line 1725... Line 1740...
1725
		return "partner-instock-item";
1740
		return "partner-instock-item";
1726
	}
1741
	}
1727
 
1742
 
1728
	@RequestMapping(value = "/getOpenTicketByFofoId", method = RequestMethod.GET)
1743
	@RequestMapping(value = "/getOpenTicketByFofoId", method = RequestMethod.GET)
1729
	public String getOpenTicketByFofoId(HttpServletRequest request,
1744
	public String getOpenTicketByFofoId(HttpServletRequest request,
1730
										@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1745
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1731
		Map<Integer, AuthUser> ticketIdAuthUser = new HashMap<>();
1746
		Map<Integer, AuthUser> ticketIdAuthUser = new HashMap<>();
1732
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1747
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1733
		List<Integer> ticketIds = ticketRepository.selectAllOpenTicketByRetailer(fofoId).stream().map(x -> x.getId())
1748
		List<Integer> ticketIds = ticketRepository.selectAllOpenTicketByRetailer(fofoId).stream().map(x -> x.getId())
1734
				.collect(Collectors.toList());
1749
				.collect(Collectors.toList());
1735
		List<TicketAssigned> ticketAssigns = ticketAssignedRepository.selectByTicketIds(ticketIds);
1750
		List<TicketAssigned> ticketAssigns = ticketAssignedRepository.selectByTicketIds(ticketIds);
Line 1744... Line 1759...
1744
		return "open-ticket";
1759
		return "open-ticket";
1745
	}
1760
	}
1746
 
1761
 
1747
	@RequestMapping(value = "/getPartnerSecondarySale", method = RequestMethod.GET)
1762
	@RequestMapping(value = "/getPartnerSecondarySale", method = RequestMethod.GET)
1748
	public String getPartnerSecondarySale(HttpServletRequest request,
1763
	public String getPartnerSecondarySale(HttpServletRequest request,
1749
										  @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, @RequestParam String timeValue, Model model)
1764
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, @RequestParam String timeValue, Model model)
1750
			throws Exception {
1765
			throws Exception {
1751
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1766
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1752
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1767
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1753
		int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1768
		int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1754
		LocalDateTime startDate = null;
1769
		LocalDateTime startDate = null;
Line 1877... Line 1892...
1877
		return "accessories-brand-wise-report";
1892
		return "accessories-brand-wise-report";
1878
	}
1893
	}
1879
 
1894
 
1880
	@RequestMapping(value = "/getMobileLMSGraph", method = RequestMethod.GET)
1895
	@RequestMapping(value = "/getMobileLMSGraph", method = RequestMethod.GET)
1881
	public String getMobileLMSGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
1896
	public String getMobileLMSGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
1882
									@RequestParam(required = false) LocalDate date, @RequestParam List<Integer> fofoIds, Model model)
1897
			@RequestParam(required = false) LocalDate date, @RequestParam List<Integer> fofoIds, Model model)
1883
			throws Exception {
1898
			throws Exception {
1884
		Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
1899
		Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
1885
				.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1900
				.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1886
						FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1901
						FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1887
 
1902
 
Line 1900... Line 1915...
1900
		return "brand-wise-mobile-lms-chart";
1915
		return "brand-wise-mobile-lms-chart";
1901
	}
1916
	}
1902
 
1917
 
1903
	@RequestMapping(value = "/getMobileLMSFilter", method = RequestMethod.GET)
1918
	@RequestMapping(value = "/getMobileLMSFilter", method = RequestMethod.GET)
1904
	public String getMobileLMSFilter(HttpServletRequest request,
1919
	public String getMobileLMSFilter(HttpServletRequest request,
1905
									 @RequestParam(required = false, defaultValue = "0") int warehouseId,
1920
			@RequestParam(required = false, defaultValue = "0") int warehouseId,
1906
									 @RequestParam(required = false) LocalDate date, Model model) throws Exception {
1921
			@RequestParam(required = false) LocalDate date, Model model) throws Exception {
1907
 
1922
 
1908
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1923
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1909
		String email = loginDetails.getEmailId();
1924
		String email = loginDetails.getEmailId();
1910
		Map<String, Object> map = adminUser.getFilter(warehouseId, email, date);
1925
		Map<String, Object> map = adminUser.getFilter(warehouseId, email, date);
1911
		model.addAttribute("warehouseId", warehouseId);
1926
		model.addAttribute("warehouseId", warehouseId);
Line 1914... Line 1929...
1914
		return "chart-filter-lms";
1929
		return "chart-filter-lms";
1915
	}
1930
	}
1916
 
1931
 
1917
	@RequestMapping(value = "/getMobileLMPFilter", method = RequestMethod.GET)
1932
	@RequestMapping(value = "/getMobileLMPFilter", method = RequestMethod.GET)
1918
	public String getMobileLMPFilter(HttpServletRequest request,
1933
	public String getMobileLMPFilter(HttpServletRequest request,
1919
									 @RequestParam(required = false, defaultValue = "0") int warehouseId,
1934
			@RequestParam(required = false, defaultValue = "0") int warehouseId,
1920
									 @RequestParam(required = false) LocalDate date, Model model) throws Exception {
1935
			@RequestParam(required = false) LocalDate date, Model model) throws Exception {
1921
 
1936
 
1922
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1937
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1923
		String email = loginDetails.getEmailId();
1938
		String email = loginDetails.getEmailId();
1924
		Map<String, Object> map = adminUser.getFilter(warehouseId, email, date);
1939
		Map<String, Object> map = adminUser.getFilter(warehouseId, email, date);
1925
		model.addAttribute("warehouseId", warehouseId);
1940
		model.addAttribute("warehouseId", warehouseId);
Line 1928... Line 1943...
1928
		return "chart-filter-lmp";
1943
		return "chart-filter-lmp";
1929
	}
1944
	}
1930
 
1945
 
1931
	@RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
1946
	@RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
1932
	public String getMobileLMPGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
1947
	public String getMobileLMPGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
1933
									@RequestParam(required = false) LocalDate date, @RequestParam List<Integer> fofoIds, Model model)
1948
			@RequestParam(required = false) LocalDate date, @RequestParam List<Integer> fofoIds, Model model)
1934
			throws Exception {
1949
			throws Exception {
1935
		Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
1950
		Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
1936
				.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1951
				.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1937
						FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1952
						FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1938
 
1953