adamsaghy commented on code in PR #4837:
URL: https://github.com/apache/fineract/pull/4837#discussion_r2213123396
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java:
##########
@@ -1386,4 +1421,107 @@ public List<Long> getAccountsIdsByStatusPaged(Integer
status, int pageSize, Long
public Long retrieveAccountIdByExternalId(final ExternalId externalId) {
return savingsAccountRepositoryWrapper.findIdByExternalId(externalId);
}
+
+ @Override
+ public Collection<SavingsAccrualData>
retrievePeriodicAccrualData(LocalDate tillDate, SavingsAccount savings) {
+ final SavingAccrualMapper mapper = new SavingAccrualMapper();
+ final StringBuilder sqlBuilder = new StringBuilder(400);
+ Map<String, Object> paramMap = new HashMap<>(3);
+ sqlBuilder.append(" select " + mapper.schema() + " where ");
+
+ sqlBuilder.append(" savings.status_enum = :active ");
+ sqlBuilder.append(" and (savings.nominal_annual_interest_rate is not
null and savings.nominal_annual_interest_rate > 0) ");
+ sqlBuilder.append(" and msp.accounting_type = :type ");
+ sqlBuilder.append(" and (savings.closedon_date <= :tillDate or
savings.closedon_date is null) ");
+ sqlBuilder.append(" and (savings.accrued_till_date <= :tillDate or
savings.accrued_till_date is null) ");
+ if (savings != null) {
+ sqlBuilder.append(" and savings.id = " + savings.getId());
+ }
+ sqlBuilder.append(" order by savings.id ");
+ paramMap.put("active", SavingsAccountStatusType.ACTIVE.getValue());
+ paramMap.put("type", AccountingRuleType.ACCRUAL_PERIODIC.getValue());
+ paramMap.put("tillDate", tillDate);
+ try {
+ return
this.namedParameterJdbcTemplate.query(sqlBuilder.toString(), paramMap, mapper);
Review Comment:
Use `queryForList` and no need the try catch!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]