Merge pull request #208 from Kitzanos/feature/GEPAFINBE-166

GEPAFINBE-166 (Linking the SystemEmailTemplate entity with the hub)
This commit is contained in:
Rinaldo
2025-02-11 09:46:24 +01:00
committed by GitHub
7 changed files with 126 additions and 81 deletions

View File

@@ -180,27 +180,27 @@ public class GepafinConstant {
public static final String UNAUTHORIZED = "UNAUTHORIZED"; public static final String UNAUTHORIZED = "UNAUTHORIZED";
public static final String COMPANY_ID_MANDATORY = "company.id.mandatory"; public static final String COMPANY_ID_MANDATORY = "company.id.mandatory";
public static final String USER_ALREADY_CONNECTED_TO_COMPANY = "user.already.connected.to.company"; public static final String USER_ALREADY_CONNECTED_TO_COMPANY = "user.already.connected.to.company";
public static final String YYYY_MM_DD_DASH = "yyyy-MM-dd"; public static final String YYYY_MM_DD_DASH = "yyyy-MM-dd";
public static final String YYYY_MM_DD_SLASH = "yyyy/MM/dd"; public static final String YYYY_MM_DD_SLASH = "yyyy/MM/dd";
public static final String DELEGATION_TEMPLATE = "DELEGATION_TEMPLATE"; public static final String DELEGATION_TEMPLATE = "DELEGATION_TEMPLATE";
public static final String VALIDATION_ERROR_MISSING_FIRSTNAME = "validation.error.missing.firstName"; public static final String VALIDATION_ERROR_MISSING_FIRSTNAME = "validation.error.missing.firstName";
public static final String VALIDATION_ERROR_MISSING_LASTNAME = "validation.error.missing.lastName"; public static final String VALIDATION_ERROR_MISSING_LASTNAME = "validation.error.missing.lastName";
public static final String VALIDATION_ERROR_MISSING_CODICEFISCALE = "validation.error.missing.codiceFiscale"; public static final String VALIDATION_ERROR_MISSING_CODICEFISCALE = "validation.error.missing.codiceFiscale";
public static final String DELEGATION_FILE_UPLOAD_SUCCESS = "delegation.file.upload.success"; public static final String DELEGATION_FILE_UPLOAD_SUCCESS = "delegation.file.upload.success";
public static final String DELEGATION_FETCH_SUCCESS = "delegation.fetch.success"; public static final String DELEGATION_FETCH_SUCCESS = "delegation.fetch.success";
public static final String DELEGATION_TEMPLATE_GENERATION_ERROR = "delegation.template.generation.error"; public static final String DELEGATION_TEMPLATE_GENERATION_ERROR = "delegation.template.generation.error";
public static final String VALIDATION_ERROR_FILE_EMPTY = "validation.error.file.empty"; public static final String VALIDATION_ERROR_FILE_EMPTY = "validation.error.file.empty";
public static final String VALIDATION_ERROR_FILE_INVALIDTYPE = "validation.error.file.invalidType"; public static final String VALIDATION_ERROR_FILE_INVALIDTYPE = "validation.error.file.invalidType";
public static final String UPLOAD_ERROR_S3 = "upload.error.s3"; public static final String UPLOAD_ERROR_S3 = "upload.error.s3";
public static final String CALL_NOT_STARTED_YET = "call.not.started.yet"; public static final String CALL_NOT_STARTED_YET = "call.not.started.yet";
public static final String CALL_ALREADY_ENDED = "call.already.ended"; public static final String CALL_ALREADY_ENDED = "call.already.ended";
public static final String APPLICATION_STATUS_UPDATED_SUCCESSFULLY = "application.status.updated.successfully"; public static final String APPLICATION_STATUS_UPDATED_SUCCESSFULLY = "application.status.updated.successfully";
public static final String APPLICATION_ALREADY_IN_PREVIOUS_STATUS = "application.already.in.provided.status"; public static final String APPLICATION_ALREADY_IN_PREVIOUS_STATUS = "application.already.in.provided.status";
public static final String DELEGATION_NOT_FOUND = "delegation.not.found"; public static final String DELEGATION_NOT_FOUND = "delegation.not.found";
public static final String USER_COMPANY_RELATION_NOT_FOUND = "user.company.relation.not.found"; public static final String USER_COMPANY_RELATION_NOT_FOUND = "user.company.relation.not.found";
public static final String DELEGATION_DELETE_SUCCESS = "delegation.delete.success"; public static final String DELEGATION_DELETE_SUCCESS = "delegation.delete.success";
public static final String HH_MM_SS = "HH:mm:ss"; public static final String HH_MM_SS = "HH:mm:ss";
public static final String USER_NOT_AUTHORIZED_TO_CREATE_APPLICATION = "user.not.authorized.create.application"; public static final String USER_NOT_AUTHORIZED_TO_CREATE_APPLICATION = "user.not.authorized.create.application";
public static final String APPLICATION_SUBMITTED_CANNOT_CHANGE = "application.submitted.cannot.change"; public static final String APPLICATION_SUBMITTED_CANNOT_CHANGE = "application.submitted.cannot.change";
@@ -218,11 +218,11 @@ public class GepafinConstant {
public static final String USER_ID_AND_BENEFICIARY_ID_ERROR = "userId.and.beneficiaryId.error"; public static final String USER_ID_AND_BENEFICIARY_ID_ERROR = "userId.and.beneficiaryId.error";
public static final String EITHER_USER_OR_BENEFICIARY_ID_REQUIRED = "either.user.or.beneficiary.id.required"; public static final String EITHER_USER_OR_BENEFICIARY_ID_REQUIRED = "either.user.or.beneficiary.id.required";
public static final String USER_NOT_FOUND_WITH_BENEFICIARYID_MSG = "User.not.found.with.the.given.beneficiaryID"; public static final String USER_NOT_FOUND_WITH_BENEFICIARYID_MSG = "User.not.found.with.the.given.beneficiaryID";
public static final String PERMISSION_DENIED = "permission.denied"; public static final String PERMISSION_DENIED = "permission.denied";
public static final String SIGNED_DOCUMENT_FILE_UPLOAD_SUCCESS = "signed.document.file.upload.success"; public static final String SIGNED_DOCUMENT_FILE_UPLOAD_SUCCESS = "signed.document.file.upload.success";
public static final String GET_SIGNED_DOCUMENT_FILE_SUCCESS = "get.signed.document.file.success"; public static final String GET_SIGNED_DOCUMENT_FILE_SUCCESS = "get.signed.document.file.success";
public static final String APPLICATION_SIGNED_DOCUMENT_NOT_FOUND = "application.signed.document.not.found"; public static final String APPLICATION_SIGNED_DOCUMENT_NOT_FOUND = "application.signed.document.not.found";
public static final String DELETE_SIGNED_DOCUMENT_FILE_SUCCESS = "delete.signed.document.file.success"; public static final String DELETE_SIGNED_DOCUMENT_FILE_SUCCESS = "delete.signed.document.file.success";
public static final String DD_MM_YYYY = "dd/MM/yyyy"; public static final String DD_MM_YYYY = "dd/MM/yyyy";
public static final String DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY="dashboard.widget.fetched.successfully"; public static final String DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY="dashboard.widget.fetched.successfully";
@@ -258,9 +258,9 @@ public class GepafinConstant {
public static final String HUB_GET_ALL_SUCCESS = "hub_get_all_success"; public static final String HUB_GET_ALL_SUCCESS = "hub_get_all_success";
public static final String HUB_DELETE_SUCCESS = "hub_delete_success"; public static final String HUB_DELETE_SUCCESS = "hub_delete_success";
public static final String HUB_NOT_FOUND = "hub_not_found"; public static final String HUB_NOT_FOUND = "hub_not_found";
public static final String EVALUATIONCRITERIA_INVALID = "evaluationCriteria.invalid"; public static final String EVALUATIONCRITERIA_INVALID = "evaluationCriteria.invalid";
public static final String APPLICATION_NOT_IN_DRAFT_STATUS="application.not.in.draft.status"; public static final String APPLICATION_NOT_IN_DRAFT_STATUS="application.not.in.draft.status";
public static final String GET_ERROR_S3 = "get.error.s3"; public static final String GET_ERROR_S3 = "get.error.s3";
public static final String BENEFICIARY_EMAIL_NOT_FOUND_MSG = "beneficiary.email.not.found.msg"; public static final String BENEFICIARY_EMAIL_NOT_FOUND_MSG = "beneficiary.email.not.found.msg";
public static final String ADDED_S3_PATH_STRUCTURE ="added.s3.path.structure"; public static final String ADDED_S3_PATH_STRUCTURE ="added.s3.path.structure";
public static final String S3_PATH_STRUCTURE_BY_TYPE ="fetched.s3.path.structure.by.type.successfully"; public static final String S3_PATH_STRUCTURE_BY_TYPE ="fetched.s3.path.structure.by.type.successfully";
@@ -391,7 +391,7 @@ public class GepafinConstant {
public static final String NON_EMPTY_TABLES="nonEmptyTables"; public static final String NON_EMPTY_TABLES="nonEmptyTables";
public static final String VALIDATION_IN_TABLE = "validation.table.message"; public static final String VALIDATION_IN_TABLE = "validation.table.message";
public static final String CALL_EXPIRED="call.expired"; public static final String CALL_EXPIRED="call.expired";
public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero"; public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero";
@@ -423,44 +423,8 @@ public class GepafinConstant {
public static final String FORMULA_AMOUNT_NOT_MATCHED="formula.amount.not.matches.requested.amount"; public static final String FORMULA_AMOUNT_NOT_MATCHED="formula.amount.not.matches.requested.amount";
public static final String CRITERIA_TABLE_COLUMNS="criteria_table_columns"; public static final String CRITERIA_TABLE_COLUMNS="criteria_table_columns";
public static final String DOCUMENTATION_INTEGRATION_REQUEST_SVILUPPUMBRIA= "<html>\n" +
" <body style=\"font-family: Arial, sans-serif; color: #000; line-height: 1.6;\">\n" +
" <div style=\"padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;\">\n" +
" <p><strong>RICHIESTA INTEGRAZIONE DOCUMENTALE</strong></p>\n" +
" <p>Buongiorno,</p>\n" +
" <p>In riferimento alla domanda di concessione di Finanziamento agevolato a valere sul Bando \n" +
" “<strong>{{call_name}}</strong>“ di cui al <strong>Protocollo n. {{protocol_number}} del\n" +
" {{protocol_date}} e {{protocol_time}}</strong>, alla luce dell'attività istruttoria svolta,\n" +
" segnaliamo quanto segue:\n" +
" </p>\n" +
" {{note}}\n" +
" <p>Vi invitiamo a fornire quanto sopra richiesto integrando la documentazione caricandola all'interno dello sportello\n" +
" online <a href=\"{{platform_link}}\">{{platform_link}}</a> entro e <strong>non oltre {{response_days}} giorni</strong> dal ricevimento della presente comunicazione,\n" +
" precisando che, in caso di mancata ricezione nei termini indicati, saremo costretti a non prendere in considerazione la Vostra richiesta di finanziamento.\n" +
" </p>\n" +
" <p>La documentazione trasmessa e le informazioni fornite saranno processate dall'istruttore assegnatario della pratica.\n" +
" </p>\n" +
" <p>Distinti Saluti,</p>\n" +
" <p><strong>{{email_signature}}</strong></p>\n" +
" </div>\n" +
" </body>\n" +
"</html>";
public static final String APPLICATION_REJECTED_SVILUPPUMBRIA = "<html>\n" +
" <body style=\"font-family: Arial, sans-serif; color: #000; line-height: 1.6;\">\n" +
" <div style=\"padding: 20px; border: 1px solid #ddd; border-radius: 8px; max-width: 600px; margin: auto;\">\n" +
" <p>Buongiorno,</p>\n" +
" <p>Si comunica che, in riferimento alla domanda a valere sul bando “<strong>{{call_name}}</strong>” di cui al\n" +
" <strong>Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}</strong>,\n" +
" la stessa è stata sottoposta ad istruttoria di ammissibilità con esito negativo.</p>\n" +
" <p>Le motivazioni sono le seguenti: <strong>{{form_text}}</strong></p>\n" +
" <p>Vi ricordiamo che i Beneficiari che hanno presentato richieste valutate non ammissibili entro 10 giorni dalla data di ricevimento della presente potranno finoltrare richiesta di chiarimenti e/o osservazioni alla scrivente Società ai sensi e per gli effetti dellart.10 bis della L.241/1990 e s.m.i.</p>\n" +
" <p>Distinti Saluti,</p>\n" +
" <p><strong>{{email_signature}}</strong></p>\n" +
" </div>\n" +
" </body>\n" +
"</html>";
} }

View File

@@ -94,19 +94,7 @@ public class EmailNotificationDao {
subjectPlaceholders.put("{{company_name}}", company.getCompanyName()); subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
// bodyPlaceholders.put("{{legal_mail}}", legalMail); // bodyPlaceholders.put("{{legal_mail}}", legalMail);
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders); String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
String body; String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
if ("t7jh5wfg9QXylNaTZkPoE".equals(hubEntity.getUniqueUuid()) && templateType.equals(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.DOCUMENTATION_INTEGRATION_REQUEST)) {
bodyPlaceholders.put("{{email_signature}}", hubEntity.getEmailSignature());
bodyPlaceholders.put("{{platform_link}}",hubEntity.getDomainName());
body = Utils.replacePlaceholders(GepafinConstant.DOCUMENTATION_INTEGRATION_REQUEST_SVILUPPUMBRIA, bodyPlaceholders);
}
else if ("t7jh5wfg9QXylNaTZkPoE".equals(hubEntity.getUniqueUuid()) && templateType.equals(SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_TEMPLATE)) {
bodyPlaceholders.put("{{email_signature}}", hubEntity.getEmailSignature());
body = Utils.replacePlaceholders(GepafinConstant.APPLICATION_REJECTED_SVILUPPUMBRIA, bodyPlaceholders);
}
else {
body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
}
return new EmailContentResponse(subject, body, systemEmailTemplateResponse); return new EmailContentResponse(subject, body, systemEmailTemplateResponse);
} }

View File

@@ -33,10 +33,10 @@ public class SystemEmailTemplatesDao {
public SystemEmailTemplateResponse retrieveTemplate(SystemEmailTemplatesEntityTypeEnum type, HubEntity hub, Locale language) { public SystemEmailTemplateResponse retrieveTemplate(SystemEmailTemplatesEntityTypeEnum type, HubEntity hub, Locale language) {
SystemEmailTemplatesEntity dbSystemEmailTemplatesEntity = null; SystemEmailTemplatesEntity dbSystemEmailTemplatesEntity = null;
if(hub != null){ if(hub != null){
// dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
// .findByTypeAndCallId(type.getValue(), call.getId()); .findByTypeAndHubEntityId(type.getValue(), hub.getId());
} }
if(dbSystemEmailTemplatesEntity == null) { if(dbSystemEmailTemplatesEntity == null){
dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
.findByType(type.getValue()); .findByType(type.getValue());
} }

View File

@@ -39,6 +39,11 @@ public class SystemEmailTemplatesEntity extends BaseEntity {
@Column(name = "email_scenario") @Column(name = "email_scenario")
private String emailScenario; private String emailScenario;
@ManyToOne
@JoinColumn(name = "HUB_ID")
private HubEntity hubEntity;
public enum SystemEmailTemplatesEntityTypeEnum { public enum SystemEmailTemplatesEntityTypeEnum {
APPLICATION_SUBMISSION_TO_USER_AND_COMPANY("APPLICATION_SUBMISSION_TO_USER_AND_COMPANY"), APPLICATION_SUBMISSION_TO_USER_AND_COMPANY("APPLICATION_SUBMISSION_TO_USER_AND_COMPANY"),

View File

@@ -14,4 +14,7 @@ public interface SystemEmailTemplatesRespository extends JpaRepository<SystemEma
@Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.isDeleted =false and s.system = true") @Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.isDeleted =false and s.system = true")
SystemEmailTemplatesEntity findByType(@Param("type") String type); SystemEmailTemplatesEntity findByType(@Param("type") String type);
@Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.hubEntity.id=:hubId and s.isDeleted =false and s.system = false")
SystemEmailTemplatesEntity findByTypeAndHubEntityId(@Param("type") String type, @Param("hubId") Long hubId);
} }

View File

@@ -2390,6 +2390,26 @@
<sqlFile dbms="postgresql" <sqlFile dbms="postgresql"
path="db/dump/update_form_field_data_06-02-2025.sql"/> path="db/dump/update_form_field_data_06-02-2025.sql"/>
</changeSet>
<changeSet id="11-02-2025_RK_111500" author="Rajesh Khore">
<addColumn tableName="system_email_template">
<column name="hub_id" type="INTEGER">
<constraints foreignKeyName="fk_hub_id"
references="hub(id)" />
</column>
</addColumn>
</changeSet>
<changeSet id="11-02-2025_RK_111515" author="Rajesh Khore">
<sql dbms="postgresql">select
setval('gepafin_schema.system_email_template_id_seq', (select
max(id)+1
from gepafin_schema.system_email_template), false)
</sql>
<sqlFile dbms="postgresql"
path="db/dump/insert_system_email_template_for_updating_amendment_mail_notification_mail_31_01_2024_1.sql"/>
</changeSet> </changeSet>

View File

@@ -0,0 +1,65 @@
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
(
'Instructional Aid/Request for Documentation Integration Template For Sviluppumbria',
'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 Bando
"<strong>{{call_name}}</strong>" di cui al <strong>Protocollo n. {{protocol_number}} del
{{protocol_date}} e {{protocol_time}}</strong>, alla luce dell''attività istruttoria svolta,
segnaliamo quanto segue:
</p>
{{note}}
<p>Vi invitiamo a fornire quanto sopra richiesto integrando la documentazione caricandola all''interno dello sportello
online <a href="{{platform_link}}">{{platform_link}}</a> entro e <strong>non oltre {{response_days}} 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>La documentazione trasmessa e le informazioni fornite saranno processate dall''istruttore assegnatario della pratica.
</p>
<p>Distinti Saluti,</p>
<p><strong>{{email_signature}}</strong></p>
</div>
</body>
</html>',
'BANDO {{call_name}}- Domanda di concessione di finanziamento agevolato {{company_name}}',
NULL,
false,
false,
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP,
'APPLICATION_AMENDMENT_REQUESTED',
2
);
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
(
'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>Si comunica che, in riferimento alla domanda a valere sul bando “<strong>{{call_name}}</strong>” di cui al
<strong>Protocollo n. {{protocol_number}} del {{protocol_date}} alle {{protocol_time}}</strong>,
la stessa è stata sottoposta ad istruttoria di ammissibilità con esito negativo.</p>
<p>Le motivazioni sono le seguenti: <strong>{{form_text}}</strong></p>
<p>Vi ricordiamo che i Beneficiari che hanno presentato richieste valutate non ammissibili entro 10 giorni dalla data di ricevimento della presente potranno finoltrare richiesta di chiarimenti e/o osservazioni alla scrivente Società ai sensi e per gli effetti dellart.10 bis della L.241/1990 e s.m.i.</p>
<p>Distinti Saluti,</p>
<p><strong>{{email_signature}}</strong></p>
</div>
</body>
</html>',
'BANDO {{call_name}} Esito negativo istruttoria di ammissibilità {{company_name}}',
NULL,
false,
false,
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP,
'APPLICATION_REJECTED',
2
);