Business date - part 3: Fix reports
This commit is contained in:
committed by
Arnold Gálovics
parent
357062a186
commit
b44a2f2b14
+4
-2
@@ -179,7 +179,8 @@ public final class ResultsetColumnHeaderData implements Serializable {
|
||||
}
|
||||
|
||||
private boolean isChar() {
|
||||
return "char".equalsIgnoreCase(this.columnType) || "CHARACTER VARYING".equalsIgnoreCase(this.columnType);
|
||||
return "char".equalsIgnoreCase(this.columnType) || "CHARACTER VARYING".equalsIgnoreCase(this.columnType)
|
||||
|| "bpchar".equalsIgnoreCase(this.columnType);
|
||||
}
|
||||
|
||||
private boolean isVarchar() {
|
||||
@@ -201,7 +202,8 @@ public final class ResultsetColumnHeaderData implements Serializable {
|
||||
}
|
||||
|
||||
private boolean isInteger() {
|
||||
return "integer".equalsIgnoreCase(this.columnType) || "int4".equalsIgnoreCase(this.columnType);
|
||||
return "integer".equalsIgnoreCase(this.columnType) || "int2".equalsIgnoreCase(this.columnType)
|
||||
|| "int4".equalsIgnoreCase(this.columnType);
|
||||
}
|
||||
|
||||
private boolean isSmallInt() {
|
||||
|
||||
+3
@@ -24,6 +24,7 @@ import java.time.temporal.ChronoField;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.sql.DataSource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
@@ -41,6 +42,7 @@ import org.springframework.jdbc.support.rowset.SqlRowSetMetaData;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GenericDataServiceImpl implements GenericDataService {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
@@ -88,6 +90,7 @@ public class GenericDataServiceImpl implements GenericDataService {
|
||||
|
||||
return new GenericResultsetData(columnHeaders, resultsetDataRows);
|
||||
} catch (DataAccessException e) {
|
||||
log.error("Reporting error: {}", e.getMessage());
|
||||
throw new PlatformDataIntegrityException("error.msg.report.unknown.data.integrity.issue", e.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -39,8 +39,10 @@ import java.util.Set;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.GenericResultsetData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.ReportData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.ReportParameterData;
|
||||
@@ -69,6 +71,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
private final PlatformSecurityContext context;
|
||||
private final GenericDataService genericDataService;
|
||||
private final SqlInjectionPreventerService sqlInjectionPreventerService;
|
||||
private final DatabaseSpecificSQLGenerator sqlGenerator;
|
||||
|
||||
@Override
|
||||
public StreamingOutput retrieveReportCSV(final String name, final String type, final Map<String, String> queryParams,
|
||||
@@ -187,9 +190,11 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
// (typically used to return report lists containing only reports
|
||||
// permitted to be run by the user
|
||||
sql = this.genericDataService.replace(sql, "${currentUserId}", currentUser.getId().toString());
|
||||
|
||||
sql = this.genericDataService.replace(sql, "${isSelfServiceUser}", Integer.toString(isSelfServiceUserReport ? 1 : 0));
|
||||
|
||||
sql = this.genericDataService.replace(sql, "${isSelfServiceUser}", Boolean.toString(isSelfServiceUserReport));
|
||||
sql = this.genericDataService.replace(sql, "${currentDate}", sqlGenerator.currentBusinessDate());
|
||||
sql = StringUtils.replaceIgnoreCase(sql, "NOW()", sqlGenerator.currentTenantDateTime());
|
||||
sql = StringUtils.replaceIgnoreCase(sql, "curdate()", sqlGenerator.currentBusinessDate());
|
||||
sql = StringUtils.replaceIgnoreCase(sql, "CURRENT_DATE", sqlGenerator.currentBusinessDate());
|
||||
sql = this.genericDataService.wrapSQL(sql);
|
||||
|
||||
return sql;
|
||||
|
||||
Reference in New Issue
Block a user