Merge pull request #35 from Kitzanos/feature/GEPAFINBE-34
GEPAFINBE-34 (Applied validation for start, end date and time for application)
This commit is contained in:
@@ -179,6 +179,9 @@ public class GepafinConstant {
|
||||
public static final String UNAUTHORIZED = "UNAUTHORIZED";
|
||||
public static final String COMPANY_ID_MANDATORY = "company.id.mandatory";
|
||||
public static final String USER_ALREADY_CONNECTED_TO_COMPANY = "user.already.connected.to.company";
|
||||
|
||||
public static final String CALL_NOT_STARTED_YET = "call.not.started.yet";
|
||||
public static final String CALL_ALREADY_ENDED = "call.already.ended";
|
||||
public static final String APPLICATION_STATUS_UPDATED_SUCCESSFULLY = "application.status.updated.successfully";
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.dao;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -673,6 +674,25 @@ public class CallDao {
|
||||
Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.CALL_NOT_PUBLISHED));
|
||||
}
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
LocalTime currentTime = LocalTime.now();
|
||||
|
||||
if (currentDate.isBefore(callEntity.getStartDate().toLocalDate()) ||
|
||||
(currentDate.isEqual(callEntity.getStartDate().toLocalDate()) && currentTime.isBefore(callEntity.getStartTime()))) {
|
||||
throw new CustomValidationException(
|
||||
Status.BAD_REQUEST,
|
||||
Translator.toLocale(GepafinConstant.CALL_NOT_STARTED_YET)
|
||||
);
|
||||
}
|
||||
|
||||
if (currentDate.isAfter(callEntity.getEndDate().toLocalDate()) ||
|
||||
(currentDate.isEqual(callEntity.getEndDate().toLocalDate()) && currentTime.isAfter(callEntity.getEndTime()))) {
|
||||
throw new CustomValidationException(
|
||||
Status.BAD_REQUEST,
|
||||
Translator.toLocale(GepafinConstant.CALL_ALREADY_ENDED)
|
||||
);
|
||||
}
|
||||
|
||||
return callEntity;
|
||||
}
|
||||
|
||||
|
||||
@@ -206,5 +206,8 @@ vatnumber.already.exists=VatNumber already exists.
|
||||
invalid.email=Invalid email.
|
||||
company.id.mandatory=Company id is mandatory.
|
||||
user.already.connected.to.company=The user is already connected to this company.
|
||||
|
||||
call.not.started.yet = The call has not started yet. Please wait until the specified start date and time.
|
||||
call.already.ended = The call has already ended. You cannot submit the application after the deadline.
|
||||
status.updated.successfully=Status updated successfully.
|
||||
application.status.updated.successfully = Application status updated successfully.
|
||||
|
||||
@@ -9,7 +9,7 @@ get_user_success_msg=Utente recuperato con successo.
|
||||
get_user_error_msg=Si <20> verificato un errore durante il recupero dell'utente.
|
||||
user.not.active=Utente non attivo. Si prega di contattare il supporto.
|
||||
user.already.exist.msg=L'utente esiste gi<67> per questo codice fiscale.
|
||||
validate.email=L'email è obbligatoria e deve essere nel formato corretto. Si prega di verificare e riprovare.
|
||||
validate.email=L'email <EFBFBD> obbligatoria e deve essere nel formato corretto. Si prega di verificare e riprovare.
|
||||
validate.password=La password e confPassword sono obbligatorie. Verifica e riprova.
|
||||
# Role-related messages
|
||||
role.created.success=Ruolo creato con successo.
|
||||
@@ -20,7 +20,7 @@ create.role.error=Errore durante la creazione del ruolo.
|
||||
update.role.error=Errore durante l'aggiornamento del ruolo.
|
||||
role.fetch.success=Ruolo recuperato con successo.
|
||||
delete.role.error=Errore durante l'eliminazione del ruolo.
|
||||
role.id.mandatory=L'ID del ruolo è obbligatorio.
|
||||
role.id.mandatory=L'ID del ruolo <EFBFBD> obbligatorio.
|
||||
|
||||
# Region-related messages
|
||||
region.created.success=Regione creata con successo.
|
||||
@@ -194,10 +194,12 @@ company.get.success=Azienda recuperata con successo.
|
||||
company.not.found=Azienda non trovata.
|
||||
check.vatnumber.success=Numero di partita IVA verificato con successo.
|
||||
invalid.vatnumber=Numero di partita IVA non valido.
|
||||
vatnumber.mandatory=Il numero di partita IVA è obbligatorio.
|
||||
vatnumber.already.exists=Il numero di partita IVA esiste già.
|
||||
vatnumber.mandatory=Il numero di partita IVA <EFBFBD> obbligatorio.
|
||||
vatnumber.already.exists=Il numero di partita IVA esiste gi<EFBFBD>.
|
||||
invalid.email=Email non valida.
|
||||
company.id.mandatory=L'ID dell'azienda è obbligatorio.
|
||||
user.already.connected.to.company=L'utente è già collegato a questa azienda.
|
||||
company.id.mandatory=L'ID dell'azienda <EFBFBD> obbligatorio.
|
||||
user.already.connected.to.company=L'utente <EFBFBD> gi<EFBFBD> collegato a questa azienda.
|
||||
call.not.started.yet = La chiamata non <20> ancora iniziata. Attendere fino alla data e all'ora di inizio specificate.
|
||||
call.already.ended = La chiamata <20> gi<67> terminata. Non <20> possibile inviare l'applicazione dopo la scadenza.
|
||||
status.updated.successfully=Stato aggiornato con successo.
|
||||
application.status.updated.successfully = Stato dell'applicazione aggiornato con successo.
|
||||
|
||||
Reference in New Issue
Block a user