Subversion Repositories SmartDukaan

Rev

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

Rev 31235 Rev 31465
Line 512... Line 512...
512
				.collect(Collectors.toSet());
512
				.collect(Collectors.toSet());
513
		List<Position> categoryPositions = positionRepository
513
		List<Position> categoryPositions = positionRepository
514
				.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_SALES);
514
				.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_SALES);
515
		categoryPositions
515
		categoryPositions
516
				.addAll(positionRepository.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_RBM));
516
				.addAll(positionRepository.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_RBM));
-
 
517
		categoryPositions.addAll(positionRepository
517
		categoryPositions.addAll(positionRepository.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT));
518
				.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT));
518
		Map<Integer, Position> positionsMap = categoryPositions.stream()
519
		Map<Integer, Position> positionsMap = categoryPositions.stream()
519
				.collect(Collectors.toMap(x -> x.getId(), x -> x));
520
				.collect(Collectors.toMap(x -> x.getId(), x -> x));
520
 
521
 
521
		Map<Integer, List<CustomRetailer>> positonPartnerMap = this.getPositionCustomRetailerMap(categoryPositions);
522
		Map<Integer, List<CustomRetailer>> positonPartnerMap = this.getPositionCustomRetailerMap(categoryPositions);
522
		for (Map.Entry<Integer, List<CustomRetailer>> positionPartnerEntry : positonPartnerMap.entrySet()) {
523
		for (Map.Entry<Integer, List<CustomRetailer>> positionPartnerEntry : positonPartnerMap.entrySet()) {
Line 536... Line 537...
536
		return storeGuyMap;
537
		return storeGuyMap;
537
	}
538
	}
538
 
539
 
539
	@Override
540
	@Override
540
	@Cacheable(value = "authUserPartnerEmailPartnerIdMapping", cacheManager = "thirtyMinsTimeOutCacheManager")
541
	@Cacheable(value = "authUserPartnerEmailPartnerIdMapping", cacheManager = "thirtyMinsTimeOutCacheManager")
541
	public Map<String, Set<Integer>> getAuthUserPartnerIdMappingByCategoryIds(List<Integer> categoryIds) {
542
	public Map<String, Set<Integer>> getAuthUserPartnerIdMappingByCategoryIds(List<Integer> categoryIds,
-
 
543
			boolean active) {
542
		Map<String, Set<Integer>> authUserPartnerMap = new HashMap<>();
544
		Map<String, Set<Integer>> authUserPartnerMap = new HashMap<>();
-
 
545
		Set<Integer> activeFofoIds;
-
 
546
		if (active) {
543
		Set<Integer> activeFofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId())
547
			activeFofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId())
544
				.collect(Collectors.toSet());
548
					.collect(Collectors.toSet());
-
 
549
 
-
 
550
		} else {
-
 
551
			activeFofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId()).collect(Collectors.toSet());
-
 
552
 
-
 
553
		}
545
 
554
 
546
		List<Position> categoryPositions = positionRepository.selectPositionByCategoryIds(categoryIds);
555
		List<Position> categoryPositions = positionRepository.selectPositionByCategoryIds(categoryIds);
547
		Map<Integer, Position> positionsMap = categoryPositions.stream()
556
		Map<Integer, Position> positionsMap = categoryPositions.stream()
548
				.collect(Collectors.toMap(x -> x.getId(), x -> x));
557
				.collect(Collectors.toMap(x -> x.getId(), x -> x));
549
 
558
 
Line 964... Line 973...
964
		return partnerIdSalesHeadersMap;
973
		return partnerIdSalesHeadersMap;
965
 
974
 
966
	}
975
	}
967
 
976
 
968
	@Override
977
	@Override
969
	public Set<Integer> getAuthFofoIds(String email) throws ProfitMandiBusinessException {
978
	public Set<Integer> getAuthFofoIds(String email, boolean active) throws ProfitMandiBusinessException {
970
 
979
 
971
		List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_LOGISTICS,
980
		List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_LOGISTICS,
972
				ProfitMandiConstants.TICKET_CATEGORY_FINANCIAL_SERVICES, ProfitMandiConstants.TICKET_CATEGORY_CATEGORY,
981
				ProfitMandiConstants.TICKET_CATEGORY_FINANCIAL_SERVICES, ProfitMandiConstants.TICKET_CATEGORY_CATEGORY,
973
				ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,
982
				ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,
974
				ProfitMandiConstants.TICKET_CATEGORY_MARKETING, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS,
983
				ProfitMandiConstants.TICKET_CATEGORY_MARKETING, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS,
975
				ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT,
984
				ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT,
976
				ProfitMandiConstants.TICKET_CATEGORY_TECHNOLOGY);
985
				ProfitMandiConstants.TICKET_CATEGORY_TECHNOLOGY);
977
 
986
 
978
		Map<String, Set<Integer>> storeGuyMap = this.getAuthUserPartnerIdMappingByCategoryIds(categoryIds);
987
		Map<String, Set<Integer>> storeGuyMap = this.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, active);
979
		Set<Integer> authfofoIds = storeGuyMap.get(email);
988
		Set<Integer> authfofoIds = storeGuyMap.get(email);
980
 
989
 
981
		AuthUser authUser = authRepository.selectByEmailOrMobile(email);
990
		AuthUser authUser = authRepository.selectByEmailOrMobile(email);
982
		if (authfofoIds == null) {
991
		if (authfofoIds == null) {
983
			List<Position> positions1 = positionRepository.selectAll(authUser.getId());
992
			List<Position> positions1 = positionRepository.selectAll(authUser.getId());