From 8b2fb052d49509808491c360e054ed04a89e34e7 Mon Sep 17 00:00:00 2001 From: Nitesh Yadav Date: Fri, 25 Sep 2026 12:40:21 +0530 Subject: [PATCH] fix(fd): keep a genuinely-matured FD on the Dashboard instead of dropping it The maturity-dashboard query only ever selected ACTIVE(300) accounts. That was fine while nothing ever really reached MATURED(800) in this dev setup (test dates were only SQL-backdated, never run through the real nightly job), but the first time the job actually flipped an account's real status, it silently vanished from the ladder instead of showing under "Matured" -- exactly the state the ladder exists to surface. Now selects ACTIVE or MATURED. Co-Authored-By: Claude Sonnet 5 --- .../FixedDepositMaturityDashboardApiResource.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositMaturityDashboardApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositMaturityDashboardApiResource.java index c1a1c8b51..9ab7d736f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositMaturityDashboardApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositMaturityDashboardApiResource.java @@ -33,8 +33,12 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Component; /** - * FD Dashboard's data source: every ACTIVE Fixed Deposit with just the fields the maturity ladder - * needs (account/client/product identity, maturity date, deposit and maturity amounts). + * FD Dashboard's data source: every Fixed Deposit still sitting on its own account -- ACTIVE, or the + * real MATURED(800) status the nightly maturity job sets once it's past maturity_date with no + * closure instruction to auto-process -- with just the fields the maturity ladder needs + * (account/client/product identity, maturity date, deposit and maturity amounts). A MATURED FD stays + * here until it's actually renewed or closed, since that's exactly the "needs manual attention" + * state the ladder exists to surface. * * Deliberately not routed through {@link FixedDepositAccountsApiResource#retrieveAll}: that * endpoint's mapper joins m_savings_account to m_client, m_group, m_staff, m_currency, @@ -57,6 +61,8 @@ public class FixedDepositMaturityDashboardApiResource { private static final int FIXED_DEPOSIT = 200; /** SavingsAccountStatusType.ACTIVE. */ private static final int ACTIVE = 300; + /** SavingsAccountStatusType.MATURED -- set by the nightly job once past maturity_date. */ + private static final int MATURED = 800; private final PlatformSecurityContext context; private final JdbcTemplate jdbcTemplate; @@ -87,9 +93,9 @@ public class FixedDepositMaturityDashboardApiResource { JOIN m_savings_product sp ON sp.id = sa.product_id LEFT JOIN m_deposit_product_term_and_preclosure dptp ON dptp.savings_product_id = sp.id LEFT JOIN m_client c ON c.id = sa.client_id - WHERE sa.deposit_type_enum = ? AND sa.status_enum = ? + WHERE sa.deposit_type_enum = ? AND sa.status_enum IN (?, ?) ORDER BY datp.maturity_date ASC - """, FIXED_DEPOSIT, ACTIVE); + """, FIXED_DEPOSIT, ACTIVE, MATURED); return this.gson.toJson(rows); }