FINERACT-1981: Interest recalculation - Recalculate Interest For Loan - Business step for COB

This commit is contained in:
Soma Sörös
2024-08-29 21:18:05 +02:00
committed by Adam Saghy
parent b4f5a3a175
commit 8b89aaf413
11 changed files with 396 additions and 74 deletions
@@ -101,6 +101,9 @@ public interface LoanWritePlatformService {
CommandProcessingResult updateDisbursementDateAndAmountForTranche(Long loanId, Long disbursementId, JsonCommand command);
@Transactional
Loan recalculateInterest(Loan loan);
CommandProcessingResult recoverFromGuarantor(Long loanId);
void applyMeetingDateChanges(Calendar calendar, Collection<CalendarInstance> loanCalendarInstances);
@@ -22,27 +22,26 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.infrastructure.core.domain.FineractContext;
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
@NoArgsConstructor
@RequiredArgsConstructor
@Slf4j
public class RecalculateInterestPoster implements Callable<Void> {
@Setter
private Collection<Long> loanIds;
private LoanWritePlatformService loanWritePlatformService;
public void setLoanIds(final Collection<Long> loanIds) {
this.loanIds = loanIds;
}
public void setLoanWritePlatformService(final LoanWritePlatformService loanWritePlatformService) {
this.loanWritePlatformService = loanWritePlatformService;
}
@Setter
private FineractContext fineractContext;
private final LoanWritePlatformService loanWritePlatformService;
@Override
public Void call() throws JobExecutionException {
ThreadLocalContextUtil.init(fineractContext);
if (!loanIds.isEmpty()) {
List<Throwable> errors = new ArrayList<>();
for (Long loanId : loanIds) {