From 768b3f783e8e50d5bab36323fdce00981926cc6c Mon Sep 17 00:00:00 2001 From: 5Amogh Date: Tue, 1 Jul 2025 17:26:57 +0530 Subject: [PATCH 1/2] fix: AMM-1677 - rendering only grievances who have consent --- .../com/iemr/common/dto/grivance/GrievanceWorklistDTO.java | 6 ++++-- .../service/grievance/GrievanceHandlingServiceImpl.java | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/iemr/common/dto/grivance/GrievanceWorklistDTO.java b/src/main/java/com/iemr/common/dto/grivance/GrievanceWorklistDTO.java index b8184162..6364b7f6 100644 --- a/src/main/java/com/iemr/common/dto/grivance/GrievanceWorklistDTO.java +++ b/src/main/java/com/iemr/common/dto/grivance/GrievanceWorklistDTO.java @@ -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; @@ -71,6 +72,7 @@ public GrievanceWorklistDTO(String complaintID,Long grievanceId, String subjectO this.retryNeeded = retryNeeded; this.callCounter = callCounter; this.lastCall = lastCall; + this.beneficiaryConsent = beneficiaryConsent; } diff --git a/src/main/java/com/iemr/common/service/grievance/GrievanceHandlingServiceImpl.java b/src/main/java/com/iemr/common/service/grievance/GrievanceHandlingServiceImpl.java index 68e8e76e..ed643417 100644 --- a/src/main/java/com/iemr/common/service/grievance/GrievanceHandlingServiceImpl.java +++ b/src/main/java/com/iemr/common/service/grievance/GrievanceHandlingServiceImpl.java @@ -296,7 +296,7 @@ public List 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; @@ -334,7 +334,8 @@ public List 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 ); From 82d64083c9eaad92255d2a3fe6bd1da57817b1ea Mon Sep 17 00:00:00 2001 From: 5Amogh Date: Fri, 4 Jul 2025 15:44:54 +0530 Subject: [PATCH 2/2] fix: AMM-1701 callcounter issue fix --- .../grievance/GrievanceDataSyncImpl.java | 59 +++++++++++-------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/iemr/common/service/grievance/GrievanceDataSyncImpl.java b/src/main/java/com/iemr/common/service/grievance/GrievanceDataSyncImpl.java index 5a05b94f..35c9b57b 100644 --- a/src/main/java/com/iemr/common/service/grievance/GrievanceDataSyncImpl.java +++ b/src/main/java/com/iemr/common/service/grievance/GrievanceDataSyncImpl.java @@ -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"; }