update code saving product add on client

This commit is contained in:
Nitesh Yadav
2026-04-21 17:30:57 +05:30
parent 98dd941712
commit 05c5adb034
9 changed files with 5189 additions and 2465 deletions
File diff suppressed because it is too large Load Diff
@@ -382,7 +382,9 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
// retrieve chart Slabs
final InterestRateChartData productChartData = this.productChartReadPlatformService.retrieveActiveChartWithTemplate(productId);
final DepositAccountInterestRateChartData accountChart = DepositAccountInterestRateChartData.from(productChartData);
final DepositAccountInterestRateChartData accountChart = (productChartData != null)
? DepositAccountInterestRateChartData.from(productChartData)
: null;
if (depositAccountType.isFixedDeposit()) {
@@ -25,6 +25,9 @@ import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.infrastructure.codes.service.CodeValueReadPlatformService;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
import org.apache.fineract.infrastructure.dataqueries.data.DatatableData;
@@ -43,6 +46,7 @@ import org.apache.fineract.portfolio.client.data.ClientData;
import org.apache.fineract.portfolio.client.service.ClientReadPlatformService;
import org.apache.fineract.portfolio.group.data.GroupGeneralData;
import org.apache.fineract.portfolio.group.service.GroupReadPlatformService;
import org.apache.fineract.portfolio.savings.SavingsApiConstants;
import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType;
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationDaysInYearType;
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationType;
@@ -62,6 +66,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.util.CollectionUtils;
@Slf4j
public class SavingsAccountTemplateReadPlatformServiceImpl implements SavingsAccountTemplateReadPlatformService {
private final PlatformSecurityContext context;
@@ -72,6 +77,7 @@ public class SavingsAccountTemplateReadPlatformServiceImpl implements SavingsAcc
private final StaffReadPlatformService staffReadPlatformService;
private final SavingsDropdownReadPlatformService dropdownReadPlatformService;
private final ChargeReadPlatformService chargeReadPlatformService;
private final CodeValueReadPlatformService codeValueReadPlatformService;
private final EntityDatatableChecksReadService entityDatatableChecksReadService;
@@ -80,7 +86,8 @@ public class SavingsAccountTemplateReadPlatformServiceImpl implements SavingsAcc
final SavingsProductReadPlatformService savingProductReadPlatformService,
final StaffReadPlatformService staffReadPlatformService, final SavingsDropdownReadPlatformService dropdownReadPlatformService,
final ChargeReadPlatformService chargeReadPlatformService,
final EntityDatatableChecksReadService entityDatatableChecksReadService, final ColumnValidator columnValidator) {
final EntityDatatableChecksReadService entityDatatableChecksReadService, final ColumnValidator columnValidator,
final CodeValueReadPlatformService codeValueReadPlatformService) {
this.context = context;
this.jdbcTemplate = jdbcTemplate;
this.clientReadPlatformService = clientReadPlatformService;
@@ -90,6 +97,7 @@ public class SavingsAccountTemplateReadPlatformServiceImpl implements SavingsAcc
this.dropdownReadPlatformService = dropdownReadPlatformService;
this.chargeReadPlatformService = chargeReadPlatformService;
this.entityDatatableChecksReadService = entityDatatableChecksReadService;
this.codeValueReadPlatformService = codeValueReadPlatformService;
}
@Override
@@ -178,18 +186,29 @@ public class SavingsAccountTemplateReadPlatformServiceImpl implements SavingsAcc
charges, chargeOptions);
// Enrich template with full CBS product data (classification, digital facilities, etc.)
final SavingsProductData fullProduct = this.savingsProductReadPlatformService.retrieveOne(productId);
if (fullProduct != null) {
try {
final SavingsProductData fullProduct = this.savingsProductReadPlatformService.retrieveOne(productId);
template.setAccountType(fullProduct.getAccountType());
template.setCustomerSegment(fullProduct.getCustomerSegment());
template.setProductCode(fullProduct.getProductCode());
template.setEffectiveDate(fullProduct.getEffectiveDate());
template.setEffectiveTo(fullProduct.getEffectiveTo());
template.setEndDate(fullProduct.getEndDate());
template.setIntroducerRequired(fullProduct.getIntroducerRequired());
template.setShareLinkingEnabled(fullProduct.getShareLinkingEnabled());
template.setNominationFacility(fullProduct.getNominationFacility());
template.setDormancyAlert(fullProduct.getDormancyAlert());
template.setInterestCalculationTypeName(fullProduct.getInterestCalculationTypeName());
template.setLastInterestDate(fullProduct.getLastInterestDate());
template.setEnableLockinPeriod(fullProduct.getEnableLockinPeriod());
template.setBalanceFrequency(fullProduct.getBalanceFrequency());
template.setAccountClosedZeroBalanceInDayClosing(fullProduct.getAccountClosedZeroBalanceInDayClosing());
template.setBalanceSwapOption(fullProduct.getBalanceSwapOption());
template.setMsme(fullProduct.getMsme());
template.setAutoDebitFacility(fullProduct.getAutoDebitFacility());
template.setAvgBalanceCalcPeriod(fullProduct.getAvgBalanceCalcPeriod());
template.setValidForPeriod(fullProduct.getValidForPeriod());
template.setOdAccountClosedZeroBalanceInDayClosing(fullProduct.getOdAccountClosedZeroBalanceInDayClosing());
template.setAccountFacilityConfig(fullProduct.getAccountFacilityConfig());
template.setAccountFacilityLimits(fullProduct.getAccountFacilityLimits());
template.setDepositLimitKyc(fullProduct.getDepositLimitKyc());
@@ -198,6 +217,24 @@ public class SavingsAccountTemplateReadPlatformServiceImpl implements SavingsAcc
template.setAveragePeriod(fullProduct.getAveragePeriod());
template.setAutoPost(fullProduct.getAutoPost());
template.setFrequencyFixDay(fullProduct.getFrequencyFixDay());
// CBS dropdown options (fetched from code values, same as product template page)
final Collection<EnumOptionData> interestCalculationTypeOption = this.codeValueReadPlatformService
.retrieveCodeValuesByCode(SavingsApiConstants.INTEREST_CALCULATION_TYPE_OPTION).stream()
.map(cv -> new EnumOptionData(cv.getId(),
"interestCalculationTypeOption." + cv.getName().toLowerCase(Locale.ROOT).replace(' ', '_'),
cv.getName()))
.toList();
template.setInterestCalculationTypeOption(interestCalculationTypeOption);
final Collection<EnumOptionData> periodFrequencyOptions = this.codeValueReadPlatformService
.retrieveCodeValuesByCode(SavingsApiConstants.PERIOD_FREQUENCY).stream()
.map(cv -> new EnumOptionData(cv.getId(),
"periodFrequencyType." + cv.getName().toLowerCase(Locale.ROOT).replace(' ', '_'),
cv.getName()))
.toList();
template.setPeriodFrequencyOptions(periodFrequencyOptions);
} catch (final Exception e) {
log.warn("Failed to enrich savings account template with CBS product data for productId={}: {}", productId, e.getMessage());
}
} else {
@@ -370,10 +370,10 @@ public class SavingsConfiguration {
GroupReadPlatformService groupReadPlatformService, SavingsProductReadPlatformService savingProductReadPlatformService,
StaffReadPlatformService staffReadPlatformService, SavingsDropdownReadPlatformService dropdownReadPlatformService,
ChargeReadPlatformService chargeReadPlatformService, EntityDatatableChecksReadService entityDatatableChecksReadService,
ColumnValidator columnValidator) {
ColumnValidator columnValidator, CodeValueReadPlatformService codeValueReadPlatformService) {
return new SavingsAccountTemplateReadPlatformServiceImpl(context, jdbcTemplate, clientReadPlatformService, groupReadPlatformService,
savingProductReadPlatformService, staffReadPlatformService, dropdownReadPlatformService, chargeReadPlatformService,
entityDatatableChecksReadService, columnValidator);
entityDatatableChecksReadService, columnValidator, codeValueReadPlatformService);
}
@Bean