Subversion Repositories SmartDukaan

Rev

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

Rev 34144 Rev 34155
Line 515... Line 515...
515
        List<AuthUser> authUsers = authRepository.selectAllActiveUser();
515
        List<AuthUser> authUsers = authRepository.selectAllActiveUser();
516
        List<Lead> leads = null;
516
        List<Lead> leads = null;
517
        long size = 0;
517
        long size = 0;
518
        if (!(searchTerm.equals(""))) {
518
        if (!(searchTerm.equals(""))) {
519
            leads = leadRepository.selectBySearchTerm(status, searchTerm, offset, limit);
519
            leads = leadRepository.selectBySearchTerm(status, searchTerm, offset, limit);
-
 
520
            size = leadRepository.selectCountByStatus(status);
-
 
521
            Map<Integer, AuthUser> authIdAndAuthUserMap = new HashMap<>();
-
 
522
            List<Integer> authIds = new ArrayList<>();
520
            if (!(leads.size() == 0)) {
523
            if (!(leads.size() == 0)) {
521
                size = leadRepository.selectCountByStatus(status);
-
 
522
                List<Integer> authIds = new ArrayList<>();
-
 
523
                for (Lead lead : leads) {
524
                for (Lead lead : leads) {
524
                    authIds.add(lead.getAssignTo());
525
                    authIds.add(lead.getAssignTo());
525
                }
526
                }
526
                Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectAllAuthUserByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
527
                authIdAndAuthUserMap = authRepository.selectAllAuthUserByIds(authIds).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
527
                model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
-
 
528
                model.addAttribute("leads", leads);
-
 
529
                model.addAttribute("start", offset + 1);
-
 
530
                model.addAttribute("size", size);
-
 
531
                model.addAttribute("searchTerm", searchTerm);
-
 
532
 
-
 
533
                if (leads.size() < limit) {
528
                if (leads.size() < limit) {
534
                    model.addAttribute("end", offset + leads.size());
529
                    model.addAttribute("end", offset + leads.size());
535
                } else {
530
                } else {
536
                    model.addAttribute("end", offset + limit);
531
                    model.addAttribute("end", offset + limit);
537
                }
532
                }
538
            } else {
533
            } else {
539
                throw new ProfitMandiBusinessException("lead", searchTerm, "leads Not Found");
534
                model.addAttribute("end", offset + limit);
540
            }
535
            }
-
 
536
            model.addAttribute("leads", leads);
-
 
537
            model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
-
 
538
            model.addAttribute("start", offset + 1);
-
 
539
            model.addAttribute("size", size);
-
 
540
            model.addAttribute("searchTerm", searchTerm);
541
        } else {
541
        } else {
542
            leads = leadRepository.selectAllByStatus(status, offset, limit);
542
            leads = leadRepository.selectAllByStatus(status, offset, limit);
543
            size = leadRepository.selectCountByStatus(status);
543
            size = leadRepository.selectCountByStatus(status);
544
 
544
 
545
            if (!leads.isEmpty()) {
545
            if (!leads.isEmpty()) {