Subversion Repositories SmartDukaan

Rev

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

Rev 30455 Rev 30564
Line 82... Line 82...
82
@Controller
82
@Controller
83
@Transactional(rollbackOn = Throwable.class)
83
@Transactional(rollbackOn = Throwable.class)
84
public class DashboardController {
84
public class DashboardController {
85
 
85
 
86
	List<String> emails = Arrays.asList("kamini.sharma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
86
	List<String> emails = Arrays.asList("kamini.sharma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
87
			"niranjan.kala@smartdukaan.com", "hemant.kaura@smartdukaan.com", "amit.gupta@shop2020.in",
87
			"niranjan.kala@smartdukaan.com", "hemant.kaura@smartdukaan.com", "amit.gupta@smartdukaan.com",
88
			"tejbeer.kaur@shop2020.in");
88
			"tejbeer.kaur@smartdukaan.com");
89
 
89
 
90
	@Value("${web.api.host}")
90
	@Value("${web.api.host}")
91
	private String webApiHost;
91
	private String webApiHost;
92
 
92
 
93
	@Value("${web.api.scheme}")
93
	@Value("${web.api.scheme}")
Line 350... Line 350...
350
				orderStatus.add(SHIPPED_FROM_WH);
350
				orderStatus.add(SHIPPED_FROM_WH);
351
				orderStatus.add(DELIVERY_SUCCESS);
351
				orderStatus.add(DELIVERY_SUCCESS);
352
 
352
 
353
				List<Order> openOrders = orderRepository.selectGrnTimestampNull(fofoId, orderStatus);
353
				List<Order> openOrders = orderRepository.selectGrnTimestampNull(fofoId, orderStatus);
354
				List<LineItem> submittedLineItemIds = openOrders.stream()
354
				List<LineItem> submittedLineItemIds = openOrders.stream()
355
						.filter(x -> x.getStatus().equals(SUBMITTED_FOR_PROCESSING))
355
						.filter(x -> x.getStatus().equals(SUBMITTED_FOR_PROCESSING)).map(x -> x.getLineItem())
-
 
356
						.collect(Collectors.toList());
-
 
357
				List<LineItem> billedOrderIds = openOrders.stream().filter(x -> x.getStatus().equals(BILLED))
356
						.map(x -> x.getLineItem()).collect(Collectors.toList());
358
						.map(x -> x.getLineItem()).collect(Collectors.toList());
357
				List<LineItem> billedOrderIds = openOrders.stream()
-
 
358
						.filter(x -> x.getStatus().equals(BILLED))
-
 
359
						.map(x -> x.getLineItem()).collect(Collectors.toList());
-
 
360
				List<LineItem> shippedOrderIds = openOrders.stream()
359
				List<LineItem> shippedOrderIds = openOrders.stream().filter(x -> x.getStatus().equals(SHIPPED_FROM_WH))
361
						.filter(x -> x.getStatus().equals(SHIPPED_FROM_WH))
-
 
362
						.map(x -> x.getLineItem()).collect(Collectors.toList());
360
						.map(x -> x.getLineItem()).collect(Collectors.toList());
363
				List<LineItem> grnPendingLineItemIds = openOrders.stream()
361
				List<LineItem> grnPendingLineItemIds = openOrders.stream()
364
						.filter(x -> x.getStatus().equals(DELIVERY_SUCCESS))
362
						.filter(x -> x.getStatus().equals(DELIVERY_SUCCESS)).map(x -> x.getLineItem())
365
						.map(x -> x.getLineItem()).collect(Collectors.toList());
363
						.collect(Collectors.toList());
366
 
-
 
367
 
364
 
368
				long imeiActivationPendingCount = 0;
365
				long imeiActivationPendingCount = 0;
369
				long imeiActivationPendingValue = 0;
366
				long imeiActivationPendingValue = 0;
-
 
367
				List<Integer> grnPendingOrderIds = openOrders.stream()
370
				List<Integer> grnPendingOrderIds = openOrders.stream().filter(x -> x.getStatus().equals(SHIPPED_FROM_WH) || x.getStatus().equals(DELIVERY_SUCCESS)).map(x -> x.getId()).collect(Collectors.toList());
368
						.filter(x -> x.getStatus().equals(SHIPPED_FROM_WH) || x.getStatus().equals(DELIVERY_SUCCESS))
-
 
369
						.map(x -> x.getId()).collect(Collectors.toList());
371
				if (grnPendingOrderIds.size() > 0) {
370
				if (grnPendingOrderIds.size() > 0) {
372
					List<ImeiActivationTimestampModel> imeiActivationTimestampModels = activatedImeiRepository.selectActivatedImeisByOrders(grnPendingOrderIds);
371
					List<ImeiActivationTimestampModel> imeiActivationTimestampModels = activatedImeiRepository
-
 
372
							.selectActivatedImeisByOrders(grnPendingOrderIds);
373
					imeiActivationPendingCount = imeiActivationTimestampModels.size();
373
					imeiActivationPendingCount = imeiActivationTimestampModels.size();
-
 
374
					imeiActivationPendingValue = imeiActivationTimestampModels.stream()
374
					imeiActivationPendingValue = imeiActivationTimestampModels.stream().collect(Collectors.summingDouble(x -> x.getSellingPrice())).longValue();
375
							.collect(Collectors.summingDouble(x -> x.getSellingPrice())).longValue();
375
				}
376
				}
376
 
377
 
377
 
-
 
-
 
378
				long grnPendingCount = grnPendingLineItemIds.stream()
378
				long grnPendingCount = grnPendingLineItemIds.stream().collect(Collectors.summingLong(LineItem::getQuantity));
379
						.collect(Collectors.summingLong(LineItem::getQuantity));
379
				long grnPendingValue = grnPendingLineItemIds.stream()
380
				long grnPendingValue = grnPendingLineItemIds.stream()
380
						.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
381
						.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
381
				model.addAttribute("grnPendingCount", grnPendingCount);
382
				model.addAttribute("grnPendingCount", grnPendingCount);
382
				model.addAttribute("grnPendingValue", grnPendingValue);
383
				model.addAttribute("grnPendingValue", grnPendingValue);
383
 
384
 
-
 
385
				long submittedCount = submittedLineItemIds.stream()
384
				long submittedCount = submittedLineItemIds.stream().collect(Collectors.summingLong(LineItem::getQuantity));
386
						.collect(Collectors.summingLong(LineItem::getQuantity));
385
				long submittedValue = submittedLineItemIds.stream()
387
				long submittedValue = submittedLineItemIds.stream()
386
						.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
388
						.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
387
				model.addAttribute("submittedCount", submittedCount);
389
				model.addAttribute("submittedCount", submittedCount);
388
				model.addAttribute("submittedValue", submittedValue);
390
				model.addAttribute("submittedValue", submittedValue);
389
 
391
 
390
				long billedCount = billedOrderIds.stream().collect(Collectors.summingLong(LineItem::getQuantity));
392
				long billedCount = billedOrderIds.stream().collect(Collectors.summingLong(LineItem::getQuantity));
-
 
393
				long billedValue = billedOrderIds.stream()
391
				long billedValue = billedOrderIds.stream().collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
394
						.collect(Collectors.summingLong(x -> x.getTotalPrice().longValue()));
392
				model.addAttribute("billedValue", billedValue);
395
				model.addAttribute("billedValue", billedValue);
393
				model.addAttribute("billedCount", billedCount);
396
				model.addAttribute("billedCount", billedCount);
394
				LOGGER.info("billedCount {}", billedCount);
397
				LOGGER.info("billedCount {}", billedCount);
395
 
398
 
396
				long shippedCount = shippedOrderIds.stream().collect(Collectors.summingLong(LineItem::getQuantity));
399
				long shippedCount = shippedOrderIds.stream().collect(Collectors.summingLong(LineItem::getQuantity));
Line 421... Line 424...
421
				model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
424
				model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
422
				model.addAttribute("retailers", new JSONObject().append("code", fofoStore.getCode())
425
				model.addAttribute("retailers", new JSONObject().append("code", fofoStore.getCode())
423
						.append("partnerId", fofoStore.getId()).toString());
426
						.append("partnerId", fofoStore.getId()).toString());
424
				model.addAttribute("activatedImeis",
427
				model.addAttribute("activatedImeis",
425
						inventoryItemRepository.selectCountByActivatedNotSold(loginDetails.getFofoId()));
428
						inventoryItemRepository.selectCountByActivatedNotSold(loginDetails.getFofoId()));
426
				model.addAttribute("imeiActivationPendingCount",
429
				model.addAttribute("imeiActivationPendingCount", imeiActivationPendingCount);
427
						imeiActivationPendingCount);
-
 
428
				model.addAttribute("imeiActivationPendingValue",
430
				model.addAttribute("imeiActivationPendingValue", imeiActivationPendingValue);
429
						imeiActivationPendingValue);
-
 
430
 
431
 
431
				Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository
432
				Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository
432
						.selectSumSaleGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
433
						.selectSumSaleGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
433
								curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
434
								curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
434
 
435
 
Line 450... Line 451...
450
				model.addAttribute("publishedOffers", publishedOffers);
451
				model.addAttribute("publishedOffers", publishedOffers);
451
				model.addAttribute("investments", fofoUser.getInvestments(loginDetails.getFofoId()));
452
				model.addAttribute("investments", fofoUser.getInvestments(loginDetails.getFofoId()));
452
				model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(),
453
				model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(),
453
						10, ProfitMandiConstants.CUTOFF_INVESTMENT));
454
						10, ProfitMandiConstants.CUTOFF_INVESTMENT));
454
 
455
 
455
				double currentMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), currentMonthStart,
456
				double currentMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(),
456
						currentMonthEnd) / 2;
457
						currentMonthStart, currentMonthEnd) / 2;
457
				double lastMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), lastMonthStart,
458
				double lastMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), lastMonthStart,
458
						currentMonthStart) / 2;
459
						currentMonthStart) / 2;
459
				double ratingTillDate = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), LocalDateTime.MIN,
460
				double ratingTillDate = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(),
460
						currentMonthEnd) / 2;
461
						LocalDateTime.MIN, currentMonthEnd) / 2;
461
				model.addAttribute("currentMonthRating", (float) Math.round(currentMonthRating * 10) / 10);
462
				model.addAttribute("currentMonthRating", (float) Math.round(currentMonthRating * 10) / 10);
462
				model.addAttribute("lastMonthRating", (float) Math.round(lastMonthRating * 10) / 10);
463
				model.addAttribute("lastMonthRating", (float) Math.round(lastMonthRating * 10) / 10);
463
				model.addAttribute("ratingTillDate", (float) Math.round(ratingTillDate * 10) / 10);
464
				model.addAttribute("ratingTillDate", (float) Math.round(ratingTillDate * 10) / 10);
464
 
465
 
465
				long hygieneCount = hygieneDataRepository.selectHygieneCount(loginDetails.getFofoId(), true, currentMonthStart,
466
				long hygieneCount = hygieneDataRepository.selectHygieneCount(loginDetails.getFofoId(), true,
466
						currentMonthEnd);
467
						currentMonthStart, currentMonthEnd);
467
 
468
 
468
				long invalidHygieneCount = hygieneDataRepository.selectHygieneCount(loginDetails.getFofoId(), false,
469
				long invalidHygieneCount = hygieneDataRepository.selectHygieneCount(loginDetails.getFofoId(), false,
469
						currentMonthStart, currentMonthEnd);
470
						currentMonthStart, currentMonthEnd);
470
				if (hygieneCount == 0 && invalidHygieneCount == 0) {
471
				if (hygieneCount == 0 && invalidHygieneCount == 0) {
471
					invalidHygieneCount = 1;
472
					invalidHygieneCount = 1;
Line 667... Line 668...
667
		return "partner-total-income";
668
		return "partner-total-income";
668
	}
669
	}
669
 
670
 
670
	@RequestMapping(value = "/getMonthsInvestment", method = RequestMethod.GET)
671
	@RequestMapping(value = "/getMonthsInvestment", method = RequestMethod.GET)
671
	public String getMonthsInvestment(HttpServletRequest request,
672
	public String getMonthsInvestment(HttpServletRequest request,
672
									  @RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model)
673
			@RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model)
673
			throws Exception {
674
			throws Exception {
674
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
675
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
675
		int fofoId = loginDetails.getFofoId();
676
		int fofoId = loginDetails.getFofoId();
676
		Map<String, Object> investment = fofoUser.getInvestmentsMonths(fofoId, month);
677
		Map<String, Object> investment = fofoUser.getInvestmentsMonths(fofoId, month);
677
 
678
 
Line 757... Line 758...
757
		return "bar_chart";
758
		return "bar_chart";
758
	}
759
	}
759
 
760
 
760
	@RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
761
	@RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
761
	public String getPriceDropDetails(HttpServletRequest request,
762
	public String getPriceDropDetails(HttpServletRequest request,
762
									  @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
763
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
763
									  @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
764
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
764
									  @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
765
			@RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
765
			throws Exception {
766
			throws Exception {
766
 
767
 
767
		LOGGER.info("params" + fofoId + brand + yearMonth);
768
		LOGGER.info("params" + fofoId + brand + yearMonth);
768
 
769
 
769
		List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository
770
		List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository
Line 776... Line 777...
776
		return "price-drop-details";
777
		return "price-drop-details";
777
	}
778
	}
778
 
779
 
779
	@RequestMapping(value = "/getPriceDropDetailSixMonths", method = RequestMethod.GET)
780
	@RequestMapping(value = "/getPriceDropDetailSixMonths", method = RequestMethod.GET)
780
	public String getPriceDropDetailSixMonths(HttpServletRequest request,
781
	public String getPriceDropDetailSixMonths(HttpServletRequest request,
781
											  @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
782
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
782
											  @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
783
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
783
			throws Exception {
784
			throws Exception {
784
 
785
 
785
		LOGGER.info("params" + fofoId + brand);
786
		LOGGER.info("params" + fofoId + brand);
786
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
787
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
787
		LocalDateTime startfMonthSixMonth = curDate.withDayOfMonth(1).minusMonths(12);
788
		LocalDateTime startfMonthSixMonth = curDate.withDayOfMonth(1).minusMonths(12);
Line 983... Line 984...
983
		return "activation-tabular";
984
		return "activation-tabular";
984
	}
985
	}
985
 
986
 
986
	@RequestMapping(value = "/getMonthlyActivationItemDetail", method = RequestMethod.GET)
987
	@RequestMapping(value = "/getMonthlyActivationItemDetail", method = RequestMethod.GET)
987
	public String getMonthlyActivationItemDetail(HttpServletRequest request,
988
	public String getMonthlyActivationItemDetail(HttpServletRequest request,
988
												 @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
989
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
989
												 @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
990
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
990
												 @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
991
			@RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
991
			throws Exception {
992
			throws Exception {
992
 
993
 
993
		LOGGER.info("params" + fofoId + brand + yearMonth);
994
		LOGGER.info("params" + fofoId + brand + yearMonth);
994
 
995
 
995
		List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository
996
		List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository
Line 1020... Line 1021...
1020
		return "activation-pending-item-details";
1021
		return "activation-pending-item-details";
1021
	}
1022
	}
1022
 
1023
 
1023
	@RequestMapping(value = "/getMonthlyActivationBeforeSixMonthsItemDetail", method = RequestMethod.GET)
1024
	@RequestMapping(value = "/getMonthlyActivationBeforeSixMonthsItemDetail", method = RequestMethod.GET)
1024
	public String getMonthlyActivationItemDetail(HttpServletRequest request,
1025
	public String getMonthlyActivationItemDetail(HttpServletRequest request,
1025
												 @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1026
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1026
												 @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
1027
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
1027
			throws Exception {
1028
			throws Exception {
1028
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1029
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1029
 
1030
 
1030
		LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1031
		LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1031
 
1032
 
Line 1132... Line 1133...
1132
 
1133
 
1133
	}
1134
	}
1134
 
1135
 
1135
	@RequestMapping(value = "/getMonthlyUpgradeOfferItemDetail", method = RequestMethod.GET)
1136
	@RequestMapping(value = "/getMonthlyUpgradeOfferItemDetail", method = RequestMethod.GET)
1136
	public String getMonthlyUpgradeOfferItemDetail(HttpServletRequest request,
1137
	public String getMonthlyUpgradeOfferItemDetail(HttpServletRequest request,
1137
												   @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1138
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1138
												   @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
1139
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
1139
												   @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
1140
			@RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model)
1140
			throws Exception {
1141
			throws Exception {
1141
 
1142
 
1142
		LOGGER.info("params" + fofoId + brand + yearMonth);
1143
		LOGGER.info("params" + fofoId + brand + yearMonth);
1143
		List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository
1144
		List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository
1144
				.selectUpgradeOfferItemDetails(fofoId, UpgradeOfferStatus.approved, brand, yearMonth);
1145
				.selectUpgradeOfferItemDetails(fofoId, UpgradeOfferStatus.approved, brand, yearMonth);
Line 1148... Line 1149...
1148
		return "upgrade-offer-item-detail";
1149
		return "upgrade-offer-item-detail";
1149
	}
1150
	}
1150
 
1151
 
1151
	@RequestMapping(value = "/getUpgradeOfferBeforeSixMonthItemDetail", method = RequestMethod.GET)
1152
	@RequestMapping(value = "/getUpgradeOfferBeforeSixMonthItemDetail", method = RequestMethod.GET)
1152
	public String getUpgradeOfferBeforeSixMonthItemDetail(HttpServletRequest request,
1153
	public String getUpgradeOfferBeforeSixMonthItemDetail(HttpServletRequest request,
1153
														  @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1154
			@RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
1154
														  @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
1155
			@RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model)
1155
			throws Exception {
1156
			throws Exception {
1156
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1157
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1157
 
1158
 
1158
		LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1159
		LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1159
 
1160
 
Line 1237... Line 1238...
1237
		return "auth_user_partner_detail";
1238
		return "auth_user_partner_detail";
1238
	}
1239
	}
1239
 
1240
 
1240
	@RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
1241
	@RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
1241
	public String getWarehouseWiseBrandStock(HttpServletRequest request, Model model,
1242
	public String getWarehouseWiseBrandStock(HttpServletRequest request, Model model,
1242
											 @RequestParam List<Integer> warehouseId) throws Exception {
1243
			@RequestParam List<Integer> warehouseId) throws Exception {
1243
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1244
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1244
		String email = loginDetails.getEmailId();
1245
		String email = loginDetails.getEmailId();
1245
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1246
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1246
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1247
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1247
		AuthUser authUser = authRepository.selectByEmailOrMobile(email);
1248
		AuthUser authUser = authRepository.selectByEmailOrMobile(email);
Line 1282... Line 1283...
1282
		return "response";
1283
		return "response";
1283
	}
1284
	}
1284
 
1285
 
1285
	@RequestMapping(value = "/getWarehouseWiseBrandAndCategory", method = RequestMethod.GET)
1286
	@RequestMapping(value = "/getWarehouseWiseBrandAndCategory", method = RequestMethod.GET)
1286
	public String getWarehouseWiseBrandAndCategory(HttpServletRequest request, Model model,
1287
	public String getWarehouseWiseBrandAndCategory(HttpServletRequest request, Model model,
1287
												   @RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category)
1288
			@RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category)
1288
			throws Exception {
1289
			throws Exception {
1289
 
1290
 
1290
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1291
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1291
		List<String> listbrands = saholicInventoryCISRepository.selectAllBrand();
1292
		List<String> listbrands = saholicInventoryCISRepository.selectAllBrand();
1292
		List<String> listCategory = saholicInventoryCISRepository.selectAllSubCategory();
1293
		List<String> listCategory = saholicInventoryCISRepository.selectAllSubCategory();
Line 1302... Line 1303...
1302
		return "warehouse_brand_item_stock";
1303
		return "warehouse_brand_item_stock";
1303
	}
1304
	}
1304
 
1305
 
1305
	@RequestMapping(value = "/getWarehouseWiseItemStock", method = RequestMethod.GET)
1306
	@RequestMapping(value = "/getWarehouseWiseItemStock", method = RequestMethod.GET)
1306
	public String getWarehouseWiseItemStock(HttpServletRequest request, Model model,
1307
	public String getWarehouseWiseItemStock(HttpServletRequest request, Model model,
1307
											@RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category)
1308
			@RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category)
1308
			throws Exception {
1309
			throws Exception {
1309
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1310
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1310
		if (warehouseId.contains(0)) {
1311
		if (warehouseId.contains(0)) {
1311
			warehouseId.addAll(warehouseMap.keySet());
1312
			warehouseId.addAll(warehouseMap.keySet());
1312
		}
1313
		}
Line 1373... Line 1374...
1373
		return "warehousewise_brand_partners_sale";
1374
		return "warehousewise_brand_partners_sale";
1374
	}
1375
	}
1375
 
1376
 
1376
	@RequestMapping(value = "/getWarehouseWiseAccesoriesBrandPartnerSale", method = RequestMethod.GET)
1377
	@RequestMapping(value = "/getWarehouseWiseAccesoriesBrandPartnerSale", method = RequestMethod.GET)
1377
	public String getWarehouseWiseAccesoriesBrandPartnerSale(HttpServletRequest request, Model model,
1378
	public String getWarehouseWiseAccesoriesBrandPartnerSale(HttpServletRequest request, Model model,
1378
															 @RequestParam String brand) throws Exception {
1379
			@RequestParam String brand) throws Exception {
1379
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1380
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1380
		String email = loginDetails.getEmailId();
1381
		String email = loginDetails.getEmailId();
1381
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1382
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1382
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1383
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1383
 
1384
 
Line 1402... Line 1403...
1402
		return "warehousewise_accessoriesbrand_sale";
1403
		return "warehousewise_accessoriesbrand_sale";
1403
	}
1404
	}
1404
 
1405
 
1405
	@RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
1406
	@RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
1406
	public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model model,
1407
	public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model model,
1407
												@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1408
			@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1408
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1409
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1409
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1410
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1410
		String email = loginDetails.getEmailId();
1411
		String email = loginDetails.getEmailId();
1411
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1412
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1412
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1413
		Set<Integer> authfofoIds = storeGuyMap.get(email);
Line 1446... Line 1447...
1446
		return "warehouse_partner_itemwise_sale";
1447
		return "warehouse_partner_itemwise_sale";
1447
	}
1448
	}
1448
 
1449
 
1449
	@RequestMapping(value = "/getWarehouseAccesoriesBrandWiseItemSale", method = RequestMethod.GET)
1450
	@RequestMapping(value = "/getWarehouseAccesoriesBrandWiseItemSale", method = RequestMethod.GET)
1450
	public String getWarehouseAccesoriesBrandWiseItemSale(HttpServletRequest request, Model model,
1451
	public String getWarehouseAccesoriesBrandWiseItemSale(HttpServletRequest request, Model model,
1451
														  @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1452
			@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1452
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1453
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1453
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1454
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1454
		String email = loginDetails.getEmailId();
1455
		String email = loginDetails.getEmailId();
1455
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1456
		Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1456
		Set<Integer> authfofoIds = storeGuyMap.get(email);
1457
		Set<Integer> authfofoIds = storeGuyMap.get(email);
Line 1467... Line 1468...
1467
		return "contact-us";
1468
		return "contact-us";
1468
	}
1469
	}
1469
 
1470
 
1470
	@RequestMapping(value = "/notifications", method = RequestMethod.GET)
1471
	@RequestMapping(value = "/notifications", method = RequestMethod.GET)
1471
	public String getNotificationsWithType(HttpServletRequest request,
1472
	public String getNotificationsWithType(HttpServletRequest request,
1472
										   @RequestParam(required = false) MessageType messageType,
1473
			@RequestParam(required = false) MessageType messageType,
1473
										   @RequestParam(name = "offset", defaultValue = "0") int offset,
1474
			@RequestParam(name = "offset", defaultValue = "0") int offset,
1474
										   @RequestParam(name = "limit", defaultValue = "20") int limit, Model model) throws Exception {
1475
			@RequestParam(name = "limit", defaultValue = "20") int limit, Model model) throws Exception {
1475
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1476
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1476
		int userId = 0;
1477
		int userId = 0;
1477
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
1478
		boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
1478
		if (isAdmin) {
1479
		if (isAdmin) {
1479
			userId = loginDetails.getFofoId();
1480
			userId = loginDetails.getFofoId();
Line 1493... Line 1494...
1493
		return "notification-template";
1494
		return "notification-template";
1494
	}
1495
	}
1495
 
1496
 
1496
	@RequestMapping(value = "/notifyDocument/documentId", method = RequestMethod.GET)
1497
	@RequestMapping(value = "/notifyDocument/documentId", method = RequestMethod.GET)
1497
	public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
1498
	public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
1498
												  @RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam int cid)
1499
			@RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam int cid)
1499
			throws ProfitMandiBusinessException {
1500
			throws ProfitMandiBusinessException {
1500
		Document document = documentRepository.selectById(documentId);
1501
		Document document = documentRepository.selectById(documentId);
1501
		NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1502
		NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1502
		if (nc.getDocumentId() == null) {
1503
		if (nc.getDocumentId() == null) {
1503
			throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
1504
			throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
Line 1547... Line 1548...
1547
		return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
1548
		return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
1548
	}
1549
	}
1549
 
1550
 
1550
	@RequestMapping(value = "/getItemWiseTertiary", method = RequestMethod.GET)
1551
	@RequestMapping(value = "/getItemWiseTertiary", method = RequestMethod.GET)
1551
	public String getItemWiseTertiary(HttpServletRequest request,
1552
	public String getItemWiseTertiary(HttpServletRequest request,
1552
									  @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model)
1553
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model)
1553
			throws ProfitMandiBusinessException {
1554
			throws ProfitMandiBusinessException {
1554
		List<ItemWiseTertiaryModel> itemWiseTertiary = fofoOrderRepository.SelectItemWiseTertiary(fofoId);
1555
		List<ItemWiseTertiaryModel> itemWiseTertiary = fofoOrderRepository.SelectItemWiseTertiary(fofoId);
1555
 
1556
 
1556
		LOGGER.info("itemWiseTertiary" + itemWiseTertiary);
1557
		LOGGER.info("itemWiseTertiary" + itemWiseTertiary);
1557
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1558
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
Line 1560... Line 1561...
1560
		return "item-wise-tertiary";
1561
		return "item-wise-tertiary";
1561
	}
1562
	}
1562
 
1563
 
1563
	@RequestMapping(value = "/getItemWiseIndent", method = RequestMethod.GET)
1564
	@RequestMapping(value = "/getItemWiseIndent", method = RequestMethod.GET)
1564
	public String getItemWiseIndent(HttpServletRequest request,
1565
	public String getItemWiseIndent(HttpServletRequest request,
1565
									@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model)
1566
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model)
1566
			throws ProfitMandiBusinessException {
1567
			throws ProfitMandiBusinessException {
1567
 
1568
 
1568
		List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoId);
1569
		List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoId);
1569
		model.addAttribute("unbilledOrders", unbilledOrders);
1570
		model.addAttribute("unbilledOrders", unbilledOrders);
1570
 
1571
 
1571
		return "item-wise-indent";
1572
		return "item-wise-indent";
1572
	}
1573
	}
1573
 
1574
 
1574
	@RequestMapping(value = "/getPartnerInvestment", method = RequestMethod.GET)
1575
	@RequestMapping(value = "/getPartnerInvestment", method = RequestMethod.GET)
1575
	public String getPartnerInvestment(HttpServletRequest request,
1576
	public String getPartnerInvestment(HttpServletRequest request,
1576
									   @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1577
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1577
		Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
1578
		Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
1578
		PartnerDetailModel partnerDetailModel = partnerStats.get(fofoId);
1579
		PartnerDetailModel partnerDetailModel = partnerStats.get(fofoId);
1579
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1580
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1580
		model.addAttribute("partnerDetailModel", partnerDetailModel);
1581
		model.addAttribute("partnerDetailModel", partnerDetailModel);
1581
		model.addAttribute("customRetailer", customRetailer);
1582
		model.addAttribute("customRetailer", customRetailer);
1582
		return "partner-investment";
1583
		return "partner-investment";
1583
	}
1584
	}
1584
 
1585
 
1585
	@RequestMapping(value = "/getPartnerPendingIndentItem", method = RequestMethod.GET)
1586
	@RequestMapping(value = "/getPartnerPendingIndentItem", method = RequestMethod.GET)
1586
	public String getPartnerPendingIndentItem(HttpServletRequest request, @RequestParam int warehouseId,
1587
	public String getPartnerPendingIndentItem(HttpServletRequest request, @RequestParam int warehouseId,
1587
											  @RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
1588
			@RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
1588
		List<PartnerPendingIndentItemModel> partnerPendingIndent = fofoStoreRepository
1589
		List<PartnerPendingIndentItemModel> partnerPendingIndent = fofoStoreRepository
1589
				.selectPartnerPendingIndentItem(itemId, warehouseId);
1590
				.selectPartnerPendingIndentItem(itemId, warehouseId);
1590
 
1591
 
1591
		model.addAttribute("partnerPendingIndent", partnerPendingIndent);
1592
		model.addAttribute("partnerPendingIndent", partnerPendingIndent);
1592
		return "partner-pending-indent-item";
1593
		return "partner-pending-indent-item";
1593
	}
1594
	}
1594
 
1595
 
1595
	@RequestMapping(value = "/getPatnerActivateStock", method = RequestMethod.GET)
1596
	@RequestMapping(value = "/getPatnerActivateStock", method = RequestMethod.GET)
1596
	public String getPartnerActivateStockItem(HttpServletRequest request,
1597
	public String getPartnerActivateStockItem(HttpServletRequest request,
1597
											  @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1598
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1598
		List<ActivateItemModel> activateStocks = new ArrayList<>();
1599
		List<ActivateItemModel> activateStocks = new ArrayList<>();
1599
		List<InventoryItem> inventoryItems = inventoryItemRepository.selectByActivatedNotSold(fofoId);
1600
		List<InventoryItem> inventoryItems = inventoryItemRepository.selectByActivatedNotSold(fofoId);
1600
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1601
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1601
 
1602
 
1602
		for (InventoryItem inventoryItem : inventoryItems) {
1603
		for (InventoryItem inventoryItem : inventoryItems) {
Line 1616... Line 1617...
1616
		return "partner-activate-stock";
1617
		return "partner-activate-stock";
1617
	}
1618
	}
1618
 
1619
 
1619
	@RequestMapping(value = "/getPatnerBrandWiseMTDSale", method = RequestMethod.GET)
1620
	@RequestMapping(value = "/getPatnerBrandWiseMTDSale", method = RequestMethod.GET)
1620
	public String getPatnerBrandWiseMTDSale(HttpServletRequest request,
1621
	public String getPatnerBrandWiseMTDSale(HttpServletRequest request,
1621
											@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1622
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1622
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1623
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1623
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1624
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1624
		Map<String, Double> brandMtdAmount = fofoOrderItemRepository
1625
		Map<String, Double> brandMtdAmount = fofoOrderItemRepository
1625
				.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1626
				.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1626
		Map<String, Long> brandMtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate.withDayOfMonth(1),
1627
		Map<String, Long> brandMtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate.withDayOfMonth(1),
Line 1640... Line 1641...
1640
		return "partner-brand-mtd-sale";
1641
		return "partner-brand-mtd-sale";
1641
	}
1642
	}
1642
 
1643
 
1643
	@RequestMapping(value = "/getPatnerBrandWiseLMTDSale", method = RequestMethod.GET)
1644
	@RequestMapping(value = "/getPatnerBrandWiseLMTDSale", method = RequestMethod.GET)
1644
	public String getPatnerBrandWiseLMTDSale(HttpServletRequest request,
1645
	public String getPatnerBrandWiseLMTDSale(HttpServletRequest request,
1645
											 @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1646
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1646
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1647
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1647
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1648
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1648
		Map<String, Double> brandLMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1649
		Map<String, Double> brandLMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1649
				curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
1650
				curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
1650
		Map<String, Long> brandLmtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(
1651
		Map<String, Long> brandLmtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(
Line 1666... Line 1667...
1666
		return "partner-brand-lmtd-sale";
1667
		return "partner-brand-lmtd-sale";
1667
	}
1668
	}
1668
 
1669
 
1669
	@RequestMapping(value = "/getPatnerBrandWiseLMSSale", method = RequestMethod.GET)
1670
	@RequestMapping(value = "/getPatnerBrandWiseLMSSale", method = RequestMethod.GET)
1670
	public String getPatnerBrandWiseLMSSale(HttpServletRequest request,
1671
	public String getPatnerBrandWiseLMSSale(HttpServletRequest request,
1671
											@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1672
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1672
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1673
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1673
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1674
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1674
		int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1675
		int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1675
 
1676
 
1676
		Map<String, Double> brandLMSAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1677
		Map<String, Double> brandLMSAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
Line 1693... Line 1694...
1693
		return "partner-brand-lms-sale";
1694
		return "partner-brand-lms-sale";
1694
	}
1695
	}
1695
 
1696
 
1696
	@RequestMapping(value = "/getPatnerInStock", method = RequestMethod.GET)
1697
	@RequestMapping(value = "/getPatnerInStock", method = RequestMethod.GET)
1697
	public String getPatnerInStock(HttpServletRequest request,
1698
	public String getPatnerInStock(HttpServletRequest request,
1698
								   @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1699
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1699
 
1700
 
1700
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1701
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1701
 
1702
 
1702
		List<InStockBrandModel> mobileStocks = currentInventorySnapshotRepository
1703
		List<InStockBrandModel> mobileStocks = currentInventorySnapshotRepository
1703
				.selectSumInStockMobileGroupByBrand(fofoId);
1704
				.selectSumInStockMobileGroupByBrand(fofoId);
Line 1717... Line 1718...
1717
		return "partner-instock-item";
1718
		return "partner-instock-item";
1718
	}
1719
	}
1719
 
1720
 
1720
	@RequestMapping(value = "/getOpenTicketByFofoId", method = RequestMethod.GET)
1721
	@RequestMapping(value = "/getOpenTicketByFofoId", method = RequestMethod.GET)
1721
	public String getOpenTicketByFofoId(HttpServletRequest request,
1722
	public String getOpenTicketByFofoId(HttpServletRequest request,
1722
										@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1723
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1723
		Map<Integer, AuthUser> ticketIdAuthUser = new HashMap<>();
1724
		Map<Integer, AuthUser> ticketIdAuthUser = new HashMap<>();
1724
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1725
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1725
		List<Integer> ticketIds = ticketRepository.selectAllOpenTicketByRetailer(fofoId).stream().map(x -> x.getId())
1726
		List<Integer> ticketIds = ticketRepository.selectAllOpenTicketByRetailer(fofoId).stream().map(x -> x.getId())
1726
				.collect(Collectors.toList());
1727
				.collect(Collectors.toList());
1727
		List<TicketAssigned> ticketAssigns = ticketAssignedRepository.selectByTicketIds(ticketIds);
1728
		List<TicketAssigned> ticketAssigns = ticketAssignedRepository.selectByTicketIds(ticketIds);
Line 1736... Line 1737...
1736
		return "open-ticket";
1737
		return "open-ticket";
1737
	}
1738
	}
1738
 
1739
 
1739
	@RequestMapping(value = "/getPartnerSecondarySale", method = RequestMethod.GET)
1740
	@RequestMapping(value = "/getPartnerSecondarySale", method = RequestMethod.GET)
1740
	public String getPartnerSecondarySale(HttpServletRequest request,
1741
	public String getPartnerSecondarySale(HttpServletRequest request,
1741
										  @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, @RequestParam String timeValue, Model model)
1742
			@RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, @RequestParam String timeValue, Model model)
1742
			throws Exception {
1743
			throws Exception {
1743
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1744
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
1744
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1745
		CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1745
		int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1746
		int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1746
		LocalDateTime startDate = null;
1747
		LocalDateTime startDate = null;
Line 1869... Line 1870...
1869
		return "accessories-brand-wise-report";
1870
		return "accessories-brand-wise-report";
1870
	}
1871
	}
1871
 
1872
 
1872
	@RequestMapping(value = "/getMobileLMSGraph", method = RequestMethod.GET)
1873
	@RequestMapping(value = "/getMobileLMSGraph", method = RequestMethod.GET)
1873
	public String getMobileLMSGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
1874
	public String getMobileLMSGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
1874
									@RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
1875
			@RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
1875
									@RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
1876
			@RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
1876
		Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
1877
		Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
1877
				.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1878
				.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1878
						FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1879
						FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1879
 
1880
 
1880
		ChartModel cm;
1881
		ChartModel cm;
Line 1894... Line 1895...
1894
		return "brand-wise-mobile-lms-chart";
1895
		return "brand-wise-mobile-lms-chart";
1895
	}
1896
	}
1896
 
1897
 
1897
	@RequestMapping(value = "/getMobileLMSFilter", method = RequestMethod.GET)
1898
	@RequestMapping(value = "/getMobileLMSFilter", method = RequestMethod.GET)
1898
	public String getMobileLMSFilter(HttpServletRequest request,
1899
	public String getMobileLMSFilter(HttpServletRequest request,
1899
									 @RequestParam(required = false, defaultValue = "0") int warehouseId,
1900
			@RequestParam(required = false, defaultValue = "0") int warehouseId,
1900
									 @RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
1901
			@RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
1901
									 Model model) throws Exception {
1902
			Model model) throws Exception {
1902
 
1903
 
1903
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1904
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1904
		String email = loginDetails.getEmailId();
1905
		String email = loginDetails.getEmailId();
1905
 
1906
 
1906
		if (date == null) {
1907
		if (date == null) {
Line 1924... Line 1925...
1924
		return "chart-filter-lms";
1925
		return "chart-filter-lms";
1925
	}
1926
	}
1926
 
1927
 
1927
	@RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
1928
	@RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
1928
	public String getMobileLMPGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
1929
	public String getMobileLMPGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
1929
									@RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
1930
			@RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
1930
									@RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
1931
			@RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
1931
		Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
1932
		Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
1932
				.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1933
				.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1933
						FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1934
						FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1934
 
1935
 
1935
		ChartModel cm;
1936
		ChartModel cm;
Line 1980... Line 1981...
1980
		return "activation-brandwise-report";
1981
		return "activation-brandwise-report";
1981
	}
1982
	}
1982
 
1983
 
1983
	@RequestMapping(value = "/getWarehouseBrandWiseItemActivatedModel", method = RequestMethod.GET)
1984
	@RequestMapping(value = "/getWarehouseBrandWiseItemActivatedModel", method = RequestMethod.GET)
1984
	public String getWarehouseBrandWiseItemActivatedModel(HttpServletRequest request, Model model,
1985
	public String getWarehouseBrandWiseItemActivatedModel(HttpServletRequest request, Model model,
1985
														  @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1986
			@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1986
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1987
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1987
		List<Integer> fofoIds = getFofoIds(loginDetails);
1988
		List<Integer> fofoIds = getFofoIds(loginDetails);
1988
 
1989
 
1989
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1990
		Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1990
		List<WarehouseBrandWiseItemActivatedModel> activatedItems = activatedImeiRepository
1991
		List<WarehouseBrandWiseItemActivatedModel> activatedItems = activatedImeiRepository