Fixes for dep upgrades
This commit is contained in:
committed by
Arnold Gálovics
parent
7e61256a7b
commit
232a954093
@@ -26,6 +26,6 @@ jobs:
|
|||||||
- name: Wait for stack to come up
|
- name: Wait for stack to come up
|
||||||
run: sleep 120
|
run: sleep 120
|
||||||
- name: Check health
|
- name: Check health
|
||||||
run: curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/health
|
run: curl -f -k --retry 10 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/health
|
||||||
- name: Check info
|
- name: Check info
|
||||||
run: (( $(curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 ))
|
run: (( $(curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 ))
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ jobs:
|
|||||||
- name: Wait for stack to come up
|
- name: Wait for stack to come up
|
||||||
run: sleep 120
|
run: sleep 120
|
||||||
- name: Check health
|
- name: Check health
|
||||||
run: curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/health
|
run: curl -f -k --retry 10 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/health
|
||||||
- name: Check info
|
- name: Check info
|
||||||
run: (( $(curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 ))
|
run: (( $(curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 ))
|
||||||
|
|||||||
+5
@@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.core.service.tenant;
|
package org.apache.fineract.infrastructure.core.service.tenant;
|
||||||
|
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
@@ -46,6 +48,9 @@ public class JdbcTenantDetailsService implements TenantDetailsService {
|
|||||||
@Override
|
@Override
|
||||||
@Cacheable(value = "tenantsById")
|
@Cacheable(value = "tenantsById")
|
||||||
public FineractPlatformTenant loadTenantById(final String tenantIdentifier) {
|
public FineractPlatformTenant loadTenantById(final String tenantIdentifier) {
|
||||||
|
if (isBlank(tenantIdentifier)) {
|
||||||
|
throw new IllegalArgumentException("tenantIdentifier cannot be blank");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
final TenantMapper rm = new TenantMapper(false);
|
final TenantMapper rm = new TenantMapper(false);
|
||||||
final String sql = "select " + rm.schema() + " where t.identifier = ?";
|
final String sql = "select " + rm.schema() + " where t.identifier = ?";
|
||||||
|
|||||||
+4
-28
@@ -18,34 +18,25 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.jobs.service;
|
package org.apache.fineract.infrastructure.jobs.service;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
|
||||||
import org.apache.fineract.infrastructure.businessdate.service.BusinessDateReadPlatformService;
|
|
||||||
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
import org.apache.fineract.infrastructure.core.service.tenant.TenantDetailsService;
|
import org.apache.fineract.infrastructure.core.service.tenant.TenantDetailsService;
|
||||||
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionContext;
|
||||||
import org.quartz.JobKey;
|
|
||||||
import org.quartz.Trigger;
|
import org.quartz.Trigger;
|
||||||
import org.quartz.Trigger.CompletedExecutionInstruction;
|
import org.quartz.Trigger.CompletedExecutionInstruction;
|
||||||
import org.quartz.TriggerListener;
|
import org.quartz.TriggerListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Isolation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Component
|
@Component
|
||||||
public class SchedulerTriggerListener implements TriggerListener {
|
public class SchedulerTriggerListener implements TriggerListener {
|
||||||
|
|
||||||
private final SchedularWritePlatformService schedularService;
|
|
||||||
private final TenantDetailsService tenantDetailsService;
|
private final TenantDetailsService tenantDetailsService;
|
||||||
|
private final SchedulerVetoer schedulerVetoer;
|
||||||
private final BusinessDateReadPlatformService businessDateReadPlatformService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@@ -58,27 +49,12 @@ public class SchedulerTriggerListener implements TriggerListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
|
||||||
public boolean vetoJobExecution(final Trigger trigger, final JobExecutionContext context) {
|
public boolean vetoJobExecution(final Trigger trigger, final JobExecutionContext context) {
|
||||||
final String tenantIdentifier = trigger.getJobDataMap().getString(SchedulerServiceConstants.TENANT_IDENTIFIER);
|
String tenantIdentifier = trigger.getJobDataMap().getString(SchedulerServiceConstants.TENANT_IDENTIFIER);
|
||||||
final FineractPlatformTenant tenant = this.tenantDetailsService.loadTenantById(tenantIdentifier);
|
FineractPlatformTenant tenant = tenantDetailsService.loadTenantById(tenantIdentifier);
|
||||||
ThreadLocalContextUtil.setTenant(tenant);
|
ThreadLocalContextUtil.setTenant(tenant);
|
||||||
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
HashMap<BusinessDateType, LocalDate> businessDates = businessDateReadPlatformService.getBusinessDates();
|
return schedulerVetoer.veto(trigger, context);
|
||||||
ThreadLocalContextUtil.setBusinessDates(businessDates);
|
|
||||||
final JobKey key = trigger.getJobKey();
|
|
||||||
final String jobKey = key.getName() + SchedulerServiceConstants.JOB_KEY_SEPERATOR + key.getGroup();
|
|
||||||
String triggerType = SchedulerServiceConstants.TRIGGER_TYPE_CRON;
|
|
||||||
if (context.getMergedJobDataMap().containsKey(SchedulerServiceConstants.TRIGGER_TYPE_REFERENCE)) {
|
|
||||||
triggerType = context.getMergedJobDataMap().getString(SchedulerServiceConstants.TRIGGER_TYPE_REFERENCE);
|
|
||||||
}
|
|
||||||
boolean vetoJob = this.schedularService.processJobDetailForExecution(jobKey, triggerType);
|
|
||||||
if (vetoJob) {
|
|
||||||
log.warn(
|
|
||||||
"vetoJobExecution() WILL veto the execution (returning vetoJob == true; the job's execute method will NOT be called); tenant={}, jobKey={}, triggerType={}, trigger={}, context={}",
|
|
||||||
tenantIdentifier, jobKey, triggerType, trigger, context);
|
|
||||||
}
|
|
||||||
return vetoJob;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+62
@@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.fineract.infrastructure.jobs.service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
|
import org.apache.fineract.infrastructure.businessdate.service.BusinessDateReadPlatformService;
|
||||||
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobKey;
|
||||||
|
import org.quartz.Trigger;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SchedulerVetoer {
|
||||||
|
|
||||||
|
private final SchedularWritePlatformService schedularService;
|
||||||
|
private final BusinessDateReadPlatformService businessDateReadPlatformService;
|
||||||
|
|
||||||
|
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||||
|
public boolean veto(Trigger trigger, JobExecutionContext context) {
|
||||||
|
String tenantIdentifier = trigger.getJobDataMap().getString(SchedulerServiceConstants.TENANT_IDENTIFIER);
|
||||||
|
HashMap<BusinessDateType, LocalDate> businessDates = businessDateReadPlatformService.getBusinessDates();
|
||||||
|
ThreadLocalContextUtil.setBusinessDates(businessDates);
|
||||||
|
JobKey key = trigger.getJobKey();
|
||||||
|
String jobKey = key.getName() + SchedulerServiceConstants.JOB_KEY_SEPERATOR + key.getGroup();
|
||||||
|
String triggerType = SchedulerServiceConstants.TRIGGER_TYPE_CRON;
|
||||||
|
if (context.getMergedJobDataMap().containsKey(SchedulerServiceConstants.TRIGGER_TYPE_REFERENCE)) {
|
||||||
|
triggerType = context.getMergedJobDataMap().getString(SchedulerServiceConstants.TRIGGER_TYPE_REFERENCE);
|
||||||
|
}
|
||||||
|
boolean vetoJob = schedularService.processJobDetailForExecution(jobKey, triggerType);
|
||||||
|
if (vetoJob) {
|
||||||
|
log.warn(
|
||||||
|
"vetoJobExecution() WILL veto the execution (returning vetoJob == true; the job's execute method will NOT be called); tenant={}, jobKey={}, triggerType={}, trigger={}, context={}",
|
||||||
|
tenantIdentifier, jobKey, triggerType, trigger, context);
|
||||||
|
}
|
||||||
|
return vetoJob;
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -24,7 +24,7 @@ import org.apache.fineract.portfolio.savings.domain.SavingsAccountAssembler;
|
|||||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountRepositoryWrapper;
|
import org.apache.fineract.portfolio.savings.domain.SavingsAccountRepositoryWrapper;
|
||||||
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
|
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
|
||||||
import org.apache.fineract.portfolio.savings.service.SavingsAccountWritePlatformService;
|
import org.apache.fineract.portfolio.savings.service.SavingsAccountWritePlatformService;
|
||||||
import org.apache.fineract.portfolio.savings.service.SavingsSchedularInterestPoster;
|
import org.apache.fineract.portfolio.savings.service.SavingsSchedularInterestPosterTask;
|
||||||
import org.springframework.batch.core.Job;
|
import org.springframework.batch.core.Job;
|
||||||
import org.springframework.batch.core.Step;
|
import org.springframework.batch.core.Step;
|
||||||
import org.springframework.batch.core.job.builder.JobBuilder;
|
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||||
@@ -50,7 +50,7 @@ public class PostInterestForSavingConfig {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ConfigurationDomainService configurationDomainService;
|
private ConfigurationDomainService configurationDomainService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SavingsSchedularInterestPoster savingsSchedularInterestPoster;
|
private SavingsSchedularInterestPosterTask savingsSchedularInterestPosterTask;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SavingsAccountWritePlatformService savingsAccountWritePlatformService;
|
private SavingsAccountWritePlatformService savingsAccountWritePlatformService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
+7
-7
@@ -37,7 +37,7 @@ import org.apache.fineract.infrastructure.core.domain.FineractContext;
|
|||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
|
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
|
||||||
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
|
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
|
||||||
import org.apache.fineract.portfolio.savings.service.SavingsSchedularInterestPoster;
|
import org.apache.fineract.portfolio.savings.service.SavingsSchedularInterestPosterTask;
|
||||||
import org.springframework.batch.core.StepContribution;
|
import org.springframework.batch.core.StepContribution;
|
||||||
import org.springframework.batch.core.scope.context.ChunkContext;
|
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||||
import org.springframework.batch.core.step.tasklet.Tasklet;
|
import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||||
@@ -138,13 +138,13 @@ public class PostInterestForSavingTasklet implements Tasklet {
|
|||||||
|
|
||||||
for (long i = 0; i < loopCount; i++) {
|
for (long i = 0; i < loopCount; i++) {
|
||||||
List<SavingsAccountData> subList = safeSubList(savingsAccounts, fromIndex, toIndex);
|
List<SavingsAccountData> subList = safeSubList(savingsAccounts, fromIndex, toIndex);
|
||||||
SavingsSchedularInterestPoster savingsSchedularInterestPoster = applicationContext
|
SavingsSchedularInterestPosterTask savingsSchedularInterestPosterTask = applicationContext
|
||||||
.getBean(SavingsSchedularInterestPoster.class);
|
.getBean(SavingsSchedularInterestPosterTask.class);
|
||||||
savingsSchedularInterestPoster.setSavingAccounts(subList);
|
savingsSchedularInterestPosterTask.setSavingAccounts(subList);
|
||||||
savingsSchedularInterestPoster.setBackdatedTxnsAllowedTill(backdatedTxnsAllowedTill);
|
savingsSchedularInterestPosterTask.setBackdatedTxnsAllowedTill(backdatedTxnsAllowedTill);
|
||||||
savingsSchedularInterestPoster.setContext(ThreadLocalContextUtil.getContext());
|
savingsSchedularInterestPosterTask.setContext(ThreadLocalContextUtil.getContext());
|
||||||
|
|
||||||
posters.add(savingsSchedularInterestPoster);
|
posters.add(savingsSchedularInterestPosterTask);
|
||||||
|
|
||||||
if (lastBatch) {
|
if (lastBatch) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
+1
-5
@@ -131,7 +131,6 @@ import org.springframework.data.domain.PageRequest;
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@@ -1672,7 +1671,6 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
||||||
public void setSubStatusInactive(Long savingsId) {
|
public void setSubStatusInactive(Long savingsId) {
|
||||||
final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId, false);
|
final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId, false);
|
||||||
final Set<Long> existingTransactionIds = new HashSet<>();
|
final Set<Long> existingTransactionIds = new HashSet<>();
|
||||||
@@ -1684,15 +1682,13 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
||||||
public void setSubStatusDormant(Long savingsId) {
|
public void setSubStatusDormant(Long savingsId) {
|
||||||
final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId, false);
|
final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId, false);
|
||||||
account.setSubStatusDormant();
|
account.setSubStatusDormant();
|
||||||
this.savingAccountRepositoryWrapper.save(account);
|
this.savingAccountRepositoryWrapper.saveAndFlush(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
||||||
public void escheat(Long savingsId) {
|
public void escheat(Long savingsId) {
|
||||||
final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId, false);
|
final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId, false);
|
||||||
final Set<Long> existingTransactionIds = new HashSet<>();
|
final Set<Long> existingTransactionIds = new HashSet<>();
|
||||||
|
|||||||
+4
-15
@@ -27,14 +27,11 @@ import java.util.Date;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.fineract.accounting.journalentry.domain.JournalEntryType;
|
import org.apache.fineract.accounting.journalentry.domain.JournalEntryType;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractContext;
|
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
|
||||||
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
||||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||||
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
|
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
|
||||||
@@ -47,32 +44,26 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.transaction.annotation.Isolation;
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author manoj
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Setter
|
@Setter
|
||||||
@Component
|
@Component
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public class SavingsSchedularInterestPoster implements Callable<Void> {
|
public class SavingsSchedularInterestPoster {
|
||||||
|
|
||||||
private static final String SAVINGS_TRANSACTION_IDENTIFIER = "S";
|
private static final String SAVINGS_TRANSACTION_IDENTIFIER = "S";
|
||||||
|
|
||||||
private final SavingsAccountWritePlatformService savingsAccountWritePlatformService;
|
private final SavingsAccountWritePlatformService savingsAccountWritePlatformService;
|
||||||
private final List<SavingsAccountData> savingsAccountDataList = new ArrayList<>();
|
|
||||||
private final JdbcTemplate jdbcTemplate;
|
private final JdbcTemplate jdbcTemplate;
|
||||||
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
|
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
|
||||||
private final PlatformSecurityContext platformSecurityContext;
|
private final PlatformSecurityContext platformSecurityContext;
|
||||||
|
|
||||||
|
private final List<SavingsAccountData> savingsAccountDataList = new ArrayList<>();
|
||||||
private Collection<SavingsAccountData> savingAccounts;
|
private Collection<SavingsAccountData> savingAccounts;
|
||||||
private FineractContext context;
|
|
||||||
private boolean backdatedTxnsAllowedTill;
|
private boolean backdatedTxnsAllowedTill;
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(isolation = Isolation.READ_UNCOMMITTED, rollbackFor = Exception.class)
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED, rollbackFor = Exception.class)
|
||||||
public Void call() throws org.apache.fineract.infrastructure.jobs.exception.JobExecutionException {
|
public void postInterest() throws JobExecutionException {
|
||||||
ThreadLocalContextUtil.init(this.context);
|
|
||||||
|
|
||||||
if (!savingAccounts.isEmpty()) {
|
if (!savingAccounts.isEmpty()) {
|
||||||
List<Throwable> errors = new ArrayList<>();
|
List<Throwable> errors = new ArrayList<>();
|
||||||
@@ -103,8 +94,6 @@ public class SavingsSchedularInterestPoster implements Callable<Void> {
|
|||||||
throw new JobExecutionException(errors);
|
throw new JobExecutionException(errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void batchUpdateJournalEntries(final List<SavingsAccountData> savingsAccountDataList,
|
private void batchUpdateJournalEntries(final List<SavingsAccountData> savingsAccountDataList,
|
||||||
|
|||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.fineract.portfolio.savings.service;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.FineractContext;
|
||||||
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
|
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author manoj
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Component
|
||||||
|
@Scope("prototype")
|
||||||
|
public class SavingsSchedularInterestPosterTask implements Callable<Void> {
|
||||||
|
|
||||||
|
private final SavingsSchedularInterestPoster interestPoster;
|
||||||
|
@Setter
|
||||||
|
private FineractContext context;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Void call() throws org.apache.fineract.infrastructure.jobs.exception.JobExecutionException {
|
||||||
|
ThreadLocalContextUtil.init(context);
|
||||||
|
interestPoster.postInterest();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSavingAccounts(Collection<SavingsAccountData> savingAccounts) {
|
||||||
|
this.interestPoster.setSavingAccounts(savingAccounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackdatedTxnsAllowedTill(boolean backdatedTxnsAllowedTill) {
|
||||||
|
this.interestPoster.setBackdatedTxnsAllowedTill(backdatedTxnsAllowedTill);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user