-
Notifications
You must be signed in to change notification settings - Fork 0
feat(CRED-75): Implement Month-End Accrual Journal Entries #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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.
private List<LoanTransaction> findUnprocessedAccrualTransactionsForLoan(Long loanId, LocalDate startDate, LocalDate endDate) { | ||
Set<Long> processedTransactionIds = processingRepository.findProcessedTransactionIdsByLoanAndPeriod( | ||
loanId, startDate.getYear(), startDate.getMonthValue()); |
There was a problem hiding this comment.
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.
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) " + |
There was a problem hiding this comment.
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) " + |
There was a problem hiding this comment.
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.
9249609
to
9788f02
Compare
9788f02
to
6a37026
Compare
There was a problem hiding this 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.
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.