Changes related to the response of the Dashboard Widget for Super Admin API.
This commit is contained in:
@@ -377,11 +377,11 @@ public class GepafinConstant {
|
||||
public static final String MESSAGE_STRING = "message";
|
||||
public static final String AMOUNT_ACCEPTED_REQUIRED_WHILE_APPROVING_APPLICATION="amount.accepted.required";
|
||||
public static final String CALL_NAME="callName";
|
||||
public static final String NUMBER_OF_APPLICATIONS="numberOfApplications";
|
||||
public static final String NUMBER_OF_APPLICATIONS="numberOfSubmitedApplications";
|
||||
public static final String NUMBER_OF_DRAFT_APPLICATIONS="numberOfDraftApplications";
|
||||
public static final String COUNT="count";
|
||||
public static final String APPLICATION_PER_CALL="applicationPerCall";
|
||||
public static final String APPLICATION_PER_STATUS="applicationPerStatus";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,8 @@ public class DashboardDao {
|
||||
stats.put(GepafinConstant.APPLICATION_PER_CALL, applicationsPerCall.stream().map(result -> {
|
||||
Map<String, Object> callData = new HashMap<>();
|
||||
callData.put(GepafinConstant.CALL_NAME, result[0]); // Call name
|
||||
callData.put(GepafinConstant.NUMBER_OF_APPLICATIONS, result[1]); // Application count
|
||||
callData.put(GepafinConstant.NUMBER_OF_APPLICATIONS, result[1]);// Application count
|
||||
callData.put(GepafinConstant.NUMBER_OF_DRAFT_APPLICATIONS, result[2]);// Application count
|
||||
return callData;
|
||||
}).toList());
|
||||
|
||||
|
||||
@@ -45,9 +45,17 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
||||
@Query("SELECT a.call.id FROM ApplicationEntity a WHERE a.id = :id AND a.isDeleted = false")
|
||||
Long findCallIdById(@Param("id") Long id);
|
||||
|
||||
@Query("SELECT a.call.name, COUNT(a.id) FROM ApplicationEntity a WHERE a.isDeleted = false AND a.call.hub.id = :hubId GROUP BY a.call.name")
|
||||
@Query(value = "SELECT c.name AS callName, " +
|
||||
"SUM(CASE WHEN a.status IN ('DISCARD', 'SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION', 'APPOINTMENT', 'NDG', 'ADMISSIBLE', 'SUBMIT') THEN 1 ELSE 0 END) AS totalApplications, " +
|
||||
"SUM(CASE WHEN a.status IN ('DRAFT', 'AWAITING', 'READY') THEN 1 ELSE 0 END) AS draftApplications " +
|
||||
"FROM application a " +
|
||||
"JOIN call c ON a.call_id = c.id " +
|
||||
"WHERE a.is_deleted = false AND c.hub_id = :hubId " +
|
||||
"GROUP BY c.name", nativeQuery = true)
|
||||
List<Object[]> findApplicationsPerCallWithName(@Param("hubId") Long hubId);
|
||||
|
||||
|
||||
|
||||
// Count Applications by Status by Hub ID
|
||||
@Query("SELECT a.status, COUNT(a.id) FROM ApplicationEntity a WHERE a.isDeleted = false AND a.call.hub.id = :hubId GROUP BY a.status")
|
||||
List<Object[]> findApplicationsByStatus(@Param("hubId") Long hubId);
|
||||
|
||||
Reference in New Issue
Block a user