MIFOSX-998,MIFOSX-1008 Interest posting issue

This commit is contained in:
Madhukar
2014-03-29 12:21:04 +05:30
parent dccbec3701
commit 646956ac99
3 changed files with 26 additions and 15 deletions
@@ -159,6 +159,11 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
rollbackTransaction = this.commandProcessingService.validateCommand(commandWrapper, currentUser);
}
}
if (!newGroup.isCenter() && newGroup.hasActiveClients()) {
final CommandWrapper commandWrapper = new CommandWrapperBuilder().associateClientsToGroup(newGroup.getId()).build();
rollbackTransaction = this.commandProcessingService.validateCommand(commandWrapper, currentUser);
}
// pre-save to generate id for use in group hierarchy
this.groupRepository.save(newGroup);
@@ -1164,6 +1164,10 @@ public class SavingsAccount extends AbstractPersistable<Long> {
return this.client;
}
public BigDecimal getNominalAnnualInterestRate() {
return this.nominalAnnualInterestRate;
}
public Map<String, Object> approveApplication(final AppUser currentUser, final JsonCommand command, final LocalDate tenantsTodayDate) {
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>();
@@ -309,25 +309,27 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
@Transactional
private void postInterest(final SavingsAccount account) {
final Set<Long> existingTransactionIds = new HashSet<Long>();
final Set<Long> existingReversedTransactionIds = new HashSet<Long>();
updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds);
final LocalDate today = DateUtils.getLocalDateOfTenant();
final MathContext mc = new MathContext(10, RoundingMode.HALF_EVEN);
if (account.getNominalAnnualInterestRate().compareTo(BigDecimal.ZERO) == 1) {
final Set<Long> existingTransactionIds = new HashSet<Long>();
final Set<Long> existingReversedTransactionIds = new HashSet<Long>();
updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds);
final LocalDate today = DateUtils.getLocalDateOfTenant();
final MathContext mc = new MathContext(10, RoundingMode.HALF_EVEN);
account.postInterest(mc, today);
account.postInterest(mc, today);
// for generating transaction id's
List<SavingsAccountTransaction> transactions = account.getTransactions();
for (SavingsAccountTransaction accountTransaction : transactions) {
if (accountTransaction.getId() == null) {
this.savingsAccountTransactionRepository.save(accountTransaction);
// for generating transaction id's
List<SavingsAccountTransaction> transactions = account.getTransactions();
for (SavingsAccountTransaction accountTransaction : transactions) {
if (accountTransaction.getId() == null) {
this.savingsAccountTransactionRepository.save(accountTransaction);
}
}
this.savingAccountRepository.save(account);
postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds);
}
this.savingAccountRepository.save(account);
postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds);
}
@CronTarget(jobName = JobName.POST_INTEREST_FOR_SAVINGS)