update tomcat plugin, handle change of disbursement date when modifying loan application for now.
This commit is contained in:
@@ -7,7 +7,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'bmuschko:gradle-tomcat-plugin:0.9.3'
|
classpath 'bmuschko:gradle-tomcat-plugin:0.9.5'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -274,7 +274,8 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
|
|
||||||
public void modifyLoanApplication(final LoanApplicationCommand command, final Client client, final LoanProduct loanProduct,
|
public void modifyLoanApplication(final LoanApplicationCommand command, final Client client, final LoanProduct loanProduct,
|
||||||
final Fund fund, final LoanTransactionProcessingStrategy strategy, final LoanScheduleData modifiedLoanSchedule, final Set<LoanCharge> charges,
|
final Fund fund, final LoanTransactionProcessingStrategy strategy, final LoanScheduleData modifiedLoanSchedule, final Set<LoanCharge> charges,
|
||||||
final Staff loanOfficer) {
|
final Staff loanOfficer,
|
||||||
|
final LoanLifecycleStateMachine loanLifecycleStateMachine) {
|
||||||
|
|
||||||
if (command.isClientChanged()) {
|
if (command.isClientChanged()) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
@@ -307,6 +308,8 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
if (command.isExpectedDisbursementDateChanged()) {
|
if (command.isExpectedDisbursementDateChanged()) {
|
||||||
if (command.getExpectedDisbursementDate() != null) {
|
if (command.getExpectedDisbursementDate() != null) {
|
||||||
this.expectedDisbursedOnDate = command.getExpectedDisbursementDate().toDate();
|
this.expectedDisbursedOnDate = command.getExpectedDisbursementDate().toDate();
|
||||||
|
removeFirstDisbursementTransaction();
|
||||||
|
disburse(command.getExpectedDisbursementDate(), loanLifecycleStateMachine, false);
|
||||||
} else {
|
} else {
|
||||||
this.expectedDisbursedOnDate = null;
|
this.expectedDisbursedOnDate = null;
|
||||||
}
|
}
|
||||||
@@ -358,6 +361,15 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
loanRepaymentScheduleTransactionProcessor.handleTransaction(repaymentsOrWaivers, getCurrency(), this.repaymentScheduleInstallments);
|
loanRepaymentScheduleTransactionProcessor.handleTransaction(repaymentsOrWaivers, getCurrency(), this.repaymentScheduleInstallments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeFirstDisbursementTransaction() {
|
||||||
|
for (LoanTransaction loanTransaction : loanTransactions) {
|
||||||
|
if (loanTransaction.isDisbursement()) {
|
||||||
|
loanTransactions.remove(loanTransaction);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void submitApplication(
|
public void submitApplication(
|
||||||
final Integer loanTermFrequency,
|
final Integer loanTermFrequency,
|
||||||
final PeriodFrequencyType loanTermFrequencyType,
|
final PeriodFrequencyType loanTermFrequencyType,
|
||||||
@@ -502,13 +514,15 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
modifiedInstallment.updateLoan(this);
|
modifiedInstallment.updateLoan(this);
|
||||||
this.repaymentScheduleInstallments.add(modifiedInstallment);
|
this.repaymentScheduleInstallments.add(modifiedInstallment);
|
||||||
}
|
}
|
||||||
disburse(disbursedOn, loanLifecycleStateMachine);
|
disburse(disbursedOn, loanLifecycleStateMachine, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disburse(final LocalDate disbursedOn, final LoanLifecycleStateMachine loanLifecycleStateMachine) {
|
public void disburse(final LocalDate disbursedOn, final LoanLifecycleStateMachine loanLifecycleStateMachine, final boolean statusTransition) {
|
||||||
|
|
||||||
LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.LOAN_DISBURSED, LoanStatus.fromInt(this.loanStatus));
|
if (statusTransition) {
|
||||||
this.loanStatus = statusEnum.getValue();
|
LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.LOAN_DISBURSED, LoanStatus.fromInt(this.loanStatus));
|
||||||
|
this.loanStatus = statusEnum.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
this.disbursedOnDate = disbursedOn.toDateTimeAtCurrentTime().toDate();
|
this.disbursedOnDate = disbursedOn.toDateTimeAtCurrentTime().toDate();
|
||||||
this.expectedMaturityDate = this.repaymentScheduleInstallments
|
this.expectedMaturityDate = this.repaymentScheduleInstallments
|
||||||
|
|||||||
+2
-2
@@ -163,7 +163,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
final Set<LoanCharge> charges = this.loanChargeAssembler.assembleFrom(command.getCharges(), loanProduct.getCharges(), loan.getPrincpal().getAmount());
|
final Set<LoanCharge> charges = this.loanChargeAssembler.assembleFrom(command.getCharges(), loanProduct.getCharges(), loan.getPrincpal().getAmount());
|
||||||
|
|
||||||
final LoanScheduleData loanSchedule = this.calculationPlatformService.calculateLoanScheduleNew(command.toCalculateLoanScheduleCommand());
|
final LoanScheduleData loanSchedule = this.calculationPlatformService.calculateLoanScheduleNew(command.toCalculateLoanScheduleCommand());
|
||||||
loan.modifyLoanApplication(command, client, loanProduct, fund, strategy, loanSchedule, charges, loanOfficer);
|
loan.modifyLoanApplication(command, client, loanProduct, fund, strategy, loanSchedule, charges, loanOfficer, defaultLoanLifecycleStateMachine());
|
||||||
|
|
||||||
this.loanRepository.save(loan);
|
this.loanRepository.save(loan);
|
||||||
|
|
||||||
@@ -391,7 +391,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
}
|
}
|
||||||
loan.disburseWithModifiedRepaymentSchedule(actualDisbursementDate, modifiedLoanRepaymentSchedule, defaultLoanLifecycleStateMachine());
|
loan.disburseWithModifiedRepaymentSchedule(actualDisbursementDate, modifiedLoanRepaymentSchedule, defaultLoanLifecycleStateMachine());
|
||||||
} else {
|
} else {
|
||||||
loan.disburse(actualDisbursementDate, defaultLoanLifecycleStateMachine());
|
loan.disburse(actualDisbursementDate, defaultLoanLifecycleStateMachine(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loanRepository.save(loan);
|
this.loanRepository.save(loan);
|
||||||
|
|||||||
Reference in New Issue
Block a user