Subversion Repositories SmartDukaan

Rev

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

Rev 33041 Rev 33074
Line 551... Line 551...
551
        Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
551
        Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
552
        Map<Integer, List<CustomRetailer>> positionRetailerMap = new HashMap<>();
552
        Map<Integer, List<CustomRetailer>> positionRetailerMap = new HashMap<>();
553
        for (Position position : positions) {
553
        for (Position position : positions) {
554
            List<Integer> fofoIds = partnerPositionRepository.selectByPositionId(position.getId()).stream().map(x -> x.getFofoId()).collect(Collectors.toList());
554
            List<Integer> fofoIds = partnerPositionRepository.selectByPositionId(position.getId()).stream().map(x -> x.getFofoId()).collect(Collectors.toList());
555
 
555
 
556
            LOGGER.info("fofoIds - {}", fofoIds);
556
            //LOGGER.info("fofoIds - {}", fofoIds);
557
            if (!fofoIds.isEmpty()) {
557
            if (!fofoIds.isEmpty()) {
558
                if (fofoIds.contains(0)) {
558
                if (fofoIds.contains(0)) {
559
                    fofoIds = partnerRegionRepository.selectByRegionId(position.getRegionId()).stream().map(x -> x.getFofoId()).collect(Collectors.toList());
559
                    fofoIds = partnerRegionRepository.selectByRegionId(position.getRegionId()).stream().map(x -> x.getFofoId()).collect(Collectors.toList());
560
                    if (fofoIds.contains(0)) {
560
                    if (fofoIds.contains(0)) {
561
                        fofoIds = new ArrayList<>(customRetailerMap.keySet());
561
                        fofoIds = new ArrayList<>(customRetailerMap.keySet());
562
                    }
562
                    }
563
 
563
 
564
                }
564
                }
565
                LOGGER.info("fofoIds - {}", fofoIds);
565
                //LOGGER.info("fofoIds - {}", fofoIds);
566
                positionRetailerMap.put(position.getId(), fofoIds.stream().map(x -> customRetailerMap.get(x)).filter(x -> x != null).collect(Collectors.toList()));
566
                positionRetailerMap.put(position.getId(), fofoIds.stream().map(x -> customRetailerMap.get(x)).filter(x -> x != null).collect(Collectors.toList()));
567
 
567
 
568
            }
568
            }
569
        }
569
        }
570
        return positionRetailerMap;
570
        return positionRetailerMap;
Line 713... Line 713...
713
        regionIds.add(5);// All partners Id;
713
        regionIds.add(5);// All partners Id;
714
        List<Integer> fofoIds = new ArrayList<>();
714
        List<Integer> fofoIds = new ArrayList<>();
715
        fofoIds.add(fofoId);
715
        fofoIds.add(fofoId);
716
        fofoIds.add(0);
716
        fofoIds.add(0);
717
 
717
 
718
        LOGGER.info("fofoIds" + fofoIds);
718
        //LOGGER.info("fofoIds" + fofoIds);
719
        List<Integer> partnerPositionIds = partnerPositionRepository.selectByRegionIdAndPartnerId(regionIds, fofoIds).stream().map(x -> x.getPositionId()).collect(Collectors.toList());
719
        List<Integer> partnerPositionIds = partnerPositionRepository.selectByRegionIdAndPartnerId(regionIds, fofoIds).stream().map(x -> x.getPositionId()).collect(Collectors.toList());
720
 
720
 
721
        LOGGER.info("partnerPositionIds" + partnerPositionIds);
721
        //LOGGER.info("partnerPositionIds" + partnerPositionIds);
722
 
722
 
723
        for (Integer partnerPostionId : partnerPositionIds) {
723
        for (Integer partnerPostionId : partnerPositionIds) {
724
            Position position = positionRepository.selectByIdAndCategoryId(partnerPostionId, ProfitMandiConstants.TICKET_CATEGORY_SALES);
724
            Position position = positionRepository.selectByIdAndCategoryId(partnerPostionId, ProfitMandiConstants.TICKET_CATEGORY_SALES);
725
            LOGGER.info("position" + position);
725
            //LOGGER.info("position" + position);
726
            if (position != null) {
726
            if (position != null) {
727
 
727
 
728
                AuthUser authUser = authRepository.selectById(position.getAuthUserId());
728
                AuthUser authUser = authRepository.selectById(position.getAuthUserId());
729
                LOGGER.info("authUser" + authUser);
729
                //LOGGER.info("authUser" + authUser);
730
 
730
 
731
                emailEsclationTypeMap.put(position.getEscalationType(), authUser.getEmailId());
731
                emailEsclationTypeMap.put(position.getEscalationType(), authUser.getEmailId());
732
            }
732
            }
733
        }
733
        }
734
 
734
 
735
        LOGGER.info("emailEsclationTypeMap" + emailEsclationTypeMap);
735
        //LOGGER.info("emailEsclationTypeMap" + emailEsclationTypeMap);
736
 
736
 
737
        return emailEsclationTypeMap;
737
        return emailEsclationTypeMap;
738
    }
738
    }
739
 
739
 
740
    @Override
740
    @Override
Line 779... Line 779...
779
        List<Position> l1SalesPositions = positionRepository.selectPositionbyCategoryIdAndEscalationType(
779
        List<Position> l1SalesPositions = positionRepository.selectPositionbyCategoryIdAndEscalationType(
780
                ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L1);
780
                ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L1);
781
        List<Position> l2SalesPositions = positionRepository.selectPositionbyCategoryIdAndEscalationType(
781
        List<Position> l2SalesPositions = positionRepository.selectPositionbyCategoryIdAndEscalationType(
782
                ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L2);
782
                ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L2);
783
 
783
 
784
        LOGGER.info("position" + l1SalesPositions);
784
        //LOGGER.info("position" + l1SalesPositions);
785
        Map<Integer, List<Integer>> authUserPartnerListMap = this.getAuthUserIdPartnerIdMapping();
785
        Map<Integer, List<Integer>> authUserPartnerListMap = this.getAuthUserIdPartnerIdMapping();
786
        LOGGER.info("map" + authUserPartnerListMap);
786
        //LOGGER.info("map" + authUserPartnerListMap);
787
 
787
 
788
        Map<Integer, List<Integer>> l2l1ListMap = new HashMap<>();
788
        Map<Integer, List<Integer>> l2l1ListMap = new HashMap<>();
789
 
789
 
790
        for (Position l2SalePosition : l2SalesPositions) {
790
        for (Position l2SalePosition : l2SalesPositions) {
791
            int l2AuthUserId = l2SalePosition.getAuthUserId();
791
            int l2AuthUserId = l2SalePosition.getAuthUserId();
Line 866... Line 866...
866
        regionIds.add(5);// All partners Id;
866
        regionIds.add(5);// All partners Id;
867
        List<Integer> fofoIds = new ArrayList<>();
867
        List<Integer> fofoIds = new ArrayList<>();
868
        fofoIds.add(fofoId);
868
        fofoIds.add(fofoId);
869
        fofoIds.add(0);
869
        fofoIds.add(0);
870
 
870
 
871
        LOGGER.info("fofoIds" + fofoIds);
871
        //LOGGER.info("fofoIds" + fofoIds);
872
        List<Integer> partnerPositionIds = partnerPositionRepository.selectByRegionIdAndPartnerId(regionIds, fofoIds).stream().map(x -> x.getPositionId()).collect(Collectors.toList());
872
        List<Integer> partnerPositionIds = partnerPositionRepository.selectByRegionIdAndPartnerId(regionIds, fofoIds).stream().map(x -> x.getPositionId()).collect(Collectors.toList());
873
 
873
 
874
        LOGGER.info("partnerPositionIds" + partnerPositionIds);
874
        //LOGGER.info("partnerPositionIds" + partnerPositionIds);
875
        List<Integer> allowedTicketCategoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_RBM);
875
        List<Integer> allowedTicketCategoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_RBM);
876
 
876
 
877
 
877
 
878
        List<Position> escalationBasedPositions = positionRepository.selectAll(partnerPositionIds).stream().filter(x -> allowedTicketCategoryIds.contains(x.getCategoryId()) &&
878
        List<Position> escalationBasedPositions = positionRepository.selectAll(partnerPositionIds).stream().filter(x -> allowedTicketCategoryIds.contains(x.getCategoryId()) &&
879
                Arrays.stream(escalationTypes)
879
                Arrays.stream(escalationTypes)
Line 889... Line 889...
889
    public List<AuthUser> getAuthUserIds(int categoryId, List<EscalationType> escalationType) {
889
    public List<AuthUser> getAuthUserIds(int categoryId, List<EscalationType> escalationType) {
890
 
890
 
891
        List<Position> positions = positionRepository.selectPositionbyCategoryIdAndEscalationTypes(categoryId, escalationType);
891
        List<Position> positions = positionRepository.selectPositionbyCategoryIdAndEscalationTypes(categoryId, escalationType);
892
        List<Integer> authIds = positions.stream().map(x -> x.getAuthUserId()).distinct().collect(Collectors.toList());
892
        List<Integer> authIds = positions.stream().map(x -> x.getAuthUserId()).distinct().collect(Collectors.toList());
893
 
893
 
894
        LOGGER.info("authIds" + authIds);
894
        //LOGGER.info("authIds" + authIds);
895
 
895
 
896
        List<AuthUser> authUsers = authRepository.selectAllAuthUserByIds(authIds);
896
        List<AuthUser> authUsers = authRepository.selectAllAuthUserByIds(authIds);
897
 
897
 
898
        LOGGER.info("authUsers" + authUsers);
898
        LOGGER.info("authUsers" + authUsers);
899
        return authUsers;
899
        return authUsers;