Subversion Repositories SmartDukaan

Rev

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

Rev 25592 Rev 25594
Line 735... Line 735...
735
				new ByteArrayResource(baos.toByteArray()));
735
				new ByteArrayResource(baos.toByteArray()));
736
	}
736
	}
737
 
737
 
738
	private Map<String, Set<String>> getStoreGuyMap() {
738
	private Map<String, Set<String>> getStoreGuyMap() {
739
		Map<String, Set<String>> storeGuyMap = new HashMap<>();
739
		Map<String, Set<String>> storeGuyMap = new HashMap<>();
-
 
740
		Set<Integer> activeFofoIds = fofoStoreRepository.selectActiveStores().stream().map(x->x.getId()).collect(Collectors.toSet());
740
		List<Position> categoryPositions = positionRepository.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_SALES);
741
		List<Position> categoryPositions = positionRepository.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_SALES);
741
		Map<Integer, Position> positionsMap = categoryPositions.stream().collect(Collectors.toMap(x->x.getId(), x->x));
742
		Map<Integer, Position> positionsMap = categoryPositions.stream().collect(Collectors.toMap(x->x.getId(), x->x));
742
		
743
		
743
		Map<Integer, List<CustomRetailer>> positonPartnerMap = csService.getPositionCustomRetailerMap(categoryPositions);
744
		Map<Integer, List<CustomRetailer>> positonPartnerMap = csService.getPositionCustomRetailerMap(categoryPositions);
744
		for(Map.Entry<Integer, List<CustomRetailer>> positionPartnerEntry : positonPartnerMap.entrySet()) {
745
		for(Map.Entry<Integer, List<CustomRetailer>> positionPartnerEntry : positonPartnerMap.entrySet()) {
745
			int authUserId = positionsMap.get(positionPartnerEntry.getKey()).getAuthUserId();
746
			int authUserId = positionsMap.get(positionPartnerEntry.getKey()).getAuthUserId();
746
			Set<String> partnerEmails = positionPartnerEntry.getValue().stream().map(x->x.getEmail()).collect(Collectors.toSet());
747
			Set<String> partnerEmails = positionPartnerEntry.getValue().stream()
-
 
748
					.filter(x->activeFofoIds.contains(x.getPartnerId()))
-
 
749
					.map(x->x.getEmail()).collect(Collectors.toSet());
747
			AuthUser authUser = authRepository.selectById(authUserId);
750
			AuthUser authUser = authRepository.selectById(authUserId);
-
 
751
			if(authUser.isActive()) {
748
			storeGuyMap.put(authUser.getEmailId(), partnerEmails);
752
				storeGuyMap.put(authUser.getEmailId(), partnerEmails);
-
 
753
			}
749
		}
754
		}
750
		return storeGuyMap;
755
		return storeGuyMap;
751
	}
756
	}
752
 
757
 
753
	public void sendAgeingReport(String... sendTo) throws Exception {
758
	public void sendAgeingReport(String... sendTo) throws Exception {