Subversion Repositories SmartDukaan

Rev

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

Rev 25335 Rev 25341
Line 572... Line 572...
572
		LOGGER.info("Cashbacks for Recharge processed Successfully");
572
		LOGGER.info("Cashbacks for Recharge processed Successfully");
573
	}
573
	}
574
 
574
 
575
	public void sendPartnerInvestmentDetails(List<String> sendTo) throws Exception {
575
	public void sendPartnerInvestmentDetails(List<String> sendTo) throws Exception {
576
		if (sendTo == null) {
576
		if (sendTo == null) {
577
			sendTo = Arrays.asList(//"tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com",
577
			sendTo = Arrays.asList("tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com",
578
					"amit.gupta@shop2020.in");
578
					"amit.gupta@shop2020.in");
579
		}
579
		}
580
		LocalDate yesterDay = LocalDate.now().minusDays(1);
580
		LocalDate yesterDay = LocalDate.now().minusDays(1);
581
		List<FofoStore> fofoStores = fofoStoreRepository.selectActiveStores();
581
		List<FofoStore> fofoStores = fofoStoreRepository.selectActiveStores();
582
		Map<Integer, CustomRetailer> customRetailerMap = retailerService
582
		Map<Integer, CustomRetailer> customRetailerMap = retailerService
Line 625... Line 625...
625
			}
625
			}
626
		}
626
		}
627
		storeGuyMap.remove("");
627
		storeGuyMap.remove("");
628
 
628
 
629
		String fileName = "InvestmentSummary-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
629
		String fileName = "InvestmentSummary-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
630
		/*for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuyMap.entrySet()) {
630
		for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuyMap.entrySet()) {
631
			List<List<? extends Serializable>> filteredRows = storeGuyEntry.getValue().stream()
631
			List<List<? extends Serializable>> filteredRows = storeGuyEntry.getValue().stream()
632
					.map(x -> partnerRow.get(x)).collect(Collectors.toList());
632
					.map(x -> partnerRow.get(x)).collect(Collectors.toList());
633
			ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
633
			ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
634
			String[] sendToArray = new String[] { nameEmail.get(storeGuyEntry.getKey()) };
634
			String[] sendToArray = new String[] { nameEmail.get(storeGuyEntry.getKey()) };
635
			Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA",
635
			Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA",
636
					fileName, new ByteArrayResource(baos.toByteArray()));
636
					fileName, new ByteArrayResource(baos.toByteArray()));
637
		}*/
637
		}
638
 
638
 
639
		ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
639
		ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
640
		String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
640
		String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
641
		Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA", fileName,
641
		Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA", fileName,
642
				new ByteArrayResource(baos.toByteArray()));
642
				new ByteArrayResource(baos.toByteArray()));
Line 649... Line 649...
649
	}
649
	}
650
 
650
 
651
	public void sendTargetVsSalesReport(List<String> sendTo) throws Exception {
651
	public void sendTargetVsSalesReport(List<String> sendTo) throws Exception {
652
 
652
 
653
		if (sendTo == null) {
653
		if (sendTo == null) {
654
			sendTo = Arrays.asList(//"tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com",
654
			sendTo = Arrays.asList("tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com",
655
					"amit.gupta@shop2020.in");
655
					"amit.gupta@shop2020.in");
656
		}
656
		}
657
		List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
657
		List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
658
				.selectAllGeEqAndLeEqStartDateAndEndDate(LocalDateTime.now());
658
				.selectAllGeEqAndLeEqStartDateAndEndDate(LocalDateTime.now());
659
		Map<String, List<? extends Serializable>> partnerSalesTargetRowsMap = new HashMap<>();
659
		Map<String, List<? extends Serializable>> partnerSalesTargetRowsMap = new HashMap<>();
Line 711... Line 711...
711
			}
711
			}
712
		}
712
		}
713
		storeGuyMap.remove("");
713
		storeGuyMap.remove("");
714
 
714
 
715
		String fileName = "TargetVsSales-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
715
		String fileName = "TargetVsSales-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
716
		/*for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuyMap.entrySet()) {
716
		for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuyMap.entrySet()) {
717
			List<List<? extends Serializable>> filteredRows = storeGuyEntry.getValue().stream()
717
			List<List<? extends Serializable>> filteredRows = storeGuyEntry.getValue().stream()
718
					.map(x -> partnerRowMap.get(x)).filter(x->x!=null).collect(Collectors.toList());
718
					.map(x -> partnerRowMap.get(x)).filter(x->x!=null).collect(Collectors.toList());
719
			ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
719
			ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
720
			String[] sendToArray = new String[] { nameEmail.get(storeGuyEntry.getKey()) };
720
			String[] sendToArray = new String[] { nameEmail.get(storeGuyEntry.getKey()) };
721
			Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Target vs Sales Summary", "PFA",
721
			Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Target vs Sales Summary", "PFA",
722
					fileName, new ByteArrayResource(baos.toByteArray()));
722
					fileName, new ByteArrayResource(baos.toByteArray()));
723
		}*/
723
		}
724
 
724
 
725
		ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
725
		ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
726
		String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
726
		String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
727
		Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Target vs Sales Summary", "PFA", fileName,
727
		Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Target vs Sales Summary", "PFA", fileName,
728
				new ByteArrayResource(baos.toByteArray()));
728
				new ByteArrayResource(baos.toByteArray()));