Skip to content

Commit

Permalink
fix/FBR-690 (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianMuhimbura authored Jun 26, 2024
1 parent 02419f7 commit e934841
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
Expand Down Expand Up @@ -1006,20 +1007,22 @@ private CheckValidationColor runCheck25(final ClientData clientData) {
final ClientData params = retrieveClientParams(clientData.getClientId(), clientData.getProductId());
final List<LoanAdditionProperties> loanAdditionPropertiesList = this.loanAdditionalPropertiesRepository
.findByClientIdAndLoanId(clientData.getClientId(), clientData.getLoanId());
int yearsInBusiness = 0;
String yearsInBusiness = "0";
if (!CollectionUtils.isEmpty(loanAdditionPropertiesList)) {
final LoanAdditionProperties loanAdditionProperties = loanAdditionPropertiesList.get(0);
LocalDate businessStartDate = loanAdditionProperties.getFecha_inicio_negocio();
LocalDate currentDate = DateUtils.getLocalDateOfTenant();
Integer monthsBetween = Math.toIntExact(ChronoUnit.MONTHS.between(currentDate, businessStartDate));
yearsInBusiness = monthsBetween / 12;
Double monthsBetween = Double.valueOf(ChronoUnit.MONTHS.between(businessStartDate,currentDate));
DecimalFormat f = new DecimalFormat("##.0");

yearsInBusiness = f.format(Double.valueOf(monthsBetween / 12));
}
final Map<String, String> reportParams = new HashMap<>();
reportParams.put("${clientId}", clientId);
reportParams.put("${loanProductId}", productId);
reportParams.put("${clientCategorization}", params.getClientCategorization());
reportParams.put("${recreditCategorization}", params.getRecreditCategorization());
reportParams.put("${businessAge}", String.valueOf(yearsInBusiness));
reportParams.put("${businessAge}", yearsInBusiness);
reportParams.put("${requestedAmount}", String.valueOf(clientData.getRequestedAmount()));
final GenericResultsetData result = this.readReportingService.retrieveGenericResultset(reportName, "report", reportParams, false);
return extractColorFromResultset(result);
Expand Down

0 comments on commit e934841

Please sign in to comment.