Added signed document in evaluation response
This commit is contained in:
@@ -1424,7 +1424,7 @@ public class ApplicationDao {
|
|||||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG));
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private ApplicationSignedDocumentResponse convertApplicationSignedDocumentToApplicationSignedDocumentResponse(
|
public ApplicationSignedDocumentResponse convertApplicationSignedDocumentToApplicationSignedDocumentResponse(
|
||||||
ApplicationSignedDocumentEntity applicationSignedDocument) {
|
ApplicationSignedDocumentEntity applicationSignedDocument) {
|
||||||
ApplicationSignedDocumentResponse applicationSignedDocumentResponse = new ApplicationSignedDocumentResponse();
|
ApplicationSignedDocumentResponse applicationSignedDocumentResponse = new ApplicationSignedDocumentResponse();
|
||||||
applicationSignedDocumentResponse.setId(applicationSignedDocument.getId());
|
applicationSignedDocumentResponse.setId(applicationSignedDocument.getId());
|
||||||
|
|||||||
@@ -154,6 +154,9 @@ public class ApplicationEvaluationDao {
|
|||||||
@Value("${default.hub.uuid}")
|
@Value("${default.hub.uuid}")
|
||||||
private String defaultHubUuid;
|
private String defaultHubUuid;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationSignedDocumentRepository applicationSignedDocumentRepository;
|
||||||
|
|
||||||
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||||
|
|
||||||
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
||||||
@@ -1188,6 +1191,7 @@ public class ApplicationEvaluationDao {
|
|||||||
}
|
}
|
||||||
ApplicationEvaluationEntity entity = entityOptional.get();
|
ApplicationEvaluationEntity entity = entityOptional.get();
|
||||||
ApplicationEvaluationResponse applicationEvaluationResponse = convertToResponse(entity);
|
ApplicationEvaluationResponse applicationEvaluationResponse = convertToResponse(entity);
|
||||||
|
applicationEvaluationResponse.setSignedDocument(getApplicationSignedDocument(entity));
|
||||||
applicationEvaluationResponse.setEmailSendResponse(entity.getEmailSendResponse());
|
applicationEvaluationResponse.setEmailSendResponse(entity.getEmailSendResponse());
|
||||||
return applicationEvaluationResponse;
|
return applicationEvaluationResponse;
|
||||||
}
|
}
|
||||||
@@ -2417,6 +2421,7 @@ public class ApplicationEvaluationDao {
|
|||||||
}
|
}
|
||||||
response.setCompanyVatNumber(company.getVatNumber());
|
response.setCompanyVatNumber(company.getVatNumber());
|
||||||
response.setCompanyCodiceAteco(company.getCodiceAteco());
|
response.setCompanyCodiceAteco(company.getCodiceAteco());
|
||||||
|
response.setSignedDocument(getApplicationSignedDocument(evaluationEntity));
|
||||||
response.setEmailSendResponse(evaluationEntity.getEmailSendResponse());
|
response.setEmailSendResponse(evaluationEntity.getEmailSendResponse());
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
@@ -2705,5 +2710,15 @@ public class ApplicationEvaluationDao {
|
|||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
public ApplicationSignedDocumentResponse getApplicationSignedDocument(ApplicationEvaluationEntity evaluationEntity){
|
||||||
|
ApplicationSignedDocumentEntity applicationSignedDocument = applicationSignedDocumentRepository
|
||||||
|
.findByApplicationIdAndStatus(evaluationEntity.getApplicationId(), ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
||||||
|
if(applicationSignedDocument == null) {
|
||||||
|
log.warn("No active signed document found for applicationId: {}", evaluationEntity.getApplicationId());
|
||||||
|
throw new ResourceNotFoundException(Status.NOT_FOUND,
|
||||||
|
Translator.toLocale(GepafinConstant.APPLICATION_SIGNED_DOCUMENT_NOT_FOUND));
|
||||||
|
}
|
||||||
|
return applicationDao.convertApplicationSignedDocumentToApplicationSignedDocumentResponse(applicationSignedDocument);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,5 +49,6 @@ public class ApplicationEvaluationFormResponse {
|
|||||||
private String companyVatNumber;
|
private String companyVatNumber;
|
||||||
private String companyCodiceAteco;
|
private String companyCodiceAteco;
|
||||||
private List<EmailSendResponse> emailSendResponse;
|
private List<EmailSendResponse> emailSendResponse;
|
||||||
|
private ApplicationSignedDocumentResponse signedDocument;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,5 +51,6 @@ public class ApplicationEvaluationResponse {
|
|||||||
private String companyCodiceAteco;
|
private String companyCodiceAteco;
|
||||||
private List<EmailSendResponse> emailSendResponse;
|
private List<EmailSendResponse> emailSendResponse;
|
||||||
private List<DocumentResponseBean> rejectedDocument;
|
private List<DocumentResponseBean> rejectedDocument;
|
||||||
|
private ApplicationSignedDocumentResponse signedDocument;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,7 @@ public interface ApplicationSignedDocumentRepository extends JpaRepository<Appli
|
|||||||
|
|
||||||
@Query("SELECT d FROM ApplicationSignedDocumentEntity d WHERE d.status = :status")
|
@Query("SELECT d FROM ApplicationSignedDocumentEntity d WHERE d.status = :status")
|
||||||
List<ApplicationSignedDocumentEntity> findAllByIsStatus(@Param("status")String status);
|
List<ApplicationSignedDocumentEntity> findAllByIsStatus(@Param("status")String status);
|
||||||
|
|
||||||
|
ApplicationSignedDocumentEntity findByIdAndStatus(Long id, String status);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user