Resolved conflicts

This commit is contained in:
rajesh
2025-05-26 18:53:47 +05:30
27 changed files with 326 additions and 147 deletions

View File

@@ -27,6 +27,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundExceptio
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
@@ -308,8 +309,14 @@ public class ApplicationAmendmentRequestDao {
if (Boolean.TRUE.equals(applicationAmendmentRequestResponse.getIsSendEmail())) {
emailNotificationDao.sendMailToNotifyBeneficiaryRegardingNewAmendment(applicationAmendmentRequestEntity);
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
applicationAmendmentRequestResponse.setEmailSendResponse(emailSendResponse);
List<EmailSendResponse> responses = List.of(emailSendResponse);
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())){
saveEmailSendResponse(emailSendResponse, applicationAmendmentRequestEntity);
applicationAmendmentRequestResponse.setEmailSendResponse(responses);
}
else{
applicationAmendmentRequestResponse.setEmailSendResponse(Collections.emptyList());
}
}
return applicationAmendmentRequestResponse;
}
@@ -517,6 +524,7 @@ public class ApplicationAmendmentRequestDao {
Long hubId = applicationEntity.getHubId();
HubEntity hubEntity = hubService.valdateHub(hubId);
response.setEmailSendResponse(entity.getEmailSendResponse());
response.setId(entity.getId());
response.setApplicationId(entity.getApplicationId());
response.setApplicationEvaluationId(entity.getApplicationEvaluationEntity().getId());
@@ -655,19 +663,12 @@ public class ApplicationAmendmentRequestDao {
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);
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validateApplicationAmendmentRequest(id);
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;
ApplicationAmendmentRequestResponse response = convertEntityToResponse(applicationAmendmentRequestEntity,true);
response.setEmailSendResponse(applicationAmendmentRequestEntity.getEmailSendResponse());
return response;
}
public List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId) {
@@ -1050,7 +1051,7 @@ public class ApplicationAmendmentRequestDao {
public ApplicationAmendmentRequestResponse closeAmendmentRequest(Long id, CloseAmendmentRequest closeAmendmentRequest) {
log.info("Closing application amendement with ID: {}", id);
ApplicationAmendmentRequestEntity existingApplicationAmendment = validateApplicationAmendmentRequest(id);
ApplicationAmendmentRequestEntity existingApplicationAmendment = validatApplicationAmendmentRequestByListStatus(id,List.of(ApplicationAmendmentRequestEnum.AWAITING.getValue(),ApplicationAmendmentRequestEnum.RESPONSE_RECEIVED.getValue()));
//cloned entity for old data and versioning
ApplicationAmendmentRequestEntity oldApplicationAmendmentEntity = Utils.getClonedEntityForData(existingApplicationAmendment);
List<ApplicationAmendmentRequestEntity> amendmentRequestList = applicationAmendmentRequestRepository.findAllByApplicationEvaluationIdAndIsDeletedFalse(
@@ -1060,17 +1061,18 @@ public class ApplicationAmendmentRequestDao {
// Check if this is the last amendment being closed
boolean isLastRemaining = amendmentRequestList.stream()
.filter(amendment -> !amendment.getId().equals(id)) // Exclude the current amendment
.allMatch(amendment -> amendment.getStatus().equals(ApplicationAmendmentRequestEnum.CLOSE.getValue()));
.allMatch(amendment -> amendment.getStatus().equals(ApplicationAmendmentRequestEnum.CLOSE.getValue()) || amendment.getStatus().equals(ApplicationAmendmentRequestEnum.EXPIRED.getValue()));
if (isLastRemaining) {
log.info("The current amendment is the last remaining one to be closed.");
applicationAmendmentRequestDao.calculateEndDateAndSuspensionDays(existingApplicationAmendment.getApplicationEvaluationEntity());
}
setIfUpdated(existingApplicationAmendment::getInternalNote, existingApplicationAmendment::setInternalNote, closeAmendmentRequest.getInternalNote());
setIfUpdated(existingApplicationAmendment::getStatus, existingApplicationAmendment::setStatus, ApplicationAmendmentRequestEnum.CLOSE.getValue());
existingApplicationAmendment.setClosingDate(LocalDateTime.now());
ApplicationAmendmentRequestEntity updatedApplicationAmendment = saveApplicationAmendmentRequestEntity(existingApplicationAmendment, oldApplicationAmendmentEntity,
VersionActionTypeEnum.UPDATE);
if (isLastRemaining) {
log.info("The current amendment is the last remaining one to be closed.");
applicationAmendmentRequestDao.calculateEndDateAndSuspensionDaysOnExpirationOrClosing(existingApplicationAmendment.getApplicationEvaluationEntity());
}
ApplicationAmendmentRequestResponse response = convertEntityToResponse(updatedApplicationAmendment,false);
List<ApplicationAmendmentRequestEntity> amendmentRequests = applicationAmendmentRequestRepository.findAllByApplicationEvaluationIdAndIsDeletedFalse(
@@ -1122,15 +1124,17 @@ public class ApplicationAmendmentRequestDao {
return response;
}
public ApplicationAmendmentRequestResponse extendResponseDays(Long id, Long newResponseDays) {
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validateApplicationAmendmentRequest(id);
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = validatApplicationAmendmentRequestByStatus(id,ApplicationAmendmentRequestEnum.EXPIRED.getValue());
if (newResponseDays != null && newResponseDays > 0) {
ApplicationAmendmentRequestEntity oldApplicationAmendmentEntity = Utils.getClonedEntityForData(applicationAmendmentRequestEntity);
Long currentResponseDays = applicationAmendmentRequestEntity.getResponseDays() != null ? applicationAmendmentRequestEntity.getResponseDays() : 0L;
applicationAmendmentRequestEntity.setResponseDays(currentResponseDays + newResponseDays);
applicationAmendmentRequestEntity.setEndDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now().plusDays(applicationAmendmentRequestEntity.getResponseDays())));
applicationAmendmentRequestEntity.setEndDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now().plusDays(newResponseDays)));
applicationAmendmentRequestEntity.setStatus(ApplicationAmendmentRequestEnum.AWAITING.getValue());
applicationAmendmentRequestEntity.getApplicationEvaluationEntity().setStatus(ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue());
applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().setStatus(ApplicationStatusTypeEnum.SOCCORSO.getValue());
applicationAmendmentRequestRepository.save(applicationAmendmentRequestEntity);
/** This code is responsible for adding a version history log for the "Update Application Amendment" operation. **/
@@ -1206,8 +1210,14 @@ public class ApplicationAmendmentRequestDao {
beneficiaryUser.getId(), applicationEntity.getId(), amendment.getId(), applicationEntity.getCall().getId());
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email), emailLogRequest);
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
emailReminderResponse.setEmailSendResponse(emailSendResponse);
List<EmailSendResponse> responses = List.of(emailSendResponse);
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())){
emailReminderResponse.setEmailSendResponse(responses);
saveEmailSendResponse(emailSendResponse, amendment);
}
else{
emailReminderResponse.setEmailSendResponse(Collections.emptyList());
}
} else {
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.BENEFICIARY_EMAIL_NOT_FOUND_MSG));
}
@@ -1242,26 +1252,26 @@ public class ApplicationAmendmentRequestDao {
return Utils.replacePlaceholders(template.getHtmlContent(), bodyPlaceholders);
}
public ApplicationEvaluationEntity calculateEndDateAndSuspensionDays(ApplicationEvaluationEntity applicationEvaluationEntity){
LocalDateTime currentDate=DateTimeUtil.DateServerToUTC(LocalDateTime.now());
LocalDateTime endDate=currentDate.plusDays(applicationEvaluationEntity.getRemainingDays());
Long suspendedDays = ChronoUnit.DAYS.between(applicationEvaluationEntity.getStopDateTime(), currentDate);
ApplicationEvaluationEntity oldApplicationEvaluationEntity = Utils.getClonedEntityForData(applicationEvaluationEntity);
applicationEvaluationEntity.setEndDate(endDate);
if(applicationEvaluationEntity.getSuspendedDays() == null) {
applicationEvaluationEntity.setSuspendedDays(0L);
}
applicationEvaluationEntity.setSuspendedDays(applicationEvaluationEntity.getSuspendedDays()+suspendedDays);
ApplicationEvaluationEntity applicationEvaluation = applicationEvaluationRepository.save(applicationEvaluationEntity);
/** This code is responsible for adding a version history log for the "Update Application Amendment" operation. **/
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluationEntity).newData(applicationEvaluation).build());
return applicationEvaluation;
}
// public ApplicationEvaluationEntity calculateEndDateAndSuspensionDays(ApplicationEvaluationEntity applicationEvaluationEntity){
// LocalDateTime currentDate=DateTimeUtil.DateServerToUTC(LocalDateTime.now());
// LocalDateTime endDate=currentDate.plusDays(applicationEvaluationEntity.getRemainingDays());
// Long suspendedDays = ChronoUnit.DAYS.between(applicationEvaluationEntity.getStopDateTime(), currentDate);
//
// ApplicationEvaluationEntity oldApplicationEvaluationEntity = Utils.getClonedEntityForData(applicationEvaluationEntity);
// applicationEvaluationEntity.setEndDate(endDate);
// if(applicationEvaluationEntity.getSuspendedDays() == null) {
// applicationEvaluationEntity.setSuspendedDays(0L);
// }
// applicationEvaluationEntity.setSuspendedDays(applicationEvaluationEntity.getSuspendedDays()+suspendedDays);
// ApplicationEvaluationEntity applicationEvaluation = applicationEvaluationRepository.save(applicationEvaluationEntity);
//
// /** This code is responsible for adding a version history log for the "Update Application Amendment" operation. **/
// loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluationEntity).newData(applicationEvaluation).build());
//
// return applicationEvaluation;
//
//
// }
private GetAllAmendmentResponseBean initializeGetAllBasicResponse(ApplicationAmendmentRequestEntity entity) {
GetAllAmendmentResponseBean response = new GetAllAmendmentResponseBean();
@@ -1566,10 +1576,107 @@ public class ApplicationAmendmentRequestDao {
return applicationAmendmentRequestViewResponse;
}
public ApplicationEvaluationEntity calculateEndDateAndSuspensionDaysOnExpirationOrClosing
(ApplicationEvaluationEntity applicationEvaluationEntity) {
// Fetch all linked amendments
List<ApplicationAmendmentRequestEntity> amendments =
applicationAmendmentRequestRepository.findAllByApplicationEvaluationIdAndIsDeletedFalse(applicationEvaluationEntity.getId());
// Recalculate suspension
long suspendedDays = calculateSuspendedDays(amendments);
// Update end date and save
ApplicationEvaluationEntity oldEntity = Utils.getClonedEntityForData(applicationEvaluationEntity);
HubEntity hub = hubService.valdateHub(applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication().getHubId());
Long initialDays = (hub != null) ? hub.getEvaluationExpirationDays() : 30L;
LocalDateTime endDate = applicationEvaluationEntity.getStartDate().plusDays(suspendedDays+initialDays);
applicationEvaluationEntity.setEndDate(endDate);
applicationEvaluationEntity.setSuspendedDays(suspendedDays);
ApplicationEvaluationEntity updated = applicationEvaluationRepository.save(applicationEvaluationEntity);
loggingUtil.addVersionHistory(VersionHistoryRequest.builder()
.request(request)
.actionType(VersionActionTypeEnum.UPDATE)
.oldData(oldEntity)
.newData(updated)
.build());
return updated;
}
public long calculateSuspendedDays(List<ApplicationAmendmentRequestEntity> amendments) {
List<Pair<LocalDateTime, LocalDateTime>> periods = amendments.stream()
.filter(amendmentRequest -> amendmentRequest.getStartDate() != null)
.map(amendmentRequest -> {
LocalDateTime start = amendmentRequest.getStartDate();
LocalDateTime end;
String status = amendmentRequest.getStatus();
if (Boolean.TRUE.equals(ApplicationAmendmentRequestEnum.CLOSE.getValue().equals(status)) && amendmentRequest.getClosingDate() != null) {
end = amendmentRequest.getClosingDate();
} else if (Boolean.TRUE.equals(ApplicationAmendmentRequestEnum.EXPIRED.getValue().equals(status)) && amendmentRequest.getEndDate() != null) {
end = amendmentRequest.getStartDate().plusDays(amendmentRequest.getResponseDays());
}else {
end= amendmentRequest.getEndDate();
}
return Pair.of(start, end);
})
.filter(Objects::nonNull)
.sorted(Comparator.comparing(Pair::getLeft))
.collect(Collectors.toList());
long totalDays = 0;
LocalDateTime currentStart = null;
LocalDateTime currentEnd = null;
for (Pair<LocalDateTime, LocalDateTime> period : periods) {
if (currentStart == null) {
currentStart = period.getLeft();
currentEnd = period.getRight();
} else if (!period.getLeft().isAfter(currentEnd)) {
// Merge overlapping/touching periods
currentEnd = currentEnd.isAfter(period.getRight()) ? currentEnd : period.getRight();
} else {
// Non-overlapping: count previous period
totalDays += ChronoUnit.DAYS.between(currentStart.toLocalDate(), currentEnd.toLocalDate());
currentStart = period.getLeft();
currentEnd = period.getRight();
}
}
if (currentStart != null && currentEnd != null) {
totalDays += ChronoUnit.DAYS.between(currentStart.toLocalDate(), currentEnd.toLocalDate());
}
return totalDays;
}
public ApplicationAmendmentRequestEntity validatApplicationAmendmentRequestByStatus(Long id,String status) {
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalseAndStatus(id, status);
if (applicationAmendmentRequestEntity == null) {
throw new ResourceNotFoundException(Status.NOT_FOUND,
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG));
}
return applicationAmendmentRequestEntity;
}
private void saveEmailSendResponse(EmailSendResponse newResponses, ApplicationAmendmentRequestEntity amendment) {
List<EmailSendResponse> mergedResponses = Utils.mergeEmailSendResponses(amendment.getEmailSendResponse(), newResponses);
amendment.setEmailSendResponse(mergedResponses);
applicationAmendmentRequestRepository.save(amendment);
}
public ApplicationAmendmentRequestEntity validatApplicationAmendmentRequestByListStatus(Long id,List<String> status) {
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalseAndStatusIn(id, status);
if (applicationAmendmentRequestEntity == null) {
throw new ResourceNotFoundException(Status.NOT_FOUND,
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG));
}
return applicationAmendmentRequestEntity;
}
}

View File

@@ -211,6 +211,7 @@ public class ApplicationDao {
@Autowired
private ApplicationEvaluationDao applicationEvaluationDao;
public final Random random = new Random();
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
FormEntity formEntity = formService.validateForm(formId);
@@ -937,12 +938,16 @@ public class ApplicationDao {
}
}
public String generateRandomFiveDigitNumber() {
int number = 10000 + random.nextInt(90000); // Generates a number from 10000 to 99999
return String.valueOf(number);
}
public ApplicationResponse updateApplicationStatus(HttpServletRequest request, Long applicationId, ApplicationStatusTypeEnum status) {
log.info("Updating status for Application id : " + applicationId);
ApplicationEntity applicationEntity = validateApplication(applicationId);
checkCallEndDate(applicationEntity.getCall());
log.info("Call end date verified successfully | callId: {}", applicationEntity.getCall().getId());
//cloned entity for old application data
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(applicationEntity);
@@ -956,9 +961,18 @@ public class ApplicationDao {
if (Boolean.TRUE.equals(applicationEntity.getStatus().equals(status.getValue()))) {
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_ALREADY_IN_PREVIOUS_STATUS));
}
if (status.equals(ApplicationStatusTypeEnum.APPOINTMENT) && Boolean.TRUE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.NDG.getValue()))){
String appointmentId = generateRandomFiveDigitNumber();
applicationEntity.setAppointmentId(appointmentId);
applicationEntity.setStatus(ApplicationStatusTypeEnum.APPOINTMENT.getValue());
}
if (status.equals(ApplicationStatusTypeEnum.SUBMIT) && Boolean.TRUE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.READY.getValue()))) {
CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId());
// callService.validatePublishedCall(applicationEntity.getCall().getId(), userEntity.getHub().getId());
checkCallEndDate(applicationEntity.getCall());
Long protocolNumber = protocolDao.getProtocolNumber(userEntity.getHub());
ProtocolEntity protocolEntity = protocolDao.createProtocolEntity(applicationEntity, protocolNumber, userEntity.getHub().getId(),true);
protocolDao.saveProtocolEntity(protocolEntity);
@@ -982,10 +996,12 @@ public class ApplicationDao {
log.info("Status updated to SUBMIT for applicationId: " + applicationId);
}
if (status.equals(ApplicationStatusTypeEnum.DRAFT) && Boolean.TRUE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.AWAITING.getValue()))) {
checkCallEndDate(applicationEntity.getCall());
applicationEntity.setStatus(status.getValue());
log.info("Status updated to DRAFT for applicationId: " + applicationId);
}
if (status.equals(ApplicationStatusTypeEnum.AWAITING) && Boolean.TRUE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.READY.getValue()))) {
checkCallEndDate(applicationEntity.getCall());
ApplicationSignedDocumentEntity applicationSignedDocument = applicationSignedDocumentRepository.findByApplicationIdAndStatus(applicationId,
ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
deleteSignedDocumentFromS3(applicationSignedDocument);
@@ -2147,44 +2163,6 @@ public class ApplicationDao {
tableDataByApp.put(appId, flattenedAll);
}
}
public void sendApplicationSubmissionFailureEmail(EmailLogRequest emailLogRequest){
Long callId = emailLogRequest.getCallId();
CallEntity call = callService.validateCall(callId);
HubEntity hub = call.getHub();
Long userId = emailLogRequest.getUserId();
UserEntity user = userService.validateUser(userId);
Long applicationId = emailLogRequest.getApplicatioId();
ApplicationEntity applicationEntity = validateApplication(applicationId);
CompanyEntity company = companyService.validateCompany(applicationEntity.getCompanyId());
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
.retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntityTypeEnum.APPLICATION_SUBMISSION_FAILURE_NOTIFICATION,
hub, null);
Map<String, String> subjectPlaceholders = new HashMap<>();
subjectPlaceholders.put("{{call_name}}", call.getName());
Map<String, String> bodyPlaceholders = new HashMap<>();
bodyPlaceholders.put("{{scenario}}",emailLogRequest.getEmailType().getValue());
bodyPlaceholders.put("{{call_name}}", call.getName());
bodyPlaceholders.put("{{application_id}}", applicationEntity.getId().toString());
bodyPlaceholders.put("{{company_name}}", company.getCompanyName());
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString());
bodyPlaceholders.put("{{user_action_id}}",emailLogRequest.getUserActionId().toString());
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
emailLogRequest=emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(),RecipientTypeEnum.PROPERTIES,null,user.getEmail(),user.getId(),applicationEntity.getId(),null,callId);
emailLogRequest.setRecipientEmails(GepafinConstant.RINALDO_EMAIL);
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(GepafinConstant.RINALDO_EMAIL),emailLogRequest);
}
public ApplicationResponse readmitApplication(HttpServletRequest request, Long applicationId) {
log.info("Re-admiting the Application with id : {}", applicationId);
@@ -2195,7 +2173,7 @@ public class ApplicationDao {
}
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
assignedApplicationsRepository.findByApplicationIdAndStatusAndIsDeletedFalse(applicationEntity.getId(), AssignedApplicationEnum.CLOSE.getValue())
assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationEntity.getId())
.ifPresent(assignedApp -> processAssignedAppAndEvaluation(request, applicationEntity, assignedApp));
return getApplicationResponse(applicationEntity);
@@ -2205,7 +2183,7 @@ public class ApplicationDao {
}
private void processAssignedAppAndEvaluation(HttpServletRequest request, ApplicationEntity applicationEntity, AssignedApplicationsEntity assignedApp) {
applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndStatusAndIsDeletedFalse(assignedApp.getId(), ApplicationEvaluationStatusTypeEnum.CLOSE.getValue())
applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApp.getId())
.ifPresent(eval -> reopenApplication(request, applicationEntity, assignedApp, eval));
}
@@ -2264,4 +2242,40 @@ public class ApplicationDao {
}
public void sendApplicationSubmissionFailureEmail(EmailLogRequest emailLogRequest){
Long callId = emailLogRequest.getCallId();
CallEntity call = callService.validateCall(callId);
HubEntity hub = call.getHub();
Long userId = emailLogRequest.getUserId();
UserEntity user = userService.validateUser(userId);
Long applicationId = emailLogRequest.getApplicatioId();
ApplicationEntity applicationEntity = validateApplication(applicationId);
CompanyEntity company = companyService.validateCompany(applicationEntity.getCompanyId());
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
.retrieveTemplateByTypeAndCall(SystemEmailTemplatesEntityTypeEnum.APPLICATION_SUBMISSION_FAILURE_NOTIFICATION,
hub, null);
Map<String, String> subjectPlaceholders = new HashMap<>();
subjectPlaceholders.put("{{call_name}}", call.getName());
Map<String, String> bodyPlaceholders = new HashMap<>();
bodyPlaceholders.put("{{scenario}}",emailLogRequest.getEmailType().getValue());
bodyPlaceholders.put("{{call_name}}", call.getName());
bodyPlaceholders.put("{{application_id}}", applicationEntity.getId().toString());
bodyPlaceholders.put("{{company_name}}", company.getCompanyName());
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString());
bodyPlaceholders.put("{{user_action_id}}",emailLogRequest.getUserActionId().toString());
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
emailLogRequest=emailLogDao.createEmailLogRequest(systemEmailTemplateResponse.getEmailScenario(),RecipientTypeEnum.PROPERTIES,null,user.getEmail(),user.getId(),applicationEntity.getId(),null,callId);
emailLogRequest.setRecipientEmails(GepafinConstant.RINALDO_EMAIL);
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(GepafinConstant.RINALDO_EMAIL),emailLogRequest);
}
}

View File

@@ -703,7 +703,11 @@ public class ApplicationEvaluationDao {
/** This code is responsible for adding a version history log for the "Update Application" operation. **/
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(actionType).oldData(oldApplication).newData(application).build());
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_CREATION);
// Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_CREATION);
Map<String, String> placeHolders = new HashMap<>();
placeHolders.put("{{call_name}}", application.getCall().getName());
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber()));
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_CREATION);
notificationDao.sendNotificationToInstructor(placeHolders,entity,NotificationTypeEnum.EVALUATION_CREATION);
@@ -1092,7 +1096,7 @@ public class ApplicationEvaluationDao {
}
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 assignedApplicationId;
validatePreinstructor(request, applicationID, assignedApplicationID);
@@ -1131,12 +1135,9 @@ public class ApplicationEvaluationDao {
return null;
}
ApplicationEvaluationEntity entity = entityOptional.get();
ApplicationEvaluationResponse response = convertToResponse(entity);
ApplicationEvaluationResponseBean targetResponse = Utils.convertSourceObjectToDestinationObject(response, ApplicationEvaluationResponseBean.class);
if (targetResponse != null && entity.getEmailSendResponse() != null) {
targetResponse.setEmailSendResponse(entity.getEmailSendResponse());
}
return targetResponse;
ApplicationEvaluationResponse applicationEvaluationResponse = convertToResponse(entity);
applicationEvaluationResponse.setEmailSendResponse(entity.getEmailSendResponse());
return applicationEvaluationResponse;
}
private List<EvaluationDocumentRequest> prepareEvaluationDocumentBeanList(ApplicationEvaluationEntity entity) {
List<EvaluationDocumentRequest> docRequest = new ArrayList<>();
@@ -1893,12 +1894,16 @@ public class ApplicationEvaluationDao {
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(application);
List<EmailSendResponse> responses = new ArrayList<>();
if(newStatus.equals(ApplicationStatusForEvaluation.ADMISSIBLE) && Boolean.TRUE.equals(application.getStatus().equals(ApplicationStatusTypeEnum.APPOINTMENT.getValue()))){
application.setStatus(newStatus.getValue());
log.info("Status updated to ADMISSIBLE for applicationId: " + application.getId());
emailNotificationDao.sendAdmissibilityNotificationEmailForAdmissibleApplication(application);
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()))){
@@ -1949,6 +1954,7 @@ public class ApplicationEvaluationDao {
application.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
application = applicationRepository.save(application);
// emailNotificationDao.sendAdmissibilityNotificationEmailForApprovedApplication(application);
notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_RESULT);
}
if (Boolean.TRUE.equals(statusType.equals((ApplicationStatusTypeEnum.REJECTED.getValue())))) {
application.setDateRejected(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
@@ -1956,15 +1962,23 @@ public class ApplicationEvaluationDao {
application = applicationRepository.save(application);
emailNotificationDao.sendInadmissibilityEmailForRejectedApplication(application,existingEntity);
emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
saveEmailSendResponseToEvaluation(emailSendResponse,existingEntity);
responses = List.of(emailSendResponse);
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
saveEmailSendResponseToEvaluation(emailSendResponse, existingEntity);
}
notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_RESULT);
}
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_RESULT);
Map<String, String> placeHolders = new HashMap<>();
placeHolders.put("{{call_name}}", application.getCall().getName());
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber()));
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_RESULT);
notificationDao.sendNotificationToInstructor(placeHolders,existingEntity,NotificationTypeEnum.EVALUATION_RESULT);
ApplicationEvaluationResponse response = convertToResponse(entity);
response.setEmailSendResponse(emailSendResponse);
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())) {
response.setEmailSendResponse(responses);
}
return response;
}
return null;
@@ -2029,6 +2043,7 @@ public class ApplicationEvaluationDao {
ApplicationEvaluationEntity entity = applicationEvaluationService.validateApplicationEvaluation(evaluationResponse.getId());
//Handling Application Evaluation form
EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
validateFormFields(applicationEvaluationFormRequestBean,evaluationFormEntity);
@@ -2037,7 +2052,9 @@ public class ApplicationEvaluationDao {
validateFormFieldCustom(applicationEvaluationFormRequestBean.getFormFields(),entity,evaluationFormEntity);
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,entity);
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) {
@@ -2282,6 +2299,7 @@ public class ApplicationEvaluationDao {
}
response.setCompanyVatNumber(company.getVatNumber());
response.setCompanyCodiceAteco(company.getCodiceAteco());
response.setEmailSendResponse(evaluationEntity.getEmailSendResponse());
return response;
}

View File

@@ -62,11 +62,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -522,9 +518,12 @@ public class AppointmentDao {
application.setStatus(ApplicationStatusTypeEnum.NDG.getValue());
applicationRepository.save(application);
companyRepository.save(company);
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(
application.getApplicationEvaluationId());
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.NDG_GENERATION);
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(application.getApplicationEvaluationId());
// Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.NDG_GENERATION);
Map<String, String> placeHolders = new HashMap<>();
placeHolders.put("{{call_name}}", application.getCall().getName());
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber()));
notificationDao.sendNotificationToInstructor(placeHolders, applicationEvaluationEntity, NotificationTypeEnum.NDG_GENERATION);
notificationDao.sendNotificationToSuperUser(application, placeHolders, NotificationTypeEnum.NDG_GENERATION);
log.info("NDG saved successfully for applicationId: {}", application.getId());
@@ -574,7 +573,10 @@ public class AppointmentDao {
companyRepository.save(company);
applicationRepository.save(application);
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(application.getApplicationEvaluationId());
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.NDG_GENERATION);
// Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.NDG_GENERATION);
Map<String, String> placeHolders = new HashMap<>();
placeHolders.put("{{call_name}}", application.getCall().getName());
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber()));
notificationDao.sendNotificationToInstructor(placeHolders, applicationEvaluationEntity, NotificationTypeEnum.NDG_GENERATION);
notificationDao.sendNotificationToSuperUser(application, placeHolders, NotificationTypeEnum.NDG_GENERATION);
log.info("NDG saved for applicationId: {}, {}", application.getId(), application.getNdg());

View File

@@ -161,9 +161,10 @@ public class EmailDao {
private boolean updateEmailSendResponse(List<EmailSendResponse> responses, String scenario) {
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())) {
response.setIsEmailSend(true);
iterator.remove(); // remove only the first match
return true;
}
}
@@ -172,6 +173,7 @@ public class EmailDao {
public EmailSendResponse buildEmailSendResponseFromRequest(HttpServletRequest request) {
Long userActionId = (Long) request.getAttribute(GepafinConstant.USER_ACTION_ID);
List<EmailLogEntity> emailLogs = emailLogRepository.findByUserActionIdAndEmailServiceType(userActionId,EmailServiceTypeEnum.PEC_SERVICE.getValue());

View File

@@ -149,17 +149,25 @@ public class UserDao {
/** 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());
EmailSendResponse emailSendResponse = new EmailSendResponse();
List<EmailSendResponse> responses = new ArrayList<>();
if(Boolean.FALSE.equals(roleEntity.getRoleType().equals(RoleStatusEnum.ROLE_BENEFICIARY.getValue()))){
sendEmailToOnboardingUser(userEntity, userReq );
boolean isEmailSendSuccess = isEmailSentSuccessfully(userEntity.getId());
emailSendResponse.setIsEmailSend(isEmailSendSuccess);
EmailSendResponse emailSendResponse = new EmailSendResponse();
if (Boolean.FALSE.equals(isEmailSendSuccess)){
emailSendResponse.setIsEmailSend(false);
Long userActionId =(Long)request.getAttribute(GepafinConstant.USER_ACTION_ID);
emailSendResponse.setUserActionId(userActionId);
emailSendResponse.setEmailScenario(EmailScenarioTypeEnum.USER_CREATION);
saveEmailSendResponseToUser(emailSendResponse,userEntity);
responses = List.of(emailSendResponse);
}
JWTToken token = authService.getJWTTokenBean(userEntity, Boolean.TRUE, loginAttemptEntity.getId(),emailSendResponse);
else{
responses = Collections.emptyList();
}
}
JWTToken token = authService.getJWTTokenBean(userEntity, Boolean.TRUE, loginAttemptEntity.getId(),responses);
return token;
}
@@ -509,8 +517,14 @@ public class UserDao {
sendResetPasswordTokenEmail(user, token);
InitiatePasswordResetResponse initiatePasswordResetResponse = new InitiatePasswordResetResponse();
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
initiatePasswordResetResponse.setEmailSendResponse(emailSendResponse);
List<EmailSendResponse> responses = List.of(emailSendResponse);
if (!Boolean.TRUE.equals(emailSendResponse.getIsEmailSend())){
initiatePasswordResetResponse.setEmailSendResponse(responses);
saveEmailSendResponseToUser(emailSendResponse,user);
}
else{
initiatePasswordResetResponse.setEmailSendResponse(Collections.emptyList());
}
return initiatePasswordResetResponse;
}

View File

@@ -18,6 +18,9 @@ public class EmailSendResponseConverter implements AttributeConverter<List<Email
@Override
public String convertToDatabaseColumn(List<EmailSendResponse> attribute) {
try {
if (attribute == null) {
attribute = List.of();
}
return objectMapper.writeValueAsString(attribute);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException("Error converting list to JSON", e);

View File

@@ -32,5 +32,5 @@ public class ApplicationAmendmentRequestResponse {
private String internalNote;
private ApplicationAmendmentRequestEnum status;
private String emailTemplate;
private EmailSendResponse emailSendResponse;
private List<EmailSendResponse> emailSendResponse;
}

View File

@@ -48,5 +48,6 @@ public class ApplicationEvaluationFormResponse {
private Long appointmentTemplateId;
private String companyVatNumber;
private String companyCodiceAteco;
private List<EmailSendResponse> emailSendResponse;
}

View File

@@ -49,6 +49,6 @@ public class ApplicationEvaluationResponse {
private EvaluationVersionEnum evaluationVersion;
private String companyVatNumber;
private String companyCodiceAteco;
private EmailSendResponse emailSendResponse;
private List<EmailSendResponse> emailSendResponse;
}

View File

@@ -5,12 +5,14 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EmailReminderResponse {
@JsonProperty("emailSendResponse")
private EmailSendResponse emailSendResponse;
private List<EmailSendResponse> emailSendResponse;
}

View File

@@ -5,9 +5,11 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class InitiatePasswordResetResponse {
private EmailSendResponse emailSendResponse;
private List<EmailSendResponse> emailSendResponse;
}

View File

@@ -6,6 +6,8 @@ import lombok.Data;
import net.gepafin.tendermanagement.model.response.EmailSendResponse;
import net.gepafin.tendermanagement.model.response.LoginResponse;
import java.util.List;
/**
* JWTToken
*/
@@ -18,14 +20,14 @@ public class JWTToken {
private LoginResponse loginResponse;
@JsonProperty("emailSendResponse")
private EmailSendResponse emailSendResponse;
private List<EmailSendResponse> emailSendResponse;
public JWTToken(String token, LoginResponse loginResponse) {
this.token = token;
this.loginResponse = loginResponse;
}
public JWTToken(String token, LoginResponse loginResponse, EmailSendResponse emailSendResponse) {
public JWTToken(String token, LoginResponse loginResponse, List<EmailSendResponse> emailSendResponse) {
this.token = token;
this.loginResponse = loginResponse;
this.emailSendResponse = emailSendResponse;

View File

@@ -150,4 +150,8 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
@Query("SELECT COUNT(a) FROM ApplicationAmendmentRequestEntity a WHERE a.applicationId IN :applicationIds AND a.status IN :statuses AND a.isDeleted = false")
Long countAmendmentsByApplicationIds(@Param("applicationIds") List<Long> applicationIds, @Param("statuses") List<String> statuses);
ApplicationAmendmentRequestEntity findByIdAndIsDeletedFalseAndStatus(Long id,String status);
ApplicationAmendmentRequestEntity findByIdAndIsDeletedFalseAndStatusIn(Long id, List<String> statusList);
}

View File

@@ -122,7 +122,7 @@ public class ApplicationAmendmentScheduler {
.findEvaluationsWithoutActiveAmendmentsByIds(applicationEvaluationIds);
evaluationsWithoutActiveAmendmentList.forEach(evaluation -> {
try {
applicationAmendmentRequestDao.calculateEndDateAndSuspensionDays(evaluation);
applicationAmendmentRequestDao.calculateEndDateAndSuspensionDaysOnExpirationOrClosing(evaluation);
updateEvaluationStatus(evaluation);

View File

@@ -24,6 +24,7 @@ import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -87,7 +88,10 @@ public class ApplicationEvaluationScheduler {
evaluation.setStatus(ApplicationEvaluationStatusTypeEnum.EXPIRED.getValue());
evaluation = applicationEvaluationRepository.save(evaluation);
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_EXPIRED);
// Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_EXPIRED);
Map<String, String> placeHolders = new HashMap<>();
placeHolders.put("{{call_name}}", application.getCall().getName());
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber()));
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_EXPIRED);
notificationDao.sendNotificationToInstructor(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED);
notificationDao.sendNotificationToInstructorManager(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED);

View File

@@ -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);
ApplicationAmendmentRequestResponseBean getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId);
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);

View File

@@ -19,7 +19,7 @@ public interface ApplicationEvaluationService {
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 validateApplicationEvaluationByApplicationId(Long applicationId);

View File

@@ -75,7 +75,7 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
}
@Override
public ApplicationAmendmentRequestResponseBean getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
public ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id) {
ApplicationAmendmentRequestEntity amendment = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id)
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG)));

View File

@@ -57,7 +57,7 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
@Override
@Transactional(readOnly = true)
public ApplicationEvaluationResponseBean getApplicationEvaluationByApplicationId(
public ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
UserEntity preInstructor = validator.validateUser(request);
return applicationEvaluationDao.getApplicationEvaluationByApplicationId(

View File

@@ -142,7 +142,7 @@ public class AuthenticationService {
loginAttemptEntity.setErrorMsg(errorMsg);
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);
user.setLastLogin(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
user = userRepository.save(user);

View File

@@ -73,7 +73,10 @@ public class SystemEmailService implements EmailService {
throw new RuntimeException("Failed to send email via Mailgun: " + (response != null ? response.getMessage() : "No response from Mailgun"), e);
}
if(response != null) {
emailLogRequest.setEmailServiceResponse(response.toString());
}
emailLogDao.createEmailLog(emailLogRequest);
}
}

View File

@@ -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<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)",
responses = {

View File

@@ -44,7 +44,7 @@ public interface ApplicationEvaluationApi {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) }))
})
@GetMapping(value = "/application", produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Response<ApplicationEvaluationResponseBean>> getApplicationEvaluationByApplicationId(
ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
HttpServletRequest request,
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);

View File

@@ -69,14 +69,14 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
}
@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");
/** 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());
ApplicationAmendmentRequestResponseBean applicationAmendmentRequestResponse = applicationAmendmentRequestService.getApplicationAmendmentRequestById(request,id);
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = applicationAmendmentRequestService.getApplicationAmendmentRequestById(request,id);
return ResponseEntity.status(HttpStatus.OK)
.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);
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)
.body(new Response<>(emailSendResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.REMINDER_EMAIL_SENT_SUCCESS_MSG)));
}

View File

@@ -51,7 +51,7 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
@Override
public ResponseEntity<Response<ApplicationEvaluationResponseBean>> getApplicationEvaluationByApplicationId(
public ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
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());
ApplicationEvaluationResponseBean response = null;
ApplicationEvaluationResponse response = null;
response = applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId,assignedApplicationId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FETCHED_SUCCESSFULLY)));

View File

@@ -2653,6 +2653,8 @@
<column name="file_path" value="https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/local/template/PROCURA_BANDI_TEMPLATE_CONFIDI.docx"></column>
<column name="type" value="DOCUMENT"></column>
<column name="source" value="DELEGATION_TEMPLATE_CONFIDI"></column>
<column name="created_date" value="2025-05-21 03:00:00"/>
<column name="updated_date" value="2025-05-21 03:00:00"/>
</insert>
</changeSet>
@@ -2666,12 +2668,16 @@
<column name="file_path" value="https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/local/template/true.png"></column>
<column name="type" value="IMAGE"></column>
<column name="source" value="PDF_TRUE"></column>
<column name="created_date" value="2025-05-21 03:00:00"/>
<column name="updated_date" value="2025-05-21 03:00:00"/>
</insert>
<insert tableName="document">
<column name="file_name" value="GEPAFIN_PDF_FALSE.PNG"></column>
<column name="file_path" value="https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/local/template/false.png"></column>
<column name="type" value="IMAGE"></column>
<column name="source" value="PDF_FALSE"></column>
<column name="created_date" value="2025-05-21 03:00:00"/>
<column name="updated_date" value="2025-05-21 03:00:00"/>
</insert>
</changeSet>
<changeSet id="14-04-2025_RK_161000" author="Rajesh Khore">