fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From avikganguly01 <...@git.apache.org>
Subject [GitHub] fineract pull request #118: 293_post_interest_job
Date Tue, 10 Oct 2017 18:06:18 GMT
Github user avikganguly01 commented on a diff in the pull request:

    https://github.com/apache/fineract/pull/118#discussion_r143808080
  
    --- Diff: fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularServiceImpl.java
---
    @@ -37,42 +40,66 @@
     
         private final SavingsAccountAssembler savingAccountAssembler;
         private final SavingsAccountWritePlatformService savingsAccountWritePlatformService;
    -    private final SavingsAccountRepository savingAccountRepository;
         private final SavingsAccountReadPlatformService savingAccountReadPlatformService;
     
         @Autowired
         public SavingsSchedularServiceImpl(final SavingsAccountAssembler savingAccountAssembler,
                 final SavingsAccountWritePlatformService savingsAccountWritePlatformService,
    -            final SavingsAccountRepository savingAccountRepository,
                 final SavingsAccountReadPlatformService savingAccountReadPlatformService)
{
             this.savingAccountAssembler = savingAccountAssembler;
             this.savingsAccountWritePlatformService = savingsAccountWritePlatformService;
    -        this.savingAccountRepository = savingAccountRepository;
             this.savingAccountReadPlatformService = savingAccountReadPlatformService;
         }
     
    -    @CronTarget(jobName = JobName.POST_INTEREST_FOR_SAVINGS)
    -    @Override
    -    public void postInterestForAccounts() throws JobExecutionException {
    -        final List<SavingsAccount> savingsAccounts = this.savingAccountRepository.findSavingAccountByStatus(SavingsAccountStatusType.ACTIVE
    -                .getValue());
    -        StringBuffer sb = new StringBuffer();
    -        for (final SavingsAccount savingsAccount : savingsAccounts) {
    -            try {
    -                this.savingAccountAssembler.assignSavingAccountHelpers(savingsAccount);
    -                this.savingsAccountWritePlatformService.postInterest(savingsAccount);
    -            } catch (Exception e) {
    -                Throwable realCause = e;
    -                if (e.getCause() != null) {
    -                    realCause = e.getCause();
    -                }
    -                sb.append("failed to post interest for Savings with id " + savingsAccount.getId()
+ " with message "
    -                        + realCause.getMessage());
    -            }
    -        }
    -        
    -        if (sb.length() > 0) { throw new JobExecutionException(sb.toString()); }
    -    }
    +	@Transactional
    +	@CronTarget(jobName = JobName.POST_INTEREST_FOR_SAVINGS)
    +	@Override
    +	public void postInterestForAccounts() throws JobExecutionException {
    +		final int maxPazeSize = 100;
    +		boolean hasErrorOccurred = false;
    +		int offSet = 1;
    +		Integer initialSize = 100;
    +		final Integer status = SavingsAccountStatusType.ACTIVE.getValue();
    +		
    +		
    +		do {
    +			Page<SavingsAccountData> savingsAccounts = this.savingAccountReadPlatformService.retrieveSavingsAccount(maxPazeSize,
offSet,
    --- End diff --
    
    @nazeer1100126 : The reads are page-wise only. I did not understand your concern.


---

Mime
View raw message