diff --git a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java index 37768891..45494d2b 100644 --- a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java +++ b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java @@ -267,5 +267,9 @@ public class GepafinConstant { public static final String COMMENT_UPDATED_SUCCESS_MSG = "comment.updated.successfully"; public static final String COMMENT_DELETED_SUCCESS_MSG = "comment.deleted.successfully"; public static final String COMMENT_NOT_ASSOCIATE_WITH_AMENDMENT_ID_ERROR_MSG = "comment.not.associate.with.amendment"; + public static final String AMENDMENT_FOUND_SUCCESS = "amendment.found.success"; + public static final String INVALID_AMENDMENT_FOR_COMMENT = "invalid.amendment.for.comment"; + + public static final String DD_MM_YYYY_HH_MM = "DD_MM_YYYY_HH_MM"; } diff --git a/src/main/java/net/gepafin/tendermanagement/dao/CommunicationAmendmentDao.java b/src/main/java/net/gepafin/tendermanagement/dao/CommunicationAmendmentDao.java index e5369f1d..790dd85f 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/CommunicationAmendmentDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/CommunicationAmendmentDao.java @@ -2,12 +2,22 @@ package net.gepafin.tendermanagement.dao; import net.gepafin.tendermanagement.config.Translator; import net.gepafin.tendermanagement.constants.GepafinConstant; -import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity; -import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity; +import net.gepafin.tendermanagement.entities.ApplicationEntity; +import net.gepafin.tendermanagement.entities.CallEntity; +import net.gepafin.tendermanagement.entities.CommunicationEntity; +import net.gepafin.tendermanagement.entities.CompanyEntity; +import net.gepafin.tendermanagement.entities.ProtocolEntity; +import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity; +import net.gepafin.tendermanagement.entities.UserEntity; import net.gepafin.tendermanagement.model.request.CommunicationRequestBean; +import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse; import net.gepafin.tendermanagement.model.response.CommunicationResponseBean; -import net.gepafin.tendermanagement.repositories.CommunicationAmendmentRepository; -import net.gepafin.tendermanagement.web.rest.api.ApplicationAmendmentRepository; +import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse; +import net.gepafin.tendermanagement.repositories.CommunicationRepository; +import net.gepafin.tendermanagement.service.SystemEmailTemplatesService; +import net.gepafin.tendermanagement.util.DateTimeUtil; +import net.gepafin.tendermanagement.util.MailUtil; +import net.gepafin.tendermanagement.util.Utils; import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException; import net.gepafin.tendermanagement.web.rest.api.errors.Status; import org.slf4j.Logger; @@ -15,112 +25,223 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.time.Instant; -import java.util.Optional; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @Component public class CommunicationAmendmentDao { private static final Logger log = LoggerFactory.getLogger(CommunicationAmendmentDao.class); @Autowired - CommunicationAmendmentRepository communicationAmendmentRepository; + CommunicationRepository communicationRepository; @Autowired ApplicationAmendmentRepository applicationAmendmentRepository; - // @Autowired - // ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository; + @Autowired + private MailUtil mailUtil; - public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationReq) { + @Autowired + private SystemEmailTemplatesService systemEmailTemplatesService; + + public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationReq, Long amendmentId) { log.info("Adding communication request..."); - - // Fetch amendment request by ID to set the relationship - ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRepository - .findAmendmentById(communicationReq.getAmendmentId()); - // Create and populate CommunicationAmendmentEntity - CommunicationAmendmentEntity communicationAmendmentEntity = new CommunicationAmendmentEntity(); - communicationAmendmentEntity.setAmendmentRequest(amendmentRequest); - communicationAmendmentEntity.setCommunicationTitle(communicationReq.getTitle()); - communicationAmendmentEntity.setCommunicationComment(communicationReq.getComment()); - communicationAmendmentEntity.setIsDeleted(false); - - // Save the communication amendment entity - communicationAmendmentEntity = communicationAmendmentRepository.save(communicationAmendmentEntity); - log.info("Added comment: {}", communicationAmendmentEntity); - - // Convert and return the response bean - return convertToCommunicationResponseBean(communicationAmendmentEntity); + CommunicationEntity communicationEntity = convertToCommunicationCommentEntity(communicationReq, amendmentId); + communicationEntity = communicationRepository.save(communicationEntity); + log.info("Added comment: {}", communicationEntity); + return convertToCommunicationResponseBean(communicationEntity); } public String deleteCommunicationAmendmentComment(Long amendmentId, Long commentId) { - // Optional amendmentData = communicationAmendmentRepository.findById(amendmentId); - // if(amendmentData.isEmpty()) { - // throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_ASSOCIATE_WITH_AMENDMENT_ID_ERROR_MSG)); - // } - Optional data = communicationAmendmentRepository.findById(commentId); - if (data.isEmpty()) { - throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)); + + CommunicationEntity data = communicationRepository.findById(commentId) + .orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND))); + if (!data.getAmendmentRequest().getId().equals(amendmentId)) { + throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.INVALID_AMENDMENT_FOR_COMMENT)); } - communicationAmendmentRepository.deleteById(commentId); + communicationRepository.deleteById(commentId); return "Deleted Comment Successfully."; } - public CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean) { + + public ApplicationAmendmentResponse getAmendmentComments(Long amendmentId) { + + ApplicationAmendmentRequestEntity amendmentData = applicationAmendmentRepository.findAmendmentById(amendmentId); + + if (amendmentData == null) { + throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.AMENDMENT_NOT_FOUND)); + } + List commentsList = communicationRepository.findCommentDetailsByAmendmentId(amendmentId); + if (commentsList == null) { + throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)); + } + return new ApplicationAmendmentResponse(amendmentData, commentsList); + } + + public CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) { log.info("Updating communication comment..."); - CommunicationAmendmentEntity communicationAmendmentEntity = convertToCommunicationAmendmentEntity(communicationRequestBean); - communicationAmendmentEntity = communicationAmendmentRepository.save(communicationAmendmentEntity); - log.info("Updated Comment {}", communicationAmendmentEntity); - return convertToCommunicationResponseBean(communicationAmendmentEntity); + CommunicationEntity existingComment = communicationRepository.findById(commentId) + .orElseThrow(() -> new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND))); + if (!existingComment.getAmendmentRequest().getId().equals(amendmentId)) { + throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.COMMENT_NOT_ASSOCIATE_WITH_AMENDMENT_ID_ERROR_MSG)); + } + existingComment.setCommunicationTitle(communicationRequestBean.getTitle()); + existingComment.setCommunicationComment(communicationRequestBean.getComment()); + existingComment.setCommentedDate(LocalDateTime.now()); + existingComment = communicationRepository.save(existingComment); + log.info("Updated Comment: {}", existingComment); + return convertToCommunicationResponseBean(existingComment); } - public CommunicationResponseBean getAmendmentComments(Long amendmentId, Long commentId) { - // Optional amendmentData = communicationAmendmentRepository.findById(amendmentId); - // if(amendmentData.isEmpty()) { - // throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.AMENDMENT_NOT_FOUND)); - // } - CommunicationAmendmentEntity commentData = communicationAmendmentRepository.findCommentsById(commentId); - CommunicationResponseBean data = convertToCommunicationResponseBean1(commentData); - return data; - } - private CommunicationResponseBean convertToCommunicationResponseBean(CommunicationAmendmentEntity entity) { + private CommunicationResponseBean convertToCommunicationResponseBean(CommunicationEntity entity) { CommunicationResponseBean response = new CommunicationResponseBean(); response.setComment(entity.getCommunicationComment()); - response.setCommunicationAddedDate(Instant.now()); - return response; - } - private CommunicationResponseBean convertToCommunicationResponseBean1(CommunicationAmendmentEntity entity) { - - CommunicationResponseBean response = new CommunicationResponseBean(); - response.setComment(entity.getCommunicationComment()); - response.setCommunicationAddedDate(Instant.now()); + response.setCommentedDate(entity.setCommentedDate();); + response.setAmendmentId(entity.getAmendmentRequest().getId()); + response.setCreatedDate(entity.getCreatedDate()); + response.setUpdatedDate(entity.getUpdatedDate()); return response; } - private CommunicationAmendmentEntity convertToCommunicationAmendmentEntity(CommunicationRequestBean communicationReq) { + private CommunicationEntity convertToCommunicationCommentEntity(CommunicationRequestBean communicationReq, Long amendmentId) { - CommunicationAmendmentEntity communicationAmendmentEntity = new CommunicationAmendmentEntity(); - ApplicationAmendmentRequestEntity entity = applicationAmendmentRepository.findAmendmentById(communicationReq.getAmendmentId()); - if (entity == null) { - throw new CustomValidationException(Status.NOT_FOUND, "Amendment Request not found for id: " + communicationReq.getAmendmentId()); - } - communicationAmendmentEntity.setAmendmentRequest(entity); - communicationAmendmentEntity.setCommunicationTitle(communicationReq.getComment()); - communicationAmendmentEntity.setCommunicationComment(communicationReq.getComment()); - return communicationAmendmentEntity; + ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRepository.findAmendmentById(amendmentId); + CommunicationEntity communicationEntity = new CommunicationEntity(); + communicationEntity.setAmendmentRequest(amendmentRequest); + communicationEntity.setCommunicationTitle(communicationReq.getTitle()); + communicationEntity.setCommunicationComment(communicationReq.getComment()); + communicationEntity.setIsDeleted(false); + communicationEntity.setCommentedDate(LocalDateTime.now()); + return communicationEntity; } - public ApplicationAmendmentRequestEntity getAmendmentRequestById(Long id) { - if(id==null){ - throw new CustomValidationException(Status.BAD_REQUEST, "Please provide amendmentId" + null); + private void sendMailToNotifyBeneficiaryRegardingNewAmendment(UserEntity userEntity, ApplicationEntity applicationEntity) { + CallEntity call = applicationEntity.getCall(); + CompanyEntity company = applicationEntity.getCompany(); + ProtocolEntity protocol = applicationEntity.getProtocol(); + SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService + .retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.DOCUMENTATION_INTEGRATION_REQUEST, + call, null); + + // Create the map for subject placeholders + Map subjectPlaceholders = new HashMap<>(); + subjectPlaceholders.put("{{call_name}}", call.getName()); + subjectPlaceholders.put("{{company_name}}", company.getCompanyName()); + + // Create the map for body placeholders + Map bodyPlaceholders = new HashMap<>(); + bodyPlaceholders.put("{{call_name}}", call.getName()); + bodyPlaceholders.put("{{protocol_number}}", protocol.getProtocolNumber().toString()); + bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(protocol.getCreatedDate())); + bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(protocol.getTime(), GepafinConstant.HH_MM_SS)); + bodyPlaceholders.put("{{form_dataInput}}", "YOUR_FORM_DATA_HERE"); + + // Replace placeholders in the subject and body + String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders); + String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders); + + String email = userEntity.getEmail(); + if (userEntity.getBeneficiary() != null) { + email = userEntity.getBeneficiary().getEmail(); } - ApplicationAmendmentRequestEntity applicationAmendmentData = applicationAmendmentRepository.findAmendmentById(id); - if(Boolean.FALSE.equals(applicationAmendmentData)){ - throw new CustomValidationException(Status.NOT_FOUND, "Amendment Request not found for id: " + applicationAmendmentData.getId()); + mailUtil.sendByMailGun(subject, body, List.of(email), null); + mailUtil.sendByMailGun(subject, body, List.of(applicationEntity.getCompany().getEmail()), null); + } + + public void sendApplicationFailureNotificationEmail(String userEmail, ApplicationEntity applicationEntity) { + CallEntity call = applicationEntity.getCall(); + CompanyEntity company = applicationEntity.getCompany(); + ProtocolEntity protocol = applicationEntity.getProtocol(); + SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService + .retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE, + call, null); + + // Create the map for subject placeholders + Map subjectPlaceholders = new HashMap<>(); + subjectPlaceholders.put("{{call_name}}", call.getName()); + subjectPlaceholders.put("{{company_name}}", company.getCompanyName()); + + // Create the map for body placeholders + Map bodyPlaceholders = new HashMap<>(); + bodyPlaceholders.put("{{call_name}}", call.getName()); + bodyPlaceholders.put("{{date_time_emailSend}}", DateTimeUtil.formatLocalDateTime(protocol.getCreatedDate(), GepafinConstant.DD_MM_YYYY_HH_MM)); + + // Replace placeholders in the subject and body + String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders); + String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders); + + mailUtil.sendByMailGun(subject, body, List.of(userEmail), null); + mailUtil.sendByMailGun(subject, body, List.of(applicationEntity.getCompany().getEmail()), null); + } + + private void sendAdmissibilityNotificationEmail(UserEntity userEntity, ApplicationEntity applicationEntity) { + CallEntity call = applicationEntity.getCall(); + CompanyEntity company = applicationEntity.getCompany(); + ProtocolEntity protocol = applicationEntity.getProtocol(); + SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService + .retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.ADMISSIBILITY_NOTIFICATION, + call, null); + + // Create the map for subject placeholders + Map subjectPlaceholders = new HashMap<>(); + subjectPlaceholders.put("{{call_name}}", call.getName()); + subjectPlaceholders.put("{{company_name}}", company.getCompanyName()); + + // Create the map for body placeholders + Map bodyPlaceholders = new HashMap<>(); + bodyPlaceholders.put("{{call_name}}", call.getName()); + bodyPlaceholders.put("{{protocol_number}}", protocol.getProtocolNumber().toString()); + bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(protocol.getCreatedDate())); + bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(protocol.getTime(), GepafinConstant.HH_MM_SS)); + + // Replace placeholders in the subject and body + String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders); + String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders); + + String email = userEntity.getEmail(); + if (userEntity.getBeneficiary() != null) { + email = userEntity.getBeneficiary().getEmail(); } - return applicationAmendmentData; + mailUtil.sendByMailGun(subject, body, List.of(email), null); + mailUtil.sendByMailGun(subject, body, List.of(applicationEntity.getCompany().getEmail()), null); + } + + private void sendInadmissibilityTemplateEmail(UserEntity userEntity, ApplicationEntity applicationEntity) { + CallEntity call = applicationEntity.getCall(); + CompanyEntity company = applicationEntity.getCompany(); + ProtocolEntity protocol = applicationEntity.getProtocol(); + SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService + .retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_TEMPLATE, + call, null); + + // Create the map for subject placeholders + Map subjectPlaceholders = new HashMap<>(); + subjectPlaceholders.put("{{call_name}}", call.getName()); + subjectPlaceholders.put("{{company_name}}", company.getCompanyName()); + + // Create the map for body placeholders + Map bodyPlaceholders = new HashMap<>(); + bodyPlaceholders.put("{{call_name}}", call.getName()); + bodyPlaceholders.put("{{protocol_number}}", protocol.getProtocolNumber().toString()); + bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(protocol.getCreatedDate())); + bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(protocol.getTime(), GepafinConstant.HH_MM_SS)); + bodyPlaceholders.put("{{form_text}}", "YOUR_FORM_TEXT_HERE"); // Replace with actual data input if available + + // Replace placeholders in the subject and body + String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders); + String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders); + + String email = userEntity.getEmail(); + if (userEntity.getBeneficiary() != null) { + email = userEntity.getBeneficiary().getEmail(); + } + mailUtil.sendByMailGun(subject, body, List.of(email), null); + mailUtil.sendByMailGun(subject, body, List.of(applicationEntity.getCompany().getEmail()), null); } } diff --git a/src/main/java/net/gepafin/tendermanagement/entities/ApplicationAmendmentRequestEntity.java b/src/main/java/net/gepafin/tendermanagement/entities/ApplicationAmendmentRequestEntity.java deleted file mode 100644 index 8e36d49d..00000000 --- a/src/main/java/net/gepafin/tendermanagement/entities/ApplicationAmendmentRequestEntity.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.gepafin.tendermanagement.entities; - -import jakarta.persistence.CascadeType; -import jakarta.persistence.Column; -import jakarta.persistence.ElementCollection; -import jakarta.persistence.Entity; -import jakarta.persistence.OneToMany; -import jakarta.persistence.Table; -import lombok.Data; - -import java.util.List; - -@Entity -@Table(name = "application_amendment_request") -@Data -public class ApplicationAmendmentRequestEntity extends BaseEntity { - - @Column(name = "NOTE") - private String note; - - @Column(name = "RESPONSE_DAYS") - private Long responseDays; - - @Column(name = "IS_NOTIFICATION") - private Boolean isNotification; - - @Column(name = "IS_EMAIL") - private Boolean isEmail; - - @ElementCollection - @Column(name = "FIELD_ID") - private List fieldId; - - @OneToMany(mappedBy = "amendmentRequest", cascade = CascadeType.ALL) - private List communicationAmendmentEntities; -} - diff --git a/src/main/java/net/gepafin/tendermanagement/entities/CommunicationAmendmentEntity.java b/src/main/java/net/gepafin/tendermanagement/entities/CommunicationEntity.java similarity index 67% rename from src/main/java/net/gepafin/tendermanagement/entities/CommunicationAmendmentEntity.java rename to src/main/java/net/gepafin/tendermanagement/entities/CommunicationEntity.java index 0665df52..48262afa 100644 --- a/src/main/java/net/gepafin/tendermanagement/entities/CommunicationAmendmentEntity.java +++ b/src/main/java/net/gepafin/tendermanagement/entities/CommunicationEntity.java @@ -1,18 +1,20 @@ package net.gepafin.tendermanagement.entities; +import com.fasterxml.jackson.annotation.JsonIgnore; import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import jakarta.persistence.Table; import lombok.Data; -import java.util.Optional; +import java.time.LocalDateTime; @Entity @Table(name = "communication_amendment") @Data -public class CommunicationAmendmentEntity extends BaseEntity { +public class CommunicationEntity extends BaseEntity { @Column(name = "COMMUNICATION_TITLE") private String communicationTitle; @@ -23,9 +25,7 @@ public class CommunicationAmendmentEntity extends BaseEntity { @Column(name = "IS_DELETED") private Boolean isDeleted; - @ManyToOne - @JoinColumn(name = "AMENDMENT_ID", referencedColumnName = "id", nullable = false) - private ApplicationAmendmentRequestEntity amendmentRequest; - -} + @Column(name = "COMMENTED_DATE") + private LocalDateTime commentedDate; +} \ No newline at end of file diff --git a/src/main/java/net/gepafin/tendermanagement/entities/SystemEmailTemplatesEntity.java b/src/main/java/net/gepafin/tendermanagement/entities/SystemEmailTemplatesEntity.java index 9ae12cbf..29e33277 100644 --- a/src/main/java/net/gepafin/tendermanagement/entities/SystemEmailTemplatesEntity.java +++ b/src/main/java/net/gepafin/tendermanagement/entities/SystemEmailTemplatesEntity.java @@ -39,7 +39,11 @@ public class SystemEmailTemplatesEntity extends BaseEntity { public enum SystemEmailTemplatesEntityTypeEnum { APPLICATION_SUBMISSION_TO_USER_AND_COMPANY("APPLICATION_SUBMISSION_TO_USER_AND_COMPANY"), - APPLICATION_SUBMISSION_TO_GEPAFIN("APPLICATION_SUBMISSION_TO_GEPAFIN"); + APPLICATION_SUBMISSION_TO_GEPAFIN("APPLICATION_SUBMISSION_TO_GEPAFIN"), + DOCUMENTATION_INTEGRATION_REQUEST("DOCUMENTATION_INTEGRATION_REQUEST"), + INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE("INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE"), + ADMISSIBILITY_NOTIFICATION("ADMISSIBILITY_NOTIFICATION"), + INADMISSIBILITY_TEMPLATE("INADMISSIBILITY_NOTIFICATION_2"); private String value; diff --git a/src/main/java/net/gepafin/tendermanagement/model/request/CommunicationRequestBean.java b/src/main/java/net/gepafin/tendermanagement/model/request/CommunicationRequestBean.java index 512b39be..d44e7eaa 100644 --- a/src/main/java/net/gepafin/tendermanagement/model/request/CommunicationRequestBean.java +++ b/src/main/java/net/gepafin/tendermanagement/model/request/CommunicationRequestBean.java @@ -6,6 +6,5 @@ import lombok.Data; public class CommunicationRequestBean { private String title; private String comment; - private Long amendmentId; } diff --git a/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationAmendmentResponse.java b/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationAmendmentResponse.java new file mode 100644 index 00000000..dcdf780b --- /dev/null +++ b/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationAmendmentResponse.java @@ -0,0 +1,15 @@ +package net.gepafin.tendermanagement.model.response; + +import lombok.Data; + +import java.util.List; + +@Data +public class ApplicationAmendmentResponse { + private ApplicationAmendmentRequestEntity amendment; + private List commentsList; + public ApplicationAmendmentResponse(ApplicationAmendmentRequestEntity amendment, List comments) { + this.amendment = amendment; + this.commentsList = comments; + } +} 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 ae69e24c..d1405dd8 100644 --- a/src/main/java/net/gepafin/tendermanagement/model/response/CommunicationResponseBean.java +++ b/src/main/java/net/gepafin/tendermanagement/model/response/CommunicationResponseBean.java @@ -2,10 +2,32 @@ package net.gepafin.tendermanagement.model.response; import lombok.Data; -import java.time.Instant; +import java.time.LocalDateTime; @Data public class CommunicationResponseBean { - private Instant communicationAddedDate; + private LocalDateTime commentedDate; + private String comment; + + private String title; + + private LocalDateTime createdDate; + + private LocalDateTime updatedDate; + + private Long amendmentId; + public CommunicationResponseBean(LocalDateTime commentedDate, String comment, String title, LocalDateTime createdDate, LocalDateTime updatedDate, Long amendmentId) { + + this.commentedDate = commentedDate; + this.comment = comment; + this.title = title; + this.createdDate = createdDate; + this.updatedDate = updatedDate; + this.amendmentId = amendmentId; + } + + public CommunicationResponseBean() { + + } } diff --git a/src/main/java/net/gepafin/tendermanagement/repositories/CommunicationAmendmentRepository.java b/src/main/java/net/gepafin/tendermanagement/repositories/CommunicationAmendmentRepository.java deleted file mode 100644 index 591e633e..00000000 --- a/src/main/java/net/gepafin/tendermanagement/repositories/CommunicationAmendmentRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.gepafin.tendermanagement.repositories; - -import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; - -import java.util.Optional; - -public interface CommunicationAmendmentRepository extends JpaRepository { - - @Query("Select c from CommunicationAmendmentEntity c Where c.id = :id") - CommunicationAmendmentEntity findCommentsById(@Param("id") Long id); -} diff --git a/src/main/java/net/gepafin/tendermanagement/repositories/CommunicationRepository.java b/src/main/java/net/gepafin/tendermanagement/repositories/CommunicationRepository.java new file mode 100644 index 00000000..e1edb157 --- /dev/null +++ b/src/main/java/net/gepafin/tendermanagement/repositories/CommunicationRepository.java @@ -0,0 +1,20 @@ +package net.gepafin.tendermanagement.repositories; + +import net.gepafin.tendermanagement.entities.CommunicationEntity; +import net.gepafin.tendermanagement.model.response.CommunicationResponseBean; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +public interface CommunicationRepository extends JpaRepository { + + @Query("Select c from CommunicationEntity c Where c.id = :id") + CommunicationEntity findCommentsById(@Param("id") Long id); + + @Query("SELECT new net.gepafin.tendermanagement.model.response.CommunicationResponseBean( " + "c.addedDate, c.communicationComment, c.communicationTitle, c.createdDate, c" + + ".updatedDate, c.amendmentRequest.id) " + "FROM CommunicationEntity c " + "WHERE c.amendmentRequest.id = :amendmentId AND c.isDeleted = false") + List findCommentDetailsByAmendmentId(@Param("amendmentId") Long amendmentId); + +} diff --git a/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java b/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java new file mode 100644 index 00000000..f0243da7 --- /dev/null +++ b/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java @@ -0,0 +1,72 @@ +//package net.gepafin.tendermanagement.scheduler; +// +//import net.gepafin.tendermanagement.dao.CommunicationAmendmentDao; +//import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity; +//import net.gepafin.tendermanagement.entities.ApplicationEntity; +//import net.gepafin.tendermanagement.entities.UserEntity; +//import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRepository; +//import net.gepafin.tendermanagement.repositories.ApplicationRepository; +//import net.gepafin.tendermanagement.repositories.UserRepository; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.scheduling.annotation.Scheduled; +//import org.springframework.stereotype.Component; +// +//import java.time.LocalDateTime; +//import java.util.List; +// +//@Component +//public class NotificationScheduler { +// +// @Autowired +// UserRepository userRepository; +// +// @Autowired +// ApplicationRepository applicationRepository; +// +// @Autowired +// ApplicationAmendmentRepository applicationAmendmentRepository; +// +// @Autowired +// CommunicationAmendmentDao communicationAmendmentDao; +// +// @Scheduled(cron = "0 0/10 * * * ?", zone = "Asia/Kolkata") +// void sendNotificationForRejectedApplicationToBeneficiary() { +// +// List applicationsList = applicationRepository.findByIsDeletedFalse(); +// List amendmentRequestList = applicationAmendmentRepository.findByIsDeletedFalse(); +// +// LocalDateTime today = LocalDateTime.now(); +// +// for (ApplicationEntity application : applicationsList) { +// ApplicationAmendmentRequestEntity amendmentRequest = getAmendmentRequestForApplication(application, amendmentRequestList); +// +// if (amendmentRequest != null) { +// LocalDateTime requestDate = amendmentRequest.getStartedDate(); +// +// // Check if requestDate + 7 days is less than or equal to today +// if (requestDate.plusDays(7).isAfter(today)) { +// // Update the application status to REJECTED +// application.setStatus("REJECTED"); +// applicationRepository.save(application); // Save updated application +// +// // Update the amendment request status to CLOSED +// amendmentRequest.setStatus("CLOSED"); +// applicationAmendmentRepository.save(amendmentRequest); // Save updated amendment request +// +// // Get the user associated with the application +// UserEntity user = userRepository.findById(application.getUserId()).orElse(null); // Adjust according to your UserRepository's method +// +// // Send email notification if user is found +// if (user != null && user.getEmail() != null) { +// communicationAmendmentDao.sendApplicationFailureNotificationEmail(user.getEmail(), application); +// } +// } +// } +// } +// } +// +// private ApplicationAmendmentRequestEntity getAmendmentRequestForApplication(ApplicationEntity application, List amendmentRequestList) { +// +// return amendmentRequestList.stream().filter(request -> request.getId().equals(application.getId())).findFirst().orElse(null); +// } +//} diff --git a/src/main/java/net/gepafin/tendermanagement/service/CommunicationAmendmentService.java b/src/main/java/net/gepafin/tendermanagement/service/CommunicationAmendmentService.java index a19f134f..23938f21 100644 --- a/src/main/java/net/gepafin/tendermanagement/service/CommunicationAmendmentService.java +++ b/src/main/java/net/gepafin/tendermanagement/service/CommunicationAmendmentService.java @@ -1,17 +1,15 @@ package net.gepafin.tendermanagement.service; -import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity; import net.gepafin.tendermanagement.model.request.CommunicationRequestBean; +import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse; import net.gepafin.tendermanagement.model.response.CommunicationResponseBean; -import java.util.Optional; - public interface CommunicationAmendmentService { - CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean); + CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean, Long amendmentId); String deleteCommunicationAmendmentComment(Long amendmentId, Long commentId); - CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean); + CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId); - CommunicationResponseBean getAmendmentComments(Long id, Long commentId); + ApplicationAmendmentResponse getAmendmentComments(Long id); } diff --git a/src/main/java/net/gepafin/tendermanagement/service/impl/CommunicationAmendmentServiceImpl.java b/src/main/java/net/gepafin/tendermanagement/service/impl/CommunicationAmendmentServiceImpl.java index 011999b0..3b0f8eb2 100644 --- a/src/main/java/net/gepafin/tendermanagement/service/impl/CommunicationAmendmentServiceImpl.java +++ b/src/main/java/net/gepafin/tendermanagement/service/impl/CommunicationAmendmentServiceImpl.java @@ -1,15 +1,13 @@ package net.gepafin.tendermanagement.service.impl; import net.gepafin.tendermanagement.dao.CommunicationAmendmentDao; -import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity; import net.gepafin.tendermanagement.model.request.CommunicationRequestBean; +import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse; import net.gepafin.tendermanagement.model.response.CommunicationResponseBean; import net.gepafin.tendermanagement.service.CommunicationAmendmentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Optional; - @Service public class CommunicationAmendmentServiceImpl implements CommunicationAmendmentService { @@ -17,8 +15,8 @@ public class CommunicationAmendmentServiceImpl implements CommunicationAmendment CommunicationAmendmentDao communicationAmendmentDao; @Override - public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean) { - return communicationAmendmentDao.addCommentToAmendmentRequest(communicationRequestBean); + public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean, Long amendmentId) { + return communicationAmendmentDao.addCommentToAmendmentRequest(communicationRequestBean,amendmentId); } @Override public String deleteCommunicationAmendmentComment(Long amendmentId, Long commentId) { @@ -26,13 +24,13 @@ public class CommunicationAmendmentServiceImpl implements CommunicationAmendment return communicationAmendmentDao.deleteCommunicationAmendmentComment(amendmentId, commentId); } @Override - public CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean) { + public CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) { - return communicationAmendmentDao.updateCommunicationAmendment(communicationRequestBean); + return communicationAmendmentDao.updateCommunicationAmendment(communicationRequestBean, amendmentId, commentId); } @Override - public CommunicationResponseBean getAmendmentComments(Long id, Long commentId) { + public ApplicationAmendmentResponse getAmendmentComments(Long id) { - return communicationAmendmentDao.getAmendmentComments(id, commentId); + return communicationAmendmentDao.getAmendmentComments(id); } } diff --git a/src/main/java/net/gepafin/tendermanagement/util/DateTimeUtil.java b/src/main/java/net/gepafin/tendermanagement/util/DateTimeUtil.java index 1fdf6c1a..ec7fe7d9 100644 --- a/src/main/java/net/gepafin/tendermanagement/util/DateTimeUtil.java +++ b/src/main/java/net/gepafin/tendermanagement/util/DateTimeUtil.java @@ -108,4 +108,12 @@ public class DateTimeUtil { return null; } } + public static String formatCreatedDate(LocalDateTime createdDate) { + + if (createdDate == null) { + return ""; + } + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); + return createdDate.format(formatter); + } } diff --git a/src/main/java/net/gepafin/tendermanagement/web/rest/api/ApplicationAmendmentRepository.java b/src/main/java/net/gepafin/tendermanagement/web/rest/api/ApplicationAmendmentRepository.java deleted file mode 100644 index d2a3984e..00000000 --- a/src/main/java/net/gepafin/tendermanagement/web/rest/api/ApplicationAmendmentRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.gepafin.tendermanagement.web.rest.api; - -import feign.Param; -import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import java.util.Optional; - -public interface ApplicationAmendmentRepository extends JpaRepository { - - @Query("SELECT app FROM ApplicationAmendmentRequestEntity app WHERE app.id = :id") - ApplicationAmendmentRequestEntity findAmendmentById(@Param("id") Long id); - -} diff --git a/src/main/java/net/gepafin/tendermanagement/web/rest/api/CommunicationAmendmentApi.java b/src/main/java/net/gepafin/tendermanagement/web/rest/api/CommunicationAmendmentApi.java index 35ff7d51..90627089 100644 --- a/src/main/java/net/gepafin/tendermanagement/web/rest/api/CommunicationAmendmentApi.java +++ b/src/main/java/net/gepafin/tendermanagement/web/rest/api/CommunicationAmendmentApi.java @@ -6,8 +6,8 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.responses.ApiResponse; import jakarta.servlet.http.HttpServletRequest; -import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity; import net.gepafin.tendermanagement.model.request.CommunicationRequestBean; +import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse; import net.gepafin.tendermanagement.model.response.CommunicationResponseBean; import net.gepafin.tendermanagement.model.util.Response; import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants; @@ -17,10 +17,10 @@ import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; - -import java.util.Optional; +import org.springframework.web.bind.annotation.RequestBody; @Validated public interface CommunicationAmendmentApi { @@ -31,19 +31,19 @@ public interface CommunicationAmendmentApi { @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })), @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) }) - @PostMapping(value = "", produces = { "application/json" }) - ResponseEntity> addCommentToAmendmentRequest(HttpServletRequest request, @Parameter CommunicationRequestBean communicationResponseBean); + @PostMapping(value = "/{amendmentId}", produces = { "application/json" }) + ResponseEntity> addCommentToAmendmentRequest(HttpServletRequest request, @RequestBody @Parameter CommunicationRequestBean communicationResponseBean, + @Param(value = "amendmentId") Long amendmentId); - @Operation(summary = "Api to Get Amendment request comment", responses = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { - @ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { - @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })), - @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { - @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) }) - @GetMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" }) - ResponseEntity> getAmendmentComments(HttpServletRequest request, @Param(value = "amendmentId") Long id, - @Param(value = "commentId") Long commentId); + @Operation(summary = "API to Get Amendment Request Comment", responses = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value = + ErrorConstants.NOTFOUND_ERROR_EXAMPLE))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value = + ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE))), + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value = + ErrorConstants.BADREQUEST_ERROR_EXAMPLE))) }) + @GetMapping(value = "/{amendmentId}", produces = "application/json") + public ResponseEntity> getAmendmentComments(@PathVariable Long amendmentId); @Operation(summary = "Api to update communication comments", responses = { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { @@ -52,8 +52,9 @@ public interface CommunicationAmendmentApi { @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })), @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) }) - @PutMapping(value = "", produces = { "application/json" }) - ResponseEntity> updateCommunicationAmendment(HttpServletRequest request, @Parameter CommunicationRequestBean communicationResponseBean); + @PutMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" }) + ResponseEntity> updateCommunicationAmendment(HttpServletRequest request, @RequestBody @Parameter CommunicationRequestBean communicationResponseBean, + @PathVariable Long amendmentId, @PathVariable Long commentId); @Operation(summary = "Api to delete communication comments", responses = { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { diff --git a/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/CommunicationAmendmentController.java b/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/CommunicationAmendmentController.java index 8e78df76..6510b753 100644 --- a/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/CommunicationAmendmentController.java +++ b/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/CommunicationAmendmentController.java @@ -3,8 +3,8 @@ package net.gepafin.tendermanagement.web.rest.api.impl; import jakarta.servlet.http.HttpServletRequest; import net.gepafin.tendermanagement.config.Translator; import net.gepafin.tendermanagement.constants.GepafinConstant; -import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity; import net.gepafin.tendermanagement.model.request.CommunicationRequestBean; +import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse; import net.gepafin.tendermanagement.model.response.CommunicationResponseBean; import net.gepafin.tendermanagement.model.util.Response; import net.gepafin.tendermanagement.service.CommunicationAmendmentService; @@ -16,8 +16,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.Optional; - @RestController @RequestMapping("${openapi.gepafin.base-path:/v1/communication-amendment}") public class CommunicationAmendmentController implements CommunicationAmendmentApi { @@ -26,32 +24,33 @@ public class CommunicationAmendmentController implements CommunicationAmendmentA CommunicationAmendmentService communicationAmendmentService; @Override - public ResponseEntity> addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationRequestBean) { + public ResponseEntity> addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationRequestBean, + Long amendmentId) { - CommunicationResponseBean communicationResponseBean = communicationAmendmentService.addCommentToAmendmentRequest(communicationRequestBean); + CommunicationResponseBean communicationResponseBean = communicationAmendmentService.addCommentToAmendmentRequest(communicationRequestBean, amendmentId); return ResponseEntity.status(HttpStatus.CREATED) .body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS))); } @Override - public ResponseEntity> getAmendmentComments(HttpServletRequest request, Long id, Long commentId) { + public ResponseEntity> getAmendmentComments(Long amendmentId) { - CommunicationResponseBean communicationResponseBean = communicationAmendmentService.getAmendmentComments(id, commentId); - return ResponseEntity.status(HttpStatus.CREATED) - .body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS))); + ApplicationAmendmentResponse response = communicationAmendmentService.getAmendmentComments(amendmentId); + return ResponseEntity.ok(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.AMENDMENT_FOUND_SUCCESS))); } @Override - public ResponseEntity> updateCommunicationAmendment(HttpServletRequest request, CommunicationRequestBean communicationRequestBean) { + public ResponseEntity> updateCommunicationAmendment(HttpServletRequest request, CommunicationRequestBean communicationRequestBean, + Long amendmentId, Long commentId) { - CommunicationResponseBean communicationResponseBean = communicationAmendmentService.updateCommunicationAmendment(communicationRequestBean); - return ResponseEntity.status(HttpStatus.CREATED) - .body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS))); + CommunicationResponseBean communicationResponseBean = communicationAmendmentService.updateCommunicationAmendment(communicationRequestBean, amendmentId, commentId); + return ResponseEntity.status(HttpStatus.OK) + .body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMENT_UPDATED_SUCCESS_MSG))); } @Override public ResponseEntity> deleteApplicationAmendmentComment(HttpServletRequest request, Long applicationAmendId, Long commentId) { String communicationResponseBean = communicationAmendmentService.deleteCommunicationAmendmentComment(applicationAmendId, commentId); - return ResponseEntity.status(HttpStatus.CREATED) - .body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS))); + return ResponseEntity.status(HttpStatus.OK) + .body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMENT_DELETED_SUCCESS_MSG))); } } diff --git a/src/main/resources/db/changelog/db.changelog-1.0.0.xml b/src/main/resources/db/changelog/db.changelog-1.0.0.xml index 133473c0..4959217d 100644 --- a/src/main/resources/db/changelog/db.changelog-1.0.0.xml +++ b/src/main/resources/db/changelog/db.changelog-1.0.0.xml @@ -1336,20 +1336,20 @@ - - - - - - + + + + + + - + @@ -1357,24 +1357,24 @@ - - - - + + + + - + @@ -1382,17 +1382,17 @@ - - - + + + @@ -1402,12 +1402,12 @@ - + @@ -1483,62 +1483,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/db/dump/insert_system_email_template_for_notification_mail_1_2_3_4.sql b/src/main/resources/db/dump/insert_system_email_template_for_notification_mail_1_2_3_4.sql new file mode 100644 index 00000000..2ae022d9 --- /dev/null +++ b/src/main/resources/db/dump/insert_system_email_template_for_notification_mail_1_2_3_4.sql @@ -0,0 +1,135 @@ +INSERT INTO gepafin_schema.system_email_template +( + id, template_name, "type", html_content, subject, "json", "system", + is_deleted, created_date, updated_date +) +VALUES +( + 3, + 'Instructional Aid/Request for Documentation Integration Template', + 'DOCUMENTATION_INTEGRATION_REQUEST', + ' + +
+

RICHIESTA INTEGRAZIONE DOCUMENTALE

+

Buongiorno,

+

In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Fondo prestiti + {{call_name}} di cui al Protocollo n. {{protocol_number}} del + {{protocol_date}} e {{protocol_time}}, alla luce dell’attività istruttoria svolta, + segnaliamo quanto segue:

+
    +
  • {{form_dataInput}}
  • +
+

Vi invitiamo a fornire quanto sopra richiesto integrando la documentazione sia caricandola all’interno dello sportello + online https://bandi.gepafin.it/ che inviandola a mezzo PEC all’indirizzo + bandi.gepafin@legalmail.it entro e non oltre 10 giorni dal ricevimento della presente comunicazione, + precisando che, in caso di mancata ricezione nei termini indicati, saremo costretti a non prendere in considerazione la Vostra richiesta di finanziamento.

+

Vi informiamo che per la ricezione della PEC farà fede la ricevuta di avvenuta consegna che attesterà il buon esito + dell’invio. La documentazione trasmessa e le informazioni fornite saranno processate dall''istruttore assegnatario della pratica.

+

Distinti Saluti,

+

Gepafin S.p.a.

+
+ + ', + 'BANDO {{call_name}} - Domanda di concessione di finanziamento agevolato {{company_name}}', + NULL, + true, + false, + '2024-10-26 20:00:00', + '2024-10-26 20:00:00' +); +INSERT INTO gepafin_schema.system_email_template +( + id, template_name, "type", html_content, subject, "json", "system", + is_deleted, created_date, updated_date +) +VALUES +( + 4, + 'Notification of Inadmissibility Due to Failure to Respond Template', + 'INADMISSIBILITY_NOTIFICATION', + ' + +
+

Comunicazione di non ammissibilità per mancata risposta a richiesta integrazione documentale

+

Buongiorno,

+

Con posta elettronica certificata del {{date_time_emailSend}}, vi abbiamo comunicato che i documenti richiesti + dal Gestore sarebbero dovuti pervenire entro 10 giorni dal ricevimento di detta comunicazione. + Trascorso il termine senza la ricezione dei documenti richiesti, il Gestore non ha potuto prendere in considerazione la richiesta di finanziamento.

+

È possibile presentare ricorso tramite modello disponibile nello sportello online + https://bandi.gepafin.it/ entro 10 giorni dalla ricezione di questa comunicazione.

+

Distinti Saluti,

+

Gepafin S.p.a.

+
+ + ', + 'BANDO {{call_name}} - Domanda di finanziamento agevolato non ammessa {{company_name}}', + NULL, + true, + false, + '2024-10-26 20:00:00', + '2024-10-26 20:00:00' +); +INSERT INTO gepafin_schema.system_email_template +( + id, template_name, "type", html_content, subject, "json", "system", + is_deleted, created_date, updated_date +) +VALUES +( + 5, + 'Notification of Admissibility Template', + 'ADMISSIBILITY_NOTIFICATION', + ' + +
+

Buongiorno,

+

In riferimento alla domanda di concessione di Finanziamento agevolato “{{call_name}}” di cui al + Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}, l’istruttoria di ammissibilità + è stata completata con esito positivo.

+

Seguirà una comunicazione relativa alla valutazione tecnica ed economico-finanziaria ai fini della valutazione finale.

+

Distinti Saluti,

+

Gepafin S.p.a.

+
+ + ', + 'BANDO {{call_name}} – Esito positivo istruttoria di ammissibilità {{company_name}}', + NULL, + true, + false, + '2024-10-26 20:00:00', + '2024-10-26 20:00:00' +); +INSERT INTO gepafin_schema.system_email_template +( + id, template_name, "type", html_content, subject, "json", "system", + is_deleted, created_date, updated_date +) +VALUES +( + 6, + 'Notification of Inadmissibility Template', + 'INADMISSIBILITY_NOTIFICATION', + ' + +
+

Buongiorno,

+

In riferimento alla domanda di concessione di Finanziamento agevolato “{{call_name}}” di cui al + Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}, + l''istruttoria di ammissibilità è stata completata con esito negativo.

+

Motivazioni: {{form_text}}

+

È possibile presentare ricorso tramite modello disponibile nello sportello online + https://bandi.gepafin.it/ entro 10 giorni dalla ricezione di questa comunicazione.

+

Distinti Saluti,

+

Gepafin S.p.a.

+
+ + ', + 'BANDO {{call_name}} – Esito negativo istruttoria di ammissibilità {{company_name}}', + NULL, + true, + false, + '2024-10-26 20:00:00', + '2024-10-26 20:00:00' +); +