resolving compilation issue and bumping up sql patch number
This commit is contained in:
+24
-22
@@ -42,7 +42,6 @@ import org.mifosplatform.portfolio.calendar.domain.CalendarInstanceRepository;
|
|||||||
import org.mifosplatform.portfolio.loanaccount.data.HolidayDetailDTO;
|
import org.mifosplatform.portfolio.loanaccount.data.HolidayDetailDTO;
|
||||||
import org.mifosplatform.portfolio.loanaccount.data.LoanChargePaidByData;
|
import org.mifosplatform.portfolio.loanaccount.data.LoanChargePaidByData;
|
||||||
import org.mifosplatform.portfolio.loanaccount.data.ScheduleGeneratorDTO;
|
import org.mifosplatform.portfolio.loanaccount.data.ScheduleGeneratorDTO;
|
||||||
import org.mifosplatform.portfolio.loanaccount.domain.ChangedTransactionDetail;
|
|
||||||
import org.mifosplatform.portfolio.loanaccount.domain.DefaultLoanLifecycleStateMachine;
|
import org.mifosplatform.portfolio.loanaccount.domain.DefaultLoanLifecycleStateMachine;
|
||||||
import org.mifosplatform.portfolio.loanaccount.domain.Loan;
|
import org.mifosplatform.portfolio.loanaccount.domain.Loan;
|
||||||
import org.mifosplatform.portfolio.loanaccount.domain.LoanAccountDomainService;
|
import org.mifosplatform.portfolio.loanaccount.domain.LoanAccountDomainService;
|
||||||
@@ -121,13 +120,10 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
HolidayRepositoryWrapper holidayRepository, WorkingDaysRepositoryWrapper workingDaysRepository,
|
HolidayRepositoryWrapper holidayRepository, WorkingDaysRepositoryWrapper workingDaysRepository,
|
||||||
LoanRepaymentScheduleHistoryRepository loanRepaymentScheduleHistoryRepository,
|
LoanRepaymentScheduleHistoryRepository loanRepaymentScheduleHistoryRepository,
|
||||||
final LoanScheduleHistoryWritePlatformService loanScheduleHistoryWritePlatformService,
|
final LoanScheduleHistoryWritePlatformService loanScheduleHistoryWritePlatformService,
|
||||||
final CalendarInstanceRepository calendarInstanceRepository,
|
final CalendarInstanceRepository calendarInstanceRepository, final LoanAccountDomainService loanAccountDomainService,
|
||||||
final LoanAccountDomainService loanAccountDomainService,
|
final LoanChargeReadPlatformService loanChargeReadPlatformService, final LoanScheduleGeneratorFactory loanScheduleFactory,
|
||||||
final LoanChargeReadPlatformService loanChargeReadPlatformService,
|
|
||||||
final LoanScheduleGeneratorFactory loanScheduleFactory,
|
|
||||||
final LoanTransactionRepository loanTransactionRepository,
|
final LoanTransactionRepository loanTransactionRepository,
|
||||||
final JournalEntryWritePlatformService journalEntryWritePlatformService,
|
final JournalEntryWritePlatformService journalEntryWritePlatformService, final LoanRepository loanRepository,
|
||||||
final LoanRepository loanRepository,
|
|
||||||
final LoanAssembler loanAssembler) {
|
final LoanAssembler loanAssembler) {
|
||||||
this.loanRepositoryWrapper = loanRepositoryWrapper;
|
this.loanRepositoryWrapper = loanRepositoryWrapper;
|
||||||
this.codeValueRepositoryWrapper = codeValueRepositoryWrapper;
|
this.codeValueRepositoryWrapper = codeValueRepositoryWrapper;
|
||||||
@@ -271,7 +267,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
|
|
||||||
catch (final DataIntegrityViolationException dve) {
|
catch (final DataIntegrityViolationException dve) {
|
||||||
// handle the data integrity violation
|
// handle the data integrity violation
|
||||||
handleDataIntegrityViolation(jsonCommand, dve);
|
handleDataIntegrityViolation(dve);
|
||||||
|
|
||||||
// return an empty command processing result object
|
// return an empty command processing result object
|
||||||
return CommandProcessingResult.empty();
|
return CommandProcessingResult.empty();
|
||||||
@@ -359,8 +355,8 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
if (Money.of(currency, period.principalDue()).isZero() && Money.of(currency, period.interestDue()).isZero()
|
if (Money.of(currency, period.principalDue()).isZero() && Money.of(currency, period.interestDue()).isZero()
|
||||||
&& repaymentScheduleInstallment.isNotFullyPaidOff()) {
|
&& repaymentScheduleInstallment.isNotFullyPaidOff()) {
|
||||||
|
|
||||||
if(repaymentScheduleInstallment.getPenaltyChargesOutstanding(currency).isGreaterThan(zeroAmount) ||
|
if (repaymentScheduleInstallment.getPenaltyChargesOutstanding(currency).isGreaterThan(zeroAmount)
|
||||||
repaymentScheduleInstallment.getFeeChargesOutstanding(currency).isGreaterThan(zeroAmount)) {
|
|| repaymentScheduleInstallment.getFeeChargesOutstanding(currency).isGreaterThan(zeroAmount)) {
|
||||||
|
|
||||||
waiveLoanCharges.addAll(loan.getLoanCharges(periodDueDate));
|
waiveLoanCharges.addAll(loan.getLoanCharges(periodDueDate));
|
||||||
}
|
}
|
||||||
@@ -395,7 +391,8 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
// update the status of the request
|
// update the status of the request
|
||||||
loanRescheduleRequest.approve(appUser, approvedOnDate);
|
loanRescheduleRequest.approve(appUser, approvedOnDate);
|
||||||
|
|
||||||
// update the derived fields of each loan repayments schedule instalments
|
// update the derived fields of each loan repayments schedule
|
||||||
|
// instalments
|
||||||
for (final LoanRepaymentScheduleInstallment repaymentScheduleInstallment : repaymentScheduleInstallments) {
|
for (final LoanRepaymentScheduleInstallment repaymentScheduleInstallment : repaymentScheduleInstallments) {
|
||||||
repaymentScheduleInstallment.updateDerivedFields(currency, new LocalDate());
|
repaymentScheduleInstallment.updateDerivedFields(currency, new LocalDate());
|
||||||
}
|
}
|
||||||
@@ -410,7 +407,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
|
|
||||||
catch (final DataIntegrityViolationException dve) {
|
catch (final DataIntegrityViolationException dve) {
|
||||||
// handle the data integrity violation
|
// handle the data integrity violation
|
||||||
handleDataIntegrityViolation(jsonCommand, dve);
|
handleDataIntegrityViolation(dve);
|
||||||
|
|
||||||
// return an empty command processing result object
|
// return an empty command processing result object
|
||||||
return CommandProcessingResult.empty();
|
return CommandProcessingResult.empty();
|
||||||
@@ -420,11 +417,14 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
/**
|
/**
|
||||||
* waive all charges in the collection
|
* waive all charges in the collection
|
||||||
*
|
*
|
||||||
* @param loan Loan object
|
* @param loan
|
||||||
* @param loanCharges collection of LoanCharge objects
|
* Loan object
|
||||||
|
* @param loanCharges
|
||||||
|
* collection of LoanCharge objects
|
||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
private void waiveLoanCharges(Loan loan, Collection<LoanCharge> loanCharges) {
|
private void waiveLoanCharges(Loan loan, Collection<LoanCharge> loanCharges) {
|
||||||
|
AppUser currentUser = this.platformSecurityContext.authenticatedUser();
|
||||||
this.loanAssembler.setHelpers(loan);
|
this.loanAssembler.setHelpers(loan);
|
||||||
|
|
||||||
for (LoanCharge loanCharge : loanCharges) {
|
for (LoanCharge loanCharge : loanCharges) {
|
||||||
@@ -454,8 +454,8 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
LocalDate lastTransactionDate = null;
|
LocalDate lastTransactionDate = null;
|
||||||
Long overdurPenaltyWaitPeriod = null;
|
Long overdurPenaltyWaitPeriod = null;
|
||||||
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
||||||
restCalendarInstance = calendarInstanceRepository.findCalendarInstaneByEntityId(loan.loanInterestRecalculationDetailId(),
|
restCalendarInstance = calendarInstanceRepository.findCalendarInstaneByEntityId(
|
||||||
CalendarEntityType.LOAN_RECALCULATION_DETAIL.getValue());
|
loan.loanInterestRecalculationDetailId(), CalendarEntityType.LOAN_RECALCULATION_DETAIL.getValue());
|
||||||
|
|
||||||
final MonetaryCurrency currency = loan.getCurrency();
|
final MonetaryCurrency currency = loan.getCurrency();
|
||||||
applicationCurrency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currency);
|
applicationCurrency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currency);
|
||||||
@@ -465,15 +465,16 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
loan.getDisbursementDate(), loan, calendarInstance);
|
loan.getDisbursementDate(), loan, calendarInstance);
|
||||||
|
|
||||||
isHolidayEnabled = this.configurationDomainService.isRescheduleRepaymentsOnHolidaysEnabled();
|
isHolidayEnabled = this.configurationDomainService.isRescheduleRepaymentsOnHolidaysEnabled();
|
||||||
holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(loan.getOfficeId(), loan.getDisbursementDate().toDate());
|
holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(loan.getOfficeId(), loan.getDisbursementDate()
|
||||||
|
.toDate());
|
||||||
workingDays = this.workingDaysRepository.findOne();
|
workingDays = this.workingDaysRepository.findOne();
|
||||||
overdurPenaltyWaitPeriod = this.configurationDomainService.retrievePenaltyWaitPeriod();
|
overdurPenaltyWaitPeriod = this.configurationDomainService.retrievePenaltyWaitPeriod();
|
||||||
}
|
}
|
||||||
|
|
||||||
HolidayDetailDTO holidayDetailDTO = new HolidayDetailDTO(isHolidayEnabled, holidays, workingDays);
|
HolidayDetailDTO holidayDetailDTO = new HolidayDetailDTO(isHolidayEnabled, holidays, workingDays);
|
||||||
ScheduleGeneratorDTO scheduleGeneratorDTO = new ScheduleGeneratorDTO(loanScheduleFactory, applicationCurrency,
|
ScheduleGeneratorDTO scheduleGeneratorDTO = new ScheduleGeneratorDTO(loanScheduleFactory, applicationCurrency,
|
||||||
calculatedRepaymentsStartingFromDate, holidayDetailDTO, restCalendarInstance, recalculateFrom, overdurPenaltyWaitPeriod,
|
calculatedRepaymentsStartingFromDate, holidayDetailDTO, restCalendarInstance, recalculateFrom,
|
||||||
lastTransactionDate);
|
overdurPenaltyWaitPeriod, lastTransactionDate);
|
||||||
|
|
||||||
Money accruedCharge = Money.zero(loan.getCurrency());
|
Money accruedCharge = Money.zero(loan.getCurrency());
|
||||||
if (loan.isPeriodicAccrualAccountingEnabledOnLoanProduct()) {
|
if (loan.isPeriodicAccrualAccountingEnabledOnLoanProduct()) {
|
||||||
@@ -485,7 +486,8 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
}
|
}
|
||||||
|
|
||||||
final LoanTransaction loanTransaction = loan.waiveLoanCharge(loanCharge, defaultLoanLifecycleStateMachine(), changes,
|
final LoanTransaction loanTransaction = loan.waiveLoanCharge(loanCharge, defaultLoanLifecycleStateMachine(), changes,
|
||||||
existingTransactionIds, existingReversedTransactionIds, loanInstallmentNumber, scheduleGeneratorDTO, accruedCharge);
|
existingTransactionIds, existingReversedTransactionIds, loanInstallmentNumber, scheduleGeneratorDTO, accruedCharge,
|
||||||
|
currentUser);
|
||||||
|
|
||||||
this.loanTransactionRepository.save(loanTransaction);
|
this.loanTransactionRepository.save(loanTransaction);
|
||||||
|
|
||||||
@@ -545,7 +547,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
|
|
||||||
catch (final DataIntegrityViolationException dve) {
|
catch (final DataIntegrityViolationException dve) {
|
||||||
// handle the data integrity violation
|
// handle the data integrity violation
|
||||||
handleDataIntegrityViolation(jsonCommand, dve);
|
handleDataIntegrityViolation(dve);
|
||||||
|
|
||||||
// return an empty command processing result object
|
// return an empty command processing result object
|
||||||
return CommandProcessingResult.empty();
|
return CommandProcessingResult.empty();
|
||||||
@@ -562,7 +564,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
|||||||
* data integrity violation exception
|
* data integrity violation exception
|
||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
private void handleDataIntegrityViolation(final JsonCommand jsonCommand, final DataIntegrityViolationException dve) {
|
private void handleDataIntegrityViolation(final DataIntegrityViolationException dve) {
|
||||||
|
|
||||||
logger.error(dve.getMessage(), dve);
|
logger.error(dve.getMessage(), dve);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user