Skip to content

Commit

Permalink
Merge pull request #363 from fiterlatam/FBR-497
Browse files Browse the repository at this point in the history
FBR-497 retain loan external id for bulk import and fix 500 exception…
  • Loading branch information
faheem205 authored Dec 26, 2023
2 parents 87a290b + 66609e1 commit 3a1afd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,10 @@ public CommandProcessingResult submitApplication(final JsonCommand command) {

this.loanRepositoryWrapper.saveAndFlush(newLoanApplication);
final Long newLoanApplicationId = newLoanApplication.getId();
newLoanApplication.setExternalId(String.valueOf(newLoanApplicationId));
final Boolean isBulkImport = this.fromJsonHelper.extractBooleanNamed("isBulkImport", command.parsedJson());
if (isBulkImport == null || !isBulkImport) {
newLoanApplication.setExternalId(String.valueOf(newLoanApplicationId));
}

Long facilitatorId = command.longValueOfParameterNamed("facilitator");
AppUser facilitator = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2588,7 +2588,12 @@ public Collection<LoanAccountData> retrieveClientActiveLoans(Long clientId) {
public GroupLoanAdditionalData retrieveAdditionalData(Long loanId) {
final AdditionalGroupLoanData mapper = new AdditionalGroupLoanData(sqlGenerator);
String sql = "select " + mapper.schema();
GroupLoanAdditionalData groupLoanAdditionalData = this.jdbcTemplate.queryForObject(sql, mapper, loanId);
GroupLoanAdditionalData groupLoanAdditionalData = null;
try {
groupLoanAdditionalData = this.jdbcTemplate.queryForObject(sql, mapper, loanId);
} catch (EmptyResultDataAccessException e) {
return null;
}

if (groupLoanAdditionalData!=null){
AdditionalDataExtraLoansMapper extraLoansMapper = new AdditionalDataExtraLoansMapper(sqlGenerator);
Expand Down

0 comments on commit 3a1afd2

Please sign in to comment.