Done ticket GEPAFINBE-6141
This commit is contained in:
@@ -50,24 +50,28 @@ public class PecMailDao {
|
||||
private ApplicationService applicationService;
|
||||
|
||||
|
||||
public PecMailResponse sendPecMail(HttpServletRequest request, List<Long> userActionIds) {
|
||||
public List<PecMailResponse> sendPecMail(HttpServletRequest request, List<Long> userActionIds) {
|
||||
|
||||
List<PecMailResponse> pecMailResponses=new ArrayList<>();
|
||||
for (Long userActionId: userActionIds) {
|
||||
List<EmailLogEntity> emailLogs = getEmailLogEntities(request, userActionId);
|
||||
for (EmailLogEntity log : emailLogs) {
|
||||
List<String> recipients = Utils.commaSeparatedStringToList(log.getRecipientEmails());
|
||||
CallEntity call = callService.validateCall(log.getCallId());
|
||||
emailNotificationDao.sendMail(
|
||||
emailNotificationDao.sendPendingMail(
|
||||
call.getHub().getId(),
|
||||
log.getEmailSubject(),
|
||||
log.getEmailBody(),
|
||||
recipients,
|
||||
null
|
||||
log
|
||||
);
|
||||
|
||||
ApplicationEntity applicationEntity=applicationService.validateApplication(log.getApplicationId());
|
||||
String callName=applicationEntity.getCall().getName();
|
||||
PecMailResponse pecMailResponse=createPecMailResponse(log.getUserAction().getId(),log,callName);
|
||||
pecMailResponses.add(pecMailResponse);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return pecMailResponses;
|
||||
}
|
||||
|
||||
private List<EmailLogEntity> getEmailLogEntities(HttpServletRequest request, Long userActionId) {
|
||||
@@ -77,7 +81,7 @@ public class PecMailDao {
|
||||
}
|
||||
validator.validateHubId(request, userActionEntity.getHubId());
|
||||
|
||||
List<EmailLogEntity> emailLogs = emailLogRepository.findByUserActionIdAndEmailServiceTypeAndSendStatus(userActionId, EmailServiceTypeEnum.PEC_SERVICE.getValue(), StatusTypeEnum.PENDING.getValue());
|
||||
List<EmailLogEntity> emailLogs = emailLogRepository.findByUserActionIdAndSendStatusAndIsDeletedFalse(userActionId,StatusTypeEnum.PENDING.getValue());
|
||||
|
||||
if (emailLogs.isEmpty()) {
|
||||
log.info("No emails found for given userActionId: {}", userActionId);
|
||||
|
||||
Reference in New Issue
Block a user