PEC success emails not saved or included in response
This commit is contained in:
@@ -308,8 +308,14 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
if (Boolean.TRUE.equals(applicationAmendmentRequestResponse.getIsSendEmail())) {
|
if (Boolean.TRUE.equals(applicationAmendmentRequestResponse.getIsSendEmail())) {
|
||||||
emailNotificationDao.sendMailToNotifyBeneficiaryRegardingNewAmendment(applicationAmendmentRequestEntity);
|
emailNotificationDao.sendMailToNotifyBeneficiaryRegardingNewAmendment(applicationAmendmentRequestEntity);
|
||||||
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||||
applicationAmendmentRequestResponse.setEmailSendResponse(emailSendResponse);
|
List<EmailSendResponse> responses = List.of(emailSendResponse);
|
||||||
saveEmailSendResponse(emailSendResponse, applicationAmendmentRequestEntity);
|
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())){
|
||||||
|
saveEmailSendResponse(emailSendResponse, applicationAmendmentRequestEntity);
|
||||||
|
applicationAmendmentRequestResponse.setEmailSendResponse(responses);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
applicationAmendmentRequestResponse.setEmailSendResponse(Collections.emptyList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return applicationAmendmentRequestResponse;
|
return applicationAmendmentRequestResponse;
|
||||||
}
|
}
|
||||||
@@ -516,6 +522,7 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
Long hubId = applicationEntity.getHubId();
|
Long hubId = applicationEntity.getHubId();
|
||||||
HubEntity hubEntity = hubService.valdateHub(hubId);
|
HubEntity hubEntity = hubService.valdateHub(hubId);
|
||||||
|
|
||||||
|
response.setEmailSendResponse(entity.getEmailSendResponse());
|
||||||
response.setId(entity.getId());
|
response.setId(entity.getId());
|
||||||
response.setApplicationId(entity.getApplicationId());
|
response.setApplicationId(entity.getApplicationId());
|
||||||
response.setApplicationEvaluationId(entity.getApplicationEvaluationEntity().getId());
|
response.setApplicationEvaluationId(entity.getApplicationEvaluationEntity().getId());
|
||||||
@@ -654,19 +661,12 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
log.info(" Application amendment deleted with ID: {}", id);
|
log.info(" Application amendment deleted with ID: {}", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationAmendmentRequestResponseBean getApplicationAmendmentRequestById(Long id) {
|
public ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(Long id) {
|
||||||
log.info("Fetching application amendment with ID: {}", id);
|
log.info("Fetching application amendment with ID: {}", id);
|
||||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validateApplicationAmendmentRequest(id);
|
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validateApplicationAmendmentRequest(id);
|
||||||
ApplicationAmendmentRequestResponse sourceResponse = convertEntityToResponse(applicationAmendmentRequestEntity,true);
|
ApplicationAmendmentRequestResponse response = convertEntityToResponse(applicationAmendmentRequestEntity,true);
|
||||||
ApplicationAmendmentRequestResponseBean targetResponse = Utils.convertSourceObjectToDestinationObject(
|
response.setEmailSendResponse(applicationAmendmentRequestEntity.getEmailSendResponse());
|
||||||
sourceResponse, ApplicationAmendmentRequestResponseBean.class
|
return response;
|
||||||
);
|
|
||||||
|
|
||||||
if (targetResponse != null) {
|
|
||||||
targetResponse.setEmailSendResponse(applicationAmendmentRequestEntity.getEmailSendResponse());
|
|
||||||
}
|
|
||||||
log.info("Application Amendment fetched successfully by ID: {}", targetResponse);
|
|
||||||
return targetResponse;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId) {
|
public List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId) {
|
||||||
@@ -1205,8 +1205,14 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
beneficiaryUser.getId(), applicationEntity.getId(), amendment.getId(), applicationEntity.getCall().getId());
|
beneficiaryUser.getId(), applicationEntity.getId(), amendment.getId(), applicationEntity.getCall().getId());
|
||||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email), emailLogRequest);
|
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email), emailLogRequest);
|
||||||
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||||
emailReminderResponse.setEmailSendResponse(emailSendResponse);
|
List<EmailSendResponse> responses = List.of(emailSendResponse);
|
||||||
saveEmailSendResponse(emailSendResponse, amendment);
|
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())){
|
||||||
|
emailReminderResponse.setEmailSendResponse(responses);
|
||||||
|
saveEmailSendResponse(emailSendResponse, amendment);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
emailReminderResponse.setEmailSendResponse(Collections.emptyList());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.BENEFICIARY_EMAIL_NOT_FOUND_MSG));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.BENEFICIARY_EMAIL_NOT_FOUND_MSG));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1092,7 +1092,7 @@ public class ApplicationEvaluationDao {
|
|||||||
}
|
}
|
||||||
validator.validatePreInstructor(request, assignedApplications.getUserId());
|
validator.validatePreInstructor(request, assignedApplications.getUserId());
|
||||||
}
|
}
|
||||||
public ApplicationEvaluationResponseBean getApplicationEvaluationByApplicationId(HttpServletRequest request, UserEntity user, Long applicationID, Long assignedApplicationID) {
|
public ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(HttpServletRequest request, UserEntity user, Long applicationID, Long assignedApplicationID) {
|
||||||
Long applicationId;
|
Long applicationId;
|
||||||
Long assignedApplicationId;
|
Long assignedApplicationId;
|
||||||
validatePreinstructor(request, applicationID, assignedApplicationID);
|
validatePreinstructor(request, applicationID, assignedApplicationID);
|
||||||
@@ -1131,12 +1131,9 @@ public class ApplicationEvaluationDao {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ApplicationEvaluationEntity entity = entityOptional.get();
|
ApplicationEvaluationEntity entity = entityOptional.get();
|
||||||
ApplicationEvaluationResponse response = convertToResponse(entity);
|
ApplicationEvaluationResponse applicationEvaluationResponse = convertToResponse(entity);
|
||||||
ApplicationEvaluationResponseBean targetResponse = Utils.convertSourceObjectToDestinationObject(response, ApplicationEvaluationResponseBean.class);
|
applicationEvaluationResponse.setEmailSendResponse(entity.getEmailSendResponse());
|
||||||
if (targetResponse != null && entity.getEmailSendResponse() != null) {
|
return applicationEvaluationResponse;
|
||||||
targetResponse.setEmailSendResponse(entity.getEmailSendResponse());
|
|
||||||
}
|
|
||||||
return targetResponse;
|
|
||||||
}
|
}
|
||||||
private List<EvaluationDocumentRequest> prepareEvaluationDocumentBeanList(ApplicationEvaluationEntity entity) {
|
private List<EvaluationDocumentRequest> prepareEvaluationDocumentBeanList(ApplicationEvaluationEntity entity) {
|
||||||
List<EvaluationDocumentRequest> docRequest = new ArrayList<>();
|
List<EvaluationDocumentRequest> docRequest = new ArrayList<>();
|
||||||
@@ -1893,12 +1890,16 @@ public class ApplicationEvaluationDao {
|
|||||||
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(application);
|
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(application);
|
||||||
|
|
||||||
|
|
||||||
|
List<EmailSendResponse> responses = new ArrayList<>();
|
||||||
if(newStatus.equals(ApplicationStatusForEvaluation.ADMISSIBLE) && Boolean.TRUE.equals(application.getStatus().equals(ApplicationStatusTypeEnum.APPOINTMENT.getValue()))){
|
if(newStatus.equals(ApplicationStatusForEvaluation.ADMISSIBLE) && Boolean.TRUE.equals(application.getStatus().equals(ApplicationStatusTypeEnum.APPOINTMENT.getValue()))){
|
||||||
application.setStatus(newStatus.getValue());
|
application.setStatus(newStatus.getValue());
|
||||||
log.info("Status updated to ADMISSIBLE for applicationId: " + application.getId());
|
log.info("Status updated to ADMISSIBLE for applicationId: " + application.getId());
|
||||||
emailNotificationDao.sendAdmissibilityNotificationEmailForAdmissibleApplication(application);
|
emailNotificationDao.sendAdmissibilityNotificationEmailForAdmissibleApplication(application);
|
||||||
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||||
saveEmailSendResponseToEvaluation(emailSendResponse,existingEntity);
|
responses = List.of(emailSendResponse);
|
||||||
|
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
|
||||||
|
saveEmailSendResponseToEvaluation(emailSendResponse, existingEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newStatus.equals(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION) && Boolean.TRUE.equals(application.getStatus().equals(ApplicationStatusTypeEnum.ADMISSIBLE.getValue()))){
|
if(newStatus.equals(ApplicationStatusForEvaluation.TECHNICAL_EVALUATION) && Boolean.TRUE.equals(application.getStatus().equals(ApplicationStatusTypeEnum.ADMISSIBLE.getValue()))){
|
||||||
@@ -1945,8 +1946,8 @@ public class ApplicationEvaluationDao {
|
|||||||
|
|
||||||
|
|
||||||
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.APPROVED.getValue())))) {
|
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.APPROVED.getValue())))) {
|
||||||
application.setDateAccepted(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
application.setDateAccepted(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
application.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
application.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
application = applicationRepository.save(application);
|
application = applicationRepository.save(application);
|
||||||
// emailNotificationDao.sendAdmissibilityNotificationEmailForApprovedApplication(application);
|
// emailNotificationDao.sendAdmissibilityNotificationEmailForApprovedApplication(application);
|
||||||
}
|
}
|
||||||
@@ -1956,7 +1957,10 @@ public class ApplicationEvaluationDao {
|
|||||||
application = applicationRepository.save(application);
|
application = applicationRepository.save(application);
|
||||||
emailNotificationDao.sendInadmissibilityEmailForRejectedApplication(application,existingEntity);
|
emailNotificationDao.sendInadmissibilityEmailForRejectedApplication(application,existingEntity);
|
||||||
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||||
saveEmailSendResponseToEvaluation(emailSendResponse,existingEntity);
|
responses = List.of(emailSendResponse);
|
||||||
|
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
|
||||||
|
saveEmailSendResponseToEvaluation(emailSendResponse, existingEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_RESULT);
|
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_RESULT);
|
||||||
@@ -1964,7 +1968,9 @@ public class ApplicationEvaluationDao {
|
|||||||
notificationDao.sendNotificationToInstructor(placeHolders,existingEntity,NotificationTypeEnum.EVALUATION_RESULT);
|
notificationDao.sendNotificationToInstructor(placeHolders,existingEntity,NotificationTypeEnum.EVALUATION_RESULT);
|
||||||
|
|
||||||
ApplicationEvaluationResponse response = convertToResponse(entity);
|
ApplicationEvaluationResponse response = convertToResponse(entity);
|
||||||
response.setEmailSendResponse(emailSendResponse);
|
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
|
||||||
|
response.setEmailSendResponse(responses);
|
||||||
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -2029,6 +2035,7 @@ public class ApplicationEvaluationDao {
|
|||||||
|
|
||||||
ApplicationEvaluationEntity entity = applicationEvaluationService.validateApplicationEvaluation(evaluationResponse.getId());
|
ApplicationEvaluationEntity entity = applicationEvaluationService.validateApplicationEvaluation(evaluationResponse.getId());
|
||||||
|
|
||||||
|
|
||||||
//Handling Application Evaluation form
|
//Handling Application Evaluation form
|
||||||
EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
|
EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
|
||||||
validateFormFields(applicationEvaluationFormRequestBean,evaluationFormEntity);
|
validateFormFields(applicationEvaluationFormRequestBean,evaluationFormEntity);
|
||||||
@@ -2037,7 +2044,9 @@ public class ApplicationEvaluationDao {
|
|||||||
validateFormFieldCustom(applicationEvaluationFormRequestBean.getFormFields(),entity,evaluationFormEntity);
|
validateFormFieldCustom(applicationEvaluationFormRequestBean.getFormFields(),entity,evaluationFormEntity);
|
||||||
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,entity);
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,entity);
|
||||||
createOrUpdateMultipleFormFields(applicationEvaluationFormRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
|
createOrUpdateMultipleFormFields(applicationEvaluationFormRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
|
||||||
return processEvaluationForm(entity);
|
ApplicationEvaluationFormResponse response = processEvaluationForm(entity);
|
||||||
|
response.setEmailSendResponse(evaluationResponse.getEmailSendResponse());
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApplicationEvaluationFormEntity getApplicationEvaluationFormOrCreate(EvaluationFormEntity evaluationFormEntity, ApplicationEvaluationEntity applicationEvaluationEntity) {
|
private ApplicationEvaluationFormEntity getApplicationEvaluationFormOrCreate(EvaluationFormEntity evaluationFormEntity, ApplicationEvaluationEntity applicationEvaluationEntity) {
|
||||||
@@ -2282,6 +2291,7 @@ public class ApplicationEvaluationDao {
|
|||||||
}
|
}
|
||||||
response.setCompanyVatNumber(company.getVatNumber());
|
response.setCompanyVatNumber(company.getVatNumber());
|
||||||
response.setCompanyCodiceAteco(company.getCodiceAteco());
|
response.setCompanyCodiceAteco(company.getCodiceAteco());
|
||||||
|
response.setEmailSendResponse(evaluationEntity.getEmailSendResponse());
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,9 +161,10 @@ public class EmailDao {
|
|||||||
private boolean updateEmailSendResponse(List<EmailSendResponse> responses, String scenario) {
|
private boolean updateEmailSendResponse(List<EmailSendResponse> responses, String scenario) {
|
||||||
if (responses == null || responses.isEmpty()) return false;
|
if (responses == null || responses.isEmpty()) return false;
|
||||||
|
|
||||||
for (EmailSendResponse response : responses) {
|
for (Iterator<EmailSendResponse> iterator = responses.iterator(); iterator.hasNext(); ) {
|
||||||
|
EmailSendResponse response = iterator.next();
|
||||||
if (scenario.equals(response.getEmailScenario().getValue())) {
|
if (scenario.equals(response.getEmailScenario().getValue())) {
|
||||||
response.setIsEmailSend(true);
|
iterator.remove(); // remove only the first match
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,6 +173,7 @@ 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.findByUserActionIdAndEmailServiceType(userActionId,EmailServiceTypeEnum.PEC_SERVICE.getValue());
|
List<EmailLogEntity> emailLogs = emailLogRepository.findByUserActionIdAndEmailServiceType(userActionId,EmailServiceTypeEnum.PEC_SERVICE.getValue());
|
||||||
|
|||||||
@@ -149,17 +149,25 @@ public class UserDao {
|
|||||||
/** This code is responsible for adding a version history log for the "Create user" operation. **/
|
/** This code is responsible for adding a version history log for the "Create user" operation. **/
|
||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).newData(userEntity).build());
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).newData(userEntity).build());
|
||||||
|
|
||||||
EmailSendResponse emailSendResponse = new EmailSendResponse();
|
List<EmailSendResponse> responses = new ArrayList<>();
|
||||||
if(Boolean.FALSE.equals(roleEntity.getRoleType().equals(RoleStatusEnum.ROLE_BENEFICIARY.getValue()))){
|
if(Boolean.FALSE.equals(roleEntity.getRoleType().equals(RoleStatusEnum.ROLE_BENEFICIARY.getValue()))){
|
||||||
sendEmailToOnboardingUser(userEntity, userReq );
|
sendEmailToOnboardingUser(userEntity, userReq );
|
||||||
boolean isEmailSendSuccess = isEmailSentSuccessfully(userEntity.getId());
|
boolean isEmailSendSuccess = isEmailSentSuccessfully(userEntity.getId());
|
||||||
emailSendResponse.setIsEmailSend(isEmailSendSuccess);
|
EmailSendResponse emailSendResponse = new EmailSendResponse();
|
||||||
Long userActionId =(Long)request.getAttribute(GepafinConstant.USER_ACTION_ID);
|
if (Boolean.FALSE.equals(isEmailSendSuccess)){
|
||||||
emailSendResponse.setUserActionId(userActionId);
|
emailSendResponse.setIsEmailSend(false);
|
||||||
emailSendResponse.setEmailScenario(EmailScenarioTypeEnum.USER_CREATION);
|
Long userActionId =(Long)request.getAttribute(GepafinConstant.USER_ACTION_ID);
|
||||||
saveEmailSendResponseToUser(emailSendResponse,userEntity);
|
emailSendResponse.setUserActionId(userActionId);
|
||||||
|
emailSendResponse.setEmailScenario(EmailScenarioTypeEnum.USER_CREATION);
|
||||||
|
|
||||||
|
saveEmailSendResponseToUser(emailSendResponse,userEntity);
|
||||||
|
responses = List.of(emailSendResponse);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
responses = Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
JWTToken token = authService.getJWTTokenBean(userEntity, Boolean.TRUE, loginAttemptEntity.getId(),emailSendResponse);
|
JWTToken token = authService.getJWTTokenBean(userEntity, Boolean.TRUE, loginAttemptEntity.getId(),responses);
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,8 +517,14 @@ public class UserDao {
|
|||||||
sendResetPasswordTokenEmail(user, token);
|
sendResetPasswordTokenEmail(user, token);
|
||||||
InitiatePasswordResetResponse initiatePasswordResetResponse = new InitiatePasswordResetResponse();
|
InitiatePasswordResetResponse initiatePasswordResetResponse = new InitiatePasswordResetResponse();
|
||||||
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||||
initiatePasswordResetResponse.setEmailSendResponse(emailSendResponse);
|
List<EmailSendResponse> responses = List.of(emailSendResponse);
|
||||||
saveEmailSendResponseToUser(emailSendResponse,user);
|
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())){
|
||||||
|
initiatePasswordResetResponse.setEmailSendResponse(responses);
|
||||||
|
saveEmailSendResponseToUser(emailSendResponse,user);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
initiatePasswordResetResponse.setEmailSendResponse(Collections.emptyList());
|
||||||
|
}
|
||||||
return initiatePasswordResetResponse;
|
return initiatePasswordResetResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public class EmailSendResponseConverter implements AttributeConverter<List<Email
|
|||||||
@Override
|
@Override
|
||||||
public String convertToDatabaseColumn(List<EmailSendResponse> attribute) {
|
public String convertToDatabaseColumn(List<EmailSendResponse> attribute) {
|
||||||
try {
|
try {
|
||||||
|
if (attribute == null) {
|
||||||
|
attribute = List.of();
|
||||||
|
}
|
||||||
return objectMapper.writeValueAsString(attribute);
|
return objectMapper.writeValueAsString(attribute);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
throw new IllegalArgumentException("Error converting list to JSON", e);
|
throw new IllegalArgumentException("Error converting list to JSON", e);
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ public class ApplicationAmendmentRequestResponse {
|
|||||||
private String internalNote;
|
private String internalNote;
|
||||||
private ApplicationAmendmentRequestEnum status;
|
private ApplicationAmendmentRequestEnum status;
|
||||||
private String emailTemplate;
|
private String emailTemplate;
|
||||||
private EmailSendResponse emailSendResponse;
|
private List<EmailSendResponse> emailSendResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,5 +48,6 @@ public class ApplicationEvaluationFormResponse {
|
|||||||
private Long appointmentTemplateId;
|
private Long appointmentTemplateId;
|
||||||
private String companyVatNumber;
|
private String companyVatNumber;
|
||||||
private String companyCodiceAteco;
|
private String companyCodiceAteco;
|
||||||
|
private List<EmailSendResponse> emailSendResponse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,6 @@ public class ApplicationEvaluationResponse {
|
|||||||
private EvaluationVersionEnum evaluationVersion;
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
private String companyVatNumber;
|
private String companyVatNumber;
|
||||||
private String companyCodiceAteco;
|
private String companyCodiceAteco;
|
||||||
private EmailSendResponse emailSendResponse;
|
private List<EmailSendResponse> emailSendResponse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class EmailReminderResponse {
|
public class EmailReminderResponse {
|
||||||
|
|
||||||
@JsonProperty("emailSendResponse")
|
@JsonProperty("emailSendResponse")
|
||||||
private EmailSendResponse emailSendResponse;
|
private List<EmailSendResponse> emailSendResponse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,11 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class InitiatePasswordResetResponse {
|
public class InitiatePasswordResetResponse {
|
||||||
private EmailSendResponse emailSendResponse;
|
private List<EmailSendResponse> emailSendResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import lombok.Data;
|
|||||||
import net.gepafin.tendermanagement.model.response.EmailSendResponse;
|
import net.gepafin.tendermanagement.model.response.EmailSendResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.LoginResponse;
|
import net.gepafin.tendermanagement.model.response.LoginResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JWTToken
|
* JWTToken
|
||||||
*/
|
*/
|
||||||
@@ -18,14 +20,14 @@ public class JWTToken {
|
|||||||
private LoginResponse loginResponse;
|
private LoginResponse loginResponse;
|
||||||
|
|
||||||
@JsonProperty("emailSendResponse")
|
@JsonProperty("emailSendResponse")
|
||||||
private EmailSendResponse emailSendResponse;
|
private List<EmailSendResponse> emailSendResponse;
|
||||||
|
|
||||||
public JWTToken(String token, LoginResponse loginResponse) {
|
public JWTToken(String token, LoginResponse loginResponse) {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.loginResponse = loginResponse;
|
this.loginResponse = loginResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JWTToken(String token, LoginResponse loginResponse, EmailSendResponse emailSendResponse) {
|
public JWTToken(String token, LoginResponse loginResponse, List<EmailSendResponse> emailSendResponse) {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.loginResponse = loginResponse;
|
this.loginResponse = loginResponse;
|
||||||
this.emailSendResponse = emailSendResponse;
|
this.emailSendResponse = emailSendResponse;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public interface ApplicationAmendmentRequestService {
|
|||||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request,Long applicationEvaluationId);
|
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request,Long applicationEvaluationId);
|
||||||
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest);
|
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest);
|
||||||
void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id);
|
void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id);
|
||||||
ApplicationAmendmentRequestResponseBean getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
|
ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
|
||||||
List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId);
|
List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId);
|
||||||
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
||||||
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);
|
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public interface ApplicationEvaluationService {
|
|||||||
|
|
||||||
void deleteApplicationEvaluation(HttpServletRequest request,Long id);
|
void deleteApplicationEvaluation(HttpServletRequest request,Long id);
|
||||||
|
|
||||||
ApplicationEvaluationResponseBean getApplicationEvaluationByApplicationId(HttpServletRequest request,Long applicationId,Long assignedApplicationId);
|
ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(HttpServletRequest request,Long applicationId,Long assignedApplicationId);
|
||||||
ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId);
|
ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId);
|
||||||
|
|
||||||
ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId);
|
ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApplicationAmendmentRequestResponseBean getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
|
public ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
|
||||||
ApplicationAmendmentRequestEntity amendment = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id)
|
ApplicationAmendmentRequestEntity amendment = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id)
|
||||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||||
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG)));
|
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG)));
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public ApplicationEvaluationResponseBean getApplicationEvaluationByApplicationId(
|
public ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(
|
||||||
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||||
UserEntity preInstructor = validator.validateUser(request);
|
UserEntity preInstructor = validator.validateUser(request);
|
||||||
return applicationEvaluationDao.getApplicationEvaluationByApplicationId(
|
return applicationEvaluationDao.getApplicationEvaluationByApplicationId(
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ public class AuthenticationService {
|
|||||||
loginAttemptEntity.setErrorMsg(errorMsg);
|
loginAttemptEntity.setErrorMsg(errorMsg);
|
||||||
loginAttemptDao.createLoginAttempt(loginAttemptEntity);
|
loginAttemptDao.createLoginAttempt(loginAttemptEntity);
|
||||||
}
|
}
|
||||||
public JWTToken getJWTTokenBean(UserEntity user, Boolean rememberMe, Long loginAttemptId, EmailSendResponse emailSendResponse) {
|
public JWTToken getJWTTokenBean(UserEntity user, Boolean rememberMe, Long loginAttemptId, List<EmailSendResponse> emailSendResponse) {
|
||||||
UserEntity oldUserEntity = Utils.getClonedEntityForData(user);
|
UserEntity oldUserEntity = Utils.getClonedEntityForData(user);
|
||||||
user.setLastLogin(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
user.setLastLogin(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
user = userRepository.save(user);
|
user = userRepository.save(user);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public interface ApplicationAmendmentRequestApi {
|
|||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@GetMapping(value = "", produces = "application/json")
|
@GetMapping(value = "", produces = "application/json")
|
||||||
ResponseEntity<Response<ApplicationAmendmentRequestResponseBean>> getApplicationAmendmentRequestById(HttpServletRequest request,@Parameter(description = "The application amendment id", required = true) @RequestParam(value = "id", required = true) Long id);
|
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> getApplicationAmendmentRequestById(HttpServletRequest request,@Parameter(description = "The application amendment id", required = true) @RequestParam(value = "id", required = true) Long id);
|
||||||
|
|
||||||
@Operation(summary = "Api to get all applications amendment request by preInstructor user Id (deprecated)",
|
@Operation(summary = "Api to get all applications amendment request by preInstructor user Id (deprecated)",
|
||||||
responses = {
|
responses = {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public interface ApplicationEvaluationApi {
|
|||||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) }))
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) }))
|
||||||
})
|
})
|
||||||
@GetMapping(value = "/application", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = "/application", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
ResponseEntity<Response<ApplicationEvaluationResponseBean>> getApplicationEvaluationByApplicationId(
|
ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
|
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
|
||||||
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
|
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
|
||||||
|
|||||||
@@ -69,14 +69,14 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<ApplicationAmendmentRequestResponseBean>> getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
|
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
|
||||||
log.info("Get Application Amendment Request By Id");
|
log.info("Get Application Amendment Request By Id");
|
||||||
|
|
||||||
/** This code is responsible for creating user action logs for the "get application amendment by id" operation. **/
|
/** This code is responsible for creating user action logs for the "get application amendment by id" operation. **/
|
||||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
.actionContext(UserActionContextEnum.GET_AMENDMENT).build());
|
.actionContext(UserActionContextEnum.GET_AMENDMENT).build());
|
||||||
|
|
||||||
ApplicationAmendmentRequestResponseBean applicationAmendmentRequestResponse = applicationAmendmentRequestService.getApplicationAmendmentRequestById(request,id);
|
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = applicationAmendmentRequestService.getApplicationAmendmentRequestById(request,id);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(applicationAmendmentRequestResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
|
.body(new Response<>(applicationAmendmentRequestResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
|
||||||
}
|
}
|
||||||
@@ -185,11 +185,6 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
|
|||||||
|
|
||||||
EmailReminderResponse emailSendResponse = applicationAmendmentRequestService.sendReminderEmail(request,amendmentId);
|
EmailReminderResponse emailSendResponse = applicationAmendmentRequestService.sendReminderEmail(request,amendmentId);
|
||||||
|
|
||||||
if (!emailSendResponse.getEmailSendResponse().getIsEmailSend()) {
|
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
|
||||||
.body(new Response<>(emailSendResponse, Status.EXCEPTION_ERROR, Translator.toLocale(GepafinConstant.REMINDER_EMAIL_FAILED_MSG)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(emailSendResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.REMINDER_EMAIL_SENT_SUCCESS_MSG)));
|
.body(new Response<>(emailSendResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.REMINDER_EMAIL_SENT_SUCCESS_MSG)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<ApplicationEvaluationResponseBean>> getApplicationEvaluationByApplicationId(
|
public ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
|
||||||
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||||
|
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
|||||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_APPLICATION_EVALUATION).build());
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_APPLICATION_EVALUATION).build());
|
||||||
|
|
||||||
|
|
||||||
ApplicationEvaluationResponseBean response = null;
|
ApplicationEvaluationResponse response = null;
|
||||||
response = applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId,assignedApplicationId);
|
response = applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId,assignedApplicationId);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FETCHED_SUCCESSFULLY)));
|
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FETCHED_SUCCESSFULLY)));
|
||||||
|
|||||||
Reference in New Issue
Block a user