updated code
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user