FINERACT-2618: Add originators to journal entry aggregation job and improve reports.#5898
Conversation
66a379b to
19febc5
Compare
|
@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. |
de32e00 to
158b5b1
Compare
|
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? |
…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)
158b5b1 to
220789a
Compare
|
@AshharAhmadKhan Please rebase and fix failing checks |
|
Hey @adamsaghy , just saw 2421 merged - it does this exact fix already, so closing this one out. Good work on 2421! One thing worth noting though: they resolve the originator list with a correlated subquery per row, while I was using a CTE with a single LEFT JOIN instead. Isn't it better to do it this way? Let me know your thoughts. |
Description
The journal entry aggregation job was grouping entries only by asset owner, leaving
originator_external_idsalways 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:
loan_originatorsCTE to the aggregation job reader query and wiresoriginator_external_idsthrough the full pipeline — DTO, JPA entity, and writer service — so it gets correctly persisted per summary row0236sosummary_snapshot_baseline_datareads the stored originator value directly instead of hardcoding NULL, letting the snapshot join cleanly on originator without re-hitting the mapping tables