Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ public class GrievanceWorklistDTO implements Serializable {
private String age;
private Boolean retryNeeded;
private Integer callCounter;
private Timestamp lastCall;
private Timestamp lastCall;
private Boolean beneficiaryConsent;

public GrievanceWorklistDTO(String complaintID,Long grievanceId, String subjectOfComplaint, String complaint,
Long beneficiaryRegID, Integer providerServiceMapID,String primaryNumber,String severety,String state,
Integer userId, Boolean deleted, String createdBy, Timestamp createdDate, Timestamp lastModDate,
Boolean isCompleted,String firstName, String lastName, String gender, String district, Long beneficiaryID, String age,
Boolean retryNeeded, Integer callCounter, Timestamp lastCall) {
Boolean retryNeeded, Integer callCounter, Timestamp lastCall, Boolean beneficiaryConsent) {
super();
this.complaintID = complaintID;
this.grievanceId = grievanceId;
Expand All @@ -71,6 +72,7 @@ public GrievanceWorklistDTO(String complaintID,Long grievanceId, String subjectO
this.retryNeeded = retryNeeded;
this.callCounter = callCounter;
this.lastCall = lastCall;
this.beneficiaryConsent = beneficiaryConsent;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,41 +579,48 @@ public String completeGrievanceCall(String request) throws Exception {

// Logic for reattempt based on call group type and call type
boolean isRetryNeeded = grievanceCallStatus.getRetryNeeded();
if ((null != grievanceCallStatus.getComplaintResolution()
&& grievanceCallStatus.getComplaintResolution().equalsIgnoreCase("Resolved")) || (callGroupType.equalsIgnoreCase("Valid") && (callType.equalsIgnoreCase("Valid") || callType.equals("Test Call")))) {
boolean isResolved = grievanceCallStatus.getComplaintResolution() != null
&& grievanceCallStatus.getComplaintResolution().equalsIgnoreCase("Resolved");
boolean isValidGroup = callGroupType.equalsIgnoreCase("Valid")
&& (callType.equalsIgnoreCase("Valid") || callType.equals("Test Call"));
boolean isInvalidGroup = callGroupType.equalsIgnoreCase("Invalid")
&& (callType.equalsIgnoreCase("Wrong Number") || callType.equalsIgnoreCase("Invalid Call"));

if (isResolved) {
// 1) Any resolved call β†’ complete, no retry
isRetryNeeded = false;
updateCount = grievanceDataRepo.updateCompletedStatusInCall(true, false, complaintID, userID, beneficiaryRegID);
}
else if (callGroupType.equalsIgnoreCase("Invalid") && (callType.equalsIgnoreCase("Wrong Number") || callType.equalsIgnoreCase("Invalid Call"))) {

} else if (isValidGroup) {
// 2) Valid but not resolved β†’ leave open, retry allowed
isRetryNeeded = true;
updateCount = grievanceDataRepo.updateCompletedStatusInCall(false, true, complaintID, userID, beneficiaryRegID);

} else if (isInvalidGroup) {
// 3) Invalid calls β†’ complete, no retry
isRetryNeeded = false;
updateCount = grievanceDataRepo.updateCompletedStatusInCall(true, isRetryNeeded, complaintID, userID,
beneficiaryRegID);
}else {
updateCount = grievanceDataRepo.updateCompletedStatusInCall(true, false, complaintID, userID, beneficiaryRegID);

} else {
// 4) All other cases (e.g. unreachable) β†’ leave open, retry allowed
isRetryNeeded = true;
updateCount = grievanceDataRepo.updateCompletedStatusInCall(false, isRetryNeeded, complaintID,
userID, beneficiaryRegID);
updateCount = grievanceDataRepo.updateCompletedStatusInCall(false, true, complaintID, userID, beneficiaryRegID);
}
// Check if max attempts (3) are reached

//Call counter update
if (isRetryNeeded && grievanceCallStatus.getCallCounter() < grievanceAllocationRetryConfiguration) {
grievanceCallStatus.setCallCounter(grievanceCallStatus.getCallCounter() + 1);
updateCallCounter = grievanceDataRepo.updateCallCounter(grievanceCallStatus.getCallCounter(),
isRetryNeeded, grievanceCallRequest.getComplaintID(),
grievanceCallRequest.getBeneficiaryRegID(),
grievanceCallRequest.getUserID());
if (updateCallCounter > 0)
response = "Successfully closing call";
else {
response = "failure in closing call";
}
} else if (grievanceCallStatus.getCallCounter() == grievanceAllocationRetryConfiguration) {
// Max attempts reached, no further reattempt
updateCallCounter = grievanceDataRepo.updateCallCounter(
grievanceCallStatus.getCallCounter(), true, complaintID, beneficiaryRegID, userID);
response = (updateCallCounter > 0) ? "Successfully closing call" : "failure in closing call";

} else if (grievanceCallStatus.getCallCounter() >= grievanceAllocationRetryConfiguration) {
// Max attempts reached β†’ treated as β€œcomplete”
isRetryNeeded = false;
// isCompleted = true;
updateCount = grievanceDataRepo.updateCompletedStatusInCall(isCompleted, isRetryNeeded, complaintID,
userID, beneficiaryRegID);
response = "max_attempts_reached"; // Indicate that max attempts are reached
updateCount = grievanceDataRepo.updateCompletedStatusInCall(true, false, complaintID, userID, beneficiaryRegID);
response = "max_attempts_reached";

}else if(updateCount > 0) {
} else if (updateCount > 0) {
response = "Successfully closing call";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public List<GrievanceWorklistDTO> getFormattedGrievanceData(String request) thro

// Loop through the worklist data and format the response
for (Object[] row : worklistData) {
if (row == null || row.length < 22)
if (row == null || row.length < 24)
{
logger.warn("invalid row data received");
continue;
Expand Down Expand Up @@ -334,7 +334,8 @@ public List<GrievanceWorklistDTO> getFormattedGrievanceData(String request) thro
ageFormatted,
(Boolean) row[21], // retryNeeded
(Integer) row[22], // callCounter
(Timestamp) row[13] //lastCall
(Timestamp) row[13], // lastCall
(Boolean) row[23] //beneficiaryConsent

);

Expand Down
Loading