| Line 590... |
Line 590... |
| 590 |
RbmCallSequenceLogRepository rbmCallSequenceLogRepository;
|
590 |
RbmCallSequenceLogRepository rbmCallSequenceLogRepository;
|
| 591 |
|
591 |
|
| 592 |
@Autowired
|
592 |
@Autowired
|
| 593 |
com.spice.profitmandi.dao.repository.cs.TicketRepository ticketRepository;
|
593 |
com.spice.profitmandi.dao.repository.cs.TicketRepository ticketRepository;
|
| 594 |
|
594 |
|
| - |
|
595 |
@Autowired
|
| - |
|
596 |
com.spice.profitmandi.dao.repository.cs.AgentCallLogRepository agentCallLogRepository;
|
| - |
|
597 |
|
| 595 |
@Override
|
598 |
@Override
|
| 596 |
public List<RbmCallTargetModel> getRbmCallTargetModels() throws Exception {
|
599 |
public List<RbmCallTargetModel> getRbmCallTargetModels() throws Exception {
|
| 597 |
long methodStart = System.currentTimeMillis();
|
600 |
long methodStart = System.currentTimeMillis();
|
| 598 |
List<RbmCallTargetModel> rbmCallTargetModels = new ArrayList<>();
|
601 |
List<RbmCallTargetModel> rbmCallTargetModels = new ArrayList<>();
|
| 599 |
|
602 |
|
| Line 1186... |
Line 1189... |
| 1186 |
retailerMap = retailerService.getFofoRetailers(new ArrayList<>(fofoIds));
|
1189 |
retailerMap = retailerService.getFofoRetailers(new ArrayList<>(fofoIds));
|
| 1187 |
} catch (ProfitMandiBusinessException e) {
|
1190 |
} catch (ProfitMandiBusinessException e) {
|
| 1188 |
LOGGER.error("Error fetching fofo stores", e);
|
1191 |
LOGGER.error("Error fetching fofo stores", e);
|
| 1189 |
}
|
1192 |
}
|
| 1190 |
|
1193 |
|
| - |
|
1194 |
// Fetch call logs for remarks that have agentCallLogId
|
| - |
|
1195 |
List<Long> callLogIds = uniqueRemarksByFofoId.values().stream()
|
| - |
|
1196 |
.filter(r -> r.getAgentCallLogId() > 0)
|
| - |
|
1197 |
.map(PartnerCollectionRemark::getAgentCallLogId)
|
| - |
|
1198 |
.collect(Collectors.toList());
|
| - |
|
1199 |
|
| - |
|
1200 |
Map<Long, com.spice.profitmandi.dao.entity.cs.AgentCallLog> callLogMap = new HashMap<>();
|
| - |
|
1201 |
if (!callLogIds.isEmpty()) {
|
| - |
|
1202 |
List<com.spice.profitmandi.dao.entity.cs.AgentCallLog> callLogs = agentCallLogRepository.findByIds(callLogIds);
|
| - |
|
1203 |
callLogMap = callLogs.stream()
|
| - |
|
1204 |
.collect(Collectors.toMap(com.spice.profitmandi.dao.entity.cs.AgentCallLog::getId, c -> c, (a, b) -> a));
|
| - |
|
1205 |
}
|
| - |
|
1206 |
|
| 1191 |
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("hh:mm a");
|
1207 |
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("hh:mm a");
|
| - |
|
1208 |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy hh:mm a");
|
| 1192 |
List<CalledPartnerDetailModel> result = new ArrayList<>();
|
1209 |
List<CalledPartnerDetailModel> result = new ArrayList<>();
|
| 1193 |
|
1210 |
|
| 1194 |
for (PartnerCollectionRemark remark : uniqueRemarksByFofoId.values()) {
|
1211 |
for (PartnerCollectionRemark remark : uniqueRemarksByFofoId.values()) {
|
| 1195 |
CustomRetailer retailer = retailerMap.get(remark.getFofoId());
|
1212 |
CustomRetailer retailer = retailerMap.get(remark.getFofoId());
|
| 1196 |
String partyName = retailer != null
|
1213 |
String partyName = retailer != null
|
| Line 1210... |
Line 1227... |
| 1210 |
|
1227 |
|
| 1211 |
String time = remark.getCreateTimestamp() != null
|
1228 |
String time = remark.getCreateTimestamp() != null
|
| 1212 |
? remark.getCreateTimestamp().format(timeFormatter)
|
1229 |
? remark.getCreateTimestamp().format(timeFormatter)
|
| 1213 |
: "-";
|
1230 |
: "-";
|
| 1214 |
|
1231 |
|
| - |
|
1232 |
// Get call log data if available
|
| - |
|
1233 |
String recordingUrl = null;
|
| - |
|
1234 |
String callStatus = null;
|
| - |
|
1235 |
String callDuration = null;
|
| - |
|
1236 |
String callDateTime = null;
|
| - |
|
1237 |
|
| - |
|
1238 |
if (remark.getAgentCallLogId() > 0 && callLogMap.containsKey(remark.getAgentCallLogId())) {
|
| - |
|
1239 |
com.spice.profitmandi.dao.entity.cs.AgentCallLog callLog = callLogMap.get(remark.getAgentCallLogId());
|
| - |
|
1240 |
recordingUrl = callLog.getRecordingUrl();
|
| - |
|
1241 |
callStatus = callLog.getCallStatus();
|
| - |
|
1242 |
callDuration = callLog.getCallDuration();
|
| - |
|
1243 |
if (callLog.getCallDate() != null && callLog.getCallTime() != null) {
|
| - |
|
1244 |
LocalDateTime callDateTimeObj = LocalDateTime.of(callLog.getCallDate(), callLog.getCallTime());
|
| - |
|
1245 |
callDateTime = callDateTimeObj.format(dateTimeFormatter);
|
| - |
|
1246 |
}
|
| - |
|
1247 |
}
|
| - |
|
1248 |
|
| 1215 |
result.add(new CalledPartnerDetailModel(partyName, code, remarkValue, messageValue, time));
|
1249 |
result.add(new CalledPartnerDetailModel(partyName, code, remarkValue, messageValue, time,
|
| - |
|
1250 |
recordingUrl, callStatus, callDuration, callDateTime));
|
| 1216 |
}
|
1251 |
}
|
| 1217 |
|
1252 |
|
| 1218 |
return result;
|
1253 |
return result;
|
| 1219 |
}
|
1254 |
}
|
| 1220 |
|
1255 |
|