Updated Code

This commit is contained in:
piyuskag
2024-10-27 16:07:56 +05:30
parent 452a661389
commit 90cdc9ba50
19 changed files with 574 additions and 302 deletions

View File

@@ -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";
}

View File

@@ -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<ApplicationAmendmentRequestEntity> 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<CommunicationAmendmentEntity> 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<CommunicationResponseBean> 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<ApplicationAmendmentRequestEntity> 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<String, String> subjectPlaceholders = new HashMap<>();
subjectPlaceholders.put("{{call_name}}", call.getName());
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
// Create the map for body placeholders
Map<String, String> 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<String, String> subjectPlaceholders = new HashMap<>();
subjectPlaceholders.put("{{call_name}}", call.getName());
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
// Create the map for body placeholders
Map<String, String> 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<String, String> subjectPlaceholders = new HashMap<>();
subjectPlaceholders.put("{{call_name}}", call.getName());
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
// Create the map for body placeholders
Map<String, String> 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<String, String> subjectPlaceholders = new HashMap<>();
subjectPlaceholders.put("{{call_name}}", call.getName());
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
// Create the map for body placeholders
Map<String, String> 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);
}
}

View File

@@ -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<String> fieldId;
@OneToMany(mappedBy = "amendmentRequest", cascade = CascadeType.ALL)
private List<CommunicationAmendmentEntity> communicationAmendmentEntities;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -6,6 +6,5 @@ import lombok.Data;
public class CommunicationRequestBean {
private String title;
private String comment;
private Long amendmentId;
}

View File

@@ -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<CommunicationResponseBean> commentsList;
public ApplicationAmendmentResponse(ApplicationAmendmentRequestEntity amendment, List<CommunicationResponseBean> comments) {
this.amendment = amendment;
this.commentsList = comments;
}
}

View File

@@ -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() {
}
}

View File

@@ -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<CommunicationAmendmentEntity, Long> {
@Query("Select c from CommunicationAmendmentEntity c Where c.id = :id")
CommunicationAmendmentEntity findCommentsById(@Param("id") Long id);
}

View File

@@ -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<CommunicationEntity, Long> {
@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<CommunicationResponseBean> findCommentDetailsByAmendmentId(@Param("amendmentId") Long amendmentId);
}

View File

@@ -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<ApplicationEntity> applicationsList = applicationRepository.findByIsDeletedFalse();
// List<ApplicationAmendmentRequestEntity> 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<ApplicationAmendmentRequestEntity> amendmentRequestList) {
//
// return amendmentRequestList.stream().filter(request -> request.getId().equals(application.getId())).findFirst().orElse(null);
// }
//}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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<ApplicationAmendmentRequestEntity, Long> {
@Query("SELECT app FROM ApplicationAmendmentRequestEntity app WHERE app.id = :id")
ApplicationAmendmentRequestEntity findAmendmentById(@Param("id") Long id);
}

View File

@@ -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<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, @Parameter CommunicationRequestBean communicationResponseBean);
@PostMapping(value = "/{amendmentId}", produces = { "application/json" })
ResponseEntity<Response<CommunicationResponseBean>> 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<Response<CommunicationResponseBean>> 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<Response<ApplicationAmendmentResponse>> 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<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request, @Parameter CommunicationRequestBean communicationResponseBean);
@PutMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
ResponseEntity<Response<CommunicationResponseBean>> 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 = {

View File

@@ -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<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationRequestBean) {
public ResponseEntity<Response<CommunicationResponseBean>> 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<Response<CommunicationResponseBean>> getAmendmentComments(HttpServletRequest request, Long id, Long commentId) {
public ResponseEntity<Response<ApplicationAmendmentResponse>> 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<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request, CommunicationRequestBean communicationRequestBean) {
public ResponseEntity<Response<CommunicationResponseBean>> 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<Response<String>> 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)));
}
}

View File

@@ -1336,20 +1336,20 @@
</changeSet>
<changeSet id="19-10-2024_2" author="Harish Bagora">
<modifyDataType tableName="protocol" columnName="HUB_ID" newDataType="INTEGER"/>
<modifyDataType tableName="protocol" columnName="HUB_ID" newDataType="INTEGER"/>
<addForeignKeyConstraint baseTableName="protocol"
baseColumnNames="HUB_ID"
constraintName="fk_protocol_hub"
referencedTableName="hub"
referencedColumnNames="id"/>
</changeSet>
<addForeignKeyConstraint baseTableName="protocol"
baseColumnNames="HUB_ID"
constraintName="fk_protocol_hub"
referencedTableName="hub"
referencedColumnNames="id"/>
</changeSet>
<changeSet id="24-10-2024_1" author="Rajesh Khore">
<dropUniqueConstraint
constraintName="company_vat_number_key"
tableName="company"/>
constraintName="company_vat_number_key"
tableName="company"/>
<addColumn tableName="company">
<column name="hub_id" type="INTEGER" defaultValue="1">
@@ -1358,23 +1358,23 @@
</addColumn>
<addUniqueConstraint
columnNames="VAT_NUMBER, hub_id"
tableName="company"
constraintName="uk_vat_hub" />
columnNames="VAT_NUMBER, hub_id"
tableName="company"
constraintName="uk_vat_hub"/>
<addForeignKeyConstraint
baseTableName="company"
baseColumnNames="hub_id"
referencedTableName="hub"
referencedColumnNames="id"
constraintName="fk_company_hub" />
baseTableName="company"
baseColumnNames="hub_id"
referencedTableName="hub"
referencedColumnNames="id"
constraintName="fk_company_hub"/>
</changeSet>
<changeSet id="24-10-2024_2" author="Rajesh Khore">
<dropUniqueConstraint
constraintName="beneficiary_codice_fiscale_key"
tableName="beneficiary"/>
constraintName="beneficiary_codice_fiscale_key"
tableName="beneficiary"/>
<addColumn tableName="beneficiary">
<column name="hub_id" type="INTEGER" defaultValue="1">
@@ -1383,16 +1383,16 @@
</addColumn>
<addUniqueConstraint
columnNames="CODICE_FISCALE, hub_id"
tableName="beneficiary"
constraintName="uk_codice_hub" />
columnNames="CODICE_FISCALE, hub_id"
tableName="beneficiary"
constraintName="uk_codice_hub"/>
<addForeignKeyConstraint
baseTableName="beneficiary"
baseColumnNames="hub_id"
referencedTableName="hub"
referencedColumnNames="id"
constraintName="fk_beneficiary_hub" />
baseTableName="beneficiary"
baseColumnNames="hub_id"
referencedTableName="hub"
referencedColumnNames="id"
constraintName="fk_beneficiary_hub"/>
</changeSet>
<changeSet id="24-10-2024_3" author="Rajesh Khore">
@@ -1403,11 +1403,11 @@
</addColumn>
<addForeignKeyConstraint
baseTableName="application"
baseColumnNames="hub_id"
referencedTableName="hub"
referencedColumnNames="id"
constraintName="fk_application_hub" />
baseTableName="application"
baseColumnNames="hub_id"
referencedTableName="hub"
referencedColumnNames="id"
constraintName="fk_application_hub"/>
</changeSet>
<changeSet id="25-10-2024_1" author="Piyush">
@@ -1483,62 +1483,4 @@
</insert>
</changeSet>
<changeSet id="25-10-2024_4" author="Piyush">
<createTable tableName="application_amendment_request">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="application_amendment_request_pkey"/>
</column>
<column name="note" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="response_days" type="INTEGER">
<constraints nullable="true"/>
</column>
<column name="is_notification" type="BOOLEAN">
<constraints nullable="true"/>
</column>
<column name="is_email" type="BOOLEAN">
<constraints nullable="true"/>
</column>
<column name="field_id" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet id="25-10-2024_3" author="Piyush">
<createTable tableName="communication_amendment">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true" primaryKeyName="communication_amendment_pkey"/>
</column>
<column name="communication_title" type="VARCHAR(255)">
<constraints nullable="true"/>
</column>
<column name="communication_comment" type="TEXT">
<constraints nullable="true"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/>
</column>
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
<column name="amendment_id" type="INTEGER">
<constraints nullable="false" foreignKeyName="fk_amendment_id" references="application_amendment_request(id)"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>

View File

@@ -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',
'<html>
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
<p><strong>RICHIESTA INTEGRAZIONE DOCUMENTALE</strong></p>
<p>Buongiorno,</p>
<p>In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Fondo prestiti
<strong>{{call_name}}</strong> di cui al Protocollo n. <strong>{{protocol_number}}</strong> del
<strong>{{protocol_date}}</strong> e <strong>{{protocol_time}}</strong>, alla luce dellattività istruttoria svolta,
segnaliamo quanto segue:</p>
<ul>
<li>{{form_dataInput}}</li>
</ul>
<p>Vi invitiamo a fornire quanto sopra richiesto integrando la documentazione sia caricandola allinterno dello sportello
online <a href="https://bandi.gepafin.it/">https://bandi.gepafin.it/</a> che inviandola a mezzo PEC allindirizzo
bandi.gepafin@legalmail.it entro e <strong>non oltre 10 giorni</strong> 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.</p>
<p>Vi informiamo che per la ricezione della PEC farà fede la ricevuta di avvenuta consegna che attesterà il buon esito
dellinvio. La documentazione trasmessa e le informazioni fornite saranno processate dall''istruttore assegnatario della pratica.</p>
<p>Distinti Saluti,</p>
<p><strong>Gepafin S.p.a.</strong></p>
</div>
</body>
</html>',
'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',
'<html>
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
<p><strong>Comunicazione di non ammissibilità per mancata risposta a richiesta integrazione documentale</strong></p>
<p>Buongiorno,</p>
<p>Con posta elettronica certificata del <strong>{{date_time_emailSend}}</strong>, vi abbiamo comunicato che i documenti richiesti
dal Gestore sarebbero dovuti pervenire entro <strong>10 giorni</strong> 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.</p>
<p>È possibile presentare ricorso tramite modello disponibile nello sportello online
<a href="https://bandi.gepafin.it/">https://bandi.gepafin.it/</a> entro <strong>10 giorni</strong> dalla ricezione di questa comunicazione.</p>
<p>Distinti Saluti,</p>
<p><strong>Gepafin S.p.a.</strong></p>
</div>
</body>
</html>',
'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',
'<html>
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
<p>Buongiorno,</p>
<p>In riferimento alla domanda di concessione di Finanziamento agevolato “<strong>{{call_name}}</strong>” di cui al
<strong>Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}</strong>, listruttoria di ammissibilità
è stata completata con esito positivo.</p>
<p>Seguirà una comunicazione relativa alla valutazione tecnica ed economico-finanziaria ai fini della valutazione finale.</p>
<p>Distinti Saluti,</p>
<p><strong>Gepafin S.p.a.</strong></p>
</div>
</body>
</html>',
'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',
'<html>
<body style="font-family: Arial, sans-serif; color: #000; line-height: 1.6;">
<div style="padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;">
<p>Buongiorno,</p>
<p>In riferimento alla domanda di concessione di Finanziamento agevolato “<strong>{{call_name}}</strong>” di cui al
<strong>Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}</strong>,
l''istruttoria di ammissibilità è stata completata con esito negativo.</p>
<p>Motivazioni: <strong>{{form_text}}</strong></p>
<p>È possibile presentare ricorso tramite modello disponibile nello sportello online
<a href="https://bandi.gepafin.it/">https://bandi.gepafin.it/</a> entro <strong>10 giorni</strong> dalla ricezione di questa comunicazione.</p>
<p>Distinti Saluti,</p>
<p><strong>Gepafin S.p.a.</strong></p>
</div>
</body>
</html>',
'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'
);