josemakara2 commented on a change in pull request #1671:
URL: https://github.com/apache/fineract/pull/1671#discussion_r611810273
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesReadPlatformServiceImpl.java
##########
@@ -57,28 +57,27 @@ public ProvisioningEntriesReadPlatformServiceImpl(final
RoutingDataSource dataSo
@Override
public Collection<LoanProductProvisioningEntryData>
retrieveLoanProductsProvisioningData(Date date) {
String formattedDate = new SimpleDateFormat("yyyy-MM-dd").format(date);
- formattedDate = "'" + formattedDate + "'";
- LoanProductProvisioningEntryMapper mapper = new
LoanProductProvisioningEntryMapper(formattedDate);
+ LoanProductProvisioningEntryMapper mapper = new
LoanProductProvisioningEntryMapper();
final String sql = mapper.schema();
- return this.jdbcTemplate.query(sql, mapper, new Object[] {});
+ return this.jdbcTemplate.query(sql, mapper, new Object[] {
formattedDate, formattedDate, formattedDate });
}
private static final class LoanProductProvisioningEntryMapper implements
RowMapper<LoanProductProvisioningEntryData> {
private final StringBuilder sqlQuery;
- private LoanProductProvisioningEntryMapper(String formattedDate) {
+ private LoanProductProvisioningEntryMapper() {
sqlQuery = new StringBuilder().append(
"select if(loan.loan_type_enum=1, mclient.office_id,
mgroup.office_id) as office_id, loan.loan_type_enum, pcd.criteria_id as
criteriaid, loan.product_id,loan.currency_code,")
- .append("GREATEST(datediff(").append(formattedDate)
+ .append("GREATEST(datediff(?")
.append(",sch.duedate),0) as
numberofdaysoverdue,sch.duedate, pcd.category_id, pcd.provision_percentage,")
.append("loan.total_outstanding_derived as
outstandingbalance, pcd.liability_account, pcd.expense_account from
m_loan_repayment_schedule sch")
.append(" LEFT JOIN m_loan loan on sch.loan_id = loan.id")
.append(" JOIN m_loanproduct_provisioning_mapping lpm on
lpm.product_id = loan.product_id")
.append(" JOIN m_provisioning_criteria_definition pcd on
pcd.criteria_id = lpm.criteria_id and ")
- .append("(pcd.min_age <=
GREATEST(datediff(").append(formattedDate).append(",sch.duedate),0) and ")
-
.append("GREATEST(datediff(").append(formattedDate).append(",sch.duedate),0) <=
pcd.max_age) and ")
- .append("pcd.criteria_id is not null ").append("LEFT JOIN
m_client mclient ON mclient.id = loan.client_id ")
+ .append("(pcd.min_age <=
GREATEST(datediff(?").append(",sch.duedate),0) and
").append("GREATEST(datediff(?")
+ .append(",sch.duedate),0) <= pcd.max_age) and
").append("pcd.criteria_id is not null ")
Review comment:
@ptuomola
Done. Please check. Thank you
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]