From 8116bceffe03346ee0c18990660d0e5d72703cfe Mon Sep 17 00:00:00 2001 From: nisha Date: Mon, 17 Mar 2025 19:04:34 +0530 Subject: [PATCH] Changes for evaluation document --- .../dao/ApplicationEvaluationDao.java | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java index 0fd56e6c..787192d6 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java @@ -261,27 +261,32 @@ public class ApplicationEvaluationDao { for (EvaluationDocumentRequest doc : docRequest) { EvaluationDocumentResponse evaluationDocResponse = new EvaluationDocumentResponse(); if (doc.getFileValue() != null) { - Long fileId = Long.valueOf(doc.getFileValue().toString()); - documentRepository.findByIdAndNotDeleted(fileId).ifPresent(documentEntity -> { - DocumentResponseBean documentResponseBean = new DocumentResponseBean(); - documentResponseBean.setId(documentEntity.getId()); - documentResponseBean.setName(documentEntity.getFileName()); - documentResponseBean.setType(DocumentTypeEnum.valueOf(documentEntity.getType())); - documentResponseBean.setSource(DocumentSourceTypeEnum.valueOf(documentEntity.getSource())); - documentResponseBean.setSourceId(documentEntity.getSourceId()); - documentResponseBean.setFilePath(documentEntity.getFilePath()); - documentResponseBean.setCreatedDate(documentEntity.getCreatedDate()); - documentResponseBean.setUpdatedDate(documentEntity.getUpdatedDate()); - documentResponseBean.setDocumentAttachmentId(documentEntity.getDocumentAttachmentId()); - evaluationDocResponse.setFileValue(List.of(documentResponseBean)); - evaluationDocResponse.setNameValue(doc.getNameValue()); - evaluationDocResponse.setValid(doc.getValid()); - evaluationDocResponse.setFieldId(doc.getFieldId()); - }); - } - if (evaluationDocResponse.getFileValue() == null) { - continue; + if( Boolean.FALSE.equals(doc.getFileValue().isEmpty())) { + Long fileId = Long.valueOf(doc.getFileValue().toString()); + documentRepository.findByIdAndNotDeleted(fileId).ifPresent(documentEntity -> { + DocumentResponseBean documentResponseBean = new DocumentResponseBean(); + documentResponseBean.setId(documentEntity.getId()); + documentResponseBean.setName(documentEntity.getFileName()); + documentResponseBean.setType(DocumentTypeEnum.valueOf(documentEntity.getType())); + documentResponseBean.setSource(DocumentSourceTypeEnum.valueOf(documentEntity.getSource())); + documentResponseBean.setSourceId(documentEntity.getSourceId()); + documentResponseBean.setFilePath(documentEntity.getFilePath()); + documentResponseBean.setCreatedDate(documentEntity.getCreatedDate()); + documentResponseBean.setUpdatedDate(documentEntity.getUpdatedDate()); + documentResponseBean.setDocumentAttachmentId(documentEntity.getDocumentAttachmentId()); + evaluationDocResponse.setFileValue(List.of(documentResponseBean)); + }); + } + else { + evaluationDocResponse.setFileValue(null); + } + evaluationDocResponse.setNameValue(doc.getNameValue()); + evaluationDocResponse.setValid(doc.getValid()); + evaluationDocResponse.setFieldId(doc.getFieldId()); } +// if (evaluationDocResponse.getFileValue() == null) { +// continue; +// } evaluationDocResponses.add(evaluationDocResponse); } response.setEvaluationDocument(evaluationDocResponses); @@ -1963,8 +1968,10 @@ public class ApplicationEvaluationDao { for (EvaluationDocumentRequest doc : docRequest) { if (doc.getFileValue() != null) { - Long fileId = Long.valueOf(doc.getFileValue()); - documentService.validateDocument(fileId); + if(Boolean.FALSE.equals(doc.getFileValue().isEmpty())) { + Long fileId = Long.valueOf(doc.getFileValue()); + documentService.validateDocument(fileId); + } existingDocs.add(doc); } }