updated code

This commit is contained in:
Piyush
2025-05-09 18:27:17 +05:30
parent 6145232330
commit aefe8fb38b
2 changed files with 7 additions and 4 deletions

View File

@@ -72,18 +72,18 @@ public class EmailDao {
public EmailSendResponse buildEmailSendResponseFromRequest(HttpServletRequest request) { public EmailSendResponse buildEmailSendResponseFromRequest(HttpServletRequest request) {
Long userActionId = (Long) request.getAttribute(GepafinConstant.USER_ACTION_ID); Long userActionId = (Long) request.getAttribute(GepafinConstant.USER_ACTION_ID);
List<EmailLogEntity> emailLogs = emailLogRepository.findByUserActionId(userActionId); List<EmailLogEntity> emailLogs = emailLogRepository.findByUserActionIdAndEmailServiceType(userActionId,EmailServiceTypeEnum.PEC_SERVICE.getValue());
boolean allSuccess = true; boolean allSuccess = true;
String emailScenario = null; String emailScenario = null;
for (EmailLogEntity log : emailLogs) { for (EmailLogEntity log : emailLogs) {
if (emailScenario == null) { if (emailScenario == null) {
emailScenario = log.getEmailType(); emailScenario = log.getEmailType();
} }
boolean isSuccess = EmailServiceTypeEnum.PEC_SERVICE.getValue().equals(log.getEmailServiceType()) && boolean isSuccess = StatusTypeEnum.SUCCESS.getValue().equals(log.getSendStatus());
StatusTypeEnum.SUCCESS.getValue().equals(log.getSendStatus()); if (Boolean.FALSE.equals(isSuccess)) {
if (!isSuccess) {
allSuccess = false; allSuccess = false;
break; break;
} }

View File

@@ -14,5 +14,8 @@ public interface EmailLogRepository extends JpaRepository<EmailLogEntity,Long> {
List<EmailLogEntity> findByUserActionIdAndEmailServiceTypeAndSendStatus( List<EmailLogEntity> findByUserActionIdAndEmailServiceTypeAndSendStatus(
Long userActionId, String emailServiceType, String sendStatus); Long userActionId, String emailServiceType, String sendStatus);
Optional<EmailLogEntity> findTopByUserIdAndEmailTypeAndIsDeletedFalseOrderByCreatedDateDesc(Long userId, String emailType); Optional<EmailLogEntity> findTopByUserIdAndEmailTypeAndIsDeletedFalseOrderByCreatedDateDesc(Long userId, String emailType);
List<EmailLogEntity> findByUserActionIdAndEmailServiceType(
Long userActionId, String emailServiceType);
} }