FINERACT-1678: Fix Apply Penalty to overdue loan COB job
This commit is contained in:
committed by
Arnold Gálovics
parent
aa12de397d
commit
4808bb3489
+9
-2
@@ -26,6 +26,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.cob.domain.BatchBusinessStep;
|
||||
import org.apache.fineract.cob.domain.BatchBusinessStepRepository;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -42,8 +44,13 @@ public class COBBusinessStepServiceImpl implements COBBusinessStepService {
|
||||
@Override
|
||||
public <T extends COBBusinessStep<S>, S extends AbstractPersistableCustom> S run(TreeMap<Long, String> executionMap, S item) {
|
||||
for (String businessStep : executionMap.values()) {
|
||||
COBBusinessStep<S> businessStepBean = (COBBusinessStep<S>) applicationContext.getBean(businessStep);
|
||||
item = businessStepBean.execute(item);
|
||||
try {
|
||||
COBBusinessStep<S> businessStepBean = (COBBusinessStep<S>) applicationContext.getBean(businessStep);
|
||||
item = businessStepBean.execute(item);
|
||||
} finally {
|
||||
// Fallback to COB action context after each business step
|
||||
ThreadLocalContextUtil.setActionContext(ActionContext.COB);
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
+2
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.cob;
|
||||
|
||||
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
@@ -31,6 +32,7 @@ public class COBInputChannelInterceptor implements ExecutorChannelInterceptor {
|
||||
public Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler) {
|
||||
COBMessage castedMessage = COBMessage.class.cast(message.getPayload());
|
||||
ThreadLocalContextUtil.init(castedMessage.getContext());
|
||||
ThreadLocalContextUtil.setActionContext(ActionContext.COB);
|
||||
return new GenericMessage<>(castedMessage.getStepExecutionRequest());
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -73,6 +73,7 @@ public class BusinessDateReadPlatformServiceImpl implements BusinessDateReadPlat
|
||||
ZoneId zone = DateUtils.getDateTimeZoneOfTenant();
|
||||
LocalDate tenantDate = LocalDate.now(zone);
|
||||
businessDateMap.put(BusinessDateType.BUSINESS_DATE, tenantDate);
|
||||
businessDateMap.put(BusinessDateType.COB_DATE, tenantDate);
|
||||
if (configurationDomainService.isBusinessDateEnabled()) {
|
||||
final List<BusinessDateData> businessDateDataList = this.findAll();
|
||||
for (BusinessDateData businessDateData : businessDateDataList) {
|
||||
|
||||
-3
@@ -61,9 +61,6 @@ public class GlobalConfigurationWritePlatformServiceJpaRepositoryImpl implements
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult update(final Long configId, final JsonCommand command) {
|
||||
|
||||
this.context.authenticatedUser();
|
||||
|
||||
try {
|
||||
this.globalConfigurationDataValidator.validateForUpdate(command);
|
||||
|
||||
|
||||
+2
-2
@@ -1576,8 +1576,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isPenaltyDue = installment.isOverdueOn(DateUtils.getBusinessLocalDate().plusDays(penaltyWaitPeriod + 1));
|
||||
boolean isDueToday = installment.getDueDate().equals(DateUtils.getBusinessLocalDate().plusDays(penaltyWaitPeriod));
|
||||
boolean isPenaltyDue = installment.isOverdueOn(DateUtils.getBusinessLocalDate().minusDays(penaltyWaitPeriod).plusDays(1));
|
||||
boolean isDueToday = installment.getDueDate().equals(DateUtils.getBusinessLocalDate().minusDays(penaltyWaitPeriod));
|
||||
|
||||
if (isPenaltyDue) {
|
||||
if (!backdatePenalties && !isDueToday) {
|
||||
|
||||
Reference in New Issue
Block a user