Subversion Repositories SmartDukaan

Rev

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

Rev 35252 Rev 35395
Line 307... Line 307...
307
 
307
 
308
            authIds.addAll(leads.stream().map(x -> x.getAssignTo()).collect(Collectors.toList()));
308
            authIds.addAll(leads.stream().map(x -> x.getAssignTo()).collect(Collectors.toList()));
309
 
309
 
310
            leadActivityMap = leadActivityRepository.selectAllByleadIds(leads.stream().map(x -> x.getId()).collect(Collectors.toList())).stream().collect(Collectors.groupingBy(LeadActivity::getLeadId, Collectors.toList()));
310
            leadActivityMap = leadActivityRepository.selectAllByleadIds(leads.stream().map(x -> x.getId()).collect(Collectors.toList())).stream().collect(Collectors.groupingBy(LeadActivity::getLeadId, Collectors.toList()));
311
 
311
 
312
            Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectAllAuthUserByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
312
            Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
313
            model.addAttribute("leadActivityMap", leadActivityMap);
313
            model.addAttribute("leadActivityMap", leadActivityMap);
314
            model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
314
            model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
315
        }
315
        }
316
 
316
 
317
        ChartLeadModel cm = this.getLeadChart(leads);
317
        ChartLeadModel cm = this.getLeadChart(leads);
Line 542... Line 542...
542
            List<Integer> leadIds = leads.stream().map(Lead::getId).collect(Collectors.toList());
542
            List<Integer> leadIds = leads.stream().map(Lead::getId).collect(Collectors.toList());
543
            leadActivityMap = leadActivityRepository.selectAllByleadIds(leadIds).stream()
543
            leadActivityMap = leadActivityRepository.selectAllByleadIds(leadIds).stream()
544
                    .collect(Collectors.groupingBy(LeadActivity::getLeadId));
544
                    .collect(Collectors.groupingBy(LeadActivity::getLeadId));
545
        }
545
        }
546
        List<Integer> authIds = leads.stream().map(Lead::getAssignTo).collect(Collectors.toList());
546
        List<Integer> authIds = leads.stream().map(Lead::getAssignTo).collect(Collectors.toList());
547
        Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectAllAuthUserByIds(authIds).stream()
547
        Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectByIds(authIds).stream()
548
                .collect(Collectors.toMap(AuthUser::getId, x -> x));
548
                .collect(Collectors.toMap(AuthUser::getId, x -> x));
549
 
549
 
550
        // Build CSV rows (USE DIRECT LEAD PROPERTIES - NO ACTIVITY FALLBACK)
550
        // Build CSV rows (USE DIRECT LEAD PROPERTIES - NO ACTIVITY FALLBACK)
551
        List<List<?>> rows = new ArrayList<>();
551
        List<List<?>> rows = new ArrayList<>();
552
        for (Lead lead : leads) {
552
        for (Lead lead : leads) {
Line 611... Line 611...
611
        if (!leads.isEmpty()) {
611
        if (!leads.isEmpty()) {
612
            List<Integer> authIds = new ArrayList<>();
612
            List<Integer> authIds = new ArrayList<>();
613
            for (Lead lead : leads) {
613
            for (Lead lead : leads) {
614
                authIds.add(lead.getAssignTo());
614
                authIds.add(lead.getAssignTo());
615
            }
615
            }
616
            Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectAllAuthUserByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
616
            Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
617
 
617
 
618
            model.addAttribute("leads", leads);
618
            model.addAttribute("leads", leads);
619
            model.addAttribute("start", offset + 1);
619
            model.addAttribute("start", offset + 1);
620
            model.addAttribute("size", size);
620
            model.addAttribute("size", size);
621
            model.addAttribute("searchTerm", searchTerm);
621
            model.addAttribute("searchTerm", searchTerm);
Line 646... Line 646...
646
        if (!leads.isEmpty()) {
646
        if (!leads.isEmpty()) {
647
            List<Integer> authIds = new ArrayList<>();
647
            List<Integer> authIds = new ArrayList<>();
648
            for (Lead lead : leads) {
648
            for (Lead lead : leads) {
649
                authIds.add(lead.getAssignTo());
649
                authIds.add(lead.getAssignTo());
650
            }
650
            }
651
            Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectAllAuthUserByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
651
            Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
652
            model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
652
            model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
653
            model.addAttribute("leads", leads);
653
            model.addAttribute("leads", leads);
654
            model.addAttribute("url", "/getPaginatedClosedLeads");
654
            model.addAttribute("url", "/getPaginatedClosedLeads");
655
 
655
 
656
        } else {
656
        } else {
Line 672... Line 672...
672
            List<Integer> authIds = new ArrayList<>();
672
            List<Integer> authIds = new ArrayList<>();
673
            if (!(leads.size() == 0)) {
673
            if (!(leads.size() == 0)) {
674
                for (Lead lead : leads) {
674
                for (Lead lead : leads) {
675
                    authIds.add(lead.getAssignTo());
675
                    authIds.add(lead.getAssignTo());
676
                }
676
                }
677
                authIdAndAuthUserMap = authRepository.selectAllAuthUserByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
677
                authIdAndAuthUserMap = authRepository.selectByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
678
                if (leads.size() < limit) {
678
                if (leads.size() < limit) {
679
                    model.addAttribute("end", offset + leads.size());
679
                    model.addAttribute("end", offset + leads.size());
680
                } else {
680
                } else {
681
                    model.addAttribute("end", offset + limit);
681
                    model.addAttribute("end", offset + limit);
682
                }
682
                }
Line 695... Line 695...
695
            if (!leads.isEmpty()) {
695
            if (!leads.isEmpty()) {
696
                List<Integer> authIds = new ArrayList<>();
696
                List<Integer> authIds = new ArrayList<>();
697
                for (Lead lead : leads) {
697
                for (Lead lead : leads) {
698
                    authIds.add(lead.getAssignTo());
698
                    authIds.add(lead.getAssignTo());
699
                }
699
                }
700
                Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectAllAuthUserByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
700
                Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
701
 
701
 
702
                model.addAttribute("leads", leads);
702
                model.addAttribute("leads", leads);
703
                model.addAttribute("start", offset + 1);
703
                model.addAttribute("start", offset + 1);
704
                model.addAttribute("size", size);
704
                model.addAttribute("size", size);
705
                model.addAttribute("searchTerm", searchTerm);
705
                model.addAttribute("searchTerm", searchTerm);
Line 728... Line 728...
728
 
728
 
729
                List<Integer> authIds = new ArrayList<>();
729
                List<Integer> authIds = new ArrayList<>();
730
                for (Lead lead : leads) {
730
                for (Lead lead : leads) {
731
                    authIds.add(lead.getAssignTo());
731
                    authIds.add(lead.getAssignTo());
732
                }
732
                }
733
                Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectAllAuthUserByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
733
                Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
734
                model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
734
                model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
735
                model.addAttribute("leads", leads);
735
                model.addAttribute("leads", leads);
736
            }
736
            }
737
        }
737
        }
738
 
738
 
Line 1397... Line 1397...
1397
            salesPositionsAuthIds.addAll(rbmPositionsAuthIds);
1397
            salesPositionsAuthIds.addAll(rbmPositionsAuthIds);
1398
 
1398
 
1399
            Set<Integer> empHierarchy = allReportees.stream().filter(x -> salesPositionsAuthIds.contains(x)).collect(Collectors.toSet());
1399
            Set<Integer> empHierarchy = allReportees.stream().filter(x -> salesPositionsAuthIds.contains(x)).collect(Collectors.toSet());
1400
            List<AuthUser> authUsers = new ArrayList<>();
1400
            List<AuthUser> authUsers = new ArrayList<>();
1401
            if (!empHierarchy.isEmpty()) {
1401
            if (!empHierarchy.isEmpty()) {
1402
                authUsers = authRepository.selectAllAuthUserByIds(new ArrayList<>(empHierarchy));
1402
                authUsers = authRepository.selectByIds(new ArrayList<>(empHierarchy));
1403
            }
1403
            }
1404
 
1404
 
1405
 
1405
 
1406
            Map<Integer, AuthUser> authUserMap = authRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
1406
            Map<Integer, AuthUser> authUserMap = authRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
1407
 
1407
 
Line 1506... Line 1506...
1506
 
1506
 
1507
        List<Integer> allReportees = authService.getAllReportees(authUser.getId());
1507
        List<Integer> allReportees = authService.getAllReportees(authUser.getId());
1508
 
1508
 
1509
        Set<Integer> empHierarchy = allReportees.stream().filter(x -> salesPositionsAuthIds.contains(x)).collect(Collectors.toSet());
1509
        Set<Integer> empHierarchy = allReportees.stream().filter(x -> salesPositionsAuthIds.contains(x)).collect(Collectors.toSet());
1510
 
1510
 
1511
        List<AuthUser> authUsers = authRepository.selectAllAuthUserByIds(new ArrayList<>(empHierarchy));
1511
        List<AuthUser> authUsers = authRepository.selectByIds(new ArrayList<>(empHierarchy));
1512
 
1512
 
1513
        Map<Integer, String> monthValueMap = new HashMap<>();
1513
        Map<Integer, String> monthValueMap = new HashMap<>();
1514
        for (int i = 0; i <= 5; i++) {
1514
        for (int i = 0; i <= 5; i++) {
1515
            LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
1515
            LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1).minusMonths(i);
1516
            monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));
1516
            monthValueMap.put(i, startOfMonth.format(DateTimeFormatter.ofPattern("MMM''uu")));