List of usage examples for org.joda.time LocalDate toDate
@SuppressWarnings("deprecation") public Date toDate()
java.util.Date
. From source file:com.gst.portfolio.loanaccount.rescheduleloan.service.LoanRescheduleRequestWritePlatformServiceImpl.java
License:Apache License
/** * create a new instance of the LoanRescheduleRequest object from the * JsonCommand object and persist/*from www. j ava2s . co m*/ * * @return CommandProcessingResult object **/ @Override @Transactional public CommandProcessingResult create(JsonCommand jsonCommand) { try { // get the loan id from the JsonCommand object final Long loanId = jsonCommand.longValueOfParameterNamed(RescheduleLoansApiConstants.loanIdParamName); // use the loan id to get a Loan entity object final Loan loan = this.loanAssembler.assembleFrom(loanId); // validate the request in the JsonCommand object passed as // parameter this.loanRescheduleRequestDataValidator.validateForCreateAction(jsonCommand, loan); // get the reschedule reason code value id from the JsonCommand // object final Long rescheduleReasonId = jsonCommand .longValueOfParameterNamed(RescheduleLoansApiConstants.rescheduleReasonIdParamName); // use the reschedule reason code value id to get a CodeValue entity // object final CodeValue rescheduleReasonCodeValue = this.codeValueRepositoryWrapper .findOneWithNotFoundDetection(rescheduleReasonId); // get the grace on principal integer value from the JsonCommand // object final Integer graceOnPrincipal = jsonCommand .integerValueOfParameterNamed(RescheduleLoansApiConstants.graceOnPrincipalParamName); // get the grace on interest integer value from the JsonCommand // object final Integer graceOnInterest = jsonCommand .integerValueOfParameterNamed(RescheduleLoansApiConstants.graceOnInterestParamName); // get the extra terms to be added at the end of the new schedule // from the JsonCommand object final Integer extraTerms = jsonCommand .integerValueOfParameterNamed(RescheduleLoansApiConstants.extraTermsParamName); // get the new interest rate that would be applied to the new loan // schedule final BigDecimal interestRate = jsonCommand .bigDecimalValueOfParameterNamed(RescheduleLoansApiConstants.newInterestRateParamName); // get the reschedule reason comment text from the JsonCommand // object final String rescheduleReasonComment = jsonCommand .stringValueOfParameterNamed(RescheduleLoansApiConstants.rescheduleReasonCommentParamName); // get the recalculate interest option final Boolean recalculateInterest = jsonCommand .booleanObjectValueOfParameterNamed(RescheduleLoansApiConstants.recalculateInterestParamName); // initialize set the value to null Date submittedOnDate = null; // check if the parameter is in the JsonCommand object if (jsonCommand.hasParameter(RescheduleLoansApiConstants.submittedOnDateParamName)) { // create a LocalDate object from the "submittedOnDate" Date // string LocalDate localDate = jsonCommand .localDateValueOfParameterNamed(RescheduleLoansApiConstants.submittedOnDateParamName); if (localDate != null) { // update the value of the "submittedOnDate" variable submittedOnDate = localDate.toDate(); } } // initially set the value to null Date rescheduleFromDate = null; // start point of the rescheduling exercise Integer rescheduleFromInstallment = null; // initially set the value to null Date adjustedDueDate = null; // check if the parameter is in the JsonCommand object if (jsonCommand.hasParameter(RescheduleLoansApiConstants.rescheduleFromDateParamName)) { // create a LocalDate object from the "rescheduleFromDate" Date // string LocalDate localDate = jsonCommand .localDateValueOfParameterNamed(RescheduleLoansApiConstants.rescheduleFromDateParamName); if (localDate != null) { // get installment by due date LoanRepaymentScheduleInstallment installment = loan.getRepaymentScheduleInstallment(localDate); rescheduleFromInstallment = installment.getInstallmentNumber(); // update the value of the "rescheduleFromDate" variable rescheduleFromDate = localDate.toDate(); } } if (jsonCommand.hasParameter(RescheduleLoansApiConstants.adjustedDueDateParamName)) { // create a LocalDate object from the "adjustedDueDate" Date // string LocalDate localDate = jsonCommand .localDateValueOfParameterNamed(RescheduleLoansApiConstants.adjustedDueDateParamName); if (localDate != null) { // update the value of the "adjustedDueDate"variable adjustedDueDate = localDate.toDate(); } } final LoanRescheduleRequest loanRescheduleRequest = LoanRescheduleRequest.instance(loan, LoanStatus.SUBMITTED_AND_PENDING_APPROVAL.getValue(), rescheduleFromInstallment, rescheduleFromDate, recalculateInterest, rescheduleReasonCodeValue, rescheduleReasonComment, submittedOnDate, this.platformSecurityContext.authenticatedUser(), null, null, null, null); // update reschedule request to term variations mapping List<LoanRescheduleRequestToTermVariationMapping> loanRescheduleRequestToTermVariationMappings = new ArrayList<>(); final Boolean isActive = false; final boolean isSpecificToInstallment = false; BigDecimal decimalValue = null; Date dueDate = null; // create term variations for flat and declining balance loans createLoanTermVariationsForRegularLoans(loan, graceOnPrincipal, graceOnInterest, extraTerms, interestRate, rescheduleFromDate, adjustedDueDate, loanRescheduleRequest, loanRescheduleRequestToTermVariationMappings, isActive, isSpecificToInstallment, decimalValue, dueDate); // create a new entry in the m_loan_reschedule_request table this.loanRescheduleRequestRepository.save(loanRescheduleRequest); this.loanRepositoryWrapper.save(loan); return new CommandProcessingResultBuilder().withCommandId(jsonCommand.commandId()) .withEntityId(loanRescheduleRequest.getId()).withLoanId(loan.getId()).build(); } catch (final DataIntegrityViolationException dve) { // handle the data integrity violation handleDataIntegrityViolation(dve); // return an empty command processing result object return CommandProcessingResult.empty(); } }
From source file:com.gst.portfolio.loanaccount.rescheduleloan.service.LoanRescheduleRequestWritePlatformServiceImpl.java
License:Apache License
@Override @Transactional/*from w ww .j a v a 2 s .c o m*/ public CommandProcessingResult approve(JsonCommand jsonCommand) { try { final Long loanRescheduleRequestId = jsonCommand.entityId(); final LoanRescheduleRequest loanRescheduleRequest = this.loanRescheduleRequestRepository .findOne(loanRescheduleRequestId); if (loanRescheduleRequest == null) { throw new LoanRescheduleRequestNotFoundException(loanRescheduleRequestId); } // validate the request in the JsonCommand object passed as // parameter this.loanRescheduleRequestDataValidator.validateForApproveAction(jsonCommand, loanRescheduleRequest); final AppUser appUser = this.platformSecurityContext.authenticatedUser(); final Map<String, Object> changes = new LinkedHashMap<>(); LocalDate approvedOnDate = jsonCommand.localDateValueOfParameterNamed("approvedOnDate"); final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(jsonCommand.dateFormat()) .withLocale(jsonCommand.extractLocale()); changes.put("locale", jsonCommand.locale()); changes.put("dateFormat", jsonCommand.dateFormat()); changes.put("approvedOnDate", approvedOnDate.toString(dateTimeFormatter)); changes.put("approvedByUserId", appUser.getId()); Loan loan = loanRescheduleRequest.getLoan(); final List<Long> existingTransactionIds = new ArrayList<>(loan.findExistingTransactionIds()); final List<Long> existingReversedTransactionIds = new ArrayList<>( loan.findExistingReversedTransactionIds()); ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, loanRescheduleRequest.getRescheduleFromDate()); Collection<LoanRepaymentScheduleHistory> loanRepaymentScheduleHistoryList = this.loanScheduleHistoryWritePlatformService .createLoanScheduleArchive(loan.getRepaymentScheduleInstallments(), loan, loanRescheduleRequest); final LoanApplicationTerms loanApplicationTerms = loan .constructLoanApplicationTerms(scheduleGeneratorDTO); LocalDate rescheduleFromDate = null; Set<LoanTermVariations> activeLoanTermVariations = loan.getActiveLoanTermVariations(); LoanTermVariations dueDateVariationInCurrentRequest = loanRescheduleRequest .getDueDateTermVariationIfExists(); if (dueDateVariationInCurrentRequest != null && activeLoanTermVariations != null) { LocalDate fromScheduleDate = dueDateVariationInCurrentRequest.fetchTermApplicaDate(); LocalDate currentScheduleDate = fromScheduleDate; LocalDate modifiedScheduleDate = dueDateVariationInCurrentRequest.fetchDateValue(); Map<LocalDate, LocalDate> changeMap = new HashMap<>(); changeMap.put(currentScheduleDate, modifiedScheduleDate); for (LoanTermVariations activeLoanTermVariation : activeLoanTermVariations) { if (activeLoanTermVariation.getTermType().isDueDateVariation() && activeLoanTermVariation .fetchDateValue().equals(dueDateVariationInCurrentRequest.fetchTermApplicaDate())) { activeLoanTermVariation.markAsInactive(); rescheduleFromDate = activeLoanTermVariation.fetchTermApplicaDate(); dueDateVariationInCurrentRequest.setTermApplicableFrom(rescheduleFromDate.toDate()); } else if (!activeLoanTermVariation.fetchTermApplicaDate().isBefore(fromScheduleDate)) { while (currentScheduleDate.isBefore(activeLoanTermVariation.fetchTermApplicaDate())) { currentScheduleDate = this.scheduledDateGenerator.generateNextRepaymentDate( currentScheduleDate, loanApplicationTerms, false, loanApplicationTerms.getHolidayDetailDTO()); modifiedScheduleDate = this.scheduledDateGenerator.generateNextRepaymentDate( modifiedScheduleDate, loanApplicationTerms, false, loanApplicationTerms.getHolidayDetailDTO()); changeMap.put(currentScheduleDate, modifiedScheduleDate); } if (changeMap.containsKey(activeLoanTermVariation.fetchTermApplicaDate())) { activeLoanTermVariation.setTermApplicableFrom( changeMap.get(activeLoanTermVariation.fetchTermApplicaDate()).toDate()); } } } } if (rescheduleFromDate == null) { rescheduleFromDate = loanRescheduleRequest.getRescheduleFromDate(); } for (LoanRescheduleRequestToTermVariationMapping mapping : loanRescheduleRequest .getLoanRescheduleRequestToTermVariationMappings()) { mapping.getLoanTermVariations().updateIsActive(true); } BigDecimal annualNominalInterestRate = null; List<LoanTermVariationsData> loanTermVariations = new ArrayList<>(); loan.constructLoanTermVariations(scheduleGeneratorDTO.getFloatingRateDTO(), annualNominalInterestRate, loanTermVariations); loanApplicationTerms.getLoanTermVariations().setExceptionData(loanTermVariations); /*for (LoanTermVariationsData loanTermVariation : loanApplicationTerms.getLoanTermVariations().getDueDateVariation()) { if (rescheduleFromDate.isBefore(loanTermVariation.getTermApplicableFrom())) { LocalDate applicableDate = this.scheduledDateGenerator.generateNextRepaymentDate(rescheduleFromDate, loanApplicationTerms, false, loanApplicationTerms.getHolidayDetailDTO()); if (loanTermVariation.getTermApplicableFrom().equals(applicableDate)) { LocalDate adjustedDate = this.scheduledDateGenerator.generateNextRepaymentDate(adjustedApplicableDate, loanApplicationTerms, false, loanApplicationTerms.getHolidayDetailDTO()); loanTermVariation.setApplicableFromDate(adjustedDate); } } }*/ final RoundingMode roundingMode = MoneyHelper.getRoundingMode(); final MathContext mathContext = new MathContext(8, roundingMode); final LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor = this.loanRepaymentScheduleTransactionProcessorFactory .determineProcessor(loan.transactionProcessingStrategy()); final LoanScheduleGenerator loanScheduleGenerator = this.loanScheduleFactory .create(loanApplicationTerms.getInterestMethod()); final LoanLifecycleStateMachine loanLifecycleStateMachine = null; loan.setHelpers(loanLifecycleStateMachine, this.loanSummaryWrapper, this.loanRepaymentScheduleTransactionProcessorFactory); final LoanScheduleDTO loanSchedule = loanScheduleGenerator.rescheduleNextInstallments(mathContext, loanApplicationTerms, loan, loanApplicationTerms.getHolidayDetailDTO(), loanRepaymentScheduleTransactionProcessor, rescheduleFromDate); loan.updateLoanSchedule(loanSchedule.getInstallments(), appUser); loan.recalculateAllCharges(); ChangedTransactionDetail changedTransactionDetail = loan.processTransactions(); for (LoanRepaymentScheduleHistory loanRepaymentScheduleHistory : loanRepaymentScheduleHistoryList) { this.loanRepaymentScheduleHistoryRepository.save(loanRepaymentScheduleHistory); } loan.updateRescheduledByUser(appUser); loan.updateRescheduledOnDate(new LocalDate()); // update the status of the request loanRescheduleRequest.approve(appUser, approvedOnDate); // update the loan object saveAndFlushLoanWithDataIntegrityViolationChecks(loan); if (changedTransactionDetail != null) { for (final Map.Entry<Long, LoanTransaction> mapEntry : changedTransactionDetail .getNewTransactionMappings().entrySet()) { this.loanTransactionRepository.save(mapEntry.getValue()); // update loan with references to the newly created // transactions loan.addLoanTransaction(mapEntry.getValue()); this.accountTransfersWritePlatformService.updateLoanTransaction(mapEntry.getKey(), mapEntry.getValue()); } } postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); this.loanAccountDomainService.recalculateAccruals(loan, true); return new CommandProcessingResultBuilder().withCommandId(jsonCommand.commandId()) .withEntityId(loanRescheduleRequestId).withLoanId(loanRescheduleRequest.getLoan().getId()) .with(changes).build(); } catch (final DataIntegrityViolationException dve) { // handle the data integrity violation handleDataIntegrityViolation(dve); // return an empty command processing result object return CommandProcessingResult.empty(); } }
From source file:com.gst.portfolio.loanaccount.service.LoanAccrualWritePlatformServiceImpl.java
License:Apache License
private void addAccrualAccounting(LoanScheduleAccrualData scheduleAccrualData, BigDecimal amount, BigDecimal interestportion, BigDecimal totalAccInterest, BigDecimal feeportion, BigDecimal totalAccFee, BigDecimal penaltyportion, BigDecimal totalAccPenalty, final LocalDate accruedTill) throws Exception { String transactionSql = "INSERT INTO m_loan_transaction (loan_id,office_id,is_reversed,transaction_type_enum,transaction_date,amount,interest_portion_derived," + "fee_charges_portion_derived,penalty_charges_portion_derived, submitted_on_date) VALUES (?, ?, 0, ?, ?, ?, ?, ?, ?, ?)"; this.jdbcTemplate.update(transactionSql, scheduleAccrualData.getLoanId(), scheduleAccrualData.getOfficeId(), LoanTransactionType.ACCRUAL.getValue(), accruedTill.toDate(), amount, interestportion, feeportion, penaltyportion, DateUtils.getDateOfTenant()); @SuppressWarnings("deprecation") final Long transactonId = this.jdbcTemplate.queryForLong("SELECT LAST_INSERT_ID()"); Map<LoanChargeData, BigDecimal> applicableCharges = scheduleAccrualData.getApplicableCharges(); String chargespaidSql = "INSERT INTO m_loan_charge_paid_by (loan_transaction_id, loan_charge_id, amount,installment_number) VALUES (?,?,?,?)"; for (Map.Entry<LoanChargeData, BigDecimal> entry : applicableCharges.entrySet()) { LoanChargeData chargeData = entry.getKey(); this.jdbcTemplate.update(chargespaidSql, transactonId, chargeData.getId(), entry.getValue(), scheduleAccrualData.getInstallmentNumber()); }//from w ww . j av a 2 s .c om Map<String, Object> transactionMap = toMapData(transactonId, amount, interestportion, feeportion, penaltyportion, scheduleAccrualData, accruedTill); String repaymetUpdatesql = "UPDATE m_loan_repayment_schedule SET accrual_interest_derived=?, accrual_fee_charges_derived=?, " + "accrual_penalty_charges_derived=? WHERE id=?"; this.jdbcTemplate.update(repaymetUpdatesql, totalAccInterest, totalAccFee, totalAccPenalty, scheduleAccrualData.getRepaymentScheduleId()); String updateLoan = "UPDATE m_loan SET accrued_till=? WHERE id=?"; this.jdbcTemplate.update(updateLoan, accruedTill.toDate(), scheduleAccrualData.getLoanId()); final Map<String, Object> accountingBridgeData = deriveAccountingBridgeData(scheduleAccrualData, transactionMap); this.journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData); }
From source file:com.gst.portfolio.loanaccount.service.LoanUtilService.java
License:Apache License
public List<LoanDisbursementDetails> fetchDisbursementData(final JsonObject command) { final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(command); final String dateFormat = this.fromApiJsonHelper.extractDateFormatParameter(command); List<LoanDisbursementDetails> disbursementDatas = new ArrayList<>(); if (command.has(LoanApiConstants.disbursementDataParameterName)) { final JsonArray disbursementDataArray = command .getAsJsonArray(LoanApiConstants.disbursementDataParameterName); if (disbursementDataArray != null && disbursementDataArray.size() > 0) { int i = 0; do {//from www .j a va 2 s . co m final JsonObject jsonObject = disbursementDataArray.get(i).getAsJsonObject(); Date expectedDisbursementDate = null; Date actualDisbursementDate = null; BigDecimal principal = null; if (jsonObject.has(LoanApiConstants.disbursementDateParameterName)) { LocalDate date = this.fromApiJsonHelper.extractLocalDateNamed( LoanApiConstants.disbursementDateParameterName, jsonObject, dateFormat, locale); if (date != null) { expectedDisbursementDate = date.toDate(); } } if (jsonObject.has(LoanApiConstants.disbursementPrincipalParameterName) && jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).isJsonPrimitive() && StringUtils.isNotBlank((jsonObject .get(LoanApiConstants.disbursementPrincipalParameterName).getAsString()))) { principal = jsonObject .getAsJsonPrimitive(LoanApiConstants.disbursementPrincipalParameterName) .getAsBigDecimal(); } disbursementDatas.add(new LoanDisbursementDetails(expectedDisbursementDate, actualDisbursementDate, principal)); i++; } while (i < disbursementDataArray.size()); } } return disbursementDatas; }
From source file:com.gst.portfolio.loanaccount.service.LoanWritePlatformServiceJpaRepositoryImpl.java
License:Apache License
private void updateLoanCounters(final Loan loan, final LocalDate actualDisbursementDate) { if (loan.isGroupLoan()) { final List<Loan> loansToUpdateForLoanCounter = this.loanRepositoryWrapper.getGroupLoansDisbursedAfter( actualDisbursementDate.toDate(), loan.getGroupId(), AccountType.GROUP.getValue()); final Integer newLoanCounter = getNewGroupLoanCounter(loan); final Integer newLoanProductCounter = getNewGroupLoanProductCounter(loan); updateLoanCounter(loan, loansToUpdateForLoanCounter, newLoanCounter, newLoanProductCounter); } else {//from www . j a va 2 s . c om final List<Loan> loansToUpdateForLoanCounter = this.loanRepositoryWrapper .getClientOrJLGLoansDisbursedAfter(actualDisbursementDate.toDate(), loan.getClientId()); final Integer newLoanCounter = getNewClientOrJLGLoanCounter(loan); final Integer newLoanProductCounter = getNewClientOrJLGLoanProductCounter(loan); updateLoanCounter(loan, loansToUpdateForLoanCounter, newLoanCounter, newLoanProductCounter); } }
From source file:com.gst.portfolio.loanproduct.domain.LoanProduct.java
License:Apache License
public LoanProduct(final Fund fund, final LoanTransactionProcessingStrategy transactionProcessingStrategy, final String name, final String shortName, final String description, final MonetaryCurrency currency, final BigDecimal defaultPrincipal, final BigDecimal defaultMinPrincipal, final BigDecimal defaultMaxPrincipal, final BigDecimal defaultNominalInterestRatePerPeriod, final BigDecimal defaultMinNominalInterestRatePerPeriod, final BigDecimal defaultMaxNominalInterestRatePerPeriod, final PeriodFrequencyType interestPeriodFrequencyType, final BigDecimal defaultAnnualNominalInterestRate, final InterestMethod interestMethod, final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final boolean considerPartialPeriodInterest, final Integer repayEvery, final PeriodFrequencyType repaymentFrequencyType, final Integer defaultNumberOfInstallments, final Integer defaultMinNumberOfInstallments, final Integer defaultMaxNumberOfInstallments, final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods, final Integer graceOnInterestPayment, final Integer graceOnInterestCharged, final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance, final List<Charge> charges, final AccountingRuleType accountingRuleType, final boolean includeInBorrowerCycle, final LocalDate startDate, final LocalDate closeDate, final String externalId, final boolean useBorrowerCycle, final Set<LoanProductBorrowerCycleVariations> loanProductBorrowerCycleVariations, final boolean multiDisburseLoan, final Integer maxTrancheCount, final BigDecimal outstandingLoanBalance, final Integer graceOnArrearsAgeing, final Integer overdueDaysForNPA, final DaysInMonthType daysInMonthType, final DaysInYearType daysInYearType, final boolean isInterestRecalculationEnabled, final LoanProductInterestRecalculationDetails productInterestRecalculationDetails, final Integer minimumDaysBetweenDisbursalAndFirstRepayment, final boolean holdGuarantorFunds, final LoanProductGuaranteeDetails loanProductGuaranteeDetails, final BigDecimal principalThresholdForLastInstallment, final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion, final boolean canDefineEmiAmount, final Integer installmentAmountInMultiplesOf, final LoanProductConfigurableAttributes loanProductConfigurableAttributes, Boolean isLinkedToFloatingInterestRates, FloatingRate floatingRate, BigDecimal interestRateDifferential, BigDecimal minDifferentialLendingRate, BigDecimal maxDifferentialLendingRate, BigDecimal defaultDifferentialLendingRate, Boolean isFloatingInterestRateCalculationAllowed, final Boolean isVariableInstallmentsAllowed, final Integer minimumGapBetweenInstallments, final Integer maximumGapBetweenInstallments, final boolean syncExpectedWithDisbursementDate, final boolean canUseForTopup) { this.fund = fund; this.transactionProcessingStrategy = transactionProcessingStrategy; this.name = name.trim(); this.shortName = shortName.trim(); if (StringUtils.isNotBlank(description)) { this.description = description.trim(); } else {/* ww w. ja v a 2 s . co m*/ this.description = null; } if (charges != null) { this.charges = charges; } this.isLinkedToFloatingInterestRate = isLinkedToFloatingInterestRates == null ? false : isLinkedToFloatingInterestRates; if (isLinkedToFloatingInterestRate) { this.floatingRates = new LoanProductFloatingRates(floatingRate, this, interestRateDifferential, minDifferentialLendingRate, maxDifferentialLendingRate, defaultDifferentialLendingRate, isFloatingInterestRateCalculationAllowed); } this.allowVariabeInstallments = isVariableInstallmentsAllowed == null ? false : isVariableInstallmentsAllowed; if (allowVariabeInstallments) { this.variableInstallmentConfig = new LoanProductVariableInstallmentConfig(this, minimumGapBetweenInstallments, maximumGapBetweenInstallments); } this.loanProductRelatedDetail = new LoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType, defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, considerPartialPeriodInterest, repayEvery, repaymentFrequencyType, defaultNumberOfInstallments, graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, graceOnInterestCharged, amortizationMethod, inArrearsTolerance, graceOnArrearsAgeing, daysInMonthType.getValue(), daysInYearType.getValue(), isInterestRecalculationEnabled); this.loanProductRelatedDetail.validateRepaymentPeriodWithGraceSettings(); this.loanProductMinMaxConstraints = new LoanProductMinMaxConstraints(defaultMinPrincipal, defaultMaxPrincipal, defaultMinNominalInterestRatePerPeriod, defaultMaxNominalInterestRatePerPeriod, defaultMinNumberOfInstallments, defaultMaxNumberOfInstallments); if (accountingRuleType != null) { this.accountingRule = accountingRuleType.getValue(); } this.includeInBorrowerCycle = includeInBorrowerCycle; this.useBorrowerCycle = useBorrowerCycle; if (startDate != null) { this.startDate = startDate.toDateTimeAtStartOfDay().toDate(); } if (closeDate != null) { this.closeDate = closeDate.toDateTimeAtStartOfDay().toDate(); } this.externalId = externalId; this.borrowerCycleVariations = loanProductBorrowerCycleVariations; for (LoanProductBorrowerCycleVariations borrowerCycleVariations : this.borrowerCycleVariations) { borrowerCycleVariations.updateLoanProduct(this); } if (loanProductConfigurableAttributes != null) { this.loanConfigurableAttributes = loanProductConfigurableAttributes; loanConfigurableAttributes.updateLoanProduct(this); } this.loanProducTrancheDetails = new LoanProductTrancheDetails(multiDisburseLoan, maxTrancheCount, outstandingLoanBalance); this.overdueDaysForNPA = overdueDaysForNPA; this.productInterestRecalculationDetails = productInterestRecalculationDetails; this.minimumDaysBetweenDisbursalAndFirstRepayment = minimumDaysBetweenDisbursalAndFirstRepayment; this.holdGuaranteeFunds = holdGuarantorFunds; this.loanProductGuaranteeDetails = loanProductGuaranteeDetails; this.principalThresholdForLastInstallment = principalThresholdForLastInstallment; this.accountMovesOutOfNPAOnlyOnArrearsCompletion = accountMovesOutOfNPAOnlyOnArrearsCompletion; this.canDefineInstallmentAmount = canDefineEmiAmount; this.installmentAmountInMultiplesOf = installmentAmountInMultiplesOf; this.syncExpectedWithDisbursementDate = syncExpectedWithDisbursementDate; this.canUseForTopup = canUseForTopup; }
From source file:com.gst.portfolio.meeting.domain.Meeting.java
License:Apache License
public Map<String, Object> update(final JsonCommand command, final boolean isSkipRepaymentOnFirstMonth, final int numberOfDays) { final Map<String, Object> actualChanges = new LinkedHashMap<>(9); final String dateFormatAsInput = command.dateFormat(); final String localeAsInput = command.locale(); if (command.isChangeInLocalDateParameterNamed(meetingDateParamName, getMeetingDateLocalDate())) { final String valueAsInput = command.stringValueOfParameterNamed(meetingDateParamName); final LocalDate newValue = command.localDateValueOfParameterNamed(meetingDateParamName); actualChanges.put(meetingDateParamName, valueAsInput); actualChanges.put("dateFormat", dateFormatAsInput); actualChanges.put("locale", localeAsInput); this.meetingDate = newValue.toDate(); if (!isValidMeetingDate(this.calendarInstance, this.meetingDate, isSkipRepaymentOnFirstMonth, numberOfDays)) {//from ww w . j a va 2 s . c o m throw new NotValidRecurringDateException("meeting", "Not a valid meeting date", this.meetingDate); } } return actualChanges; }
From source file:com.gst.portfolio.savings.domain.DepositAccountOnHoldTransaction.java
License:Apache License
private DepositAccountOnHoldTransaction(final SavingsAccount savingsAccount, final BigDecimal amount, final DepositAccountOnHoldTransactionType transactionType, final LocalDate transactionDate, final boolean reversed) { this.savingsAccount = savingsAccount; this.amount = amount; this.transactionType = transactionType.getValue(); this.transactionDate = transactionDate.toDate(); this.createdDate = new Date(); this.reversed = reversed; }
From source file:com.gst.portfolio.savings.domain.DepositAccountTermAndPreClosure.java
License:Apache License
private DepositAccountTermAndPreClosure(DepositPreClosureDetail preClosureDetail, DepositTermDetail depositTermDetail, SavingsAccount account, BigDecimal depositAmount, BigDecimal maturityAmount, final LocalDate maturityDate, Integer depositPeriod, final SavingsPeriodFrequencyType depositPeriodFrequency, final LocalDate expectedFirstDepositOnDate, final DepositAccountOnClosureType accountOnClosureType, Boolean transferInterest) { this.depositAmount = depositAmount; this.maturityAmount = maturityAmount; this.maturityDate = (maturityDate == null) ? null : maturityDate.toDate(); this.depositPeriod = depositPeriod; this.depositPeriodFrequency = (depositPeriodFrequency == null) ? null : depositPeriodFrequency.getValue(); this.preClosureDetail = preClosureDetail; this.depositTermDetail = depositTermDetail; this.account = account; this.expectedFirstDepositOnDate = expectedFirstDepositOnDate == null ? null : expectedFirstDepositOnDate.toDate(); this.onAccountClosureType = (accountOnClosureType == null) ? null : accountOnClosureType.getValue(); this.transferInterestToLinkedAccount = transferInterest; }
From source file:com.gst.portfolio.savings.domain.DepositAccountTermAndPreClosure.java
License:Apache License
public void updateMaturityDetails(final BigDecimal maturityAmount, final LocalDate maturityDate) { this.maturityAmount = maturityAmount; this.maturityDate = maturityDate.toDate(); }