saving, currun, fd and rd account working and tested

This commit is contained in:
keshav898966
2026-06-30 10:06:59 +05:30
parent db41c2b606
commit 1bd41cff43
9 changed files with 353 additions and 37 deletions
@@ -33,6 +33,7 @@ import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import jakarta.persistence.PostLoad;
import jakarta.persistence.Table;
import java.math.BigDecimal;
import java.time.LocalDate;
@@ -181,11 +182,27 @@ public class DepositAccountTermAndPreClosure extends AbstractPersistableCustom<L
return actualChanges;
}
@PostLoad
public void postLoad() {
if (this.preClosureDetail == null) {
this.preClosureDetail = new DepositPreClosureDetail();
}
if (this.depositTermDetail == null) {
this.depositTermDetail = new DepositTermDetail();
}
}
public DepositPreClosureDetail depositPreClosureDetail() {
if (this.preClosureDetail == null) {
this.preClosureDetail = new DepositPreClosureDetail();
}
return this.preClosureDetail;
}
public DepositTermDetail depositTermDetail() {
if (this.depositTermDetail == null) {
this.depositTermDetail = new DepositTermDetail();
}
return this.depositTermDetail;
}
@@ -1866,6 +1866,218 @@ public class SavingsAccount extends AbstractAuditableWithUTCDateTimeCustom<Long>
actualChanges.put(shareLinkingEnabledParamName, newValue);
this.shareLinkingEnabled = newValue;
}
// CBS extended fields mapping during modify application
final String accountTypeParam = "accountType";
if (command.isChangeInStringParameterNamed(accountTypeParam, this.cbsAccountType)) {
final String newValue = command.stringValueOfParameterNamed(accountTypeParam);
actualChanges.put(accountTypeParam, newValue);
this.cbsAccountType = newValue;
}
final String customerSegmentParam = "customerSegment";
if (command.isChangeInStringParameterNamed(customerSegmentParam, this.customerSegment)) {
final String newValue = command.stringValueOfParameterNamed(customerSegmentParam);
actualChanges.put(customerSegmentParam, newValue);
this.customerSegment = newValue;
}
final String accountStatusParam = "accountStatus";
if (command.isChangeInStringParameterNamed(accountStatusParam, this.accountStatus)) {
final String newValue = command.stringValueOfParameterNamed(accountStatusParam);
actualChanges.put(accountStatusParam, newValue);
this.accountStatus = newValue;
}
final String modeOfOperationParam = "modeOfOperation";
if (command.isChangeInStringParameterNamed(modeOfOperationParam, this.modeOfOperation)) {
final String newValue = command.stringValueOfParameterNamed(modeOfOperationParam);
actualChanges.put(modeOfOperationParam, newValue);
this.modeOfOperation = newValue;
}
final String specialCategoryParam = "specialCategory";
if (command.isChangeInStringParameterNamed(specialCategoryParam, this.specialCategory)) {
final String newValue = command.stringValueOfParameterNamed(specialCategoryParam);
actualChanges.put(specialCategoryParam, newValue);
this.specialCategory = newValue;
}
final String weakerSectionParam = "weakerSection";
if (command.isChangeInStringParameterNamed(weakerSectionParam, this.weakerSection)) {
final String newValue = command.stringValueOfParameterNamed(weakerSectionParam);
actualChanges.put(weakerSectionParam, newValue);
this.weakerSection = newValue;
}
final String nominationFacilityParam = "nominationFacility";
if (command.isChangeInBooleanParameterNamed(nominationFacilityParam, this.nominationFacility)) {
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(nominationFacilityParam);
actualChanges.put(nominationFacilityParam, newValue);
this.nominationFacility = newValue;
}
final String autoDebitFacilityParam = "autoDebitFacility";
if (command.isChangeInBooleanParameterNamed(autoDebitFacilityParam, this.autoDebitFacility)) {
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(autoDebitFacilityParam);
actualChanges.put(autoDebitFacilityParam, newValue);
this.autoDebitFacility = newValue;
}
final String isSeniorCitizenParam = "isSeniorCitizen";
if (command.isChangeInBooleanParameterNamed(isSeniorCitizenParam, this.isSeniorCitizen)) {
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(isSeniorCitizenParam);
actualChanges.put(isSeniorCitizenParam, newValue);
this.isSeniorCitizen = newValue;
}
final String seniorCitizenInterestRateParam = "seniorCitizenInterestRate";
if (command.isChangeInBigDecimalParameterNamed(seniorCitizenInterestRateParam, this.seniorCitizenInterestRate)) {
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(seniorCitizenInterestRateParam);
actualChanges.put(seniorCitizenInterestRateParam, newValue);
this.seniorCitizenInterestRate = newValue;
if (newValue != null && newValue.compareTo(BigDecimal.ZERO) > 0) {
updateNominalAnnualInterestRate(newValue);
}
}
final String guardianNameParam = "guardianName";
if (command.isChangeInStringParameterNamed(guardianNameParam, this.guardianName)) {
final String newValue = command.stringValueOfParameterNamed(guardianNameParam);
actualChanges.put(guardianNameParam, newValue);
this.guardianName = newValue;
}
final String guardianCifNumberParam = "guardianCifNumber";
if (command.isChangeInStringParameterNamed(guardianCifNumberParam, this.guardianCifNumber)) {
final String newValue = command.stringValueOfParameterNamed(guardianCifNumberParam);
actualChanges.put(guardianCifNumberParam, newValue);
this.guardianCifNumber = newValue;
}
final String guardianRelationshipParam = "guardianRelationship";
if (command.isChangeInStringParameterNamed(guardianRelationshipParam, this.guardianRelationship)) {
final String newValue = command.stringValueOfParameterNamed(guardianRelationshipParam);
actualChanges.put(guardianRelationshipParam, newValue);
this.guardianRelationship = newValue;
}
final String minorDateOfBirthParam = "minorDateOfBirth";
if (command.isChangeInLocalDateParameterNamed(minorDateOfBirthParam, this.minorDateOfBirth)) {
final LocalDate newValue = command.localDateValueOfParameterNamed(minorDateOfBirthParam);
actualChanges.put(minorDateOfBirthParam, newValue);
this.minorDateOfBirth = newValue;
}
final String guardianClientIdParam = "guardianClientId";
if (command.isChangeInLongParameterNamed(guardianClientIdParam, this.guardianClientId)) {
final Long newValue = command.longValueOfParameterNamed(guardianClientIdParam);
actualChanges.put(guardianClientIdParam, newValue);
this.guardianClientId = newValue;
}
final String introducerIdParam = "introducerId";
if (command.isChangeInLongParameterNamed(introducerIdParam, this.introducerClientId)) {
final Long newValue = command.longValueOfParameterNamed(introducerIdParam);
actualChanges.put(introducerIdParam, newValue);
this.introducerClientId = newValue;
}
final String introducerNameParam = "introducerName";
if (command.isChangeInStringParameterNamed(introducerNameParam, this.introducerName)) {
final String newValue = command.stringValueOfParameterNamed(introducerNameParam);
actualChanges.put(introducerNameParam, newValue);
this.introducerName = newValue;
}
final String introducerCifNumberParam = "introducerCifNumber";
if (command.isChangeInStringParameterNamed(introducerCifNumberParam, this.introducerCifNumber)) {
final String newValue = command.stringValueOfParameterNamed(introducerCifNumberParam);
actualChanges.put(introducerCifNumberParam, newValue);
this.introducerCifNumber = newValue;
}
final String linkedAccountIdParam = "linkedAccountId";
if (command.isChangeInLongParameterNamed(linkedAccountIdParam, this.linkedAccountId)) {
final Long newValue = command.longValueOfParameterNamed(linkedAccountIdParam);
actualChanges.put(linkedAccountIdParam, newValue);
this.linkedAccountId = newValue;
}
final String linkedAccountTypeParam = "linkedAccountType";
if (command.isChangeInStringParameterNamed(linkedAccountTypeParam, this.linkedAccountType)) {
final String newValue = command.stringValueOfParameterNamed(linkedAccountTypeParam);
actualChanges.put(linkedAccountTypeParam, newValue);
this.linkedAccountType = newValue;
}
final String linkedAccountNoParam = "linkedAccountNo";
if (command.isChangeInStringParameterNamed(linkedAccountNoParam, this.linkedAccountNo)) {
final String newValue = command.stringValueOfParameterNamed(linkedAccountNoParam);
actualChanges.put(linkedAccountNoParam, newValue);
this.linkedAccountNo = newValue;
}
final String accountFacilityConfigParam = "accountFacilityConfig";
if (command.hasParameter(accountFacilityConfigParam)) {
final com.google.gson.JsonElement parsedJson = command.parsedJson();
if (parsedJson != null && parsedJson.isJsonObject()) {
final com.google.gson.JsonObject jsonObj = parsedJson.getAsJsonObject();
if (jsonObj.has(accountFacilityConfigParam) && !jsonObj.get(accountFacilityConfigParam).isJsonNull()
&& jsonObj.get(accountFacilityConfigParam).isJsonObject()) {
final com.google.gson.JsonObject configObj = jsonObj.get(accountFacilityConfigParam).getAsJsonObject();
if (this.facilityConfig == null) {
this.facilityConfig = new SavingsAccountFacilityConfig(this);
}
this.facilityConfig.updateFrom(configObj);
actualChanges.put(accountFacilityConfigParam, configObj.toString());
}
}
}
final String jointHoldersParam = "jointHolders";
if (command.hasParameter(jointHoldersParam)) {
final com.google.gson.JsonElement parsedJson = command.parsedJson();
if (parsedJson != null && parsedJson.isJsonObject()) {
final com.google.gson.JsonObject jsonObj = parsedJson.getAsJsonObject();
if (jsonObj.has(jointHoldersParam) && !jsonObj.get(jointHoldersParam).isJsonNull()
&& jsonObj.get(jointHoldersParam).isJsonArray()) {
final com.google.gson.JsonArray holdersArray = jsonObj.get(jointHoldersParam).getAsJsonArray();
final List<SavingsAccountJointHolder> holders = new ArrayList<>();
for (int i = 0; i < holdersArray.size(); i++) {
final com.google.gson.JsonObject h = holdersArray.get(i).getAsJsonObject();
final Long clientId = h.has("clientId") && !h.get("clientId").isJsonNull()
? h.get("clientId").getAsLong() : null;
final String cifNumber = h.has("cifNumber") && !h.get("cifNumber").isJsonNull()
? h.get("cifNumber").getAsString() : null;
final String displayName = h.has("displayName") && !h.get("displayName").isJsonNull()
? h.get("displayName").getAsString() : null;
final BigDecimal sharePercentage = h.has("sharePercentage") && !h.get("sharePercentage").isJsonNull()
? h.get("sharePercentage").getAsBigDecimal() : null;
final boolean isPrimary = h.has("isPrimary") && h.get("isPrimary").getAsBoolean();
String signingAuthority = h.has("signingAuthority") && !h.get("signingAuthority").isJsonNull()
? h.get("signingAuthority").getAsString() : null;
String role = h.has("role") && !h.get("role").isJsonNull()
? h.get("role").getAsString() : null;
if (signingAuthority == null || signingAuthority.trim().isEmpty()) {
signingAuthority = isPrimary ? "Mandatory" : "Optional";
}
if (role == null || role.trim().isEmpty()) {
role = isPrimary ? "Primary Account Holder" : "Co-Holder";
}
final boolean isMandatory = h.has("isMandatory") && h.get("isMandatory").getAsBoolean();
holders.add(new SavingsAccountJointHolder(this, clientId, cifNumber, displayName,
sharePercentage, signingAuthority, role, isPrimary, isMandatory));
}
this.jointHolders.clear();
this.jointHolders.addAll(holders);
actualChanges.put(jointHoldersParam, holdersArray.toString());
}
}
}
validateLockinDetails(baseDataValidator);
esnureOverdraftLimitsSetForOverdraftAccounts();
}
@@ -815,16 +815,20 @@ public class SavingsAccountCharge extends AbstractAuditableWithUTCDateTimeCustom
return nextDueLocalDate;
}
public Integer getFeeInterval() {
return this.feeInterval == null ? 1 : this.feeInterval;
}
private LocalDate calculateNextDueDate(final LocalDate date) {
LocalDate nextDueLocalDate = null;
if (isAnnualFee()) {
nextDueLocalDate = date.withMonth(this.feeOnMonth).plusYears(1);
nextDueLocalDate = setDayOfMonth(nextDueLocalDate);
} else if (isMonthlyFee()) {
nextDueLocalDate = date.plusMonths(this.feeInterval);
nextDueLocalDate = date.plusMonths(getFeeInterval());
nextDueLocalDate = setDayOfMonth(nextDueLocalDate);
} else if (isWeeklyFee()) {
nextDueLocalDate = date.plusWeeks(this.feeInterval);
nextDueLocalDate = date.plusWeeks(getFeeInterval());
nextDueLocalDate = setDayOfWeek(nextDueLocalDate);
}
return nextDueLocalDate;
@@ -857,10 +861,10 @@ public class SavingsAccountCharge extends AbstractAuditableWithUTCDateTimeCustom
nextDueLocalDate = nextDueLocalDate.withMonth(this.feeOnMonth).minusYears(1);
nextDueLocalDate = setDayOfMonth(nextDueLocalDate);
} else if (isMonthlyFee()) {
nextDueLocalDate = nextDueLocalDate.minusMonths(this.feeInterval);
nextDueLocalDate = nextDueLocalDate.minusMonths(getFeeInterval());
nextDueLocalDate = setDayOfMonth(nextDueLocalDate);
} else if (isWeeklyFee()) {
nextDueLocalDate = nextDueLocalDate.minusDays(7 * this.feeInterval);
nextDueLocalDate = nextDueLocalDate.minusDays(7 * getFeeInterval());
nextDueLocalDate = setDayOfWeek(nextDueLocalDate);
}