From 7610cc8bd664efb03ee41e616f4bd40802bc3d25 Mon Sep 17 00:00:00 2001 From: piyuskag Date: Wed, 30 Oct 2024 18:52:05 +0530 Subject: [PATCH 1/6] Updated cron. --- .../tendermanagement/scheduler/NotificationScheduler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java b/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java index 5fcb3bc2..f83af795 100644 --- a/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java +++ b/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java @@ -29,7 +29,7 @@ public class NotificationScheduler { @Autowired EmailNotificationDao emailNotificationDao; -// @Scheduled(cron = "0 0/1 * * * ?") + @Scheduled(cron = "0 0/1 * * * ?") void sendNotificationForRejectedApplicationToBeneficiary() { List applicationsList = applicationRepository.findByIsDeletedFalse(); From f23dafff283365e8ca9c8b3d4404c81a6497968e Mon Sep 17 00:00:00 2001 From: piyuskag Date: Wed, 30 Oct 2024 18:53:25 +0530 Subject: [PATCH 2/6] Updated cron. --- .../tendermanagement/scheduler/NotificationScheduler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java b/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java index f83af795..aed9d142 100644 --- a/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java +++ b/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java @@ -29,7 +29,7 @@ public class NotificationScheduler { @Autowired EmailNotificationDao emailNotificationDao; - @Scheduled(cron = "0 0/1 * * * ?") + @Scheduled(cron = "0 0 1 * * ?") void sendNotificationForRejectedApplicationToBeneficiary() { List applicationsList = applicationRepository.findByIsDeletedFalse(); From 7f0f447c8c88d0c1460a3333fa5ee1f4716464a4 Mon Sep 17 00:00:00 2001 From: piyuskag Date: Wed, 30 Oct 2024 19:00:34 +0530 Subject: [PATCH 3/6] Updated code for updating status on auto rejection after given time and updated cron. --- .../scheduler/NotificationScheduler.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java b/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java index aed9d142..93d41c98 100644 --- a/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java +++ b/src/main/java/net/gepafin/tendermanagement/scheduler/NotificationScheduler.java @@ -42,16 +42,12 @@ public class NotificationScheduler { if (amendmentRequest != null) { LocalDateTime requestDate = amendmentRequest.getCreatedDate(); - - // Eg :- Check if requestDate + 7 days is less than or equal to today if (requestDate.plusDays(amendmentRequest.getResponseDays()).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("CLOSE"); - // applicationAmendmentRepository.save(amendmentRequest); // Save updated amendment request + applicationRepository.save(application); + amendmentRequest.setStatus("CLOSE"); + applicationAmendmentRepository.save(amendmentRequest); emailNotificationDao.sendApplicationFailureNotificationEmail(amendmentRequest); } } From eeb8bbc7e2de53f3e28c6c9507d75c9d78d1d223 Mon Sep 17 00:00:00 2001 From: piyuskag Date: Thu, 31 Oct 2024 14:03:55 +0530 Subject: [PATCH 4/6] Updated code. --- .../db/changelog/db.changelog-1.0.0.xml | 79 ++++++++++--------- ..._for_email_service_config_31_10_2024_1.sql | 9 +++ 2 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 src/main/resources/db/dump/update_hub_data_for_email_service_config_31_10_2024_1.sql diff --git a/src/main/resources/db/changelog/db.changelog-1.0.0.xml b/src/main/resources/db/changelog/db.changelog-1.0.0.xml index 4156ccf4..caeae0ed 100644 --- a/src/main/resources/db/changelog/db.changelog-1.0.0.xml +++ b/src/main/resources/db/changelog/db.changelog-1.0.0.xml @@ -1647,42 +1647,6 @@ - - - - - - - UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs' - - - - UNIQUE_UUID = 't7jh5wfg9QXylNaTZkPoE' - - - - - - - - - - - - - - - - - UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs' - - - - UNIQUE_UUID = 't7jh5wfg9QXylNaTZkPoE' - - - @@ -1696,4 +1660,47 @@ path="db/dump/insert_system_email_template_for_notification_mail_31_10_2024.sql"/> + + + + + + + UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs' + + + + UNIQUE_UUID = 't7jh5wfg9QXylNaTZkPoE' + + + + + + + + + + + + + + + + + + + + + UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs' + + + + UNIQUE_UUID = 't7jh5wfg9QXylNaTZkPoE' + + + diff --git a/src/main/resources/db/dump/update_hub_data_for_email_service_config_31_10_2024_1.sql b/src/main/resources/db/dump/update_hub_data_for_email_service_config_31_10_2024_1.sql new file mode 100644 index 00000000..e5a8da72 --- /dev/null +++ b/src/main/resources/db/dump/update_hub_data_for_email_service_config_31_10_2024_1.sql @@ -0,0 +1,9 @@ +UPDATE hub +SET email_service_type = 'PEC_SERVICE', + email_service_config = 'JkFbBfuVvq7VWwp5LcWIi+hAa1RJ1ekI0jq3w7gLTXETZiTaN8zC4OBWD53x8FtbfFTh3L/5805CIYTH1BQGa3X9q16q9SDzMy7DKHdmJzOnLKhn74C5akoXKaeXUCGnzp0cSk2c01FV6lwefC29IshijFSumCHtVlgWNeZigBx51GL2Coh8nF1Mu7/KIcny' +WHERE UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs'; + +UPDATE hub +SET email_service_type = 'MAILGUN_SERVICE', + email_service_config = 'mhyP0kKQCrsbhGv3PGx4yob4dPSNBOd2xFnAPkikJE7VHkydklfUSVWAdYjhXwOz8rglH2YYEC/xGZdrEgSnkS9Ed56/qzmaU1667GGf+kc5mciOiECW5/sVmhtbVClEnu1FGZMzlsJSqYKlTmqfCYD0lTAlak1Lu2n030tj6nhMDvUxP9CbeTwkzALMtmgt' +WHERE UNIQUE_UUID = 't7jh5wfg9QXylNaTZkPoE'; \ No newline at end of file From c0bd9bb928ead7e5c644782dbb1727e1d808a2a9 Mon Sep 17 00:00:00 2001 From: harish Date: Thu, 31 Oct 2024 14:16:26 +0530 Subject: [PATCH 5/6] Reminder mail to beneficiary --- .../constants/GepafinConstant.java | 4 +- .../dao/ApplicationAmendmentRequestDao.java | 65 +++++++++++++++++++ .../entities/SystemEmailTemplatesEntity.java | 1 + .../ApplicationAmendmentRequestService.java | 2 +- ...pplicationAmendmentRequestServiceImpl.java | 24 +++++++ .../api/ApplicationAmendmentRequestApi.java | 15 +++++ ...ApplicationAmendmentRequestController.java | 12 ++++ .../db/changelog/db.changelog-1.0.0.xml | 9 +++ ...mail_template_for_sollecito_30_10_2024.sql | 29 +++++++++ src/main/resources/message_en.properties | 2 + src/main/resources/message_it.properties | 2 + 11 files changed, 162 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/db/dump/insert_system_email_template_for_sollecito_30_10_2024.sql diff --git a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java index 23b14cf0..3a160d09 100644 --- a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java +++ b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java @@ -259,7 +259,7 @@ public class GepafinConstant { 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 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"; public static final String S3_PATH_STRUCTURE_NOT_FOUND_BY_TYPE_MSG ="s3.path.not.found.by.type"; @@ -287,7 +287,7 @@ public class GepafinConstant { 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"; - + public static final String REMINDER_EMAIL_SENT_SUCCESS_MSG = "reminder.email.sent.success.msg"; public static final String ENCRYPT_INIT_VECTOR = "IG8*(*@&)*#biVVD"; public static final String ENCRYPT_KEY = "U2VjdXJlRW5jcnlwdEtleQ=="; } diff --git a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationAmendmentRequestDao.java b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationAmendmentRequestDao.java index b5d36dac..1f39459b 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationAmendmentRequestDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationAmendmentRequestDao.java @@ -18,9 +18,14 @@ import net.gepafin.tendermanagement.model.request.ApplicationFormFieldRequestBea import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest; import net.gepafin.tendermanagement.model.response.AmendmentFormFieldResponse; import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse; +import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse; import net.gepafin.tendermanagement.repositories.*; import net.gepafin.tendermanagement.service.*; import net.gepafin.tendermanagement.util.DateTimeUtil; +import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum; +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.ResourceNotFoundException; import net.gepafin.tendermanagement.web.rest.api.errors.Status; import org.springframework.beans.factory.annotation.Autowired; @@ -83,6 +88,13 @@ public class ApplicationAmendmentRequestDao { @Autowired private AssignedApplicationsRepository assignedApplicationsRepository; + @Autowired + private SystemEmailTemplatesService systemEmailTemplatesService; + + @Autowired + private HubService hubService; +// @Autowired +// private MailUtil mailUtil; public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request, Long applicationEvaluationId) { log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId); @@ -481,4 +493,57 @@ public class ApplicationAmendmentRequestDao { log.info("Amendment status updated successfully: {}", response); return response; } + public void sendReminderEmail(Long amendmentId) { + ApplicationAmendmentRequestEntity amendment = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(amendmentId) + .orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, + Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG))); + + Optional entityOptional = applicationEvaluationRepository.findByIdAndIsDeletedFalse(amendment.getApplicationEvaluationEntity().getId()); + if (entityOptional.isPresent()) { + ApplicationEntity applicationEntity = applicationService.validateApplication(entityOptional.get().getApplicationId()); + UserEntity beneficiaryUser = userService.validateUser(applicationEntity.getUserId()); + HubEntity hub = hubService.valdateHub(applicationEntity.getHubId()); + SystemEmailTemplateResponse emailTemplate = systemEmailTemplatesService + .retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntityTypeEnum.AMENDMENT_REMINDER, hub, null); + String subject = prepareSubject(emailTemplate, amendment, beneficiaryUser); + String body = prepareBody(emailTemplate, amendment, beneficiaryUser); + String email = beneficiaryUser.getEmail(); + if (Boolean.TRUE.equals(amendment.getIsEmail())&&email != null && !email.isEmpty()) { + emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email)); +// mailUtil.sendByMailGun(subject,body,List.of("harish.bagora1@gmail.com"),null); + } else { + throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.BENEFICIARY_EMAIL_NOT_FOUND_MSG)); + } + } + } + + private String prepareSubject(SystemEmailTemplateResponse template, ApplicationAmendmentRequestEntity amendment, UserEntity beneficiary) { + Map subjectPlaceholders = new HashMap<>(); + String firstName = beneficiary.getFirstName() != null ? beneficiary.getFirstName() : ""; + String lastName = beneficiary.getLastName() != null ? beneficiary.getLastName() : ""; + String beneficiaryName = String.join(" ", firstName, lastName).trim(); + + subjectPlaceholders.put("{{amendment_id}}", amendment.getId().toString()); + subjectPlaceholders.put("{{beneficiary_name}}", beneficiaryName); + + return Utils.replacePlaceholders(template.getSubject(), subjectPlaceholders); + } + + private String prepareBody(SystemEmailTemplateResponse template, ApplicationAmendmentRequestEntity amendment, UserEntity beneficiary) { + Map bodyPlaceholders = new HashMap<>(); + bodyPlaceholders.put("{{amendment_id}}", amendment.getId().toString()); + + if (amendment.getStartDate() != null && amendment.getResponseDays() != null) { + + LocalDateTime dueDate = amendment.getStartDate().plusDays(amendment.getResponseDays()); + bodyPlaceholders.put("{{amendment_due_date}}", DateTimeUtil.formatLocalDateTime(dueDate, GepafinConstant.DD_MM_YYYY)); + } else { + + bodyPlaceholders.put("{{amendment_due_date}}", "Not available"); + } + + return Utils.replacePlaceholders(template.getHtmlContent(), bodyPlaceholders); + } + + } diff --git a/src/main/java/net/gepafin/tendermanagement/entities/SystemEmailTemplatesEntity.java b/src/main/java/net/gepafin/tendermanagement/entities/SystemEmailTemplatesEntity.java index 6d8ff6de..1440e00d 100644 --- a/src/main/java/net/gepafin/tendermanagement/entities/SystemEmailTemplatesEntity.java +++ b/src/main/java/net/gepafin/tendermanagement/entities/SystemEmailTemplatesEntity.java @@ -43,6 +43,7 @@ public class SystemEmailTemplatesEntity extends BaseEntity { DOCUMENTATION_INTEGRATION_REQUEST("DOCUMENTATION_INTEGRATION_REQUEST"), INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE("INADMISSIBILITY_NOTIFICATION_DUE_TO_FAILURE"), ADMISSIBILITY_NOTIFICATION("ADMISSIBILITY_NOTIFICATION"), + AMENDMENT_REMINDER("AMENDMENT_REMINDER"), INADMISSIBILITY_TEMPLATE("INADMISSIBILITY_NOTIFICATION"); private String value; diff --git a/src/main/java/net/gepafin/tendermanagement/service/ApplicationAmendmentRequestService.java b/src/main/java/net/gepafin/tendermanagement/service/ApplicationAmendmentRequestService.java index 318e48c1..a6112bf0 100644 --- a/src/main/java/net/gepafin/tendermanagement/service/ApplicationAmendmentRequestService.java +++ b/src/main/java/net/gepafin/tendermanagement/service/ApplicationAmendmentRequestService.java @@ -25,5 +25,5 @@ public interface ApplicationAmendmentRequestService { public ApplicationAmendmentRequestResponse getAmendmentByApplicationId(HttpServletRequest request,Long applicationId); public ApplicationAmendmentRequestResponse updateApplicationStatus(HttpServletRequest request, Long applicationId, ApplicationAmendmentRequestEnum status); - + void sendReminderEmail(HttpServletRequest request,Long amendmentId); } diff --git a/src/main/java/net/gepafin/tendermanagement/service/impl/ApplicationAmendmentRequestServiceImpl.java b/src/main/java/net/gepafin/tendermanagement/service/impl/ApplicationAmendmentRequestServiceImpl.java index d8a93d36..2d45bddd 100644 --- a/src/main/java/net/gepafin/tendermanagement/service/impl/ApplicationAmendmentRequestServiceImpl.java +++ b/src/main/java/net/gepafin/tendermanagement/service/impl/ApplicationAmendmentRequestServiceImpl.java @@ -1,8 +1,11 @@ package net.gepafin.tendermanagement.service.impl; import jakarta.servlet.http.HttpServletRequest; +import net.gepafin.tendermanagement.config.Translator; +import net.gepafin.tendermanagement.constants.GepafinConstant; import net.gepafin.tendermanagement.dao.ApplicationAmendmentRequestDao; import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity; +import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity; import net.gepafin.tendermanagement.entities.UserEntity; import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum; import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum; @@ -10,12 +13,17 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest; import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean; import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest; import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse; +import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepository; +import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository; import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService; import net.gepafin.tendermanagement.util.Validator; +import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException; +import net.gepafin.tendermanagement.web.rest.api.errors.Status; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Optional; @Service public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendmentRequestService { @@ -25,6 +33,10 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm @Autowired private ApplicationAmendmentRequestDao applicationAmendmentRequestDao; + @Autowired + private ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository; + @Autowired + private ApplicationEvaluationRepository applicationEvaluationRepository; @Override public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request, Long applicationEvaluationId) { @@ -88,5 +100,17 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm return applicationAmendmentRequestDao.updateApplicationAmendmentStatus(applicationId, status); } + @Override + public void sendReminderEmail(HttpServletRequest request,Long amendmentId) { + ApplicationAmendmentRequestEntity amendment = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(amendmentId) + .orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, + Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG))); + Optional entityOptional = applicationEvaluationRepository.findByIdAndIsDeletedFalse(amendment.getApplicationEvaluationEntity().getId()); + if (entityOptional.isPresent()) { + UserEntity user = validator.validatePreInstructor(request, entityOptional.get().getUserId()); + + applicationAmendmentRequestDao.sendReminderEmail(amendmentId); + } + } } diff --git a/src/main/java/net/gepafin/tendermanagement/web/rest/api/ApplicationAmendmentRequestApi.java b/src/main/java/net/gepafin/tendermanagement/web/rest/api/ApplicationAmendmentRequestApi.java index 2438eae6..42977539 100644 --- a/src/main/java/net/gepafin/tendermanagement/web/rest/api/ApplicationAmendmentRequestApi.java +++ b/src/main/java/net/gepafin/tendermanagement/web/rest/api/ApplicationAmendmentRequestApi.java @@ -171,4 +171,19 @@ public interface ApplicationAmendmentRequestApi { @Parameter(description = "The application amendment id", required = true) @PathVariable("applicationAmendmentId") Long applicationAmendmentId, @Parameter(description = "status", required = true)@RequestParam(value = "status", required = true) ApplicationAmendmentRequestEnum status); + @Operation(summary = "Send reminder email for the specified amendment", + responses = { + @ApiResponse(responseCode = "200", description = "Email sent successfully"), + @ApiResponse(responseCode = "404", description = "Amendment not found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { + @ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })), + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { + @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { + @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })) + }) + @PostMapping(value = "sendReminderEmail/{amendmentId}", produces = MediaType.APPLICATION_JSON_VALUE) + ResponseEntity> sendReminderEmail(HttpServletRequest request, + @Parameter( required = true) + @PathVariable(value = "amendmentId") Long amendmentId); + } diff --git a/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/ApplicationAmendmentRequestController.java b/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/ApplicationAmendmentRequestController.java index de74ac06..9a75fe23 100644 --- a/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/ApplicationAmendmentRequestController.java +++ b/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/ApplicationAmendmentRequestController.java @@ -117,4 +117,16 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme return ResponseEntity.status(HttpStatus.OK) .body(new Response<>(applicationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_STATUS_UPDATED_SUCCESSFULLY))); } + @Override + public ResponseEntity> sendReminderEmail( + HttpServletRequest request, + Long amendmentId) { + + log.info("Sending reminder email for Amendment ID: {}", amendmentId); + applicationAmendmentRequestService.sendReminderEmail(request,amendmentId); + + return ResponseEntity.status(HttpStatus.OK) + .body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.REMINDER_EMAIL_SENT_SUCCESS_MSG))); + } + } diff --git a/src/main/resources/db/changelog/db.changelog-1.0.0.xml b/src/main/resources/db/changelog/db.changelog-1.0.0.xml index 4156ccf4..5eb2f8b6 100644 --- a/src/main/resources/db/changelog/db.changelog-1.0.0.xml +++ b/src/main/resources/db/changelog/db.changelog-1.0.0.xml @@ -1695,5 +1695,14 @@ + + select + setval('gepafin_schema.system_email_template_id_seq', (select + max(id)+1 + from gepafin_schema.system_email_template), false) + + + diff --git a/src/main/resources/db/dump/insert_system_email_template_for_sollecito_30_10_2024.sql b/src/main/resources/db/dump/insert_system_email_template_for_sollecito_30_10_2024.sql new file mode 100644 index 00000000..435cf965 --- /dev/null +++ b/src/main/resources/db/dump/insert_system_email_template_for_sollecito_30_10_2024.sql @@ -0,0 +1,29 @@ +-- SQL Dump to insert system email template for amendment reminder email with calculated due date +INSERT INTO gepafin_schema.system_email_template +(template_name, "type", html_content, subject, "json", "system", is_deleted, created_date, updated_date) +VALUES +( + 'Amendment Reminder Email', + 'AMENDMENT_REMINDER', + ' + +
+

PROMEMORIA PER LA PRESENTAZIONE DELL''EMENDAMENTO

+

Buongiorno,

+

Questo รจ un promemoria per completare la presentazione dell''emendamento entro il termine specificato. Di seguito i dettagli:

+
    +
  • Amendment ID: {{amendment_id}}
  • +
  • Data di Scadenza: {{amendment_due_date}}
  • +
+

Si prega di assicurarsi che l''emendamento venga presentato entro la data di scadenza per evitare ritardi. Inviare l''emendamento tramite la piattaforma online {{platform_link}}

+

Distinti saluti,

+

{{email_signature}}

+
+ + ', + 'Reminder: Pending Amendment Submission - ID {{amendment_id}}', + NULL, + true, + false, +CURRENT_TIMESTAMP, + CURRENT_TIMESTAMP); diff --git a/src/main/resources/message_en.properties b/src/main/resources/message_en.properties index 2d547b8c..220d4654 100644 --- a/src/main/resources/message_en.properties +++ b/src/main/resources/message_en.properties @@ -101,6 +101,7 @@ success.password.changed=Password changed successfully. logout.successful.msg=Logout successful. You have been logged out successfully. #Update user Active or Deactive status update.user.status.success=User status has been successfully updated. +beneficiary.email.not.found.msg=The email address for the beneficiary could not be found. Please ensure that the beneficiary has a valid email address. #Form-field-related messages @@ -295,6 +296,7 @@ application.amendment.get.success = Application Amendment details fetched succes application.amendment.update.successfully = Application Amendment Updated Successfully. application.amendment.closed.successfully = Application Amendment Closed Successfully. response.days.extended.success=Response days extended successfully. +reminder.email.sent.success.msg=Reminder email sent successfully! added.comment.to.amendment.request.success = Application Amendment Comment Added Successfully. comment.not.found = Comment Not Found. diff --git a/src/main/resources/message_it.properties b/src/main/resources/message_it.properties index 544ff70b..ea702497 100644 --- a/src/main/resources/message_it.properties +++ b/src/main/resources/message_it.properties @@ -299,3 +299,5 @@ amendment.found.success = Richiesta di emendamento trovata con successo. invalid.amendment.for.comment = Richiesta di emendamento non valida per il commento fornito. DD_MM_YYYY_HH_MM = dd_MM_yyyy HH:mm create.application.data.amendment.msg =Emendamento alla domanda inviato con successo +beneficiary.email.not.found.msg=L'indirizzo email per il beneficiario non ่ stato trovato. Si prega di assicurarsi che il beneficiario abbia un indirizzo email valido. +reminder.email.sent.success.msg=Email di promemoria inviata con successo! From 838905cbc270d7d1a125531e82d2bf35aff48de1 Mon Sep 17 00:00:00 2001 From: harish Date: Thu, 31 Oct 2024 15:00:31 +0530 Subject: [PATCH 6/6] Updated code --- .../tendermanagement/dao/ApplicationAmendmentRequestDao.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationAmendmentRequestDao.java b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationAmendmentRequestDao.java index 1f39459b..63ecc6c7 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationAmendmentRequestDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationAmendmentRequestDao.java @@ -510,7 +510,7 @@ public class ApplicationAmendmentRequestDao { String email = beneficiaryUser.getEmail(); if (Boolean.TRUE.equals(amendment.getIsEmail())&&email != null && !email.isEmpty()) { emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email)); -// mailUtil.sendByMailGun(subject,body,List.of("harish.bagora1@gmail.com"),null); +// mailUtil.sendByMailGun(subject,body,List.of(email),null); } else { throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.BENEFICIARY_EMAIL_NOT_FOUND_MSG)); }