remove warnings

This commit is contained in:
Keith Woodlock
2012-09-26 10:18:41 +01:00
parent c08a76dd94
commit 3617197f5f
2 changed files with 23 additions and 10 deletions
@@ -184,7 +184,7 @@ public class DepositAccountData {
this.interestPaid=account.getInterestPaid(); this.interestPaid=account.getInterestPaid();
this.isInterestWithdrawable=account.isInterestWithdrawable(); this.isInterestWithdrawable=account.isInterestWithdrawable();
this.interestCompoundingAllowed = account.isInterestCompoundingAllowed(); this.interestCompoundingAllowed = account.isInterestCompoundingAllowed();
this.availableInterestForWithdrawal=getAvailableInterestForWithdrawal(account);; this.availableInterestForWithdrawal=determineAvailableInterestForWithdrawal(account);;
} }
public DepositAccountData( public DepositAccountData(
@@ -444,15 +444,26 @@ public class DepositAccountData {
public BigDecimal getAvailableInterestForWithdrawal() { public BigDecimal getAvailableInterestForWithdrawal() {
return availableInterestForWithdrawal; return availableInterestForWithdrawal;
} }
public BigDecimal getAvailableInterestForWithdrawal(DepositAccountData account) {
if(account.getStatus().getId()==300){ private BigDecimal determineAvailableInterestForWithdrawal(final DepositAccountData account) {
BigDecimal interstGettingForPeriod = BigDecimal.valueOf(account.getActualInterestAccrued().doubleValue()/new Double(account.getTenureInMonths())); BigDecimal availableInterestForWithdrawal = BigDecimal.ZERO;
Integer noOfMonthsforInterestCal = Months.monthsBetween(account.getActualCommencementDate(), new LocalDate()).getMonths();
Integer noOfPeriods = noOfMonthsforInterestCal / account.getInterestCompoundedEvery(); if (account.getStatus().getId() == 300) {
return BigDecimal.valueOf(interstGettingForPeriod.multiply(new BigDecimal(noOfPeriods)).doubleValue()-account.getInterestPaid().doubleValue()); BigDecimal interestGettingForPeriod = BigDecimal.valueOf(account
} .getActualInterestAccrued().doubleValue()
else{ / new Double(account.getTenureInMonths()));
return new BigDecimal(0); Integer noOfMonthsforInterestCal = Months.monthsBetween(
account.getActualCommencementDate(), new LocalDate())
.getMonths();
Integer noOfPeriods = noOfMonthsforInterestCal
/ account.getInterestCompoundedEvery();
availableInterestForWithdrawal = BigDecimal
.valueOf(interestGettingForPeriod.multiply(
new BigDecimal(noOfPeriods)).doubleValue()
- account.getInterestPaid().doubleValue());
} }
return availableInterestForWithdrawal;
} }
} }
@@ -45,9 +45,11 @@ public class DepositAccountTransaction extends AbstractPersistable<Long> {
@Column(name = "amount", scale = 6, precision = 19, nullable = false) @Column(name = "amount", scale = 6, precision = 19, nullable = false)
private final BigDecimal amount; private final BigDecimal amount;
@SuppressWarnings("unused")
@Column(name = "interest", scale = 6, precision = 19, nullable = false) @Column(name = "interest", scale = 6, precision = 19, nullable = false)
private final BigDecimal interest; private final BigDecimal interest;
@SuppressWarnings("unused")
@Column(name = "total", scale = 6, precision = 19, nullable = false) @Column(name = "total", scale = 6, precision = 19, nullable = false)
private final BigDecimal total; private final BigDecimal total;