adamsaghy commented on code in PR #3112:
URL: https://github.com/apache/fineract/pull/3112#discussion_r1163809195
##########
fineract-provider/src/main/java/org/apache/fineract/cob/loan/FetchAndLockLoanTasklet.java:
##########
@@ -46,67 +40,44 @@ public class FetchAndLockLoanTasklet implements Tasklet {
private static final Long NUMBER_OF_DAYS_BEHIND = 1L;
- private final LoanAccountLockRepository loanAccountLockRepository;
-
private final RetrieveLoanIdService retrieveLoanIdService;
- private final FineractProperties fineractProperties;
-
private final JdbcTemplate jdbcTemplate;
@Override
public RepeatStatus execute(@NotNull StepContribution contribution,
@NotNull ChunkContext chunkContext) throws Exception {
String businessDateParameter = (String)
contribution.getStepExecution().getJobExecution().getExecutionContext()
.get(LoanCOBConstant.BUSINESS_DATE_PARAMETER_NAME);
LocalDate businessDate =
LocalDate.parse(Objects.requireNonNull(businessDateParameter));
- List<Long> allNonClosedLoanIds =
retrieveLoanIdService.retrieveLoanIdsNDaysBehind(NUMBER_OF_DAYS_BEHIND,
businessDate);
- if (allNonClosedLoanIds.isEmpty()) {
-
contribution.getStepExecution().getJobExecution().getExecutionContext().put(LoanCOBConstant.LOAN_IDS,
Collections.emptyList());
+ LoanCOBMinANdMaxLoanId minAndMaxLoanId =
retrieveLoanIdService.retrieveMinAndMaxLoanIdsNDaysBehind(NUMBER_OF_DAYS_BEHIND,
+ businessDate);
+ if (Objects.isNull(minAndMaxLoanId)
+ || (Objects.isNull(minAndMaxLoanId.getMinLoanId()) &&
Objects.isNull(minAndMaxLoanId.getMaxLoanId()))) {
+
contribution.getStepExecution().getJobExecution().getExecutionContext().put(LoanCOBConstant.LOAN_IDS,
null);
Review Comment:
NPE if anyone fetching the `LoanCOBMinANdMaxLoanId` at a later step?
--
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]