From bc11a40723b2c356040d8c23ce081285149761c3 Mon Sep 17 00:00:00 2001 From: rajesh Date: Mon, 25 Nov 2024 12:57:05 +0530 Subject: [PATCH 1/2] Fix issue related to senderUserId and receiverUserId --- .../tendermanagement/dao/CommunicationDao.java | 2 +- .../model/response/CommunicationResponseBean.java | 12 ++++++++++++ .../repositories/CommunicationRepository.java | 5 +++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/gepafin/tendermanagement/dao/CommunicationDao.java b/src/main/java/net/gepafin/tendermanagement/dao/CommunicationDao.java index 75926512..b752a755 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/CommunicationDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/CommunicationDao.java @@ -58,7 +58,7 @@ public class CommunicationDao { public ApplicationAmendmentResponse getAmendmentComments(Long amendmentId) { ApplicationAmendmentRequestEntity amendmentData = applicationAmendmentRequestService.validateApplicationAmendmentRequest(amendmentId); - List commentsList = communicationRepository.findCommentDetailsByAmendmentId(amendmentId); + List commentsList = communicationRepository.findCommentListDetailsByAmendmentId(amendmentId); if (commentsList == null) { throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)); } diff --git a/src/main/java/net/gepafin/tendermanagement/model/response/CommunicationResponseBean.java b/src/main/java/net/gepafin/tendermanagement/model/response/CommunicationResponseBean.java index 13afde4b..4593db84 100644 --- a/src/main/java/net/gepafin/tendermanagement/model/response/CommunicationResponseBean.java +++ b/src/main/java/net/gepafin/tendermanagement/model/response/CommunicationResponseBean.java @@ -31,6 +31,18 @@ public class CommunicationResponseBean { this.amendmentId = amendmentId; } + public CommunicationResponseBean(LocalDateTime commentedDate, String comment, String title, LocalDateTime createdDate, LocalDateTime updatedDate, Long amendmentId,Long senderUserId,Long receiverUserId) { + + this.commentedDate = commentedDate; + this.comment = comment; + this.title = title; + this.createdDate = createdDate; + this.updatedDate = updatedDate; + this.amendmentId = amendmentId; + this.senderUserId = senderUserId; + this.receiverUserId = receiverUserId; + } + public CommunicationResponseBean() { } diff --git a/src/main/java/net/gepafin/tendermanagement/repositories/CommunicationRepository.java b/src/main/java/net/gepafin/tendermanagement/repositories/CommunicationRepository.java index 0e9d8d9c..f92b9a06 100644 --- a/src/main/java/net/gepafin/tendermanagement/repositories/CommunicationRepository.java +++ b/src/main/java/net/gepafin/tendermanagement/repositories/CommunicationRepository.java @@ -15,7 +15,8 @@ public interface CommunicationRepository extends JpaRepository findCommentsByApplicationAmendmentRequestId(@Param("applicationAmendmentRequestId") Long amendmentRequestId); @Query("SELECT new net.gepafin.tendermanagement.model.response.CommunicationResponseBean( " + "c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c" + - ".updatedDate, c.applicationAmendmentRequest.id) " + "FROM CommunicationEntity c " + "WHERE c.applicationAmendmentRequest.id = :amendmentId AND c.isDeleted = false") - List findCommentDetailsByAmendmentId(@Param("amendmentId") Long amendmentId); + ".updatedDate, c.applicationAmendmentRequest.id,c.senderUserId, c.receiverUserId) " + "FROM CommunicationEntity c " + "WHERE c.applicationAmendmentRequest.id = :amendmentId AND c.isDeleted = false") + List findCommentListDetailsByAmendmentId(@Param("amendmentId") Long amendmentId); + } From 04aaa23c2cddb5c50a4540fcaa6d18332fbeb834 Mon Sep 17 00:00:00 2001 From: rajesh Date: Mon, 25 Nov 2024 15:20:10 +0530 Subject: [PATCH 2/2] updated code for document --- .../java/net/gepafin/tendermanagement/dao/DocumentDao.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/gepafin/tendermanagement/dao/DocumentDao.java b/src/main/java/net/gepafin/tendermanagement/dao/DocumentDao.java index 71655909..4f0f3144 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/DocumentDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/DocumentDao.java @@ -109,7 +109,8 @@ public class DocumentDao { } public void deleteFile(Long documentId) { - DocumentEntity documentEntity = validateDocument(documentId); + DocumentEntity documentEntity = documentRepository.findById(documentId).orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, + Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND))); // String fileName= Utils.extractFileName(documentEntity.getFilePath()); // deleteFileOnAmazonS3(fileName); documentEntity.setIsDeleted(true);