Subversion Repositories SmartDukaan

Rev

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

Rev 30209 Rev 30215
Line 731... Line 731...
731
 
731
 
732
		List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
732
		List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
733
		for (FofoStore store : stores) {
733
		for (FofoStore store : stores) {
734
			int fofoId = store.getId();
734
			int fofoId = store.getId();
735
 
735
 
736
			PartnerType startOfPreviousMonthPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, startOfPreviousMonth).getPartnerType();
736
			PartnerType startOfPreviousMonthPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, startOfPreviousMonth);
737
			PartnerType todayPartnerType = partnerTypeChangeService.getTypeOnMonth(fofoId,
737
			PartnerType todayPartnerType = partnerTypeChangeService.getTypeOnMonth(fofoId,
738
					YearMonth.from(startOfPreviousMonth.atStartOfDay()));
738
					YearMonth.from(startOfPreviousMonth.atStartOfDay()));
739
			if (!startOfPreviousMonthPartnerType.nextPartnerTypes().contains(todayPartnerType)) {
739
			if (!startOfPreviousMonthPartnerType.nextPartnerTypes().contains(todayPartnerType)) {
740
				continue;
740
				continue;
741
			}
741
			}
Line 759... Line 759...
759
		List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
759
		List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
760
		StringBuilder sb = new StringBuilder();
760
		StringBuilder sb = new StringBuilder();
761
		for (FofoStore store : stores) {
761
		for (FofoStore store : stores) {
762
			int fofoId = store.getId();
762
			int fofoId = store.getId();
763
 
763
 
764
			PartnerType yesterdayPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, yesterday).getPartnerType();
764
			PartnerType yesterdayPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, yesterday);
765
			PartnerType todayPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, today).getPartnerType();
765
			PartnerType todayPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, today);
766
			if (!yesterdayPartnerType.nextPartnerTypes().contains(todayPartnerType)) {
766
			if (!yesterdayPartnerType.nextPartnerTypes().contains(todayPartnerType)) {
767
				continue;
767
				continue;
768
			}
768
			}
769
			if (!yesterdayPartnerType.equals(todayPartnerType)) {
769
			if (!yesterdayPartnerType.equals(todayPartnerType)) {
770
				upgradedCount++;
770
				upgradedCount++;
Line 978... Line 978...
978
		}
978
		}
979
 
979
 
980
		String fileName = "InvestmentSummary-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
980
		String fileName = "InvestmentSummary-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
981
 
981
 
982
		if (sendTo == null) {
982
		if (sendTo == null) {
983
			for (Map.Entry<String, List<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMapping().entrySet()) {
983
			for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMapping().entrySet()) {
984
				List<List<?>> filteredRows = storeGuyEntry.getValue().stream().map(x -> partnerRowsMap.get(x))
984
				List<List<?>> filteredRows = storeGuyEntry.getValue().stream().map(x -> partnerRowsMap.get(x))
985
						.filter(x -> x != null).collect(Collectors.toList());
985
						.filter(x -> x != null).collect(Collectors.toList());
986
				ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
986
				ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
987
				String[] sendToArray = new String[]{storeGuyEntry.getKey()};
987
				String[] sendToArray = new String[]{storeGuyEntry.getKey()};
988
				Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Franchise Investment Summary", "PFA",
988
				Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Franchise Investment Summary", "PFA",
Line 2419... Line 2419...
2419
			 */
2419
			 */
2420
 
2420
 
2421
		}
2421
		}
2422
		if (!focusedModelShortageReportMap.isEmpty()) {
2422
		if (!focusedModelShortageReportMap.isEmpty()) {
2423
			String fileName = "Stock Alert-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
2423
			String fileName = "Stock Alert-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
2424
			Map<String, List<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
2424
			Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
2425
			Map<String, List<List<?>>> emailRowsMap = new HashMap<>();
2425
			Map<String, List<List<?>>> emailRowsMap = new HashMap<>();
2426
 
2426
 
2427
			focusedModelShortageReportMap.entrySet().forEach(x -> {
2427
			focusedModelShortageReportMap.entrySet().forEach(x -> {
2428
				storeGuyMap.entrySet().forEach(y -> {
2428
				storeGuyMap.entrySet().forEach(y -> {
2429
 
2429