Skip to content

Commit 84e0139

Browse files
srishtigrp78SR20290919
andauthored
AMM-1148 | Close call API including reattempt logic based on calltype (#164)
* adding code for API to close call and make reattempts if needed * adding code changes suggested by code rabbit * adding code rabbit suggested changes * adding code rabbit fixes * adding code rabbit fixes * Delete src/main/java/com/iemr/common/data/grievance/.gitignore --------- Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B>
1 parent d78ac62 commit 84e0139

11 files changed

Lines changed: 201 additions & 10 deletions

File tree

src/main/environment/common_ci.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,6 @@ grievanceDataSyncDuration = @env.GRIEVANCE_DATA_SYNC_DURATION@
160160
springdoc.api-docs.enabled=false
161161
springdoc.swagger-ui.enabled=false
162162

163-
grievanceAllocationRetryConfiguration=1
163+
grievanceAllocationRetryConfiguration=3
164164

165165

src/main/environment/common_dev.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,4 @@ grievanceDataSyncDuration = <Enter Grievience Data Sync Duration>
186186
springdoc.api-docs.enabled=true
187187
springdoc.swagger-ui.enabled=true
188188

189-
grievanceAllocationRetryConfiguration=1
189+
grievanceAllocationRetryConfiguration=3

src/main/environment/common_example.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ grievanceDataSyncDuration = <Enter Grievience Data Sync Duration>
186186
springdoc.api-docs.enabled=true
187187
springdoc.swagger-ui.enabled=true
188188

189-
grievanceAllocationRetryConfiguration=1
189+
grievanceAllocationRetryConfiguration=3
190190

191191

192192

src/main/environment/common_test.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,4 @@ grievanceDataSyncDuration = <Enter Grievience Data Sync Duration>
188188
springdoc.api-docs.enabled=true
189189
springdoc.swagger-ui.enabled=true
190190

191-
grievanceAllocationRetryConfiguration=1
191+
grievanceAllocationRetryConfiguration=3

src/main/environment/common_uat.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,4 @@ grievanceDataSyncDuration = <Enter Grievience Data Sync Duration>
159159
springdoc.api-docs.enabled=true
160160
springdoc.swagger-ui.enabled=true
161161

162-
grievanceAllocationRetryConfiguration=1
162+
grievanceAllocationRetryConfiguration=3

src/main/java/com/iemr/common/controller/grievance/GrievanceController.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,5 +178,35 @@ public String saveComplaintResolution( @Param(value = "{\"complaintID\":\"
178178
return response.toString();
179179
}
180180

181+
182+
// Controller method to handle reattempt logic
183+
@Operation(summary = "Check reattempt logic for grievance")
184+
@PostMapping(value = "/completeGrievanceCall", consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, headers = "Authorization")
185+
public String completeGrievanceCall(
186+
@Param(value = "{\"complaintID\":\"String - ComplaintID\", "
187+
+ "\"userID\":\"Integer - Assigned UserID\", "
188+
+ "\"isCompleted\":\"Boolean - completion status of call\", "
189+
+ "\"beneficiaryRegId\":\"Long - Beneficiary Registration ID\", "
190+
+ "\"callTypeID\":\"Integer - Call Type ID\", "
191+
+ "\"benCallID\":\"Long - Beneficiary Call ID\", "
192+
+"\"callID\":\"String - call ID by czentrix\", "
193+
+ "\"providerServiceMapID\":\"Integer - providerServiceMapID\", "
194+
+ "\"createdBy\":\"String - Creator\"}")
195+
@RequestBody String request) {
196+
197+
OutputResponse response = new OutputResponse();
198+
199+
try {
200+
String s = grievanceDataSync.completeGrievanceCall(request);
201+
response.setResponse(s);
202+
203+
} catch (Exception e) {
204+
logger.error("complete grievance outbound call failed with error " + e.getMessage(), e);
205+
response.setError(e);
206+
}
207+
return response.toString();
208+
}
209+
210+
181211

182212
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.iemr.common.data.grievance;
2+
3+
import lombok.Data;
4+
5+
@Data
6+
public class GrievanceCallRequest {
7+
8+
String complaintID;
9+
Integer userID;
10+
Boolean isCompleted;
11+
Long beneficiaryRegID;
12+
Integer callTypeID;
13+
Long benCallID;
14+
Integer providerServiceMapId;
15+
String createdBy;
16+
17+
}

src/main/java/com/iemr/common/repository/callhandling/IEMRCalltypeRepositoryImplCustom.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,7 @@ Set<Object[]> getOutboundCallTypes(@Param("providerServiceMapID") Integer provid
8888
@Query("select callType from CallType callType where deleted = false and callTypeID = :callTypeID")
8989
CallType getCallTypeDetails(@Param("callTypeID") Integer callTypeID);
9090

91-
91+
@Query("select callType, callGroupType from CallType "
92+
+ "where callTypeID = :callTypeID")
93+
Set<Object[]> getCallDetails(@Param("callTypeID") Integer callTypeID);
9294
}

src/main/java/com/iemr/common/repository/grievance/GrievanceDataRepo.java

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int updateGrievanceAllocationStatus(@Param("grievanceId") Long grievanceId,
7272
public Set<Object[]> fetchUnallocatedGrievanceCount();
7373

7474
@Modifying
75-
@Query("UPDATE GrievanceDetails g SET g.complaintResolution = :complaintResolution, g.remarks = :remarks, g.modifiedBy = :modifiedBy, "
75+
@Query("UPDATE GrievanceDetails g SET g.complaintResolution = :complaintResolution, g.remarks = :remarks, g.modifiedBy = :modifiedBy "
7676
+ "WHERE g.complaintID = :complaintID AND g.beneficiaryRegID = :beneficiaryRegID AND g.providerServiceMapID = :providerServiceMapID"
7777
+ " AND g.userID = :userID")
7878
@Transactional
@@ -85,7 +85,7 @@ int updateComplaintResolution(@Param("complaintResolution") String complaintReso
8585
@Param("userID") Integer userID);
8686

8787
@Modifying
88-
@Query("UPDATE GrievanceDetails g SET g.complaintResolution = :complaintResolution, g.modifiedBy = :modifiedBy, "
88+
@Query("UPDATE GrievanceDetails g SET g.complaintResolution = :complaintResolution, g.modifiedBy = :modifiedBy "
8989
+ "WHERE g.complaintID = :complaintID AND g.beneficiaryRegID = :beneficiaryRegID AND g.providerServiceMapID = :providerServiceMapID"
9090
+ " AND g.userID = :userID")
9191
@Transactional
@@ -95,5 +95,33 @@ int updateComplaintResolution(@Param("complaintResolution") String complaintReso
9595
@Param("beneficiaryRegID") Long beneficiaryRegID,
9696
@Param("providerServiceMapID") Integer providerServiceMapID,
9797
@Param("userID") Integer userID);
98+
99+
@Query(" Select grievance.callCounter, grievance.retryNeeded FROM GrievanceDetails grievance where complaintID = :complaintID")
100+
public List<Object[]> getCallCounter(@Param("complaintID") String complaintID);
101+
102+
@Modifying
103+
@Query("UPDATE GrievanceDetails g SET g.isCompleted = :isCompleted, g. g.retryNeeded = :retryNeeded "
104+
+ "WHERE g.complaintID = :complaintID AND g.userID = :userID AND g.beneficiaryRegID = :beneficiaryRegID "
105+
+ "AND g.providerServiceMapID = :providerServiceMapID")
106+
@Transactional
107+
public int updateCompletedStatusInCall(@Param("isCompleted") Boolean isCompleted,
108+
@Param("retryNeeded") Boolean retryNeeded,
109+
@Param("complaintID") String complaintID,
110+
@Param("userID") Integer userID,
111+
@Param("beneficiaryRegID") Long beneficiaryRegID,
112+
@Param("providerServiceMapID") Integer providerServiceMapID);
113+
114+
115+
@Modifying
116+
@Query("UPDATE GrievanceDetails g SET g.callCounter = :callCounter, g.retryNeeded = :retryNeeded "
117+
+ "WHERE g.complaintID = :complaintID AND g.beneficiaryRegID = :beneficiaryRegID AND g.providerServiceMapID = :providerServiceMapID"
118+
+ " AND g.userID = :userID")
119+
@Transactional
120+
public int updateCallCounter(@Param("callCounter") Integer callCounter,
121+
@Param("retryNeeded") Boolean retryNeeded,
122+
@Param("complaintID") String complaintID,
123+
@Param("beneficiaryRegID") Long beneficiaryRegID,
124+
@Param("providerServiceMapID") Integer providerServiceMapID,
125+
@Param("userID") Integer userID);
98126

99127
}

src/main/java/com/iemr/common/service/grievance/GrievanceDataSync.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ public interface GrievanceDataSync {
1212

1313
public String fetchUnallocatedGrievanceCount(String preferredLanguage) throws IEMRException, JSONException;
1414

15+
public String completeGrievanceCall(String request) throws Exception;
16+
1517
}

0 commit comments

Comments
 (0)