Merge branch 'develop' of https://github.com/Kitzanos/GEPAFIN-BE into develop
This commit is contained in:
@@ -195,9 +195,11 @@ 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";
|
||||||
public static final String USER_NOT_AUTHORIZED_TO_CREATE_APPLICATION = "user.not.authorized.create.application";
|
public static final String USER_NOT_AUTHORIZED_TO_CREATE_APPLICATION = "user.not.authorized.create.application";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,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;
|
||||||
|
|
||||||
@@ -79,6 +80,10 @@ public class ApplicationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
@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);
|
||||||
// callService.validatePublishedCall(formEntity.getCall().getId());
|
// callService.validatePublishedCall(formEntity.getCall().getId());
|
||||||
@@ -280,6 +285,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +307,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,6 +503,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;
|
||||||
}
|
}
|
||||||
@@ -526,7 +540,11 @@ 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 (ApplicationStatusTypeEnum.SUBMIT.getValue().equals(applicationEntity.getStatus())) {
|
if (ApplicationStatusTypeEnum.SUBMIT.getValue().equals(applicationEntity.getStatus())) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_ALREADY_SUBMITTED));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_SUBMITTED_CANNOT_CHANGE));
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
@@ -547,6 +565,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 {
|
||||||
@@ -630,4 +652,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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -24,6 +24,8 @@ public class ApplicationGetResponseBean {
|
|||||||
|
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
|
private Long protocolNumber;
|
||||||
|
|
||||||
private List<FormApplicationResponse> form;
|
private List<FormApplicationResponse> form;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,4 +31,6 @@ public class ApplicationResponse{
|
|||||||
|
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
|
private Long protocolNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user