You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2023/01/18 13:56:25 UTC

[GitHub] [fineract] galovics commented on a diff in pull request #2897: [FINERACT-1859] Avro schema for LoanAccountsStayedLockedBusinessEvent

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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org