Merge branch 'develop' of https://github.com/Kitzanos/GEPAFIN-BE into develop

This commit is contained in:
rajesh
2026-02-23 14:36:53 +05:30
14 changed files with 96 additions and 17 deletions

View File

@@ -636,6 +636,7 @@ public class GepafinConstant {
public static final String APPLICATION_AMENDMENT_APPROPIATE_STATUS="amendment.appropiate.status"; public static final String APPLICATION_AMENDMENT_APPROPIATE_STATUS="amendment.appropiate.status";
public static final String UPLOAD_COMPANY_DOCUMENT_TO_APPLICATION_MSG="upload.company.document.to.application"; public static final String UPLOAD_COMPANY_DOCUMENT_TO_APPLICATION_MSG="upload.company.document.to.application";
public static final String COMPANY_DOCUMENT_NOT_FOUND_WITH_IDS="company.document.not.found.with.ids"; public static final String COMPANY_DOCUMENT_NOT_FOUND_WITH_IDS="company.document.not.found.with.ids";
public static final String REQUIRED_AMOUNT_FIELD_NOT_PROVIDED = "amount.field.not.provided";
} }

View File

@@ -1859,6 +1859,11 @@ public class ApplicationAmendmentRequestDao {
ApplicationEvaluationEntity oldApplicationEvaluationEntity = Utils.getClonedEntityForData(applicationEvaluationEntity); ApplicationEvaluationEntity oldApplicationEvaluationEntity = Utils.getClonedEntityForData(applicationEvaluationEntity);
ApplicationEntity applicationEntity=applicationDao.validateApplication(applicationEvaluationEntity.getApplicationId()); ApplicationEntity applicationEntity=applicationDao.validateApplication(applicationEvaluationEntity.getApplicationId());
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(applicationEntity); ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(applicationEntity);
if(Boolean.TRUE.equals(applicationAmendmentRequest.getAmendmentDocumentType().equals(AmendmentDocumentTypeEnum.BLUE_TONGUE))) {
if(applicationAmendmentRequest.getBlueTongueField1()==null || applicationAmendmentRequest.getBlueTongueField2()==null){
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.REQUIRED_AMOUNT_FIELD_NOT_PROVIDED));
}
}
if(Boolean.FALSE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.ADMISSIBLE.getValue()))) { if(Boolean.FALSE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.ADMISSIBLE.getValue()))) {
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.INVALID_APPLICATION_STATUS)); throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.INVALID_APPLICATION_STATUS));
@@ -1922,6 +1927,8 @@ public class ApplicationAmendmentRequestDao {
protocolDao.saveProtocolEntity(protocolEntity); protocolDao.saveProtocolEntity(protocolEntity);
applicationAmendmentRequestEntity.setProtocol(protocolEntity); applicationAmendmentRequestEntity.setProtocol(protocolEntity);
applicationAmendmentRequestEntity.setAmendmentDocumentType(applicationAmendmentRequest.getAmendmentDocumentType().getValue()); applicationAmendmentRequestEntity.setAmendmentDocumentType(applicationAmendmentRequest.getAmendmentDocumentType().getValue());
applicationAmendmentRequestEntity.setBlueTongueField1(applicationAmendmentRequest.getBlueTongueField1());
applicationAmendmentRequestEntity.setBlueTongueField2(applicationAmendmentRequest.getBlueTongueField2());
ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity, null, VersionActionTypeEnum.INSERT); ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity, null, VersionActionTypeEnum.INSERT);
log.info("Amendment request saved with ID={}", applicationAmendment.getId()); log.info("Amendment request saved with ID={}", applicationAmendment.getId());

View File

@@ -145,7 +145,7 @@ public class EmailNotificationDao {
List<AttachmentRequest> attachmentRequests =new ArrayList<>(); List<AttachmentRequest> attachmentRequests =new ArrayList<>();
List<String> urls=new ArrayList<>(); List<String> urls=new ArrayList<>();
List<DocumentEntity> documentEntities=new ArrayList<>(); List<DocumentEntity> documentEntities=new ArrayList<>();
if(systemEmailTemplateResponse.getEmailScenario().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED)) { if(systemEmailTemplateResponse.getEmailScenario().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED) || systemEmailTemplateResponse.getEmailScenario().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED_BLUE_TONGUE)) {
if(Boolean.TRUE.equals(AmendmentDocumentTypeEnum.ALTRE_GARANZIE.getValue().equals(applicationAmendmentRequest.getAmendmentDocumentType()))){ if(Boolean.TRUE.equals(AmendmentDocumentTypeEnum.ALTRE_GARANZIE.getValue().equals(applicationAmendmentRequest.getAmendmentDocumentType()))){
documentEntities=documentRepository.findBySourceInAndIsDeletedFalse(List.of(applicationAmendmentRequest.getAmendmentDocumentType(),"MODELLO_AUTOCERTIFICAZIONE","MODELLO_PRIVACY")); documentEntities=documentRepository.findBySourceInAndIsDeletedFalse(List.of(applicationAmendmentRequest.getAmendmentDocumentType(),"MODELLO_AUTOCERTIFICAZIONE","MODELLO_PRIVACY"));
}else { }else {
@@ -517,7 +517,11 @@ public class EmailNotificationDao {
public void sendMailforSpecialAmendment(ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity,ApplicationEntity applicationEntity) { public void sendMailforSpecialAmendment(ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity,ApplicationEntity applicationEntity) {
Map<String, String> bodyPlaceholders = prepareEmailPlaceholders(applicationEntity, applicationAmendmentRequestEntity); Map<String, String> bodyPlaceholders = prepareEmailPlaceholders(applicationEntity, applicationAmendmentRequestEntity);
sendEmail(applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED, bodyPlaceholders, null, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum systemEmailTemplatesEntityTypeEnum= SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED;
if(applicationAmendmentRequestEntity.getAmendmentDocumentType().equals(AmendmentDocumentTypeEnum.BLUE_TONGUE.getValue())){
systemEmailTemplatesEntityTypeEnum= SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED_BLUE_TONGUE;
}
sendEmail(applicationEntity,systemEmailTemplatesEntityTypeEnum, bodyPlaceholders, null,
applicationAmendmentRequestEntity.getId(),null); applicationAmendmentRequestEntity.getId(),null);
} }
public void sendEmailForApplicationContracted(ApplicationEntity applicationEntity,ApplicationContractEntity applicationContractEntity,UserEntity user) { public void sendEmailForApplicationContracted(ApplicationEntity applicationEntity,ApplicationContractEntity applicationContractEntity,UserEntity user) {

View File

@@ -5,6 +5,7 @@ import lombok.Data;
import org.hibernate.annotations.Where; import org.hibernate.annotations.Where;
import net.gepafin.tendermanagement.model.response.EmailSendResponse; import net.gepafin.tendermanagement.model.response.EmailSendResponse;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@@ -77,4 +78,10 @@ public class ApplicationAmendmentRequestEntity extends BaseEntity {
@Column(name = "AMENDMENT_INITIAL_DOCUMENT") @Column(name = "AMENDMENT_INITIAL_DOCUMENT")
private String amendmentInitialDocument; private String amendmentInitialDocument;
@Column(name = "BLUE_TONGUE_FIELD_1")
private BigDecimal blueTongueField1;
@Column(name = "BLUE_TONGUE_FIELD_2")
private BigDecimal blueTongueField2;
} }

View File

@@ -57,7 +57,8 @@ public class SystemEmailTemplatesEntity extends BaseEntity {
INADMISSIBILITY_TEMPLATE("INADMISSIBILITY_NOTIFICATION"), INADMISSIBILITY_TEMPLATE("INADMISSIBILITY_NOTIFICATION"),
APPLICATION_SUBMISSION_FAILURE_NOTIFICATION("APPLICATION_SUBMISSION_FAILURE_NOTIFICATION"), APPLICATION_SUBMISSION_FAILURE_NOTIFICATION("APPLICATION_SUBMISSION_FAILURE_NOTIFICATION"),
INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE("INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE"), INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE("INADMISSIBILITY_NOTIFICATION_DUE_TO_TECHNICAL_EVALUATION_FAILURE"),
SPECIAL_APPLICATION_AMENDMENT_REQUESTED("SPECIAL_APPLICATION_AMENDMENT_REQUESTED"); SPECIAL_APPLICATION_AMENDMENT_REQUESTED("SPECIAL_APPLICATION_AMENDMENT_REQUESTED"),
SPECIAL_APPLICATION_AMENDMENT_REQUESTED_BLUE_TONGUE("SPECIAL_APPLICATION_AMENDMENT_REQUESTED_BLUE_TONGUE");
private String value; private String value;
SystemEmailTemplatesEntityTypeEnum(String value) { SystemEmailTemplatesEntityTypeEnum(String value) {

View File

@@ -10,7 +10,9 @@ public enum AmendmentDocumentTypeEnum {
MCC_START_UP("MCC_START_UP"), MCC_START_UP("MCC_START_UP"),
ALTRE_GARANZIE("ALTRE_GARANZIE"); ALTRE_GARANZIE("ALTRE_GARANZIE"),
BLUE_TONGUE("BLUE_TONGUE");
private final String value; private final String value;

View File

@@ -15,6 +15,7 @@ public enum EmailScenarioTypeEnum {
APPLICATION_SUBMISSION_FAILURE("APPLICATION_SUBMISSION_FAILURE"), APPLICATION_SUBMISSION_FAILURE("APPLICATION_SUBMISSION_FAILURE"),
APPLICATION_TECHNICAL_EVALUATION_REJECTED("APPLICATION_TECHNICAL_EVALUATION_REJECTED"), APPLICATION_TECHNICAL_EVALUATION_REJECTED("APPLICATION_TECHNICAL_EVALUATION_REJECTED"),
SPECIAL_APPLICATION_AMENDMENT_REQUESTED("SPECIAL_APPLICATION_AMENDMENT_REQUESTED"), SPECIAL_APPLICATION_AMENDMENT_REQUESTED("SPECIAL_APPLICATION_AMENDMENT_REQUESTED"),
SPECIAL_APPLICATION_AMENDMENT_REQUESTED_BLUE_TONGUE("SPECIAL_APPLICATION_AMENDMENT_REQUESTED_BLUE_TONGUE"),
APPLICATION_CONTRACT_CREATED("APPLICATION_CONTRACT_CREATED"); APPLICATION_CONTRACT_CREATED("APPLICATION_CONTRACT_CREATED");
private final String value; private final String value;

View File

@@ -13,4 +13,8 @@ public class ApplicationAmendmentSpecialRequest {
private AmendmentDocumentTypeEnum amendmentDocumentType; private AmendmentDocumentTypeEnum amendmentDocumentType;
private String pec; private String pec;
private BigDecimal blueTongueField1;
private BigDecimal blueTongueField2;
} }

View File

@@ -156,4 +156,6 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
ApplicationAmendmentRequestEntity findByIdAndIsDeletedFalseAndStatusIn(Long id, List<String> statusList); ApplicationAmendmentRequestEntity findByIdAndIsDeletedFalseAndStatusIn(Long id, List<String> statusList);
ApplicationAmendmentRequestEntity findByApplicationIdAndIsDeletedFalseAndAmendmentDocumentTypeAndType(Long applicationId,String amendmentDocumentType, String type);
} }

View File

@@ -10,14 +10,13 @@ import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.dao.ApplicationDao; import net.gepafin.tendermanagement.dao.ApplicationDao;
import net.gepafin.tendermanagement.dao.EmailLogDao; import net.gepafin.tendermanagement.dao.EmailLogDao;
import net.gepafin.tendermanagement.dao.NotificationDao; import net.gepafin.tendermanagement.dao.NotificationDao;
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
import net.gepafin.tendermanagement.entities.ApplicationEntity; import net.gepafin.tendermanagement.entities.ApplicationEntity;
import net.gepafin.tendermanagement.entities.CompanyEntity; import net.gepafin.tendermanagement.entities.CompanyEntity;
import net.gepafin.tendermanagement.entities.EmailLogEntity; import net.gepafin.tendermanagement.entities.EmailLogEntity;
import net.gepafin.tendermanagement.enums.EmailScenarioTypeEnum; import net.gepafin.tendermanagement.enums.*;
import net.gepafin.tendermanagement.enums.EmailServiceTypeEnum;
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
import net.gepafin.tendermanagement.enums.StatusTypeEnum;
import net.gepafin.tendermanagement.model.request.*; import net.gepafin.tendermanagement.model.request.*;
import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepository;
import net.gepafin.tendermanagement.repositories.EmailLogRepository; import net.gepafin.tendermanagement.repositories.EmailLogRepository;
import net.gepafin.tendermanagement.service.CompanyService; import net.gepafin.tendermanagement.service.CompanyService;
import net.gepafin.tendermanagement.util.DateTimeUtil; import net.gepafin.tendermanagement.util.DateTimeUtil;
@@ -68,6 +67,9 @@ public class PecEmailService implements EmailService {
@Autowired @Autowired
private EmailLogRepository emailLogRepository; private EmailLogRepository emailLogRepository;
@Autowired
private ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
@Override @Override
public void sendEmail(String subject, String body, List<String> recipientEmails, EmailConfig emailConfig, EmailLogEntity emailLogEntity, Boolean isSendEmail) { public void sendEmail(String subject, String body, List<String> recipientEmails, EmailConfig emailConfig, EmailLogEntity emailLogEntity, Boolean isSendEmail) {
@@ -80,7 +82,7 @@ public class PecEmailService implements EmailService {
S3DocxProcessor processor = new S3DocxProcessor(s3Client); S3DocxProcessor processor = new S3DocxProcessor(s3Client);
List<String> urls = Utils.convertJsonStringToList(emailLogEntity.getAttachments(), String.class); List<String> urls = Utils.convertJsonStringToList(emailLogEntity.getAttachments(), String.class);
if(emailLogEntity.getEmailType().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED.getValue())) { if(emailLogEntity.getEmailType().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED.getValue()) || emailLogEntity.getEmailType().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED_BLUE_TONGUE.getValue()) ) {
ApplicationEntity applicationEntity = applicationDao.validateApplication(emailLogEntity.getApplicationId()); ApplicationEntity applicationEntity = applicationDao.validateApplication(emailLogEntity.getApplicationId());
CompanyEntity company = companyService.validateCompany(applicationEntity.getCompanyId()); CompanyEntity company = companyService.validateCompany(applicationEntity.getCompanyId());
String amount = Utils.convertToItalianFormat(String.valueOf(applicationEntity.getAmountAccepted())); String amount = Utils.convertToItalianFormat(String.valueOf(applicationEntity.getAmountAccepted()));
@@ -88,13 +90,27 @@ public class PecEmailService implements EmailService {
if (protocolNumber == null) { if (protocolNumber == null) {
protocolNumber = String.valueOf(applicationEntity.getProtocol().getProtocolNumber()); protocolNumber = String.valueOf(applicationEntity.getProtocol().getProtocolNumber());
} }
replacements = Map.of(
"{call_name}", applicationEntity.getCall().getName(), replacements.put("{call_name}", applicationEntity.getCall().getName());
"{amount_accepted}", amount, replacements.put("{amount_accepted}", amount);
"{pec}", "bandi.gepafin@legalmail.it", replacements.put("{pec}", "bandi.gepafin@legalmail.it");
"{company_name}", company.getCompanyName(), replacements.put("{company_name}", company.getCompanyName());
"{protocol_number}", protocolNumber replacements.put("{protocol_number}", protocolNumber);
);
if (emailLogEntity.getEmailType().equals(EmailScenarioTypeEnum.SPECIAL_APPLICATION_AMENDMENT_REQUESTED_BLUE_TONGUE.getValue())){
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity=applicationAmendmentRequestRepository.findByApplicationIdAndIsDeletedFalseAndAmendmentDocumentTypeAndType(applicationEntity.getId(), AmendmentDocumentTypeEnum.BLUE_TONGUE.getValue(),ApplicationAmendmentRequestTypeEnum.SPECIAL.getValue());
if(applicationAmendmentRequestEntity!=null){
if (applicationAmendmentRequestEntity.getBlueTongueField1() != null) {
replacements.put("{blue_tongue_field_1}",
Utils.convertToItalianFormat(applicationAmendmentRequestEntity.getBlueTongueField1().toString()));
}
if (applicationAmendmentRequestEntity.getBlueTongueField2() != null) {
replacements.put("{blue_tongue_field_2}",
Utils.convertToItalianFormat(applicationAmendmentRequestEntity.getBlueTongueField2().toString()));
}
}
}
} }
if (urls!=null && Boolean.FALSE.equals(urls.isEmpty())) { if (urls!=null && Boolean.FALSE.equals(urls.isEmpty())) {
Map<String, AttachmentRequest> processedFiles = null; Map<String, AttachmentRequest> processedFiles = null;

View File

@@ -3173,4 +3173,25 @@
<column name="company_document" type="VARCHAR(255)"></column> <column name="company_document" type="VARCHAR(255)"></column>
</addColumn> </addColumn>
</changeSet> </changeSet>
<changeSet id="22-02-2026_RK_132342" author="Rajesh Khore">
<insert tableName="document">
<column name="file_name" value="Comunicazione_esito_istruttoria_ammissibilita_delibera_Blue_Tongue.docx"/>
<column name="file_path" value="https://mementoresources.s3.amazonaws.com/gepafin/staging/template/Comunicazione_esito_istruttoria_ammissibilita_delibera_Blue_Tongue.docx"/>
<column name="source" value="BLUE_TONGUE"/>
<column name="type" value="DOCUMENT"/>
<column name="created_date" value="2026-02-22 00:00:00"/>
<column name="updated_date" value="2026-02-22 00:00:00"/>
</insert>
</changeSet>
<changeSet id="23-02-2026_RK_110012" author="Rajesh Khore">
<sqlFile dbms="postgresql" path="db/dump/insert_system_email_template_for_special_amendment_blue_tongue_23_02_2026.sql"/>
<addColumn tableName="application_amendment_request">
<column name="blue_tongue_field_1" type="numeric"/>
<column name="blue_tongue_field_2" type="numeric"/>
</addColumn>
</changeSet>
</databaseChangeLog> </databaseChangeLog>

View File

@@ -0,0 +1,11 @@
INSERT INTO gepafin_schema.system_email_template
( template_name, "type", html_content, subject, "json", "system", is_deleted, created_date, updated_date, email_scenario, hub_id)
VALUES( 'Special Amendment Creation Email', 'SPECIAL_APPLICATION_AMENDMENT_REQUESTED_BLUE_TONGUE', '<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, vi invitiamo a prendere visione del documento allegato con cui vi informiamo dell avvenuta delibera a valere sull Avviso in oggetto. </p>
<p>Distinti Saluti,</p>
<p><strong>{{email_signature}}</strong></p>
</div>
</body>
</html>', 'Comunicazione esito valutazione tecnica ed economico-finanziaria Avviso {{call_name}} ', NULL, true, false, '2026-02-22 20:00:00.000', '2026-02-22 20:00:00.000', 'SPECIAL_APPLICATION_AMENDMENT_REQUESTED_BLUE_TONGUE', NULL);

View File

@@ -428,7 +428,8 @@ mail.send.successfully=Mail sent succesfully.
email.log.fetched=Email log fetched successfully. email.log.fetched=Email log fetched successfully.
amendment.appropiate.status=Application amendment is not in appropiate status for this operation. amendment.appropiate.status=Application amendment is not in appropiate status for this operation.
upload.company.document.to.application=Uploaded company document to application successfully. upload.company.document.to.application=Uploaded company document to application successfully.
company.document.not.found.with.ids=Company document not found. Missing IDs: {0} company.document.not.found.with.ids=Company document not found. Missing IDs: {0}.
amount.field.not.provided= Please provide the required amount fields.

View File

@@ -420,3 +420,4 @@ email.log.fetched=Registro email recuperato correttamente.
amendment.appropiate.status=L'emendamento dell'applicazione non <20> in stato appropriato per questa operazione. amendment.appropiate.status=L'emendamento dell'applicazione non <20> in stato appropriato per questa operazione.
upload.company.document.to.application=Documento aziendale caricato correttamente nell'applicazione. upload.company.document.to.application=Documento aziendale caricato correttamente nell'applicazione.
company.document.not.found.with.ids=Documento aziendale non trovato. ID mancanti: {0} company.document.not.found.with.ids=Documento aziendale non trovato. ID mancanti: {0}
amount.field.not.provided= Si prega di fornire i campi obbligatori per l'importo.