You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/02/10 13:48:09 UTC

[GitHub] [fineract] avikganguly01 commented on a change in pull request #2025: Improve performance of Interest Posting Job

avikganguly01 commented on a change in pull request #2025:
URL: https://github.com/apache/fineract/pull/2025#discussion_r803691118



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java
##########
@@ -230,6 +246,495 @@ public SavingsAccountData retrieveOne(final Long accountId) {
         }
     }
 
+    @Override
+    public List<SavingsAccountTransactionData> retrieveAllTransactionData(final List<String> refNo) throws DataAccessException {
+        String inSql = String.join(",", Collections.nCopies(refNo.size(), "?"));
+        String sql = "select " + this.savingsAccountTransactionsForBatchMapper.schema() + " where tr.ref_no in (%s)";
+        Object[] params = new Object[refNo.size()];
+        int i = 0;
+        for (String element : refNo) {
+            params[i] = element;
+            i++;
+        }
+        return this.jdbcTemplate.query(String.format(sql, inSql), this.savingsAccountTransactionsForBatchMapper, params);
+    }
+
+    @Override
+    public List<SavingsAccountData> retrieveAllSavingsDataForInterestPosting(final boolean backdatedTxnsAllowedTill, final int pageSize,
+            final Integer status, final Long maxSavingsId) {
+        LocalDate currentDate = DateUtils.getLocalDateOfTenant().minusDays(1);
+
+        String sql = "select " + this.savingAccountMapperForInterestPosting.schema()
+                + "join (select a.id from m_savings_account a where a.id > ? and a.status_enum = ? limit ?) b on b.id = sa.id ";
+        if (backdatedTxnsAllowedTill) {
+            sql = sql
+                    + "where if (sa.interest_posted_till_date is not null, tr.transaction_date >= sa.interest_posted_till_date, tr.transaction_date >= sa.activatedon_date) ";
+        }
+
+        sql = sql + "and apm.product_type=2 and sa.interest_posted_till_date<" + java.sql.Date.valueOf(currentDate);
+        sql = sql + " order by sa.id, tr.transaction_date, tr.created_date, tr.id";

Review comment:
       @fynmanoj Can you provide galovics the before and after results from the Gatling collection?




-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org