Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/FBR-514: Update prequalification creation date #401

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public static SearchParameters forBlacklist(final String displayName, final Stri
}

public static SearchParameters forPrequalification(final String displayName, final String status, final Integer offset,
final Integer limit, final String orderBy, final String sortOrder, final String type, String searchText,
final String groupingType, Long portfolioCenterId) {
final Integer limit, final String orderBy, final String sortOrder, final String type, String searchText,
final String groupingType, Long portfolioCenterId) {

final Integer maxLimitAllowed = getCheckedLimit(limit);
final Long staffId = null;
Expand All @@ -137,7 +137,8 @@ public static SearchParameters forPrequalification(final String displayName, fin
final Long savingsId = null;

return new SearchParameters(searchText, null, null, displayName, null, null, null, status, offset, maxLimitAllowed, orderBy,
sortOrder, staffId, accountNo, loanId, savingsId, null, false, null, type, null, null, null, groupingType,portfolioCenterId);
sortOrder, staffId, accountNo, loanId, savingsId, null, false, null, type, null, null, null, groupingType,
portfolioCenterId);
}

public static SearchParameters forBankCheques(final Long agencyId, final String chequeNo, final String bankAccNo, final Long batchId,
Expand Down Expand Up @@ -616,10 +617,11 @@ private SearchParameters(final String sqlSearch, final Long officeId, final Stri
}

private SearchParameters(final String sqlSearch, final Long officeId, final String externalId, final String name,
final String hierarchy, final String firstname, final String lastname, final String status, final Integer offset,
final Integer limit, final String orderBy, final String sortOrder, final Long staffId, final String accountNo,
final Long loanId, final Long savingsId, final Boolean orphansOnly, boolean isSelfUser, final String dpiNumber,
final String type, final String groupName, final String groupNumber, final String centerName, final String groupingType, Long portfolioCenterId) {
final String hierarchy, final String firstname, final String lastname, final String status, final Integer offset,
final Integer limit, final String orderBy, final String sortOrder, final Long staffId, final String accountNo,
final Long loanId, final Long savingsId, final Boolean orphansOnly, boolean isSelfUser, final String dpiNumber,
final String type, final String groupName, final String groupNumber, final String centerName, final String groupingType,
Long portfolioCenterId) {
this.sqlSearch = sqlSearch;
this.officeId = officeId;
this.externalId = externalId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void validateSQLInput(final String sqlSearch) {
}
String lowerCaseSQL = sqlSearch.toLowerCase();
for (String ddl : DDL_COMMANDS) {
if (lowerCaseSQL.contains(ddl)) {
if (ddl.equals(lowerCaseSQL)) {
throw new SQLInjectionException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo,

String clientName = queryParameters.getFirst("clientName");
SearchParameters searchParameters = SearchParameters.forPrequalification(clientName, status, offset, limit, orderBy, sortOrder,
type, searchText, groupingType,portfolioCenterId);
type, searchText, groupingType, portfolioCenterId);
final Page<GroupPrequalificationData> clientData = this.prequalificationReadPlatformService.retrieveAll(searchParameters);

final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(queryParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import lombok.Data;
Expand Down Expand Up @@ -62,7 +63,7 @@ public class GroupPrequalificationData {
private final Long facilitatorId;
private final String comments;
private final Long groupId;
private final LocalDate createdAt;
private final LocalDateTime createdAt;
private final Collection<AgencyData> agencies;
private final Collection<CenterData> centerData;
private final Collection<LoanProductData> loanProducts;
Expand All @@ -83,10 +84,11 @@ public class GroupPrequalificationData {
private Long linkedGroupId;

public GroupPrequalificationData(final Long id, final String productName, final String prequalificationNumber, final String agencyName,
final String portforlioName, final String centerName, final String groupName, final String addedBy, final LocalDate createdAt,
final EnumOptionData status, String comments, Long groupId, final Collection<MemberPrequalificationData> groupMembers,
final Collection<AgencyData> agencies, Collection<CenterData> centerData, Collection<LoanProductData> loanProducts,
Collection<AppUserData> appUsers, Long prequalilficationTimespan, List<EnumOptionData> groupStatusOptions) {
final String portforlioName, final String centerName, final String groupName, final String addedBy,
final LocalDateTime createdAt, final EnumOptionData status, String comments, Long groupId,
final Collection<MemberPrequalificationData> groupMembers, final Collection<AgencyData> agencies,
Collection<CenterData> centerData, Collection<LoanProductData> loanProducts, Collection<AppUserData> appUsers,
Long prequalilficationTimespan, List<EnumOptionData> groupStatusOptions) {
this.id = id;
this.productName = productName;
this.prequalificationNumber = prequalificationNumber;
Expand Down Expand Up @@ -126,15 +128,16 @@ public GroupPrequalificationData(final Long id, final String productName, final
}

public GroupPrequalificationData(final Long id, final String productName, final String prequalificationNumber, final String agencyName,
final String portforlioName, final String centerName, final String groupName, final String addedBy, final LocalDate createdAt,
final EnumOptionData status, String comments, Long groupId, final Collection<MemberPrequalificationData> groupMembers,
final Collection<AgencyData> agencies, Collection<CenterData> centerData, Collection<LoanProductData> loanProducts,
Collection<AppUserData> appUsers, final Long agencyId, final Long centerId, final Long productId, final Long facilitatorId,
final String facilitatorName, Long greenValidationCount, Long yellowValidationCount, Long orangeValidationCount,
Long redValidationCount, Long prequalilficationTimespan, EnumOptionData lastPrequalificationStatus, String statusChangedBy,
LocalDate statusChangedOn, String processType, String processQuality, BigDecimal totalRequestedAmount,
BigDecimal totalApprovedAmount, EnumOptionData prequalificationType, String substatus, String assignedUser,
String assignedUserName, String latestComments, Long linkedGroupId) {
final String portforlioName, final String centerName, final String groupName, final String addedBy,
final LocalDateTime createdAt, final EnumOptionData status, String comments, Long groupId,
final Collection<MemberPrequalificationData> groupMembers, final Collection<AgencyData> agencies,
Collection<CenterData> centerData, Collection<LoanProductData> loanProducts, Collection<AppUserData> appUsers,
final Long agencyId, final Long centerId, final Long productId, final Long facilitatorId, final String facilitatorName,
Long greenValidationCount, Long yellowValidationCount, Long orangeValidationCount, Long redValidationCount,
Long prequalilficationTimespan, EnumOptionData lastPrequalificationStatus, String statusChangedBy, LocalDate statusChangedOn,
String processType, String processQuality, BigDecimal totalRequestedAmount, BigDecimal totalApprovedAmount,
EnumOptionData prequalificationType, String substatus, String assignedUser, String assignedUserName, String latestComments,
Long linkedGroupId) {
this.id = id;
this.productName = productName;
this.prequalificationNumber = prequalificationNumber;
Expand Down Expand Up @@ -188,14 +191,14 @@ public static GroupPrequalificationData template(final Collection<AgencyData> ag
}

public static GroupPrequalificationData instance(Long id, String prequalificationNumber, EnumOptionData status, String agencyName,
String portfolioName, String centerName, String groupName, String productName, String addedBy, LocalDate createdAt,
String portfolioName, String centerName, String groupName, String productName, String addedBy, LocalDateTime createdAt,
String comments, Long groupId, Long prequalilficationTimespan) {
return new GroupPrequalificationData(id, productName, prequalificationNumber, agencyName, portfolioName, centerName, groupName,
addedBy, createdAt, status, comments, groupId, null, null, null, null, null, prequalilficationTimespan, null);
}

public static GroupPrequalificationData instance(Long id, String prequalificationNumber, EnumOptionData status, String agencyName,
String portfolioName, String centerName, String groupName, String productName, String addedBy, LocalDate createdAt,
String portfolioName, String centerName, String groupName, String productName, String addedBy, LocalDateTime createdAt,
String comments, Long groupId, final Long agencyId, final Long centerId, final Long productId, final Long facilitatorId,
final String facilitatorName, Long greenValidationCount, Long yellowValidationCount, Long orangeValidationCount,
Long redValidationCount, Long prequalilficationTimespan, EnumOptionData lastPrequalificationStatus, String statusChangedBy,
Expand All @@ -211,7 +214,7 @@ public static GroupPrequalificationData instance(Long id, String prequalificatio
}

public static GroupPrequalificationData simpeGroupData(Long id, String prequalificationNumber, EnumOptionData status, String groupName,
String productName, String addedBy, LocalDate createdAt, Long groupId) {
String productName, String addedBy, LocalDateTime createdAt, Long groupId) {

return new GroupPrequalificationData(id, productName, prequalificationNumber, null, null, null, groupName, addedBy, createdAt,
status, null, groupId, null, null, null, null, null, null, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
Expand Down Expand Up @@ -305,10 +305,11 @@ private String buildSqlStringFromBlacklistCriteria(final SearchParameters search

Set<Role> roles = appUser.getRoles();
for (Role userRole : roles) {
if (StringUtils.containsIgnoreCase(userRole.getName(),"Líder de agencia")){
if (StringUtils.containsIgnoreCase(userRole.getName(), "Líder de agencia")) {
extraCriteria += " and ma.responsible_user_id = ? ";
paramList.add(appUser.getId());
};
}
;
}

}
Expand Down Expand Up @@ -532,7 +533,7 @@ public GroupPrequalificationData mapRow(final ResultSet rs, final int rowNum) th
final String productName = rs.getString("productName");
final String comments = rs.getString("comments");
final String latestComments = rs.getString("latestComments");
final LocalDate createdAt = JdbcSupport.getLocalDate(rs, "created_at");
final LocalDateTime createdAt = JdbcSupport.getLocalDateTime(rs, "created_at");

final String addedBy = rs.getString("firstname") + " " + rs.getString("lastname");
final Long agencyId = JdbcSupport.getLong(rs, "agencyId");
Expand Down Expand Up @@ -607,7 +608,7 @@ public GroupPrequalificationData mapRow(final ResultSet rs, final int rowNum) th
final String prequalificationNumber = rs.getString("prequalificationNumber");
String groupName = rs.getString("groupName");
final String productName = rs.getString("productName");
final LocalDate createdAt = JdbcSupport.getLocalDate(rs, "created_at");
final LocalDateTime createdAt = JdbcSupport.getLocalDateTime(rs, "created_at");
final String addedBy = rs.getString("firstname") + " " + rs.getString("lastname");
return GroupPrequalificationData.simpeGroupData(id, prequalificationNumber, status, groupName, productName, addedBy, createdAt,
groupId);
Expand Down Expand Up @@ -645,7 +646,7 @@ public GroupPrequalificationData mapRow(final ResultSet rs, final int rowNum) th
final String prequalificationNumber = rs.getString("prequalificationNumber");
String groupName = rs.getString("groupName");
final String productName = rs.getString("productName");
final LocalDate createdAt = JdbcSupport.getLocalDate(rs, "created_at");
final LocalDateTime createdAt = JdbcSupport.getLocalDateTime(rs, "created_at");
final String addedBy = rs.getString("firstname") + " " + rs.getString("lastname");
final Integer prequalificationTypeEnum = JdbcSupport.getInteger(rs, "prequalificationType");
final EnumOptionData prequalificationType = PreQualificationsEnumerations.prequalificationType(prequalificationTypeEnum);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,7 @@ public void setClientInfoRelatedDetail(ClientInfoRelatedDetail clientInfoRelated
public Integer getLoanCycle() {
return this.loanCycle;
}

public void updateLoanCycle(final Integer loanCycle) {
this.loanCycle = loanCycle;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public Page<ClientData> retrieveAll(final SearchParameters searchParameters) {
sqlBuilder.append("select " + sqlGenerator.calcFoundRows() + " ");
sqlBuilder.append(this.clientMapper.schema());
sqlBuilder.append(" where (o.hierarchy like ? or transferToOffice.hierarchy like ?) ");
// sqlBuilder.append(" and c.external_id in (select NumeroCliente from PDA_MIG_017_P_SALDOS) ");
// sqlBuilder.append(" and c.external_id in (select NumeroCliente from PDA_MIG_017_P_SALDOS) ");

if (searchParameters != null) {
if (searchParameters.isSelfUser()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1745,8 +1745,8 @@ public Integer retriveLoanCounter(final Long clientId, Long productId) {

@Override
public Integer retriveLoanCounterByClient(final Long clientId) {
final String sql = "Select COUNT(ml.id) from m_loan ml where ml.client_id = ? and ml.loan_status_id >=300 " +
"and ml.loan_status_id not in (400, 500, 601, 602)";
final String sql = "Select COUNT(ml.id) from m_loan ml where ml.client_id = ? and ml.loan_status_id >=300 "
+ "and ml.loan_status_id not in (400, 500, 601, 602)";
Integer loanCounter = this.jdbcTemplate.queryForObject(sql, new Object[] { clientId }, Integer.class);
if (loanCounter != null) {
return loanCounter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
<sql>
<![CDATA[
with cte as (
select count(ml.id) client_cycle, mc.id
from m_client mc
left join m_loan ml on ml.client_id = mc.id and ml.loan_status_id >=300 and ml.loan_status_id not in (400, 500, 601, 602)
group by mc.id
)
update m_client mc
join cte on cte.id = mc.id
set mc.loan_cycle = cte.client_cycle;
select count(ml.id) client_cycle, mc.id
from m_client mc
left join m_loan ml on ml.client_id = mc.id and ml.loan_status_id >=300 and ml.loan_status_id not in (400, 500, 601, 602)
group by mc.id
)
update m_client mc
join cte on cte.id = mc.id
set mc.loan_cycle = cte.client_cycle;
]]>
</sql>
</changeSet>
Expand Down
Loading