Resolved conflicts for GEPAFINBE-31.
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.entities.EmailLogEntity;
|
||||
import net.gepafin.tendermanagement.enums.EmailScenarioTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.EmailEntityTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.RecipientTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.request.EmailLogRequest;
|
||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||
import net.gepafin.tendermanagement.repositories.EmailLogRepository;
|
||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
public class EmailLogDao {
|
||||
|
||||
@Autowired
|
||||
private EmailLogRepository emailLogRepository;
|
||||
|
||||
|
||||
public EmailLogEntity createEmailLog(EmailLogRequest emailLogRequest) {
|
||||
|
||||
EmailLogEntity emailLogEntity = new EmailLogEntity();
|
||||
emailLogEntity.setEmailType(emailLogRequest.getEmailType().getValue());
|
||||
emailLogEntity.setRecipientType(emailLogRequest.getRecipientType().getValue());
|
||||
emailLogEntity.setRecipientId(emailLogRequest.getRecipientId());
|
||||
emailLogEntity.setEmailSubject(emailLogRequest.getEmailSubject());
|
||||
emailLogEntity.setEmailBody(emailLogRequest.getEmailBody());
|
||||
emailLogEntity.setSendStatus(emailLogRequest.getSendStatus());
|
||||
emailLogEntity.setSendDateTime(DateTimeUtil.DateServerToUTC(LocalDateTime.now())); // Set to now if null
|
||||
emailLogEntity.setErrorMessage(emailLogRequest.getErrorMessage());
|
||||
emailLogEntity.setUserId(emailLogRequest.getUserId());
|
||||
emailLogEntity.setEmailServiceResponse(emailLogRequest.getEmailServiceResponse());
|
||||
emailLogEntity.setRecipientEmails(emailLogRequest.getRecipientEmails());
|
||||
emailLogEntity.setEmailServiceType(emailLogRequest.getEmailServiceType().getValue());
|
||||
emailLogEntity.setIsDeleted(false);
|
||||
emailLogEntity.setApplicationId(emailLogRequest.getApplicatioId());
|
||||
emailLogEntity.setAmendmentId(emailLogRequest.getAmendmentId());
|
||||
emailLogEntity.setCallId(emailLogRequest.getCallId());
|
||||
emailLogEntity = saveEmailLogEntity(emailLogEntity);
|
||||
|
||||
return emailLogEntity;
|
||||
}
|
||||
public EmailLogEntity saveEmailLogEntity(EmailLogEntity emailLogEntity){
|
||||
return emailLogRepository.save(emailLogEntity);
|
||||
}
|
||||
public EmailLogRequest createEmailLogRequest(EmailScenarioTypeEnum emailType, RecipientTypeEnum recipientType, Long recipientId,
|
||||
String recipientEmails, Long userId,Long applicationId,Long amendmentId,Long callId) {
|
||||
EmailLogRequest emailLogRequest = new EmailLogRequest();
|
||||
emailLogRequest.setEmailType(emailType);
|
||||
emailLogRequest.setRecipientType(recipientType);
|
||||
emailLogRequest.setRecipientId(recipientId);
|
||||
emailLogRequest.setUserId(userId);
|
||||
emailLogRequest.setRecipientEmails(recipientEmails);
|
||||
emailLogRequest.setApplicatioId(applicationId);
|
||||
emailLogRequest.setAmendmentId(amendmentId);
|
||||
emailLogRequest.setCallId(callId);
|
||||
return emailLogRequest;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user