galovics commented on code in PR #2897:
URL: https://github.com/apache/fineract/pull/2897#discussion_r1073566287
##########
fineract-provider/src/main/java/org/apache/fineract/cob/loan/StayedLockedLoansTasklet.java:
##########
@@ -35,14 +40,24 @@ public class StayedLockedLoansTasklet implements Tasklet {
private final LoanAccountLockRepository loanAccountLockRepository;
private final BusinessEventNotifierService businessEventNotifierService;
+ private final LoanRepository loanRepository;
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext
chunkContext) throws Exception {
List<LoanAccountLock> loanAccountLocks =
loanAccountLockRepository.findAll();
if (!loanAccountLocks.isEmpty()) {
List<Long> loanIds =
loanAccountLocks.stream().map(LoanAccountLock::getLoanId).toList();
- businessEventNotifierService.notifyPostBusinessEvent(new
LoanAccountsStayedLockedBusinessEvent(loanIds));
+ businessEventNotifierService.notifyPostBusinessEvent(new
LoanAccountsStayedLockedBusinessEvent(buildLoanAccountData(loanIds)));
}
return RepeatStatus.FINISHED;
}
+
+ private LoanAccountsStayedLockedBusinessEvent.Data
buildLoanAccountData(List<Long> loanIds) {
+ List<LoanIdAndExternalIdAndAccountNo> stayedLockedLoanAccounts =
loanRepository.findAllStayedLockedByLoanIds(loanIds);
Review Comment:
Do we need to at all go to the database to grab this data? Can't we pass
this through some context?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]