Done ticket GEPAFINBE-38

This commit is contained in:
nisha
2024-10-09 13:16:02 +05:30
parent d4f8d0251c
commit ec987d93dd
13 changed files with 187 additions and 67 deletions

View File

@@ -24,7 +24,7 @@ public class GepafinConstant {
public static final String GET_REGION_SUCCESS_MSG = "get.region.success";
public static final String DELETE_REGION_SUCCESS_MSG = "delete.region.success";
public static final String REGION_NOT_FOUND_MSG = "user.region.not.found";
public static final String PASSWORD_DOESNT_MATCH ="password.doesnt.match";
public static final String PASSWORD_DOESNT_MATCH = "password.doesnt.match";
public static final String USER_NOT_EXIST_MSG = "user.not.exist";
public static final String REGION_NOT_FOUND = "region.not.found";
public static final String USER_ID_NOT_NULL_MSG = "user.id.not.null";
@@ -36,12 +36,12 @@ public class GepafinConstant {
public static final String LOOK_UP_DATA_NOT_VALID_MSG = "look.up.data.not.valid";
public static final String FILES_UPLOADED_MSG = "files.uploaded";
public static final String CALL_CREATED_SUCCESSFULLY_MSG = "call.created.successfully";
public static final String FILE_DELETED_SUCCESSFULLY_MSG="file.deleted.successfully";
public static final String DOCUMENT_NOT_FOUND="document.not.found";
public static final String LOGIN_SUCCESS_MSG="login.successfully";
public static final String PASSWORD_MIN_LEN ="pass.min.len.msg";
public static final String FILE_DELETED_SUCCESSFULLY_MSG = "file.deleted.successfully";
public static final String DOCUMENT_NOT_FOUND = "document.not.found";
public static final String LOGIN_SUCCESS_MSG = "login.successfully";
public static final String PASSWORD_MIN_LEN = "pass.min.len.msg";
public static final String EMAIL_ALREADY_EXISTS = "email.already.exists";
public static final String DOCUMENT_ID_NOT_FOUND="document.id.not.found";
public static final String DOCUMENT_ID_NOT_FOUND = "document.id.not.found";
public static final String INVALID_DATE_MSG = "call.invalid.date";
public static final String FORM_NOT_FOUND = "form.not.found";
public static final String FORM_CREATED_SUCCESSFULLY = "form.created.successfully";
@@ -61,7 +61,7 @@ public class GepafinConstant {
public static final String FORM_TEMPLATE_DELETED_SUCCESSFULLY = "form.template.deleted.successfully";
public static final String FORM_TEMPLATE_FETCHED_SUCCESSFULLY = "form.template.fetched.successfully";
public static final String REQUIRED_PARAMETER_NOT_FOUND_FOR_FORM_TEMPLATE = "required.parameter.not.found.for.form.template";
public static final String FORM_NOT_FOUND_FOR_CALL_ID="form.not.found.for.call.id";
public static final String FORM_NOT_FOUND_FOR_CALL_ID = "form.not.found.for.call.id";
public static final String STEP_1 = "STEP_1";
public static final String STEP_2 = "STEP_2";
public static final String VALIDATE_REQUEST = "VALIDATE_REQUEST";
@@ -74,7 +74,7 @@ public class GepafinConstant {
public static final String EVALUATION_CRITERIA_FETCH_SUCCESSFULLY = "evaluation.criteria.fetch.successfully";
public static final String EVALUATION_CRITERIA_UPDATED_SUCCESSFULLY = "evaluation.criteria.updated.successfully";
public static final String EVALUATION_CRITERIA_DELETED_SUCCESSFULLY = "evaluation.criteria.deleted.successfully";
public static final String SCORE_NOT_NULL_MSG="score.not.null";
public static final String SCORE_NOT_NULL_MSG = "score.not.null";
public static final String FAQ_NOT_FOUND = "faq.not.found";
public static final String FAQ_CREATED_SUCCESSFULLY = "faq.created.successfully";
public static final String FAQ_FETCHED_SUCCESSFULLY = "faq.fetched.successfully";
@@ -104,39 +104,39 @@ public class GepafinConstant {
public static final String STATUS_CANNOT_BE_CHANGED = "status.cannot.be.changed";
public static final String PUBLISHED_CALL_NOT_UPDATE = "published.call.not.update";
public static final String INVALID_USER = "invalid_user";
public static final String FLOW_CREATED_SUCCESSFULLY="flow.created.successfully";
public static final String FLOW_FETCHED_SUCCESSFULLY="flow.fetched.successfully";
public static final String FLOW_ALREADY_EXISTS="flow.already.exists";
public static final String FLOW_REQUEST_NOT_PROPER="flow.request.not.complete";
public static final String FLOW_CREATED_SUCCESSFULLY = "flow.created.successfully";
public static final String FLOW_FETCHED_SUCCESSFULLY = "flow.fetched.successfully";
public static final String FLOW_ALREADY_EXISTS = "flow.already.exists";
public static final String FLOW_REQUEST_NOT_PROPER = "flow.request.not.complete";
public static final String APPLICATION_CREATED_SUCCESS_MSG = "application.created.success";
public static final String APPLICATION_UPDATED_SUCCESS_MSG = "application.updated.success";
public static final String DELETE_APPLICATION_SUCCESS_MSG = "application.deleted.success";
public static final String GET_APPLICATION_SUCCESS_MSG = "application.get.success";
public static final String APPLICATION_NOT_FOUND_MSG = "application.not.found";
public static final String APPLICATION_FORM_FIELD_NOT_FOUND="application.form.field.not.found";
public static final String FORM_ID_DOES_NOT_MACTHES="Form.not.matches.to.call.initial.form";
public static final String APPLICATION_FORM_FIELD_NOT_FOUND = "application.form.field.not.found";
public static final String FORM_ID_DOES_NOT_MACTHES = "Form.not.matches.to.call.initial.form";
public static final String VALIDATION_FIELD_REQUIRED = "validation.field.required";
public static final String VALIDATION_FIELD_MIN_LENGTH = "validation.field.min_length";
public static final String VALIDATION_FIELD_MAX_LENGTH = "validation.field.max_length";
public static final String VALIDATION_FIELD_PATTERN = "validation.field.pattern";
public static final String VALIDATION_FIELD_NOT_NULL = "validation.field.not_null";
public static final String VALIDATION_FIELD_NOT_EMPTY = "validation.field.not_empty";
public static final String APPLICATION_ALREADY_EXISTS="application.already.exists";
public static final String APPLICATION_ALREADY_EXISTS = "application.already.exists";
// public static final String NEXT_FORM_NOT_FOUND = "next.form.not.found";
// public static final String PREVIOUS_FORM_NOT_FOUND = "previous.form.not.found";
public static final String CURRENT_FORM_INCOMPLETE = "current.form.incomplete";
public static final String FLOW_NOT_FOUND = "flow.not.found";
public static final String VALIDATION_MESSAGE = "validation.message";
public static final String ACTION_REQUIRED = "action.required";
public static final String CALL_NOT_PUBLISHED="call.not.published";
public static final String APPLICATION_ALREADY_SUBMITTED="application.already.submitted";
public static final String INITAL_AND_FINAL_FORM_CANNOT_NULL="initial.and.final.form.cannot.null";
public static final String APPLICATION_FORM_NOT_FOUND="application.form.not.found";
public static final String UPDATING_FORM_VALUE_IMPACT_ON_FLOW="updating.form.value.impact.on.flow";
public static final String CALL_NOT_PUBLISHED = "call.not.published";
public static final String APPLICATION_ALREADY_SUBMITTED = "application.already.submitted";
public static final String INITAL_AND_FINAL_FORM_CANNOT_NULL = "initial.and.final.form.cannot.null";
public static final String APPLICATION_FORM_NOT_FOUND = "application.form.not.found";
public static final String UPDATING_FORM_VALUE_IMPACT_ON_FLOW = "updating.form.value.impact.on.flow";
public static final String APPLICATION_IS_INCOMPLETE_MSG = "application.is.incomplete";
public static final String AUTHORIZATION = "Authorization";
public static final String CHECK_VATNUMBER_V2_NEW_URL = "https://imprese.openapi.it/advance";
public static final String VALIDATION_FIELD_CUSTOM="validation.field.custom";
public static final String VALIDATION_FIELD_CUSTOM = "validation.field.custom";
public static final String VALIDATION_CODICE_FISCALE = "validation.codice.fiscale";
public static final String VALIDATION_CAP = "validation.cap";
public static final String VALIDATION_IBAN = "validation.iban";
@@ -145,23 +145,23 @@ public class GepafinConstant {
public static final String VALIDATION_URL = "validation.url";
public static final String VALIDATION_MARCA_DA_BOLLO = "validation.marca.da.bollo";
public static final String VALIDATION_PIVA = "validation.piva";
public static final String VALIDATION_VALID_PIVA="valid.vat.number";
public static final String IS_MARCA_DA_BOLLO="isMarcaDaBollo";
public static final String IS_URL="isUrl";
public static final String IS_EMAIL_PEC="isEmailPEC";
public static final String IS_EMAIL="isEmail";
public static final String IS_IBAN="isIBAN";
public static final String IS_CAP="isCAP";
public static final String IS_CODICE_FISCALE="isCodiceFiscale";
public static final String IS_PIVA="isPIVA";
public static final String FAILED_RETAIN_FIELD="failed.retain.field";
public static final String VALIDATION_VALID_PIVA = "valid.vat.number";
public static final String IS_MARCA_DA_BOLLO = "isMarcaDaBollo";
public static final String IS_URL = "isUrl";
public static final String IS_EMAIL_PEC = "isEmailPEC";
public static final String IS_EMAIL = "isEmail";
public static final String IS_IBAN = "isIBAN";
public static final String IS_CAP = "isCAP";
public static final String IS_CODICE_FISCALE = "isCodiceFiscale";
public static final String IS_PIVA = "isPIVA";
public static final String FAILED_RETAIN_FIELD = "failed.retain.field";
public static final String USER_ALREADY_EXIST_MSG = "user.already.exist.msg";
public static final String TOKEN_VALIDATE_SUCCESS_MSE = "token.validate.success";
public static final String INVALID_REQUEST = "invalid.request";
public static final String CODICE_FISCALE_EXISTS = "codice.fiscale.exists";
public static final String TOTAL_STEPS_NOT_BE_ZERO="total.steps.not.zero";
public static final String COMPLETED_STEPS_NOT_VALID="completed.steps.not.valid";
public static final String FIELD_ID_NOT_FOUND="field.id.not.found";
public static final String TOTAL_STEPS_NOT_BE_ZERO = "total.steps.not.zero";
public static final String COMPLETED_STEPS_NOT_VALID = "completed.steps.not.valid";
public static final String FIELD_ID_NOT_FOUND = "field.id.not.found";
public static final String VALIDATE_EMAIL = "validate.email";
public static final String ROLE_ID_MANDATORY = "role.id.mandatory";
public static final String VALIDATE_PASSWORD = "validate.password";
@@ -183,5 +183,6 @@ public class GepafinConstant {
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";
public static final String APPLICATION_ALREADY_IN_PREVIOUS_STATUS = "application.already.in.provided.status";
}

View File

@@ -31,6 +31,7 @@ import jakarta.persistence.criteria.Predicate;
import java.text.MessageFormat;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -72,6 +73,9 @@ public class ApplicationDao {
@Autowired
private Validator validator;
@Autowired
private ProtocolRepository protocolRepository;
public ApplicationResponseBean createApplication(ApplicationRequestBean applicationRequestBean, UserEntity userEntity, Long formId, Long applicationId) {
FormEntity formEntity = formService.validateForm(formId);
@@ -260,6 +264,9 @@ public class ApplicationDao {
responseBean.setComments(applicationEntity.getComments());
responseBean.setCompanyId(applicationEntity.getCompany().getId());
responseBean.setCompanyName(applicationEntity.getCompany().getCompanyName());
if(applicationEntity.getProtocol() != null) {
responseBean.setProtocolNumber(applicationEntity.getProtocol().getProtocolNumber());
}
return responseBean;
}
@@ -279,6 +286,9 @@ public class ApplicationDao {
response.setCallId(entity.getCall().getId());
response.setCreatedDate(entity.getCreatedDate());
response.setUpdatedDate(entity.getUpdatedDate());
if(entity.getProtocol() != null) {
response.setProtocolNumber(entity.getProtocol().getProtocolNumber());
}
return response;
}
@@ -472,6 +482,9 @@ public class ApplicationDao {
applicationGetResponseBean.setCallId(applicationEntity.getCall().getId());
applicationGetResponseBean.setCallTitle(applicationEntity.getCall().getName());
applicationGetResponseBean.setCompanyId(applicationEntity.getCompany().getId());
if(applicationEntity.getProtocol() != null) {
applicationGetResponseBean.setProtocolNumber(applicationEntity.getProtocol().getProtocolNumber());
}
applicationGetResponseBean.setCompanyName(applicationEntity.getCompany().getCompanyName());
return applicationGetResponseBean;
}
@@ -506,6 +519,9 @@ public class ApplicationDao {
public ApplicationResponse updateApplicationStatus(Long applicationId, ApplicationStatusTypeEnum status) {
ApplicationEntity applicationEntity = validateApplication(applicationId);
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.SUBMIT)) {
callService.validatePublishedCall(applicationEntity.getCall().getId());
// CallEntity callEntity = applicationEntity.getCall();
@@ -525,6 +541,10 @@ public class ApplicationDao {
if (totalSteps.intValue() != completedSteps) {
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_IS_INCOMPLETE_MSG));
}
Integer maxProtocolNumber=protocolRepository.findMaxProtocolNumber();
Integer protocolNumber = (maxProtocolNumber != null) ? maxProtocolNumber + 1 : 10000;
ProtocolEntity protocolEntity=createProtocolEntity(applicationEntity,protocolNumber);
applicationEntity.setProtocol(protocolEntity);
applicationEntity.setStatus(ApplicationStatusTypeEnum.SUBMIT.getValue());
applicationEntity.setSubmissionDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
} else {
@@ -608,4 +628,15 @@ public class ApplicationDao {
}
}
public ProtocolEntity createProtocolEntity(ApplicationEntity applicationEntity,Integer protocolNumber){
ProtocolEntity protocolEntity=new ProtocolEntity();
protocolEntity.setCall(applicationEntity.getCall().getId());
LocalDateTime utcDateTime = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
protocolEntity.setYear(utcDateTime.getYear());
protocolEntity.setProtocolNumber(Long.valueOf(protocolNumber));
protocolEntity.setTime(LocalTime.now());
protocolEntity.setApplicationId(applicationEntity.getId());
protocolRepository.save(protocolEntity);
return protocolEntity;
}
}

View File

@@ -307,6 +307,9 @@ public class FlowFormDao {
completedSteps = getCompletedSteps(applicationEntity);
nextOrPreviousFormResponse.setCompletedSteps(Long.valueOf(completedSteps));
nextOrPreviousFormResponse.setCurrentStep(currentStep);
if(applicationEntity.getProtocol() != null) {
nextOrPreviousFormResponse.setProtocolNumber(applicationEntity.getProtocol().getProtocolNumber());
}
return nextOrPreviousFormResponse;
}

View File

@@ -36,4 +36,7 @@ public class ApplicationEntity extends BaseEntity {
@Column(name="IS_DELETED")
private Boolean isDeleted;
@OneToOne
@JoinColumn(name = "PROTOCOL_NUMBER")
private ProtocolEntity protocol;
}

View File

@@ -0,0 +1,28 @@
package net.gepafin.tendermanagement.entities;
import jakarta.persistence.*;
import lombok.Data;
import java.time.LocalTime;
@Entity
@Table(name = "PROTOCOL")
@Data
public class ProtocolEntity extends BaseEntity {
@Column(name = "PROTOCOL_NUMBER", nullable = false)
private Long protocolNumber;
@Column(name = "YEAR", nullable = false)
private Integer year;
@Column(name="CALL_ID")
private Long call;
@Column(name = "TIME", nullable = false)
private LocalTime time;
@Column(name="APPLICATION_ID")
private Long applicationId;
}

View File

@@ -24,6 +24,8 @@ public class ApplicationGetResponseBean {
private String companyName;
private Long protocolNumber;
private List<FormApplicationResponse> form;
}

View File

@@ -31,4 +31,6 @@ public class ApplicationResponse{
private String companyName;
private Long protocolNumber;
}

View File

@@ -17,6 +17,8 @@ public class ApplicationResponseBean extends BaseBean {
private String comments;
private Long protocolNumber;
private List<ApplicationFormFieldResponseBean> formFields;
}

View File

@@ -22,6 +22,8 @@ public class NextOrPreviousFormResponse {
private String companyName;
private Long protocolNumber;
private ApplicationStatusTypeEnum applicationStatus;
private FormApplicationResponse applicationFormResponse;

View File

@@ -0,0 +1,13 @@
package net.gepafin.tendermanagement.repositories;
import net.gepafin.tendermanagement.entities.ProtocolEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@Repository
public interface ProtocolRepository extends JpaRepository<ProtocolEntity,Long> {
@Query("SELECT MAX(p.protocolNumber) FROM ProtocolEntity p")
Integer findMaxProtocolNumber();
}

View File

@@ -885,4 +885,35 @@
columnName="field_value"
newDataType="TEXT"/>
</changeSet>
<changeSet id="08-10-2024_2" author="Nisha Kashyap">
<createTable tableName="protocol">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints nullable="false" primaryKey="true"
primaryKeyName="protocol_pkey" />
</column>
<column name="protocol_number" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="year" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="call_id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="time" type="TIME">
<constraints nullable="false"/>
</column>
<column name="application_id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>
<addColumn tableName="application">
<column name="protocol_number" type="INTEGER">
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

View File

@@ -211,3 +211,4 @@ call.not.started.yet = The call has not started yet. Please wait until the speci
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.
application.already.in.provided.status=Application is already in provided status.

View File

@@ -203,3 +203,4 @@ call.not.started.yet = La chiamata non <20> ancora iniziata. Attendere fino alla
call.already.ended = La chiamata � gi� terminata. Non � possibile inviare l'applicazione dopo la scadenza.
status.updated.successfully=Stato aggiornato con successo.
application.status.updated.successfully = Stato dell'applicazione aggiornato con successo.
application.already.in.provided.status=L'applicazione è già nello stato fornito.