From 6a487eeda3f4f8a251834de043aa42647c9c43df Mon Sep 17 00:00:00 2001 From: rajesh Date: Wed, 22 Oct 2025 15:08:09 +0530 Subject: [PATCH] Added signed document in evaluation response --- .../tendermanagement/dao/ApplicationDao.java | 2 +- .../dao/ApplicationEvaluationDao.java | 15 +++++++++++++++ .../ApplicationEvaluationFormResponse.java | 1 + .../response/ApplicationEvaluationResponse.java | 1 + .../ApplicationSignedDocumentRepository.java | 3 +++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java index 9c100add..7eb0c316 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java @@ -1424,7 +1424,7 @@ public class ApplicationDao { throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG)); } } - private ApplicationSignedDocumentResponse convertApplicationSignedDocumentToApplicationSignedDocumentResponse( + public ApplicationSignedDocumentResponse convertApplicationSignedDocumentToApplicationSignedDocumentResponse( ApplicationSignedDocumentEntity applicationSignedDocument) { ApplicationSignedDocumentResponse applicationSignedDocumentResponse = new ApplicationSignedDocumentResponse(); applicationSignedDocumentResponse.setId(applicationSignedDocument.getId()); diff --git a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java index 00f37bc1..d0d7b8ba 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java @@ -154,6 +154,9 @@ public class ApplicationEvaluationDao { @Value("${default.hub.uuid}") private String defaultHubUuid; + @Autowired + private ApplicationSignedDocumentRepository applicationSignedDocumentRepository; + private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) { ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity(); @@ -1188,6 +1191,7 @@ public class ApplicationEvaluationDao { } ApplicationEvaluationEntity entity = entityOptional.get(); ApplicationEvaluationResponse applicationEvaluationResponse = convertToResponse(entity); + applicationEvaluationResponse.setSignedDocument(getApplicationSignedDocument(entity)); applicationEvaluationResponse.setEmailSendResponse(entity.getEmailSendResponse()); return applicationEvaluationResponse; } @@ -2417,6 +2421,7 @@ public class ApplicationEvaluationDao { } response.setCompanyVatNumber(company.getVatNumber()); response.setCompanyCodiceAteco(company.getCodiceAteco()); + response.setSignedDocument(getApplicationSignedDocument(evaluationEntity)); response.setEmailSendResponse(evaluationEntity.getEmailSendResponse()); return response; } @@ -2705,5 +2710,15 @@ public class ApplicationEvaluationDao { } 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); + } } diff --git a/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationFormResponse.java b/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationFormResponse.java index 92f7933a..84cf4989 100644 --- a/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationFormResponse.java +++ b/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationFormResponse.java @@ -49,5 +49,6 @@ public class ApplicationEvaluationFormResponse { private String companyVatNumber; private String companyCodiceAteco; private List emailSendResponse; + private ApplicationSignedDocumentResponse signedDocument; } diff --git a/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationResponse.java b/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationResponse.java index 296d7f6b..33b58062 100644 --- a/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationResponse.java +++ b/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationResponse.java @@ -51,5 +51,6 @@ public class ApplicationEvaluationResponse { private String companyCodiceAteco; private List emailSendResponse; private List rejectedDocument; + private ApplicationSignedDocumentResponse signedDocument; } diff --git a/src/main/java/net/gepafin/tendermanagement/repositories/ApplicationSignedDocumentRepository.java b/src/main/java/net/gepafin/tendermanagement/repositories/ApplicationSignedDocumentRepository.java index b9d2bce3..4f66d578 100644 --- a/src/main/java/net/gepafin/tendermanagement/repositories/ApplicationSignedDocumentRepository.java +++ b/src/main/java/net/gepafin/tendermanagement/repositories/ApplicationSignedDocumentRepository.java @@ -21,4 +21,7 @@ public interface ApplicationSignedDocumentRepository extends JpaRepository findAllByIsStatus(@Param("status")String status); + + ApplicationSignedDocumentEntity findByIdAndStatus(Long id, String status); + }