http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java index 5109c3e..fbcf5c0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java @@ -23,6 +23,7 @@ import java.util.*; import javax.persistence.Transient; +import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants; import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.dataqueries.data.DatatableData; @@ -214,6 +215,393 @@ public class LoanAccountData { private List<DatatableData> datatables = null; + //import fields + private String dateFormat; + private String locale; + private transient Integer rowIndex; + private LocalDate submittedOnDate; + private Long productId; + private Integer loanTermFrequency; + private EnumOptionData loanTermFrequencyType; + private LocalDate repaymentsStartingFromDate; + private String linkAccountId; + private Long groupId; + private LocalDate expectedDisbursementDate; + + public static LoanAccountData importInstanceIndividual(EnumOptionData loanTypeEnumOption,Long clientId,Long productId, + Long loanOfficerId,LocalDate submittedOnDate, + Long fundId,BigDecimal principal, Integer numberOfRepayments,Integer repaymentEvery, + EnumOptionData repaidEveryFrequencyEnums, Integer loanTermFrequency,EnumOptionData loanTermFrequencyTypeEnum, + BigDecimal nominalInterestRate,LocalDate expectedDisbursementDate ,EnumOptionData amortizationEnumOption, + EnumOptionData interestMethodEnum, EnumOptionData interestCalculationPeriodTypeEnum,BigDecimal inArrearsTolerance,Long transactionProcessingStrategyId, + Integer graceOnPrincipalPayment,Integer graceOnInterestPayment,Integer graceOnInterestCharged, + LocalDate interestChargedFromDate,LocalDate repaymentsStartingFromDate,Integer rowIndex , + String externalId,Long groupId,Collection<LoanChargeData> charges,String linkAccountId, + String locale,String dateFormat){ + + return new LoanAccountData(loanTypeEnumOption, clientId, productId, loanOfficerId, submittedOnDate, fundId, + principal, numberOfRepayments, + repaymentEvery, repaidEveryFrequencyEnums, loanTermFrequency, loanTermFrequencyTypeEnum, nominalInterestRate, expectedDisbursementDate, + amortizationEnumOption, interestMethodEnum, interestCalculationPeriodTypeEnum, inArrearsTolerance, transactionProcessingStrategyId, + graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, interestChargedFromDate, repaymentsStartingFromDate, + rowIndex, externalId, null, charges, linkAccountId,locale,dateFormat); + } + + private LoanAccountData(EnumOptionData loanType,Long clientId,Long productId,Long loanOfficerId,LocalDate submittedOnDate, + Long fundId,BigDecimal principal, Integer numberOfRepayments,Integer repaymentEvery, + EnumOptionData repaymentFrequencyType, Integer loanTermFrequency,EnumOptionData loanTermFrequencyType, + BigDecimal interestRatePerPeriod,LocalDate expectedDisbursementDate ,EnumOptionData amortizationType, + EnumOptionData interestType, EnumOptionData interestCalculationPeriodType,BigDecimal inArrearsTolerance,Long transactionProcessingStrategyId, + Integer graceOnPrincipalPayment,Integer graceOnInterestPayment,Integer graceOnInterestCharged, + LocalDate interestChargedFromDate,LocalDate repaymentsStartingFromDate,Integer rowIndex , + String externalId,Long groupId,Collection<LoanChargeData> charges,String linkAccountId, + String locale,String dateFormat) { + this.dateFormat=dateFormat; + this.locale= locale; + this.rowIndex=rowIndex; + this.submittedOnDate=submittedOnDate; + this.productId=productId; + this.loanTermFrequency=loanTermFrequency; + this.loanTermFrequencyType=loanTermFrequencyType; + this.repaymentsStartingFromDate=repaymentsStartingFromDate; + this.linkAccountId=linkAccountId; + this.externalId = externalId; + this.clientId = clientId; + this.fundId = fundId; + this.loanOfficerId = loanOfficerId; + this.numberOfRepayments = numberOfRepayments; + this.loanType = loanType; + this.principal = principal; + this.repaymentEvery = repaymentEvery; + this.repaymentFrequencyType = repaymentFrequencyType; + this.interestRatePerPeriod = interestRatePerPeriod; + this.amortizationType = amortizationType; + this.interestType = interestType; + this.interestCalculationPeriodType = interestCalculationPeriodType; + this.inArrearsTolerance = inArrearsTolerance; + this.transactionProcessingStrategyId = transactionProcessingStrategyId; + this.graceOnInterestPayment = graceOnInterestPayment; + this.graceOnInterestCharged = graceOnInterestCharged; + this.graceOnPrincipalPayment = graceOnPrincipalPayment; + this.interestChargedFromDate = interestChargedFromDate; + this.groupId=groupId; + this.expectedDisbursementDate=expectedDisbursementDate; + this.charges = charges; + this.id = null; + this.accountNo = null; + + this.status = null; + this.subStatus = null; + + this.clientAccountNo = null; + this.clientName = null; + this.clientOfficeId = null; + this.group = null; + this.loanProductId = null; + this.loanProductName = null; + this.loanProductDescription = null; + this.isLoanProductLinkedToFloatingRate = false; + + this.fundName = null; + this.loanPurposeId = null; + this.loanPurposeName = null; + + this.loanOfficerName = null; + + this.currency = null; + + this.approvedPrincipal = null; + this.proposedPrincipal = null; + this.termFrequency = null; + this.termPeriodFrequencyType = null; + + + this.repaymentFrequencyNthDayType = null; + this.repaymentFrequencyDayOfWeekType = null; + + this.interestRateFrequencyType = null; + this.annualInterestRate = null; + this.isFloatingInterestRate = false; + this.interestRateDifferential = null; + + this.allowPartialPeriodInterestCalcualtion = null; + + this.transactionProcessingStrategyName = null; + + this.recurringMoratoriumOnPrincipalPeriods = null; + + this.graceOnArrearsAgeing = null; + + this.expectedFirstRepaymentOnDate = null; + this.syncDisbursementWithMeeting = null; + this.timeline = null; + this.summary = null; + this.repaymentSchedule = null; + this.transactions = null; + + this.collateral = null; + this.guarantors = null; + this.meeting = null; + this.notes = null; + this.disbursementDetails = null; + this.originalSchedule = null; + this.productOptions = null; + this.loanOfficerOptions = null; + this.loanPurposeOptions = null; + this.fundOptions = null; + this.termFrequencyTypeOptions = null; + this.repaymentFrequencyTypeOptions = null; + this.repaymentFrequencyNthDayTypeOptions = null; + this.repaymentFrequencyDaysOfWeekTypeOptions = null; + this.interestRateFrequencyTypeOptions = null; + this.amortizationTypeOptions = null; + this.interestTypeOptions = null; + this.interestCalculationPeriodTypeOptions = null; + this.transactionProcessingStrategyOptions = null; + this.chargeOptions = null; + this.loanCollateralOptions = null; + this.calendarOptions = null; + this.feeChargesAtDisbursementCharged = null; + this.totalOverpaid = null; + this.loanCounter = null; + this.loanProductCounter = null; + this.linkedAccount = null; + this.accountLinkingOptions = null; + this.multiDisburseLoan = null; + this.canDefineInstallmentAmount = null; + this.fixedEmiAmount = null; + this.maxOutstandingLoanBalance = null; + this.canDisburse = null; + this.emiAmountVariations = null; + this.clientActiveLoanOptions = null; + this.canUseForTopup = null; + this.isTopup = false; + this.closureLoanId = null; + this.closureLoanAccountNo = null; + this.topupAmount = null; + this.memberVariations = null; + this.inArrears = null; + this.isNPA = null; + this.overdueCharges = null; + this.daysInMonthType = null; + this.daysInYearType = null; + this.isInterestRecalculationEnabled = false; + this.interestRecalculationData = null; + this.createStandingInstructionAtDisbursement = null; + this.paidInAdvance = null; + this.interestRatesPeriods = null; + this.isVariableInstallmentsAllowed = null; + this.minimumGap = null; + this.maximumGap = null; + } + + public static LoanAccountData importInstanceGroup(EnumOptionData loanTypeEnumOption,Long groupIdforGroupLoan,Long productId, + Long loanOfficerId,LocalDate submittedOnDate, + Long fundId,BigDecimal principal, Integer numberOfRepayments,Integer repaidEvery, + EnumOptionData repaidEveryFrequencyEnums, Integer loanTermFrequency,EnumOptionData loanTermFrequencyTypeEnum, + BigDecimal nominalInterestRate, EnumOptionData amortizationEnumOption,EnumOptionData interestMethodEnum, + EnumOptionData interestCalculationPeriodEnum,BigDecimal arrearsTolerance, + Long transactionProcessingStrategyId, + Integer graceOnPrincipalPayment,Integer graceOnInterestPayment,Integer graceOnInterestCharged, + LocalDate interestChargedFromDate,LocalDate repaymentsStartingFromDate, + Integer rowIndex ,String externalId,String linkAccountId,String locale,String dateFormat){ + + return new LoanAccountData(loanTypeEnumOption, groupIdforGroupLoan, productId, loanOfficerId, submittedOnDate, fundId, + principal, numberOfRepayments, + repaidEvery, repaidEveryFrequencyEnums, loanTermFrequency, loanTermFrequencyTypeEnum, nominalInterestRate, + amortizationEnumOption, interestMethodEnum, interestCalculationPeriodEnum, arrearsTolerance, + transactionProcessingStrategyId, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, + interestChargedFromDate, repaymentsStartingFromDate, rowIndex, externalId, linkAccountId,locale,dateFormat); + } + private LoanAccountData(EnumOptionData loanType,Long clientId,Long productId,Long loanOfficerId,LocalDate submittedOnDate, + Long fundId,BigDecimal principal, Integer numberOfRepayments,Integer repaymentEvery, + EnumOptionData repaymentFrequencyType, Integer loanTermFrequency,EnumOptionData loanTermFrequencyType, + BigDecimal interestRatePerPeriod, EnumOptionData amortizationType,EnumOptionData interestType, + EnumOptionData interestCalculationPeriodType,BigDecimal inArrearsTolerance, + Long transactionProcessingStrategyId, + Integer graceOnPrincipalPayment,Integer graceOnInterestPayment,Integer graceOnInterestCharged, + LocalDate interestChargedFromDate,LocalDate repaymentsStartingFromDate, + Integer rowIndex ,String externalId,String linkAccountId,String locale,String dateFormat) { + this.dateFormat=dateFormat; + this.locale= locale; + this.rowIndex=rowIndex; + this.submittedOnDate=submittedOnDate; + this.productId=productId; + this.loanTermFrequency=loanTermFrequency; + this.loanTermFrequencyType=loanTermFrequencyType; + this.repaymentsStartingFromDate=repaymentsStartingFromDate; + this.linkAccountId=linkAccountId; + this.externalId = externalId; + this.clientId = clientId; + this.fundId = fundId; + this.loanOfficerId = loanOfficerId; + this.numberOfRepayments = numberOfRepayments; + this.loanType = loanType; + this.principal = principal; + this.repaymentEvery = repaymentEvery; + this.repaymentFrequencyType = repaymentFrequencyType; + this.interestRatePerPeriod = interestRatePerPeriod; + this.amortizationType = amortizationType; + this.interestType = interestType; + this.interestCalculationPeriodType = interestCalculationPeriodType; + this.inArrearsTolerance = inArrearsTolerance; + this.transactionProcessingStrategyId = transactionProcessingStrategyId; + this.graceOnInterestPayment = graceOnInterestPayment; + this.graceOnInterestCharged = graceOnInterestCharged; + this.graceOnPrincipalPayment = graceOnPrincipalPayment; + this.interestChargedFromDate = interestChargedFromDate; + this.groupId=null; + this.charges = null; + this.id = null; + this.accountNo = null; + + this.status = null; + this.subStatus = null; + + this.clientAccountNo = null; + this.clientName = null; + this.clientOfficeId = null; + this.group = null; + this.loanProductId = null; + this.loanProductName = null; + this.loanProductDescription = null; + this.isLoanProductLinkedToFloatingRate = false; + + this.fundName = null; + this.loanPurposeId = null; + this.loanPurposeName = null; + + this.loanOfficerName = null; + + this.currency = null; + + this.approvedPrincipal = null; + this.proposedPrincipal = null; + this.termFrequency = null; + this.termPeriodFrequencyType = null; + + + this.repaymentFrequencyNthDayType = null; + this.repaymentFrequencyDayOfWeekType = null; + + this.interestRateFrequencyType = null; + this.annualInterestRate = null; + this.isFloatingInterestRate = false; + this.interestRateDifferential = null; + + this.allowPartialPeriodInterestCalcualtion = null; + + this.transactionProcessingStrategyName = null; + + this.recurringMoratoriumOnPrincipalPeriods = null; + + this.graceOnArrearsAgeing = null; + + this.expectedFirstRepaymentOnDate = null; + this.syncDisbursementWithMeeting = null; + this.timeline = null; + this.summary = null; + this.repaymentSchedule = null; + this.transactions = null; + + this.collateral = null; + this.guarantors = null; + this.meeting = null; + this.notes = null; + this.disbursementDetails = null; + this.originalSchedule = null; + this.productOptions = null; + this.loanOfficerOptions = null; + this.loanPurposeOptions = null; + this.fundOptions = null; + this.termFrequencyTypeOptions = null; + this.repaymentFrequencyTypeOptions = null; + this.repaymentFrequencyNthDayTypeOptions = null; + this.repaymentFrequencyDaysOfWeekTypeOptions = null; + this.interestRateFrequencyTypeOptions = null; + this.amortizationTypeOptions = null; + this.interestTypeOptions = null; + this.interestCalculationPeriodTypeOptions = null; + this.transactionProcessingStrategyOptions = null; + this.chargeOptions = null; + this.loanCollateralOptions = null; + this.calendarOptions = null; + this.feeChargesAtDisbursementCharged = null; + this.totalOverpaid = null; + this.loanCounter = null; + this.loanProductCounter = null; + this.linkedAccount = null; + this.accountLinkingOptions = null; + this.multiDisburseLoan = null; + this.canDefineInstallmentAmount = null; + this.fixedEmiAmount = null; + this.maxOutstandingLoanBalance = null; + this.canDisburse = null; + this.emiAmountVariations = null; + this.clientActiveLoanOptions = null; + this.canUseForTopup = null; + this.isTopup = false; + this.closureLoanId = null; + this.closureLoanAccountNo = null; + this.topupAmount = null; + this.memberVariations = null; + this.inArrears = null; + this.isNPA = null; + this.overdueCharges = null; + this.daysInMonthType = null; + this.daysInYearType = null; + this.isInterestRecalculationEnabled = false; + this.interestRecalculationData = null; + this.createStandingInstructionAtDisbursement = null; + this.paidInAdvance = null; + this.interestRatesPeriods = null; + this.isVariableInstallmentsAllowed = null; + this.minimumGap = null; + this.maximumGap = null; + } + + + public Integer getRowIndex() { + return rowIndex; + } + + public Long getClientId() { + return clientId; + } + + public String getClientName() { + return clientName; + } + + public BigDecimal getPrincipal() { + return principal; + } + + public LoanApplicationTimelineData getTimeline() { + return timeline; + } + + public String getAccountNo() { + return accountNo; + } + + public String getLoanProductName() { + return loanProductName; + } + + public static final Comparator<LoanAccountData> ClientNameComparator = new Comparator<LoanAccountData>() { + + @Override + public int compare(LoanAccountData loan1, LoanAccountData loan2) { + String clientOfLoan1 = loan1.getClientName().toUpperCase(Locale.ENGLISH); + String clientOfLoan2 = loan2.getClientName().toUpperCase(Locale.ENGLISH); + return clientOfLoan1.compareTo(clientOfLoan2); + } + }; + + public String getClientAccountNo() { + return clientAccountNo; + } /** * Used to produce a {@link LoanAccountData} with only collateral options * for now. @@ -1622,4 +2010,8 @@ public class LoanAccountData { public void setDatatables(final List<DatatableData> datatables) { this.datatables = datatables; } + + public String getStatusStringValue(){ + return this.status.value(); + } }
http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanApprovalData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanApprovalData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanApprovalData.java index 5d3a06c..ef80f1b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanApprovalData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanApprovalData.java @@ -20,6 +20,7 @@ package org.apache.fineract.portfolio.loanaccount.data; import java.math.BigDecimal; +import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants; import org.joda.time.LocalDate; /** @@ -30,6 +31,27 @@ public class LoanApprovalData { private final LocalDate approvalDate; private final BigDecimal approvalAmount; + //import fields + private LocalDate approvedOnDate; + private String note; + private String dateFormat; + private String locale; + private transient Integer rowIndex; + + public static LoanApprovalData importInstance(LocalDate approvedOnDate, Integer rowIndex, + String locale,String dateFormat){ + return new LoanApprovalData(approvedOnDate,rowIndex,locale,dateFormat); + } + private LoanApprovalData(LocalDate approvedOnDate, Integer rowIndex,String locale,String dateFormat) { + this.approvedOnDate = approvedOnDate; + this.rowIndex = rowIndex; + this.dateFormat=dateFormat; + this.locale= locale; + this.note=""; + this.approvalAmount=null; + this.approvalDate=null; + } + public LoanApprovalData(final BigDecimal approvalAmount, final LocalDate approvalDate) { this.approvalDate = approvalDate; this.approvalAmount = approvalAmount; http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTransactionData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTransactionData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTransactionData.java index 39d6899..e3424fa 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTransactionData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTransactionData.java @@ -21,6 +21,7 @@ package org.apache.fineract.portfolio.loanaccount.data; import java.math.BigDecimal; import java.util.Collection; +import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants; import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.portfolio.account.data.AccountTransferData; @@ -66,6 +67,116 @@ public class LoanTransactionData { private Collection<CodeValueData> writeOffReasonOptions = null; + //import fields + private transient Integer rowIndex; + private String dateFormat; + private String locale; + private BigDecimal transactionAmount; + private LocalDate transactionDate; + private Long paymentTypeId; + private String accountNumber; + private Integer checkNumber; + private Integer routingCode; + private Integer receiptNumber; + private Integer bankNumber; + private transient Integer accountId; + private transient String transactionType; + + public static LoanTransactionData importInstance(BigDecimal repaymentAmount,LocalDate lastRepaymentDate, + Long repaymentTypeId,Integer rowIndex,String locale,String dateFormat){ + return new LoanTransactionData(repaymentAmount, lastRepaymentDate, repaymentTypeId, rowIndex,locale,dateFormat); + } + private LoanTransactionData(BigDecimal transactionAmount,LocalDate transactionDate, + Long paymentTypeId,Integer rowIndex,String locale,String dateFormat) { + this.transactionAmount=transactionAmount; + this.transactionDate=transactionDate; + this.paymentTypeId=paymentTypeId; + this.rowIndex = rowIndex; + this.dateFormat= dateFormat; + this.locale= locale; + this.amount = null; + this.date = null; + this.type = null; + this.id =null; + this.officeId = null; + this.officeName = null; + this.currency = null; + this.paymentDetailData = null; + this.principalPortion = null; + this.interestPortion = null; + this.feeChargesPortion = null; + this.penaltyChargesPortion = null; + this.overpaymentPortion = null; + this.unrecognizedIncomePortion = null; + this.externalId = null; + this.transfer = null; + this.fixedEmiAmount = null; + this.outstandingLoanBalance = null; + this.submittedOnDate = null; + this.manuallyReversed = false; + this.possibleNextRepaymentDate = null; + this.paymentTypeOptions = null; + this.writeOffReasonOptions = null; + } + public static LoanTransactionData importInstance(BigDecimal repaymentAmount,LocalDate repaymentDate, + Long repaymentTypeId, String accountNumber,Integer checkNumber,Integer routingCode, + Integer receiptNumber, Integer bankNumber,Integer loanAccountId,String transactionType, + Integer rowIndex,String locale, String dateFormat){ + return new LoanTransactionData(repaymentAmount, repaymentDate, repaymentTypeId, accountNumber, + checkNumber, routingCode, receiptNumber, bankNumber, loanAccountId, "", + rowIndex,locale,dateFormat); + } + + private LoanTransactionData(BigDecimal transactionAmount,LocalDate transactionDate, Long paymentTypeId, + String accountNumber,Integer checkNumber,Integer routingCode,Integer receiptNumber, + Integer bankNumber,Integer accountId,String transactionType,Integer rowIndex,String locale, + String dateFormat) { + this.transactionAmount = transactionAmount; + this.transactionDate = transactionDate; + this.paymentTypeId = paymentTypeId; + this.accountNumber=accountNumber; + this.checkNumber=checkNumber; + this.routingCode=routingCode; + this.receiptNumber=receiptNumber; + this.bankNumber=bankNumber; + this.accountId=accountId; + this.transactionType=transactionType; + this.rowIndex=rowIndex; + this.dateFormat=dateFormat; + this.locale= locale; + this.id = null; + this.officeId = null; + this.officeName = null; + this.type = null; + this.date = null; + this.currency = null; + this.paymentDetailData = null; + this.amount = null; + this.principalPortion = null; + this.interestPortion = null; + this.feeChargesPortion = null; + this.penaltyChargesPortion = null; + this.overpaymentPortion = null; + this.unrecognizedIncomePortion = null; + this.externalId = null; + this.transfer = null; + this.fixedEmiAmount = null; + this.outstandingLoanBalance = null; + this.submittedOnDate = null; + this.manuallyReversed = false; + this.possibleNextRepaymentDate = null; + this.paymentTypeOptions = null; + this.writeOffReasonOptions = null; + } + + public Integer getAccountId() { + return accountId; + } + + public Integer getRowIndex() { + return rowIndex; + } + public static LoanTransactionData templateOnTop(final LoanTransactionData loanTransactionData, final Collection<PaymentTypeData> paymentTypeOptions) { return new LoanTransactionData(loanTransactionData.id, loanTransactionData.officeId, loanTransactionData.officeName, http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java index 948036e..1be3d26 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java @@ -18,6 +18,7 @@ */ package org.apache.fineract.portfolio.loanaccount.guarantor.api; +import java.io.InputStream; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -35,11 +36,17 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.commands.service.CommandWrapperBuilder; import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; +import org.apache.fineract.infrastructure.bulkimport.data.GlobalEntityType; +import org.apache.fineract.infrastructure.bulkimport.service.BulkImportWorkbookPopulatorService; +import org.apache.fineract.infrastructure.bulkimport.service.BulkImportWorkbookService; import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.codes.service.CodeValueReadPlatformService; import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; @@ -89,6 +96,9 @@ public class GuarantorsApiResource { private final PlatformSecurityContext context; private final PortfolioAccountReadPlatformService portfolioAccountReadPlatformService; private final LoanReadPlatformService loanReadPlatformService; + private final BulkImportWorkbookService bulkImportWorkbookService; + private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService; + @Autowired public GuarantorsApiResource(final PlatformSecurityContext context, final GuarantorReadPlatformService guarantorReadPlatformService, @@ -96,7 +106,9 @@ public class GuarantorsApiResource { final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, final CodeValueReadPlatformService codeValueReadPlatformService, final PortfolioAccountReadPlatformService portfolioAccountReadPlatformService, - final LoanReadPlatformService loanReadPlatformService) { + final LoanReadPlatformService loanReadPlatformService, + final BulkImportWorkbookService bulkImportWorkbookService, + final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) { this.context = context; this.apiRequestParameterHelper = apiRequestParameterHelper; this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; @@ -105,6 +117,8 @@ public class GuarantorsApiResource { this.codeValueReadPlatformService = codeValueReadPlatformService; this.portfolioAccountReadPlatformService = portfolioAccountReadPlatformService; this.loanReadPlatformService = loanReadPlatformService; + this.bulkImportWorkbookService=bulkImportWorkbookService; + this.bulkImportWorkbookPopulatorService=bulkImportWorkbookPopulatorService; } @GET @@ -218,4 +232,22 @@ public class GuarantorsApiResource { final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); return this.apiJsonSerializerService.serialize(settings, guarantorData, ACCOUNT_TRANSFER_API_RESPONSE_DATA_PARAMETERS); } + + @GET + @Path("downloadtemplate") + @Produces("application/vnd.ms-excel") + public Response getGuarantorTemplate(@QueryParam("officeId") final Long officeId,@QueryParam("dateFormat") final String dateFormat) { + return bulkImportWorkbookPopulatorService.getTemplate(GlobalEntityType.GUARANTORS.toString(), officeId,null,dateFormat); + } + + @POST + @Path("uploadtemplate") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public String postGuarantorTemplate(@FormDataParam("file") InputStream uploadedInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail,@FormDataParam("locale") final String locale, + @FormDataParam("dateFormat") final String dateFormat){ + final Long importDocumentId =this.bulkImportWorkbookService.importWorkbook(GlobalEntityType.GUARANTORS.toString(), + uploadedInputStream,fileDetail,locale,dateFormat); + return this.apiJsonSerializerService.serialize(importDocumentId); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/data/GuarantorData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/data/GuarantorData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/data/GuarantorData.java index f46b52a..c6132e7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/data/GuarantorData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/data/GuarantorData.java @@ -18,9 +18,11 @@ */ package org.apache.fineract.portfolio.loanaccount.guarantor.data; +import java.math.BigDecimal; import java.util.Collection; import java.util.List; +import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants; import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.organisation.staff.data.StaffData; @@ -67,6 +69,68 @@ public class GuarantorData { private final Collection<CodeValueData> allowedClientRelationshipTypes; private final Collection<PortfolioAccountData> accountLinkingOptions; + //import fields + private Integer guarantorTypeId; + private Integer clientRelationshipTypeId; + private Integer savingsId; + private BigDecimal amount; + private transient Long accountId; + private transient Integer rowIndex; + private String dateFormat; + private String locale; + + public static GuarantorData importInstance(Integer guarantorTypeId,Integer clientRelationshipTypeId,Long entityId,String firstName, + String lastName,String addressLine1,String addressLine2,String city,LocalDate dob, String zip, + Integer savingsId, BigDecimal amount,Integer rowIndex,Long accountId,String locale,String dateFormat){ + return new GuarantorData(guarantorTypeId,clientRelationshipTypeId,entityId,firstName, lastName, + addressLine1, addressLine2,city,dob,zip,savingsId,amount, rowIndex, accountId,locale,dateFormat); + } + private GuarantorData(Integer guarantorTypeId,Integer clientRelationshipTypeId,Long entityId,String firstname, + String lastname,String addressLine1,String addressLine2,String city,LocalDate dob, String zip, + Integer savingsId, BigDecimal amount,Integer rowIndex,Long accountId,String locale,String dateFormat) { + this.rowIndex=rowIndex; + this.firstname = firstname; + this.lastname = lastname; + this.entityId = entityId; + this.addressLine1 = addressLine1; + this.addressLine2 = addressLine2; + this.city = city; + this.zip = zip; + this.dob = dob; + this.guarantorTypeId = guarantorTypeId; + this.clientRelationshipTypeId = clientRelationshipTypeId; + this.savingsId = savingsId; + this.amount = amount; + this.accountId = accountId; + this.dateFormat=dateFormat; + this.locale= locale; + this.clientRelationshipType = null; + this.guarantorType = null; + this.id = null; + this.loanId = null; + this.externalId = null; + this.officeName = null; + this.joinedDate = null; + this.state = null; + this.country = null; + this.mobileNumber = null; + this.housePhoneNumber = null; + this.comment = null; + this.guarantorFundingDetails = null; + this.status = false; + this.guarantorTypeOptions = null; + this.allowedClientRelationshipTypes = null; + this.accountLinkingOptions = null; + } + + public Long getAccountId() { + return accountId; + } + + public Integer getRowIndex() { + return rowIndex; + } + public static GuarantorData template(final List<EnumOptionData> guarantorTypeOptions, final Collection<CodeValueData> allowedClientRelationshipTypes, Collection<PortfolioAccountData> accountLinkingOptions) { final Collection<GuarantorFundingData> guarantorFundingDetails = null; http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java index ab6c310..3a7f44f 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java @@ -301,41 +301,48 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { extraCriterias.add(hierarchySearchString); extraCriterias.add(hierarchySearchString); - String sqlQueryCriteria = searchParameters.getSqlSearch(); - if (StringUtils.isNotBlank(sqlQueryCriteria)) { - SQLInjectionValidator.validateSQLInput(sqlQueryCriteria); - sqlQueryCriteria = sqlQueryCriteria.replaceAll("accountNo", "l.account_no"); - this.columnValidator.validateSqlInjection(sqlBuilder.toString(), sqlQueryCriteria); - sqlBuilder.append(" and (").append(sqlQueryCriteria).append(")"); - } + if (searchParameters!=null) { + + String sqlQueryCriteria = searchParameters.getSqlSearch(); + if (StringUtils.isNotBlank(sqlQueryCriteria)) { + SQLInjectionValidator.validateSQLInput(sqlQueryCriteria); + sqlQueryCriteria = sqlQueryCriteria.replaceAll("accountNo", "l.account_no"); + this.columnValidator.validateSqlInjection(sqlBuilder.toString(), sqlQueryCriteria); + sqlBuilder.append(" and (").append(sqlQueryCriteria).append(")"); + } - if (StringUtils.isNotBlank(searchParameters.getExternalId())) { - sqlBuilder.append(" and l.external_id = ?"); - extraCriterias.add(searchParameters.getExternalId()); - arrayPos = arrayPos + 1; - } + if (StringUtils.isNotBlank(searchParameters.getExternalId())) { + sqlBuilder.append(" and l.external_id = ?"); + extraCriterias.add(searchParameters.getExternalId()); + arrayPos = arrayPos + 1; + } + if(searchParameters.getOfficeId()!=null){ + sqlBuilder.append("and c.office_id =?"); + extraCriterias.add(searchParameters.getOfficeId()); + arrayPos = arrayPos + 1; + } - if (StringUtils.isNotBlank(searchParameters.getAccountNo())) { - sqlBuilder.append(" and l.account_no = ?"); - extraCriterias.add(searchParameters.getAccountNo()); - arrayPos = arrayPos + 1; - } + if (StringUtils.isNotBlank(searchParameters.getAccountNo())) { + sqlBuilder.append(" and l.account_no = ?"); + extraCriterias.add(searchParameters.getAccountNo()); + arrayPos = arrayPos + 1; + } - if (searchParameters.isOrderByRequested()) { - sqlBuilder.append(" order by ").append(searchParameters.getOrderBy()); + if (searchParameters.isOrderByRequested()) { + sqlBuilder.append(" order by ").append(searchParameters.getOrderBy()); - if (searchParameters.isSortOrderProvided()) { - sqlBuilder.append(' ').append(searchParameters.getSortOrder()); + if (searchParameters.isSortOrderProvided()) { + sqlBuilder.append(' ').append(searchParameters.getSortOrder()); + } } - } - if (searchParameters.isLimited()) { - sqlBuilder.append(" limit ").append(searchParameters.getLimit()); - if (searchParameters.isOffset()) { - sqlBuilder.append(" offset ").append(searchParameters.getOffset()); + if (searchParameters.isLimited()) { + sqlBuilder.append(" limit ").append(searchParameters.getLimit()); + if (searchParameters.isOffset()) { + sqlBuilder.append(" offset ").append(searchParameters.getOffset()); + } } } - final Object[] objectArray = extraCriterias.toArray(); final Object[] finalObjectArray = Arrays.copyOf(objectArray, arrayPos); final String sqlCountRows = "SELECT FOUND_ROWS()"; @@ -343,6 +350,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { this.loaanLoanMapper); } + @Override public LoanAccountData retrieveTemplateWithClientAndProductDetails(final Long clientId, final Long productId) { http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java index d95fcce..c846490 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java @@ -1196,4 +1196,28 @@ public class LoanProductData { public BigDecimal getInterestRateDifferential() { return this.interestRateDifferential; } + + public LocalDate getStartDate() { + return startDate; + } + + public LocalDate getCloseDate() { + return closeDate; + } + + public Integer getMinNumberOfRepayments() { + return minNumberOfRepayments; + } + + public Integer getMaxNumberOfRepayments() { + return maxNumberOfRepayments; + } + + public BigDecimal getMinInterestRatePerPeriod() { + return minInterestRatePerPeriod; + } + + public BigDecimal getMaxInterestRatePerPeriod() { + return maxInterestRatePerPeriod; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeData.java index 03d8f92..03331f8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeData.java @@ -50,4 +50,12 @@ public class PaymentTypeData { Long position = null; return new PaymentTypeData(id, name, description, isCashPayment, position); } + + public Long getId() { + return id; + } + + public String getName() { + return name; + } } http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java index 49cba4f..a3a9171 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java @@ -18,6 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; +import java.io.InputStream; import java.math.BigDecimal; import java.util.Arrays; import java.util.Collection; @@ -36,12 +37,18 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; import org.apache.commons.lang.StringUtils; import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.commands.service.CommandWrapperBuilder; import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; +import org.apache.fineract.infrastructure.bulkimport.data.GlobalEntityType; +import org.apache.fineract.infrastructure.bulkimport.service.BulkImportWorkbookPopulatorService; +import org.apache.fineract.infrastructure.bulkimport.service.BulkImportWorkbookService; import org.apache.fineract.infrastructure.core.api.ApiParameterHelper; import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; import org.apache.fineract.infrastructure.core.api.JsonQuery; @@ -86,6 +93,9 @@ public class FixedDepositAccountsApiResource { private final FromJsonHelper fromJsonHelper; private final DepositAccountPreMatureCalculationPlatformService accountPreMatureCalculationPlatformService; private final AccountAssociationsReadPlatformService accountAssociationsReadPlatformService; + private final BulkImportWorkbookService bulkImportWorkbookService; + private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService; + @Autowired public FixedDepositAccountsApiResource(final DepositAccountReadPlatformService depositAccountReadPlatformService, @@ -94,7 +104,9 @@ public class FixedDepositAccountsApiResource { final ApiRequestParameterHelper apiRequestParameterHelper, final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService, final FromJsonHelper fromJsonHelper, final DepositAccountPreMatureCalculationPlatformService accountPreMatureCalculationPlatformService, - final AccountAssociationsReadPlatformService accountAssociationsReadPlatformService) { + final AccountAssociationsReadPlatformService accountAssociationsReadPlatformService, + final BulkImportWorkbookService bulkImportWorkbookService, + final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) { this.depositAccountReadPlatformService = depositAccountReadPlatformService; this.context = context; this.toApiJsonSerializer = toApiJsonSerializer; @@ -104,6 +116,8 @@ public class FixedDepositAccountsApiResource { this.fromJsonHelper = fromJsonHelper; this.accountPreMatureCalculationPlatformService = accountPreMatureCalculationPlatformService; this.accountAssociationsReadPlatformService = accountAssociationsReadPlatformService; + this.bulkImportWorkbookService=bulkImportWorkbookService; + this.bulkImportWorkbookPopulatorService=bulkImportWorkbookPopulatorService; } @GET @@ -356,4 +370,41 @@ public class FixedDepositAccountsApiResource { final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); return this.toApiJsonSerializer.serialize(settings, account, DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESPONSE_DATA_PARAMETERS); } + + @GET + @Path("downloadtemplate") + @Produces("application/vnd.ms-excel") + public Response getFixedDepositTemplate(@QueryParam("officeId")final Long officeId, + @QueryParam("staffId")final Long staffId,@QueryParam("dateFormat") final String dateFormat) { + return bulkImportWorkbookPopulatorService.getTemplate + (GlobalEntityType.FIXED_DEPOSIT_ACCOUNTS.toString(),officeId,staffId,dateFormat); + } + @POST + @Path("uploadtemplate") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public String postFixedDepositTemplate(@FormDataParam("file") InputStream uploadedInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail,@FormDataParam("locale") final String locale, + @FormDataParam("dateFormat") final String dateFormat){ + Long importDocumentId = bulkImportWorkbookService.importWorkbook(GlobalEntityType.FIXED_DEPOSIT_ACCOUNTS.toString(), + uploadedInputStream,fileDetail,locale,dateFormat); + return this.toApiJsonSerializer.serialize(importDocumentId); + } + + @GET + @Path("transaction/downloadtemplate") + @Produces("application/vnd.ms-excel") + public Response getFixedDepositTransactionTemplate(@QueryParam("officeId")final Long officeId,@QueryParam("dateFormat") final String dateFormat) { + return bulkImportWorkbookPopulatorService.getTemplate(GlobalEntityType.FIXED_DEPOSIT_TRANSACTIONS.toString(), officeId,null,dateFormat); + } + + @POST + @Path("transaction/uploadtemplate") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public String postFixedDepositTransactionTemplate(@FormDataParam("file") InputStream uploadedInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail,@FormDataParam("locale") final String locale, + @FormDataParam("dateFormat") final String dateFormat){ + final Long importDocumentId = this.bulkImportWorkbookService.importWorkbook(GlobalEntityType.FIXED_DEPOSIT_TRANSACTIONS.toString(), + uploadedInputStream,fileDetail,locale,dateFormat); + return this.toApiJsonSerializer.serialize(importDocumentId); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java index bedfadc..b1578e4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java @@ -18,6 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; +import java.io.InputStream; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -35,12 +36,18 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; import org.apache.commons.lang.StringUtils; import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.commands.service.CommandWrapperBuilder; import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; +import org.apache.fineract.infrastructure.bulkimport.data.GlobalEntityType; +import org.apache.fineract.infrastructure.bulkimport.service.BulkImportWorkbookPopulatorService; +import org.apache.fineract.infrastructure.bulkimport.service.BulkImportWorkbookService; import org.apache.fineract.infrastructure.core.api.ApiParameterHelper; import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; import org.apache.fineract.infrastructure.core.api.JsonQuery; @@ -82,6 +89,9 @@ public class RecurringDepositAccountsApiResource { private final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService; private final FromJsonHelper fromJsonHelper; private final DepositAccountPreMatureCalculationPlatformService accountPreMatureCalculationPlatformService; + private final BulkImportWorkbookService bulkImportWorkbookService; + private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService; + @Autowired public RecurringDepositAccountsApiResource(final DepositAccountReadPlatformService depositAccountReadPlatformService, @@ -89,7 +99,9 @@ public class RecurringDepositAccountsApiResource { final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, final ApiRequestParameterHelper apiRequestParameterHelper, final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService, final FromJsonHelper fromJsonHelper, - final DepositAccountPreMatureCalculationPlatformService accountPreMatureCalculationPlatformService) { + final DepositAccountPreMatureCalculationPlatformService accountPreMatureCalculationPlatformService, + final BulkImportWorkbookService bulkImportWorkbookService, + final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) { this.depositAccountReadPlatformService = depositAccountReadPlatformService; this.context = context; this.toApiJsonSerializer = toApiJsonSerializer; @@ -98,6 +110,8 @@ public class RecurringDepositAccountsApiResource { this.savingsAccountChargeReadPlatformService = savingsAccountChargeReadPlatformService; this.fromJsonHelper = fromJsonHelper; this.accountPreMatureCalculationPlatformService = accountPreMatureCalculationPlatformService; + this.bulkImportWorkbookService=bulkImportWorkbookService; + this.bulkImportWorkbookPopulatorService=bulkImportWorkbookPopulatorService; } @GET @@ -341,4 +355,42 @@ public class RecurringDepositAccountsApiResource { return this.toApiJsonSerializer.serialize(settings, account, DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESPONSE_DATA_PARAMETERS); } + @GET + @Path("downloadtemplate") + @Produces("application/vnd.ms-excel") + public Response getRecurringDepositTemplate(@QueryParam("officeId")final Long officeId, + @QueryParam("staffId")final Long staffId,@QueryParam("dateFormat") final String dateFormat) { + return bulkImportWorkbookPopulatorService.getTemplate(GlobalEntityType.RECURRING_DEPOSIT_ACCOUNTS.toString(),officeId,staffId,dateFormat); + } + + @POST + @Path("uploadtemplate") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public String postRecurringDepositTemplate(@FormDataParam("file") InputStream uploadedInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail, + @FormDataParam("locale") final String locale, @FormDataParam("dateFormat") final String dateFormat){ + final Long importDocumentId = this.bulkImportWorkbookService.importWorkbook(GlobalEntityType.RECURRING_DEPOSIT_ACCOUNTS.toString(), + uploadedInputStream,fileDetail,locale,dateFormat); + return this.toApiJsonSerializer.serialize(importDocumentId); + } + + @GET + @Path("transactions/downloadtemplate") + @Produces("application/vnd.ms-excel") + public Response getRecurringDepositTransactionTemplate(@QueryParam("officeId")final Long officeId, + @QueryParam("dateFormat") final String dateFormat) { + return bulkImportWorkbookPopulatorService.getTemplate(GlobalEntityType.RECURRING_DEPOSIT_ACCOUNTS_TRANSACTIONS.toString(),officeId, + null,dateFormat); + } + + @POST + @Path("transactions/uploadtemplate") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public String postRecurringDepositTransactionsTemplate(@FormDataParam("file") InputStream uploadedInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale, + @FormDataParam("dateFormat") final String dateFormat){ + final Long importDocumentId = this. bulkImportWorkbookService.importWorkbook(GlobalEntityType.RECURRING_DEPOSIT_ACCOUNTS_TRANSACTIONS.toString(), + uploadedInputStream,fileDetail,locale,dateFormat); + return this.toApiJsonSerializer.serialize(importDocumentId); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java index 05feb63..9169c96 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java @@ -18,6 +18,7 @@ */ package org.apache.fineract.portfolio.savings.api; +import java.io.InputStream; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -35,12 +36,18 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; import org.apache.commons.lang.StringUtils; import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.commands.service.CommandWrapperBuilder; import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; +import org.apache.fineract.infrastructure.bulkimport.data.GlobalEntityType; +import org.apache.fineract.infrastructure.bulkimport.service.BulkImportWorkbookPopulatorService; +import org.apache.fineract.infrastructure.bulkimport.service.BulkImportWorkbookService; import org.apache.fineract.infrastructure.core.api.ApiParameterHelper; import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; @@ -73,19 +80,25 @@ public class SavingsAccountsApiResource { private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final ApiRequestParameterHelper apiRequestParameterHelper; private final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService; + private final BulkImportWorkbookService bulkImportWorkbookService; + private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService; @Autowired public SavingsAccountsApiResource(final SavingsAccountReadPlatformService savingsAccountReadPlatformService, final PlatformSecurityContext context, final DefaultToApiJsonSerializer<SavingsAccountData> toApiJsonSerializer, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, final ApiRequestParameterHelper apiRequestParameterHelper, - final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService) { + final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService, + final BulkImportWorkbookService bulkImportWorkbookService, + final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) { this.savingsAccountReadPlatformService = savingsAccountReadPlatformService; this.context = context; this.toApiJsonSerializer = toApiJsonSerializer; this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; this.apiRequestParameterHelper = apiRequestParameterHelper; this.savingsAccountChargeReadPlatformService = savingsAccountChargeReadPlatformService; + this.bulkImportWorkbookService=bulkImportWorkbookService; + this.bulkImportWorkbookPopulatorService=bulkImportWorkbookPopulatorService; } @GET @@ -327,4 +340,42 @@ public class SavingsAccountsApiResource { return this.toApiJsonSerializer.serialize(result); } + + @GET + @Path("downloadtemplate") + @Produces("application/vnd.ms-excel") + public Response getSavingsTemplate(@QueryParam("officeId")final Long officeId, + @QueryParam("staffId")final Long staffId,@QueryParam("dateFormat") final String dateFormat) { + return bulkImportWorkbookPopulatorService.getTemplate(GlobalEntityType.SAVINGS_ACCOUNT.toString(),officeId, staffId,dateFormat); + } + + @POST + @Path("uploadtemplate") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public String postSavingsTemplate(@FormDataParam("file") InputStream uploadedInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail, + @FormDataParam("locale") final String locale, + @FormDataParam("dateFormat") final String dateFormat){ + final Long importDocumentId = this. bulkImportWorkbookService.importWorkbook(GlobalEntityType.SAVINGS_ACCOUNT.toString(), uploadedInputStream, + fileDetail, locale, dateFormat); + return this.toApiJsonSerializer.serialize(importDocumentId); + } + + @GET + @Path("transactions/downloadtemplate") + @Produces("application/vnd.ms-excel") + public Response getSavingsTransactionTemplate(@QueryParam("officeId")final Long officeId,@QueryParam("dateFormat") final String dateFormat) { + return bulkImportWorkbookPopulatorService.getTemplate(GlobalEntityType.SAVINGS_TRANSACTIONS.toString(),officeId, null,dateFormat); + } + + @POST + @Path("transactions/uploadtemplate") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public String postSavingsTransactionTemplate(@FormDataParam("file") InputStream uploadedInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail, + @FormDataParam("locale") final String locale, @FormDataParam("dateFormat") final String dateFormat){ + final Long importDocumentId = this. bulkImportWorkbookService.importWorkbook(GlobalEntityType.SAVINGS_TRANSACTIONS.toString(), uploadedInputStream, + fileDetail,locale,dateFormat); + return this.toApiJsonSerializer.serialize(importDocumentId); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/ClosingOfSavingsAccounts.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/ClosingOfSavingsAccounts.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/ClosingOfSavingsAccounts.java new file mode 100644 index 0000000..0304b76 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/ClosingOfSavingsAccounts.java @@ -0,0 +1,102 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.savings.data; + + +import org.joda.time.LocalDate; + +import java.util.Locale; + +public class ClosingOfSavingsAccounts { + + private final transient Integer rowIndex; + + private final transient Long accountId; + + private final LocalDate closedOnDate; + + private final Long onAccountClosureId; + + private final Long toSavingsAccountId; + + private final String dateFormat; + + private final String accountType; + + private final String locale; + + private final String note; + + public static ClosingOfSavingsAccounts importInstance(Long accountId, LocalDate closedOnDate, + Long onAccountClosureId,Long toSavingsAccountId, String accountType,Integer rowIndex, + String locale,String dateFormat){ + return new ClosingOfSavingsAccounts(accountId, closedOnDate,onAccountClosureId,toSavingsAccountId, accountType, + rowIndex,locale,dateFormat); + } + + private ClosingOfSavingsAccounts(Long accountId, LocalDate closedOnDate, + Long onAccountClosureId,Long toSavingsAccountId, String accountType,Integer rowIndex, + String locale,String dateFormat ) { + this.accountId = accountId; + this.closedOnDate = closedOnDate; + this.onAccountClosureId = onAccountClosureId; + this.toSavingsAccountId = toSavingsAccountId; + this.accountType=accountType; + this.rowIndex = rowIndex; + this.dateFormat = dateFormat; + this.locale = locale; + this.note = ""; + } + + public Integer getRowIndex() { + return rowIndex; + } + + public Long getAccountId() { + return accountId; + } + + public LocalDate getClosedOnDate() { + return closedOnDate; + } + + public Long getOnAccountClosureId() { + return onAccountClosureId; + } + + public Long getToSavingsAccountId() { + return toSavingsAccountId; + } + + public String getDateFormat() { + return dateFormat; + } + + public String getAccountType() { + return accountType; + } + + public String getLocale() { + return locale; + } + + public String getNote() { + return note; + } +} http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountData.java index 41880dd..817cf07 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountData.java @@ -87,6 +87,59 @@ public class DepositAccountData { protected final DepositAccountInterestRateChartData chartTemplate; + //import fields + private Long productId; + + public DepositAccountData(Long clientId,Long productId,Long fieldOfficerId, + EnumOptionData interestCompoundingPeriodType, EnumOptionData interestPostingPeriodType, + EnumOptionData interestCalculationType,EnumOptionData interestCalculationDaysInYearType,Integer lockinPeriodFrequency, + EnumOptionData lockinPeriodFrequencyType,String externalId,Collection<SavingsAccountChargeData> charges) { + this.id = null; + this.accountNo = null; + this.externalId = externalId; + this.groupId = null; + this.groupName = null; + this.clientId = clientId; + this.clientName = null; + this.depositProductId = null; + this.depositProductName = null; + this.fieldOfficerId = fieldOfficerId; + this.fieldOfficerName = null; + this.status = null; + this.timeline = null; + this.currency = null; + this.nominalAnnualInterestRate = null; + this.interestCompoundingPeriodType = interestCompoundingPeriodType; + this.interestPostingPeriodType = interestPostingPeriodType; + this.interestCalculationType = interestCalculationType; + this.interestCalculationDaysInYearType = interestCalculationDaysInYearType; + this.minRequiredOpeningBalance = null; + this.lockinPeriodFrequency = lockinPeriodFrequency; + this.lockinPeriodFrequencyType = lockinPeriodFrequencyType; + this.withdrawalFeeForTransfers = false; + this.depositType = null; + this.minBalanceForInterestCalculation = null; + this.withHoldTax = false; + this.taxGroup = null; + this.summary = null; + this.transactions = null; + this.charges = charges; + this.accountChart = null; + this.productOptions = null; + this.fieldOfficerOptions = null; + this.interestCompoundingPeriodTypeOptions = null; + this.interestPostingPeriodTypeOptions = null; + this.interestCalculationTypeOptions = null; + this.interestCalculationDaysInYearTypeOptions = null; + this.lockinPeriodFrequencyTypeOptions = null; + this.withdrawalFeeTypeOptions = null; + this.chargeOptions = null; + this.withdrawalFee = null; + this.annualFee = null; + this.chartTemplate = null; + this.productId=productId; + } + public static DepositAccountData instance(final Long id, final String accountNo, final String externalId, final Long groupId, final String groupName, final Long clientId, final String clientName, final Long productId, final String productName, final Long fieldOfficerId, final String fieldOfficerName, final SavingsAccountStatusEnumData status, http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositProductData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositProductData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositProductData.java index bf3680e..bca5126 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositProductData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositProductData.java @@ -411,4 +411,49 @@ public class DepositProductData { public String getName() { return this.name; } -} \ No newline at end of file + + public EnumOptionData getLockinPeriodFrequencyType() { + return lockinPeriodFrequencyType; + } + + public Integer getLockinPeriodFrequency() { + return lockinPeriodFrequency; + } + + public Long getId() { + return id; + } + + public BigDecimal getNominalAnnualInterestRate() { + return nominalAnnualInterestRate; + } + + public EnumOptionData getInterestPostingPeriodType() { + return interestPostingPeriodType; + } + + public EnumOptionData getInterestCalculationType() { + return interestCalculationType; + } + + public EnumOptionData getInterestCalculationDaysInYearType() { + return interestCalculationDaysInYearType; + } + + public BigDecimal getMinBalanceForInterestCalculation() { + return minBalanceForInterestCalculation; + } + + public String getShortName() { + return shortName; + } + + public CurrencyData getCurrency() { + return currency; + } + + public EnumOptionData getInterestCompoundingPeriodType() { + return interestCompoundingPeriodType; + } +} + http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositAccountData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositAccountData.java index 60ee6a2..251e6b1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositAccountData.java @@ -23,6 +23,7 @@ import java.util.Collection; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.staff.data.StaffData; @@ -69,6 +70,69 @@ public class FixedDepositAccountData extends DepositAccountData { private Collection<EnumOptionData> onAccountClosureOptions; private Collection<PaymentTypeData> paymentTypeOptions; + //import fields + private transient Integer rowIndex; + private String dateFormat; + private String locale; + private LocalDate submittedOnDate; + private Long depositPeriodFrequencyId; + + public static FixedDepositAccountData importInstance(Long clientId,Long productId,Long fieldOfficerId,LocalDate submittedOnDate, + EnumOptionData interestCompoundingPeriodTypeEnum,EnumOptionData interestPostingPeriodTypeEnum, + EnumOptionData interestCalculationTypeEnum,EnumOptionData interestCalculationDaysInYearTypeEnum, + Integer lockinPeriodFrequency,EnumOptionData lockinPeriodFrequencyTypeEnum,BigDecimal depositAmount, + Integer depositPeriod,Long depositPeriodFrequencyId,String externalId, + Collection<SavingsAccountChargeData> charges,Integer rowIndex,String locale,String dateFormat){ + + return new FixedDepositAccountData(clientId, productId, fieldOfficerId, submittedOnDate, + interestCompoundingPeriodTypeEnum, interestPostingPeriodTypeEnum, interestCalculationTypeEnum, + interestCalculationDaysInYearTypeEnum, lockinPeriodFrequency, lockinPeriodFrequencyTypeEnum, + depositAmount, depositPeriod, depositPeriodFrequencyId, externalId, charges,rowIndex,locale,dateFormat); + } + + private FixedDepositAccountData(Long clientId,Long productId,Long fieldofficerId,LocalDate submittedOnDate, + EnumOptionData interestCompoundingPeriodType,EnumOptionData interestPostingPeriodType, + EnumOptionData interestCalculationType,EnumOptionData interestCalculationDaysInYearType, + Integer lockinPeriodFrequency,EnumOptionData lockinPeriodFrequencyType,BigDecimal depositAmount, + Integer depositPeriod,Long depositPeriodFrequencyId,String externalId, + Collection<SavingsAccountChargeData> charges,Integer rowIndex,String locale,String dateFormat) { + super(clientId, productId, fieldofficerId, interestCompoundingPeriodType, interestPostingPeriodType, + interestCalculationType, interestCalculationDaysInYearType, lockinPeriodFrequency, + lockinPeriodFrequencyType, externalId, charges); + this.preClosurePenalApplicable = false; + this.preClosurePenalInterest = null; + this.preClosurePenalInterestOnType = null; + this.minDepositTerm = null; + this.maxDepositTerm = null; + this.minDepositTermType = null; + this.maxDepositTermType = null; + this.inMultiplesOfDepositTerm = null; + this.inMultiplesOfDepositTermType = null; + this.depositAmount = depositAmount; + this.maturityAmount = null; + this.maturityDate = null; + this.depositPeriod = depositPeriod; + this.depositPeriodFrequency = null; + this.activationCharge = null; + this.onAccountClosure = null; + this.linkedAccount = null; + this.transferInterestToSavings = null; + this.preClosurePenalInterestOnTypeOptions = null; + this.periodFrequencyTypeOptions = null; + this.savingsAccounts = null; + this.onAccountClosureOptions = null; + this.paymentTypeOptions = null; + this.rowIndex = rowIndex; + this.dateFormat= dateFormat; + this.locale= locale; + this.submittedOnDate = submittedOnDate; + this.depositPeriodFrequencyId = depositPeriodFrequencyId; + } + + public Integer getRowIndex() { + return rowIndex; + } + public static FixedDepositAccountData instance(final DepositAccountData depositAccountData, final boolean preClosurePenalApplicable, final BigDecimal preClosurePenalInterest, final EnumOptionData preClosurePenalInterestOnType, final Integer minDepositTerm, final Integer maxDepositTerm, final EnumOptionData minDepositTermType, final EnumOptionData maxDepositTermType, http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositProductData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositProductData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositProductData.java index f2b2d33..31a67ca 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositProductData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositProductData.java @@ -404,4 +404,52 @@ public class FixedDepositProductData extends DepositProductData { this.periodFrequencyTypeOptions = periodFrequencyTypeOptions; } + public Integer getMinDepositTerm() { + return minDepositTerm; + } + + public EnumOptionData getMinDepositTermType() { + return minDepositTermType; + } + + public EnumOptionData getMaxDepositTermType() { + return maxDepositTermType; + } + + public Integer getMaxDepositTerm() { + return maxDepositTerm; + } + + public Integer getInMultiplesOfDepositTerm() { + return inMultiplesOfDepositTerm; + } + + public EnumOptionData getInMultiplesOfDepositTermType() { + return inMultiplesOfDepositTermType; + } + + public BigDecimal getMinDepositAmount() { + return minDepositAmount; + } + + public BigDecimal getDepositAmount() { + return depositAmount; + } + + public BigDecimal getMaxDepositAmount() { + return maxDepositAmount; + } + + public EnumOptionData getPreClosurePenalInterestOnType() { + return preClosurePenalInterestOnType; + } + + public BigDecimal getPreClosurePenalInterest() { + return preClosurePenalInterest; + } + + public boolean isPreClosurePenalApplicable() { + return preClosurePenalApplicable; + } + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositAccountData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositAccountData.java index 6f61ef2..1b5dcf0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositAccountData.java @@ -23,6 +23,7 @@ import java.util.Collection; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.staff.data.StaffData; @@ -75,6 +76,82 @@ public class RecurringDepositAccountData extends DepositAccountData { private final Collection<EnumOptionData> onAccountClosureOptions; private final Collection<PaymentTypeData> paymentTypeOptions; + //import fields + private transient Integer rowIndex; + private String dateFormat; + private String locale; + private LocalDate submittedOnDate; + private Long depositPeriodFrequencyId; + + public static RecurringDepositAccountData importInstance(Long clientId,Long productId,Long fieldOfficerId, + LocalDate submittedOnDate, + EnumOptionData interestCompoundingPeriodTypeEnum,EnumOptionData interestPostingPeriodTypeEnum, + EnumOptionData interestCalculationTypeEnum,EnumOptionData interestCalculationDaysInYearTypeEnum, + Integer lockinPeriodFrequency,EnumOptionData lockinPeriodFrequencyTypeEnum,BigDecimal depositAmount, + Integer depositPeriod,Long depositPeriodFrequencyId,LocalDate expectedFirstDepositOnDate, + Integer recurringFrequency,EnumOptionData recurringFrequencyTypeEnum,boolean isCalendarInherited, + boolean isMandatoryDeposit,boolean allowWithdrawal,boolean adjustAdvanceTowardsFuturePayments, + String externalId,Collection<SavingsAccountChargeData> charges,Integer rowIndex,String locale, String dateFormat){ + + return new RecurringDepositAccountData(clientId, productId, fieldOfficerId, submittedOnDate, + interestCompoundingPeriodTypeEnum,interestPostingPeriodTypeEnum,interestCalculationTypeEnum, + interestCalculationDaysInYearTypeEnum, lockinPeriodFrequency, lockinPeriodFrequencyTypeEnum, + depositAmount, depositPeriod, depositPeriodFrequencyId, expectedFirstDepositOnDate, + recurringFrequency, recurringFrequencyTypeEnum, isCalendarInherited, isMandatoryDeposit, + allowWithdrawal, adjustAdvanceTowardsFuturePayments, externalId,charges, rowIndex,locale,dateFormat); + } + private RecurringDepositAccountData(Long clientId,Long productId,Long fieldofficerId,LocalDate submittedOnDate, + EnumOptionData interestCompoundingPeriodType,EnumOptionData interestPostingPeriodType, + EnumOptionData interestCalculationType,EnumOptionData interestCalculationDaysInYearType, + Integer lockinPeriodFrequency,EnumOptionData lockinPeriodFrequencyType,BigDecimal depositAmount, + Integer depositPeriod,Long depositPeriodFrequencyId,LocalDate expectedFirstDepositOnDate, + Integer recurringFrequency,EnumOptionData recurringFrequencyType,boolean isCalendarInherited, + boolean isMandatoryDeposit,boolean allowWithdrawal,boolean adjustAdvanceTowardsFuturePayments, + String externalId,Collection<SavingsAccountChargeData> charges,Integer rowIndex,String locale, String dateFormat) { + super(clientId,productId,fieldofficerId,interestCompoundingPeriodType,interestPostingPeriodType,interestCalculationType, + interestCalculationDaysInYearType,lockinPeriodFrequency,lockinPeriodFrequencyType, externalId,charges); + + this.preClosurePenalApplicable = false; + this.preClosurePenalInterest = null; + this.preClosurePenalInterestOnType = null; + this.minDepositTerm = null; + this.maxDepositTerm = null; + this.minDepositTermType = null; + this.maxDepositTermType = null; + this.inMultiplesOfDepositTerm = null; + this.inMultiplesOfDepositTermType = null; + this.depositAmount = null; + this.maturityAmount = null; + this.maturityDate = null; + this.depositPeriod = depositPeriod; + this.depositPeriodFrequency = null; + this.mandatoryRecommendedDepositAmount = depositAmount; + this.totalOverdueAmount = null; + this.noOfOverdueInstallments = null; + this.isMandatoryDeposit = isMandatoryDeposit; + this.allowWithdrawal = allowWithdrawal; + this.adjustAdvanceTowardsFuturePayments = adjustAdvanceTowardsFuturePayments; + this.expectedFirstDepositOnDate = expectedFirstDepositOnDate; + this.isCalendarInherited = isCalendarInherited; + this.recurringFrequency = recurringFrequency; + this.recurringFrequencyType = recurringFrequencyType; + this.onAccountClosure = null; + this.preClosurePenalInterestOnTypeOptions = null; + this.periodFrequencyTypeOptions = null; + this.savingsAccounts = null; + this.onAccountClosureOptions = null; + this.paymentTypeOptions = null; + this.rowIndex = rowIndex; + this.dateFormat= dateFormat; + this.locale=locale; + this.submittedOnDate=submittedOnDate; + this.depositPeriodFrequencyId=depositPeriodFrequencyId; + } + + public Integer getRowIndex() { + return rowIndex; + } + public static RecurringDepositAccountData instance(final DepositAccountData depositAccountData, final boolean preClosurePenalApplicable, final BigDecimal preClosurePenalInterest, final EnumOptionData preClosurePenalInterestOnType, final Integer minDepositTerm, final Integer maxDepositTerm, http://git-wip-us.apache.org/repos/asf/fineract/blob/210647d4/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositProductData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositProductData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositProductData.java index 184a7e7..e3b1b13 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositProductData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositProductData.java @@ -422,4 +422,63 @@ public class RecurringDepositProductData extends DepositProductData { this.periodFrequencyTypeOptions = periodFrequencyTypeOptions; } + public EnumOptionData getMinDepositTermType() { + return minDepositTermType; + } + + public boolean isPreClosurePenalApplicable() { + return preClosurePenalApplicable; + } + + public BigDecimal getPreClosurePenalInterest() { + return preClosurePenalInterest; + } + + public EnumOptionData getPreClosurePenalInterestOnType() { + return preClosurePenalInterestOnType; + } + + public Integer getMinDepositTerm() { + return minDepositTerm; + } + + public Integer getMaxDepositTerm() { + return maxDepositTerm; + } + + public EnumOptionData getMaxDepositTermType() { + return maxDepositTermType; + } + + public BigDecimal getMinDepositAmount() { + return minDepositAmount; + } + + public BigDecimal getDepositAmount() { + return depositAmount; + } + + public BigDecimal getMaxDepositAmount() { + return maxDepositAmount; + } + + public Integer getInMultiplesOfDepositTerm() { + return inMultiplesOfDepositTerm; + } + + public EnumOptionData getInMultiplesOfDepositTermType() { + return inMultiplesOfDepositTermType; + } + + public boolean isMandatoryDeposit() { + return isMandatoryDeposit; + } + + public boolean isAllowWithdrawal() { + return allowWithdrawal; + } + + public boolean isAdjustAdvanceTowardsFuturePayments() { + return adjustAdvanceTowardsFuturePayments; + } } \ No newline at end of file