Skip to content

Commit

Permalink
feature/FBR-710-714-QA (#1019)
Browse files Browse the repository at this point in the history
* fix FSF-9

* fix FSF-4 (#945)

* Fix/fsf 11 (#947)

* fix FSF-4

* fix FSF-11

* Fix/fsf 11 (#950)

* fix FSF-4

* fix FSF-11

* fix FSF-11

* fix FSF-17 (#957)

* fix FSF-15

* fix FSF-12

* fix FSF-19

* fix FSF-19 (#969)

* Fix/fs 18 (#977)

* fix FSF-19

* FIX FSF-18

* Fix/fsf 20 (#980)

* fix FSF-19

* FIX FSF-18

* FIX FSF-20

* QA-FSF-18-20

* Fix/fsf 21 (#989)

* FSF 22

* FSF 22

* Fix/fsf 21 (#990)

* FSF 22

* FSF 22

* FSF 22

* FSF 23 (#992)

* FBR-710 (#1000)

* Fix/fsf 24 (#1014)

* FBR-710

* FSF-24

* Feature/fbr 714 (#1018)

* FBR-710

* FBR-714
  • Loading branch information
BrianMuhimbura authored Aug 15, 2024
1 parent 0af84c4 commit 81b5e04
Show file tree
Hide file tree
Showing 15 changed files with 581 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ 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 String groupingType, Long portfolioCenterId, Long agencyId) {

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

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);
portfolioCenterId,agencyId);
}

public static SearchParameters forBankCheques(final Long agencyId, final String chequeNo, final String bankAccNo, final Long batchId,
Expand Down Expand Up @@ -622,7 +622,7 @@ private SearchParameters(final String sqlSearch, final Long officeId, final Stri
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) {
Long portfolioCenterId, Long agencyId) {
this.sqlSearch = sqlSearch;
this.officeId = officeId;
this.externalId = externalId;
Expand Down Expand Up @@ -659,7 +659,7 @@ private SearchParameters(final String sqlSearch, final Long officeId, final Stri
this.disbursementStartDate = null;
this.approvalEndDate = null;
this.approvalStartDate = null;
this.agencyId = null;
this.agencyId = agencyId;
this.clientNo = null;
this.groupId = null;
this.centerId = portfolioCenterId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo,
@QueryParam("limit") @Parameter(description = "limit") final Integer limit,
@QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy,
@QueryParam("status") @Parameter(description = "status") final String status,
@QueryParam("agencyId") @Parameter(description = "agencyId") final Long agencyId,
@QueryParam("type") @Parameter(description = "type") final String type,
@QueryParam("portfolioCenterId") @Parameter(description = "type") final Long portfolioCenterId,
@QueryParam("searchText") @Parameter(description = "searchText") final String searchText,
Expand All @@ -157,7 +158,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, agencyId);
final Page<GroupPrequalificationData> clientData = this.prequalificationReadPlatformService.retrieveAll(searchParameters);

final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(queryParameters);
Expand All @@ -174,6 +175,7 @@ public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo,
public String newClientIdentifierDetails(@Context final UriInfo uriInfo) {

this.context.authenticatedUser().validateHasViewPermission(this.resourceNameForPermissions);
final String hierarchy = this.context.authenticatedUser().getOffice().getHierarchy();

MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();

Expand All @@ -183,7 +185,7 @@ public String newClientIdentifierDetails(@Context final UriInfo uriInfo) {
Long agencyId = null;
Long centerId = null;
Collection<CenterData> centerData = null;
Collection<AgencyData> agencies = null;
Collection<AgencyData> agencies = this.agencyReadPlatformService.retrieveByOfficeHierarchy(hierarchy);
Collection<AppUserData> appUsers = null;
Collection<LoanProductData> loanProducts = null;
GlobalConfigurationPropertyData timespan = null;
Expand Down Expand Up @@ -226,7 +228,6 @@ public String newClientIdentifierDetails(@Context final UriInfo uriInfo) {
}
}

final String hierarchy = this.context.authenticatedUser().getOffice().getHierarchy();
centerData = this.centerReadPlatformService.retrieveByOfficeHierarchy(hierarchy, agencyId);
agencies = this.agencyReadPlatformService.retrieveAllByAgencyLeader();
if (agencies.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,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,null);
final Page<MemberPrequalificationData> memberData = this.prequalificationReadPlatformService.retrieveAllMembers(searchParameters);

final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(queryParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ private CheckValidationColor runCheck7(final ClientData clientData) {
reportParams.put("${prequalificationId}", prequalificationId);
reportParams.put("${loanProductId}", productId);
reportParams.put("${clientArea}", clientArea);
reportParams.put("${categorization}", clientData.getCategorization());
reportParams.put("${categorization}", clientData.getRecreditCategorization());
reportParams.put("${isTopup}", String.valueOf(clientData.getIsLoanTopup()));
reportParams.put("${requestedAmount}", String.valueOf(clientData.getRequestedAmount()));
final GenericResultsetData result = this.readReportingService.retrieveGenericResultset(reportName, "report", reportParams, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ private String buildSqlStringFromBlacklistCriteria(final SearchParameters search
String sqlSearch = searchParameters.getSqlSearch();
final Long officeId = searchParameters.getOfficeId();
final Long centerId = searchParameters.getCenterId();
final Long agencyId = searchParameters.getAgencyId();
final String dpiNumber = searchParameters.getName();
final String status = searchParameters.getStatus();
final String type = searchParameters.getType();
Expand All @@ -298,12 +299,6 @@ private String buildSqlStringFromBlacklistCriteria(final SearchParameters search
paramList.add(appUser.getId());
}
}

// add hierrachy filter here.
extraCriteria += " and (mo.hierarchy LIKE CONCAT(?, '%') OR ? like CONCAT(mo.hierarchy, '%'))";
paramList.add(appUser.getOffice().getHierarchy());
paramList.add(appUser.getOffice().getHierarchy());

}

if (StringUtils.equals(groupingType, "individual")) {
Expand All @@ -314,6 +309,14 @@ private String buildSqlStringFromBlacklistCriteria(final SearchParameters search
paramList.add(dpiNumber);
}
}
extraCriteria += " and (moind.hierarchy LIKE CONCAT(?, '%') OR ? like CONCAT(moind.hierarchy, '%'))";
paramList.add(appUser.getOffice().getHierarchy());
paramList.add(appUser.getOffice().getHierarchy());

if (agencyId != null) {
extraCriteria += " and individualOffice.agency_id = ? ";
paramList.add(agencyId);
}
}

if (sqlSearch != null && !isGroup) {
Expand Down Expand Up @@ -457,12 +460,25 @@ LEFT JOIN (
FROM m_prequalification_group_members mpgm
GROUP BY mpgm.group_id
) prequalification_numbers ON prequalification_numbers.prequalification_id = g.id
LEFT JOIN(
select DISTINCT mc.office_id, ms.agency_id, mpgm.group_id, ms.linked_office_id as supervision_office
from m_prequalification_group_members mpgm
INNER JOIN m_client mc on mc.dpi = mpgm.dpi
INNER JOIN m_group_client mgc on mgc.client_id = mc.id
INNER JOIN m_group mg on mg.id = mgc.group_id
INNER JOIN m_group center on center.id = mg.parent_id
INNER JOIN m_portfolio mp on mp.id = center.portfolio_id
INNER JOIN m_supervision ms on ms.id = mp.supervision_id
) individualOffice ON individualOffice.group_id = g.id
LEFT JOIN m_agency ma ON
g.agency_id = ma.id
LEFT JOIN(
select agency_id, linked_office_id from m_supervision GROUP BY agency_id
) supv ON supv.agency_id = ma.id
LEFT JOIN m_office mo on mo.id = supv.linked_office_id
LEFT JOIN m_office moind on moind.id = individualOffice.supervision_office
LEFT JOIN
(
SELECT p.id AS groupid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,5 @@
<include file="parts/0132_AddConfigurationForAmountFormats.xml" relativeToChangelogFile="true"/>
<include file="parts/0133_UpdateNewHardPolicyQueries.xml" relativeToChangelogFile="true"/>
<include file="parts/0134_HardPolicyFixes.xml" relativeToChangelogFile="true"/>
<include file="parts/0135_FBR-714-BANCO_COMMUNAL_MEDA.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--

SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1);
UPDATE stretchy_report SET report_sql = concat('SELECT mc.id,
client_age.client_age AS client_age,
mc.date_of_birth AS date_of_birth,
CASE
-- Banco Comunal normal
WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
-- Banco Comunal normal meda
WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
-- Banco Comunal temporal
WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
-- Banco Comunal Agricola
WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
-- Grupo Solidario
WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
-- Grupo Solidario Agricola
WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
END AS color
FROM m_client mc
INNER JOIN (
SELECT mct.id AS client_id, mct.date_of_birth AS date_of_birth, IFNULL(TIMESTAMPDIFF(YEAR, mct.date_of_birth, CURDATE()), 0) AS client_age
FROM m_client mct
) client_age ON client_age.client_id = mc.id
WHERE mc.id = ${clientId}')
WHERE report_name = 'Client age Policy Check';
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--

SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1);
UPDATE stretchy_report SET report_sql = concat(' SELECT CASE
WHEN (${loanProductId} IN (9)) AND ''${categorization}'' = ''RECREDITO'' AND ${requestedAmount} <= 6000 THEN ''GREEN''
WHEN (${loanProductId} IN (2,',@productId,',8)) AND ${requestedAmount} <= 6000 THEN ''GREEN''
WHEN (${loanProductId} IN (2,',@productId,',9,8,4,5,7)) AND (${photographs} <= 0 OR ${investmentPlan} <= 0) THEN ''RED''
ELSE ''GREEN''
END AS color')
WHERE report_name = 'Mandatory to attach photographs and investment plan Policy Check';
Loading

0 comments on commit 81b5e04

Please sign in to comment.