Resolved conflicts
This commit is contained in:
@@ -543,6 +543,12 @@ public class GepafinConstant {
|
||||
|
||||
public static final String READMIT_APPLICATION_SUCCESS = "application.readmit.success";
|
||||
|
||||
public static final String NO_EMAIL_LOG_FOUND = "no.email.log.msg";
|
||||
public static final String USER_ACTION_ID_NOT_FOUND = "user.action.id.not.found";
|
||||
|
||||
public static final String CAUSE_STRING = "cause" ;
|
||||
public static final String ERROR_DESCRIPTION_STRING = "errorDescription" ;
|
||||
public static final String ERROR_STRING = "errors";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -654,12 +654,19 @@ public class ApplicationAmendmentRequestDao {
|
||||
log.info(" Application amendment deleted with ID: {}", id);
|
||||
}
|
||||
|
||||
public ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(Long id) {
|
||||
public ApplicationAmendmentRequestResponseBean getApplicationAmendmentRequestById(Long id) {
|
||||
log.info("Fetching application amendment with ID: {}", id);
|
||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validateApplicationAmendmentRequest(id);
|
||||
ApplicationAmendmentRequestResponse response = convertEntityToResponse(applicationAmendmentRequestEntity,true);
|
||||
log.info("Application Amendment fetched successfully by ID: {}", response);
|
||||
return response;
|
||||
ApplicationAmendmentRequestResponse sourceResponse = convertEntityToResponse(applicationAmendmentRequestEntity,true);
|
||||
ApplicationAmendmentRequestResponseBean targetResponse = Utils.convertSourceObjectToDestinationObject(
|
||||
sourceResponse, ApplicationAmendmentRequestResponseBean.class
|
||||
);
|
||||
|
||||
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) {
|
||||
|
||||
@@ -176,6 +176,12 @@ public class AppointmentDao {
|
||||
}
|
||||
|
||||
private HubEntity loginToOdessa(HubEntity hub, ApplicationEntity application) {
|
||||
|
||||
int maxRetries = 3;
|
||||
int attempt = 0;
|
||||
boolean success = false;
|
||||
while (attempt < maxRetries && !success) {
|
||||
attempt++;
|
||||
try {
|
||||
//code to generate token with payload having "iat" epoch timestamp and secret key with no expiry and send in below method call
|
||||
String authJwtToken = Utils.generateAuthTokenForLoginToOdessa();
|
||||
@@ -195,15 +201,15 @@ public class AppointmentDao {
|
||||
hub.setAreaCode(parsedResponse.getAreaCode());
|
||||
hubRepository.save(hub);
|
||||
log.info("Saved new authToken and areaCode for Hub.");
|
||||
success = true;
|
||||
return hub;
|
||||
} else {
|
||||
throw new RuntimeException("Login response is missing a valid tokenId for login to odessa system, please try again.");
|
||||
}
|
||||
}
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.ERROR_IN_GENERATING_NDG_TRY_AGAIN));
|
||||
}
|
||||
catch (FeignException.Forbidden forbiddenException) {
|
||||
logForbiddenError();
|
||||
} catch (FeignException.Forbidden forbiddenException) {
|
||||
log.error("Failed to login to odessa due to some error");
|
||||
|
||||
// Extract raw response body
|
||||
String responseBody = forbiddenException.contentUTF8(); // Extract raw JSON response
|
||||
@@ -239,15 +245,12 @@ public class AppointmentDao {
|
||||
} catch (IOException e) {
|
||||
log.error("Error parsing JSON response: {}", e.getMessage());
|
||||
}
|
||||
|
||||
// Regenerate the token and retry
|
||||
loginToOdessa(hub, application);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to authenticate user on Odessa : {}", e.getMessage(), e);
|
||||
throw new RuntimeException("Authentication failed on Odessa. try again", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void startAsyncNdgProcessing(Long applicationId) {
|
||||
@@ -423,76 +426,80 @@ public class AppointmentDao {
|
||||
|
||||
private HubEntity authenticateAndSaveToken(HubEntity hub) {
|
||||
|
||||
try {
|
||||
//code to generate token with payload having "iat" epoch timestamp and secret key with no expiry and send in below method call
|
||||
String authJwtToken = Utils.generateAuthTokenForLoginToOdessa();
|
||||
log.info("Got the auth for login to odessa {}", authJwtToken);
|
||||
hub.setAuthToken(authJwtToken);
|
||||
hubRepository.save(hub);
|
||||
// Prepare the request body (adjust if necessary for login API)
|
||||
Map<String, Object> body = Collections.emptyMap();
|
||||
// Perform login API call
|
||||
ResponseEntity<Object> responseLogin = appointmentApiService.loginWithOdessa(authJwtToken, source, context, user, password, body);
|
||||
|
||||
// Handle successful login
|
||||
if (responseLogin.getStatusCode() == HttpStatus.OK) {
|
||||
log.info("Login successful to odessa. Parsing response.");
|
||||
String loginResponseJson = Utils.convertObjectToJson(responseLogin.getBody());
|
||||
AppointmentLoginResponse parsedResponse = parseLoginResponse(loginResponseJson);
|
||||
|
||||
// Validate and save token
|
||||
if (parsedResponse.getTokenId() != null) {
|
||||
hub.setAppointmentAuthTokenId(parsedResponse.getTokenId());
|
||||
hub.setAreaCode(parsedResponse.getAreaCode());
|
||||
hubRepository.save(hub);
|
||||
|
||||
log.info("Saved new authToken and areaCode for Hub.");
|
||||
return hub;
|
||||
} else {
|
||||
throw new RuntimeException("Login response is missing a valid tokenId for login to odessa system, please try again.");
|
||||
}
|
||||
}
|
||||
// Handle non-OK response
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.ERROR_IN_GENERATING_NDG_TRY_AGAIN));
|
||||
} catch (FeignException.Forbidden forbiddenException) {
|
||||
logForbiddenError();
|
||||
|
||||
// Extract raw response body
|
||||
String responseBody = forbiddenException.contentUTF8(); // Extract raw JSON response
|
||||
|
||||
// Parse JSON to check for "PasswordExpired"
|
||||
int maxRetries = 3;
|
||||
int attempt = 0;
|
||||
boolean success = false;
|
||||
while (attempt < maxRetries && !success) {
|
||||
attempt++;
|
||||
try {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode rootNode = objectMapper.readTree(responseBody);
|
||||
JsonNode errorsNode = rootNode.path("errors");
|
||||
//code to generate token with payload having "iat" epoch timestamp and secret key with no expiry and send in below method call
|
||||
String authJwtToken = Utils.generateAuthTokenForLoginToOdessa();
|
||||
log.info("Got the auth for login to odessa {}", authJwtToken);
|
||||
hub.setAuthToken(authJwtToken);
|
||||
hubRepository.save(hub);
|
||||
// Prepare the request body (adjust if necessary for login API)
|
||||
Map<String, Object> body = Collections.emptyMap();
|
||||
// Perform login API call
|
||||
ResponseEntity<Object> responseLogin = appointmentApiService.loginWithOdessa(authJwtToken, source, context, user, password, body);
|
||||
|
||||
if (errorsNode.isArray()) {
|
||||
for (JsonNode error : errorsNode) {
|
||||
// Check the main errorCode
|
||||
if (GepafinConstant.PASSWORD_EXPIRED.equals(error.path("errorCode").asText())) {
|
||||
throw new CustomValidationException(Status.FORBIDDEN, Translator.toLocale(GepafinConstant.PASSWORD_EXPIRED_LOGIN_TO_ODESSA));
|
||||
}
|
||||
// Handle successful login
|
||||
if (responseLogin.getStatusCode() == HttpStatus.OK) {
|
||||
log.info("Login successful to odessa. Parsing response.");
|
||||
String loginResponseJson = Utils.convertObjectToJson(responseLogin.getBody());
|
||||
AppointmentLoginResponse parsedResponse = parseLoginResponse(loginResponseJson);
|
||||
|
||||
// Check inside "subErrors"
|
||||
JsonNode subErrorsNode = error.path("subErrors");
|
||||
if (subErrorsNode.isArray()) {
|
||||
for (JsonNode subError : subErrorsNode) {
|
||||
if (GepafinConstant.PASSWORD_EXPIRED.equals(subError.path("errorCode").asText())) {
|
||||
throw new CustomValidationException(Status.FORBIDDEN, Translator.toLocale(GepafinConstant.PASSWORD_EXPIRED_LOGIN_TO_ODESSA));
|
||||
// Validate and save token
|
||||
if (parsedResponse.getTokenId() != null) {
|
||||
hub.setAppointmentAuthTokenId(parsedResponse.getTokenId());
|
||||
hub.setAreaCode(parsedResponse.getAreaCode());
|
||||
hubRepository.save(hub);
|
||||
|
||||
log.info("Saved new authToken and areaCode for Hub.");
|
||||
success = true;
|
||||
return hub;
|
||||
} else {
|
||||
throw new RuntimeException("Login response is missing a valid tokenId for login to odessa system, please try again.");
|
||||
}
|
||||
}
|
||||
// Handle non-OK response
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.ERROR_IN_GENERATING_NDG_TRY_AGAIN));
|
||||
} catch (FeignException.Forbidden forbiddenException) {
|
||||
log.error("Failed to login to odessa due to some error occurred.");
|
||||
|
||||
// Extract raw response body
|
||||
String responseBody = forbiddenException.contentUTF8(); // Extract raw JSON response
|
||||
|
||||
// Parse JSON to check for "PasswordExpired"
|
||||
try {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode rootNode = objectMapper.readTree(responseBody);
|
||||
JsonNode errorsNode = rootNode.path("errors");
|
||||
|
||||
if (errorsNode.isArray()) {
|
||||
for (JsonNode error : errorsNode) {
|
||||
// Check the main errorCode
|
||||
if (GepafinConstant.PASSWORD_EXPIRED.equals(error.path("errorCode").asText())) {
|
||||
throw new CustomValidationException(Status.FORBIDDEN, Translator.toLocale(GepafinConstant.PASSWORD_EXPIRED_LOGIN_TO_ODESSA));
|
||||
}
|
||||
|
||||
// Check inside "subErrors"
|
||||
JsonNode subErrorsNode = error.path("subErrors");
|
||||
if (subErrorsNode.isArray()) {
|
||||
for (JsonNode subError : subErrorsNode) {
|
||||
if (GepafinConstant.PASSWORD_EXPIRED.equals(subError.path("errorCode").asText())) {
|
||||
throw new CustomValidationException(Status.FORBIDDEN, Translator.toLocale(GepafinConstant.PASSWORD_EXPIRED_LOGIN_TO_ODESSA));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Error parsing JSON response: {}", e.getMessage());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Error parsing JSON response: {}", e.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to authenticate user on Odessa : {}", e.getMessage(), e);
|
||||
throw new RuntimeException("Authentication failed on Odessa. try again", e);
|
||||
}
|
||||
|
||||
// Regenerate the token and retry
|
||||
regenerateTokenAndSave(hub);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to authenticate user on Odessa : {}", e.getMessage(), e);
|
||||
throw new RuntimeException("Authentication failed on Odessa. try again", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -758,12 +765,31 @@ public class AppointmentDao {
|
||||
|
||||
if (appointmentResponse.getBody() != null) {
|
||||
log.info("Appointment API Response : {}", appointmentResponse.getBody());
|
||||
Map<String, Object> responseBody = (Map<String, Object>) appointmentResponse.getBody();
|
||||
if (responseBody.containsKey(GepafinConstant.DATA_STRING)) {
|
||||
Map<String, Object> data = (Map<String, Object>) responseBody.get(GepafinConstant.DATA_STRING);
|
||||
if (data != null && data.containsKey(GepafinConstant.ID_STRING)) {
|
||||
return data.get(GepafinConstant.ID_STRING).toString();
|
||||
try {
|
||||
Map<String, Object> responseBody = (Map<String, Object>) appointmentResponse.getBody();
|
||||
// 1. Try to get appointment ID from data.id
|
||||
if (responseBody.containsKey(GepafinConstant.DATA_STRING)) {
|
||||
Map<String, Object> data = (Map<String, Object>) responseBody.get(GepafinConstant.DATA_STRING);
|
||||
if (data != null && data.containsKey(GepafinConstant.ID_STRING)) {
|
||||
return data.get(GepafinConstant.ID_STRING).toString();
|
||||
}
|
||||
}
|
||||
// 2. If ID not present, check errors[0].cause.errorDescription
|
||||
if (responseBody.containsKey(GepafinConstant.ERROR_STRING)) {
|
||||
List<Map<String, Object>> errors = (List<Map<String, Object>>) responseBody.get(GepafinConstant.ERROR_STRING);
|
||||
if (errors != null && !errors.isEmpty()) {
|
||||
Map<String, Object> firstError = errors.get(0);
|
||||
if (firstError.containsKey(GepafinConstant.CAUSE_STRING)) {
|
||||
Map<String, Object> cause = (Map<String, Object>) firstError.get(GepafinConstant.CAUSE_STRING);
|
||||
if (cause != null && cause.containsKey(GepafinConstant.ERROR_DESCRIPTION_STRING)) {
|
||||
String errorDescription = cause.get(GepafinConstant.ERROR_DESCRIPTION_STRING).toString();
|
||||
log.warn("Appointment creation failed: {}", errorDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Error while extracting appointment ID or parsing error message", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -3,9 +3,9 @@ package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.entities.EmailLogEntity;
|
||||
import net.gepafin.tendermanagement.entities.*;
|
||||
import net.gepafin.tendermanagement.enums.EmailScenarioTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.EmailServiceTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.RecipientTypeEnum;
|
||||
@@ -13,9 +13,12 @@ import net.gepafin.tendermanagement.enums.StatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.request.EmailLogRequest;
|
||||
import net.gepafin.tendermanagement.model.response.EmailResendResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.EmailSendResponse;
|
||||
import net.gepafin.tendermanagement.repositories.EmailLogRepository;
|
||||
import net.gepafin.tendermanagement.repositories.*;
|
||||
import net.gepafin.tendermanagement.service.CallService;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -38,10 +41,28 @@ public class EmailDao {
|
||||
@Autowired
|
||||
private EmailLogDao emailLogDao;
|
||||
|
||||
@Autowired
|
||||
private UserActionsRepository userActionsRepository;
|
||||
|
||||
@Autowired
|
||||
private ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
||||
|
||||
public EmailResendResponseBean resendEmail(HttpServletRequest request , Long userActionId){
|
||||
UserActionEntity userActionEntity = userActionsRepository.findUserActionByIdAndIsDeletedFalse(userActionId);
|
||||
if(userActionEntity == null){
|
||||
throw new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.USER_ACTION_ID_NOT_FOUND));
|
||||
}
|
||||
List<EmailLogEntity> emailLogs = emailLogRepository.findByUserActionIdAndEmailServiceTypeAndSendStatus(userActionId,EmailServiceTypeEnum.PEC_SERVICE.getValue(),StatusTypeEnum.FAILED.getValue());
|
||||
|
||||
if (emailLogs.isEmpty()) {
|
||||
log.info("No emails found for given userActionId.");
|
||||
log.info("No emails found for given userActionId: {}",userActionId);
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.NO_EMAIL_LOG_FOUND));
|
||||
}
|
||||
EmailResendResponseBean emailResendResponseBean = new EmailResendResponseBean();
|
||||
for (EmailLogEntity log : emailLogs){
|
||||
@@ -67,23 +88,104 @@ public class EmailDao {
|
||||
}
|
||||
EmailSendResponse emailSendResponse = buildEmailSendResponseFromRequest(request);
|
||||
emailResendResponseBean.setEmailSendResponse(emailSendResponse);
|
||||
|
||||
if (Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())){
|
||||
updateEmailSendStatusIfSuccessful(emailSendResponse);
|
||||
}
|
||||
return emailResendResponseBean;
|
||||
}
|
||||
|
||||
private void updateEmailSendStatusIfSuccessful(EmailSendResponse emailSendResponse){
|
||||
Long actionId = emailSendResponse.getUserActionId();
|
||||
|
||||
EmailLogEntity emailLog = emailLogRepository.findTopByUserActionIdAndEmailServiceTypeAndSendStatusOrderByIdDesc(
|
||||
actionId,
|
||||
EmailServiceTypeEnum.PEC_SERVICE.getValue(),
|
||||
StatusTypeEnum.SUCCESS.getValue()
|
||||
);
|
||||
if (emailLog != null) {
|
||||
switch (emailSendResponse.getEmailScenario()) {
|
||||
case APPLICATION_AMENDMENT_REQUESTED:
|
||||
case APPLICATION_AMENDMENT_REMINDER:
|
||||
updateApplicationAmendmentStatus(emailLog, emailSendResponse.getEmailScenario().getValue());
|
||||
break;
|
||||
|
||||
case USER_CREATION:
|
||||
case PASSWORD_RESET_REQUEST:
|
||||
updateUserEmailStatus(emailLog, emailSendResponse.getEmailScenario().getValue());
|
||||
break;
|
||||
|
||||
case APPLICATION_ADMISSIBLE:
|
||||
case APPLICATION_REJECTED:
|
||||
updateApplicationEvaluationStatus(emailLog, emailSendResponse.getEmailScenario().getValue());
|
||||
break;
|
||||
|
||||
default:
|
||||
log.warn("Unhandled email scenario: {}", emailSendResponse.getEmailScenario());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateApplicationAmendmentStatus(EmailLogEntity log, String scenario) {
|
||||
if (log.getAmendmentId() != null) {
|
||||
applicationAmendmentRequestRepository.findById(log.getAmendmentId()).ifPresent(amendment -> {
|
||||
if (updateEmailSendResponse(amendment.getEmailSendResponse(), scenario)) {
|
||||
applicationAmendmentRequestRepository.save(amendment);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void updateApplicationEvaluationStatus(EmailLogEntity log, String scenario) {
|
||||
if (log.getApplicationId() != null) {
|
||||
ApplicationEvaluationEntity evaluation = applicationEvaluationRepository.findByApplicationId(log.getApplicationId());
|
||||
if (evaluation != null && updateEmailSendResponse(evaluation.getEmailSendResponse(), scenario)) {
|
||||
applicationEvaluationRepository.save(evaluation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUserEmailStatus(EmailLogEntity log, String scenario) {
|
||||
if (log.getUserId() != null) {
|
||||
userRepository.findById(log.getUserId()).ifPresent(user -> {
|
||||
if (updateEmailSendResponse(user.getEmailSendResponse(), scenario)) {
|
||||
userRepository.save(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private boolean updateEmailSendResponse(List<EmailSendResponse> responses, String scenario) {
|
||||
if (responses == null || responses.isEmpty()) return false;
|
||||
|
||||
for (EmailSendResponse response : responses) {
|
||||
if (scenario.equals(response.getEmailScenario().getValue())) {
|
||||
response.setIsEmailSend(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public EmailSendResponse buildEmailSendResponseFromRequest(HttpServletRequest request) {
|
||||
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;
|
||||
String emailScenario = null;
|
||||
|
||||
for (EmailLogEntity log : emailLogs) {
|
||||
|
||||
if (emailScenario == null) {
|
||||
emailScenario = log.getEmailType();
|
||||
}
|
||||
boolean isSuccess = EmailServiceTypeEnum.PEC_SERVICE.getValue().equals(log.getEmailServiceType()) &&
|
||||
StatusTypeEnum.SUCCESS.getValue().equals(log.getSendStatus());
|
||||
if (!isSuccess) {
|
||||
boolean isSuccess = StatusTypeEnum.SUCCESS.getValue().equals(log.getSendStatus());
|
||||
if (Boolean.FALSE.equals(isSuccess)) {
|
||||
allSuccess = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ApplicationAmendmentRequestResponseBean {
|
||||
private Long id;
|
||||
private String callEmail;
|
||||
private String note;
|
||||
private Long responseDays;
|
||||
private LocalDateTime startDate;
|
||||
private Boolean isSendNotification;
|
||||
private Boolean isSendEmail;
|
||||
private Long protocolNumber;
|
||||
private String callName;
|
||||
private String beneficiaryName;
|
||||
private String companyName;
|
||||
private List<AmendmentFormFieldResponse> formFields;
|
||||
private List<ApplicationFormFieldResponseBean> applicationFormFields;
|
||||
private List<DocumentResponseBean> amendmentDocuments;
|
||||
private String amendmentNotes;
|
||||
private Boolean valid;
|
||||
private Long applicationId;
|
||||
private Long applicationEvaluationId;
|
||||
private LocalDateTime evaluationEndDate;
|
||||
private LocalDateTime expirationDate;
|
||||
private List<CommunicationResponseBean> commentsList;
|
||||
private String internalNote;
|
||||
private ApplicationAmendmentRequestEnum status;
|
||||
private String emailTemplate;
|
||||
private List<EmailSendResponse> emailSendResponse;
|
||||
}
|
||||
@@ -80,6 +80,10 @@ public interface ApplicationEvaluationRepository extends JpaRepository<Applicati
|
||||
Long assignedApplicationId,
|
||||
String status
|
||||
);
|
||||
@Query("SELECT ae FROM ApplicationEvaluationEntity ae WHERE ae.applicationId = :applicationId AND ae.isDeleted = false")
|
||||
ApplicationEvaluationEntity findByApplicationId(@Param("applicationId") Long applicationId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -14,5 +14,15 @@ public interface EmailLogRepository extends JpaRepository<EmailLogEntity,Long> {
|
||||
List<EmailLogEntity> findByUserActionIdAndEmailServiceTypeAndSendStatus(
|
||||
Long userActionId, String emailServiceType, String sendStatus);
|
||||
Optional<EmailLogEntity> findTopByUserIdAndEmailTypeAndIsDeletedFalseOrderByCreatedDateDesc(Long userId, String emailType);
|
||||
List<EmailLogEntity> findByUserActionIdAndEmailServiceType(
|
||||
Long userActionId, String emailServiceType);
|
||||
|
||||
EmailLogEntity findTopByUserActionIdAndEmailServiceTypeAndSendStatusOrderByIdDesc(
|
||||
Long userActionId,
|
||||
String emailServiceType,
|
||||
String sendStatus
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public interface ApplicationAmendmentRequestService {
|
||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request,Long applicationEvaluationId);
|
||||
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest);
|
||||
void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id);
|
||||
ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
|
||||
ApplicationAmendmentRequestResponseBean getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
|
||||
List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId);
|
||||
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
||||
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
|
||||
public ApplicationAmendmentRequestResponseBean getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
|
||||
ApplicationAmendmentRequestEntity amendment = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG)));
|
||||
|
||||
@@ -72,7 +72,7 @@ public interface ApplicationAmendmentRequestApi {
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "", produces = "application/json")
|
||||
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> getApplicationAmendmentRequestById(HttpServletRequest request,@Parameter(description = "The application amendment id", required = true) @RequestParam(value = "id", required = true) Long id);
|
||||
ResponseEntity<Response<ApplicationAmendmentRequestResponseBean>> 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)",
|
||||
responses = {
|
||||
|
||||
@@ -69,14 +69,14 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
|
||||
public ResponseEntity<Response<ApplicationAmendmentRequestResponseBean>> getApplicationAmendmentRequestById(HttpServletRequest request,Long 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. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||
.actionContext(UserActionContextEnum.GET_AMENDMENT).build());
|
||||
|
||||
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = applicationAmendmentRequestService.getApplicationAmendmentRequestById(request,id);
|
||||
ApplicationAmendmentRequestResponseBean applicationAmendmentRequestResponse = applicationAmendmentRequestService.getApplicationAmendmentRequestById(request,id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(applicationAmendmentRequestResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@@ -406,3 +406,5 @@ resend.email.sent.success.msg = Email resend successfully
|
||||
resend.email.sent.failed.msg = Failed to resend the email.
|
||||
|
||||
application.readmit.success=Application has been readmitted successfully.
|
||||
no.email.log.msg = No failed emails found for given userActionId.
|
||||
user.action.id.not.found = User Action id not found.
|
||||
|
||||
@@ -397,3 +397,5 @@ resend.email.sent.success.msg = Email reinviata con successo
|
||||
resend.email.sent.failed.msg = Impossibile inviare nuovamente l'e-mail.
|
||||
|
||||
application.readmit.success=L'applicazione è stata riammessa con successo.
|
||||
no.email.log.msg = Nessuna email trovata per userActionId specificato.
|
||||
user.action.id.not.found = ID azione utente non trovato.
|
||||
|
||||
Reference in New Issue
Block a user