Done ticket GEPAFINBE-166

This commit is contained in:
rajesh
2025-02-11 11:38:56 +05:30
parent 93f663826c
commit acab068ef1
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 COMPANY_ID_MANDATORY = "company.id.mandatory";
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_SLASH = "yyyy/MM/dd";
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_LASTNAME = "validation.error.missing.lastName";
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_FETCH_SUCCESS = "delegation.fetch.success";
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_INVALIDTYPE = "validation.error.file.invalidType";
public static final String UPLOAD_ERROR_S3 = "upload.error.s3";
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 DELEGATION_TEMPLATE = "DELEGATION_TEMPLATE";
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_CODICEFISCALE = "validation.error.missing.codiceFiscale";
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_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_INVALIDTYPE = "validation.error.file.invalidType";
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_ALREADY_ENDED = "call.already.ended";
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 DELEGATION_NOT_FOUND = "delegation.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 HH_MM_SS = "HH:mm:ss";
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 DELEGATION_DELETE_SUCCESS = "delegation.delete.success";
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 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 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 PERMISSION_DENIED = "permission.denied";
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 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 PERMISSION_DENIED = "permission.denied";
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 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 DD_MM_YYYY = "dd/MM/yyyy";
public static final String DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY="dashboard.widget.fetched.successfully";
@@ -251,16 +251,16 @@ public class GepafinConstant {
public static final String DELETE_ASSIGNED_APPLICATION_SUCCESS_MSG = "assigned.application.deleted.success";
public static final String GET_ASSIGNED_APPLICATION_SUCCESS_MSG = "assigned.application.get.success";
public static final String ASSIGNED_APPLICATION_UPDATE_SUCCESSFULLY_MSG = "assigned.application.update.successfully";
public static final String HUB_CREATE_SUCCESS = "hub_create_success";
public static final String HUB_UPDATE_SUCCESS = "hub_update_success";
public static final String HUB_GET_SUCCESS = "hub_get_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_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 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 ADDED_S3_PATH_STRUCTURE ="added.s3.path.structure";
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 VALIDATION_IN_TABLE = "validation.table.message";
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";
@@ -410,44 +410,8 @@ public class GepafinConstant {
public static final String REQUIRED_REQUESTED_AMOUNT_MSG = "validation.required.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 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());
// bodyPlaceholders.put("{{legal_mail}}", legalMail);
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
String body;
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);
}
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
return new EmailContentResponse(subject, body, systemEmailTemplateResponse);
}

View File

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

View File

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

View File

@@ -13,5 +13,8 @@ public interface SystemEmailTemplatesRespository extends JpaRepository<SystemEma
@Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.isDeleted =false and s.system = true")
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);
}