Resolved Conflicts
This commit is contained in:
@@ -367,8 +367,6 @@ public class GepafinConstant {
|
|||||||
public static final String COUNT="count";
|
public static final String COUNT="count";
|
||||||
public static final String APPLICATION_PER_CALL="applicationPerCall";
|
public static final String APPLICATION_PER_CALL="applicationPerCall";
|
||||||
public static final String APPLICATION_PER_STATUS="applicationPerStatus";
|
public static final String APPLICATION_PER_STATUS="applicationPerStatus";
|
||||||
|
public static final String CALL_EXPIRED="call.expired";
|
||||||
|
|
||||||
public static final String CALL_END_DATE_PASSED="call.end.date.passed";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ public class ApplicationDao {
|
|||||||
// callService.validatePublishedCall(formEntity.getCall().getId());
|
// callService.validatePublishedCall(formEntity.getCall().getId());
|
||||||
validateFormFields(applicationRequestBean,formEntity);
|
validateFormFields(applicationRequestBean,formEntity);
|
||||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||||
|
checkCallEndDate(applicationEntity.getCall());
|
||||||
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
||||||
if(Boolean.FALSE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.DRAFT.getValue()))) {
|
if(Boolean.FALSE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.DRAFT.getValue()))) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
|
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
|
||||||
@@ -405,6 +406,7 @@ public class ApplicationDao {
|
|||||||
responseBean.setProgress(progress);
|
responseBean.setProgress(progress);
|
||||||
responseBean.setCallTitle(applicationEntity.getCall().getName());
|
responseBean.setCallTitle(applicationEntity.getCall().getName());
|
||||||
responseBean.setCallEndDate(applicationEntity.getCall().getEndDate());
|
responseBean.setCallEndDate(applicationEntity.getCall().getEndDate());
|
||||||
|
responseBean.setCallEndTime(applicationEntity.getCall().getEndTime());
|
||||||
responseBean.setModifiedDate(applicationEntity.getCall().getUpdatedDate());
|
responseBean.setModifiedDate(applicationEntity.getCall().getUpdatedDate());
|
||||||
responseBean.setCallId(applicationEntity.getCall().getId());
|
responseBean.setCallId(applicationEntity.getCall().getId());
|
||||||
responseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
responseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
||||||
@@ -1394,129 +1396,6 @@ public class ApplicationDao {
|
|||||||
throw new RuntimeException("Error while creating ZIP file", e);
|
throw new RuntimeException("Error while creating ZIP file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageableResponseBean<List<ApplicationResponse>> getAllApplicationByPagination(UserEntity userEntity, Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean) {
|
|
||||||
Integer pageNo = null;
|
|
||||||
Integer pageLimit = null;
|
|
||||||
if (applicationPageableRequestBean.getGlobalFilters() != null) {
|
|
||||||
pageNo = applicationPageableRequestBean.getGlobalFilters().getPage();
|
|
||||||
pageLimit = applicationPageableRequestBean.getGlobalFilters().getLimit();
|
|
||||||
}
|
|
||||||
if (pageLimit == null || pageLimit <= 0) {
|
|
||||||
pageLimit = GepafinConstant.DEFAULT_PAGE_LIMIT;
|
|
||||||
}
|
|
||||||
if (pageNo == null || pageNo <= 0) {
|
|
||||||
pageNo = GepafinConstant.DEFAULT_PAGE;
|
|
||||||
}
|
|
||||||
Specification<ApplicationEntity> spec = search(callId, companyId, applicationPageableRequestBean, userEntity);
|
|
||||||
Page<ApplicationEntity> entityPage = applicationRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
|
||||||
// Prepare the response
|
|
||||||
|
|
||||||
|
|
||||||
List<ApplicationResponse> applicationResponses = entityPage.getContent().stream()
|
|
||||||
.map(application -> {
|
|
||||||
ApplicationResponse response = getApplicationResponse(application);
|
|
||||||
return response;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
|
|
||||||
PageableResponseBean<List<ApplicationResponse>> pageableResponseBean = new PageableResponseBean<>();
|
|
||||||
pageableResponseBean.setBody(applicationResponses);
|
|
||||||
pageableResponseBean.setCurrentPage(entityPage.getNumber() + 1); // Page numbers typically start from 0, so add 1 for user-friendly indexing
|
|
||||||
pageableResponseBean.setTotalPages(entityPage.getTotalPages());
|
|
||||||
pageableResponseBean.setTotalRecords(entityPage.getTotalElements());
|
|
||||||
pageableResponseBean.setPageSize(entityPage.getSize());
|
|
||||||
|
|
||||||
return pageableResponseBean;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Specification<ApplicationEntity> search(Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean, UserEntity userEntity) {
|
|
||||||
return (root, query, criteriaBuilder) -> {
|
|
||||||
|
|
||||||
List<Predicate> predicates = getPredicates(applicationPageableRequestBean, criteriaBuilder, root, callId, companyId, userEntity);
|
|
||||||
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
|
||||||
|
|
||||||
if (applicationPageableRequestBean.getGlobalFilters() != null
|
|
||||||
&& applicationPageableRequestBean.getGlobalFilters().getSortBy() != null &&
|
|
||||||
applicationPageableRequestBean.getGlobalFilters().getSortBy().getColumnName() != null && Boolean.FALSE.equals(
|
|
||||||
isEmpty(applicationPageableRequestBean.getGlobalFilters().getSortBy().getColumnName()))) {
|
|
||||||
sortBy.setColumnName(applicationPageableRequestBean.getGlobalFilters().getSortBy().getColumnName());
|
|
||||||
sortBy.setSortDesc(true);
|
|
||||||
if (applicationPageableRequestBean.getGlobalFilters().getSortBy().getSortDesc() != null) {
|
|
||||||
sortBy.setSortDesc(applicationPageableRequestBean.getGlobalFilters().getSortBy().getSortDesc());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
query.orderBy(criteriaBuilder.desc(root.get(sortBy.getColumnName())));
|
|
||||||
if (Boolean.FALSE.equals(sortBy.getSortDesc())) {
|
|
||||||
query.orderBy(criteriaBuilder.asc(root.get(sortBy.getColumnName())));
|
|
||||||
}
|
|
||||||
return query.where(criteriaBuilder.and(predicates.toArray(new Predicate[0]))).getRestriction();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<Predicate> getPredicates(ApplicationPageableRequestBean applicationPageableRequestBean,
|
|
||||||
CriteriaBuilder criteriaBuilder, Root<ApplicationEntity> root, Long callId, Long companyId, UserEntity userEntity) {
|
|
||||||
|
|
||||||
Integer year = null;
|
|
||||||
String search = null;
|
|
||||||
if (applicationPageableRequestBean.getGlobalFilters() != null) {
|
|
||||||
year = applicationPageableRequestBean.getGlobalFilters().getYear();
|
|
||||||
search = applicationPageableRequestBean.getGlobalFilters().getSearch();
|
|
||||||
}
|
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
|
||||||
|
|
||||||
Boolean isBeneficiary = validator.checkIsBeneficiary();
|
|
||||||
if (isBeneficiary) {
|
|
||||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_ID), userEntity.getId()));
|
|
||||||
}
|
|
||||||
if (year != null && year > 0) {
|
|
||||||
int filterYear = applicationPageableRequestBean.getGlobalFilters().getYear();
|
|
||||||
|
|
||||||
// Create LocalDateTime boundaries for the start and end of the year
|
|
||||||
LocalDateTime startOfYear = LocalDateTime.of(filterYear, 1, 1, 0, 0);
|
|
||||||
LocalDateTime endOfYear = LocalDateTime.of(filterYear, 12, 31, 23, 59, 59);
|
|
||||||
|
|
||||||
// Add the range comparison to filter records within the year
|
|
||||||
predicates.add(criteriaBuilder.between(root.get(GepafinConstant.CREATED_DATE), startOfYear, endOfYear));
|
|
||||||
|
|
||||||
}
|
|
||||||
// Search in `title` and `message` (if search term is provided)
|
|
||||||
if (search != null && !search.isEmpty()) {
|
|
||||||
Predicate titlePredicate = criteriaBuilder.like(
|
|
||||||
criteriaBuilder.upper(root.get(GepafinConstant.COMMENTS)),
|
|
||||||
"%" + search.toUpperCase() + "%"
|
|
||||||
);
|
|
||||||
predicates.add(criteriaBuilder.or(titlePredicate));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter by `status` (if status list is provided)
|
|
||||||
if (applicationPageableRequestBean.getStatus() != null && !applicationPageableRequestBean.getStatus().isEmpty()) {
|
|
||||||
List<String> statusValues = applicationPageableRequestBean.getStatus().stream()
|
|
||||||
.map(ApplicationStatusTypeEnum::name) // Convert enum to string
|
|
||||||
.toList();
|
|
||||||
predicates.add(root.get(GepafinConstant.STATUS).in(statusValues));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (callId != null) {
|
|
||||||
CallEntity call = callService.validateCall(callId);
|
|
||||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.CALL).get(GepafinConstant.ID), callId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optional companyId filter
|
|
||||||
if (companyId != null) {
|
|
||||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.COMPANY_ID), companyId));
|
|
||||||
}
|
|
||||||
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
|
||||||
|
|
||||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.HUB_ID), userEntity.getHub().getId()));
|
|
||||||
|
|
||||||
|
|
||||||
return predicates;
|
|
||||||
|
|
||||||
}
|
|
||||||
public void checkCallEndDate(CallEntity call) {
|
public void checkCallEndDate(CallEntity call) {
|
||||||
LocalDateTime now = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
|
LocalDateTime now = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
|
||||||
|
|
||||||
@@ -1528,7 +1407,7 @@ public class ApplicationDao {
|
|||||||
if (now.isAfter(callEndDateTime)) {
|
if (now.isAfter(callEndDateTime)) {
|
||||||
throw new CustomValidationException(
|
throw new CustomValidationException(
|
||||||
Status.BAD_REQUEST,
|
Status.BAD_REQUEST,
|
||||||
Translator.toLocale(GepafinConstant.CALL_END_DATE_PASSED)
|
Translator.toLocale(GepafinConstant.CALL_EXPIRED)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,6 +296,8 @@ public class FlowFormDao {
|
|||||||
applicationDao.processForm(formEntity, applicationEntity));
|
applicationDao.processForm(formEntity, applicationEntity));
|
||||||
nextOrPreviousFormResponse.setCallId(applicationEntity.getCall().getId());
|
nextOrPreviousFormResponse.setCallId(applicationEntity.getCall().getId());
|
||||||
nextOrPreviousFormResponse.setCallTitle(applicationEntity.getCall().getName());
|
nextOrPreviousFormResponse.setCallTitle(applicationEntity.getCall().getName());
|
||||||
|
nextOrPreviousFormResponse.setCallEndDate(applicationEntity.getCall().getEndDate());
|
||||||
|
nextOrPreviousFormResponse.setCallEndTime(applicationEntity.getCall().getEndTime());
|
||||||
nextOrPreviousFormResponse.setCompanyId(applicationEntity.getCompanyId());
|
nextOrPreviousFormResponse.setCompanyId(applicationEntity.getCompanyId());
|
||||||
nextOrPreviousFormResponse.setCompanyName(company.getCompanyName());
|
nextOrPreviousFormResponse.setCompanyName(company.getCompanyName());
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.gepafin.tendermanagement.model.response.ApplicationFormFieldResponseB
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -18,6 +19,8 @@ public class ApplicationResponse{
|
|||||||
|
|
||||||
private LocalDateTime callEndDate;
|
private LocalDateTime callEndDate;
|
||||||
|
|
||||||
|
private LocalTime callEndTime;
|
||||||
|
|
||||||
private LocalDateTime modifiedDate;
|
private LocalDateTime modifiedDate;
|
||||||
|
|
||||||
private Integer progress;
|
private Integer progress;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class NextOrPreviousFormResponse {
|
public class NextOrPreviousFormResponse {
|
||||||
@@ -20,6 +21,10 @@ public class NextOrPreviousFormResponse {
|
|||||||
private Long completedSteps;
|
private Long completedSteps;
|
||||||
|
|
||||||
private Long currentStep;
|
private Long currentStep;
|
||||||
|
|
||||||
|
private LocalDateTime callEndDate;
|
||||||
|
|
||||||
|
private LocalTime callEndTime;
|
||||||
|
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
|
|||||||
@@ -347,4 +347,4 @@ notification.deleted.successfully=Notification deleted successfully.
|
|||||||
notification.updated.successfully=Notification updated successfully.
|
notification.updated.successfully=Notification updated successfully.
|
||||||
user.with.company.not.found = User with company not found for user or company.
|
user.with.company.not.found = User with company not found for user or company.
|
||||||
amount.accepted.required=Amount accepted is required while approving the application.
|
amount.accepted.required=Amount accepted is required while approving the application.
|
||||||
call.end.date.passed=Call end date and time has been passed.
|
call.expired=Call has been expired.
|
||||||
|
|||||||
@@ -342,4 +342,4 @@ amount.accepted.required=L'importo accettato <20> obbligatorio durante l'approvaz
|
|||||||
user.action.fetched.successfully = Dettagli sull'azione dell'utente recuperati correttamente.
|
user.action.fetched.successfully = Dettagli sull'azione dell'utente recuperati correttamente.
|
||||||
action.context.labels.fetched.successfully = Etichette del contesto dell'azione recuperate correttamente.
|
action.context.labels.fetched.successfully = Etichette del contesto dell'azione recuperate correttamente.
|
||||||
amount.accepted.required=L'importo accettato <20> obbligatorio durante l'approvazione della domanda.
|
amount.accepted.required=L'importo accettato <20> obbligatorio durante l'approvazione della domanda.
|
||||||
call.end.date.passed=La data e l'ora di fine della chiamata sono state trascorse.
|
call.expired=La chiamata <20> scaduta.
|
||||||
|
|||||||
Reference in New Issue
Block a user