add gl mapping in the saving product,current product,rd product and also add genrate account no all three

This commit is contained in:
Nitesh Yadav
2026-04-26 02:02:56 +05:30
parent efb0511725
commit 159633f59a
31 changed files with 34724 additions and 34388 deletions
@@ -44,7 +44,7 @@ public class SavingsApiSetConstants extends SavingsApiConstants {
daysToDormancyParamName, daysToInactiveParamName, accountMappingForPaymentParamName, "otherGlMappings", "otherGlMappingsMap", "accountTypeOptions",
"customerSegmentOptions", "yesNoOptions",
// Enhanced custom fields
"accountType", "customerSegment", "productCode", "effectiveDate", "effectiveTo", "endDate",
"accountType", "customerSegment", "productCode", "glAccountId", "glAccountName", "effectiveDate", "effectiveTo", "endDate",
"introducerRequired", "shareLinkingEnabled", "nominationFacility", "dormancyAlert",
"interestCalculateSelector", "averagePeriod", "autoPost", "frequencyFixDay", "lastInterestDate",
"enableLockinPeriod", "balanceFrequency", "accountClosedZeroBalanceInDayClosing",
@@ -82,7 +82,7 @@ public class SavingsApiSetConstants extends SavingsApiConstants {
"minBalanceForInterestCalculation", "minOverdraftForInterestCalculation",
"periodFrequencyOptions",
// CBS Product fields
"accountType", "customerSegment", "productCode", "effectiveTo", "endDate", "introducerRequired", "shareLinkingEnabled",
"accountType", "customerSegment", "productCode", "glAccountId", "glAccountName", "effectiveTo", "endDate", "introducerRequired", "shareLinkingEnabled",
"nominationFacility", "dormancyAlert", "enableLockinPeriod", "balanceFrequency",
"accountClosedZeroBalanceInDayClosing", "accountFacilityConfig", "accountFacilityLimits", "depositLimitKyc",
"interestCalculateSelector", "averagePeriod", "autoPost", "frequencyFixDay", "lastInterestDate",
@@ -38,6 +38,8 @@ public class DepositAccountData {
protected final Long id;
protected final String accountNo;
@lombok.Setter
protected String previewAccountNo;
protected final String externalId;
protected final Long groupId;
protected final String groupName;
@@ -65,6 +65,8 @@ public final class RecurringDepositProductData extends DepositProductData {
private String accountType;
private String customerSegment;
private String productCode;
private Long glAccountId;
private String glAccountName;
private java.time.LocalDate effectiveDate;
private java.time.LocalDate effectiveTo;
private java.time.LocalDate endDate;
@@ -105,6 +107,8 @@ public final class RecurringDepositProductData extends DepositProductData {
public void setAccountType(String v) { this.accountType = v; }
public void setCustomerSegment(String v) { this.customerSegment = v; }
public void setProductCode(String v) { this.productCode = v; }
public void setGlAccountId(Long v) { this.glAccountId = v; }
public void setGlAccountName(String v) { this.glAccountName = v; }
public void setEffectiveDate(java.time.LocalDate v) { this.effectiveDate = v; }
public void setEffectiveTo(java.time.LocalDate v) { this.effectiveTo = v; }
public void setEndDate(java.time.LocalDate v) { this.endDate = v; }
@@ -143,6 +147,8 @@ public final class RecurringDepositProductData extends DepositProductData {
this.accountType = src.accountType;
this.customerSegment = src.customerSegment;
this.productCode = src.productCode;
this.glAccountId = src.glAccountId;
this.glAccountName = src.glAccountName;
this.effectiveDate = src.effectiveDate;
this.effectiveTo = src.effectiveTo;
this.endDate = src.endDate;
@@ -186,6 +192,14 @@ public final class RecurringDepositProductData extends DepositProductData {
return productCode;
}
public Long getGlAccountId() {
return glAccountId;
}
public String getGlAccountName() {
return glAccountName;
}
public static RecurringDepositProductData template(final CurrencyData currency, final EnumOptionData interestCompoundingPeriodType,
final EnumOptionData interestPostingPeriodType, final EnumOptionData interestCalculationType,
final EnumOptionData interestCalculationDaysInYearType, final EnumOptionData accountingRule,
@@ -124,7 +124,8 @@ public class SavingsProductDataValidator {
SavingsApiConstants.accountFacilityConfigParamName, SavingsApiConstants.accountFacilityLimitsParamName,
SavingsApiConstants.depositLimitKycParamName,
// Additional custom fields
SavingsApiConstants.balanceFrequencyParamName, SavingsApiConstants.accountClosedZeroBalanceInDayClosingParamName));
SavingsApiConstants.balanceFrequencyParamName, SavingsApiConstants.accountClosedZeroBalanceInDayClosingParamName,
SavingsApiConstants.glAccountIdParamName));
public void validateForCreate(final String json) {
@@ -285,6 +285,9 @@ public class DepositProductAssembler {
recurringDepositProduct.setAccountType(command.stringValueOfParameterNamed("accountType"));
recurringDepositProduct.setCustomerSegment(command.stringValueOfParameterNamed("customerSegment"));
recurringDepositProduct.setProductCode(command.stringValueOfParameterNamed("productCode"));
if (command.parameterExists("glAccountId")) {
recurringDepositProduct.setGlAccountId(command.longValueOfParameterNamed("glAccountId"));
}
recurringDepositProduct.setEffectiveDate(parseCbsDate(command.stringValueOfParameterNamed("effectiveDate")));
recurringDepositProduct.setEffectiveTo(parseCbsDate(command.stringValueOfParameterNamed("effectiveTo")));
recurringDepositProduct.setEndDate(parseCbsDate(command.stringValueOfParameterNamed("endDate")));
@@ -22,6 +22,7 @@ import jakarta.persistence.LockModeType;
import java.time.LocalDate;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import org.apache.fineract.cob.data.COBIdAndLastClosedBusinessDate;
import org.apache.fineract.infrastructure.core.domain.ExternalId;
import org.apache.fineract.portfolio.savings.data.SavingsAccrualData;
@@ -147,4 +148,7 @@ public interface SavingsAccountRepository extends JpaRepository<SavingsAccount,
ORDER BY sa.lastClosedBusinessDate ASC
""")
List<COBIdAndLastClosedBusinessDate> findAllSavingsIdsOldestCobProcessed();
@Query("SELECT MAX(sa.id) FROM SavingsAccount sa")
Optional<Long> findMaxId();
}
@@ -56,6 +56,7 @@ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.withdraw
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.accountTypeParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.customerSegmentParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.productCodeParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.glAccountIdParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.effectiveDateParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.effectiveToParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.endDateParamName;
@@ -248,6 +249,9 @@ public class SavingsProduct extends AbstractPersistableCustom<Long> {
@Column(name = "product_code", length = 20, unique = true)
private String productCode;
@Column(name = "gl_account_id")
private Long glAccountId;
@Column(name = "effective_date")
private LocalDate effectiveDate;
@@ -796,6 +800,11 @@ public class SavingsProduct extends AbstractPersistableCustom<Long> {
actualChanges.put(productCodeParamName, newValue);
this.productCode = newValue;
}
if (command.isChangeInLongParameterNamed(glAccountIdParamName, this.glAccountId)) {
final Long newValue = command.longValueOfParameterNamed(glAccountIdParamName);
actualChanges.put(glAccountIdParamName, newValue);
this.glAccountId = newValue;
}
if (command.parameterExists(effectiveDateParamName)) {
final LocalDate newValue = parseCbsLocalDate(command.stringValueOfParameterNamed(effectiveDateParamName));
if (!Objects.equals(newValue, this.effectiveDate)) {
@@ -1134,6 +1143,14 @@ public class SavingsProduct extends AbstractPersistableCustom<Long> {
this.productCode = productCode;
}
public Long getGlAccountId() {
return glAccountId;
}
public void setGlAccountId(Long glAccountId) {
this.glAccountId = glAccountId;
}
public LocalDate getEffectiveDate() {
return effectiveDate;
}
@@ -36,6 +36,7 @@ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.introduc
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.lastInterestDateParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.nominationFacilityParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.productCodeParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.glAccountIdParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.shareLinkingEnabledParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.chargesParamName;
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.currencyCodeParamName;
@@ -232,6 +233,9 @@ public class SavingsProductAssembler {
if (command.parameterExists(productCodeParamName)) {
product.setProductCode(command.stringValueOfParameterNamed(productCodeParamName));
}
if (command.parameterExists(glAccountIdParamName)) {
product.setGlAccountId(command.longValueOfParameterNamed(glAccountIdParamName));
}
if (command.parameterExists(effectiveDateParamName)) {
product.setEffectiveDate(command.localDateValueOfParameterNamed(effectiveDateParamName));
}
@@ -31,4 +31,5 @@
<include file="parts/2006_add_period_frequency_options.xml" relativeToChangelogFile="true" />
<include file="parts/2007_add_interest_calculation_type_option.xml" relativeToChangelogFile="true" />
<include file="parts/2008_add_other_gl_mappings_to_savings_product.xml" relativeToChangelogFile="true" />
<include file="parts/2009_add_gl_account_id_to_savings_product.xml" relativeToChangelogFile="true" />
</databaseChangeLog>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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. This file is licensed under the Apache License, Version 2.0.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
<changeSet author="fineract" id="2009-add-gl-account-id-to-savings-product">
<addColumn tableName="m_savings_product">
<column name="gl_account_id" type="BIGINT">
<constraints nullable="true"
foreignKeyName="fk_savings_product_gl_account"
references="acc_gl_account(id)"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>