Merge pull request #87 from Kitzanos/feature/GEPAFINBE-84
GEPAFINBE- 84 & GEPAFINBE - 92 (Email Tracking Management)
This commit is contained in:
@@ -8,6 +8,7 @@ import net.gepafin.tendermanagement.enums.*;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationFormFieldRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.EmailLogRequest;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.repositories.*;
|
||||
import net.gepafin.tendermanagement.service.AmazonS3Service;
|
||||
@@ -142,6 +143,8 @@ public class ApplicationDao {
|
||||
@Autowired
|
||||
private FormDao formDao;
|
||||
|
||||
@Autowired
|
||||
private EmailLogDao emailLogDao;
|
||||
|
||||
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
||||
FormEntity formEntity = formService.validateForm(formId);
|
||||
@@ -795,25 +798,32 @@ public class ApplicationDao {
|
||||
// Replace placeholders in the subject and body
|
||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||
|
||||
String email = userEntity.getEmail();
|
||||
EmailLogRequest emailLogRequest=emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(),RecipientTypeEnum.USER,userEntity.getId(),userEntity.getEmail(),userEntity.getId(),applicationEntity.getId(),null,applicationEntity.getCall().getId());
|
||||
String email = userEntity.getEmail();
|
||||
if (userEntity.getBeneficiary() != null) {
|
||||
emailLogRequest.setRecipientType(RecipientTypeEnum.BENEFICIARY);
|
||||
email = userEntity.getBeneficiary().getEmail();
|
||||
emailLogRequest.setUserId(userEntity.getBeneficiary().getId());
|
||||
}
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email));
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email),emailLogRequest);
|
||||
List<String> recipientEmails = new ArrayList<>();
|
||||
// recipientEmails.add(email);
|
||||
String companyEmail = company.getEmail();
|
||||
String contactEmail = company.getContactEmail();
|
||||
|
||||
if (companyEmail != null && !companyEmail.isEmpty()) {
|
||||
recipientEmails.add(companyEmail);
|
||||
}
|
||||
|
||||
if (contactEmail != null && !contactEmail.isEmpty() && !contactEmail.equals(companyEmail)) {
|
||||
recipientEmails.add(contactEmail);
|
||||
}
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, recipientEmails);
|
||||
// recipientEmails.add(email);
|
||||
String companyEmail = company.getEmail();
|
||||
String contactEmail = company.getContactEmail();
|
||||
|
||||
if (companyEmail != null && !companyEmail.isEmpty()) {
|
||||
recipientEmails.add(companyEmail);
|
||||
}
|
||||
|
||||
if (contactEmail != null && !contactEmail.isEmpty() && !contactEmail.equals(companyEmail)) {
|
||||
recipientEmails.add(contactEmail);
|
||||
}
|
||||
if(Boolean.FALSE.equals(recipientEmails.isEmpty())){
|
||||
emailLogRequest.setRecipientId(applicationEntity.getCompany().getId());
|
||||
emailLogRequest.setRecipientType(RecipientTypeEnum.COMPANY);
|
||||
emailLogRequest.setRecipientEmails(companyEmail);
|
||||
}
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, recipientEmails,emailLogRequest);
|
||||
}
|
||||
private void sendMailTodefaultSystemAndGepafin(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
||||
CallEntity call = applicationEntity.getCall();
|
||||
@@ -840,17 +850,22 @@ public class ApplicationDao {
|
||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||
|
||||
EmailLogRequest emailLogRequest=emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(),RecipientTypeEnum.PROPERTIES,null,userEntity.getEmail(),userEntity.getId(),applicationEntity.getId(),null,applicationEntity.getCall().getId());
|
||||
|
||||
// mailUtil.sendByMailGun(subject, body, List.of(defaultSystemReceiverEmail), null);
|
||||
// mailUtil.sendByMailGun(subject, body, List.of(gepafinEmail), null);
|
||||
// mailUtil.sendByMailGun(subject, body, List.of(rinaldoEmail), null);
|
||||
if(validator.isProductionProfileActivated()) {
|
||||
emailLogRequest.setRecipientEmails(carloEmail);
|
||||
// mailUtil.sendByMailGun(subject, body, List.of(carloEmail), null);
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(carloEmail));
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(carloEmail),emailLogRequest);
|
||||
}
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(hub.getEmail()));
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(defaultSystemReceiverEmail));
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(rinaldoEmail));
|
||||
emailLogRequest.setRecipientEmails(hub.getEmail());
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(hub.getEmail()),emailLogRequest);
|
||||
emailLogRequest.setRecipientEmails(defaultSystemReceiverEmail);
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(defaultSystemReceiverEmail),emailLogRequest);
|
||||
emailLogRequest.setRecipientEmails(rinaldoEmail);
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(rinaldoEmail),emailLogRequest);
|
||||
|
||||
}
|
||||
public ApplicationSignedDocumentResponse uploadSignedDocument(HttpServletRequest request, Long applicationId,
|
||||
|
||||
Reference in New Issue
Block a user