| Line 919... |
Line 919... |
| 919 |
Model model) {
|
919 |
Model model) {
|
| 920 |
List<Lead> leads = new ArrayList<>();
|
920 |
List<Lead> leads = new ArrayList<>();
|
| 921 |
if (!searchTerm.trim().isEmpty()) {
|
921 |
if (!searchTerm.trim().isEmpty()) {
|
| 922 |
leads = leadRepository.selectByGlobalSearch(searchTerm.trim(), 200);
|
922 |
leads = leadRepository.selectByGlobalSearch(searchTerm.trim(), 200);
|
| 923 |
if (!leads.isEmpty()) {
|
923 |
if (!leads.isEmpty()) {
|
| - |
|
924 |
List<Integer> allLeadIds = leads.stream().map(Lead::getId).collect(Collectors.toList());
|
| 924 |
List<Integer> authIds = leads.stream().map(Lead::getAssignTo).collect(Collectors.toList());
|
925 |
List<Integer> authIds = leads.stream().map(Lead::getAssignTo).collect(Collectors.toList());
|
| 925 |
Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectByIds(authIds).stream()
|
926 |
Map<Integer, AuthUser> authIdAndAuthUserMap = authRepository.selectByIds(authIds).stream()
|
| 926 |
.collect(Collectors.toMap(AuthUser::getId, x -> x));
|
927 |
.collect(Collectors.toMap(AuthUser::getId, x -> x));
|
| 927 |
model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
|
928 |
model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
|
| 928 |
|
929 |
|
| 929 |
List<Integer> allLeadIds = leads.stream().map(Lead::getId).collect(Collectors.toList());
|
- |
|
| 930 |
Map<Integer, LeadLiveLocation> geoLocationMap = leadLiveLocationRepository.selectByLeadIds(allLeadIds).stream()
|
930 |
Map<Integer, LeadLiveLocation> geoLocationMap = leadLiveLocationRepository.selectByLeadIds(allLeadIds).stream()
|
| 931 |
.collect(Collectors.toMap(LeadLiveLocation::getLeadId, x -> x, (a, b) -> a));
|
931 |
.collect(Collectors.toMap(LeadLiveLocation::getLeadId, x -> x, (a, b) -> a));
|
| 932 |
model.addAttribute("geoLocationMap", geoLocationMap);
|
932 |
model.addAttribute("geoLocationMap", geoLocationMap);
|
| - |
|
933 |
|
| - |
|
934 |
Map<Integer, List<LeadActivity>> leadActivityMap = leadActivityRepository.selectAllByleadIds(allLeadIds).stream()
|
| - |
|
935 |
.collect(Collectors.groupingBy(LeadActivity::getLeadId, Collectors.toList()));
|
| - |
|
936 |
model.addAttribute("leadActivityMap", leadActivityMap);
|
| - |
|
937 |
|
| - |
|
938 |
try {
|
| - |
|
939 |
Set<Integer> pendingSet = leadVisitRequestRepository.selectByLeadIdsAndStatus(allLeadIds, "PENDING").stream()
|
| - |
|
940 |
.map(com.spice.profitmandi.dao.entity.user.LeadVisitRequest::getLeadId)
|
| - |
|
941 |
.collect(Collectors.toSet());
|
| - |
|
942 |
model.addAttribute("pendingVisitRequestLeadIds", pendingSet);
|
| - |
|
943 |
} catch (Exception e) {
|
| - |
|
944 |
model.addAttribute("pendingVisitRequestLeadIds", new HashSet<Integer>());
|
| - |
|
945 |
}
|
| 933 |
}
|
946 |
}
|
| 934 |
}
|
947 |
}
|
| 935 |
if (!model.containsAttribute("geoLocationMap")) {
|
948 |
if (!model.containsAttribute("geoLocationMap")) {
|
| 936 |
model.addAttribute("geoLocationMap", new HashMap<>());
|
949 |
model.addAttribute("geoLocationMap", new HashMap<>());
|
| 937 |
}
|
950 |
}
|
| - |
|
951 |
if (!model.containsAttribute("leadActivityMap")) {
|
| - |
|
952 |
model.addAttribute("leadActivityMap", new HashMap<>());
|
| - |
|
953 |
}
|
| - |
|
954 |
if (!model.containsAttribute("pendingVisitRequestLeadIds")) {
|
| - |
|
955 |
model.addAttribute("pendingVisitRequestLeadIds", new HashSet<Integer>());
|
| - |
|
956 |
}
|
| 938 |
model.addAttribute("leads", leads);
|
957 |
model.addAttribute("leads", leads);
|
| 939 |
model.addAttribute("searchTerm", searchTerm);
|
958 |
model.addAttribute("searchTerm", searchTerm);
|
| 940 |
return "lead-close-paginated";
|
959 |
return "lead-global-search";
|
| 941 |
}
|
960 |
}
|
| 942 |
|
961 |
|
| 943 |
@RequestMapping(value = "/getLeadActivity", method = RequestMethod.GET)
|
962 |
@RequestMapping(value = "/getLeadActivity", method = RequestMethod.GET)
|
| 944 |
public String getLeadActivity(HttpServletRequest request, @RequestParam int leadId, Model model) throws Exception {
|
963 |
public String getLeadActivity(HttpServletRequest request, @RequestParam int leadId, Model model) throws Exception {
|
| 945 |
List<LeadActivity> leadActivity = leadActivityRepository.selectBYLeadId(leadId);
|
964 |
List<LeadActivity> leadActivity = leadActivityRepository.selectBYLeadId(leadId);
|