issues with latest sql patch name, removing few deprecated statement calls and other warnings

This commit is contained in:
Vishwas Babu A J
2014-11-04 16:03:21 +05:30
parent 630694c133
commit 80dfd752d7
8 changed files with 95 additions and 138 deletions
@@ -4599,7 +4599,7 @@ public class Loan extends AbstractPersistable<Long> {
**/ **/
public List<DisbursementData> getDisbursmentData() { public List<DisbursementData> getDisbursmentData() {
Iterator<LoanDisbursementDetails> iterator = this.getDisbursementDetails().iterator(); Iterator<LoanDisbursementDetails> iterator = this.getDisbursementDetails().iterator();
List<DisbursementData> disbursementData = new ArrayList<DisbursementData>(); List<DisbursementData> disbursementData = new ArrayList<>();
while (iterator.hasNext()) { while (iterator.hasNext()) {
LoanDisbursementDetails loanDisbursementDetails = iterator.next(); LoanDisbursementDetails loanDisbursementDetails = iterator.next();
@@ -24,7 +24,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
@Table(name = "m_loan_disbursement_detail") @Table(name = "m_loan_disbursement_detail")
public class LoanDisbursementDetails extends AbstractPersistable<Long> { public class LoanDisbursementDetails extends AbstractPersistable<Long> {
@SuppressWarnings("unused")
@ManyToOne @ManyToOne
@JoinColumn(name = "loan_id", nullable = false) @JoinColumn(name = "loan_id", nullable = false)
private Loan loan; private Loan loan;
@@ -35,7 +35,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
@Table(name = "m_loan_recalculation_details") @Table(name = "m_loan_recalculation_details")
public class LoanInterestRecalculationDetails extends AbstractPersistable<Long> { public class LoanInterestRecalculationDetails extends AbstractPersistable<Long> {
@SuppressWarnings("unused")
@OneToOne @OneToOne
@JoinColumn(name = "loan_id", nullable = false) @JoinColumn(name = "loan_id", nullable = false)
private Loan loan; private Loan loan;
@@ -26,68 +26,54 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
@Table(name = "m_loan_repayment_schedule_history") @Table(name = "m_loan_repayment_schedule_history")
public class LoanRepaymentScheduleHistory extends AbstractPersistable<Long> { public class LoanRepaymentScheduleHistory extends AbstractPersistable<Long> {
@SuppressWarnings("unused")
@ManyToOne(optional = false) @ManyToOne(optional = false)
@JoinColumn(name = "loan_id") @JoinColumn(name = "loan_id")
private Loan loan; private Loan loan;
@SuppressWarnings("unused")
@OneToOne(optional = true) @OneToOne(optional = true)
@JoinColumn(name = "loan_reschedule_request_id") @JoinColumn(name = "loan_reschedule_request_id")
private LoanRescheduleRequest loanRescheduleRequest; private LoanRescheduleRequest loanRescheduleRequest;
@SuppressWarnings("unused")
@Column(name = "installment", nullable = false) @Column(name = "installment", nullable = false)
private Integer installmentNumber; private Integer installmentNumber;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "fromdate", nullable = true) @Column(name = "fromdate", nullable = true)
private Date fromDate; private Date fromDate;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "duedate", nullable = false) @Column(name = "duedate", nullable = false)
private Date dueDate; private Date dueDate;
@SuppressWarnings("unused")
@Column(name = "principal_amount", scale = 6, precision = 19, nullable = true) @Column(name = "principal_amount", scale = 6, precision = 19, nullable = true)
private BigDecimal principal; private BigDecimal principal;
@SuppressWarnings("unused")
@Column(name = "interest_amount", scale = 6, precision = 19, nullable = true) @Column(name = "interest_amount", scale = 6, precision = 19, nullable = true)
private BigDecimal interestCharged; private BigDecimal interestCharged;
@SuppressWarnings("unused")
@Column(name = "fee_charges_amount", scale = 6, precision = 19, nullable = true) @Column(name = "fee_charges_amount", scale = 6, precision = 19, nullable = true)
private BigDecimal feeChargesCharged; private BigDecimal feeChargesCharged;
@SuppressWarnings("unused")
@Column(name = "penalty_charges_amount", scale = 6, precision = 19, nullable = true) @Column(name = "penalty_charges_amount", scale = 6, precision = 19, nullable = true)
private BigDecimal penaltyCharges; private BigDecimal penaltyCharges;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "created_date") @Column(name = "created_date")
private Date createdOnDate; private Date createdOnDate;
@SuppressWarnings("unused")
@ManyToOne @ManyToOne
@JoinColumn(name = "createdby_id") @JoinColumn(name = "createdby_id")
private AppUser createdByUser; private AppUser createdByUser;
@SuppressWarnings("unused")
@ManyToOne @ManyToOne
@JoinColumn(name = "lastmodifiedby_id") @JoinColumn(name = "lastmodifiedby_id")
private AppUser lastModifiedByUser; private AppUser lastModifiedByUser;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "lastmodified_date") @Column(name = "lastmodified_date")
private Date lastModifiedOnDate; private Date lastModifiedOnDate;
@Column(name = "version") @Column(name = "version")
@SuppressWarnings("unused")
private Integer version; private Integer version;
/** /**
@@ -250,7 +250,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
this.loanRescheduleRequestDataValidator.validateForApproveAction(jsonCommand, loanRescheduleRequest); this.loanRescheduleRequestDataValidator.validateForApproveAction(jsonCommand, loanRescheduleRequest);
final AppUser appUser = this.platformSecurityContext.authenticatedUser(); final AppUser appUser = this.platformSecurityContext.authenticatedUser();
final Map<String, Object> changes = new LinkedHashMap<String, Object>(); final Map<String, Object> changes = new LinkedHashMap<>();
LocalDate approvedOnDate = jsonCommand.localDateValueOfParameterNamed("approvedOnDate"); LocalDate approvedOnDate = jsonCommand.localDateValueOfParameterNamed("approvedOnDate");
final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(jsonCommand.dateFormat()).withLocale( final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(jsonCommand.dateFormat()).withLocale(
@@ -18,7 +18,6 @@ import org.mifosplatform.portfolio.loanaccount.data.LoanScheduleAccrualData;
import org.mifosplatform.portfolio.loanaccount.data.LoanTermVariationsData; import org.mifosplatform.portfolio.loanaccount.data.LoanTermVariationsData;
import org.mifosplatform.portfolio.loanaccount.data.LoanTransactionData; import org.mifosplatform.portfolio.loanaccount.data.LoanTransactionData;
import org.mifosplatform.portfolio.loanaccount.data.RepaymentScheduleRelatedLoanData; import org.mifosplatform.portfolio.loanaccount.data.RepaymentScheduleRelatedLoanData;
import org.mifosplatform.portfolio.loanaccount.domain.LoanTransactionType;
import org.mifosplatform.portfolio.loanaccount.loanschedule.data.LoanScheduleData; import org.mifosplatform.portfolio.loanaccount.loanschedule.data.LoanScheduleData;
import org.mifosplatform.portfolio.loanaccount.loanschedule.data.LoanSchedulePeriodData; import org.mifosplatform.portfolio.loanaccount.loanschedule.data.LoanSchedulePeriodData;
import org.mifosplatform.portfolio.loanaccount.loanschedule.data.OverdueLoanScheduleData; import org.mifosplatform.portfolio.loanaccount.loanschedule.data.OverdueLoanScheduleData;
@@ -55,7 +55,6 @@ import org.mifosplatform.portfolio.account.service.AccountTransfersReadPlatformS
import org.mifosplatform.portfolio.charge.domain.Charge; import org.mifosplatform.portfolio.charge.domain.Charge;
import org.mifosplatform.portfolio.charge.domain.ChargeRepositoryWrapper; import org.mifosplatform.portfolio.charge.domain.ChargeRepositoryWrapper;
import org.mifosplatform.portfolio.client.domain.Client; import org.mifosplatform.portfolio.client.domain.Client;
import org.mifosplatform.portfolio.client.exception.ClientHasNoStaffException;
import org.mifosplatform.portfolio.client.exception.ClientNotActiveException; import org.mifosplatform.portfolio.client.exception.ClientNotActiveException;
import org.mifosplatform.portfolio.group.domain.Group; import org.mifosplatform.portfolio.group.domain.Group;
import org.mifosplatform.portfolio.group.exception.GroupNotActiveException; import org.mifosplatform.portfolio.group.exception.GroupNotActiveException;
@@ -133,8 +132,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final HolidayWritePlatformService holidayWritePlatformService, final HolidayWritePlatformService holidayWritePlatformService,
final WorkingDaysWritePlatformService workingDaysWritePlatformService, final WorkingDaysWritePlatformService workingDaysWritePlatformService,
final SavingsAccountDataValidator fromApiJsonDeserializer, final SavingsAccountRepositoryWrapper savingsRepository, final SavingsAccountDataValidator fromApiJsonDeserializer, final SavingsAccountRepositoryWrapper savingsRepository,
final StaffRepositoryWrapper staffRepository, final StaffRepositoryWrapper staffRepository, final ConfigurationDomainService configurationDomainService) {
final ConfigurationDomainService configurationDomainService) {
this.context = context; this.context = context;
this.savingAccountRepository = savingAccountRepository; this.savingAccountRepository = savingAccountRepository;
this.savingsAccountTransactionRepository = savingsAccountTransactionRepository; this.savingsAccountTransactionRepository = savingsAccountTransactionRepository;
@@ -199,8 +197,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
.isSavingsInterestPostingAtCurrentPeriodEnd(); .isSavingsInterestPostingAtCurrentPeriodEnd();
final Integer financialYearBeginningMonth = this.configurationDomainService final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
.retrieveFinancialYearBeginningMonth();
Money amountForDeposit = account.activateWithBalance(); Money amountForDeposit = account.activateWithBalance();
boolean isRegularTransaction = false; boolean isRegularTransaction = false;
@@ -210,8 +207,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
null, isAccountTransfer, isRegularTransaction); null, isAccountTransfer, isRegularTransaction);
updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds);
} }
account.processAccountUponActivation(isSavingsInterestPostingAtCurrentPeriodEnd, account.processAccountUponActivation(isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth);
financialYearBeginningMonth);
account.validateAccountBalanceDoesNotBecomeNegative(SavingsAccountTransactionType.PAY_CHARGE.name()); account.validateAccountBalanceDoesNotBecomeNegative(SavingsAccountTransactionType.PAY_CHARGE.name());
} }
@@ -318,8 +314,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
.isSavingsInterestPostingAtCurrentPeriodEnd(); .isSavingsInterestPostingAtCurrentPeriodEnd();
final Integer financialYearBeginningMonth = this.configurationDomainService final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
.retrieveFinancialYearBeginningMonth();
final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId); final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId);
checkClientOrGroupActive(account); checkClientOrGroupActive(account);
@@ -327,8 +322,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final LocalDate today = DateUtils.getLocalDateOfTenant(); final LocalDate today = DateUtils.getLocalDateOfTenant();
final MathContext mc = new MathContext(15, RoundingMode.HALF_EVEN); final MathContext mc = new MathContext(15, RoundingMode.HALF_EVEN);
boolean isInterestTransfer = false; boolean isInterestTransfer = false;
account.calculateInterestUsing(mc, today, isInterestTransfer, account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd,
isSavingsInterestPostingAtCurrentPeriodEnd,
financialYearBeginningMonth); financialYearBeginningMonth);
this.savingAccountRepository.save(account); this.savingAccountRepository.save(account);
@@ -363,8 +357,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
.isSavingsInterestPostingAtCurrentPeriodEnd(); .isSavingsInterestPostingAtCurrentPeriodEnd();
final Integer financialYearBeginningMonth = this.configurationDomainService final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
.retrieveFinancialYearBeginningMonth();
if (account.getNominalAnnualInterestRate().compareTo(BigDecimal.ZERO) == 1) { if (account.getNominalAnnualInterestRate().compareTo(BigDecimal.ZERO) == 1) {
final Set<Long> existingTransactionIds = new HashSet<>(); final Set<Long> existingTransactionIds = new HashSet<>();
@@ -373,8 +366,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final LocalDate today = DateUtils.getLocalDateOfTenant(); final LocalDate today = DateUtils.getLocalDateOfTenant();
final MathContext mc = new MathContext(10, RoundingMode.HALF_EVEN); final MathContext mc = new MathContext(10, RoundingMode.HALF_EVEN);
boolean isInterestTransfer = false; boolean isInterestTransfer = false;
account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth);
financialYearBeginningMonth);
// for generating transaction id's // for generating transaction id's
List<SavingsAccountTransaction> transactions = account.getTransactions(); List<SavingsAccountTransaction> transactions = account.getTransactions();
@@ -407,8 +399,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
.isSavingsInterestPostingAtCurrentPeriodEnd(); .isSavingsInterestPostingAtCurrentPeriodEnd();
final Integer financialYearBeginningMonth = this.configurationDomainService final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
.retrieveFinancialYearBeginningMonth();
final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId); final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId);
final Set<Long> existingTransactionIds = new HashSet<>(); final Set<Long> existingTransactionIds = new HashSet<>();
@@ -449,11 +440,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
checkClientOrGroupActive(account); checkClientOrGroupActive(account);
if (savingsAccountTransaction.isPostInterestCalculationRequired() if (savingsAccountTransaction.isPostInterestCalculationRequired()
&& account.isBeforeLastPostingPeriod(savingsAccountTransaction.transactionLocalDate())) { && account.isBeforeLastPostingPeriod(savingsAccountTransaction.transactionLocalDate())) {
account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth);
financialYearBeginningMonth);
} else { } else {
account.calculateInterestUsing(mc, today, isInterestTransfer, account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd,
isSavingsInterestPostingAtCurrentPeriodEnd,
financialYearBeginningMonth); financialYearBeginningMonth);
} }
account.validateAccountBalanceDoesNotBecomeNegative(SavingsApiConstants.undoTransactionAction); account.validateAccountBalanceDoesNotBecomeNegative(SavingsApiConstants.undoTransactionAction);
@@ -474,8 +463,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
.isSavingsInterestPostingAtCurrentPeriodEnd(); .isSavingsInterestPostingAtCurrentPeriodEnd();
final Integer financialYearBeginningMonth = this.configurationDomainService final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
.retrieveFinancialYearBeginningMonth();
final SavingsAccountTransaction savingsAccountTransaction = this.savingsAccountTransactionRepository final SavingsAccountTransaction savingsAccountTransaction = this.savingsAccountTransactionRepository
.findOneByIdAndSavingsAccountId(transactionId, savingsId); .findOneByIdAndSavingsAccountId(transactionId, savingsId);
@@ -533,11 +521,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
if (account.isBeforeLastPostingPeriod(transactionDate) if (account.isBeforeLastPostingPeriod(transactionDate)
|| account.isBeforeLastPostingPeriod(savingsAccountTransaction.transactionLocalDate())) { || account.isBeforeLastPostingPeriod(savingsAccountTransaction.transactionLocalDate())) {
account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth);
financialYearBeginningMonth);
} else { } else {
account.calculateInterestUsing(mc, today, isInterestTransfer, account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd,
isSavingsInterestPostingAtCurrentPeriodEnd,
financialYearBeginningMonth); financialYearBeginningMonth);
} }
account.validateAccountBalanceDoesNotBecomeNegative(SavingsApiConstants.adjustTransactionAction); account.validateAccountBalanceDoesNotBecomeNegative(SavingsApiConstants.adjustTransactionAction);
@@ -641,8 +627,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
.isSavingsInterestPostingAtCurrentPeriodEnd(); .isSavingsInterestPostingAtCurrentPeriodEnd();
final Integer financialYearBeginningMonth = this.configurationDomainService final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
.retrieveFinancialYearBeginningMonth();
final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId); final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId);
@@ -656,8 +641,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
savingsAccount.setStatus(SavingsAccountStatusType.TRANSFER_IN_PROGRESS.getValue()); savingsAccount.setStatus(SavingsAccountStatusType.TRANSFER_IN_PROGRESS.getValue());
final MathContext mc = MathContext.DECIMAL64; final MathContext mc = MathContext.DECIMAL64;
boolean isInterestTransfer = false; boolean isInterestTransfer = false;
savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd,
isSavingsInterestPostingAtCurrentPeriodEnd,
financialYearBeginningMonth); financialYearBeginningMonth);
this.savingsAccountTransactionRepository.save(newTransferTransaction); this.savingsAccountTransactionRepository.save(newTransferTransaction);
@@ -673,8 +657,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
.isSavingsInterestPostingAtCurrentPeriodEnd(); .isSavingsInterestPostingAtCurrentPeriodEnd();
final Integer financialYearBeginningMonth = this.configurationDomainService final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
.retrieveFinancialYearBeginningMonth();
final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId); final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId);
@@ -688,8 +671,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
savingsAccount.setStatus(SavingsAccountStatusType.ACTIVE.getValue()); savingsAccount.setStatus(SavingsAccountStatusType.ACTIVE.getValue());
final MathContext mc = MathContext.DECIMAL64; final MathContext mc = MathContext.DECIMAL64;
boolean isInterestTransfer = false; boolean isInterestTransfer = false;
savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd,
isSavingsInterestPostingAtCurrentPeriodEnd,
financialYearBeginningMonth); financialYearBeginningMonth);
this.savingsAccountTransactionRepository.save(withdrawtransferTransaction); this.savingsAccountTransactionRepository.save(withdrawtransferTransaction);
@@ -713,8 +695,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
.isSavingsInterestPostingAtCurrentPeriodEnd(); .isSavingsInterestPostingAtCurrentPeriodEnd();
final Integer financialYearBeginningMonth = this.configurationDomainService final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
.retrieveFinancialYearBeginningMonth();
final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId); final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId);
@@ -731,8 +712,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
} }
boolean isInterestTransfer = false; boolean isInterestTransfer = false;
final MathContext mc = MathContext.DECIMAL64; final MathContext mc = MathContext.DECIMAL64;
savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, savingsAccount.calculateInterestUsing(mc, transferDate, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd,
isSavingsInterestPostingAtCurrentPeriodEnd,
financialYearBeginningMonth); financialYearBeginningMonth);
this.savingsAccountTransactionRepository.save(acceptTransferTransaction); this.savingsAccountTransactionRepository.save(acceptTransferTransaction);
@@ -860,8 +840,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
.isSavingsInterestPostingAtCurrentPeriodEnd(); .isSavingsInterestPostingAtCurrentPeriodEnd();
final Integer financialYearBeginningMonth = this.configurationDomainService final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
.retrieveFinancialYearBeginningMonth();
final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection( final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection(
savingsAccountChargeId, savingsAccountId); savingsAccountChargeId, savingsAccountId);
@@ -879,12 +858,10 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final MathContext mc = MathContext.DECIMAL64; final MathContext mc = MathContext.DECIMAL64;
if (account.isBeforeLastPostingPeriod(savingsAccountCharge.getDueLocalDate())) { if (account.isBeforeLastPostingPeriod(savingsAccountCharge.getDueLocalDate())) {
final LocalDate today = DateUtils.getLocalDateOfTenant(); final LocalDate today = DateUtils.getLocalDateOfTenant();
account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth);
financialYearBeginningMonth);
} else { } else {
final LocalDate today = DateUtils.getLocalDateOfTenant(); final LocalDate today = DateUtils.getLocalDateOfTenant();
account.calculateInterestUsing(mc, today, isInterestTransfer, account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd,
isSavingsInterestPostingAtCurrentPeriodEnd,
financialYearBeginningMonth); financialYearBeginningMonth);
} }
@@ -990,8 +967,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
.isSavingsInterestPostingAtCurrentPeriodEnd(); .isSavingsInterestPostingAtCurrentPeriodEnd();
final Integer financialYearBeginningMonth = this.configurationDomainService final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
.retrieveFinancialYearBeginningMonth();
// Get Savings account from savings charge // Get Savings account from savings charge
final SavingsAccount account = savingsAccountCharge.savingsAccount(); final SavingsAccount account = savingsAccountCharge.savingsAccount();
@@ -1004,12 +980,10 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final MathContext mc = MathContext.DECIMAL64; final MathContext mc = MathContext.DECIMAL64;
if (account.isBeforeLastPostingPeriod(transactionDate)) { if (account.isBeforeLastPostingPeriod(transactionDate)) {
final LocalDate today = DateUtils.getLocalDateOfTenant(); final LocalDate today = DateUtils.getLocalDateOfTenant();
account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth);
financialYearBeginningMonth);
} else { } else {
final LocalDate today = DateUtils.getLocalDateOfTenant(); final LocalDate today = DateUtils.getLocalDateOfTenant();
account.calculateInterestUsing(mc, today, isInterestTransfer, account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd,
isSavingsInterestPostingAtCurrentPeriodEnd,
financialYearBeginningMonth); financialYearBeginningMonth);
} }
@@ -1120,22 +1094,22 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final Long toSavingsOfficerId = command.longValueOfParameterNamed("toSavingsOfficerId"); final Long toSavingsOfficerId = command.longValueOfParameterNamed("toSavingsOfficerId");
final LocalDate dateOfSavingsOfficerAssignment = command.localDateValueOfParameterNamed("assignmentDate"); final LocalDate dateOfSavingsOfficerAssignment = command.localDateValueOfParameterNamed("assignmentDate");
if(fromSavingsOfficerId != null) if (fromSavingsOfficerId != null) {
{ fromSavingsOfficer = this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(fromSavingsOfficerId, savingsForUpdate
fromSavingsOfficer = this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(fromSavingsOfficerId, savingsForUpdate.office().getHierarchy()); .office().getHierarchy());
} }
if(toSavingsOfficerId != null) if (toSavingsOfficerId != null) {
{ toSavingsOfficer = this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(toSavingsOfficerId, savingsForUpdate
toSavingsOfficer = this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(toSavingsOfficerId, savingsForUpdate.office().getHierarchy()); .office().getHierarchy());
actualChanges.put("toSavingsOfficerId", toSavingsOfficer.getId());
} }
if (!savingsForUpdate.hasSavingsOfficer(fromSavingsOfficer)) { throw new SavingsOfficerAssignmentException(savingsAccountId, fromSavingsOfficerId); } if (!savingsForUpdate.hasSavingsOfficer(fromSavingsOfficer)) { throw new SavingsOfficerAssignmentException(savingsAccountId,
fromSavingsOfficerId); }
savingsForUpdate.reassignSavingsOfficer(toSavingsOfficer,dateOfSavingsOfficerAssignment); savingsForUpdate.reassignSavingsOfficer(toSavingsOfficer, dateOfSavingsOfficerAssignment);
this.savingsRepository.saveAndFlush(savingsForUpdate); this.savingsRepository.saveAndFlush(savingsForUpdate);
actualChanges.put("toSavingsOfficerId", toSavingsOfficer.getId());
return new CommandProcessingResultBuilder() // return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) // .withCommandId(command.commandId()) //
.withOfficeId(savingsForUpdate.officeId()) // .withOfficeId(savingsForUpdate.officeId()) //