Merge pull request #39 from Kitzanos/feature/GEPAFINBE-38

GEPAFINBE-38(Assigned Protocol Number Upon Call Submission)
This commit is contained in:
rajeshkhore
2024-10-09 05:52:03 -07:00
committed by GitHub
13 changed files with 187 additions and 66 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 GET_REGION_SUCCESS_MSG = "get.region.success";
public static final String DELETE_REGION_SUCCESS_MSG = "delete.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 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 USER_NOT_EXIST_MSG = "user.not.exist";
public static final String REGION_NOT_FOUND = "region.not.found"; public static final String REGION_NOT_FOUND = "region.not.found";
public static final String USER_ID_NOT_NULL_MSG = "user.id.not.null"; public static final String USER_ID_NOT_NULL_MSG = "user.id.not.null";
@@ -36,13 +36,13 @@ public class GepafinConstant {
public static final String LOOK_UP_DATA_NOT_VALID_MSG = "look.up.data.not.valid"; 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 FILES_UPLOADED_MSG = "files.uploaded";
public static final String CALL_CREATED_SUCCESSFULLY_MSG = "call.created.successfully"; 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 FILE_DELETED_SUCCESSFULLY_MSG = "file.deleted.successfully";
public static final String DOCUMENT_NOT_FOUND="document.not.found"; public static final String DOCUMENT_NOT_FOUND = "document.not.found";
public static final String LOGIN_SUCCESS_MSG="login.successfully"; public static final String LOGIN_SUCCESS_MSG = "login.successfully";
public static final String PASSWORD_MIN_LEN ="pass.min.len.msg"; 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 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 INVALID_DATE_MSG = "call.invalid.date";
public static final String FORM_NOT_FOUND = "form.not.found"; public static final String FORM_NOT_FOUND = "form.not.found";
public static final String FORM_CREATED_SUCCESSFULLY = "form.created.successfully"; public static final String FORM_CREATED_SUCCESSFULLY = "form.created.successfully";
public static final String FORM_UPDATED_SUCCESSFULLY = "form.updated.suucessfully"; public static final String FORM_UPDATED_SUCCESSFULLY = "form.updated.suucessfully";
@@ -61,12 +61,12 @@ public class GepafinConstant {
public static final String FORM_TEMPLATE_DELETED_SUCCESSFULLY = "form.template.deleted.successfully"; 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 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 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_1 = "STEP_1";
public static final String STEP_2 = "STEP_2"; public static final String STEP_2 = "STEP_2";
public static final String VALIDATE_REQUEST = "VALIDATE_REQUEST"; public static final String VALIDATE_REQUEST = "VALIDATE_REQUEST";
public static final String CALL_UPDATE_SUCCESSFULLY_MSG = "call.update.successfully"; public static final String CALL_UPDATE_SUCCESSFULLY_MSG = "call.update.successfully";
public static final String CALL_NOT_FOUND = "call.not.found"; public static final String CALL_NOT_FOUND = "call.not.found";
public static final String CALL_FETCH_SUCCESS_MSG = "call.fetch.success"; public static final String CALL_FETCH_SUCCESS_MSG = "call.fetch.success";
public static final String EVALUATION_CRITERIA_NOT_FOUND = "evaluation.criteria.not.found"; public static final String EVALUATION_CRITERIA_NOT_FOUND = "evaluation.criteria.not.found";
@@ -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_FETCH_SUCCESSFULLY = "evaluation.criteria.fetch.successfully";
public static final String EVALUATION_CRITERIA_UPDATED_SUCCESSFULLY = "evaluation.criteria.updated.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 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_NOT_FOUND = "faq.not.found";
public static final String FAQ_CREATED_SUCCESSFULLY = "faq.created.successfully"; public static final String FAQ_CREATED_SUCCESSFULLY = "faq.created.successfully";
public static final String FAQ_FETCHED_SUCCESSFULLY = "faq.fetched.successfully"; public static final String FAQ_FETCHED_SUCCESSFULLY = "faq.fetched.successfully";
@@ -102,41 +102,41 @@ public class GepafinConstant {
public static final String INVALID_STATUS_CHANGE_FROM_DRAFT = "invalid.status.change.from.draft"; public static final String INVALID_STATUS_CHANGE_FROM_DRAFT = "invalid.status.change.from.draft";
public static final String INVALID_STATUS_CHANGE_FROM_PUBLISH = "invalid.status.change.from.publish"; public static final String INVALID_STATUS_CHANGE_FROM_PUBLISH = "invalid.status.change.from.publish";
public static final String STATUS_CANNOT_BE_CHANGED = "status.cannot.be.changed"; 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 PUBLISHED_CALL_NOT_UPDATE = "published.call.not.update";
public static final String INVALID_USER = "invalid_user"; public static final String INVALID_USER = "invalid_user";
public static final String FLOW_CREATED_SUCCESSFULLY="flow.created.successfully"; 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_FETCHED_SUCCESSFULLY = "flow.fetched.successfully";
public static final String FLOW_ALREADY_EXISTS="flow.already.exists"; 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_REQUEST_NOT_PROPER = "flow.request.not.complete";
public static final String APPLICATION_CREATED_SUCCESS_MSG = "application.created.success"; 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 APPLICATION_UPDATED_SUCCESS_MSG = "application.updated.success";
public static final String DELETE_APPLICATION_SUCCESS_MSG = "application.deleted.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 GET_APPLICATION_SUCCESS_MSG = "application.get.success";
public static final String APPLICATION_NOT_FOUND_MSG = "application.not.found"; 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 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 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_REQUIRED = "validation.field.required";
public static final String VALIDATION_FIELD_MIN_LENGTH = "validation.field.min_length"; 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_MAX_LENGTH = "validation.field.max_length";
public static final String VALIDATION_FIELD_PATTERN = "validation.field.pattern"; 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_NULL = "validation.field.not_null";
public static final String VALIDATION_FIELD_NOT_EMPTY = "validation.field.not_empty"; 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 NEXT_FORM_NOT_FOUND = "next.form.not.found";
// public static final String PREVIOUS_FORM_NOT_FOUND = "previous.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 CURRENT_FORM_INCOMPLETE = "current.form.incomplete";
public static final String FLOW_NOT_FOUND = "flow.not.found"; public static final String FLOW_NOT_FOUND = "flow.not.found";
public static final String VALIDATION_MESSAGE = "validation.message"; public static final String VALIDATION_MESSAGE = "validation.message";
public static final String ACTION_REQUIRED = "action.required"; public static final String ACTION_REQUIRED = "action.required";
public static final String CALL_NOT_PUBLISHED="call.not.published"; public static final String CALL_NOT_PUBLISHED = "call.not.published";
public static final String APPLICATION_ALREADY_SUBMITTED="application.already.submitted"; 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 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 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 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 APPLICATION_IS_INCOMPLETE_MSG = "application.is.incomplete";
public static final String AUTHORIZATION = "Authorization"; public static final String AUTHORIZATION = "Authorization";
public static final String CHECK_VATNUMBER_V2_NEW_URL = "https://imprese.openapi.it/advance"; 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_CODICE_FISCALE = "validation.codice.fiscale";
public static final String VALIDATION_CAP = "validation.cap"; public static final String VALIDATION_CAP = "validation.cap";
public static final String VALIDATION_IBAN = "validation.iban"; public static final String VALIDATION_IBAN = "validation.iban";
@@ -145,39 +145,39 @@ public class GepafinConstant {
public static final String VALIDATION_URL = "validation.url"; 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_MARCA_DA_BOLLO = "validation.marca.da.bollo";
public static final String VALIDATION_PIVA = "validation.piva"; public static final String VALIDATION_PIVA = "validation.piva";
public static final String VALIDATION_VALID_PIVA="valid.vat.number"; public static final String VALIDATION_VALID_PIVA = "valid.vat.number";
public static final String IS_MARCA_DA_BOLLO="isMarcaDaBollo"; public static final String IS_MARCA_DA_BOLLO = "isMarcaDaBollo";
public static final String IS_URL="isUrl"; public static final String IS_URL = "isUrl";
public static final String IS_EMAIL_PEC="isEmailPEC"; public static final String IS_EMAIL_PEC = "isEmailPEC";
public static final String IS_EMAIL="isEmail"; public static final String IS_EMAIL = "isEmail";
public static final String IS_IBAN="isIBAN"; public static final String IS_IBAN = "isIBAN";
public static final String IS_CAP="isCAP"; public static final String IS_CAP = "isCAP";
public static final String IS_CODICE_FISCALE="isCodiceFiscale"; public static final String IS_CODICE_FISCALE = "isCodiceFiscale";
public static final String IS_PIVA="isPIVA"; public static final String IS_PIVA = "isPIVA";
public static final String FAILED_RETAIN_FIELD="failed.retain.field"; 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 USER_ALREADY_EXIST_MSG = "user.already.exist.msg";
public static final String TOKEN_VALIDATE_SUCCESS_MSE = "token.validate.success"; public static final String TOKEN_VALIDATE_SUCCESS_MSE = "token.validate.success";
public static final String INVALID_REQUEST = "invalid.request"; public static final String INVALID_REQUEST = "invalid.request";
public static final String CODICE_FISCALE_EXISTS = "codice.fiscale.exists"; 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 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 COMPLETED_STEPS_NOT_VALID = "completed.steps.not.valid";
public static final String FIELD_ID_NOT_FOUND="field.id.not.found"; public static final String FIELD_ID_NOT_FOUND = "field.id.not.found";
public static final String VALIDATE_EMAIL = "validate.email"; public static final String VALIDATE_EMAIL = "validate.email";
public static final String ROLE_ID_MANDATORY = "role.id.mandatory"; public static final String ROLE_ID_MANDATORY = "role.id.mandatory";
public static final String VALIDATE_PASSWORD = "validate.password"; public static final String VALIDATE_PASSWORD = "validate.password";
public static final String COMPANY_CREATED_SUCCESS_MSG = "company.created.success"; public static final String COMPANY_CREATED_SUCCESS_MSG = "company.created.success";
public static final String COMPANY_UPDATED_SUCCESS_MSG = "company.updated.success"; public static final String COMPANY_UPDATED_SUCCESS_MSG = "company.updated.success";
public static final String COMPANY_DELETE_SUCCESS_MSG = "company.delete.success"; public static final String COMPANY_DELETE_SUCCESS_MSG = "company.delete.success";
public static final String COMPANY_GET_SUCCESS_MSG = "company.get.success"; public static final String COMPANY_GET_SUCCESS_MSG = "company.get.success";
public static final String COMPANY_NOT_FOUND_MSG = "company.not.found"; public static final String COMPANY_NOT_FOUND_MSG = "company.not.found";
public static final String CHECK_VATNUMBER_SUCCESS_MSG = "check.vatnumber.success"; public static final String CHECK_VATNUMBER_SUCCESS_MSG = "check.vatnumber.success";
public static final String INVALID_VATNUMBER = "invalid.vatnumber"; public static final String INVALID_VATNUMBER = "invalid.vatnumber";
public static final String VATNUMBER_MANDATORY = "vatnumber.mandatory"; public static final String VATNUMBER_MANDATORY = "vatnumber.mandatory";
public static final String VATNUMBER_ALREADY_EXISTS = "vatnumber.already.exists"; public static final String VATNUMBER_ALREADY_EXISTS = "vatnumber.already.exists";
public static final String INVALID_EMAIL = "invalid.email"; public static final String INVALID_EMAIL = "invalid.email";
public static final String UNAUTHORIZED = "UNAUTHORIZED"; public static final String UNAUTHORIZED = "UNAUTHORIZED";
public static final String COMPANY_ID_MANDATORY = "company.id.mandatory"; 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 USER_ALREADY_CONNECTED_TO_COMPANY = "user.already.connected.to.company";
public static final String YYYY_MM_DD_DASH = "yyyy-MM-dd"; public static final String YYYY_MM_DD_DASH = "yyyy-MM-dd";
public static final String YYYY_MM_DD_SLASH = "yyyy/MM/dd"; public static final String YYYY_MM_DD_SLASH = "yyyy/MM/dd";
@@ -195,8 +195,10 @@ public class GepafinConstant {
public static final String CALL_NOT_STARTED_YET = "call.not.started.yet"; 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 CALL_ALREADY_ENDED = "call.already.ended";
public static final String APPLICATION_STATUS_UPDATED_SUCCESSFULLY = "application.status.updated.successfully"; 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";
public static final String DELEGATION_NOT_FOUND = "delegation.not.found"; public static final String DELEGATION_NOT_FOUND = "delegation.not.found";
public static final String USER_COMPANY_RELATION_NOT_FOUND = "user.company.relation.not.found"; public static final String USER_COMPANY_RELATION_NOT_FOUND = "user.company.relation.not.found";
public static final String DELEGATION_DELETE_SUCCESS = "delegation.delete.success"; public static final String DELEGATION_DELETE_SUCCESS = "delegation.delete.success";
} }

View File

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

View File

@@ -36,4 +36,7 @@ public class ApplicationEntity extends BaseEntity {
@Column(name="IS_DELETED") @Column(name="IS_DELETED")
private Boolean isDeleted; 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 String companyName;
private Long protocolNumber;
private List<FormApplicationResponse> form; private List<FormApplicationResponse> form;
} }

View File

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

View File

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

View File

@@ -22,6 +22,8 @@ public class NextOrPreviousFormResponse {
private String companyName; private String companyName;
private Long protocolNumber;
private ApplicationStatusTypeEnum applicationStatus; private ApplicationStatusTypeEnum applicationStatus;
private FormApplicationResponse applicationFormResponse; 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

@@ -942,4 +942,35 @@
columnName="field_value" columnName="field_value"
newDataType="TEXT"/> newDataType="TEXT"/>
</changeSet> </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> </databaseChangeLog>

View File

@@ -220,6 +220,7 @@ 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. call.already.ended = The call has already ended. You cannot submit the application after the deadline.
status.updated.successfully=Status updated successfully. status.updated.successfully=Status updated successfully.
application.status.updated.successfully = Application status updated successfully. application.status.updated.successfully = Application status updated successfully.
application.already.in.provided.status=Application is already in provided status.
delegation.not.found=Delegation not found. delegation.not.found=Delegation not found.
user.company.relation.not.found=User with the specified company relation not found. user.company.relation.not.found=User with the specified company relation not found.
delegation.delete.success=Delegation deleted successfully. delegation.delete.success=Delegation deleted successfully.

View File

@@ -215,6 +215,7 @@ call.not.started.yet = La chiamata non <20> ancora iniziata. Attendere fino alla
call.already.ended = La chiamata <20> gi<67> terminata. Non <20> possibile inviare l'applicazione dopo la scadenza. 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. status.updated.successfully=Stato aggiornato con successo.
application.status.updated.successfully = Stato dell'applicazione aggiornato con successo. application.status.updated.successfully = Stato dell'applicazione aggiornato con successo.
application.already.in.provided.status=L'applicazione <20> gi<67> nello stato fornito.
delegation.not.found=Delega non trovata. delegation.not.found=Delega non trovata.
user.company.relation.not.found=Relazione utente con l'azienda specificata non trovata. user.company.relation.not.found=Relazione utente con l'azienda specificata non trovata.
delegation.delete.success=Delega eliminata con successo. delegation.delete.success=Delega eliminata con successo.