fix for repayment intervals recalculation
This commit is contained in:
+4
-4
@@ -14,7 +14,7 @@ import org.springframework.data.jpa.repository.Query;
|
|||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
public interface CalendarInstanceRepository extends JpaRepository<CalendarInstance, Long>, JpaSpecificationExecutor<CalendarInstance> {
|
public interface CalendarInstanceRepository extends JpaRepository<CalendarInstance, Long>, JpaSpecificationExecutor<CalendarInstance> {
|
||||||
|
|
||||||
CalendarInstance findByCalendarIdAndEntityIdAndEntityTypeId(Long calendarId, Long entityId, Integer entityTypeId);
|
CalendarInstance findByCalendarIdAndEntityIdAndEntityTypeId(Long calendarId, Long entityId, Integer entityTypeId);
|
||||||
|
|
||||||
Collection<CalendarInstance> findByEntityIdAndEntityTypeId(Long entityId, Integer entityTypeId);
|
Collection<CalendarInstance> findByEntityIdAndEntityTypeId(Long entityId, Integer entityTypeId);
|
||||||
@@ -26,8 +26,8 @@ public interface CalendarInstanceRepository extends JpaRepository<CalendarInstan
|
|||||||
|
|
||||||
Collection<CalendarInstance> findByCalendarIdAndEntityTypeId(Long calendarId, Integer entityTypeId);
|
Collection<CalendarInstance> findByCalendarIdAndEntityTypeId(Long calendarId, Integer entityTypeId);
|
||||||
|
|
||||||
/**Should use in clause, can I do it without creating a new class?**/
|
/** Should use in clause, can I do it without creating a new class? **/
|
||||||
@Query("from CalendarInstance ci where ci.entityId in (select id from Loan loan where loan.client.id = :clientId and loan.group.id = :groupId and (loan.loanStatus = 100 or loan.loanStatus = 200 or loan.loanStatus = 300)) and ci.entityTypeId = 3")
|
@Query("from CalendarInstance ci where ci.entityId in (select id from Loan loan where loan.client.id = :clientId and loan.group.id = :groupId and (loan.loanStatus = 100 or loan.loanStatus = 200 or loan.loanStatus = 300)) and ci.entityTypeId = 3")
|
||||||
List<CalendarInstance> findCalendarInstancesForActiveLoansByGroupIdAndClientId(@Param("clientId") Long clientId,
|
List<CalendarInstance> findCalendarInstancesForActiveLoansByGroupIdAndClientId(@Param("groupId") Long groupId,
|
||||||
@Param("groupId") Long groupId);
|
@Param("clientId") Long clientId);
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-15
@@ -2486,22 +2486,16 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isHolidayEnabled) {
|
if (isHolidayEnabled) {
|
||||||
// reset repayment date with new meeting date
|
newRepaymentDate = HolidayUtil.getRepaymentRescheduleDateToIfHoliday(newRepaymentDate, holidays);
|
||||||
newRepaymentDate = CalendarUtils.getNewRepaymentMeetingDate(recuringRule, meetingStartDate, oldDueDate,
|
|
||||||
loanRepaymentInterval, frequency, workingDays);
|
|
||||||
if (isHolidayEnabled) {
|
|
||||||
newRepaymentDate = HolidayUtil.getRepaymentRescheduleDateToIfHoliday(newRepaymentDate, holidays);
|
|
||||||
}
|
|
||||||
|
|
||||||
loanRepaymentScheduleInstallment.updateDueDate(newRepaymentDate);
|
|
||||||
// reset from date to get actual daysInPeriod
|
|
||||||
loanRepaymentScheduleInstallment.updateFromDate(tmpFromDate);
|
|
||||||
tmpFromDate = newRepaymentDate;// update with new repayment
|
|
||||||
// date
|
|
||||||
} else {
|
|
||||||
tmpFromDate = oldDueDate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loanRepaymentScheduleInstallment.updateDueDate(newRepaymentDate);
|
||||||
|
// reset from date to get actual daysInPeriod
|
||||||
|
loanRepaymentScheduleInstallment.updateFromDate(tmpFromDate);
|
||||||
|
tmpFromDate = newRepaymentDate;// update with new repayment
|
||||||
|
// date
|
||||||
|
}else {
|
||||||
|
tmpFromDate = oldDueDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user