diff --git a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java index 63be4b25..b553df9f 100644 --- a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java +++ b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java @@ -312,6 +312,7 @@ public class GepafinConstant { 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_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 APPOINTMENT_ALREADY_CREATED = "appointment.already.created"; public static final String EXTERNAL_DOCUMENT_UPLOAD_FAILURE_MSG = "document.not.uploaded.to.external.system.please.try.again"; diff --git a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java index 72ba3ad2..4a10804f 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationEvaluationDao.java @@ -448,6 +448,8 @@ public class ApplicationEvaluationDao { String beneficiary = String.join(" ", firstName, lastName).trim(); response.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(application.getStatus())); response.setBeneficiary(beneficiary); + response.setNdg(application.getNdg() != null ? application.getNdg() : null); + response.setAppointmentId(application.getAppointmentId() != null ? application.getAppointmentId() : null); response.setSubmissionDate(application.getSubmissionDate()); response.setMinScore(call.getThreshold() != null ? call.getThreshold() : 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(); response.setBeneficiary(beneficiary); 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.setProtocolNumber((application.getProtocol() != null && application.getProtocol().getProtocolNumber() != null) ? application.getProtocol().getProtocolNumber() : null); if (assignedApplications != null) { diff --git a/src/main/java/net/gepafin/tendermanagement/dao/AppointmentDao.java b/src/main/java/net/gepafin/tendermanagement/dao/AppointmentDao.java index 1a443313..ef594da5 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/AppointmentDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/AppointmentDao.java @@ -134,7 +134,7 @@ public class AppointmentDao { // Validate application, company, and hub ApplicationEntity application = applicationService.validateApplication(applicationId); 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 ApplicationEntity oldApplicationData = Utils.getClonedEntityForData(application); @@ -261,6 +261,11 @@ public class AppointmentDao { // Check if polling time has exceeded the limit if (System.currentTimeMillis() - startTime > TimeUnit.HOURS.toMillis(2)) { 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; } diff --git a/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationResponse.java b/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationResponse.java index 3e5c3834..ca3eaa71 100644 --- a/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationResponse.java +++ b/src/main/java/net/gepafin/tendermanagement/model/response/ApplicationEvaluationResponse.java @@ -32,4 +32,6 @@ public class ApplicationEvaluationResponse { private LocalDateTime callEndDate; private String companyName; private LocalDateTime assignedAt; + private String ndg; + private String appointmentId; }