Skip to content

FINERACT-2618: Add originators to journal entry aggregation job and improve reports.#5898

Open
AshharAhmadKhan wants to merge 1 commit into
apache:developfrom
AshharAhmadKhan:FINERACT-2618-add-originators-to-journal-entry-aggregation-job
Open

FINERACT-2618: Add originators to journal entry aggregation job and improve reports.#5898
AshharAhmadKhan wants to merge 1 commit into
apache:developfrom
AshharAhmadKhan:FINERACT-2618-add-originators-to-journal-entry-aggregation-job

Conversation

@AshharAhmadKhan

Copy link
Copy Markdown
Contributor

Description

The journal entry aggregation job was grouping entries only by asset owner, leaving originator_external_ids always NULL in the summary table even though the column existed. This meant the Trial Balance report had to re-derive originator data from raw journal entries for every historical row already in the snapshot, adding unnecessary memory overhead. It also meant originator never appeared via the snapshot path even when one was attached to the loan.

This PR fixes both problems:

  • Adds a loan_originators CTE to the aggregation job reader query and wires originator_external_ids through the full pipeline — DTO, JPA entity, and writer service — so it gets correctly persisted per summary row
  • Updates the Trial Balance Summary Report (MySQL + PostgreSQL) via migration 0236 so summary_snapshot_baseline_data reads the stored originator value directly instead of hardcoding NULL, letting the snapshot join cleanly on originator without re-hitting the mapping tables
  • Updates unit tests for the reader and writer service to cover the new field
  • Adds an integration test that runs the actual aggregation job end-to-end and verifies originator surfaces correctly via the snapshot path

@AshharAhmadKhan AshharAhmadKhan force-pushed the FINERACT-2618-add-originators-to-journal-entry-aggregation-job branch 4 times, most recently from 66a379b to 19febc5 Compare May 27, 2026 12:32
@AshharAhmadKhan

Copy link
Copy Markdown
Contributor Author

@adamsaghy Checked all 4 failing CI checks. None are related to this PR's changes. Please re-trigger those checks when youu get a chance.

@AshharAhmadKhan AshharAhmadKhan force-pushed the FINERACT-2618-add-originators-to-journal-entry-aggregation-job branch from 19febc5 to de32e00 Compare May 28, 2026 16:53
…mprove reports

- Extend JournalEntryAggregationJobReader SQL with a loan_originators CTE
  (STRING_AGG/GROUP_CONCAT of originator external IDs from
  m_loan_originator_mapping + m_loan_originator), LEFT JOIN on loan.id,
  select originatorExternalIds, and add it to the GROUP BY clause

- Wire originatorExternalIds through the full pipeline:
  JournalEntryAggregationSummaryData (DTO field),
  JournalEntrySummary (@column mapping), and
  JournalEntryAggregationWriterServiceImpl (convertToJournalEntrySummary)

- Add Liquibase migration 0234: update the Trial Balance Summary Report
  (MySQL + PostgreSQL) so summary_snapshot_baseline_data reads
  COALESCE(ags.originator_external_ids, '') from the aggregation summary
  table instead of hardcoding NULL, eliminating the in-memory overhead
  described in the issue

- Update unit tests: JournalEntryAggregationJobReaderTest and
  JournalEntryAggregationWriterServiceImplTest cover the new field

- Add integration test (Order 6) in FeignTrialBalanceSummaryReportTest
  that runs the actual aggregation job and verifies originator_external_ids
  surfaces via the snapshot path (summary_snapshot_baseline_data)
@AshharAhmadKhan AshharAhmadKhan force-pushed the FINERACT-2618-add-originators-to-journal-entry-aggregation-job branch from de32e00 to 158b5b1 Compare May 29, 2026 02:38
@AshharAhmadKhan

Copy link
Copy Markdown
Contributor Author

Hi @adamsaghy, I’ve investigated this further and verified the originator flow end-to-end (reader → DTO → entity → writer → report snapshot path), but I’m still missing the cause of the Shard 15 integration failure. Could you please point me in the right direction if there’s any Fineract-specific behavior around Journal Entry Aggregation / Trial Balance reporting that I may be overlooking?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant