Skip to content

Conversation

fiter-julius-oketayot
Copy link

Description

Describe the changes made and why they were made.

Ignore if these details are present on the associated Apache Fineract JIRA ticket.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per https://github.com/apache/fineract/#pull-requests

  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.

  • Create/update unit or integration tests for verifying the changes made.

  • Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.

  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes

  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

@Copilot Copilot AI review requested due to automatic review settings October 2, 2025 12:32
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a new monthly accrual summary job for Fineract that automatically generates aggregated summaries of loan interest accrual transactions at month-end. The solution provides a non-intrusive way to create monthly summaries without modifying core accrual functionality.

Key changes:

  • Adds new database tables for storing monthly accrual summaries and tracking processed transactions
  • Implements a Spring Batch job that runs monthly to process accrual transactions
  • Creates comprehensive service layer with duplicate prevention and error handling

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
LoanMonthlyAccrualSummaryServiceImpl.java Core service implementation for processing monthly accrual summaries
LoanMonthlyAccrualSummaryService.java Service interface defining business operations for accrual summary processing
GenerateMonthlyAccrualSummariesTasklet.java Spring Batch tasklet that executes the monthly summary generation
GenerateMonthlyAccrualSummariesConfig.java Spring configuration for the batch job setup
LoanTransactionRepository.java Enhanced with queries to find unprocessed accrual transactions
LoanMonthlyAccrualSummaryRepository.java Repository for monthly accrual summary operations
LoanMonthlyAccrualSummary.java JPA entity representing monthly accrual summaries
LoanAccrualTransactionProcessingRepository.java Repository for tracking processed transactions
LoanAccrualTransactionProcessing.java JPA entity for preventing duplicate transaction processing
LoanMonthlyAccrualSummaryData.java Data transfer object for accrual summary information
JobName.java Adds new job name enum for the monthly accrual summary job
0007-create-monthly-accrual-summary-table.xml Database migration script creating required tables and indices
MONTHLY_ACCRUAL_SUMMARY_JOB.md Comprehensive documentation for the new feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 211 to 213
private List<LoanTransaction> findUnprocessedAccrualTransactionsForLoan(Long loanId, LocalDate startDate, LocalDate endDate) {
Set<Long> processedTransactionIds = processingRepository.findProcessedTransactionIdsByLoanAndPeriod(
loanId, startDate.getYear(), startDate.getMonthValue());
Copy link
Preview

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using startDate.getYear() and startDate.getMonthValue() may not match the intended year and month parameters. The method should use the provided year and month parameters instead to ensure consistency with the processing logic.

Suggested change
private List<LoanTransaction> findUnprocessedAccrualTransactionsForLoan(Long loanId, LocalDate startDate, LocalDate endDate) {
Set<Long> processedTransactionIds = processingRepository.findProcessedTransactionIdsByLoanAndPeriod(
loanId, startDate.getYear(), startDate.getMonthValue());
private List<LoanTransaction> findUnprocessedAccrualTransactionsForLoan(Long loanId, LocalDate startDate, LocalDate endDate, int year, int month) {
Set<Long> processedTransactionIds = processingRepository.findProcessedTransactionIdsByLoanAndPeriod(
loanId, year, month);

Copilot uses AI. Check for mistakes.

"WHERE lt.typeOf = :transactionType " +
"AND lt.dateOf BETWEEN :startDate AND :endDate " +
"AND lt.reversed = false " +
"AND (:processedIds IS NULL OR lt.id NOT IN :processedIds) " +
Copy link
Preview

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using NOT IN with a potentially large set of IDs can be inefficient and may cause performance issues with NULL values. Consider using NOT EXISTS with a subquery or handling empty sets explicitly to improve query performance.

Copilot uses AI. Check for mistakes.

"AND lt.typeOf = :transactionType " +
"AND lt.dateOf BETWEEN :startDate AND :endDate " +
"AND lt.reversed = false " +
"AND (:processedIds IS NULL OR lt.id NOT IN :processedIds) " +
Copy link
Preview

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using NOT IN with a potentially large set of IDs can be inefficient and may cause performance issues with NULL values. Consider using NOT EXISTS with a subquery or handling empty sets explicitly to improve query performance.

Copilot uses AI. Check for mistakes.

@fiter-julius-oketayot fiter-julius-oketayot force-pushed the feat/CRED-75 branch 2 times, most recently from 9249609 to 9788f02 Compare October 4, 2025 04:51
@Copilot Copilot AI review requested due to automatic review settings October 4, 2025 04:52
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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