Merge pull request #307 from Kitzanos/feature/GEPAFINBE-227

GEPAFINBE-227 (Update Protocol Data Using Updated External Protocol Input)
This commit is contained in:
Rinaldo
2025-06-06 11:48:28 +02:00
committed by GitHub
6 changed files with 81 additions and 19 deletions

View File

@@ -1,5 +1,6 @@
package net.gepafin.tendermanagement.dao; package net.gepafin.tendermanagement.dao;
import com.amazonaws.services.dynamodbv2.xspec.S;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
@@ -1158,8 +1159,16 @@ public class ApplicationDao {
// Create the map for body placeholders // Create the map for body placeholders
Map<String, String> bodyPlaceholders = new HashMap<>(); Map<String, String> bodyPlaceholders = new HashMap<>();
bodyPlaceholders.put("{{call_name}}", call.getName()); bodyPlaceholders.put("{{call_name}}", call.getName());
bodyPlaceholders.put("{{protocol_number}}", protocol.getProtocolNumber().toString()); String protocolNumber=applicationEntity.getProtocol().getExternalProtocolNumber();
bodyPlaceholders.put("{{date}}", DateTimeUtil.formatLocalDateTime(protocol.getCreatedDate(), GepafinConstant.DD_MM_YYYY)); if(protocolNumber==null){
protocolNumber= String.valueOf(applicationEntity.getProtocol().getProtocolNumber());
}
bodyPlaceholders.put("{{protocol_number}}",protocolNumber);
String protocolDate= DateTimeUtil.formatLocalDateTime(protocol.getCreatedDate(), GepafinConstant.DD_MM_YYYY);
if(protocol.getExternalProtocolDate()!=null){
protocolDate= DateTimeUtil.formatLocalDateTime(protocol.getExternalProtocolDate(), GepafinConstant.DD_MM_YYYY);
}
bodyPlaceholders.put("{{date}}", protocolDate);
bodyPlaceholders.put("{{time}}", DateTimeUtil.parseLocalTimeToString(protocol.getTime(), GepafinConstant.HH_MM_SS)); bodyPlaceholders.put("{{time}}", DateTimeUtil.parseLocalTimeToString(protocol.getTime(), GepafinConstant.HH_MM_SS));
// Replace placeholders in the subject and body // Replace placeholders in the subject and body
@@ -1209,8 +1218,17 @@ public class ApplicationDao {
// Create the map for body placeholders // Create the map for body placeholders
Map<String, String> bodyPlaceholders = new HashMap<>(); Map<String, String> bodyPlaceholders = new HashMap<>();
bodyPlaceholders.put("{{call_name}}", call.getName()); bodyPlaceholders.put("{{call_name}}", call.getName());
bodyPlaceholders.put("{{protocol_number}}", protocol.getProtocolNumber().toString()); String protocolNumber=applicationEntity.getProtocol().getExternalProtocolNumber();
bodyPlaceholders.put("{{date}}", DateTimeUtil.formatLocalDateTime(protocol.getCreatedDate(), GepafinConstant.DD_MM_YYYY));
if(protocolNumber==null){
protocolNumber= String.valueOf(applicationEntity.getProtocol().getProtocolNumber());
}
String protocolDate= DateTimeUtil.formatLocalDateTime(protocol.getCreatedDate(), GepafinConstant.DD_MM_YYYY);
if(protocol.getExternalProtocolDate()!=null){
protocolDate= DateTimeUtil.formatLocalDateTime(protocol.getExternalProtocolDate(), GepafinConstant.DD_MM_YYYY);
}
bodyPlaceholders.put("{{protocol_number}}", protocolNumber);
bodyPlaceholders.put("{{date}}",protocolDate);
bodyPlaceholders.put("{{time}}", DateTimeUtil.parseLocalTimeToString(protocol.getTime(), GepafinConstant.HH_MM_SS)); bodyPlaceholders.put("{{time}}", DateTimeUtil.parseLocalTimeToString(protocol.getTime(), GepafinConstant.HH_MM_SS));
// Replace placeholders in the subject and body // Replace placeholders in the subject and body
@@ -2328,7 +2346,11 @@ public class ApplicationDao {
bodyPlaceholders.put("{{call_name}}", call.getName()); bodyPlaceholders.put("{{call_name}}", call.getName());
bodyPlaceholders.put("{{application_id}}", applicationEntity.getId().toString()); bodyPlaceholders.put("{{application_id}}", applicationEntity.getId().toString());
bodyPlaceholders.put("{{company_name}}", company.getCompanyName()); bodyPlaceholders.put("{{company_name}}", company.getCompanyName());
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString()); String protocolNumber=applicationEntity.getProtocol().getExternalProtocolNumber();
if(protocolNumber==null){
protocolNumber= String.valueOf(applicationEntity.getProtocol().getProtocolNumber());
}
bodyPlaceholders.put("{{protocol_number}}", protocolNumber);
bodyPlaceholders.put("{{user_action_id}}",emailLogRequest.getUserActionId().toString()); bodyPlaceholders.put("{{user_action_id}}",emailLogRequest.getUserActionId().toString());
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders); String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);

View File

@@ -710,7 +710,11 @@ public class ApplicationEvaluationDao {
Map<String, String> placeHolders = new HashMap<>(); Map<String, String> placeHolders = new HashMap<>();
placeHolders.put("{{call_name}}", application.getCall().getName()); placeHolders.put("{{call_name}}", application.getCall().getName());
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber())); String protocolNumber=application.getProtocol().getExternalProtocolNumber();
if(protocolNumber==null){
protocolNumber= String.valueOf(application.getProtocol().getProtocolNumber());
}
placeHolders.put("{{protocol_number}}", protocolNumber);
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_CREATION); notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_CREATION);
notificationDao.sendNotificationToInstructor(placeHolders,entity,NotificationTypeEnum.EVALUATION_CREATION); notificationDao.sendNotificationToInstructor(placeHolders,entity,NotificationTypeEnum.EVALUATION_CREATION);
@@ -1997,7 +2001,11 @@ public class ApplicationEvaluationDao {
Map<String, String> placeHolders = new HashMap<>(); Map<String, String> placeHolders = new HashMap<>();
placeHolders.put("{{call_name}}", application.getCall().getName()); placeHolders.put("{{call_name}}", application.getCall().getName());
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber())); String protocolNumber=application.getProtocol().getExternalProtocolNumber();
if(protocolNumber==null){
protocolNumber= String.valueOf(application.getProtocol().getProtocolNumber());
}
placeHolders.put("{{protocol_number}}", protocolNumber);
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_RESULT); notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_RESULT);
notificationDao.sendNotificationToInstructor(placeHolders,existingEntity,NotificationTypeEnum.EVALUATION_RESULT); notificationDao.sendNotificationToInstructor(placeHolders,existingEntity,NotificationTypeEnum.EVALUATION_RESULT);

View File

@@ -174,8 +174,16 @@ public class EmailNotificationDao {
public Map<String, String> prepareEmailPlaceholders(ApplicationEntity applicationEntity, ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity){ public Map<String, String> prepareEmailPlaceholders(ApplicationEntity applicationEntity, ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity){
Map<String, String> bodyPlaceholders = new HashMap<>(); Map<String, String> bodyPlaceholders = new HashMap<>();
bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName()); bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString()); String protocolNumber=applicationEntity.getProtocol().getExternalProtocolNumber();
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatLocalDateTime(applicationEntity.getProtocol().getCreatedDate(), GepafinConstant.DD_MM_YYYY)); if(protocolNumber==null){
protocolNumber= String.valueOf(applicationEntity.getProtocol().getProtocolNumber());
}
bodyPlaceholders.put("{{protocol_number}}", protocolNumber);
String protocolDate= DateTimeUtil.formatLocalDateTime(applicationEntity.getProtocol().getCreatedDate(), GepafinConstant.DD_MM_YYYY);
if(applicationEntity.getProtocol().getExternalProtocolDate()!=null){
protocolDate= DateTimeUtil.formatLocalDateTime(applicationEntity.getProtocol().getExternalProtocolDate(), GepafinConstant.DD_MM_YYYY);
}
bodyPlaceholders.put("{{protocol_date}}", protocolDate);
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationEntity.getProtocol().getTime(), GepafinConstant.HH_MM_SS)); bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationEntity.getProtocol().getTime(), GepafinConstant.HH_MM_SS));
bodyPlaceholders.put("{{response_days}}", applicationAmendmentRequestEntity.getResponseDays().toString()); bodyPlaceholders.put("{{response_days}}", applicationAmendmentRequestEntity.getResponseDays().toString());
@@ -259,8 +267,16 @@ public class EmailNotificationDao {
public void sendAdmissibilityNotificationEmailForAdmissibleApplication(ApplicationEntity applicationEntity) { public void sendAdmissibilityNotificationEmailForAdmissibleApplication(ApplicationEntity applicationEntity) {
Map<String, String> bodyPlaceholders = new HashMap<>(); Map<String, String> bodyPlaceholders = new HashMap<>();
bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName()); bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString()); String protocolNumber=applicationEntity.getProtocol().getExternalProtocolNumber();
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(applicationEntity.getProtocol().getCreatedDate())); if(protocolNumber==null){
protocolNumber= String.valueOf(applicationEntity.getProtocol().getProtocolNumber());
}
bodyPlaceholders.put("{{protocol_number}}", protocolNumber);
String protocolDate= DateTimeUtil.formatLocalDateTime(applicationEntity.getProtocol().getCreatedDate(), GepafinConstant.DD_MM_YYYY);
if(applicationEntity.getProtocol().getExternalProtocolDate()!=null){
protocolDate= DateTimeUtil.formatLocalDateTime(applicationEntity.getProtocol().getExternalProtocolDate(), GepafinConstant.DD_MM_YYYY);
}
bodyPlaceholders.put("{{protocol_date}}", protocolDate);
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationEntity.getProtocol().getTime(), GepafinConstant.HH_MM_SS)); bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationEntity.getProtocol().getTime(), GepafinConstant.HH_MM_SS));
sendEmail(applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.ADMISSIBILITY_NOTIFICATION, bodyPlaceholders, null,null); sendEmail(applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.ADMISSIBILITY_NOTIFICATION, bodyPlaceholders, null,null);
@@ -269,8 +285,16 @@ public class EmailNotificationDao {
public void sendInadmissibilityEmailForRejectedApplication(ApplicationEntity applicationEntity,ApplicationEvaluationEntity applicationEvaluationEntity) { public void sendInadmissibilityEmailForRejectedApplication(ApplicationEntity applicationEntity,ApplicationEvaluationEntity applicationEvaluationEntity) {
Map<String, String> bodyPlaceholders = new HashMap<>(); Map<String, String> bodyPlaceholders = new HashMap<>();
bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName()); bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString()); String protocolNumber=applicationEntity.getProtocol().getExternalProtocolNumber();
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(applicationEntity.getProtocol().getCreatedDate())); if(protocolNumber==null){
protocolNumber= String.valueOf(applicationEntity.getProtocol().getProtocolNumber());
}
bodyPlaceholders.put("{{protocol_number}}", protocolNumber);
String protocolDate= DateTimeUtil.formatLocalDateTime(applicationEntity.getProtocol().getCreatedDate(), GepafinConstant.DD_MM_YYYY);
if(applicationEntity.getProtocol().getExternalProtocolDate()!=null){
protocolDate= DateTimeUtil.formatLocalDateTime(applicationEntity.getProtocol().getExternalProtocolDate(), GepafinConstant.DD_MM_YYYY);
}
bodyPlaceholders.put("{{protocol_date}}", protocolDate);
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationEntity.getProtocol().getTime(), GepafinConstant.HH_MM_SS)); bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationEntity.getProtocol().getTime(), GepafinConstant.HH_MM_SS));
bodyPlaceholders.put("{{form_text}}", applicationEvaluationEntity.getMotivation()); bodyPlaceholders.put("{{form_text}}", applicationEvaluationEntity.getMotivation());

View File

@@ -174,7 +174,11 @@ public class NotificationDao {
Map<String, String> placeHolders = new HashMap<>(); Map<String, String> placeHolders = new HashMap<>();
placeHolders.put("{{call_name}}", application.getCall().getName()); placeHolders.put("{{call_name}}", application.getCall().getName());
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber())); String protocolNumber=application.getProtocol().getExternalProtocolNumber();
if(protocolNumber==null){
protocolNumber= String.valueOf(application.getProtocol().getProtocolNumber());
}
placeHolders.put("{{protocol_number}}", protocolNumber);
NotificationReq notificationReq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders, application.getUserId(), application.getUserWithCompany(), NotificationReq notificationReq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders, application.getUserId(), application.getUserWithCompany(),
listOf(application.getCompanyId())); listOf(application.getCompanyId()));
sendNotification(notificationReq); sendNotification(notificationReq);

View File

@@ -181,15 +181,15 @@ public class ProtocolDao {
Map<String, Object> requestBody = new HashMap<>(); Map<String, Object> requestBody = new HashMap<>();
requestBody.put(GepafinConstant.PROTOCOL_DOC_URL,docUrl); requestBody.put(GepafinConstant.PROTOCOL_DOC_URL,docUrl);
requestBody.put(GepafinConstant.PROTOCOL_COMPANY_NAME,companyName);
requestBody.put(GepafinConstant.PROTOCOL_DOC_HASH,applicationSignedDocumentEntity.getFileHash()); requestBody.put(GepafinConstant.PROTOCOL_DOC_HASH,applicationSignedDocumentEntity.getFileHash());
requestBody.put(GepafinConstant.PROTOCOL_TIPO_PROTOCOLLAZIONE,TIPO_PROTOCOLLAZIONE); requestBody.put(GepafinConstant.PROTOCOL_TIPO_PROTOCOLLAZIONE,TIPO_PROTOCOLLAZIONE);
requestBody.put(GepafinConstant.PROTOCOL_COMPANY_NAME_VAT_NUMBER,company.getCompanyName());
Map<String, Object> mittente = new HashMap<>(); Map<String, Object> mittente = new HashMap<>();
mittente.put(GepafinConstant.PROTOCOL_TIPO_CORRISPONDENTE_COMPANY, mittenteValue); mittente.put(GepafinConstant.PROTOCOL_TIPO_CORRISPONDENTE, mittenteValue);
mittente.put(GepafinConstant.PROTOCOL_COMPANY_NAME_VAT_NUMBER,company.getCompanyName());
mittente.put(GepafinConstant.PROTOCOL_MEZZO,mezzo); mittente.put(GepafinConstant.PROTOCOL_MEZZO,mezzo);
mittente.put(GepafinConstant.PROTOCOL_INDIRIZZO_PEC,pecEmail); mittente.put(GepafinConstant.PROTOCOL_INDIRIZZO_PEC,pecEmail);
mittente.put(GepafinConstant.PROTOCOL_COMPANY_VAT_NUMBER,vatNumber); mittente.put(GepafinConstant.PROTOCOL_COMPANY_VAT_NUMBER,vatNumber);
mittente.put(GepafinConstant.PROTOCOL_COMPANY_NAME,company.getCompanyName());
List<Map<String,Object>> destinatariObject=new ArrayList<>(); List<Map<String,Object>> destinatariObject=new ArrayList<>();
Map<String, Object> destinatari = new HashMap<>(); Map<String, Object> destinatari = new HashMap<>();
destinatari.put(GepafinConstant.PROTOCOL_CODICE_UO,codiceUo); destinatari.put(GepafinConstant.PROTOCOL_CODICE_UO,codiceUo);

View File

@@ -91,7 +91,11 @@ public class ApplicationEvaluationScheduler {
// Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_EXPIRED); // Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_EXPIRED);
Map<String, String> placeHolders = new HashMap<>(); Map<String, String> placeHolders = new HashMap<>();
placeHolders.put("{{call_name}}", application.getCall().getName()); placeHolders.put("{{call_name}}", application.getCall().getName());
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber())); String protocolNumber=application.getProtocol().getExternalProtocolNumber();
if(protocolNumber==null){
protocolNumber= String.valueOf(application.getProtocol().getProtocolNumber());
}
placeHolders.put("{{protocol_number}}", protocolNumber);
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_EXPIRED); notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_EXPIRED);
notificationDao.sendNotificationToInstructor(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED); notificationDao.sendNotificationToInstructor(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED);
notificationDao.sendNotificationToInstructorManager(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED); notificationDao.sendNotificationToInstructorManager(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED);