Added ndg and appointmentId field in evaluation response and ndg status of failure.

This commit is contained in:
piyushkag
2024-12-06 18:51:57 +05:30
parent d363274c2c
commit b1b4eec87e
4 changed files with 13 additions and 1 deletions

View File

@@ -312,6 +312,7 @@ public class GepafinConstant {
public static final String NDG_AVAILABLE = "ndg.available"; public static final String NDG_AVAILABLE = "ndg.available";
public static final String NDG_GENERATION_IS_IN_PROGRESS = "ndg.generation.in.progress"; public static final String NDG_GENERATION_IS_IN_PROGRESS = "ndg.generation.in.progress";
public static final String NDG_GENERATED = "NDG_GENERATED"; public static final String NDG_GENERATED = "NDG_GENERATED";
public static final String NDG_FAILED = "FAILED";
public static final String NDG_NOT_FOUND_FOR_APPLICATION = "ndg.not.found.for.this.application.or.invalid"; public static final String NDG_NOT_FOUND_FOR_APPLICATION = "ndg.not.found.for.this.application.or.invalid";
public static final String APPOINTMENT_ALREADY_CREATED = "appointment.already.created"; public static final String APPOINTMENT_ALREADY_CREATED = "appointment.already.created";
public static final String EXTERNAL_DOCUMENT_UPLOAD_FAILURE_MSG = "document.not.uploaded.to.external.system.please.try.again"; public static final String EXTERNAL_DOCUMENT_UPLOAD_FAILURE_MSG = "document.not.uploaded.to.external.system.please.try.again";

View File

@@ -448,6 +448,8 @@ public class ApplicationEvaluationDao {
String beneficiary = String.join(" ", firstName, lastName).trim(); String beneficiary = String.join(" ", firstName, lastName).trim();
response.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(application.getStatus())); response.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(application.getStatus()));
response.setBeneficiary(beneficiary); response.setBeneficiary(beneficiary);
response.setNdg(application.getNdg() != null ? application.getNdg() : null);
response.setAppointmentId(application.getAppointmentId() != null ? application.getAppointmentId() : null);
response.setSubmissionDate(application.getSubmissionDate()); response.setSubmissionDate(application.getSubmissionDate());
response.setMinScore(call.getThreshold() != null ? call.getThreshold() : null); response.setMinScore(call.getThreshold() != null ? call.getThreshold() : null);
response.setCallName(application.getCall().getName() != null ? application.getCall().getName() : null); response.setCallName(application.getCall().getName() != null ? application.getCall().getName() : null);
@@ -1002,6 +1004,8 @@ public class ApplicationEvaluationDao {
String beneficiary = String.join(" ", firstName, lastName).trim(); String beneficiary = String.join(" ", firstName, lastName).trim();
response.setBeneficiary(beneficiary); response.setBeneficiary(beneficiary);
response.setSubmissionDate(application.getSubmissionDate()); response.setSubmissionDate(application.getSubmissionDate());
response.setNdg(application.getNdg() != null ? application.getNdg() : null);
response.setAppointmentId(application.getAppointmentId() != null ? application.getAppointmentId() : null);
response.setCallName(application.getCall().getName() != null ? application.getCall().getName() : null); response.setCallName(application.getCall().getName() != null ? application.getCall().getName() : null);
response.setProtocolNumber((application.getProtocol() != null && application.getProtocol().getProtocolNumber() != null) ? application.getProtocol().getProtocolNumber() : null); response.setProtocolNumber((application.getProtocol() != null && application.getProtocol().getProtocolNumber() != null) ? application.getProtocol().getProtocolNumber() : null);
if (assignedApplications != null) { if (assignedApplications != null) {

View File

@@ -134,7 +134,7 @@ public class AppointmentDao {
// Validate application, company, and hub // Validate application, company, and hub
ApplicationEntity application = applicationService.validateApplication(applicationId); ApplicationEntity application = applicationService.validateApplication(applicationId);
if (application.getNdgStatus() != null && application.getNdgStatus().equalsIgnoreCase(GepafinConstant.NDG_IN_PROGRESS)) { if (application.getNdgStatus() != null && application.getNdgStatus().equalsIgnoreCase(GepafinConstant.NDG_IN_PROGRESS)) {
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.NDG_GENERATION_IS_IN_PROGRESS)); throw new CustomValidationException(Status.SUCCESS, Translator.toLocale(GepafinConstant.NDG_GENERATION_IS_IN_PROGRESS));
} }
//cloned for old application data //cloned for old application data
ApplicationEntity oldApplicationData = Utils.getClonedEntityForData(application); ApplicationEntity oldApplicationData = Utils.getClonedEntityForData(application);
@@ -261,6 +261,11 @@ public class AppointmentDao {
// Check if polling time has exceeded the limit // Check if polling time has exceeded the limit
if (System.currentTimeMillis() - startTime > TimeUnit.HOURS.toMillis(2)) { if (System.currentTimeMillis() - startTime > TimeUnit.HOURS.toMillis(2)) {
log.warn("Polling timed out for applicationId: {}", application.getId()); log.warn("Polling timed out for applicationId: {}", application.getId());
// Mark NDG status as FAILED for this application
application.setNdgStatus(GepafinConstant.NDG_FAILED);
application.setStatus(ApplicationStatusTypeEnum.NDG.getValue());
applicationRepository.save(application);
log.info("NDG status marked as FAILED for applicationId: {}", application.getId());
break; break;
} }

View File

@@ -32,4 +32,6 @@ public class ApplicationEvaluationResponse {
private LocalDateTime callEndDate; private LocalDateTime callEndDate;
private String companyName; private String companyName;
private LocalDateTime assignedAt; private LocalDateTime assignedAt;
private String ndg;
private String appointmentId;
} }