Done ticket GEPAFINBE-199 Implemented the code to send the email to rinaldo from mailgun service like bflows.

This commit is contained in:
piyushkag
2025-04-18 18:48:49 +05:30
parent 586f872b34
commit 8e1dcecf66
9 changed files with 128 additions and 52 deletions

View File

@@ -1,10 +1,8 @@
package net.gepafin.tendermanagement.dao;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.Expression;
import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant;
@@ -12,7 +10,6 @@ import net.gepafin.tendermanagement.entities.*;
import net.gepafin.tendermanagement.enums.NotificationEnum;
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
import net.gepafin.tendermanagement.model.request.GlobalFilters;
import net.gepafin.tendermanagement.model.request.NotificationReq;
import net.gepafin.tendermanagement.model.request.NotificationRequestBean;
import net.gepafin.tendermanagement.model.response.NotificationResponse;
@@ -28,22 +25,19 @@ import net.gepafin.tendermanagement.util.DateTimeUtil;
import net.gepafin.tendermanagement.util.Utils;
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
import org.opensaml.xmlsec.signature.G;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import static org.apache.commons.lang3.StringUtils.isEmpty;
@@ -92,7 +86,7 @@ public class NotificationDao {
log.info("Sending notification to user {} with content: {}", userId, notificationReq.getMessage());
List<Long> companyIds = notificationReq.getCompanyIds();
if (companyIds == null || companyIds.isEmpty()) {
if (companyIds == null || companyIds.isEmpty() || companyIds.stream().allMatch(Objects::isNull)) {
sendToUser(userId, notificationEntity);
} else {
sendToCompanies(userId, companyIds, notificationEntity);
@@ -154,7 +148,7 @@ public class NotificationDao {
notificationEntity.setUserId(notificationReq.getUserId());
notificationEntity.setStatus(NotificationEnum.UNREAD.getValue());
notificationEntity.setIsDeleted(Boolean.FALSE);
notificationEntity.setUserWithCompany(notificationReq.getUserWithCompanyEntity() != null ? notificationReq.getUserWithCompanyEntity() : null);
notificationEntity.setUserWithCompany(notificationReq.getUserWithCompanyEntity());
notificationEntity.setMessage(message);
notificationEntity.setTitle(notificationReq.getTitle());
return notificationEntity;