From a9a9b4e41a9ca89be8ffe105e819f406a7bf2c47 Mon Sep 17 00:00:00 2001 From: Muhimbura Brian Mart Date: Thu, 19 Sep 2024 20:28:02 +0300 Subject: [PATCH 1/2] Latest QA-PREQUALIFICATION FIX --- ...equalificationReadPlatformServiceImpl.java | 194 +++++++++--------- 1 file changed, 94 insertions(+), 100 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java index 5f76557a69f..84df379e61b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java @@ -413,106 +413,100 @@ private static final class PrequalificationsGroupMapper implements RowMapper 0 THEN - 'Reproceso' ELSE 'Nuevo' - END AS processQuality, - concat( mu.firstname, ' ', mu.lastname ) AS statusChangedBy, - COALESCE ( ma.NAME, individualOffice.agency_name ) AS agencyName, - ma.id AS agencyId, - cg.display_name AS groupName, - g.group_name AS newGroupName, - g.group_id AS groupId, - pc.display_name AS centerName, - pc.id AS centerId, - lp.id AS productId, - fa.id AS facilitatorId, - concat( fa.firstname, ' ', fa.lastname ) AS facilitatorName, - lp.NAME AS productName, - au.firstname, - au.lastname, - greenValidCount AS greenValidationCount, - yellowValidCount AS yellowValidationCount, - orangeValidCount AS orangeValidationCount, - redValidCount AS redValidationCount\s - FROM - m_prequalification_group g - INNER JOIN m_appuser au ON au.id = g.added_by - INNER JOIN m_product_loan lp ON g.product_id = lp.id - LEFT JOIN ( - SELECT - mpgm.group_id AS prequalification_id, - SUM( mpgm.requested_amount ) total_requested_amount, - SUM( mpgm.approved_amount ) total_approved_amount\s - FROM - m_prequalification_group_members mpgm\s - GROUP BY - mpgm.group_id\s - ) prequalification_numbers ON prequalification_numbers.prequalification_id = g.id - LEFT JOIN ( - SELECT DISTINCT - mc.office_id, - ms.agency_id, - mag.NAME AS agency_name, - mpgm.group_id, - ms.linked_office_id AS supervision_office\s - FROM - m_prequalification_group_members mpgm - INNER JOIN m_client mc ON mc.dpi = mpgm.dpi - INNER JOIN m_group_client mgc ON mgc.client_id = mc.id - INNER JOIN m_group mg ON mg.id = mgc.group_id - INNER JOIN m_group center ON center.id = mg.parent_id - INNER JOIN m_portfolio mp ON mp.id = center.portfolio_id - INNER JOIN m_supervision ms ON ms.id = mp.supervision_id - INNER JOIN m_agency mag ON mag.id = ms.agency_id\s - ) individualOffice ON individualOffice.group_id = g.id - LEFT JOIN m_agency ma ON g.agency_id = ma.id - LEFT JOIN ( SELECT agency_id, linked_office_id FROM m_supervision GROUP BY agency_id ) supv ON supv.agency_id = ma.id - LEFT JOIN m_office mo ON mo.id = supv.linked_office_id - LEFT JOIN m_office moind ON moind.id = individualOffice.supervision_office - LEFT JOIN ( - SELECT - mcvr.prequalification_id, - COUNT( CASE WHEN mcvr.validation_color_enum = 1 THEN 1 END ) AS greenValidCount, - COUNT( CASE WHEN mcvr.validation_color_enum = 2 THEN 1 END ) AS yellowValidCount, - COUNT( CASE WHEN mcvr.validation_color_enum = 3 THEN 1 END ) AS orangeValidCount, - COUNT( CASE WHEN mcvr.validation_color_enum = 4 THEN 1 END ) AS redValidCount\s - FROM - m_checklist_validation_result mcvr\s - GROUP BY - mcvr.prequalification_id\s - ) validations ON validations.prequalification_id = g.id - LEFT JOIN m_group cg ON cg.id = g.group_id - LEFT JOIN m_group linkedGroup ON linkedGroup.prequalification_id = g.id - LEFT JOIN m_group pc ON pc.id = g.center_id - LEFT JOIN m_appuser fa ON fa.id = g.facilitator - LEFT JOIN ( SELECT count(*) AS reprocess_count, prequalification_id, to_status FROM m_prequalification_status_log GROUP BY prequalification_id, to_status ) mpsl ON mpsl.prequalification_id = g.id\s - AND mpsl.to_status = g. - STATUS LEFT JOIN ( SELECT prequalification_id, to_status, from_status, sub_status, comments, assigned_to, updatedby_id, MAX( date_created ) AS date_created FROM m_prequalification_status_log GROUP BY prequalification_id ) sl ON sl.prequalification_id = g.id\s - AND sl.to_status = g.status - LEFT JOIN m_appuser mu ON mu.id = sl.updatedby_id - LEFT JOIN m_appuser assigned ON assigned.id = sl.assigned_to + g.prequalification_number AS prequalificationNumber, + g.STATUS, + linkedGroup.id AS linkedGroupId, + g.prequalification_duration AS prequalilficationTimespan, + g.comments, + g.created_at, + g.prequalification_type_enum AS prequalificationType, + sl.from_status AS previousStatus, + sl.sub_status AS substatus, + sl.comments AS latestComments, + assigned.username AS assignedUser, + concat( assigned.firstname, ' ', assigned.lastname ) AS assignedUserName, + sl.date_created AS statusChangedOn, + prequalification_numbers.total_requested_amount AS totalRequestedAmount, + prequalification_numbers.total_approved_amount totalApprovedAmount, + ( CASE WHEN g.previous_prequalification IS NOT NULL THEN 'Recredito' ELSE 'Nuevo' END ) AS processType, + (CASE WHEN mpsl.reprocess_count > 0 THEN 'Reproceso' ELSE 'Nuevo' END) as processQuality, + concat( mu.firstname, ' ', mu.lastname ) AS statusChangedBy, + COALESCE ( ma.NAME, individualOffice.agency_name ) AS agencyName, + ma.id AS agencyId, + cg.display_name AS groupName, + g.group_name AS newGroupName, + g.group_id AS groupId, + pc.display_name AS centerName, + pc.id AS centerId, + lp.id AS productId, + fa.id AS facilitatorId, + concat( fa.firstname, ' ', fa.lastname ) AS facilitatorName, + lp.NAME AS productName, + au.firstname, + au.lastname, + greenValidCount AS greenValidationCount, + yellowValidCount AS yellowValidationCount, + orangeValidCount AS orangeValidationCount, + redValidCount AS redValidationCount + FROM + m_prequalification_group g + INNER JOIN m_appuser au ON au.id = g.added_by + INNER JOIN m_product_loan lp ON g.product_id = lp.id + LEFT JOIN ( + SELECT + mpgm.group_id AS prequalification_id, + SUM( mpgm.requested_amount ) total_requested_amount, + SUM( mpgm.approved_amount ) total_approved_amount + FROM + m_prequalification_group_members mpgm + GROUP BY + mpgm.group_id + ) prequalification_numbers ON prequalification_numbers.prequalification_id = g.id + LEFT JOIN ( + SELECT DISTINCT + mc.office_id, + ms.agency_id, + mag.NAME AS agency_name, + mpgm.group_id, + ms.linked_office_id AS supervision_office + FROM + m_prequalification_group_members mpgm + INNER JOIN m_client mc ON mc.dpi = mpgm.dpi + INNER JOIN m_group_client mgc ON mgc.client_id = mc.id + INNER JOIN m_group mg ON mg.id = mgc.group_id + INNER JOIN m_group center ON center.id = mg.parent_id + INNER JOIN m_portfolio mp ON mp.id = center.portfolio_id + INNER JOIN m_supervision ms ON ms.id = mp.supervision_id + INNER JOIN m_agency mag ON mag.id = ms.agency_id + ) individualOffice ON individualOffice.group_id = g.id + LEFT JOIN m_agency ma ON g.agency_id = ma.id + LEFT JOIN ( SELECT agency_id, linked_office_id FROM m_supervision GROUP BY agency_id ) supv ON supv.agency_id = ma.id + LEFT JOIN m_office mo ON mo.id = supv.linked_office_id + LEFT JOIN m_office moind ON moind.id = individualOffice.supervision_office + LEFT JOIN ( + SELECT + mcvr.prequalification_id, + COUNT( CASE WHEN mcvr.validation_color_enum = 1 THEN 1 END ) AS greenValidCount, + COUNT( CASE WHEN mcvr.validation_color_enum = 2 THEN 1 END ) AS yellowValidCount, + COUNT( CASE WHEN mcvr.validation_color_enum = 3 THEN 1 END ) AS orangeValidCount, + COUNT( CASE WHEN mcvr.validation_color_enum = 4 THEN 1 END ) AS redValidCount + FROM + m_checklist_validation_result mcvr + GROUP BY + mcvr.prequalification_id + ) validations ON validations.prequalification_id = g.id + LEFT JOIN m_group cg ON cg.id = g.group_id + LEFT JOIN m_group linkedGroup ON linkedGroup.prequalification_id = g.id + LEFT JOIN m_group pc ON pc.id = g.center_id + LEFT JOIN m_prequalification_status_log sl ON sl.prequalification_id = g.id + AND sl.to_status = g.STATUS + AND sl.id = ( SELECT MAX( id ) FROM m_prequalification_status_log WHERE prequalification_id = g.id AND sl.to_status = g.STATUS ) + LEFT JOIN m_appuser assigned ON assigned.id = sl.assigned_to + LEFT JOIN m_appuser mu ON mu.id = sl.updatedby_id + LEFT JOIN m_appuser fa ON fa.id = g.facilitator + LEFT JOIN ( SELECT count(*) AS reprocess_count, prequalification_id, to_status FROM + m_prequalification_status_log GROUP BY prequalification_id, to_status ) + mpsl ON mpsl.prequalification_id = g.id """; this.grpSchema = """ From 84579b7e86b3acc16cd48df6b593067e8648266e Mon Sep 17 00:00:00 2001 From: Muhimbura Brian Mart Date: Thu, 19 Sep 2024 20:37:43 +0300 Subject: [PATCH 2/2] Latest QA-PREQUALIFICATION FIX --- .../service/PrequalificationReadPlatformServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java index 84df379e61b..44881edfc59 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java @@ -412,7 +412,7 @@ private static final class PrequalificationsGroupMapper implements RowMapper