diff --git a/src/main/java/com/iemr/ecd/controller/callallocation/CallAllocationController.java b/src/main/java/com/iemr/ecd/controller/callallocation/CallAllocationController.java index b9699b8..0ff7b98 100644 --- a/src/main/java/com/iemr/ecd/controller/callallocation/CallAllocationController.java +++ b/src/main/java/com/iemr/ecd/controller/callallocation/CallAllocationController.java @@ -142,7 +142,7 @@ public ResponseEntity insertRecordsInOutboundCalls(@RequestBody Outbound } - @GetMapping(value = "/getEligibleRecordsLanguageInfo/{psmId}/{phoneNoType}/{recordType}/{fDate}/{tDate}/{preferredLanguage}", produces = MediaType.APPLICATION_JSON_VALUE) + @GetMapping(value = "/getEligibleRecordsLanguageInfo/{psmId}/{phoneNoType}/{recordType}/{fDate}/{tDate}/{preferredLanguage}/{role}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "Fetch eligible Language records for allocation", description = "Desc - Fetch eligible records for allocation") @ApiResponses(value = { @ApiResponse(responseCode = CustomExceptionResponse.SUCCESS_SC_V, description = CustomExceptionResponse.SUCCESS_SC, content = { diff --git a/src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java b/src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java index 219cee0..f008a26 100644 --- a/src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java +++ b/src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java @@ -123,6 +123,7 @@ private String allocateMotherRecordsAssociates(RequestCallAllocationDTO callAllo int callCountPointer = 0; if (callAllocationDto.getPreferredLanguage() != null) { + List motherIds = new ArrayList<>(); Page page = outboundCallsRepo.getMotherRecordsForAssociate( PageRequest.of(0, totalRecordToAllocate), "unallocated", @@ -143,11 +144,13 @@ private String allocateMotherRecordsAssociates(RequestCallAllocationDTO callAllo call.setAllocatedUserId(callAllocationDto.getToUserIds()[callCountPointer / callAllocationDto.getNoOfCalls()]); call.setCallAttemptNo(0); callCountPointer++; + motherIds.add(call.getMotherId()); } catch (Exception e) { callCountPointer++; } } outboundCallsRepo.saveAll(outBoundCallList); + motherRecordRepo.updateIsAllocatedStatus(motherIds); } else { List motherRecords = motherRecordRepo.getMotherRecordForAllocation( fromDate, toDate, callAllocationDto.getPhoneNoType(), totalRecordToAllocate); @@ -278,11 +281,11 @@ private String allocateChildRecordsAssociates(RequestCallAllocationDTO callAlloc } } outboundCallsRepo.saveAll(outBoundCallList); - int i = childRecordRepo.updateIsAllocatedStatus(childIds); + childRecordRepo.updateIsAllocatedStatus(childIds); } else if (null != childRecordsForAssociate && !childRecordsForAssociate.isEmpty()) { outBoundCallList = childRecordsForAssociate.getContent(); - + List childIds = new ArrayList<>(); if (!outBoundCallList.isEmpty()) { for (OutboundCalls outboundCall : outBoundCallList) { try { @@ -291,13 +294,14 @@ private String allocateChildRecordsAssociates(RequestCallAllocationDTO callAlloc / callAllocationDto.getNoOfCalls()]); outboundCall.setCallAttemptNo(0); - callCountPointer++; + childIds.add(outboundCall.getChildId()); } catch (Exception e) { callCountPointer++; } } outboundCallsRepo.saveAll(outBoundCallList); + childRecordRepo.updateIsAllocatedStatus(childIds); } } else { throw new ECDException("no eligible record available to allocate, please contact administrator");