FINERACT-1724: Added loanId to LoanTransactionData and extended the respective Avro schema
This commit is contained in:
committed by
Arnold Gálovics
parent
532bc507b6
commit
d2a12c3cfc
@@ -11,6 +11,14 @@
|
||||
"long"
|
||||
]
|
||||
},
|
||||
{
|
||||
"default": null,
|
||||
"name": "loanId",
|
||||
"type": [
|
||||
"null",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
{
|
||||
"default": null,
|
||||
"name": "officeId",
|
||||
|
||||
+29
-22
@@ -36,6 +36,7 @@ import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
|
||||
public class LoanTransactionData {
|
||||
|
||||
private final Long id;
|
||||
private final Long loanId;
|
||||
private final Long officeId;
|
||||
private final String officeName;
|
||||
|
||||
@@ -111,6 +112,7 @@ public class LoanTransactionData {
|
||||
this.date = null;
|
||||
this.type = null;
|
||||
this.id = null;
|
||||
this.loanId = null;
|
||||
this.officeId = null;
|
||||
this.officeName = null;
|
||||
this.currency = null;
|
||||
@@ -156,6 +158,7 @@ public class LoanTransactionData {
|
||||
this.dateFormat = dateFormat;
|
||||
this.locale = locale;
|
||||
this.id = null;
|
||||
this.loanId = null;
|
||||
this.officeId = null;
|
||||
this.officeName = null;
|
||||
this.type = null;
|
||||
@@ -197,7 +200,7 @@ public class LoanTransactionData {
|
||||
loanTransactionData.interestPortion, loanTransactionData.feeChargesPortion, loanTransactionData.penaltyChargesPortion,
|
||||
loanTransactionData.overpaymentPortion, loanTransactionData.unrecognizedIncomePortion, paymentTypeOptions,
|
||||
loanTransactionData.externalId, loanTransactionData.transfer, loanTransactionData.fixedEmiAmount,
|
||||
loanTransactionData.outstandingLoanBalance, loanTransactionData.manuallyReversed);
|
||||
loanTransactionData.outstandingLoanBalance, loanTransactionData.manuallyReversed, loanTransactionData.loanId);
|
||||
|
||||
}
|
||||
|
||||
@@ -206,10 +209,10 @@ public class LoanTransactionData {
|
||||
final BigDecimal netDisbursalAmount, final BigDecimal principalPortion, final BigDecimal interestPortion,
|
||||
final BigDecimal feeChargesPortion, final BigDecimal penaltyChargesPortion, final BigDecimal overpaymentPortion,
|
||||
final String externalId, final AccountTransferData transfer, BigDecimal fixedEmiAmount, BigDecimal outstandingLoanBalance,
|
||||
final BigDecimal unrecognizedIncomePortion, final boolean manuallyReversed) {
|
||||
final BigDecimal unrecognizedIncomePortion, final boolean manuallyReversed, Long loanId) {
|
||||
this(id, officeId, officeName, transactionType, paymentDetailData, currency, date, amount, netDisbursalAmount, principalPortion,
|
||||
interestPortion, feeChargesPortion, penaltyChargesPortion, overpaymentPortion, unrecognizedIncomePortion, null, externalId,
|
||||
transfer, fixedEmiAmount, outstandingLoanBalance, manuallyReversed);
|
||||
transfer, fixedEmiAmount, outstandingLoanBalance, manuallyReversed, loanId);
|
||||
}
|
||||
|
||||
public LoanTransactionData(final Long id, final Long officeId, final String officeName, final LoanTransactionEnumData transactionType,
|
||||
@@ -218,9 +221,9 @@ public class LoanTransactionData {
|
||||
final BigDecimal feeChargesPortion, final BigDecimal penaltyChargesPortion, final BigDecimal overpaymentPortion,
|
||||
BigDecimal unrecognizedIncomePortion, final Collection<PaymentTypeData> paymentTypeOptions, final String externalId,
|
||||
final AccountTransferData transfer, final BigDecimal fixedEmiAmount, BigDecimal outstandingLoanBalance,
|
||||
boolean manuallyReversed) {
|
||||
this(id, officeId, officeName, transactionType, paymentDetailData, currency, date, amount, netDisbursalAmount, principalPortion,
|
||||
interestPortion, feeChargesPortion, penaltyChargesPortion, overpaymentPortion, unrecognizedIncomePortion,
|
||||
boolean manuallyReversed, Long loanId) {
|
||||
this(id, loanId, officeId, officeName, transactionType, paymentDetailData, currency, date, amount, netDisbursalAmount,
|
||||
principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion, overpaymentPortion, unrecognizedIncomePortion,
|
||||
paymentTypeOptions, externalId, transfer, fixedEmiAmount, outstandingLoanBalance, null, manuallyReversed, null, null);
|
||||
}
|
||||
|
||||
@@ -230,21 +233,23 @@ public class LoanTransactionData {
|
||||
final BigDecimal feeChargesPortion, final BigDecimal penaltyChargesPortion, final BigDecimal overpaymentPortion,
|
||||
final BigDecimal unrecognizedIncomePortion, final String externalId, final AccountTransferData transfer,
|
||||
BigDecimal fixedEmiAmount, BigDecimal outstandingLoanBalance, LocalDate submittedOnDate, final boolean manuallyReversed,
|
||||
final String reversalExternalId, final LocalDate reversedOnDate) {
|
||||
this(id, officeId, officeName, transactionType, paymentDetailData, currency, date, amount, netDisbursalAmount, principalPortion,
|
||||
interestPortion, feeChargesPortion, penaltyChargesPortion, overpaymentPortion, unrecognizedIncomePortion, null, externalId,
|
||||
transfer, fixedEmiAmount, outstandingLoanBalance, submittedOnDate, manuallyReversed, reversalExternalId, reversedOnDate);
|
||||
final String reversalExternalId, final LocalDate reversedOnDate, Long loanId) {
|
||||
this(id, loanId, officeId, officeName, transactionType, paymentDetailData, currency, date, amount, netDisbursalAmount,
|
||||
principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion, overpaymentPortion, unrecognizedIncomePortion,
|
||||
null, externalId, transfer, fixedEmiAmount, outstandingLoanBalance, submittedOnDate, manuallyReversed, reversalExternalId,
|
||||
reversedOnDate);
|
||||
}
|
||||
|
||||
public LoanTransactionData(final Long id, final Long officeId, final String officeName, final LoanTransactionEnumData transactionType,
|
||||
final PaymentDetailData paymentDetailData, final CurrencyData currency, final LocalDate date, final BigDecimal amount,
|
||||
final BigDecimal netDisbursalAmount, final BigDecimal principalPortion, final BigDecimal interestPortion,
|
||||
final BigDecimal feeChargesPortion, final BigDecimal penaltyChargesPortion, final BigDecimal overpaymentPortion,
|
||||
final BigDecimal unrecognizedIncomePortion, final Collection<PaymentTypeData> paymentTypeOptions, final String externalId,
|
||||
final AccountTransferData transfer, final BigDecimal fixedEmiAmount, BigDecimal outstandingLoanBalance,
|
||||
final LocalDate submittedOnDate, final boolean manuallyReversed, final String reversalExternalId,
|
||||
final LocalDate reversedOnDate) {
|
||||
public LoanTransactionData(final Long id, Long loanId, final Long officeId, final String officeName,
|
||||
final LoanTransactionEnumData transactionType, final PaymentDetailData paymentDetailData, final CurrencyData currency,
|
||||
final LocalDate date, final BigDecimal amount, final BigDecimal netDisbursalAmount, final BigDecimal principalPortion,
|
||||
final BigDecimal interestPortion, final BigDecimal feeChargesPortion, final BigDecimal penaltyChargesPortion,
|
||||
final BigDecimal overpaymentPortion, final BigDecimal unrecognizedIncomePortion,
|
||||
final Collection<PaymentTypeData> paymentTypeOptions, final String externalId, final AccountTransferData transfer,
|
||||
final BigDecimal fixedEmiAmount, BigDecimal outstandingLoanBalance, final LocalDate submittedOnDate,
|
||||
final boolean manuallyReversed, final String reversalExternalId, final LocalDate reversedOnDate) {
|
||||
this.id = id;
|
||||
this.loanId = loanId;
|
||||
this.officeId = officeId;
|
||||
this.officeName = officeName;
|
||||
this.type = transactionType;
|
||||
@@ -274,8 +279,8 @@ public class LoanTransactionData {
|
||||
public LoanTransactionData(Long id, LoanTransactionEnumData transactionType, LocalDate date, BigDecimal totalAmount,
|
||||
BigDecimal netDisbursalAmount, BigDecimal principalPortion, BigDecimal interestPortion, BigDecimal feeChargesPortion,
|
||||
BigDecimal penaltyChargesPortion, BigDecimal overpaymentPortion, BigDecimal unrecognizedIncomePortion,
|
||||
BigDecimal outstandingLoanBalance, final boolean manuallyReversed) {
|
||||
this(id, null, null, transactionType, null, null, date, totalAmount, netDisbursalAmount, principalPortion, interestPortion,
|
||||
BigDecimal outstandingLoanBalance, final boolean manuallyReversed, Long loanId) {
|
||||
this(id, loanId, null, null, transactionType, null, null, date, totalAmount, netDisbursalAmount, principalPortion, interestPortion,
|
||||
feeChargesPortion, penaltyChargesPortion, overpaymentPortion, unrecognizedIncomePortion, null, null, null, null,
|
||||
outstandingLoanBalance, null, manuallyReversed, null, null);
|
||||
}
|
||||
@@ -285,6 +290,7 @@ public class LoanTransactionData {
|
||||
final BigDecimal netDisbursalAmount, final Collection<PaymentTypeData> paymentOptions, final BigDecimal retriveLastEmiAmount,
|
||||
final LocalDate possibleNextRepaymentDate) {
|
||||
final Long id = null;
|
||||
final Long loanId = null;
|
||||
final Long officeId = null;
|
||||
final String officeName = null;
|
||||
final PaymentDetailData paymentDetailData = null;
|
||||
@@ -300,14 +306,14 @@ public class LoanTransactionData {
|
||||
final AccountTransferData transfer = null;
|
||||
final LocalDate submittedOnDate = null;
|
||||
final boolean manuallyReversed = false;
|
||||
return new LoanTransactionData(id, officeId, officeName, transactionType, paymentDetailData, currency,
|
||||
return new LoanTransactionData(id, loanId, officeId, officeName, transactionType, paymentDetailData, currency,
|
||||
expectedDisbursedOnLocalDateForTemplate, disburseAmountForTemplate, netDisbursalAmount, principalPortion, interestPortion,
|
||||
feeChargesPortion, penaltyChargesPortion, overpaymentPortion, unrecognizedIncomePortion, paymentOptions, transfer,
|
||||
externalId, retriveLastEmiAmount, outstandingLoanBalance, submittedOnDate, manuallyReversed, possibleNextRepaymentDate);
|
||||
|
||||
}
|
||||
|
||||
private LoanTransactionData(Long id, final Long officeId, final String officeName, LoanTransactionEnumData transactionType,
|
||||
private LoanTransactionData(Long id, Long loanId, final Long officeId, final String officeName, LoanTransactionEnumData transactionType,
|
||||
final PaymentDetailData paymentDetailData, final CurrencyData currency, final LocalDate date, BigDecimal amount,
|
||||
BigDecimal netDisbursalAmount, final BigDecimal principalPortion, final BigDecimal interestPortion,
|
||||
final BigDecimal feeChargesPortion, final BigDecimal penaltyChargesPortion, final BigDecimal overpaymentPortion,
|
||||
@@ -315,6 +321,7 @@ public class LoanTransactionData {
|
||||
final String externalId, final BigDecimal fixedEmiAmount, BigDecimal outstandingLoanBalance, final LocalDate submittedOnDate,
|
||||
final boolean manuallyReversed, final LocalDate possibleNextRepaymentDate) {
|
||||
this.id = id;
|
||||
this.loanId = loanId;
|
||||
this.officeId = officeId;
|
||||
this.officeName = officeName;
|
||||
this.type = transactionType;
|
||||
|
||||
+1
-1
@@ -673,7 +673,7 @@ public class LoanTransaction extends AbstractAuditableWithUTCDateTimeCustom {
|
||||
return new LoanTransactionData(getId(), this.office.getId(), this.office.getName(), transactionType, paymentDetailData,
|
||||
currencyData, getTransactionDate(), this.amount, this.loan.getNetDisbursalAmount(), this.principalPortion,
|
||||
this.interestPortion, this.feeChargesPortion, this.penaltyChargesPortion, this.overPaymentPortion, this.externalId,
|
||||
transfer, null, outstandingLoanBalance, this.unrecognizedIncomePortion, this.manuallyAdjustedOrReversed);
|
||||
transfer, null, outstandingLoanBalance, this.unrecognizedIncomePortion, this.manuallyAdjustedOrReversed, this.loan.getId());
|
||||
}
|
||||
|
||||
public Map<String, Object> toMapData(final String currencyCode) {
|
||||
|
||||
+16
-12
@@ -459,7 +459,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
loanRepaymentScheduleInstallment.getInterestOutstanding(currency).getAmount(),
|
||||
loanRepaymentScheduleInstallment.getFeeChargesOutstanding(currency).getAmount().subtract(adjustedChargeAmount),
|
||||
loanRepaymentScheduleInstallment.getPenaltyChargesOutstanding(currency).getAmount(), null, unrecognizedIncomePortion,
|
||||
paymentOptions, null, null, null, outstandingLoanBalance, false);
|
||||
paymentOptions, null, null, null, outstandingLoanBalance, false, loanId);
|
||||
}
|
||||
|
||||
private BigDecimal adjustPrepayInstallmentCharge(Loan loan, final LocalDate onDate) {
|
||||
@@ -497,7 +497,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final BigDecimal unrecognizedIncomePortion = null;
|
||||
return new LoanTransactionData(null, null, null, transactionType, null, currencyData, waiveOfInterest.getTransactionDate(), amount,
|
||||
loan.getNetDisbursalAmount(), null, null, null, null, null, null, null, null, outstandingLoanBalance,
|
||||
unrecognizedIncomePortion, false);
|
||||
unrecognizedIncomePortion, false, loanId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -508,7 +508,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.WRITEOFF);
|
||||
final BigDecimal unrecognizedIncomePortion = null;
|
||||
return new LoanTransactionData(null, null, null, transactionType, null, null, DateUtils.getBusinessLocalDate(), null, null, null,
|
||||
null, null, null, null, null, null, null, outstandingLoanBalance, unrecognizedIncomePortion, false);
|
||||
null, null, null, null, null, null, null, outstandingLoanBalance, unrecognizedIncomePortion, false, null);
|
||||
|
||||
}
|
||||
|
||||
@@ -1310,7 +1310,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
+ " pd.payment_type_id as paymentType,pd.account_number as accountNumber,pd.check_number as checkNumber, "
|
||||
+ " pd.receipt_number as receiptNumber, pd.bank_number as bankNumber,pd.routing_code as routingCode, l.net_disbursal_amount as netDisbursalAmount,"
|
||||
+ " l.currency_code as currencyCode, l.currency_digits as currencyDigits, l.currency_multiplesof as inMultiplesOf, rc."
|
||||
+ sqlGenerator.escape("name") + " as currencyName, "
|
||||
+ sqlGenerator.escape("name") + " as currencyName, l.id as loanId, "
|
||||
+ " rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode, "
|
||||
+ " pt.value as paymentTypeName, tr.external_id as externalId, tr.office_id as officeId, office.name as officeName, "
|
||||
+ " fromtran.id as fromTransferId, fromtran.is_reversed as fromTransferReversed,"
|
||||
@@ -1339,6 +1339,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
final Long id = rs.getLong("id");
|
||||
final Long loanId = rs.getLong("loanId");
|
||||
final Long officeId = rs.getLong("officeId");
|
||||
final String officeName = rs.getString("officeName");
|
||||
final int transactionTypeInt = JdbcSupport.getInteger(rs, "transactionType");
|
||||
@@ -1401,7 +1402,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
return new LoanTransactionData(id, officeId, officeName, transactionType, paymentDetailData, currencyData, date, totalAmount,
|
||||
netDisbursalAmount, principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion, overPaymentPortion,
|
||||
unrecognizedIncomePortion, externalId, transfer, null, outstandingLoanBalance, submittedOnDate, manuallyReversed,
|
||||
reversalExternalId, reversedOnDate);
|
||||
reversalExternalId, reversedOnDate, loanId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1871,7 +1872,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final BigDecimal unrecognizedIncomePortion = null;
|
||||
return new LoanTransactionData(null, null, null, transactionType, null, null, null, loan.getTotalWrittenOff(),
|
||||
loan.getNetDisbursalAmount(), null, null, null, null, null, unrecognizedIncomePortion, paymentOptions, null, null, null,
|
||||
outstandingLoanBalance, false);
|
||||
outstandingLoanBalance, false, loanId);
|
||||
|
||||
}
|
||||
|
||||
@@ -1885,7 +1886,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
this.codeValueReadPlatformService.retrieveCodeValuesByCode(LoanApiConstants.WRITEOFFREASONS));
|
||||
LoanTransactionData loanTransactionData = new LoanTransactionData(null, null, null, transactionType, null, loan.getCurrency(),
|
||||
DateUtils.getBusinessLocalDate(), totalOutstanding, loan.getNetDisbursalAmount(), null, null, null, null, null, null, null,
|
||||
null, null, null, false);
|
||||
null, null, null, false, loanId);
|
||||
loanTransactionData.setWriteOffReasonOptions(writeOffReasonOptions);
|
||||
return loanTransactionData;
|
||||
}
|
||||
@@ -2015,13 +2016,14 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
+ ", tr.amount as total, tr.principal_portion_derived as principal, tr.interest_portion_derived as interest, "
|
||||
+ " tr.fee_charges_portion_derived as fees, tr.penalty_charges_portion_derived as penalties, "
|
||||
+ " tr.overpayment_portion_derived as overpayment, tr.outstanding_loan_balance_derived as outstandingLoanBalance, "
|
||||
+ " tr.unrecognized_income_portion as unrecognizedIncome from m_loan_transaction tr ";
|
||||
+ " tr.unrecognized_income_portion as unrecognizedIncome, tr.loan_id as loanId from m_loan_transaction tr ";
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoanTransactionData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
|
||||
final Long id = rs.getLong("id");
|
||||
final Long loanId = rs.getLong("loanId");
|
||||
final int transactionTypeInt = JdbcSupport.getInteger(rs, "transactionType");
|
||||
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(transactionTypeInt);
|
||||
|
||||
@@ -2036,7 +2038,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final BigDecimal outstandingLoanBalance = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "outstandingLoanBalance");
|
||||
|
||||
return new LoanTransactionData(id, transactionType, date, totalAmount, null, principalPortion, interestPortion,
|
||||
feeChargesPortion, penaltyChargesPortion, overPaymentPortion, unrecognizedIncomePortion, outstandingLoanBalance, false);
|
||||
feeChargesPortion, penaltyChargesPortion, overPaymentPortion, unrecognizedIncomePortion, outstandingLoanBalance, false,
|
||||
loanId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2180,7 +2183,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
|
||||
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(loanTransactionType);
|
||||
return new LoanTransactionData(null, null, null, transactionType, null, currencyData, currentDate, transactionAmount, null,
|
||||
netDisbursal, null, null, null, null, null, paymentOptions, null, null, null, null, false);
|
||||
netDisbursal, null, null, null, null, null, paymentOptions, null, null, null, null, false, loanId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2274,7 +2277,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
loanRepaymentScheduleInstallment.getInterestOutstanding(currency).getAmount(),
|
||||
loanRepaymentScheduleInstallment.getFeeChargesOutstanding(currency).getAmount(),
|
||||
loanRepaymentScheduleInstallment.getPenaltyChargesOutstanding(currency).getAmount(), null, unrecognizedIncomePortion,
|
||||
paymentTypeOptions, null, null, null, outstandingLoanBalance, isReversed);
|
||||
paymentTypeOptions, null, null, null, outstandingLoanBalance, isReversed, loanId);
|
||||
}
|
||||
|
||||
private static final class CurrencyMapper implements RowMapper<CurrencyData> {
|
||||
@@ -2346,6 +2349,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final BigDecimal overPaymentPortion = null;
|
||||
final BigDecimal netDisbursalAmount = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "netDisbursalAmount");
|
||||
final Long id = null;
|
||||
final Long loanId = null;
|
||||
final Long officeId = null;
|
||||
final String officeName = null;
|
||||
boolean manuallyReversed = false;
|
||||
@@ -2355,7 +2359,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final BigDecimal fixedEmiAmount = null;
|
||||
return new LoanTransactionData(id, officeId, officeName, transactionType, paymentDetailData, currencyData, date, totalDue,
|
||||
netDisbursalAmount, principalPortion, interestDue, feeDue, penaltyDue, overPaymentPortion, externalId, transfer,
|
||||
fixedEmiAmount, outstandingLoanBalance, unrecognizedIncomePortion, manuallyReversed);
|
||||
fixedEmiAmount, outstandingLoanBalance, unrecognizedIncomePortion, manuallyReversed, loanId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user