Subversion Repositories SmartDukaan

Rev

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

Rev 35714 Rev 35720
Line 1056... Line 1056...
1056
                            || t.getL5AuthUser() == authId)
1056
                            || t.getL5AuthUser() == authId)
1057
                    .map(Ticket::getFofoId)
1057
                    .map(Ticket::getFofoId)
1058
                    .distinct()
1058
                    .distinct()
1059
                    .collect(Collectors.toList());
1059
                    .collect(Collectors.toList());
1060
 
1060
 
-
 
1061
            // For L2, all escalated tickets are target
-
 
1062
            Set<Integer> targetFofoIds = new HashSet<>(fofoIdList);
-
 
1063
 
1061
            // Get today's remarks created by L2
1064
            // Get today's remarks
1062
            List<PartnerCollectionRemark> todayRemarks = partnerCollectionRemarkRepository
1065
            List<PartnerCollectionRemark> todayRemarks = partnerCollectionRemarkRepository
1063
                    .selectAllByAuthIdsOnDate(Collections.singletonList(authId), today);
1066
                    .selectAllByAuthIdsOnDate(Collections.singletonList(authId), today);
1064
 
1067
 
1065
            // Deduplicate by fofoId - keep latest remark per partner (list is ordered by id DESC)
1068
            // Filter to only target partners and deduplicate
1066
            Map<Integer, PartnerCollectionRemark> uniqueRemarksByFofoId = new LinkedHashMap<>();
1069
            Map<Integer, PartnerCollectionRemark> uniqueRemarksByFofoId = new LinkedHashMap<>();
1067
            for (PartnerCollectionRemark remark : todayRemarks) {
1070
            for (PartnerCollectionRemark remark : todayRemarks) {
-
 
1071
                if (targetFofoIds.contains(remark.getFofoId())) {
1068
                uniqueRemarksByFofoId.putIfAbsent(remark.getFofoId(), remark);
1072
                    uniqueRemarksByFofoId.putIfAbsent(remark.getFofoId(), remark);
-
 
1073
                }
1069
            }
1074
            }
1070
 
1075
 
1071
            return buildCalledPartnerResult(uniqueRemarksByFofoId);
1076
            return buildCalledPartnerResult(uniqueRemarksByFofoId);
1072
        }
1077
        }
1073
 
1078
 
Line 1156... Line 1161...
1156
                targetFofoIds.add(fofoId);
1161
                targetFofoIds.add(fofoId);
1157
            }
1162
            }
1158
            // rank 4 (FuturePlan) and rank 5 (Normal) are NOT in target
1163
            // rank 4 (FuturePlan) and rank 5 (Normal) are NOT in target
1159
        }
1164
        }
1160
 
1165
 
1161
        // Get today's remarks created by L1
1166
        // Get today's remarks
1162
        List<PartnerCollectionRemark> todayRemarks = partnerCollectionRemarkRepository
1167
        List<PartnerCollectionRemark> todayRemarks = partnerCollectionRemarkRepository
1163
                .selectAllByAuthIdsOnDate(Collections.singletonList(authId), today);
1168
                .selectAllByAuthIdsOnDate(Collections.singletonList(authId), today);
1164
 
1169
 
1165
        // Deduplicate by fofoId - keep latest remark per partner (list is ordered by id DESC)
1170
        // Filter to only target partners and deduplicate
1166
        Map<Integer, PartnerCollectionRemark> uniqueRemarksByFofoId = new LinkedHashMap<>();
1171
        Map<Integer, PartnerCollectionRemark> uniqueRemarksByFofoId = new LinkedHashMap<>();
1167
        for (PartnerCollectionRemark remark : todayRemarks) {
1172
        for (PartnerCollectionRemark remark : todayRemarks) {
-
 
1173
            if (targetFofoIds.contains(remark.getFofoId())) {
1168
            uniqueRemarksByFofoId.putIfAbsent(remark.getFofoId(), remark);
1174
                uniqueRemarksByFofoId.putIfAbsent(remark.getFofoId(), remark);
-
 
1175
            }
1169
        }
1176
        }
1170
 
1177
 
1171
        return buildCalledPartnerResult(uniqueRemarksByFofoId);
1178
        return buildCalledPartnerResult(uniqueRemarksByFofoId);
1172
    }
1179
    }
1173
 
1180
 
Line 1190... Line 1197...
1190
                .map(PartnerCollectionRemark::getAgentCallLogId)
1197
                .map(PartnerCollectionRemark::getAgentCallLogId)
1191
                .collect(Collectors.toList());
1198
                .collect(Collectors.toList());
1192
 
1199
 
1193
        Map<Long, com.spice.profitmandi.dao.entity.cs.AgentCallLog> callLogMap = new HashMap<>();
1200
        Map<Long, com.spice.profitmandi.dao.entity.cs.AgentCallLog> callLogMap = new HashMap<>();
1194
        if (!callLogIds.isEmpty()) {
1201
        if (!callLogIds.isEmpty()) {
-
 
1202
            try {
1195
            List<com.spice.profitmandi.dao.entity.cs.AgentCallLog> callLogs = agentCallLogRepository.findByIds(callLogIds);
1203
                List<com.spice.profitmandi.dao.entity.cs.AgentCallLog> callLogs = agentCallLogRepository.findByIds(callLogIds);
1196
            callLogMap = callLogs.stream()
1204
                callLogMap = callLogs.stream()
1197
                    .collect(Collectors.toMap(com.spice.profitmandi.dao.entity.cs.AgentCallLog::getId, c -> c, (a, b) -> a));
1205
                        .collect(Collectors.toMap(com.spice.profitmandi.dao.entity.cs.AgentCallLog::getId, c -> c, (a, b) -> a));
-
 
1206
            } catch (Exception e) {
-
 
1207
                LOGGER.error("Error fetching call logs by ids", e);
-
 
1208
            }
1198
        }
1209
        }
1199
 
1210
 
1200
        DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("hh:mm a");
1211
        DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("hh:mm a");
1201
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy hh:mm a");
1212
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy hh:mm a");
1202
        List<CalledPartnerDetailModel> result = new ArrayList<>();
1213
        List<CalledPartnerDetailModel> result = new ArrayList<>();