Merge branch 'develop' of https://github.com/Kitzanos/GEPAFIN-BE into feature/GEPAFINBE-199
This commit is contained in:
7
pom.xml
7
pom.xml
@@ -251,6 +251,13 @@
|
|||||||
<version>0.4.8</version>
|
<version>0.4.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-csv</artifactId>
|
||||||
|
<version>1.10.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- Jakarta email support -->
|
<!-- Jakarta email support -->
|
||||||
<!-- https://jakarta.ee/specifications/mail/ -->
|
<!-- https://jakarta.ee/specifications/mail/ -->
|
||||||
<!-- https://github.com/jakartaee/mail-api -->
|
<!-- https://github.com/jakartaee/mail-api -->
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public class GepafinConstant {
|
|||||||
public static final String STATUS_SAME_ERROR = "status.same.error";
|
public static final String STATUS_SAME_ERROR = "status.same.error";
|
||||||
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 INVALID_STATUS_CHANGE_FROM_PUBLISH_TO_DRAFT = "invalid.status.change.from.publish.to.draft";
|
||||||
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";
|
||||||
@@ -136,8 +137,9 @@ public class GepafinConstant {
|
|||||||
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_URL_V1 = "https://imprese.openapi.it/advance";
|
||||||
public static final String CHECK_VATNUMBER_V2_NEW_URL_IT_ADVANCE = "https://company.openapi.com/IT-advanced";
|
public static final String CHECK_VATNUMBER_URL_V2 = "https://company.openapi.com/IT-advanced";
|
||||||
|
public static final String VAT_CHECK_API_VERSION = "VAT_CHECK_API_VERSION";
|
||||||
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";
|
||||||
@@ -504,6 +506,35 @@ public class GepafinConstant {
|
|||||||
public static final String APPLICATION="application";
|
public static final String APPLICATION="application";
|
||||||
public static final String APPLICATION_ID="applicationId";
|
public static final String APPLICATION_ID="applicationId";
|
||||||
public static final String USER_WITH_COMPANY_ID="userWithCompanyId";
|
public static final String USER_WITH_COMPANY_ID="userWithCompanyId";
|
||||||
|
public static final String ASSIGNED_USER_ID="assignedUserId";
|
||||||
|
public static final String APPLICATION_USER_ID="applicationUserId";
|
||||||
|
public static final String INVALID_USER_ID="invalid.user";
|
||||||
|
public static final String COMPANY_NAME="companyName";
|
||||||
|
public static final String TABLE_COLUMNS="table_columns";
|
||||||
|
public static final String PREDEFINED="predefined";
|
||||||
|
public static final String EBABLE_CSV="enableCsv";
|
||||||
|
public static final String LABEL_CSV="labelCsv";
|
||||||
|
public static final String GET="get";
|
||||||
|
public static final String REPORT_COLUMNS="reportColumns";
|
||||||
|
public static final String FIELD_TYPE="fieldtype";
|
||||||
|
public static final String ENABLE_FORMULA="enableFormula";
|
||||||
|
public static final String STATE_FIELD_DATA="stateFieldData";
|
||||||
|
public static final String REPORT_ENABLE="reportEnable";
|
||||||
|
public static final String TABLE="table";
|
||||||
|
public static final String GET_FIELD_TYPE="getFieldType";
|
||||||
|
public static final String GET_APPLICATION_FORM_ID="getApplicationFormId";
|
||||||
|
public static final String GET_APPLICATION_ID="getApplicationId";
|
||||||
|
public static final String GET_ID="getId";
|
||||||
|
public static final String GET_CLASS="getClass";
|
||||||
|
public static final String GET_FORM_ID="getFormId";
|
||||||
|
public static final String GET_FIELD_ID="getFieldId";
|
||||||
|
public static final String GET_FIELD_LABEL="getFieldLabel";
|
||||||
|
public static final String GET_FIELD_VALUE="getFieldValue";
|
||||||
|
public static final String GET_REPORT_ENABLE="getReportEnable";
|
||||||
|
public static final String GET_REPORT_HEADER="getReportHeader";
|
||||||
|
|
||||||
|
public static final String APPOINTMENT_ID="appointmentId";
|
||||||
|
public static final String APPLICATION_STATUS="applicationStatus";
|
||||||
|
|
||||||
public static final String RINALDO_EMAIL = "rinaldo.bonazzo@bflows.net";
|
public static final String RINALDO_EMAIL = "rinaldo.bonazzo@bflows.net";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,12 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEvaluationFormRepository applicationEvaluationFormRepository;
|
private ApplicationEvaluationFormRepository applicationEvaluationFormRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationAmendmentRequestViewRepository applicationAmendmentRequestViewRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationDao applicationDao;
|
||||||
|
|
||||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(Long applicationEvaluationId) {
|
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(Long applicationEvaluationId) {
|
||||||
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
|
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
|
||||||
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
||||||
@@ -1268,7 +1274,122 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
documentService.deleteFile(documentId);
|
documentService.deleteFile(documentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageableResponseBean<List<ApplicationAmendmentRequestResponse>> getApplicationAmendmentByPaginnation(Long userId, ApplicationAmendmentPaginationRequestBean applicationAmendmentPaginationRequestBean) {
|
// public PageableResponseBean<List<ApplicationAmendmentRequestResponse>> getApplicationAmendmentByPaginnation(Long userId, ApplicationAmendmentPaginationRequestBean applicationAmendmentPaginationRequestBean) {
|
||||||
|
// Integer pageNo = null;
|
||||||
|
// Integer pageLimit = null;
|
||||||
|
// if (applicationAmendmentPaginationRequestBean.getGlobalFilters() != null) {
|
||||||
|
// pageNo = applicationAmendmentPaginationRequestBean.getGlobalFilters().getPage();
|
||||||
|
// pageLimit = applicationAmendmentPaginationRequestBean.getGlobalFilters().getLimit();
|
||||||
|
// }
|
||||||
|
// if (pageLimit == null || pageLimit <= 0) {
|
||||||
|
// pageLimit = GepafinConstant.DEFAULT_PAGE_LIMIT;
|
||||||
|
// }
|
||||||
|
// if (pageNo == null || pageNo <= 0) {
|
||||||
|
// pageNo = GepafinConstant.DEFAULT_PAGE;
|
||||||
|
// }
|
||||||
|
// Specification<ApplicationAmendmentRequestEntity> spec = searchPagination(userId,applicationAmendmentPaginationRequestBean);
|
||||||
|
// Page<ApplicationAmendmentRequestEntity> entityPage = applicationAmendmentRequestRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// List<ApplicationAmendmentRequestResponse> applicationResponses = entityPage.getContent().stream()
|
||||||
|
// .map(application -> {
|
||||||
|
// ApplicationAmendmentRequestResponse response = convertEntityToResponse(application,false);
|
||||||
|
// return response;
|
||||||
|
// })
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// PageableResponseBean<List<ApplicationAmendmentRequestResponse>> 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<ApplicationAmendmentRequestEntity> searchPagination(Long userId,ApplicationAmendmentPaginationRequestBean applicationAmendmentPaginationRequestBean) {
|
||||||
|
// return (root, query, criteriaBuilder) -> {
|
||||||
|
//
|
||||||
|
// List<Predicate> predicates = getPredicates(applicationAmendmentPaginationRequestBean, criteriaBuilder, root,userId);
|
||||||
|
// SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
||||||
|
//
|
||||||
|
// if (applicationAmendmentPaginationRequestBean .getGlobalFilters() != null
|
||||||
|
// && applicationAmendmentPaginationRequestBean.getGlobalFilters().getSortBy() != null &&
|
||||||
|
// applicationAmendmentPaginationRequestBean.getGlobalFilters().getSortBy().getColumnName() != null && Boolean.FALSE.equals(
|
||||||
|
// isEmpty(applicationAmendmentPaginationRequestBean.getGlobalFilters().getSortBy().getColumnName()))) {
|
||||||
|
// sortBy.setColumnName(applicationAmendmentPaginationRequestBean.getGlobalFilters().getSortBy().getColumnName());
|
||||||
|
// sortBy.setSortDesc(true);
|
||||||
|
// if (applicationAmendmentPaginationRequestBean.getGlobalFilters().getSortBy().getSortDesc() != null) {
|
||||||
|
// sortBy.setSortDesc(applicationAmendmentPaginationRequestBean.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(ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean,
|
||||||
|
// CriteriaBuilder criteriaBuilder, Root<ApplicationAmendmentRequestEntity> root,Long userId) {
|
||||||
|
//
|
||||||
|
// Integer year = null;
|
||||||
|
// String search = null;
|
||||||
|
// if (amendmentPaginationRequestBean.getGlobalFilters() != null) {
|
||||||
|
// year = amendmentPaginationRequestBean.getGlobalFilters().getYear();
|
||||||
|
// search = amendmentPaginationRequestBean.getGlobalFilters().getSearch();
|
||||||
|
// }
|
||||||
|
// List<Predicate> predicates = new ArrayList<>();
|
||||||
|
//
|
||||||
|
// if (year != null && year > 0) {
|
||||||
|
// int filterYear = amendmentPaginationRequestBean.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 notePredicate = criteriaBuilder.like(
|
||||||
|
// criteriaBuilder.upper(root.get(GepafinConstant.NOTE)),
|
||||||
|
// "%" + search.toUpperCase() + "%"
|
||||||
|
// );
|
||||||
|
// predicates.add(criteriaBuilder.or(notePredicate));
|
||||||
|
// Predicate internalNotePredicate = criteriaBuilder.like(
|
||||||
|
// criteriaBuilder.upper(root.get(GepafinConstant.INTERNAL_NOTE)),
|
||||||
|
// "%" + search.toUpperCase() + "%"
|
||||||
|
// );
|
||||||
|
// predicates.add(criteriaBuilder.or(internalNotePredicate));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Filter by `status` (if status list is provided)
|
||||||
|
// if (amendmentPaginationRequestBean.getStatus() != null && !amendmentPaginationRequestBean.getStatus().isEmpty()) {
|
||||||
|
// List<String> statusValues = amendmentPaginationRequestBean.getStatus().stream()
|
||||||
|
// .map(ApplicationAmendmentRequestEnum::name) // Convert enum to string
|
||||||
|
// .toList();
|
||||||
|
// predicates.add(root.get(GepafinConstant.STATUS).in(statusValues));
|
||||||
|
// }
|
||||||
|
// if(Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
|
||||||
|
// predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("application").get("userId").in(userId));
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("userId").in(userId));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return predicates;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
public PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>> getApplicationAmendmentByPaginationByView(Long userId, ApplicationAmendmentPaginationRequestBean applicationAmendmentPaginationRequestBean) {
|
||||||
Integer pageNo = null;
|
Integer pageNo = null;
|
||||||
Integer pageLimit = null;
|
Integer pageLimit = null;
|
||||||
if (applicationAmendmentPaginationRequestBean.getGlobalFilters() != null) {
|
if (applicationAmendmentPaginationRequestBean.getGlobalFilters() != null) {
|
||||||
@@ -1281,20 +1402,20 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
if (pageNo == null || pageNo <= 0) {
|
if (pageNo == null || pageNo <= 0) {
|
||||||
pageNo = GepafinConstant.DEFAULT_PAGE;
|
pageNo = GepafinConstant.DEFAULT_PAGE;
|
||||||
}
|
}
|
||||||
Specification<ApplicationAmendmentRequestEntity> spec = searchPagination(userId,applicationAmendmentPaginationRequestBean);
|
Specification<ApplicationAmendmentRequestView> spec = searchPaginationByView(userId,applicationAmendmentPaginationRequestBean);
|
||||||
Page<ApplicationAmendmentRequestEntity> entityPage = applicationAmendmentRequestRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
Page<ApplicationAmendmentRequestView> entityPage = applicationAmendmentRequestViewRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||||
|
|
||||||
|
|
||||||
List<ApplicationAmendmentRequestResponse> applicationResponses = entityPage.getContent().stream()
|
List<ApplicationAmendmentRequestViewResponse> applicationAmendmentRequestViewResponses = entityPage.getContent().stream()
|
||||||
.map(application -> {
|
.map(amendmentRequestView -> {
|
||||||
ApplicationAmendmentRequestResponse response = convertEntityToResponse(application,false);
|
ApplicationAmendmentRequestViewResponse response = convertAmendmentEntityToApplicationAmendmentRequestViewResponse(amendmentRequestView);
|
||||||
return response;
|
return response;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
PageableResponseBean<List<ApplicationAmendmentRequestResponse>> pageableResponseBean = new PageableResponseBean<>();
|
PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>> pageableResponseBean = new PageableResponseBean<>();
|
||||||
pageableResponseBean.setBody(applicationResponses);
|
pageableResponseBean.setBody(applicationAmendmentRequestViewResponses);
|
||||||
pageableResponseBean.setCurrentPage(entityPage.getNumber() + 1); // Page numbers typically start from 0, so add 1 for user-friendly indexing
|
pageableResponseBean.setCurrentPage(entityPage.getNumber() + 1); // Page numbers typically start from 0, so add 1 for user-friendly indexing
|
||||||
pageableResponseBean.setTotalPages(entityPage.getTotalPages());
|
pageableResponseBean.setTotalPages(entityPage.getTotalPages());
|
||||||
pageableResponseBean.setTotalRecords(entityPage.getTotalElements());
|
pageableResponseBean.setTotalRecords(entityPage.getTotalElements());
|
||||||
@@ -1302,11 +1423,10 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
|
|
||||||
return pageableResponseBean;
|
return pageableResponseBean;
|
||||||
}
|
}
|
||||||
|
public Specification<ApplicationAmendmentRequestView> searchPaginationByView(Long userId,ApplicationAmendmentPaginationRequestBean applicationAmendmentPaginationRequestBean) {
|
||||||
public Specification<ApplicationAmendmentRequestEntity> searchPagination(Long userId,ApplicationAmendmentPaginationRequestBean applicationAmendmentPaginationRequestBean) {
|
|
||||||
return (root, query, criteriaBuilder) -> {
|
return (root, query, criteriaBuilder) -> {
|
||||||
|
|
||||||
List<Predicate> predicates = getPredicates(applicationAmendmentPaginationRequestBean, criteriaBuilder, root,userId);
|
List<Predicate> predicates = getPredicatesByView(applicationAmendmentPaginationRequestBean, criteriaBuilder, root,userId);
|
||||||
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
||||||
|
|
||||||
if (applicationAmendmentPaginationRequestBean .getGlobalFilters() != null
|
if (applicationAmendmentPaginationRequestBean .getGlobalFilters() != null
|
||||||
@@ -1329,15 +1449,19 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<Predicate> getPredicates(ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean,
|
private List<Predicate> getPredicatesByView(ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean,
|
||||||
CriteriaBuilder criteriaBuilder, Root<ApplicationAmendmentRequestEntity> root,Long userId) {
|
CriteriaBuilder criteriaBuilder, Root<ApplicationAmendmentRequestView> root,Long userId) {
|
||||||
|
|
||||||
Integer year = null;
|
Integer year = null;
|
||||||
String search = null;
|
String search = null;
|
||||||
|
Map<String, FilterCriteria> filters = new HashMap<>();
|
||||||
if (amendmentPaginationRequestBean.getGlobalFilters() != null) {
|
if (amendmentPaginationRequestBean.getGlobalFilters() != null) {
|
||||||
year = amendmentPaginationRequestBean.getGlobalFilters().getYear();
|
year = amendmentPaginationRequestBean.getGlobalFilters().getYear();
|
||||||
search = amendmentPaginationRequestBean.getGlobalFilters().getSearch();
|
search = amendmentPaginationRequestBean.getGlobalFilters().getSearch();
|
||||||
}
|
}
|
||||||
|
if (amendmentPaginationRequestBean.getFilters() != null) {
|
||||||
|
filters = amendmentPaginationRequestBean.getFilters();
|
||||||
|
}
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
|
||||||
if (year != null && year > 0) {
|
if (year != null && year > 0) {
|
||||||
@@ -1351,19 +1475,37 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
predicates.add(criteriaBuilder.between(root.get(GepafinConstant.CREATED_DATE), startOfYear, endOfYear));
|
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()) {
|
if (search != null && !search.isEmpty()) {
|
||||||
Predicate notePredicate = criteriaBuilder.like(
|
List<Predicate> searchPredicates = new ArrayList<>();
|
||||||
criteriaBuilder.upper(root.get(GepafinConstant.NOTE)),
|
|
||||||
|
searchPredicates.add(criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get(GepafinConstant.CALL_NAME)),
|
||||||
"%" + search.toUpperCase() + "%"
|
"%" + search.toUpperCase() + "%"
|
||||||
);
|
));
|
||||||
predicates.add(criteriaBuilder.or(notePredicate));
|
|
||||||
Predicate internalNotePredicate = criteriaBuilder.like(
|
searchPredicates.add(criteriaBuilder.like(
|
||||||
criteriaBuilder.upper(root.get(GepafinConstant.INTERNAL_NOTE)),
|
criteriaBuilder.upper(root.get(GepafinConstant.COMPANY_NAME)),
|
||||||
"%" + search.toUpperCase() + "%"
|
"%" + search.toUpperCase() + "%"
|
||||||
);
|
));
|
||||||
predicates.add(criteriaBuilder.or(internalNotePredicate));
|
|
||||||
|
// Uncomment these if needed
|
||||||
|
// searchPredicates.add(criteriaBuilder.like(
|
||||||
|
// criteriaBuilder.upper(root.get(GepafinConstant.NOTE)),
|
||||||
|
// "%" + search.toUpperCase() + "%"
|
||||||
|
// ));
|
||||||
|
//
|
||||||
|
// searchPredicates.add(criteriaBuilder.like(
|
||||||
|
// criteriaBuilder.upper(root.get(GepafinConstant.INTERNAL_NOTE)),
|
||||||
|
// "%" + search.toUpperCase() + "%"
|
||||||
|
// ));
|
||||||
|
|
||||||
|
Predicate finalPredicate = criteriaBuilder.or(searchPredicates.toArray(new Predicate[0]));
|
||||||
|
|
||||||
|
predicates.add(finalPredicate);
|
||||||
}
|
}
|
||||||
|
Utils.applyFiltersByPagination(root, criteriaBuilder, predicates, filters);
|
||||||
|
|
||||||
|
|
||||||
// Filter by `status` (if status list is provided)
|
// Filter by `status` (if status list is provided)
|
||||||
if (amendmentPaginationRequestBean.getStatus() != null && !amendmentPaginationRequestBean.getStatus().isEmpty()) {
|
if (amendmentPaginationRequestBean.getStatus() != null && !amendmentPaginationRequestBean.getStatus().isEmpty()) {
|
||||||
@@ -1372,14 +1514,33 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
.toList();
|
.toList();
|
||||||
predicates.add(root.get(GepafinConstant.STATUS).in(statusValues));
|
predicates.add(root.get(GepafinConstant.STATUS).in(statusValues));
|
||||||
}
|
}
|
||||||
if(Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
|
boolean isBeneficiaryOrConfidi = validator.checkIsBeneficiary() || validator.checkIsConfidi();
|
||||||
predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("application").get("userId").in(userId));
|
boolean isPreInstructor = validator.checkIsPreInstructor();
|
||||||
}
|
boolean isInstructorManagerWithPersonalRecords = validator.checkIsInstructorManager() &&
|
||||||
else {
|
Boolean.TRUE.equals(amendmentPaginationRequestBean.getPersonalRecords());
|
||||||
predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("userId").in(userId));
|
|
||||||
|
if (isBeneficiaryOrConfidi) {
|
||||||
|
predicates.add(root.get(GepafinConstant.APPLICATION_USER_ID).in(userId));
|
||||||
|
} else if (isPreInstructor || isInstructorManagerWithPersonalRecords) {
|
||||||
|
predicates.add(root.get(GepafinConstant.ASSIGNED_USER_ID).in(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
return predicates;
|
return predicates;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public ApplicationAmendmentRequestViewResponse convertAmendmentEntityToApplicationAmendmentRequestViewResponse(ApplicationAmendmentRequestView applicationAmendmentRequestView){
|
||||||
|
ApplicationAmendmentRequestViewResponse applicationAmendmentRequestViewResponse=new ApplicationAmendmentRequestViewResponse();
|
||||||
|
applicationAmendmentRequestViewResponse.setId(applicationAmendmentRequestView.getId());
|
||||||
|
applicationAmendmentRequestViewResponse.setApplicationId(applicationAmendmentRequestView.getApplicationId());
|
||||||
|
applicationAmendmentRequestViewResponse.setProtocolNumber(applicationAmendmentRequestView.getProtocolNumber());
|
||||||
|
applicationAmendmentRequestViewResponse.setCallName(applicationAmendmentRequestView.getCallName());
|
||||||
|
applicationAmendmentRequestViewResponse.setCompanyName(applicationAmendmentRequestView.getCompanyName());
|
||||||
|
applicationAmendmentRequestViewResponse.setStartDate(applicationAmendmentRequestView.getStartDate());
|
||||||
|
applicationAmendmentRequestViewResponse.setExpirationDate(applicationAmendmentRequestView.getExpirationDate());
|
||||||
|
applicationAmendmentRequestViewResponse.setAssigendUserName(applicationAmendmentRequestView.getAssigendUserName());
|
||||||
|
applicationAmendmentRequestViewResponse.setStatus(applicationAmendmentRequestView.getStatus());
|
||||||
|
return applicationAmendmentRequestViewResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,15 +21,14 @@ import net.gepafin.tendermanagement.service.FormService;
|
|||||||
import net.gepafin.tendermanagement.service.HubService;
|
import net.gepafin.tendermanagement.service.HubService;
|
||||||
import net.gepafin.tendermanagement.service.SystemEmailTemplatesService;
|
import net.gepafin.tendermanagement.service.SystemEmailTemplatesService;
|
||||||
import net.gepafin.tendermanagement.service.UserService;
|
import net.gepafin.tendermanagement.service.UserService;
|
||||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
import net.gepafin.tendermanagement.util.*;
|
||||||
import net.gepafin.tendermanagement.util.FieldValidator;
|
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
|
||||||
|
import org.apache.commons.csv.CSVFormat;
|
||||||
|
import org.apache.commons.csv.CSVPrinter;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.h2.util.IOUtils;
|
import org.h2.util.IOUtils;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -47,9 +46,14 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -185,6 +189,11 @@ public class ApplicationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationViewRepository applicationViewRepository;
|
private ApplicationViewRepository applicationViewRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationFormViewRepository applicationFormViewRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FormRepository formRepository;
|
||||||
|
|
||||||
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
||||||
FormEntity formEntity = formService.validateForm(formId);
|
FormEntity formEntity = formService.validateForm(formId);
|
||||||
@@ -1438,185 +1447,6 @@ public class ApplicationDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageableResponseBean<List<ApplicationResponse>> getAllApplicationByPagination(UserEntity userEntity, Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean) {
|
|
||||||
Integer pageNo = null;
|
|
||||||
Integer pageLimit = null;
|
|
||||||
|
|
||||||
UserWithCompanyEntity userWithCompany= userWithCompanyRepository.findByUserIdAndCompanyIdAndIsDeletedFalse(userEntity.getId(), companyId).orElse(null);
|
|
||||||
Long userWithCompanyId = userWithCompany!=null?userWithCompany.getId():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, userWithCompanyId, 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, Long userWithCompanyId, ApplicationPageableRequestBean applicationPageableRequestBean, UserEntity userEntity) {
|
|
||||||
return (root, query, criteriaBuilder) -> {
|
|
||||||
|
|
||||||
List<Predicate> predicates = getPredicates(applicationPageableRequestBean, criteriaBuilder, root, callId,companyId, userWithCompanyId, 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, Long userWithCompanyId, UserEntity userEntity) {
|
|
||||||
|
|
||||||
Integer year = null;
|
|
||||||
String search = null;
|
|
||||||
Integer daysRange = null;
|
|
||||||
Map<String, FilterCriteria> filters = new HashMap<>();
|
|
||||||
if (applicationPageableRequestBean.getGlobalFilters() != null) {
|
|
||||||
year = applicationPageableRequestBean.getGlobalFilters().getYear();
|
|
||||||
search = applicationPageableRequestBean.getGlobalFilters().getSearch();
|
|
||||||
daysRange = applicationPageableRequestBean.getDaysRange();
|
|
||||||
}
|
|
||||||
if (applicationPageableRequestBean.getFilters() != null) {
|
|
||||||
filters = applicationPageableRequestBean.getFilters();
|
|
||||||
}
|
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
|
||||||
|
|
||||||
// Boolean isBeneficiary = validator.checkIsBeneficiary();
|
|
||||||
if (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
|
|
||||||
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() + "%"
|
|
||||||
);
|
|
||||||
// Predicate protocolPredicate = criteriaBuilder.like(
|
|
||||||
// criteriaBuilder.function(
|
|
||||||
// "TO_CHAR",
|
|
||||||
// String.class,
|
|
||||||
// criteriaBuilder.function("CAST", String.class, root.get(GepafinConstant.PROTOCOL).get(GepafinConstant.PROTOCOL_NUMBER))
|
|
||||||
// ),
|
|
||||||
// "%" + search + "%"
|
|
||||||
// );
|
|
||||||
|
|
||||||
Predicate callNamePredicate =criteriaBuilder.like(
|
|
||||||
criteriaBuilder.upper(root.get(GepafinConstant.CALL).get(GepafinConstant.NAME)), // Adjust field name
|
|
||||||
"%" + search.toUpperCase() + "%"
|
|
||||||
);
|
|
||||||
|
|
||||||
// predicates.add(criteriaBuilder.or(protocolPredicate));
|
|
||||||
predicates.add(criteriaBuilder.or(callNamePredicate));
|
|
||||||
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 (userWithCompanyId != null) {
|
|
||||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_WITH_COMPANY).get(GepafinConstant.ID), userWithCompanyId));
|
|
||||||
}
|
|
||||||
if (companyId != null) {
|
|
||||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.COMPANY_ID), companyId));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (daysRange != null && daysRange >= 0) {
|
|
||||||
LocalDateTime today = LocalDateTime.now();
|
|
||||||
LocalDateTime pastDate = today.minusDays(daysRange);
|
|
||||||
predicates.add(criteriaBuilder.between(root.get(GepafinConstant.CREATED_DATE), pastDate, today));
|
|
||||||
}
|
|
||||||
applyFilters(root, criteriaBuilder, predicates, filters);
|
|
||||||
|
|
||||||
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
|
||||||
|
|
||||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.HUB_ID), userEntity.getHub().getId()));
|
|
||||||
|
|
||||||
|
|
||||||
return predicates;
|
|
||||||
}
|
|
||||||
private void applyFilters(Root<?> root, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Map<String, FilterCriteria> filters) {
|
|
||||||
if (Boolean.FALSE.equals(filters.isEmpty())) {
|
|
||||||
for (Map.Entry<String, FilterCriteria> entry : filters.entrySet()) {
|
|
||||||
String fieldName = entry.getKey();
|
|
||||||
FilterCriteria filterCriteria = entry.getValue();
|
|
||||||
Object value = filterCriteria.getValue();
|
|
||||||
MatchModeEnum matchMode = filterCriteria.getMatchMode();
|
|
||||||
|
|
||||||
if (value != null && matchMode != null) {
|
|
||||||
Path<?> fieldPath = root.get(fieldName);
|
|
||||||
if (fieldPath != null) {
|
|
||||||
Utils.applyStringFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
|
|
||||||
Utils.applyNumberFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
|
|
||||||
Utils.applyDateFilter(fieldPath, criteriaBuilder, predicates, value, matchMode,root);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// private Path<?> getFieldPath(Root<?> root, String fieldName) {
|
// private Path<?> getFieldPath(Root<?> root, String fieldName) {
|
||||||
// try {
|
// try {
|
||||||
@@ -1889,27 +1719,29 @@ public class ApplicationDao {
|
|||||||
}
|
}
|
||||||
// Search in `title` and `message` (if search term is provided)
|
// Search in `title` and `message` (if search term is provided)
|
||||||
if (search != null && !search.isEmpty()) {
|
if (search != null && !search.isEmpty()) {
|
||||||
|
String searchPattern = "%" + search.toUpperCase() + "%";
|
||||||
|
|
||||||
Predicate titlePredicate = criteriaBuilder.like(
|
Predicate titlePredicate = criteriaBuilder.like(
|
||||||
criteriaBuilder.upper(root.get(GepafinConstant.COMMENTS)),
|
criteriaBuilder.upper(root.get(GepafinConstant.COMMENTS)),
|
||||||
"%" + search.toUpperCase() + "%"
|
searchPattern
|
||||||
);
|
);
|
||||||
// Predicate protocolPredicate = criteriaBuilder.like(
|
|
||||||
// criteriaBuilder.function(
|
|
||||||
// "TO_CHAR",
|
|
||||||
// String.class,
|
|
||||||
// criteriaBuilder.function("CAST", String.class, root.get(GepafinConstant.PROTOCOL).get(GepafinConstant.PROTOCOL_NUMBER))
|
|
||||||
// ),
|
|
||||||
// "%" + search + "%"
|
|
||||||
// );
|
|
||||||
|
|
||||||
|
Predicate callTitlePredicate = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get(GepafinConstant.CALL_TITLE)),
|
||||||
|
searchPattern
|
||||||
|
);
|
||||||
Predicate callNamePredicate = criteriaBuilder.like(
|
Predicate callNamePredicate = criteriaBuilder.like(
|
||||||
criteriaBuilder.upper(root.get(GepafinConstant.CALL_TITLE)), // Adjust field name
|
criteriaBuilder.upper(root.get(GepafinConstant.CALL_NAME)),
|
||||||
"%" + search.toUpperCase() + "%"
|
searchPattern
|
||||||
|
);
|
||||||
|
Predicate companyName = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get(GepafinConstant.COMPANY_NAME)),
|
||||||
|
searchPattern
|
||||||
);
|
);
|
||||||
|
|
||||||
// predicates.add(criteriaBuilder.or(protocolPredicate));
|
// Combine them using a single `or()`
|
||||||
predicates.add(criteriaBuilder.or(callNamePredicate));
|
Predicate finalPredicate = criteriaBuilder.or(titlePredicate, callTitlePredicate,callNamePredicate,companyName);
|
||||||
predicates.add(criteriaBuilder.or(titlePredicate));
|
predicates.add(finalPredicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by `status` (if status list is provided)
|
// Filter by `status` (if status list is provided)
|
||||||
@@ -1938,7 +1770,7 @@ public class ApplicationDao {
|
|||||||
LocalDateTime pastDate = today.minusDays(daysRange);
|
LocalDateTime pastDate = today.minusDays(daysRange);
|
||||||
predicates.add(criteriaBuilder.between(root.get(GepafinConstant.CREATED_DATE), pastDate, today));
|
predicates.add(criteriaBuilder.between(root.get(GepafinConstant.CREATED_DATE), pastDate, today));
|
||||||
}
|
}
|
||||||
applyFilters(root, criteriaBuilder, predicates, filters);
|
Utils.applyFiltersByPagination(root, criteriaBuilder, predicates, filters);
|
||||||
|
|
||||||
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
||||||
|
|
||||||
@@ -1966,18 +1798,9 @@ public class ApplicationDao {
|
|||||||
responseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(applicationView.getEvaluationVersion()));
|
responseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(applicationView.getEvaluationVersion()));
|
||||||
responseBean.setComments(applicationView.getComments());
|
responseBean.setComments(applicationView.getComments());
|
||||||
responseBean.setCompanyId(applicationView.getCompanyId());
|
responseBean.setCompanyId(applicationView.getCompanyId());
|
||||||
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
|
responseBean.setAssignedUserId(applicationView.getAssignedUserId());
|
||||||
assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationView.getId());
|
responseBean.setAssignedUserName(applicationView.getAssignedUserName());
|
||||||
if(assignedApplicationsOptional.isPresent()){
|
responseBean.setCompanyName(applicationView.getCompanyName());
|
||||||
responseBean.setAssignedUserId(assignedApplicationsOptional.get().getUserId());
|
|
||||||
UserEntity user = userService.validateUser(assignedApplicationsOptional.get().getUserId());
|
|
||||||
String firstName = user.getFirstName() != null ? user.getFirstName() : "";
|
|
||||||
String lastName = user.getLastName() != null ? user.getLastName() : "";
|
|
||||||
String userName = String.join(" ", firstName, lastName).trim();
|
|
||||||
responseBean.setAssignedUserName(userName);
|
|
||||||
}
|
|
||||||
CompanyEntity company=companyService.validateCompany(applicationView.getCompanyId());
|
|
||||||
responseBean.setCompanyName(company.getCompanyName());
|
|
||||||
responseBean.setProtocolNumber(applicationView.getProtocolNumber());
|
responseBean.setProtocolNumber(applicationView.getProtocolNumber());
|
||||||
responseBean.setAmountAccepted(applicationView.getAmountAccepted());
|
responseBean.setAmountAccepted(applicationView.getAmountAccepted());
|
||||||
responseBean.setAmountRequested(applicationView.getAmountRequested());
|
responseBean.setAmountRequested(applicationView.getAmountRequested());
|
||||||
@@ -1985,4 +1808,316 @@ public class ApplicationDao {
|
|||||||
responseBean.setDateRejected(applicationView.getDateRejected());
|
responseBean.setDateRejected(applicationView.getDateRejected());
|
||||||
return responseBean;
|
return responseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ApplicationFormView> getApplicationFormData(Long callId) {
|
||||||
|
List<ApplicationFormView> applicationFormViews=new ArrayList<>();
|
||||||
|
|
||||||
|
applicationFormViews= applicationFormViewRepository.findByCallId(callId);
|
||||||
|
|
||||||
|
return applicationFormViews;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Method> getStaticGetterMethods() {
|
||||||
|
List<String> excluded = Arrays.asList(
|
||||||
|
GepafinConstant.GET_FIELD_TYPE,GepafinConstant.GET_APPLICATION_FORM_ID,GepafinConstant.GET_ID,GepafinConstant.GET_CLASS,GepafinConstant.GET_FORM_ID,GepafinConstant.GET_FIELD_ID,GepafinConstant.GET_FIELD_LABEL,GepafinConstant.GET_FIELD_VALUE,GepafinConstant.GET_REPORT_HEADER,GepafinConstant.GET_REPORT_ENABLE
|
||||||
|
);
|
||||||
|
|
||||||
|
Method applicationIdMethod = null;
|
||||||
|
|
||||||
|
List<Method> methods = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Method m : ApplicationFormView.class.getMethods()) {
|
||||||
|
if (m.getName().equals(GepafinConstant.GET_APPLICATION_ID)) {
|
||||||
|
applicationIdMethod = m;
|
||||||
|
} else if (m.getName().startsWith(GepafinConstant.GET) && m.getParameterCount() == 0 && !excluded.contains(m.getName())) {
|
||||||
|
methods.add(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
methods.sort(Comparator.comparing(Method::getName)); // Sort remaining
|
||||||
|
|
||||||
|
if (applicationIdMethod != null) {
|
||||||
|
methods.add(0, applicationIdMethod); // Add it to the beginning
|
||||||
|
}
|
||||||
|
|
||||||
|
return methods;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String methodToHeader(Method method) {
|
||||||
|
String name = method.getName().substring(3); // strip "get"
|
||||||
|
return Arrays.stream(name.split("(?=[A-Z])"))
|
||||||
|
.map(String::toLowerCase)
|
||||||
|
.map(word -> Character.toUpperCase(word.charAt(0)) + word.substring(1))
|
||||||
|
.collect(Collectors.joining(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String invokeGetter(ApplicationFormView view, Method method) {
|
||||||
|
try {
|
||||||
|
Object value = method.invoke(view);
|
||||||
|
if (value == null) return "";
|
||||||
|
|
||||||
|
String stringValue;
|
||||||
|
|
||||||
|
if (value instanceof LocalDate) {
|
||||||
|
stringValue = ((LocalDate) value).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
} else if (value instanceof LocalDateTime) {
|
||||||
|
stringValue = ((LocalDateTime) value).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
stringValue = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format((Date) value);
|
||||||
|
} else {
|
||||||
|
stringValue = value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrap it in ="..." to make Excel treat it as a literal string
|
||||||
|
return "=\"" + stringValue.replace("\"", "\"\"") + "\"";
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public byte[] exportCsv(Long callId) {
|
||||||
|
|
||||||
|
List<ApplicationFormView> results = getApplicationFormData(callId);
|
||||||
|
|
||||||
|
|
||||||
|
Map<Long, ApplicationFormView> appInfo = new HashMap<>();
|
||||||
|
Map<Long, Map<String, String>> appFieldValues = new LinkedHashMap<>();
|
||||||
|
Set<String> tableFieldIds = new HashSet<>();
|
||||||
|
Map<String, String> fieldIdToLabel = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
for (ApplicationFormView row : results) {
|
||||||
|
appInfo.putIfAbsent(row.getApplicationId(), row);
|
||||||
|
String label=row.getReportHeader();
|
||||||
|
if(Boolean.TRUE.equals(StringUtils.isEmpty(label))){
|
||||||
|
label=row.getFieldLabel();
|
||||||
|
}
|
||||||
|
fieldIdToLabel.putIfAbsent(row.getFieldId(), label);
|
||||||
|
|
||||||
|
if (GepafinConstant.TABLE.equalsIgnoreCase(row.getFieldType())) {
|
||||||
|
tableFieldIds.add(row.getFieldId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String value = Optional.ofNullable(row.getFieldValue())
|
||||||
|
.map(v -> v.startsWith("\"") && v.endsWith("\"") ? v.substring(1, v.length() - 1) : v)
|
||||||
|
.orElse("");
|
||||||
|
|
||||||
|
appFieldValues
|
||||||
|
.computeIfAbsent(row.getApplicationId(), k -> new LinkedHashMap<>())
|
||||||
|
.merge(row.getFieldId(), value, (v1, v2) -> v1.equals(v2) ? v1 : String.join(", ", v1, v2));
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, List<String>> tableHeadersByFieldId = new LinkedHashMap<>();
|
||||||
|
Map<Long, Map<String, String>> tableDataByApp = new HashMap<>();
|
||||||
|
prepareTableFieldData(results, tableFieldIds, tableHeadersByFieldId, tableDataByApp);
|
||||||
|
|
||||||
|
// Final header construction
|
||||||
|
List<Method> staticMethods = getStaticGetterMethods();
|
||||||
|
List<String> staticHeaders = staticMethods.stream().map(this::methodToHeader).toList();
|
||||||
|
|
||||||
|
List<String> dynamicHeaders = new ArrayList<>();
|
||||||
|
for (String fieldId : fieldIdToLabel.keySet()) {
|
||||||
|
if (tableHeadersByFieldId.containsKey(fieldId)) {
|
||||||
|
dynamicHeaders.addAll(tableHeadersByFieldId.get(fieldId));
|
||||||
|
} else {
|
||||||
|
dynamicHeaders.add(fieldIdToLabel.get(fieldId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> allHeaders = new ArrayList<>(staticHeaders);
|
||||||
|
allHeaders.addAll(dynamicHeaders);
|
||||||
|
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
try (CSVPrinter printer = new CSVPrinter(new OutputStreamWriter(out), CSVFormat.DEFAULT.withHeader(allHeaders.toArray(new String[0])))) {
|
||||||
|
for (Long appId : appFieldValues.keySet()) {
|
||||||
|
ApplicationFormView appRow = appInfo.get(appId);
|
||||||
|
Map<String, String> flatFieldVals = appFieldValues.get(appId);
|
||||||
|
Map<String, String> tableVals = tableDataByApp.getOrDefault(appId, Collections.emptyMap());
|
||||||
|
|
||||||
|
List<String> row = new ArrayList<>();
|
||||||
|
for (Method method : staticMethods) {
|
||||||
|
row.add(invokeGetter(appRow, method));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String fieldId : fieldIdToLabel.keySet()) {
|
||||||
|
if (tableHeadersByFieldId.containsKey(fieldId)) {
|
||||||
|
for (String header : tableHeadersByFieldId.get(fieldId)) {
|
||||||
|
row.add(tableVals.getOrDefault(header, ""));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
row.add(flatFieldVals.getOrDefault(fieldId, ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printer.printRecord(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("CSV generation failed", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out.toByteArray();
|
||||||
|
}
|
||||||
|
private Map<String, String> extractTableData(String fieldType,
|
||||||
|
ContentResponseBean content, String fieldValue) {
|
||||||
|
|
||||||
|
if (content == null) return Map.of();
|
||||||
|
|
||||||
|
Map<String, String> result = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
List<Map<String, Object>> rows = null;
|
||||||
|
try {
|
||||||
|
rows = GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(fieldType)
|
||||||
|
? Utils.convertJsonToListMap(String.valueOf(PdfUtils.extractRows(fieldValue)))
|
||||||
|
: Utils.convertJsonToListMap(fieldValue);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> fieldLabelMap = new LinkedHashMap<>();
|
||||||
|
Set<String> predefinedIds = new LinkedHashSet<>();
|
||||||
|
Set<String> dynamicIds = new LinkedHashSet<>();
|
||||||
|
Set<String> numericFormulaIds = new LinkedHashSet<>();
|
||||||
|
|
||||||
|
for (SettingResponseBean setting : content.getSettings()) {
|
||||||
|
String settingName = setting.getName();
|
||||||
|
if(settingName.equals(GepafinConstant.REPORT_ENABLE)){
|
||||||
|
Boolean enable= (Boolean) setting.getValue();
|
||||||
|
if(Boolean.FALSE.equals(enable)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Boolean.TRUE.equals(GepafinConstant.TABLE_COLUMNS.equals(settingName)) || Boolean.TRUE.equals(GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(settingName))) {
|
||||||
|
Map<String, Object> valueMap = (Map<String, Object>) setting.getValue();
|
||||||
|
if (valueMap == null) continue;
|
||||||
|
|
||||||
|
List<Map<String, Object>> columns = (List<Map<String, Object>>) valueMap.get(GepafinConstant.STATE_FIELD_DATA);
|
||||||
|
if (columns != null) {
|
||||||
|
for (Map<String, Object> col : columns) {
|
||||||
|
String id = String.valueOf(col.get(GepafinConstant.NAME));
|
||||||
|
if (Boolean.FALSE.equals(col.get(GepafinConstant.PREDEFINED))) {
|
||||||
|
if (GepafinConstant.NUMERIC.equals(col.get(GepafinConstant.FIELD_TYPE)) && Boolean.TRUE.equals(col.get(GepafinConstant.ENABLE_FORMULA))) {
|
||||||
|
numericFormulaIds.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Boolean.TRUE.equals(GepafinConstant.REPORT_COLUMNS.equals(settingName))) {
|
||||||
|
List<Map<String, Object>> reportColumns = (List<Map<String, Object>>) setting.getValue();
|
||||||
|
if (reportColumns != null) {
|
||||||
|
for (Map<String, Object> col : reportColumns) {
|
||||||
|
Boolean enableCsv = (Boolean) col.get(GepafinConstant.EBABLE_CSV);
|
||||||
|
if (Boolean.TRUE.equals(enableCsv)) {
|
||||||
|
String id = String.valueOf(col.get(GepafinConstant.NAME));
|
||||||
|
|
||||||
|
String fieldCsvLabel = col.get(GepafinConstant.LABEL_CSV) != null
|
||||||
|
? String.valueOf(col.get(GepafinConstant.LABEL_CSV))
|
||||||
|
: String.valueOf(col.get(GepafinConstant.LABEL));
|
||||||
|
|
||||||
|
fieldLabelMap.put(id, fieldCsvLabel);
|
||||||
|
|
||||||
|
if (Boolean.TRUE.equals(col.get(GepafinConstant.PREDEFINED))) {
|
||||||
|
predefinedIds.add(id);
|
||||||
|
} else {
|
||||||
|
dynamicIds.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (predefinedIds.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (Map<String, Object> row : rows) {
|
||||||
|
String prefix = predefinedIds.stream()
|
||||||
|
.map(id -> String.valueOf(row.getOrDefault(id, "")))
|
||||||
|
.filter(s -> !s.isBlank())
|
||||||
|
.findFirst().orElse("");
|
||||||
|
|
||||||
|
|
||||||
|
for (String dynId : dynamicIds) {
|
||||||
|
String dynLabel = fieldLabelMap.get(dynId);
|
||||||
|
for (String preId : predefinedIds.isEmpty() ? List.of("") : predefinedIds) {
|
||||||
|
String preLabel = fieldLabelMap.get(preId);
|
||||||
|
String key = dynLabel + " " + (preLabel != null ? preLabel + " " : "") + prefix;
|
||||||
|
result.put(key, String.valueOf(row.getOrDefault(dynId, "")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add totals for numeric formula-enabled columns
|
||||||
|
for (String dynId : numericFormulaIds) {
|
||||||
|
double sum = rows.stream()
|
||||||
|
.mapToDouble(r -> {
|
||||||
|
try {
|
||||||
|
return Double.parseDouble(String.valueOf(r.getOrDefault(dynId, "0")));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
}).sum();
|
||||||
|
String dynLabel = fieldLabelMap.get(dynId);
|
||||||
|
result.put("TOTAL " + dynLabel, String.valueOf(sum));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
private void prepareTableFieldData(
|
||||||
|
List<ApplicationFormView> results,
|
||||||
|
Set<String> tableFieldIds,
|
||||||
|
Map<String, List<String>> tableHeadersByFieldId,
|
||||||
|
Map<Long, Map<String, String>> tableDataByApp) {
|
||||||
|
|
||||||
|
if (tableFieldIds.isEmpty()) return;
|
||||||
|
|
||||||
|
Map<Long, List<ApplicationFormView>> groupedByApp = results.stream()
|
||||||
|
.filter(r -> tableFieldIds.contains(r.getFieldId()))
|
||||||
|
.collect(Collectors.groupingBy(ApplicationFormView::getApplicationId));
|
||||||
|
|
||||||
|
for (Map.Entry<Long, List<ApplicationFormView>> entry : groupedByApp.entrySet()) {
|
||||||
|
Long appId = entry.getKey();
|
||||||
|
Map<String, String> flattenedAll = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
for (ApplicationFormView row : entry.getValue()) {
|
||||||
|
formRepository.findById(row.getFormId()).ifPresent(form -> {
|
||||||
|
List<ContentResponseBean> contentList = Utils.convertJsonStringToList(form.getContent(), ContentResponseBean.class);
|
||||||
|
ContentResponseBean content = contentList.stream()
|
||||||
|
.filter(c -> c.getId().equals(row.getFieldId()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
if (content == null) return;
|
||||||
|
|
||||||
|
content.getSettings().stream()
|
||||||
|
.filter(setting -> GepafinConstant.TABLE_COLUMNS.equals(setting.getName())
|
||||||
|
|| GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName()))
|
||||||
|
.findFirst()
|
||||||
|
.ifPresent(setting -> {
|
||||||
|
Map<String, String> flattened = extractTableData(
|
||||||
|
row.getFieldType(),
|
||||||
|
content,
|
||||||
|
row.getFieldValue()
|
||||||
|
);
|
||||||
|
if (flattened != null) {
|
||||||
|
tableHeadersByFieldId.putIfAbsent(row.getFieldId(), new ArrayList<>(flattened.keySet()));
|
||||||
|
flattenedAll.putAll(flattened);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
tableDataByApp.put(appId, flattenedAll);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1665,7 +1665,7 @@ public class ApplicationEvaluationDao {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLabelFromSettings(ContentResponseBean contentResponseBean) {
|
public String getLabelFromSettings(ContentResponseBean contentResponseBean) {
|
||||||
String label = contentResponseBean.getLabel();
|
String label = contentResponseBean.getLabel();
|
||||||
if (contentResponseBean.getSettings() != null) {
|
if (contentResponseBean.getSettings() != null) {
|
||||||
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
|
for (SettingResponseBean setting : contentResponseBean.getSettings()) {
|
||||||
|
|||||||
@@ -96,9 +96,6 @@ public class AppointmentDao {
|
|||||||
@Value("${aws.s3.bucket.name}")
|
@Value("${aws.s3.bucket.name}")
|
||||||
private String OLD_BUCKET;
|
private String OLD_BUCKET;
|
||||||
|
|
||||||
@Value("${flagDaFirmare}")
|
|
||||||
private Boolean flagDaFirmare;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HubRepository hubRepository;
|
private HubRepository hubRepository;
|
||||||
|
|
||||||
@@ -963,7 +960,7 @@ public class AppointmentDao {
|
|||||||
UploadDocToExternalSystemRequest.Input input = new UploadDocToExternalSystemRequest.Input();
|
UploadDocToExternalSystemRequest.Input input = new UploadDocToExternalSystemRequest.Input();
|
||||||
input.setIdTipoProtocollo(docToExternalSystemRequest.getInput().getIdTipoProtocollo());
|
input.setIdTipoProtocollo(docToExternalSystemRequest.getInput().getIdTipoProtocollo());
|
||||||
input.setIdClassificazione(docToExternalSystemRequest.getInput().getIdClassificazione());
|
input.setIdClassificazione(docToExternalSystemRequest.getInput().getIdClassificazione());
|
||||||
input.setFlagDaFirmare(flagDaFirmare);
|
input.setFlagDaFirmare(docToExternalSystemRequest.getInput().getFlagDaFirmare());
|
||||||
input.setDescrizione(docToExternalSystemRequest.getInput().getDescrizione());
|
input.setDescrizione(docToExternalSystemRequest.getInput().getDescrizione());
|
||||||
|
|
||||||
UploadDocToExternalSystemRequest.Input.Attributes attributes = new UploadDocToExternalSystemRequest.Input.Attributes();
|
UploadDocToExternalSystemRequest.Input.Attributes attributes = new UploadDocToExternalSystemRequest.Input.Attributes();
|
||||||
|
|||||||
@@ -14,12 +14,14 @@ import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
|||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationViewResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.SortBy;
|
import net.gepafin.tendermanagement.model.util.SortBy;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.AssignedApplicationsViewRepository;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
import net.gepafin.tendermanagement.service.CompanyService;
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
import net.gepafin.tendermanagement.service.UserService;
|
import net.gepafin.tendermanagement.service.UserService;
|
||||||
@@ -77,6 +79,9 @@ public class AssignedApplicationsDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AssignedApplicationsViewRepository assignedApplicationsViewRepository;
|
||||||
|
|
||||||
public AssignedApplicationsResponse createAssignedApplications(Long applicationId, Long userId, UserEntity assignedByUser, AssignedApplicationsRequest assignedApplicationsRequest) {
|
public AssignedApplicationsResponse createAssignedApplications(Long applicationId, Long userId, UserEntity assignedByUser, AssignedApplicationsRequest assignedApplicationsRequest) {
|
||||||
log.info("Assigning application to pre-Instructor with details: {}", applicationId, userId);
|
log.info("Assigning application to pre-Instructor with details: {}", applicationId, userId);
|
||||||
|
|
||||||
@@ -297,7 +302,7 @@ public class AssignedApplicationsDao {
|
|||||||
log.info("Assigned application fetched successfully: {}", response);
|
log.info("Assigned application fetched successfully: {}", response);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
public PageableResponseBean<List<AssignedApplicationsResponse>> getAllAssignedApplicationsByPagination(UserEntity user, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean,Long userId) {
|
public PageableResponseBean<List<AssignedApplicationViewResponse>> getAllAssignedApplicationsByPagination(UserEntity user, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean,Long userId) {
|
||||||
Integer pageNo = null;
|
Integer pageNo = null;
|
||||||
Integer pageLimit = null;
|
Integer pageLimit = null;
|
||||||
if (assignedApplicationPageableRequestBean.getGlobalFilters() != null) {
|
if (assignedApplicationPageableRequestBean.getGlobalFilters() != null) {
|
||||||
@@ -310,21 +315,15 @@ public class AssignedApplicationsDao {
|
|||||||
if (pageNo == null || pageNo <= 0) {
|
if (pageNo == null || pageNo <= 0) {
|
||||||
pageNo = GepafinConstant.DEFAULT_PAGE;
|
pageNo = GepafinConstant.DEFAULT_PAGE;
|
||||||
}
|
}
|
||||||
Specification<AssignedApplicationsEntity> spec = searchByPagination( assignedApplicationPageableRequestBean, user,userId);
|
Specification<AssignedApplicationsView> spec = searchByPagination( assignedApplicationPageableRequestBean, user,userId);
|
||||||
Page<AssignedApplicationsEntity> entityPage = assignedApplicationsRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
Page<AssignedApplicationsView> entityPage = assignedApplicationsViewRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||||
// Prepare the response
|
// Prepare the response
|
||||||
|
|
||||||
|
List<AssignedApplicationViewResponse> assignedApplicationsResponses = entityPage.getContent().stream()
|
||||||
List<AssignedApplicationsResponse> assignedApplicationsResponses = entityPage.getContent().stream()
|
.map(this::getAssignedApplicationResponseByView)
|
||||||
.map(application -> {
|
|
||||||
AssignedApplicationsResponse response = convertEntityToResponse(application);
|
|
||||||
return response;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
PageableResponseBean<List<AssignedApplicationViewResponse>> pageableResponseBean = new PageableResponseBean<>();
|
||||||
|
|
||||||
PageableResponseBean<List<AssignedApplicationsResponse>> pageableResponseBean = new PageableResponseBean<>();
|
|
||||||
pageableResponseBean.setBody(assignedApplicationsResponses);
|
pageableResponseBean.setBody(assignedApplicationsResponses);
|
||||||
pageableResponseBean.setCurrentPage(entityPage.getNumber() + 1);
|
pageableResponseBean.setCurrentPage(entityPage.getNumber() + 1);
|
||||||
pageableResponseBean.setTotalPages(entityPage.getTotalPages());
|
pageableResponseBean.setTotalPages(entityPage.getTotalPages());
|
||||||
@@ -334,7 +333,7 @@ public class AssignedApplicationsDao {
|
|||||||
return pageableResponseBean;
|
return pageableResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Specification<AssignedApplicationsEntity> searchByPagination(AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean, UserEntity userEntity,Long userId) {
|
public Specification<AssignedApplicationsView> searchByPagination(AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean, UserEntity userEntity,Long userId) {
|
||||||
return (root, query, criteriaBuilder) -> {
|
return (root, query, criteriaBuilder) -> {
|
||||||
|
|
||||||
List<Predicate> predicates = getPredicates(assignedApplicationPageableRequestBean, criteriaBuilder, root, userEntity,userId);
|
List<Predicate> predicates = getPredicates(assignedApplicationPageableRequestBean, criteriaBuilder, root, userEntity,userId);
|
||||||
@@ -350,30 +349,35 @@ public class AssignedApplicationsDao {
|
|||||||
sortBy.setSortDesc(assignedApplicationPageableRequestBean.getGlobalFilters().getSortBy().getSortDesc());
|
sortBy.setSortDesc(assignedApplicationPageableRequestBean.getGlobalFilters().getSortBy().getSortDesc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Path<?> sortPath;
|
// Path<?> sortPath;
|
||||||
Join<AssignedApplicationsEntity, ApplicationEntity> applicationJoin = root.join(GepafinConstant.APPLICATION, JoinType.LEFT);
|
// Join<AssignedApplicationsEntity, ApplicationEntity> applicationJoin = root.join(GepafinConstant.APPLICATION, JoinType.LEFT);
|
||||||
|
//
|
||||||
|
// if (GepafinConstant.APPLICATION_ID.equals(sortBy.getColumnName())) {
|
||||||
|
// sortPath = root.join(GepafinConstant.APPLICATION, JoinType.LEFT).get(GepafinConstant.ID); // Join ApplicationEntity and sort by application.id
|
||||||
|
// }
|
||||||
|
// else if (GepafinConstant.PROTOCOL_NUMBER.equals(sortBy.getColumnName())) {
|
||||||
|
// Join<ApplicationEntity, ProtocolEntity> protocolJoin = applicationJoin.join(GepafinConstant.PROTOCOL, JoinType.LEFT);
|
||||||
|
// sortPath = protocolJoin.get(GepafinConstant.PROTOCOL_NUMBER);
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// sortPath = root.get(sortBy.getColumnName()); // Sorting by a field in AmendmentEntity
|
||||||
|
// }
|
||||||
|
// query.orderBy(criteriaBuilder.desc(sortPath));
|
||||||
|
// if (Boolean.FALSE.equals(sortBy.getSortDesc())) {
|
||||||
|
// query.orderBy(criteriaBuilder.asc(sortPath));
|
||||||
|
// }
|
||||||
|
// return query.where(criteriaBuilder.and(predicates.toArray(new Predicate[0]))).getRestriction();
|
||||||
|
|
||||||
|
Path<?> sortPath = root.get(sortBy.getColumnName()); // All fields are accessible directly in the view
|
||||||
|
query.orderBy(sortBy.getSortDesc() ? criteriaBuilder.desc(sortPath) : criteriaBuilder.asc(sortPath));
|
||||||
|
|
||||||
if (GepafinConstant.APPLICATION_ID.equals(sortBy.getColumnName())) {
|
|
||||||
sortPath = root.join(GepafinConstant.APPLICATION, JoinType.LEFT).get(GepafinConstant.ID); // Join ApplicationEntity and sort by application.id
|
|
||||||
}
|
|
||||||
else if (GepafinConstant.PROTOCOL_NUMBER.equals(sortBy.getColumnName())) {
|
|
||||||
Join<ApplicationEntity, ProtocolEntity> protocolJoin = applicationJoin.join(GepafinConstant.PROTOCOL, JoinType.LEFT);
|
|
||||||
sortPath = protocolJoin.get(GepafinConstant.PROTOCOL_NUMBER);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sortPath = root.get(sortBy.getColumnName()); // Sorting by a field in AmendmentEntity
|
|
||||||
}
|
|
||||||
query.orderBy(criteriaBuilder.desc(sortPath));
|
|
||||||
if (Boolean.FALSE.equals(sortBy.getSortDesc())) {
|
|
||||||
query.orderBy(criteriaBuilder.asc(sortPath));
|
|
||||||
}
|
|
||||||
return query.where(criteriaBuilder.and(predicates.toArray(new Predicate[0]))).getRestriction();
|
return query.where(criteriaBuilder.and(predicates.toArray(new Predicate[0]))).getRestriction();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<Predicate> getPredicates(AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean,
|
private List<Predicate> getPredicates(AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean,
|
||||||
CriteriaBuilder criteriaBuilder, Root<AssignedApplicationsEntity> root, UserEntity userEntity,Long userId) {
|
CriteriaBuilder criteriaBuilder, Root<AssignedApplicationsView> root, UserEntity userEntity,Long userId) {
|
||||||
|
|
||||||
Integer year = null;
|
Integer year = null;
|
||||||
String search = null;
|
String search = null;
|
||||||
@@ -404,12 +408,35 @@ public class AssignedApplicationsDao {
|
|||||||
|
|
||||||
}
|
}
|
||||||
// Search in `title` and `message` (if search term is provided)
|
// Search in `title` and `message` (if search term is provided)
|
||||||
if (search != null && !search.isEmpty()) {
|
// if (search != null && !search.isEmpty()) {
|
||||||
Predicate titlePredicate = criteriaBuilder.like(
|
// Predicate titlePredicate = criteriaBuilder.like(
|
||||||
criteriaBuilder.upper(root.get(GepafinConstant.NOTE)),
|
// criteriaBuilder.upper(root.get(GepafinConstant.NOTE)),
|
||||||
"%" + search.toUpperCase() + "%"
|
// "%" + search.toUpperCase() + "%"
|
||||||
);
|
// );
|
||||||
predicates.add(criteriaBuilder.or(titlePredicate));
|
// predicates.add(criteriaBuilder.or(titlePredicate));
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (search != null && !search.trim().isEmpty()) {
|
||||||
|
String pattern = "%" + search.toUpperCase() + "%";
|
||||||
|
List<Predicate> searchPredicates = new ArrayList<>();
|
||||||
|
|
||||||
|
searchPredicates.add(criteriaBuilder.like(criteriaBuilder.upper(root.get(GepafinConstant.CALL_NAME)), pattern));
|
||||||
|
searchPredicates.add(criteriaBuilder.like(criteriaBuilder.upper(root.get(GepafinConstant.COMPANY_NAME)), pattern));
|
||||||
|
searchPredicates.add(criteriaBuilder.like(criteriaBuilder.upper(root.get(GepafinConstant.STATUS)), pattern));
|
||||||
|
searchPredicates.add(criteriaBuilder.like(criteriaBuilder.upper(root.get(GepafinConstant.NDG_STRING)), pattern));
|
||||||
|
searchPredicates.add(criteriaBuilder.like(criteriaBuilder.upper(root.get(GepafinConstant.APPOINTMENT_ID)), pattern));
|
||||||
|
searchPredicates.add(criteriaBuilder.like(criteriaBuilder.upper(root.get(GepafinConstant.APPLICATION_STATUS)), pattern));
|
||||||
|
|
||||||
|
// Convert numeric fields to string for search (optional and DB-specific; otherwise exact match)
|
||||||
|
try {
|
||||||
|
Long searchLong = Long.parseLong(search);
|
||||||
|
searchPredicates.add(criteriaBuilder.equal(root.get(GepafinConstant.APPLICATION_ID), searchLong));
|
||||||
|
searchPredicates.add(criteriaBuilder.equal(root.get(GepafinConstant.PROTOCOL_NUMBER), searchLong));
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
// Ignore if search is not a number
|
||||||
|
}
|
||||||
|
|
||||||
|
predicates.add(criteriaBuilder.or(searchPredicates.toArray(new Predicate[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by `status` (if status list is provided)
|
// Filter by `status` (if status list is provided)
|
||||||
@@ -421,12 +448,31 @@ public class AssignedApplicationsDao {
|
|||||||
}
|
}
|
||||||
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
||||||
|
|
||||||
applyFilters(root, criteriaBuilder, predicates, filters);
|
Utils.applyFiltersByPagination(root, criteriaBuilder, predicates, filters);
|
||||||
|
|
||||||
|
|
||||||
return predicates;
|
return predicates;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AssignedApplicationViewResponse getAssignedApplicationResponseByView(AssignedApplicationsView view) {
|
||||||
|
AssignedApplicationViewResponse response = new AssignedApplicationViewResponse();
|
||||||
|
response.setId(view.getId());
|
||||||
|
response.setUserId(view.getUserId());
|
||||||
|
response.setStatus(AssignedApplicationEnum.valueOf(view.getStatus()));
|
||||||
|
response.setApplicationId(view.getApplicationId());
|
||||||
|
response.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(view.getApplicationStatus()));
|
||||||
|
response.setSubmissionDate(view.getSubmissionDate());
|
||||||
|
response.setEvaluationEndDate(view.getEvaluationEndDate());
|
||||||
|
response.setNdg(view.getNdg());
|
||||||
|
response.setAppointmentId(view.getAppointmentId());
|
||||||
|
response.setProtocolNumber(view.getProtocolNumber());
|
||||||
|
response.setCallName(view.getCallName());
|
||||||
|
response.setCompanyName(view.getCompanyName());
|
||||||
|
response.setCreatedDate(view.getCreatedDate());
|
||||||
|
response.setUpdatedDate(view.getUpdatedDate());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
public AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status) {
|
public AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status) {
|
||||||
|
|
||||||
AssignedApplicationsEntity assignedApplication = validateAssignedApplication(assignedApplicationId);
|
AssignedApplicationsEntity assignedApplication = validateAssignedApplication(assignedApplicationId);
|
||||||
|
|||||||
@@ -124,6 +124,9 @@ public class CallDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EvaluationFormDao evalualtionFormDao;
|
private EvaluationFormDao evalualtionFormDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationRepository applicationRepository;
|
||||||
|
|
||||||
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, UserEntity userEntity) {
|
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, UserEntity userEntity) {
|
||||||
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
||||||
CallEntity callEntity = convertToCallEntity(createCallRequest, userEntity);
|
CallEntity callEntity = convertToCallEntity(createCallRequest, userEntity);
|
||||||
@@ -598,8 +601,8 @@ public class CallDao {
|
|||||||
if (!requestEndDate.equals(storedEndDate)) { // Check if dates are different
|
if (!requestEndDate.equals(storedEndDate)) { // Check if dates are different
|
||||||
|
|
||||||
setIfUpdated(callEntity::getEndDate, callEntity::setEndDate, dates.get(1));
|
setIfUpdated(callEntity::getEndDate, callEntity::setEndDate, dates.get(1));
|
||||||
callEntity.setStatus(CallStatusEnum.PUBLISH.getValue());
|
// callEntity.setStatus(CallStatusEnum.PUBLISH.getValue());
|
||||||
callRepository.save(callEntity);
|
// callRepository.save(callEntity);
|
||||||
isEndDateUpdated = true;
|
isEndDateUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -611,13 +614,13 @@ public class CallDao {
|
|||||||
|
|
||||||
if (!requestEndTime.equals(storedEndTime)) {
|
if (!requestEndTime.equals(storedEndTime)) {
|
||||||
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
|
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
|
||||||
callEntity.setStatus(CallStatusEnum.PUBLISH.getValue());
|
// callEntity.setStatus(CallStatusEnum.PUBLISH.getValue());
|
||||||
callRepository.save(callEntity);
|
// callRepository.save(callEntity);
|
||||||
isEndTimeUpdated = true;
|
isEndTimeUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isEndDateUpdated || isEndTimeUpdated) {
|
if (isEndDateUpdated || isEndTimeUpdated) {
|
||||||
|
callRepository.save(callEntity);
|
||||||
loggingUtil.logUserAction(UserActionRequest.builder()
|
loggingUtil.logUserAction(UserActionRequest.builder()
|
||||||
.request(request)
|
.request(request)
|
||||||
.actionType(UserActionLogsEnum.UPDATE)
|
.actionType(UserActionLogsEnum.UPDATE)
|
||||||
@@ -796,6 +799,7 @@ public class CallDao {
|
|||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.COMPANY_ID_REQUIRED_FOR_PREFERRED_CALL));
|
Translator.toLocale(GepafinConstant.COMPANY_ID_REQUIRED_FOR_PREFERRED_CALL));
|
||||||
}
|
}
|
||||||
|
expirePublishedCalls(request);
|
||||||
Specification<CallEntity> spec = buildCallSpecification(request, user, companyId, onlyPreferredCall, onlyConfidiCall, callStatusList);
|
Specification<CallEntity> spec = buildCallSpecification(request, user, companyId, onlyPreferredCall, onlyConfidiCall, callStatusList);
|
||||||
|
|
||||||
List<CallEntity> calls = callRepository.findAll(spec);
|
List<CallEntity> calls = callRepository.findAll(spec);
|
||||||
@@ -901,7 +905,7 @@ public class CallDao {
|
|||||||
public CallResponse updateCallStatus(CallEntity callEntity, CallStatusEnum statusReq) {
|
public CallResponse updateCallStatus(CallEntity callEntity, CallStatusEnum statusReq) {
|
||||||
CallEntity oldCallEntity = Utils.getClonedEntityForData(callEntity);
|
CallEntity oldCallEntity = Utils.getClonedEntityForData(callEntity);
|
||||||
CallStatusEnum currentStatus = CallStatusEnum.valueOf(callEntity.getStatus());
|
CallStatusEnum currentStatus = CallStatusEnum.valueOf(callEntity.getStatus());
|
||||||
validateStatusChange(currentStatus, statusReq);
|
validateStatusChange(currentStatus, statusReq, callEntity.getId());
|
||||||
callEntity.setStatus(statusReq.getValue());
|
callEntity.setStatus(statusReq.getValue());
|
||||||
callEntity = callRepository.save(callEntity);
|
callEntity = callRepository.save(callEntity);
|
||||||
|
|
||||||
@@ -921,36 +925,37 @@ public class CallDao {
|
|||||||
return convertToCallResponseBean(callEntity);
|
return convertToCallResponseBean(callEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateStatusChange(CallStatusEnum currentStatus, CallStatusEnum newStatus) {
|
private void validateStatusChange(CallStatusEnum currentStatus, CallStatusEnum newStatus, Long callId) {
|
||||||
if (currentStatus == newStatus) {
|
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
|
||||||
Translator.toLocale(GepafinConstant.STATUS_SAME_ERROR));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (currentStatus == newStatus) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.STATUS_SAME_ERROR));
|
||||||
|
}
|
||||||
switch (currentStatus) {
|
switch (currentStatus) {
|
||||||
case DRAFT:
|
case DRAFT:
|
||||||
if (newStatus == CallStatusEnum.READY_TO_PUBLISH || newStatus == CallStatusEnum.PUBLISH) {
|
if (newStatus == CallStatusEnum.READY_TO_PUBLISH || newStatus == CallStatusEnum.PUBLISH) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_STATUS_CHANGE_FROM_DRAFT));
|
||||||
Translator.toLocale(GepafinConstant.INVALID_STATUS_CHANGE_FROM_DRAFT));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PUBLISH:
|
case PUBLISH:
|
||||||
if (newStatus == CallStatusEnum.READY_TO_PUBLISH || newStatus == CallStatusEnum.DRAFT) {
|
if (newStatus == CallStatusEnum.READY_TO_PUBLISH) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_STATUS_CHANGE_FROM_PUBLISH));
|
||||||
Translator.toLocale(GepafinConstant.INVALID_STATUS_CHANGE_FROM_PUBLISH));
|
}
|
||||||
|
if (newStatus == CallStatusEnum.DRAFT && Boolean.TRUE.equals(applicationRepository.existsByCallId(callId))) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_STATUS_CHANGE_FROM_PUBLISH_TO_DRAFT));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPIRED:
|
case EXPIRED:
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.STATUS_CANNOT_BE_CHANGED));
|
||||||
Translator.toLocale(GepafinConstant.STATUS_CANNOT_BE_CHANGED));
|
|
||||||
case READY_TO_PUBLISH:
|
case READY_TO_PUBLISH:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public CallEntity validatePublishedCall(Long callId, Long hubId) {
|
public CallEntity validatePublishedCall(Long callId, Long hubId) {
|
||||||
CallEntity callEntity= callRepository
|
CallEntity callEntity= callRepository
|
||||||
.findByIdAndStatusAndHubId(callId, CallStatusEnum.PUBLISH.getValue(), hubId);
|
.findByIdAndStatusAndHubId(callId, CallStatusEnum.PUBLISH.getValue(), hubId);
|
||||||
@@ -959,7 +964,7 @@ public class CallDao {
|
|||||||
Status.NOT_FOUND,
|
Status.NOT_FOUND,
|
||||||
Translator.toLocale(GepafinConstant.CALL_NOT_PUBLISHED));
|
Translator.toLocale(GepafinConstant.CALL_NOT_PUBLISHED));
|
||||||
}
|
}
|
||||||
LocalDate currentDate = DateTimeUtil.LocalDateServerToEurope(LocalDate.now());
|
LocalDate currentDate = DateTimeUtil.DateServerToUTC(LocalDateTime.now()).toLocalDate();
|
||||||
LocalTime currentTime = DateTimeUtil.LocalTimeServerToEurope(LocalTime.now());
|
LocalTime currentTime = DateTimeUtil.LocalTimeServerToEurope(LocalTime.now());
|
||||||
|
|
||||||
if (currentDate.isBefore(callEntity.getStartDate().toLocalDate()) ||
|
if (currentDate.isBefore(callEntity.getStartDate().toLocalDate()) ||
|
||||||
@@ -1000,6 +1005,7 @@ public class CallDao {
|
|||||||
Translator.toLocale(GepafinConstant.COMPANY_ID_REQUIRED_FOR_PREFERRED_CALL)
|
Translator.toLocale(GepafinConstant.COMPANY_ID_REQUIRED_FOR_PREFERRED_CALL)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
expirePublishedCalls(request);
|
||||||
Specification<CallEntity> spec = search(request,user, callPageableRequestBean);
|
Specification<CallEntity> spec = search(request,user, callPageableRequestBean);
|
||||||
Page<CallEntity> entityPage;
|
Page<CallEntity> entityPage;
|
||||||
if (Boolean.TRUE.equals(onlyPreferredCall)) {
|
if (Boolean.TRUE.equals(onlyPreferredCall)) {
|
||||||
@@ -1078,7 +1084,6 @@ public class CallDao {
|
|||||||
|
|
||||||
private List<Predicate> getPredicates(HttpServletRequest request,CallPageableRequestBean callPageableRequestBean,
|
private List<Predicate> getPredicates(HttpServletRequest request,CallPageableRequestBean callPageableRequestBean,
|
||||||
CriteriaBuilder criteriaBuilder, Root<CallEntity> root, UserEntity userEntity) {
|
CriteriaBuilder criteriaBuilder, Root<CallEntity> root, UserEntity userEntity) {
|
||||||
expirePublishedCalls(request);
|
|
||||||
Integer year = null;
|
Integer year = null;
|
||||||
String search = null;
|
String search = null;
|
||||||
Map<String, FilterCriteria> filters = new HashMap<>();
|
Map<String, FilterCriteria> filters = new HashMap<>();
|
||||||
@@ -1162,41 +1167,23 @@ public class CallDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void expirePublishedCalls(HttpServletRequest request) {
|
public void expirePublishedCalls(HttpServletRequest request) {
|
||||||
List<CallEntity> expiredCalls = callRepository.findAll((root, query, criteriaBuilder) -> {
|
|
||||||
Predicate isPublished = criteriaBuilder.equal(root.get(GepafinConstant.STATUS), CallStatusEnum.PUBLISH.name());
|
|
||||||
|
|
||||||
// Concatenate date and time as a single string
|
|
||||||
Expression<String> dateTimeString = criteriaBuilder.concat(
|
|
||||||
root.get(GepafinConstant.END_DATE),
|
|
||||||
criteriaBuilder.literal(" ") // Space between date and time
|
|
||||||
);
|
|
||||||
Expression<String> fullDateTimeString = criteriaBuilder.concat(dateTimeString, root.get(GepafinConstant.END_TIME));
|
|
||||||
|
|
||||||
// Convert the concatenated string into TIMESTAMP
|
LocalDate currentDate = DateTimeUtil.DateServerToUTC(LocalDateTime.now()).toLocalDate();
|
||||||
Expression<LocalDateTime> endDateTime = criteriaBuilder.function(
|
LocalTime currentTime = DateTimeUtil.LocalTimeServerToEurope(LocalTime.now());
|
||||||
"to_timestamp",
|
|
||||||
LocalDateTime.class,
|
|
||||||
fullDateTimeString,
|
|
||||||
criteriaBuilder.literal("YYYY-MM-DD HH24:MI:SS")
|
|
||||||
);
|
|
||||||
|
|
||||||
Predicate isExpired = criteriaBuilder.lessThan(endDateTime, LocalDateTime.now());
|
List<CallEntity> expirdedCallList = callRepository.findExpiredCallsWhichIsPublished(CallStatusEnum.PUBLISH.getValue(), currentDate, currentTime);
|
||||||
|
|
||||||
return criteriaBuilder.and(isPublished, isExpired);
|
if (!expirdedCallList.isEmpty()) {
|
||||||
});
|
|
||||||
|
|
||||||
if (!expiredCalls.isEmpty()) {
|
|
||||||
for (CallEntity call : expiredCalls) {
|
|
||||||
CallEntity oldCallEntity = Utils.getClonedEntityForData(call); // Clone before modification
|
|
||||||
call.setStatus(CallStatusEnum.EXPIRED.getValue());
|
|
||||||
|
|
||||||
if (!oldCallEntity.getStatus().equals(call.getStatus())) {
|
|
||||||
// Log user action
|
|
||||||
loggingUtil.logUserAction(UserActionRequest.builder()
|
loggingUtil.logUserAction(UserActionRequest.builder()
|
||||||
.request(request)
|
.request(request)
|
||||||
.actionType(UserActionLogsEnum.UPDATE)
|
.actionType(UserActionLogsEnum.UPDATE)
|
||||||
.actionContext(UserActionContextEnum.UPDATE_EXPIRED_CALL)
|
.actionContext(UserActionContextEnum.UPDATE_EXPIRED_CALL)
|
||||||
.build());
|
.build());
|
||||||
|
for (CallEntity call : expirdedCallList) {
|
||||||
|
CallEntity oldCallEntity = Utils.getClonedEntityForData(call); // Clone before modification
|
||||||
|
call.setStatus(CallStatusEnum.EXPIRED.getValue());
|
||||||
|
|
||||||
// Add version history log
|
// Add version history log
|
||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder()
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder()
|
||||||
@@ -1206,8 +1193,7 @@ public class CallDao {
|
|||||||
.newData(call)
|
.newData(call)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
}
|
callRepository.saveAll(expirdedCallList); // Save all modified calls at once
|
||||||
callRepository.saveAll(expiredCalls); // Save all modified calls at once
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void applyFilters(Root<?> root, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Map<String, FilterCriteria> filters) {
|
private void applyFilters(Root<?> root, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Map<String, FilterCriteria> filters) {
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import org.springframework.data.domain.Pageable; // Correct package
|
import org.springframework.data.domain.Pageable; // Correct package
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -20,7 +18,6 @@ import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
|||||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.FaqRepository;
|
import net.gepafin.tendermanagement.repositories.FaqRepository;
|
||||||
import net.gepafin.tendermanagement.service.feignClient.VatCheckService;
|
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.*;
|
import net.gepafin.tendermanagement.web.rest.api.errors.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -37,7 +34,6 @@ import net.gepafin.tendermanagement.model.response.CompanyResponse;
|
|||||||
import net.gepafin.tendermanagement.service.UserService;
|
import net.gepafin.tendermanagement.service.UserService;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
|
|
||||||
import static net.gepafin.tendermanagement.util.Utils.convertObjectToJsonString;
|
|
||||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@@ -73,10 +69,6 @@ public class CompanyDao {
|
|||||||
private HttpServletRequest request;
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private VatCheckService vatCheckService; // Service to call VAT API
|
|
||||||
|
|
||||||
|
|
||||||
private static final String NOT_FOUND_JSON = "{\"data\": \"not found\"}";
|
private static final String NOT_FOUND_JSON = "{\"data\": \"not found\"}";
|
||||||
|
|
||||||
public CompanyResponse createCompany(UserEntity userEntity, CompanyRequest companyRequest) {
|
public CompanyResponse createCompany(UserEntity userEntity, CompanyRequest companyRequest) {
|
||||||
@@ -146,8 +138,6 @@ public class CompanyDao {
|
|||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(userWithCompany).build());
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(userWithCompany).build());
|
||||||
if (StringUtils.isEmpty(companyEntity.getJson())) {
|
if (StringUtils.isEmpty(companyEntity.getJson())) {
|
||||||
companyEntity.setJson(Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()));
|
companyEntity.setJson(Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()));
|
||||||
Map<String, Object> vatCheckResponse = companyRequest.getVatCheckResponse();
|
|
||||||
Map<String, Object> data = (Map<String, Object>) vatCheckResponse.get("data");
|
|
||||||
updateCodiceAtecoFieldWithNewJson(companyEntity);
|
updateCodiceAtecoFieldWithNewJson(companyEntity);
|
||||||
companyEntity = companyRepository.save(companyEntity);
|
companyEntity = companyRepository.save(companyEntity);
|
||||||
|
|
||||||
@@ -437,7 +427,6 @@ public class CompanyDao {
|
|||||||
log.info("Company ID {}: JSON field updated successfully.", company.getId());
|
log.info("Company ID {}: JSON field updated successfully.", company.getId());
|
||||||
|
|
||||||
// Extract and set codiceAteco field
|
// Extract and set codiceAteco field
|
||||||
// updateCodiceAtecoField(company);
|
|
||||||
updateCodiceAtecoFieldWithNewJson(company);
|
updateCodiceAtecoFieldWithNewJson(company);
|
||||||
|
|
||||||
successfulUpdates++;
|
successfulUpdates++;
|
||||||
@@ -472,50 +461,38 @@ public class CompanyDao {
|
|||||||
private void updateCodiceAtecoField(CompanyEntity company) {
|
private void updateCodiceAtecoField(CompanyEntity company) {
|
||||||
Map<String, Object> vatCheckResponse = Utils.convertJsonStringToMap(company.getJson());
|
Map<String, Object> vatCheckResponse = Utils.convertJsonStringToMap(company.getJson());
|
||||||
|
|
||||||
if (vatCheckResponse != null && vatCheckResponse.containsKey("data")) {
|
if (vatCheckResponse == null) {
|
||||||
|
log.warn("Company ID {}: Invalid JSON response.", company.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Object dataObj = vatCheckResponse.get("data");
|
Object dataObj = vatCheckResponse.get("data");
|
||||||
|
if (!(dataObj instanceof Map<?, ?> dataMap)) {
|
||||||
|
log.warn("Company ID {}: 'data' is missing or not a valid object.", company.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (dataObj instanceof Map) {
|
if (!dataMap.containsKey("dettaglio")) {
|
||||||
Map<String, Object> dataMap = (Map<String, Object>) dataObj;
|
log.warn("Company ID {}: 'dettaglio' not present inside 'data'. Skipping codiceAteco update.", company.getId());
|
||||||
log.info("Company ID {}: Available keys inside 'data' -> {}", company.getId(), dataMap.keySet());
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (dataMap.containsKey("dettaglio")) {
|
|
||||||
Object dettaglioObj = dataMap.get("dettaglio");
|
Object dettaglioObj = dataMap.get("dettaglio");
|
||||||
|
if (!(dettaglioObj instanceof Map<?, ?> dettaglio)) {
|
||||||
|
log.warn("Company ID {}: 'dettaglio' is not a valid object.", company.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (dettaglioObj instanceof Map) {
|
|
||||||
Map<String, Object> dettaglio = (Map<String, Object>) dettaglioObj;
|
|
||||||
|
|
||||||
if (dettaglio.containsKey("codice_ateco")) {
|
|
||||||
Object codiceAtecoObj = dettaglio.get("codice_ateco");
|
Object codiceAtecoObj = dettaglio.get("codice_ateco");
|
||||||
|
if (!(codiceAtecoObj instanceof String codiceAteco) || codiceAteco.isEmpty()) {
|
||||||
|
log.warn("Company ID {}: 'codice_ateco' is missing, empty, or not a string.", company.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (codiceAtecoObj instanceof String) {
|
|
||||||
String codiceAteco = (String) codiceAtecoObj;
|
|
||||||
|
|
||||||
if (codiceAteco != null && !codiceAteco.isEmpty()) {
|
|
||||||
company.setCodiceAteco(codiceAteco);
|
company.setCodiceAteco(codiceAteco);
|
||||||
log.info("Company ID {}: codiceAteco updated to {}", company.getId(), codiceAteco);
|
logCodiceAtecoUpdate(company, codiceAteco);
|
||||||
} else {
|
|
||||||
log.warn("Company ID {}: codiceAteco is null or empty in the response.", company.getId());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.warn("Company ID {}: 'codice_ateco' is not a string, actual type: {}", company.getId(), codiceAtecoObj.getClass());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.warn("Company ID {}: 'dettaglio' does not contain 'codice_ateco' key.", company.getId());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.warn("Company ID {}: 'dettaglio' is not a Map, actual type: {}", company.getId(), dettaglioObj.getClass());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.warn("Company ID {}: 'dettaglio' section is missing inside 'data'!", company.getId());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.warn("Company ID {}: 'data' is not a Map, actual type: {}", company.getId(), dataObj.getClass());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.warn("Company ID {}: 'data' section missing in the JSON response.", company.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCodiceAtecoFieldWithNewJson(CompanyEntity company) {
|
private void updateCodiceAtecoFieldWithNewJson(CompanyEntity company) {
|
||||||
if (company == null || company.getJson() == null || company.getJson().isEmpty()) {
|
if (company == null || company.getJson() == null || company.getJson().isEmpty()) {
|
||||||
log.warn("Company is null or JSON data is empty.");
|
log.warn("Company is null or JSON data is empty.");
|
||||||
@@ -530,11 +507,16 @@ public class CompanyDao {
|
|||||||
|
|
||||||
// Extract 'data' section
|
// Extract 'data' section
|
||||||
Map<String, Object> dataMap = Utils.extractMap(companyDataMap, "data");
|
Map<String, Object> dataMap = Utils.extractMap(companyDataMap, "data");
|
||||||
|
Object dataObj = companyDataMap.get("data");
|
||||||
|
|
||||||
if (dataMap == null) {
|
if (dataMap == null) {
|
||||||
log.warn("Company ID {}: 'data' section is missing or invalid in the JSON.", company.getId());
|
log.warn("Company ID {}: 'data' section is missing or invalid in the JSON.", company.getId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (dataObj instanceof Map<?, ?>) {
|
||||||
|
// if data is a single object
|
||||||
|
updateCodiceAtecoField(company);
|
||||||
|
} else {
|
||||||
// Extract 'atecoClassification' section
|
// Extract 'atecoClassification' section
|
||||||
Map<String, Object> atecoClassificationMap = Utils.extractMap(dataMap, "atecoClassification");
|
Map<String, Object> atecoClassificationMap = Utils.extractMap(dataMap, "atecoClassification");
|
||||||
if (atecoClassificationMap == null) {
|
if (atecoClassificationMap == null) {
|
||||||
@@ -553,9 +535,15 @@ public class CompanyDao {
|
|||||||
String atecoCode = Utils.extractString(atecoMap, "code");
|
String atecoCode = Utils.extractString(atecoMap, "code");
|
||||||
if (atecoCode != null && !atecoCode.isEmpty()) {
|
if (atecoCode != null && !atecoCode.isEmpty()) {
|
||||||
company.setCodiceAteco(atecoCode);
|
company.setCodiceAteco(atecoCode);
|
||||||
log.info("Company ID {}: codiceAteco updated to {}", company.getId(), atecoCode);
|
logCodiceAtecoUpdate(company, atecoCode);
|
||||||
} else {
|
} else {
|
||||||
log.warn("Company ID {}: 'code' inside 'ateco' is empty or missing.", company.getId());
|
log.warn("Company ID {}: 'code' inside 'ateco' is empty or missing.", company.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void logCodiceAtecoUpdate(CompanyEntity company, String atecoCode) {
|
||||||
|
|
||||||
|
log.info("Company ID {}: codiceAteco updated to {}", company.getId(), atecoCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -209,7 +209,6 @@ public class DelegationDao {
|
|||||||
|
|
||||||
companyDao.validateCompany(companyId);
|
companyDao.validateCompany(companyId);
|
||||||
companyDao.getUserWithCompany(userEntity.getId(), companyId);
|
companyDao.getUserWithCompany(userEntity.getId(), companyId);
|
||||||
validateFileType(file);
|
|
||||||
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userEntity.getId(),companyId);
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userEntity.getId(),companyId);
|
||||||
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository
|
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository
|
||||||
.findByUserIdAndUserWithCompanyIdAndStatus(userEntity.getId(), userWithCompanyEntity.getId(),
|
.findByUserIdAndUserWithCompanyIdAndStatus(userEntity.getId(), userWithCompanyEntity.getId(),
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ public class FormDao {
|
|||||||
// Map<String, Object> customData=null;
|
// Map<String, Object> customData=null;
|
||||||
try {
|
try {
|
||||||
// Map<String, Object> vatCheckResponse = vatCheckDao.checkVatNumberApi(value);
|
// Map<String, Object> vatCheckResponse = vatCheckDao.checkVatNumberApi(value);
|
||||||
vatCheckDao.checkVatNumberApi(value);
|
vatCheckDao.checkVatNumber(value);
|
||||||
// if (Boolean.FALSE.equals(CollectionUtils.isEmpty(vatCheckResponse))) {
|
// if (Boolean.FALSE.equals(CollectionUtils.isEmpty(vatCheckResponse))) {
|
||||||
// customData = vatCheckResponse;
|
// customData = vatCheckResponse;
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
import feign.FeignException;
|
import feign.FeignException;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
import net.gepafin.tendermanagement.enums.VatCheckVersionTypeEnum;
|
||||||
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
|
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
|
||||||
import net.gepafin.tendermanagement.service.feignClient.VatCheckService;
|
import net.gepafin.tendermanagement.repositories.GlobalConfigRepository;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.service.feignClient.VatCheckV1Service;
|
||||||
|
import net.gepafin.tendermanagement.service.feignClient.VatCheckV2Service;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -20,8 +21,8 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -30,104 +31,103 @@ import java.util.Map;
|
|||||||
public class VatCheckDao {
|
public class VatCheckDao {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private VatCheckService vatCheckService;
|
private VatCheckV2Service vatCheckV2Service;
|
||||||
|
|
||||||
@Value("${vatCheckNewToken}")
|
@Autowired
|
||||||
public String vatCheckNewToken;
|
private VatCheckV1Service vatCheckV1Service;
|
||||||
|
|
||||||
|
@Value("${vatCheckTokenV2}")
|
||||||
|
public String vatCheckTokenV2;
|
||||||
|
|
||||||
|
@Value("${vatCheckTokenV1}")
|
||||||
|
public String vatCheckTokenV1;
|
||||||
|
|
||||||
@Value("${isVatCheckGloballyDisabled}")
|
@Value("${isVatCheckGloballyDisabled}")
|
||||||
public String isVatCheckGloballyDisabled;
|
public String isVatCheckGloballyDisabled;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GlobalConfigRepository globalConfigRepository;
|
||||||
|
|
||||||
public final Logger log = LoggerFactory.getLogger(VatCheckDao.class);
|
public final Logger log = LoggerFactory.getLogger(VatCheckDao.class);
|
||||||
|
|
||||||
@Autowired
|
public VatCheckResponseBean checkVatNumberV1(String vatNumber) {
|
||||||
private LoggingUtil loggingUtil;
|
VatCheckResponseBean vatCheckResponseBean = new VatCheckResponseBean();
|
||||||
|
vatCheckResponseBean.setValid(false);
|
||||||
|
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
||||||
|
if (Boolean.TRUE.equals(Boolean.parseBoolean(isVatCheckGloballyDisabled))) {
|
||||||
|
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
||||||
|
return vatCheckResponseBean;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.set(GepafinConstant.AUTHORIZATION, "Bearer " + vatCheckTokenV1);
|
||||||
|
headers.add(org.apache.http.HttpHeaders.USER_AGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0");
|
||||||
|
|
||||||
@Autowired
|
URI baseUrl = URI.create(GepafinConstant.CHECK_VATNUMBER_URL_V1);
|
||||||
private HttpServletRequest request;
|
ResponseEntity<Map<String, Object>> response = vatCheckV1Service.checkVatNumber(baseUrl, vatNumber, headers);
|
||||||
|
|
||||||
// public VatCheckResponseBean checkVatNumberApi(String vatNumber) {
|
if (response.getStatusCode() == HttpStatus.OK && response.hasBody()) {
|
||||||
// VatCheckResponseBean vatCheckResponseBean = new VatCheckResponseBean();
|
logSuccess();
|
||||||
// vatCheckResponseBean.setValid(false);
|
Map<String, Object> responseMap = response.getBody();
|
||||||
// vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
if (responseMap != null) {
|
||||||
// if (Boolean.TRUE.equals(Boolean.parseBoolean(isVatCheckGloballyDisabled))) {
|
processValidResponseV1(responseMap, vatCheckResponseBean);
|
||||||
// vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
} else {
|
||||||
// return vatCheckResponseBean;
|
log.warn("Response map or vatCheckResponseBean is null.");
|
||||||
// }
|
}
|
||||||
// Map<String, Object> responseBody = new HashMap<>();
|
}
|
||||||
// try {
|
|
||||||
// HttpHeaders headers = new HttpHeaders();
|
} catch (FeignException ex) {
|
||||||
// headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
if (ex.status() == 406) {
|
||||||
// headers.setContentType(MediaType.APPLICATION_JSON);
|
try {
|
||||||
// headers.set(GepafinConstant.AUTHORIZATION, "Bearer " + vatCheckNewToken);
|
Map<String, Object> errorResponse = Utils.parseErrorResponse(ex.contentUTF8());
|
||||||
// headers.add(org.apache.http.HttpHeaders.USER_AGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0");
|
processValidResponseV1(errorResponse, vatCheckResponseBean);
|
||||||
//
|
} catch (Exception parseEx) {
|
||||||
// URI baseUrl = URI.create(GepafinConstant.CHECK_VATNUMBER_V2_NEW_URL);
|
log.error("Failed to parse 406 error response: {0}", parseEx);
|
||||||
// ResponseEntity<Map<String, Object>> response = vatCheckService.checkVatNumber(baseUrl, vatNumber, headers);
|
}
|
||||||
//
|
} else {
|
||||||
//
|
log.error("Exception occurred while checking vat number: {0}", ex);
|
||||||
// if (response.getStatusCode() == HttpStatus.OK && response.hasBody()) {
|
Utils.callException(ex.status(), ex);
|
||||||
// log.info("Successfully checked vat number");
|
}
|
||||||
// Map<String, Object> responseMap = response.getBody();
|
}
|
||||||
// processValidResponse(responseMap, vatCheckResponseBean);
|
return vatCheckResponseBean;
|
||||||
// }
|
}
|
||||||
// } catch (FeignException ex) {
|
|
||||||
// if (ex.status() == 406) {
|
public static void processValidResponseV1(Map<String, Object> responseMap, VatCheckResponseBean vatCheckResponseBean) {
|
||||||
// try {
|
Object dataObj = responseMap.get("data");
|
||||||
// Map<String, Object> errorResponse = Utils.parseErrorResponse(ex.contentUTF8());
|
if (dataObj instanceof Map<?, ?> rawDataMap) {
|
||||||
// processValidResponse(errorResponse, vatCheckResponseBean);
|
Map<String, Object> responseBody = new LinkedHashMap<>();
|
||||||
// } catch (Exception parseEx) {
|
rawDataMap.forEach((k, v) -> {
|
||||||
// log.error("Failed to parse 406 error response: {0}", parseEx);
|
if (k instanceof String strKey) {
|
||||||
// }
|
responseBody.put(strKey, v);
|
||||||
// } else {
|
}
|
||||||
// log.error("Exception occurred while checking vat number: {0}", ex);
|
});
|
||||||
// Utils.callException(ex.status(), ex);
|
|
||||||
// }
|
List.of("timestamp_creation", "timestamp_last_update", "id", "data_iscrizione").forEach(responseBody.keySet()::remove);
|
||||||
// }
|
|
||||||
// return vatCheckResponseBean;
|
Map<String, Object> data = new LinkedHashMap<>();
|
||||||
// }
|
data.put("data", responseBody);
|
||||||
// public static void processValidResponse(Map<String, Object> responseMap, VatCheckResponseBean vatCheckResponseBean) {
|
|
||||||
// if (responseMap != null && responseMap.containsKey("data")) {
|
vatCheckResponseBean.setValid(true);
|
||||||
// Map<String, Object> responseBody = (Map<String, Object>) responseMap.get("data");
|
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.VALID_VATNUMBER_MSG));
|
||||||
//
|
vatCheckResponseBean.setVatCheckResponse(data);
|
||||||
// if (responseBody != null) {
|
} else {
|
||||||
// responseBody.remove("timestamp_creation");
|
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
||||||
// responseBody.remove("timestamp_last_update");
|
}
|
||||||
// responseBody.remove("data_iscrizione");
|
|
||||||
// responseBody.remove("id");
|
}
|
||||||
//
|
|
||||||
// Map<String, Object> data = new LinkedHashMap<>();
|
|
||||||
// data.put("data", responseBody);
|
|
||||||
//
|
|
||||||
// vatCheckResponseBean.setValid(true);
|
|
||||||
// vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.VALID_VATNUMBER_MSG));
|
|
||||||
// vatCheckResponseBean.setVatCheckResponse(data);
|
|
||||||
// } else {
|
|
||||||
// vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public VatCheckResponseBean checkVatNumber(String vatNumber) {
|
|
||||||
// try {
|
|
||||||
// return checkVatNumberApi(vatNumber);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// log.error("Error in checkVatNumber: {}", e.getMessage());
|
|
||||||
// VatCheckResponseBean vatCheckResponseBean = new VatCheckResponseBean();
|
|
||||||
// vatCheckResponseBean.setValid(false);
|
|
||||||
// vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
|
||||||
// return vatCheckResponseBean;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public VatCheckResponseBean checkVatNumber(String vatNumber) {
|
public VatCheckResponseBean checkVatNumber(String vatNumber) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return checkVatNumberApi(vatNumber);
|
String vatApiVersion = getVatCheckVersion();
|
||||||
|
if(!isVatCheckApiV2(vatApiVersion)){
|
||||||
|
return checkVatNumberV1(vatNumber);
|
||||||
|
}
|
||||||
|
return checkVatNumberV2(vatNumber);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error in checkVatNumber: {}", e.getMessage());
|
logErrorMessage(e);
|
||||||
VatCheckResponseBean vatCheckResponseBean = new VatCheckResponseBean();
|
VatCheckResponseBean vatCheckResponseBean = new VatCheckResponseBean();
|
||||||
vatCheckResponseBean.setValid(false);
|
vatCheckResponseBean.setValid(false);
|
||||||
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
||||||
@@ -135,7 +135,7 @@ public class VatCheckDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public VatCheckResponseBean checkVatNumberApi(String vatNumber) {
|
public VatCheckResponseBean checkVatNumberV2(String vatNumber) {
|
||||||
|
|
||||||
VatCheckResponseBean vatCheckResponseBean = new VatCheckResponseBean();
|
VatCheckResponseBean vatCheckResponseBean = new VatCheckResponseBean();
|
||||||
vatCheckResponseBean.setValid(false);
|
vatCheckResponseBean.setValid(false);
|
||||||
@@ -147,13 +147,13 @@ public class VatCheckDao {
|
|||||||
try {
|
try {
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||||
headers.set(GepafinConstant.AUTHORIZATION, "Bearer " + vatCheckNewToken);
|
headers.set(GepafinConstant.AUTHORIZATION, "Bearer " + vatCheckTokenV2);
|
||||||
|
|
||||||
URI baseUrl = URI.create(GepafinConstant.CHECK_VATNUMBER_V2_NEW_URL_IT_ADVANCE);
|
URI baseUrl = URI.create(GepafinConstant.CHECK_VATNUMBER_URL_V2);
|
||||||
ResponseEntity<Map<String, Object>> response = vatCheckService.checkVatNumber(baseUrl, vatNumber, headers);
|
ResponseEntity<Map<String, Object>> response = vatCheckV2Service.checkVatNumber(baseUrl, vatNumber, headers);
|
||||||
|
|
||||||
if (response.getStatusCode() == HttpStatus.OK && response.hasBody()) {
|
if (response.getStatusCode() == HttpStatus.OK && response.hasBody()) {
|
||||||
log.info("Successfully checked vat number");
|
logSuccess();
|
||||||
Map<String, Object> responseMap = response.getBody();
|
Map<String, Object> responseMap = response.getBody();
|
||||||
processValidResponse(responseMap, vatCheckResponseBean);
|
processValidResponse(responseMap, vatCheckResponseBean);
|
||||||
}
|
}
|
||||||
@@ -172,33 +172,65 @@ public class VatCheckDao {
|
|||||||
}
|
}
|
||||||
return vatCheckResponseBean;
|
return vatCheckResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void processValidResponse(Map<String, Object> responseMap, VatCheckResponseBean vatCheckResponseBean) {
|
public static void processValidResponse(Map<String, Object> responseMap, VatCheckResponseBean vatCheckResponseBean) {
|
||||||
|
|
||||||
if (responseMap != null && responseMap.containsKey("data")) {
|
if (responseMap == null || !responseMap.containsKey("data")) {
|
||||||
Object dataObject = responseMap.get("data");
|
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
||||||
|
return;
|
||||||
if (dataObject instanceof List && !((List<?>) dataObject).isEmpty()) {
|
|
||||||
dataObject = ((List<?>) dataObject).get(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataObject instanceof Map) {
|
Object dataObject = responseMap.get("data");
|
||||||
Map<String, Object> responseBody = (Map<String, Object>) dataObject;
|
if (!(dataObject instanceof List<?> dataList) || dataList.isEmpty()) {
|
||||||
|
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
responseBody.remove("creationTimestamp");
|
List<Map<String, Object>> processedList = new ArrayList<>();
|
||||||
responseBody.remove("lastUpdateTimestamp");
|
|
||||||
responseBody.remove("id");
|
|
||||||
|
|
||||||
Map<String, Object> data = new LinkedHashMap<>();
|
for (Object item : dataList) {
|
||||||
data.put("data", responseBody);
|
if (item instanceof Map<?, ?> mapItem) {
|
||||||
|
Map<String, Object> responseBody = new LinkedHashMap<>();
|
||||||
|
mapItem.forEach((key, value) -> {
|
||||||
|
if (key instanceof String strKey) {
|
||||||
|
responseBody.put(strKey, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
List.of("creationTimestamp", "lastUpdateTimestamp", "id").forEach(responseBody.keySet()::remove);
|
||||||
|
|
||||||
|
processedList.add(responseBody);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (processedList.isEmpty()) {
|
||||||
|
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vatCheckResponseBean.setValid(true);
|
vatCheckResponseBean.setValid(true);
|
||||||
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.VALID_VATNUMBER_MSG));
|
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.VALID_VATNUMBER_MSG));
|
||||||
vatCheckResponseBean.setVatCheckResponse(data);
|
vatCheckResponseBean.setVatCheckResponse(Map.of("data", processedList));
|
||||||
} else {
|
|
||||||
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
vatCheckResponseBean.setMessage(Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void logSuccess() {
|
||||||
|
|
||||||
|
log.info("Successfully checked vat number");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isVatCheckApiV2(String vatApiVersion) {
|
||||||
|
boolean isNotBlank = StringUtils.isNotBlank(vatApiVersion);
|
||||||
|
boolean isNotEmpty = StringUtils.isNotEmpty(vatApiVersion);
|
||||||
|
return isNotBlank && isNotEmpty && Boolean.TRUE.equals(vatApiVersion.equals(VatCheckVersionTypeEnum.V2.getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getVatCheckVersion() {
|
||||||
|
|
||||||
|
return globalConfigRepository.findContentByTypeAndIsDeletedFalse(GepafinConstant.VAT_CHECK_API_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logErrorMessage(Exception e) {
|
||||||
|
|
||||||
|
log.error("Error in checkVatNumber: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.Immutable;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Immutable
|
||||||
|
@Table(name = "application_amendment_request_view")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@IdClass(ApplicationAmendmentRequestViewId.class)
|
||||||
|
public class ApplicationAmendmentRequestView {
|
||||||
|
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "APPLICATION_ID")
|
||||||
|
private Long applicationId;
|
||||||
|
|
||||||
|
@Column(name = "PROTOCOL_NUMBER")
|
||||||
|
private Long protocolNumber;
|
||||||
|
|
||||||
|
@Column(name = "CALL_NAME")
|
||||||
|
private String callName;
|
||||||
|
|
||||||
|
@Column(name = "COMPANY_NAME")
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
@Column(name = "START_DATE")
|
||||||
|
private LocalDateTime startDate;
|
||||||
|
|
||||||
|
@Column(name = "EXPIRATION_DATE")
|
||||||
|
private LocalDateTime expirationDate;
|
||||||
|
|
||||||
|
@Column(name = "ASSIGNED_USER_NAME")
|
||||||
|
private String assigendUserName;
|
||||||
|
|
||||||
|
@Column(name = "ASSIGNED_USER_ID")
|
||||||
|
private Long assignedUserId;
|
||||||
|
|
||||||
|
@Column(name = "STATUS")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Column(name = "NOTE")
|
||||||
|
private String note;
|
||||||
|
|
||||||
|
@Column(name = "INTERNAL_NOTE")
|
||||||
|
private String internalNote;
|
||||||
|
|
||||||
|
@Column(name = "APPLICATION_USER_ID")
|
||||||
|
private Long applicationUserId;
|
||||||
|
|
||||||
|
@Column(name = "CREATED_DATE")
|
||||||
|
private String createdDate;
|
||||||
|
|
||||||
|
@Column(name = "UPDATED_DATE")
|
||||||
|
private String updatedDate;
|
||||||
|
|
||||||
|
@Column(name = "IS_DELETED")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
public class ApplicationAmendmentRequestViewId {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public ApplicationAmendmentRequestViewId() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationAmendmentRequestViewId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.Immutable;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Immutable
|
||||||
|
@Table(name = "application_form_view")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@IdClass(ApplicationFormViewId.class)
|
||||||
|
public class ApplicationFormView {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "application_id")
|
||||||
|
private Long applicationId;
|
||||||
|
|
||||||
|
@Column(name = "call_id")
|
||||||
|
private Long callId;
|
||||||
|
|
||||||
|
@Column(name = "form_id")
|
||||||
|
private Long formId;
|
||||||
|
|
||||||
|
@Column(name = "application_form_id")
|
||||||
|
private Long applicationFormId;
|
||||||
|
|
||||||
|
@Column(name = "field_id")
|
||||||
|
private String fieldId;
|
||||||
|
|
||||||
|
@Column(name = "field_label")
|
||||||
|
private String fieldLabel;
|
||||||
|
|
||||||
|
@Column(name = "field_type")
|
||||||
|
private String fieldType;
|
||||||
|
|
||||||
|
@Column(name = "field_value")
|
||||||
|
private String fieldValue;
|
||||||
|
|
||||||
|
@Column(name = "report_enable")
|
||||||
|
private Boolean reportEnable;
|
||||||
|
|
||||||
|
@Column(name = "report_header")
|
||||||
|
private String reportHeader;
|
||||||
|
|
||||||
|
@Column(name = "status")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Column(name = "amount_requested")
|
||||||
|
private BigDecimal amountRequested;
|
||||||
|
|
||||||
|
@Column(name = "amount_accepted")
|
||||||
|
private BigDecimal amountAccepted;
|
||||||
|
|
||||||
|
@Column(name = "is_deleted")
|
||||||
|
private boolean isDeleted;
|
||||||
|
|
||||||
|
@Column(name = "hub_id")
|
||||||
|
private Long hubId;
|
||||||
|
|
||||||
|
@Column(name = "user_id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Column(name = "evaluation_version")
|
||||||
|
private String evaluationVersion;
|
||||||
|
|
||||||
|
@Column(name = "company_id")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@Column(name = "company_name")
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
@Column(name = "company_vat_number")
|
||||||
|
private String companyVatNumber;
|
||||||
|
|
||||||
|
@Column(name = "codice_ateco")
|
||||||
|
private String codiceAteco;
|
||||||
|
|
||||||
|
@Column(name = "company_codice_fiscale")
|
||||||
|
private String companyCodiceFiscale;
|
||||||
|
|
||||||
|
@Column(name = "protocol_number")
|
||||||
|
private Long protocolNumber;
|
||||||
|
|
||||||
|
@Column(name = "user_codice_fiscale")
|
||||||
|
private String userCodiceFiscale;
|
||||||
|
|
||||||
|
@Column(name = "user_name")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Column(name = "legal_representative")
|
||||||
|
private Boolean legalRepresentative;
|
||||||
|
|
||||||
|
@Column(name = "call_title")
|
||||||
|
private String callTitle;
|
||||||
|
|
||||||
|
@Column(name = "call_end_date")
|
||||||
|
private LocalDate callEndDate;
|
||||||
|
|
||||||
|
@Column(name = "call_end_time")
|
||||||
|
private LocalTime callEndTime;
|
||||||
|
|
||||||
|
@Column(name = "call_start_date")
|
||||||
|
private LocalDate callStartDate;
|
||||||
|
|
||||||
|
@Column(name = "call_start_time")
|
||||||
|
private LocalTime callStartTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationFormViewId implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public ApplicationFormViewId() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationFormViewId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -80,7 +80,7 @@ public class ApplicationView implements Serializable {
|
|||||||
private Long protocolNumber;
|
private Long protocolNumber;
|
||||||
|
|
||||||
@Column(name = "ASSIGNED_USER_ID")
|
@Column(name = "ASSIGNED_USER_ID")
|
||||||
private Long assigned_user_id;
|
private Long assignedUserId;
|
||||||
|
|
||||||
@Column(name = "ASSIGNED_USER_NAME")
|
@Column(name = "ASSIGNED_USER_NAME")
|
||||||
private String assignedUserName;
|
private String assignedUserName;
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.annotations.Immutable;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Immutable
|
||||||
|
@Data
|
||||||
|
@Table(name = "assigned_applications_view")
|
||||||
|
@IdClass(AssignedApplicationsViewId.class)
|
||||||
|
public class AssignedApplicationsView{
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "APPLICATION_ID")
|
||||||
|
private Long applicationId;
|
||||||
|
|
||||||
|
@Column(name = "USER_ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Column(name = "PROTOCOL_NUMBER")
|
||||||
|
private Long protocolNumber;
|
||||||
|
|
||||||
|
@Column(name = "CALL_NAME")
|
||||||
|
private String callName;
|
||||||
|
|
||||||
|
@Column(name = "COMPANY_NAME")
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
@Column(name = "STATUS")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Column(name = "NDG")
|
||||||
|
private String ndg;
|
||||||
|
|
||||||
|
@Column(name = "APPOINTMENT_ID")
|
||||||
|
private String appointmentId;
|
||||||
|
|
||||||
|
@Column(name = "APPLICATION_STATUS")
|
||||||
|
private String applicationStatus;
|
||||||
|
|
||||||
|
@Column(name = "SUBMISSION_DATE")
|
||||||
|
private LocalDateTime submissionDate;
|
||||||
|
|
||||||
|
@Column(name = "EVALUATION_END_DATE")
|
||||||
|
private LocalDateTime evaluationEndDate;
|
||||||
|
|
||||||
|
@Column(name = "CREATED_DATE")
|
||||||
|
private LocalDateTime createdDate;
|
||||||
|
|
||||||
|
@Column(name = "UPDATED_DATE")
|
||||||
|
private LocalDateTime updatedDate;
|
||||||
|
|
||||||
|
@Column(name = "IS_DELETED")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AssignedApplicationsViewId implements Serializable{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public AssignedApplicationsViewId() {}
|
||||||
|
|
||||||
|
public AssignedApplicationsViewId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Table(name = "GLOBAL_CONFIG")
|
||||||
|
public class GlobalConfigEntity extends BaseEntity{
|
||||||
|
|
||||||
|
@Column(name = "CONTENT")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@Column(name = "TYPE")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Column(name = "IS_DELETED")
|
||||||
|
private Boolean isDeleted = false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.gepafin.tendermanagement.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
public enum VatCheckVersionTypeEnum {
|
||||||
|
V1("V1"),
|
||||||
|
V2("V2");
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
VatCheckVersionTypeEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import lombok.Data;
|
|||||||
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ApplicationAmendmentPaginationRequestBean {
|
public class ApplicationAmendmentPaginationRequestBean {
|
||||||
@@ -11,4 +12,9 @@ public class ApplicationAmendmentPaginationRequestBean {
|
|||||||
private GlobalFilters globalFilters;
|
private GlobalFilters globalFilters;
|
||||||
|
|
||||||
private List<ApplicationAmendmentRequestEnum> status;
|
private List<ApplicationAmendmentRequestEnum> status;
|
||||||
|
|
||||||
|
private Map<String, FilterCriteria> filters;
|
||||||
|
|
||||||
|
private Boolean personalRecords;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationAmendmentRequestViewResponse {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long applicationId;
|
||||||
|
|
||||||
|
private Long protocolNumber;
|
||||||
|
|
||||||
|
private String callName;
|
||||||
|
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
private LocalDateTime startDate;
|
||||||
|
|
||||||
|
private LocalDateTime expirationDate;
|
||||||
|
|
||||||
|
private String assigendUserName;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.BaseBean;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AssignedApplicationViewResponse extends BaseBean {
|
||||||
|
private Long userId;
|
||||||
|
private Long applicationId;
|
||||||
|
private AssignedApplicationEnum status;
|
||||||
|
private LocalDateTime submissionDate;
|
||||||
|
private ApplicationStatusTypeEnum applicationStatus;
|
||||||
|
private LocalDateTime evaluationEndDate;
|
||||||
|
private String ndg;
|
||||||
|
private String appointmentId;
|
||||||
|
private Long protocolNumber;
|
||||||
|
private String callName;
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestView;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
||||||
|
public interface ApplicationAmendmentRequestViewRepository extends JpaRepository<ApplicationAmendmentRequestView,Long> , JpaSpecificationExecutor<ApplicationAmendmentRequestView> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationFormView;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface ApplicationFormViewRepository extends JpaRepository<ApplicationFormView,Long>, JpaSpecificationExecutor<ApplicationFormView> {
|
||||||
|
|
||||||
|
@Query("SELECT v FROM ApplicationFormView v WHERE v.callId = :callId AND v.reportEnable = true")
|
||||||
|
List<ApplicationFormView> findByCallId(Long callId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -177,4 +177,5 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
|||||||
@Query("UPDATE ApplicationEntity a SET a.ndgStatus = NULL WHERE a.ndgStatus = :status")
|
@Query("UPDATE ApplicationEntity a SET a.ndgStatus = NULL WHERE a.ndgStatus = :status")
|
||||||
void resetNdgStatusForInProgress(@Param("status") String status);
|
void resetNdgStatusForInProgress(@Param("status") String status);
|
||||||
|
|
||||||
|
boolean existsByCallId(Long callId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package net.gepafin.tendermanagement.repositories;
|
|||||||
import net.gepafin.tendermanagement.entities.ApplicationView;
|
import net.gepafin.tendermanagement.entities.ApplicationView;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
public interface ApplicationViewRepository extends JpaRepository<ApplicationView,Long> , JpaSpecificationExecutor<ApplicationView> {
|
public interface ApplicationViewRepository extends JpaRepository<ApplicationView,Long> , JpaSpecificationExecutor<ApplicationView> {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.AssignedApplicationsView;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
||||||
|
public interface AssignedApplicationsViewRepository extends JpaRepository<AssignedApplicationsView,Long> , JpaSpecificationExecutor<AssignedApplicationsView> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ import org.springframework.data.repository.query.Param;
|
|||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
@@ -59,4 +61,7 @@ public interface CallRepository extends JpaRepository<CallEntity, Long>, JpaSpec
|
|||||||
|
|
||||||
public List<CallEntity> findByStatusInAndHubIdAndConfidi(List<String> callStatus, Long hubId,Boolean onlyConfidiCall);
|
public List<CallEntity> findByStatusInAndHubIdAndConfidi(List<String> callStatus, Long hubId,Boolean onlyConfidiCall);
|
||||||
|
|
||||||
|
@Query("SELECT c FROM CallEntity c WHERE c.status = :status AND (FUNCTION('DATE', c.endDate) < :endDate OR (FUNCTION('DATE', c.endDate) = :endDate AND c.endTime <= :endTime))")
|
||||||
|
List<CallEntity> findExpiredCallsWhichIsPublished(@Param("status") String status, @Param("endDate") LocalDate endDate, @Param("endTime") LocalTime endTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.GlobalConfigEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
|
public interface GlobalConfigRepository extends JpaRepository<GlobalConfigEntity, Long> {
|
||||||
|
|
||||||
|
@Query("SELECT gc.content FROM GlobalConfigEntity gc WHERE gc.type = :vatCheckApiVersion AND gc.isDeleted = false")
|
||||||
|
String findContentByTypeAndIsDeletedFalse(String vatCheckApiVersion);
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
|||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestViewResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
||||||
|
|
||||||
@@ -29,5 +30,5 @@ public interface ApplicationAmendmentRequestService {
|
|||||||
public ApplicationAmendmentRequestResponse updateApplicationAmendmentStatus(HttpServletRequest request, Long applicationAmendmentId, ApplicationAmendmentRequestEnum status);
|
public ApplicationAmendmentRequestResponse updateApplicationAmendmentStatus(HttpServletRequest request, Long applicationAmendmentId, ApplicationAmendmentRequestEnum status);
|
||||||
|
|
||||||
void sendReminderEmail(HttpServletRequest request,Long amendmentId);
|
void sendReminderEmail(HttpServletRequest request,Long amendmentId);
|
||||||
PageableResponseBean<List<ApplicationAmendmentRequestResponse>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean);
|
PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.gepafin.tendermanagement.service;
|
package net.gepafin.tendermanagement.service;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationPageableRequestBean;
|
import net.gepafin.tendermanagement.model.request.ApplicationPageableRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.ApplicationRequest;
|
||||||
@@ -46,4 +47,7 @@ public interface ApplicationService {
|
|||||||
PageableResponseBean<List<ApplicationResponse>> getAllApplicationByPagination(HttpServletRequest request, Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean);
|
PageableResponseBean<List<ApplicationResponse>> getAllApplicationByPagination(HttpServletRequest request, Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean);
|
||||||
|
|
||||||
public ApplicationEntity validateApplicationWithCompany(Long applicationId,Long companyId);
|
public ApplicationEntity validateApplicationWithCompany(Long applicationId,Long companyId);
|
||||||
|
|
||||||
|
public byte[] exportCsv(HttpServletRequest request, Long callId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
|||||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationViewResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
|
|
||||||
@@ -23,6 +24,6 @@ public interface AssignedApplicationsService {
|
|||||||
AssignedApplicationsResponse updateAssignedApplication(HttpServletRequest request, Long id, UpdateAssignedApplicationRequest assignedApplicationsRequest);
|
AssignedApplicationsResponse updateAssignedApplication(HttpServletRequest request, Long id, UpdateAssignedApplicationRequest assignedApplicationsRequest);
|
||||||
AssignedApplicationsResponse getAssignedApplicationById(HttpServletRequest request, Long id);
|
AssignedApplicationsResponse getAssignedApplicationById(HttpServletRequest request, Long id);
|
||||||
AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId);
|
AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId);
|
||||||
PageableResponseBean<List<AssignedApplicationsResponse>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean);
|
PageableResponseBean<List<AssignedApplicationViewResponse>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean);
|
||||||
AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status);
|
AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package net.gepafin.tendermanagement.service;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.model.request.LimitRequest;
|
import net.gepafin.tendermanagement.model.request.LimitRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
|
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
|
||||||
|
|||||||
@@ -11,13 +11,9 @@ import org.springframework.web.bind.annotation.RequestHeader;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@FeignClient(value = "vat-check-service", url = GepafinConstant.CHECK_VATNUMBER_V2_NEW_URL_IT_ADVANCE)
|
@FeignClient(value = "vat-check-v1-service", url = GepafinConstant.CHECK_VATNUMBER_URL_V1)
|
||||||
public interface VatCheckService {
|
public interface VatCheckV1Service {
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/{vatNumber}")
|
@GetMapping("/{vatNumber}")
|
||||||
ResponseEntity<Map<String, Object>> checkVatNumber(URI baseUrl,
|
ResponseEntity<Map<String, Object>> checkVatNumber(URI baseUrl, @PathVariable("vatNumber") String vatNumber, @RequestHeader HttpHeaders headers);
|
||||||
@PathVariable("vatNumber") String vatNumber,
|
|
||||||
@RequestHeader HttpHeaders headers
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.gepafin.tendermanagement.service.feignClient;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@FeignClient(value = "vat-check-v2-service", url = GepafinConstant.CHECK_VATNUMBER_URL_V2)
|
||||||
|
public interface VatCheckV2Service {
|
||||||
|
|
||||||
|
@GetMapping("/{vatNumber}")
|
||||||
|
ResponseEntity<Map<String, Object>> checkVatNumber(URI baseUrl, @PathVariable("vatNumber") String vatNumber, @RequestHeader HttpHeaders headers);
|
||||||
|
}
|
||||||
@@ -13,12 +13,15 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
|||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestViewResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
||||||
|
import net.gepafin.tendermanagement.service.UserService;
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -41,6 +44,9 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request, Long applicationEvaluationId) {
|
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(HttpServletRequest request, Long applicationEvaluationId) {
|
||||||
Optional<ApplicationEvaluationEntity> entityOptional = applicationEvaluationRepository.findByIdAndIsDeletedFalse(applicationEvaluationId);
|
Optional<ApplicationEvaluationEntity> entityOptional = applicationEvaluationRepository.findByIdAndIsDeletedFalse(applicationEvaluationId);
|
||||||
@@ -153,8 +159,16 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageableResponseBean<List<ApplicationAmendmentRequestResponse>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean) {
|
public PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean) {
|
||||||
UserEntity user=validator.validateUser(request);
|
boolean isSpecialUser = validator.checkIsBeneficiary() ||
|
||||||
return applicationAmendmentRequestDao.getApplicationAmendmentByPaginnation(userId,amendmentPaginationRequestBean);
|
validator.checkIsConfidi() ||
|
||||||
|
validator.checkIsPreInstructor() ||
|
||||||
|
validator.checkIsInstructorManager();
|
||||||
|
|
||||||
|
if (isSpecialUser && Boolean.TRUE.equals(validator.checkRequestedUserWithUserId(request,userId))) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_USER_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
return applicationAmendmentRequestDao.getApplicationAmendmentByPaginationByView(userId,amendmentPaginationRequestBean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package net.gepafin.tendermanagement.service.impl;
|
package net.gepafin.tendermanagement.service.impl;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.dao.ApplicationDao;
|
import net.gepafin.tendermanagement.dao.ApplicationDao;
|
||||||
import net.gepafin.tendermanagement.dao.FlowFormDao;
|
import net.gepafin.tendermanagement.dao.FlowFormDao;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationPageableRequestBean;
|
import net.gepafin.tendermanagement.model.request.ApplicationPageableRequestBean;
|
||||||
@@ -15,6 +17,8 @@ import net.gepafin.tendermanagement.enums.FormActionEnum;
|
|||||||
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
|
import net.gepafin.tendermanagement.service.CallService;
|
||||||
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ForbiddenAccessException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ForbiddenAccessException;
|
||||||
@@ -38,6 +42,9 @@ public class ApplicationServiceImpl implements ApplicationService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private Validator validator;
|
private Validator validator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallService callService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ApplicationResponseBean createApplication(HttpServletRequest request,
|
public ApplicationResponseBean createApplication(HttpServletRequest request,
|
||||||
@@ -112,6 +119,7 @@ public class ApplicationServiceImpl implements ApplicationService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ApplicationSignedDocumentResponse uploadSignedDocument(HttpServletRequest request, Long applicationId, MultipartFile file) {
|
public ApplicationSignedDocumentResponse uploadSignedDocument(HttpServletRequest request, Long applicationId, MultipartFile file) {
|
||||||
|
Utils.validateFileType(file);
|
||||||
return applicationDao.uploadSignedDocument(request, applicationId, file);
|
return applicationDao.uploadSignedDocument(request, applicationId, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,4 +160,15 @@ public class ApplicationServiceImpl implements ApplicationService {
|
|||||||
public ApplicationEntity validateApplicationWithCompany(Long applicationId,Long companyId) {
|
public ApplicationEntity validateApplicationWithCompany(Long applicationId,Long companyId) {
|
||||||
return applicationDao.validateApplicationWithCompany(applicationId,companyId);
|
return applicationDao.validateApplicationWithCompany(applicationId,companyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] exportCsv(HttpServletRequest request, Long callId) {
|
||||||
|
UserEntity userEntity = validator.validateUser(request);
|
||||||
|
CallEntity call=callService.validateCall(callId);
|
||||||
|
validator.validateHubId(request,call.getHub().getId());
|
||||||
|
byte[] csvBytes= applicationDao.exportCsv(callId);
|
||||||
|
|
||||||
|
return csvBytes;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
|||||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationViewResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
||||||
@@ -66,7 +67,7 @@ public class AssignedApplicationsServiceImpl implements AssignedApplicationsServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageableResponseBean<List<AssignedApplicationsResponse>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean) {
|
public PageableResponseBean<List<AssignedApplicationViewResponse>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean) {
|
||||||
UserEntity user=validator.validateUser(request);
|
UserEntity user=validator.validateUser(request);
|
||||||
return assignedApplicationsDao.getAllAssignedApplicationsByPagination(user,assignedApplicationPageableRequestBean,userId);
|
return assignedApplicationsDao.getAllAssignedApplicationsByPagination(user,assignedApplicationPageableRequestBean,userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.gepafin.tendermanagement.model.request.CompanyDocumentRequest;
|
|||||||
import net.gepafin.tendermanagement.model.response.CompanyDocumentResponseBean;
|
import net.gepafin.tendermanagement.model.response.CompanyDocumentResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||||
import net.gepafin.tendermanagement.service.CompanyDocumentService;
|
import net.gepafin.tendermanagement.service.CompanyDocumentService;
|
||||||
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -31,6 +32,7 @@ public class CompanyDocumentServiceImpl implements CompanyDocumentService {
|
|||||||
public List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, List<MultipartFile> files, Long companyId, Long documentCategoryId , CompanyDocumentTypeEnum documentSourceTypeEnum, LocalDateTime expirationDate,String name) {
|
public List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, List<MultipartFile> files, Long companyId, Long documentCategoryId , CompanyDocumentTypeEnum documentSourceTypeEnum, LocalDateTime expirationDate,String name) {
|
||||||
Map<String, Object> userInfo = validator.getUserInfoFromToken(request);
|
Map<String, Object> userInfo = validator.getUserInfoFromToken(request);
|
||||||
Long userId = validator.getUserId(userInfo);
|
Long userId = validator.getUserId(userInfo);
|
||||||
|
files.forEach(Utils::validateFileType);
|
||||||
return companyDocumentDao.uploadFileForCompany(request,userId,files,companyId,documentCategoryId,documentSourceTypeEnum,expirationDate,name);
|
return companyDocumentDao.uploadFileForCompany(request,userId,files,companyId,documentCategoryId,documentSourceTypeEnum,expirationDate,name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import jdk.jshell.execution.Util;
|
||||||
import net.gepafin.tendermanagement.model.request.LimitRequest;
|
import net.gepafin.tendermanagement.model.request.LimitRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
|
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -107,6 +109,7 @@ public class CompanyServiceImpl implements CompanyService {
|
|||||||
public CompanyDelegationResponse uploadCompanyDelegation(HttpServletRequest request, Long companyId, MultipartFile file) {
|
public CompanyDelegationResponse uploadCompanyDelegation(HttpServletRequest request, Long companyId, MultipartFile file) {
|
||||||
UserEntity userEntity = validator.validateUser(request);
|
UserEntity userEntity = validator.validateUser(request);
|
||||||
validator.validateUserWithCompany(request, companyId);
|
validator.validateUserWithCompany(request, companyId);
|
||||||
|
Utils.validateFileType(file);
|
||||||
return delegationDao.uploadCompanyDelegation(userEntity, companyId, file);
|
return delegationDao.uploadCompanyDelegation(userEntity, companyId, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
|||||||
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||||
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||||
import net.gepafin.tendermanagement.service.DocumentService;
|
import net.gepafin.tendermanagement.service.DocumentService;
|
||||||
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -31,6 +32,7 @@ public class DocumentServiceImpl implements DocumentService {
|
|||||||
public List<DocumentResponseBean> uploadFile(HttpServletRequest request,List<MultipartFile> files, Long sourceId, DocumentSourceTypeEnum sourceType, DocumentTypeEnum fileType) {
|
public List<DocumentResponseBean> uploadFile(HttpServletRequest request,List<MultipartFile> files, Long sourceId, DocumentSourceTypeEnum sourceType, DocumentTypeEnum fileType) {
|
||||||
Map<String, Object> userInfo = validator.getUserInfoFromToken(request);
|
Map<String, Object> userInfo = validator.getUserInfoFromToken(request);
|
||||||
Long userId = validator.getUserId(userInfo);
|
Long userId = validator.getUserId(userInfo);
|
||||||
|
files.forEach(Utils::validateFileType);
|
||||||
return documentDao.uploadFiles(userId,files,sourceId,sourceType,fileType);
|
return documentDao.uploadFiles(userId,files,sourceId,sourceType,fileType);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -29,11 +29,6 @@ public class DateTimeUtil {
|
|||||||
return localDatetime;
|
return localDatetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LocalDate LocalDateServerToEurope(LocalDate systemDate) {
|
|
||||||
ZonedDateTime zonedDateTime = systemDate.atStartOfDay(ZoneId.systemDefault());
|
|
||||||
return zonedDateTime.withZoneSameInstant(ZoneId.of("Europe/Rome")).toLocalDate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LocalTime LocalTimeServerToEurope(LocalTime systemTime) {
|
public static LocalTime LocalTimeServerToEurope(LocalTime systemTime) {
|
||||||
ZonedDateTime zonedDateTime = systemTime.atDate(LocalDate.now()).atZone(ZoneId.systemDefault());
|
ZonedDateTime zonedDateTime = systemTime.atDate(LocalDate.now()).atZone(ZoneId.systemDefault());
|
||||||
return zonedDateTime.withZoneSameInstant(ZoneId.of("Europe/Rome")).toLocalTime();
|
return zonedDateTime.withZoneSameInstant(ZoneId.of("Europe/Rome")).toLocalTime();
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.enums.MatchModeEnum;
|
import net.gepafin.tendermanagement.enums.MatchModeEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.FilterCriteria;
|
||||||
import net.gepafin.tendermanagement.model.request.GlobalFilters;
|
import net.gepafin.tendermanagement.model.request.GlobalFilters;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.*;
|
||||||
import net.objecthunter.exp4j.Expression;
|
import net.objecthunter.exp4j.Expression;
|
||||||
import net.objecthunter.exp4j.ExpressionBuilder;
|
import net.objecthunter.exp4j.ExpressionBuilder;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
@@ -55,13 +57,10 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
|||||||
|
|
||||||
import feign.FeignException;
|
import feign.FeignException;
|
||||||
import io.micrometer.common.util.StringUtils;
|
import io.micrometer.common.util.StringUtils;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientForbiddenException;
|
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientNotFoundException;
|
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientUnauthorizedException;
|
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientValidationException;
|
|
||||||
import org.springframework.mock.web.MockHttpServletRequest;
|
import org.springframework.mock.web.MockHttpServletRequest;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
@@ -113,6 +112,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String extractFileName(String filePath) {
|
public static String extractFileName(String filePath) {
|
||||||
if (filePath == null || filePath.isEmpty()) {
|
if (filePath == null || filePath.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -125,6 +125,7 @@ public class Utils {
|
|||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String decodeBase64String(String decodedString) {
|
public static String decodeBase64String(String decodedString) {
|
||||||
if (StringUtils.isBlank(decodedString)) {
|
if (StringUtils.isBlank(decodedString)) {
|
||||||
return decodedString;
|
return decodedString;
|
||||||
@@ -138,12 +139,14 @@ public class Utils {
|
|||||||
setter.accept(value);
|
setter.accept(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void setIfUpdated(Supplier<T> getter, Consumer<T> setter, T newValue) {
|
public static <T> void setIfUpdated(Supplier<T> getter, Consumer<T> setter, T newValue) {
|
||||||
T currentValue = getter.get();
|
T currentValue = getter.get();
|
||||||
if (newValue != null && !newValue.equals(currentValue)) {
|
if (newValue != null && !newValue.equals(currentValue)) {
|
||||||
setter.accept(newValue);
|
setter.accept(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> String convertListToJsonString(List<T> list) {
|
public static <T> String convertListToJsonString(List<T> list) {
|
||||||
try {
|
try {
|
||||||
return mapper.writeValueAsString(list);
|
return mapper.writeValueAsString(list);
|
||||||
@@ -153,6 +156,7 @@ public class Utils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> List<T> convertJsonStringToList(String jsonString, Class<T> clazz) {
|
public static <T> List<T> convertJsonStringToList(String jsonString, Class<T> clazz) {
|
||||||
try {
|
try {
|
||||||
TypeReference<List<T>> typeRef = new TypeReference<List<T>>() {
|
TypeReference<List<T>> typeRef = new TypeReference<List<T>>() {
|
||||||
@@ -168,6 +172,7 @@ public class Utils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String convertMapIntoJsonString(Map<String, Object> map) {
|
public static String convertMapIntoJsonString(Map<String, Object> map) {
|
||||||
try {
|
try {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
@@ -182,6 +187,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, Object> convertIntoJson(String jsonString) {
|
public static Map<String, Object> convertIntoJson(String jsonString) {
|
||||||
if (jsonString != null && !jsonString.isEmpty()) {
|
if (jsonString != null && !jsonString.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
@@ -194,6 +200,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T, U> U convertSourceObjectToDestinationObject(T source, Class<U> destinationClass) {
|
public static <T, U> U convertSourceObjectToDestinationObject(T source, Class<U> destinationClass) {
|
||||||
try {
|
try {
|
||||||
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||||
@@ -204,6 +211,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void retainOnlySpecificFields(T requestObject, List<T> retainFields) throws IllegalAccessException {
|
public static <T> void retainOnlySpecificFields(T requestObject, List<T> retainFields) throws IllegalAccessException {
|
||||||
// Get all declared fields of the request object's class
|
// Get all declared fields of the request object's class
|
||||||
Field[] fields = requestObject.getClass().getDeclaredFields();
|
Field[] fields = requestObject.getClass().getDeclaredFields();
|
||||||
@@ -235,6 +243,7 @@ public class Utils {
|
|||||||
log.debug("Generated secure token: {}", token);
|
log.debug("Generated secure token: {}", token);
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String generateSecureToken() {
|
public static String generateSecureToken() {
|
||||||
SecureRandom secureRandom = new SecureRandom();
|
SecureRandom secureRandom = new SecureRandom();
|
||||||
byte[] tokenBytes = new byte[5];
|
byte[] tokenBytes = new byte[5];
|
||||||
@@ -243,6 +252,7 @@ public class Utils {
|
|||||||
log.debug("Generated secure token: {}", token);
|
log.debug("Generated secure token: {}", token);
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, List<Object>> convertStringIntoMap(String jsonString) {
|
public static Map<String, List<Object>> convertStringIntoMap(String jsonString) {
|
||||||
try {
|
try {
|
||||||
return mapper.readValue(jsonString, new TypeReference<Map<String, List<Object>>>() {
|
return mapper.readValue(jsonString, new TypeReference<Map<String, List<Object>>>() {
|
||||||
@@ -354,6 +364,7 @@ public class Utils {
|
|||||||
private static String replaceNull(String text, String target, String replacement) {
|
private static String replaceNull(String text, String target, String replacement) {
|
||||||
return text.replace(target, replacement != null ? replacement : "");
|
return text.replace(target, replacement != null ? replacement : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getClientIpAddress(HttpServletRequest request) {
|
public static String getClientIpAddress(HttpServletRequest request) {
|
||||||
String header = request.getHeader("X-Forwarded-For");
|
String header = request.getHeader("X-Forwarded-For");
|
||||||
if (org.apache.commons.lang3.StringUtils.isBlank(header)) {
|
if (org.apache.commons.lang3.StringUtils.isBlank(header)) {
|
||||||
@@ -362,6 +373,7 @@ public class Utils {
|
|||||||
|
|
||||||
return new StringTokenizer(header, ",").nextToken().trim();
|
return new StringTokenizer(header, ",").nextToken().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> List<T> convertJsonToList(String json, TypeReference<List<T>> typeRef) {
|
public static <T> List<T> convertJsonToList(String json, TypeReference<List<T>> typeRef) {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
try {
|
try {
|
||||||
@@ -374,11 +386,15 @@ public class Utils {
|
|||||||
|
|
||||||
public static String convertObjectToJson(Object obj) {
|
public static String convertObjectToJson(Object obj) {
|
||||||
try {
|
try {
|
||||||
if(obj == null){return null;}
|
if (obj == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return new ObjectMapper().writeValueAsString(obj);
|
return new ObjectMapper().writeValueAsString(obj);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
log.error("Failed to convert object to JSON: {}", e.getMessage(), e);
|
log.error("Failed to convert object to JSON: {}", e.getMessage(), e);
|
||||||
throw new RuntimeException("Failed to convert object to JSON", e);}}
|
throw new RuntimeException("Failed to convert object to JSON", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String replaceSpacesWithUnderscores(String content) {
|
public static String replaceSpacesWithUnderscores(String content) {
|
||||||
if (content == null) {
|
if (content == null) {
|
||||||
@@ -386,10 +402,10 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return content.trim().replace(" ", "_");
|
return content.trim().replace(" ", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Map<String, Object>> convertJsonStringIntoJsonList(String jsonString) {
|
public static List<Map<String, Object>> convertJsonStringIntoJsonList(String jsonString) {
|
||||||
try {
|
try {
|
||||||
if(isEmpty(jsonString))
|
if (isEmpty(jsonString)) {
|
||||||
{
|
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
@@ -400,6 +416,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String convertToString(Object input) {
|
public static String convertToString(Object input) {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
return "null"; // Return string "null" for null input
|
return "null"; // Return string "null" for null input
|
||||||
@@ -461,6 +478,7 @@ public class Utils {
|
|||||||
throw new RuntimeException("Error converting map to string", e);
|
throw new RuntimeException("Error converting map to string", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValidDateString(String dateStr) {
|
public static boolean isValidDateString(String dateStr) {
|
||||||
Pattern datePattern = Pattern.compile("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}");
|
Pattern datePattern = Pattern.compile("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}");
|
||||||
return datePattern.matcher(dateStr).matches();
|
return datePattern.matcher(dateStr).matches();
|
||||||
@@ -524,6 +542,7 @@ public class Utils {
|
|||||||
return "Invalid amount format";
|
return "Invalid amount format";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isItalianFormattedAmount(String input) {
|
public static boolean isItalianFormattedAmount(String input) {
|
||||||
// Regular expression to match Italian-style amounts (e.g., 41.003,00 or 123,45)
|
// Regular expression to match Italian-style amounts (e.g., 41.003,00 or 123,45)
|
||||||
String sanitizedInput = input.replace(",", "");
|
String sanitizedInput = input.replace(",", "");
|
||||||
@@ -741,6 +760,7 @@ public class Utils {
|
|||||||
public static String createChannelForUserAndCompany(Long userId, Long companyId) {
|
public static String createChannelForUserAndCompany(Long userId, Long companyId) {
|
||||||
return GepafinConstant.COMMON_SINGLE_CHANNEL_PREFIX + userId + GepafinConstant.COMPANY_PREFIX + companyId;
|
return GepafinConstant.COMMON_SINGLE_CHANNEL_PREFIX + userId + GepafinConstant.COMPANY_PREFIX + companyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GlobalFilters setPageNumberAndLimit(GlobalFilters globalFilters) {
|
public static GlobalFilters setPageNumberAndLimit(GlobalFilters globalFilters) {
|
||||||
if (globalFilters == null) {
|
if (globalFilters == null) {
|
||||||
if (globalFilters.getLimit() == null || globalFilters.getLimit() <= 0) {
|
if (globalFilters.getLimit() == null || globalFilters.getLimit() <= 0) {
|
||||||
@@ -769,6 +789,7 @@ public class Utils {
|
|||||||
private static Map<String, Object> defaultErrorResponse() {
|
private static Map<String, Object> defaultErrorResponse() {
|
||||||
return Collections.singletonMap("message", Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
return Collections.singletonMap("message", Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> extractValues(String input) {
|
public static List<String> extractValues(String input) {
|
||||||
List<String> extractedValues = new ArrayList<>();
|
List<String> extractedValues = new ArrayList<>();
|
||||||
Pattern pattern = Pattern.compile("\\{(.*?)\\}"); // Regex to match {value}
|
Pattern pattern = Pattern.compile("\\{(.*?)\\}"); // Regex to match {value}
|
||||||
@@ -779,6 +800,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return extractedValues;
|
return extractedValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double evaluateExpression(String expression) {
|
public static double evaluateExpression(String expression) {
|
||||||
try {
|
try {
|
||||||
Expression exp = new ExpressionBuilder(expression).build();
|
Expression exp = new ExpressionBuilder(expression).build();
|
||||||
@@ -788,6 +810,7 @@ public class Utils {
|
|||||||
return Double.NaN; // Return NaN if the expression is invalid
|
return Double.NaN; // Return NaN if the expression is invalid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNumeric(String input) {
|
public static boolean isNumeric(String input) {
|
||||||
if (input == null || input.trim().isEmpty()) {
|
if (input == null || input.trim().isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -795,9 +818,11 @@ public class Utils {
|
|||||||
|
|
||||||
return input.matches("-?\\d+(\\.\\d+)?");
|
return input.matches("-?\\d+(\\.\\d+)?");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValidBoolean(String value) {
|
public static boolean isValidBoolean(String value) {
|
||||||
return "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value);
|
return "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, Object> convertJsonStringToMap(String jsonString) {
|
public static Map<String, Object> convertJsonStringToMap(String jsonString) {
|
||||||
try {
|
try {
|
||||||
return mapper.readValue(jsonString, Map.class);
|
return mapper.readValue(jsonString, Map.class);
|
||||||
@@ -826,20 +851,48 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void applyNumberFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode) {
|
public static void applyNumberFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode) {
|
||||||
|
|
||||||
if (Number.class.isAssignableFrom(fieldPath.getJavaType())) {
|
if (Number.class.isAssignableFrom(fieldPath.getJavaType())) {
|
||||||
Number numberValue = null;
|
Number numberValue = null;
|
||||||
if (value instanceof Number) {
|
|
||||||
numberValue = (Number) value;
|
if (value instanceof String stringValue) {
|
||||||
|
if (isInteger(stringValue)) {
|
||||||
|
numberValue = Long.parseLong(stringValue);
|
||||||
|
} else if (isDecimal(stringValue)) {
|
||||||
|
numberValue = Double.parseDouble(stringValue);
|
||||||
}
|
}
|
||||||
|
} else if (value instanceof Number number) {
|
||||||
|
numberValue = number;
|
||||||
|
}
|
||||||
|
if (numberValue != null) {
|
||||||
MatchModeEnum mode = MatchModeEnum.fromObject(matchMode.getValue());
|
MatchModeEnum mode = MatchModeEnum.fromObject(matchMode.getValue());
|
||||||
switch (mode) {
|
|
||||||
case EQUALS -> predicates.add(criteriaBuilder.equal(fieldPath, numberValue));
|
if (mode == MatchModeEnum.EQUALS) {
|
||||||
|
predicates.add(criteriaBuilder.equal(fieldPath, numberValue));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isInteger(String value) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Long.parseLong(value);
|
||||||
|
return true;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isDecimal(String value) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Double.parseDouble(value);
|
||||||
|
return value.contains(".");
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void applyDateFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode, Root<?> root) {
|
public static void applyDateFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode, Root<?> root) {
|
||||||
if (fieldPath.getJavaType().equals(LocalDateTime.class)) {
|
if (fieldPath.getJavaType().equals(LocalDateTime.class)) {
|
||||||
@@ -879,8 +932,10 @@ public class Utils {
|
|||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DATEIS -> predicates.add(criteriaBuilder.equal(dateField, dateValue));
|
case DATEIS -> predicates.add(criteriaBuilder.equal(dateField, dateValue));
|
||||||
case DATEISNOT -> predicates.add(criteriaBuilder.notEqual(dateField, dateValue));
|
case DATEISNOT -> predicates.add(criteriaBuilder.notEqual(dateField, dateValue));
|
||||||
case BEFORE -> predicates.add(criteriaBuilder.lessThan(fieldPath.as(Timestamp.class), Timestamp.valueOf(dateTimeValue)));
|
case BEFORE ->
|
||||||
case AFTER -> predicates.add(criteriaBuilder.greaterThan(fieldPath.as(Timestamp.class), Timestamp.valueOf(dateTimeValue)));
|
predicates.add(criteriaBuilder.lessThan(fieldPath.as(Timestamp.class), Timestamp.valueOf(dateTimeValue)));
|
||||||
|
case AFTER ->
|
||||||
|
predicates.add(criteriaBuilder.greaterThan(fieldPath.as(Timestamp.class), Timestamp.valueOf(dateTimeValue)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -904,4 +959,57 @@ public class Utils {
|
|||||||
Object obj = parentMap.get(key);
|
Object obj = parentMap.get(key);
|
||||||
return (obj instanceof String str) ? str : null;
|
return (obj instanceof String str) ? str : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void validateFileType(MultipartFile file) {
|
||||||
|
if (file.isEmpty()) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
|
Translator.toLocale(GepafinConstant.VALIDATION_ERROR_FILE_EMPTY));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyFiltersByPagination(Root<?> root, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Map<String, FilterCriteria> filters) {
|
||||||
|
if (Boolean.FALSE.equals(filters.isEmpty())) {
|
||||||
|
for (Map.Entry<String, FilterCriteria> entry : filters.entrySet()) {
|
||||||
|
String fieldName = entry.getKey();
|
||||||
|
FilterCriteria filterCriteria = entry.getValue();
|
||||||
|
Object value = filterCriteria.getValue();
|
||||||
|
MatchModeEnum matchMode = filterCriteria.getMatchMode();
|
||||||
|
|
||||||
|
if (value != null && matchMode != null) {
|
||||||
|
Path<?> fieldPath = root.get(fieldName);
|
||||||
|
if (fieldPath != null) {
|
||||||
|
Utils.applyStringFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
|
||||||
|
Utils.applyNumberFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
|
||||||
|
Utils.applyDateFilter(fieldPath, criteriaBuilder, predicates, value, matchMode, root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static List<Map<String, Object>> convertJsonToListMap(String jsonString) {
|
||||||
|
try {
|
||||||
|
if (jsonString == null || jsonString.trim().isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
String unescaped;
|
||||||
|
|
||||||
|
// First try: parse as if it's double-encoded (escaped string containing a JSON array)
|
||||||
|
try {
|
||||||
|
unescaped = objectMapper.readValue(jsonString, String.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// If that fails, assume it's already a proper JSON array
|
||||||
|
unescaped = jsonString;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now parse the actual JSON array
|
||||||
|
return objectMapper.readValue(unescaped, new TypeReference<List<Map<String, Object>>>() {});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -206,4 +206,12 @@ public class Validator {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public Boolean checkRequestedUserWithUserId(HttpServletRequest request,Long userId){
|
||||||
|
UserEntity user=validateUser(request);
|
||||||
|
UserEntity requestedUser=userService.validateUser(userId);
|
||||||
|
if( Boolean.FALSE.equals(user.getId().equals(requestedUser.getId()))){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,7 @@ import jakarta.validation.Valid;
|
|||||||
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
|
||||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
|
||||||
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -201,7 +197,7 @@ public interface ApplicationAmendmentRequestApi {
|
|||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@PostMapping(value = "/user/{userId}/pagination", produces = { "application/json" })
|
@PostMapping(value = "/user/{userId}/pagination", produces = { "application/json" })
|
||||||
ResponseEntity<Response<PageableResponseBean<List<ApplicationAmendmentRequestResponse>>>> getApplicationAmendmentByPaginnation(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId,
|
ResponseEntity<Response<PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>>>> getApplicationAmendmentByPaginnation(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId,
|
||||||
@RequestBody ApplicationAmendmentPaginationRequestBean userActionPaginationRequest);
|
@RequestBody ApplicationAmendmentPaginationRequestBean userActionPaginationRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ package net.gepafin.tendermanagement.web.rest.api;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationPageableRequestBean;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import net.gepafin.tendermanagement.model.request.NotificationRequestBean;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -18,10 +19,8 @@ import io.swagger.v3.oas.annotations.media.ExampleObject;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationRequest;
|
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
|
|
||||||
@@ -224,5 +223,21 @@ public interface ApplicationApi {
|
|||||||
ResponseEntity<Response<PageableResponseBean<List<ApplicationResponse>>>> getAllApplicationByPagination(HttpServletRequest request,@Parameter(description = "The call id", required = false) @RequestParam(value = "callId", required = false) Long callId,
|
ResponseEntity<Response<PageableResponseBean<List<ApplicationResponse>>>> getAllApplicationByPagination(HttpServletRequest request,@Parameter(description = "The call id", required = false) @RequestParam(value = "callId", required = false) Long callId,
|
||||||
@Parameter(description = "The company id", required = false) @RequestParam(value = "companyId", required = false) Long companyId, @RequestBody ApplicationPageableRequestBean applicationPageableRequestBean);
|
@Parameter(description = "The company id", required = false) @RequestParam(value = "companyId", required = false) Long companyId, @RequestBody ApplicationPageableRequestBean applicationPageableRequestBean);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to download application data as a CSV file using the call ID",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE)})),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE)})),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE)}))
|
||||||
|
})
|
||||||
|
@GetMapping(value = "/call/{callId}/csv")
|
||||||
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||||
|
public ResponseEntity<byte[]> exportCsv(
|
||||||
|
HttpServletRequest request, @Parameter(description = "The call id", required = true) @PathVariable(value = "callId", required = true) Long callId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
|||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationViewResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
@@ -128,7 +129,7 @@ public interface AssignedApplicationsApi {
|
|||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@PostMapping(value = "/pagination", produces = "application/json")
|
@PostMapping(value = "/pagination", produces = "application/json")
|
||||||
ResponseEntity<Response<PageableResponseBean<List<AssignedApplicationsResponse>>>> getAllAssignedApplicationsByPagination(HttpServletRequest request,
|
ResponseEntity<Response<PageableResponseBean<List<AssignedApplicationViewResponse>>>> getAllAssignedApplicationsByPagination(HttpServletRequest request,
|
||||||
@Parameter(description = "The User ID", required = false) @RequestParam(value = "userId",required = false) Long userId, @RequestBody AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean);
|
@Parameter(description = "The User ID", required = false) @RequestParam(value = "userId",required = false) Long userId, @RequestBody AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
|||||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestViewResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
@@ -187,11 +188,11 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<PageableResponseBean<List<ApplicationAmendmentRequestResponse>>>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean) {
|
public ResponseEntity<Response<PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>>>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean) {
|
||||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
.actionContext(UserActionContextEnum.GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION).build());
|
.actionContext(UserActionContextEnum.GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION).build());
|
||||||
|
|
||||||
PageableResponseBean<List<ApplicationAmendmentRequestResponse>> listPageableResponseBean=applicationAmendmentRequestService.getApplicationAmendmentByPaginnation(request,userId,amendmentPaginationRequestBean);
|
PageableResponseBean<List<ApplicationAmendmentRequestViewResponse>> listPageableResponseBean=applicationAmendmentRequestService.getApplicationAmendmentByPaginnation(request,userId,amendmentPaginationRequestBean);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(listPageableResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_DATA_FOR_AMENDMENT_SUCCESS_MSG)));
|
.body(new Response<>(listPageableResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_DATA_FOR_AMENDMENT_SUCCESS_MSG)));
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
package net.gepafin.tendermanagement.web.rest.api.impl;
|
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationPageableRequestBean;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationRequest;
|
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
|
||||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
@@ -236,5 +234,13 @@ public class ApplicationApiController implements ApplicationApi {
|
|||||||
.getAllApplicationByPagination(request, callId,companyId,applicationPageableRequestBean);
|
.getAllApplicationByPagination(request, callId,companyId,applicationPageableRequestBean);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(pageableResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_SUCCESS_MSG)));
|
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(pageableResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_SUCCESS_MSG)));
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<byte[]> exportCsv(HttpServletRequest request, Long callId) {
|
||||||
|
byte[] csvBytes =applicationService.exportCsv(request,callId);
|
||||||
|
return ResponseEntity.ok()
|
||||||
|
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=applications.csv")
|
||||||
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
.body(csvBytes);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,7 @@ import net.gepafin.tendermanagement.model.request.AssignedApplicationPageableReq
|
|||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
|
||||||
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
@@ -96,11 +93,11 @@ public class AssignedApplicationsController implements AssignedApplicationsApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<PageableResponseBean<List<AssignedApplicationsResponse>>>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean) {
|
public ResponseEntity<Response<PageableResponseBean<List<AssignedApplicationViewResponse>>>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean) {
|
||||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
.actionContext(UserActionContextEnum.GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION).build());
|
.actionContext(UserActionContextEnum.GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION).build());
|
||||||
|
|
||||||
PageableResponseBean<List<AssignedApplicationsResponse>> assigenedApplicationResponses=assignedApplicationsService.getAllAssignedApplicationsByPagination(request, userId,assignedApplicationPageableRequestBean);
|
PageableResponseBean<List<AssignedApplicationViewResponse>> assigenedApplicationResponses=assignedApplicationsService.getAllAssignedApplicationsByPagination(request, userId,assignedApplicationPageableRequestBean);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(assigenedApplicationResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_ASSIGNED_APPLICATION_SUCCESS_MSG)));
|
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(assigenedApplicationResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_ASSIGNED_APPLICATION_SUCCESS_MSG)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ appointment.portal.user=UtenzaAPIPortal@621
|
|||||||
appointment.portal.password=u13nzaAP1P0rtal!
|
appointment.portal.password=u13nzaAP1P0rtal!
|
||||||
appointment.portal.source=GEPAFINPORTAL
|
appointment.portal.source=GEPAFINPORTAL
|
||||||
appointment.portal.context=GEPAFINPORTAL
|
appointment.portal.context=GEPAFINPORTAL
|
||||||
flagDaFirmare=false
|
|
||||||
|
|
||||||
# RabbitMQ properties for STOMP broker relay for Notification
|
# RabbitMQ properties for STOMP broker relay for Notification
|
||||||
#spring.rabbitmq.host=rabbitmq.bflows.ai
|
#spring.rabbitmq.host=rabbitmq.bflows.ai
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ appointment.portal.user=UtenzaAPIPortal@621
|
|||||||
appointment.portal.password=u13nzaAP1P0rtal!
|
appointment.portal.password=u13nzaAP1P0rtal!
|
||||||
appointment.portal.source=GEPAFINPORTAL
|
appointment.portal.source=GEPAFINPORTAL
|
||||||
appointment.portal.context=GEPAFINPORTAL
|
appointment.portal.context=GEPAFINPORTAL
|
||||||
flagDaFirmare=false
|
|
||||||
|
|
||||||
# RabbitMQ properties for STOMP broker relay for Notification
|
# RabbitMQ properties for STOMP broker relay for Notification
|
||||||
spring.rabbitmq.host=localhost
|
spring.rabbitmq.host=localhost
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ appointment.portal.user=UtenzaAPIPortal@621
|
|||||||
appointment.portal.password=u13nzaAP1P0rtal!
|
appointment.portal.password=u13nzaAP1P0rtal!
|
||||||
appointment.portal.source=GEPAFINPORTAL
|
appointment.portal.source=GEPAFINPORTAL
|
||||||
appointment.portal.context=GEPAFINPORTAL
|
appointment.portal.context=GEPAFINPORTAL
|
||||||
flagDaFirmare=true
|
|
||||||
|
|
||||||
# RabbitMQ properties for STOMP broker relay for Notification
|
# RabbitMQ properties for STOMP broker relay for Notification
|
||||||
#spring.rabbitmq.host=rabbitmq.bflows.ai
|
#spring.rabbitmq.host=rabbitmq.bflows.ai
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ appointment.portal.user=UtenzaAPIPortal@621
|
|||||||
appointment.portal.password=u13nzaAP1P0rtal!
|
appointment.portal.password=u13nzaAP1P0rtal!
|
||||||
appointment.portal.source=GEPAFINPORTAL
|
appointment.portal.source=GEPAFINPORTAL
|
||||||
appointment.portal.context=GEPAFINPORTAL
|
appointment.portal.context=GEPAFINPORTAL
|
||||||
flagDaFirmare=false
|
|
||||||
|
|
||||||
# RabbitMQ properties for STOMP broker relay for Notification
|
# RabbitMQ properties for STOMP broker relay for Notification
|
||||||
spring.rabbitmq.host=rabbitmq.bflows.ai
|
spring.rabbitmq.host=rabbitmq.bflows.ai
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ fe.base.url=https://bandi-staging.memento.credit
|
|||||||
spring.main.allow-circular-references=true
|
spring.main.allow-circular-references=true
|
||||||
|
|
||||||
isVatCheckGloballyDisabled = true
|
isVatCheckGloballyDisabled = true
|
||||||
vatCheckNewToken: 671916c76c6e822f660774d4
|
vatCheckTokenV1: 66026bd891a51044e90e08c4
|
||||||
|
vatCheckTokenV2: 671916c76c6e822f660774d4
|
||||||
|
|
||||||
#SPID configuration
|
#SPID configuration
|
||||||
spid.ipd.base.url=https://federatest.umbriadigitale.it
|
spid.ipd.base.url=https://federatest.umbriadigitale.it
|
||||||
|
|||||||
@@ -2690,4 +2690,51 @@
|
|||||||
</insert>
|
</insert>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="01-04-2025_PK_185849" author="Piyush Kag">
|
||||||
|
<sqlFile dbms="postgresql"
|
||||||
|
path="db/dump/create_application_amendment_request_view.sql"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="03-04-2025_PK_152010" author="Piyush kag">
|
||||||
|
<createTable tableName="global_config">
|
||||||
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
|
<constraints primaryKey="true" primaryKeyName="global_config_pkey" nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="content" type="TEXT"/>
|
||||||
|
<column name="type" type="TEXT"/>
|
||||||
|
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false"/>
|
||||||
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="03-04-2025_PK_154010" author="Piyush kag">
|
||||||
|
<insert tableName="global_config">
|
||||||
|
<column name="type" value="VAT_CHECK_API_VERSION"/>
|
||||||
|
<column name="content" value="V2"/>
|
||||||
|
<column name="created_date" value="2025-04-03 05:00:00"/>
|
||||||
|
<column name="updated_date" value="2024-04-03 05:00:00"/>
|
||||||
|
<column name="is_deleted" value="false"/>
|
||||||
|
</insert>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="09-04-2025_NK_172550" author="Nisha Kashyap">
|
||||||
|
<sqlFile
|
||||||
|
dbms="postgresql"
|
||||||
|
path="db/dump/create_application_form_view.sql"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
|
||||||
|
<changeSet id="08-04-2025_PK_160730" author="Piyush kag">
|
||||||
|
<sqlFile dbms="postgresql"
|
||||||
|
path="db/dump/create_assigned_application_view.sql"/>
|
||||||
|
</changeSet>
|
||||||
|
<changeSet id="14-04-2025_RK_161000" author="Rajesh Khore">
|
||||||
|
<sqlFile dbms="postgresql"
|
||||||
|
path="db/dump/update_form_field_data_14_04_2025.sql"/>
|
||||||
|
</changeSet>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
CREATE OR REPLACE VIEW application_amendment_request_view AS
|
||||||
|
|
||||||
|
SELECT a.id,
|
||||||
|
a.application_id,
|
||||||
|
p.protocol_number,
|
||||||
|
cl.name AS call_name,
|
||||||
|
c.company_name,
|
||||||
|
a.start_date,
|
||||||
|
a.end_date AS expiration_date,
|
||||||
|
COALESCE(NULLIF(TRIM(BOTH FROM concat(COALESCE(u.first_name, ''), ' ', COALESCE(u.last_name, ''))), ''), '') AS assigned_user_name,
|
||||||
|
aa.user_id AS assigned_user_id,
|
||||||
|
a.status,
|
||||||
|
a.note,
|
||||||
|
a.internal_note,
|
||||||
|
app.user_id AS application_user_id,
|
||||||
|
a.created_date,
|
||||||
|
a.updated_date,
|
||||||
|
a.is_deleted
|
||||||
|
FROM gepafin_schema.application_amendment_request a
|
||||||
|
LEFT JOIN gepafin_schema.application app ON a.application_id = app.id AND (app.is_deleted IS FALSE OR app.is_deleted IS NULL)
|
||||||
|
LEFT JOIN gepafin_schema.call cl ON app.call_id = cl.id
|
||||||
|
LEFT JOIN gepafin_schema.company c ON app.company_id = c.id
|
||||||
|
LEFT JOIN gepafin_schema.protocol p ON a.protocol_id = p.id
|
||||||
|
LEFT JOIN gepafin_schema.assigned_applications aa ON app.id = aa.application_id AND (aa.is_deleted IS FALSE OR aa.is_deleted IS NULL)
|
||||||
|
LEFT JOIN gepafin_schema.gepafin_user u ON aa.user_id = u.id
|
||||||
|
WHERE a.is_deleted IS FALSE OR a.is_deleted IS NULL ORDER BY id;
|
||||||
125
src/main/resources/db/dump/create_application_form_view.sql
Normal file
125
src/main/resources/db/dump/create_application_form_view.sql
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
CREATE OR REPLACE VIEW gepafin_schema.application_form_view AS
|
||||||
|
SELECT app_data.id,
|
||||||
|
app_data.call_id,
|
||||||
|
app_data.application_form_id,
|
||||||
|
app_data.form_id,
|
||||||
|
app_data.application_id,
|
||||||
|
field_data.value ->> 'id' AS field_id,
|
||||||
|
COALESCE(
|
||||||
|
(SELECT s.value ->> 'value'
|
||||||
|
FROM jsonb_array_elements(field_data.value -> 'settings') s(value)
|
||||||
|
WHERE s.value ->> 'name' = 'label'
|
||||||
|
LIMIT 1),
|
||||||
|
field_data.value ->> 'label'
|
||||||
|
) AS field_label,
|
||||||
|
(
|
||||||
|
SELECT (s.value ->> 'value')::boolean
|
||||||
|
FROM jsonb_array_elements(field_data.value -> 'settings') s(value)
|
||||||
|
WHERE s.value ->> 'name' = 'reportEnable'
|
||||||
|
LIMIT 1
|
||||||
|
) AS report_enable,
|
||||||
|
COALESCE( (SELECT s.value ->> 'value'
|
||||||
|
FROM jsonb_array_elements(field_data.value -> 'settings') s(value)
|
||||||
|
WHERE s.value ->> 'name' = 'reportHeader'
|
||||||
|
LIMIT 1),
|
||||||
|
field_data.value ->> 'reportHeader'
|
||||||
|
) AS report_header,
|
||||||
|
field_data.value ->> 'name' AS field_type,
|
||||||
|
CASE
|
||||||
|
WHEN field_data.value ->> 'name' = 'fileupload' THEN
|
||||||
|
to_jsonb((
|
||||||
|
SELECT string_agg(d.file_name, ', ')
|
||||||
|
FROM unnest(string_to_array(app_data.field_value, ',')) file_ids(file_id)
|
||||||
|
JOIN gepafin_schema.document d ON d.id::text = file_ids.file_id
|
||||||
|
WHERE d.is_deleted = false
|
||||||
|
))
|
||||||
|
WHEN field_data.value ->> 'name' IN ('checkboxes', 'select', 'radio') THEN
|
||||||
|
CASE
|
||||||
|
WHEN app_data.field_value ~~ '[%' THEN
|
||||||
|
to_jsonb((
|
||||||
|
SELECT string_agg(opt.value ->> 'label', ', ')
|
||||||
|
FROM jsonb_array_elements_text(app_data.field_value::jsonb) selected_id(value)
|
||||||
|
CROSS JOIN LATERAL (
|
||||||
|
SELECT s.value
|
||||||
|
FROM jsonb_array_elements(field_data.value -> 'settings') s(value)
|
||||||
|
WHERE s.value ->> 'name' = 'options'
|
||||||
|
) options_setting,
|
||||||
|
LATERAL jsonb_array_elements(options_setting.value -> 'value') opt(value)
|
||||||
|
WHERE opt.value ->> 'name' = selected_id.value
|
||||||
|
))
|
||||||
|
ELSE
|
||||||
|
to_jsonb((
|
||||||
|
SELECT opt.value ->> 'label'
|
||||||
|
FROM (
|
||||||
|
SELECT s.value
|
||||||
|
FROM jsonb_array_elements(field_data.value -> 'settings') s(value)
|
||||||
|
WHERE s.value ->> 'name' = 'options'
|
||||||
|
) options_setting,
|
||||||
|
LATERAL jsonb_array_elements(options_setting.value -> 'value') opt(value)
|
||||||
|
WHERE opt.value ->> 'name' = app_data.field_value
|
||||||
|
LIMIT 1
|
||||||
|
))
|
||||||
|
END
|
||||||
|
ELSE
|
||||||
|
to_jsonb(app_data.field_value)
|
||||||
|
END AS field_value,
|
||||||
|
app_data.status,
|
||||||
|
app_data.amount_requested,
|
||||||
|
app_data.amount_accepted,
|
||||||
|
app_data.is_deleted,
|
||||||
|
app_data.hub_id,
|
||||||
|
app_data.user_id,
|
||||||
|
app_data.evaluation_version,
|
||||||
|
app_data.company_id,
|
||||||
|
c.company_name,
|
||||||
|
c.vat_number AS company_vat_number,
|
||||||
|
c.codice_ateco,
|
||||||
|
c.codice_fiscale AS company_codice_fiscale,
|
||||||
|
p.protocol_number,
|
||||||
|
b.codice_fiscale AS user_codice_fiscale,
|
||||||
|
COALESCE(NULLIF(TRIM(BOTH FROM CONCAT(COALESCE(u.first_name, ''), ' ', COALESCE(u.last_name, ''))), ''), '') AS user_name,
|
||||||
|
uwc.is_legal_representant AS legal_representative,
|
||||||
|
cl.name AS call_title,
|
||||||
|
cl.end_date AS call_end_date,
|
||||||
|
cl.end_time AS call_end_time,
|
||||||
|
cl.start_date AS call_start_date,
|
||||||
|
cl.start_time AS call_start_time
|
||||||
|
FROM (
|
||||||
|
SELECT a.id AS application_id,
|
||||||
|
a.call_id,
|
||||||
|
a.protocol_number,
|
||||||
|
af.id AS application_form_id,
|
||||||
|
af.form_id AS form_id,
|
||||||
|
aff.id AS id,
|
||||||
|
aff.field_value,
|
||||||
|
a.status,
|
||||||
|
a.amount_requested,
|
||||||
|
a.amount_accepted,
|
||||||
|
a.is_deleted,
|
||||||
|
a.hub_id,
|
||||||
|
a.user_id,
|
||||||
|
a.evaluation_version,
|
||||||
|
a.created_date,
|
||||||
|
a.company_id,
|
||||||
|
aff.field_id,
|
||||||
|
f.content
|
||||||
|
FROM gepafin_schema.application a
|
||||||
|
JOIN gepafin_schema.application_form af ON af.application_id = a.id
|
||||||
|
JOIN gepafin_schema.application_form_field aff ON aff.application_form_id = af.id
|
||||||
|
JOIN gepafin_schema.form f ON f.id = af.form_id
|
||||||
|
WHERE a.is_deleted = false
|
||||||
|
) app_data
|
||||||
|
CROSS JOIN LATERAL (
|
||||||
|
SELECT jsonb_array_elements.value
|
||||||
|
FROM jsonb_array_elements(app_data.content::jsonb) jsonb_array_elements(value)
|
||||||
|
WHERE jsonb_array_elements.value ->> 'id' = app_data.field_id::text
|
||||||
|
) field_data(value)
|
||||||
|
LEFT JOIN gepafin_schema.call cl ON app_data.call_id = cl.id
|
||||||
|
LEFT JOIN gepafin_schema.company c ON app_data.company_id = c.id
|
||||||
|
LEFT JOIN gepafin_schema.protocol p ON app_data.protocol_number = p.id
|
||||||
|
LEFT JOIN gepafin_schema.gepafin_user u ON app_data.user_id = u.id
|
||||||
|
LEFT JOIN gepafin_schema.user_with_company uwc ON app_data.user_id = uwc.user_id AND app_data.company_id = uwc.company_id AND uwc.is_deleted = false
|
||||||
|
LEFT JOIN gepafin_schema.beneficiary b ON u.beneficiary_id = b.id
|
||||||
|
WHERE app_data.id IS NOT NULL
|
||||||
|
AND app_data.status NOT IN ('DRAFT', 'AWAITING', 'READY')
|
||||||
|
ORDER BY app_data.id, field_data.value ->> 'id';
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
CREATE OR REPLACE VIEW assigned_applications_view AS
|
||||||
|
SELECT
|
||||||
|
-- From assigned_applications
|
||||||
|
aa.id AS id,
|
||||||
|
aa.user_id AS user_id,
|
||||||
|
aa.status AS status,
|
||||||
|
aa.created_date AS created_date,
|
||||||
|
aa.updated_date AS updated_date,
|
||||||
|
aa.is_deleted AS is_deleted,
|
||||||
|
|
||||||
|
-- From application
|
||||||
|
a.id AS application_id,
|
||||||
|
a.status AS application_status,
|
||||||
|
a.submission_date AS submission_date,
|
||||||
|
ae.end_date AS evaluation_end_date,
|
||||||
|
a.ndg AS ndg,
|
||||||
|
a.appointment_id AS appointment_id,
|
||||||
|
|
||||||
|
-- From protocol (OneToOne)
|
||||||
|
p.protocol_number AS protocol_number,
|
||||||
|
|
||||||
|
-- From call (ManyToOne)
|
||||||
|
cl.name AS call_name,
|
||||||
|
|
||||||
|
-- From company (ManyToOne)
|
||||||
|
c.company_name AS company_name
|
||||||
|
|
||||||
|
FROM gepafin_schema.assigned_applications aa
|
||||||
|
|
||||||
|
-- Join application (ManyToOne from assigned_applications)
|
||||||
|
LEFT JOIN gepafin_schema.application a
|
||||||
|
ON aa.application_id = a.id
|
||||||
|
AND (a.is_deleted IS FALSE OR a.is_deleted IS NULL)
|
||||||
|
|
||||||
|
-- Join application_evaluation (application_id matches + not deleted)
|
||||||
|
LEFT JOIN gepafin_schema.application_evaluation ae
|
||||||
|
ON ae.application_id = a.id
|
||||||
|
AND (ae.is_deleted IS FALSE OR ae.is_deleted IS NULL)
|
||||||
|
|
||||||
|
-- Join protocol (OneToOne from application)
|
||||||
|
LEFT JOIN gepafin_schema.protocol p
|
||||||
|
ON a.protocol_number = p.id
|
||||||
|
|
||||||
|
-- Join call (ManyToOne from application)
|
||||||
|
LEFT JOIN gepafin_schema.call cl
|
||||||
|
ON a.call_id = cl.id
|
||||||
|
|
||||||
|
-- Join company (ManyToOne from application)
|
||||||
|
LEFT JOIN gepafin_schema.company c
|
||||||
|
ON a.company_id = c.id
|
||||||
|
|
||||||
|
WHERE aa.is_deleted IS FALSE OR aa.is_deleted IS NULL;
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Testo Breve"},{"name":"placeholder","value":""},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 1;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Testo Lungo"},{"name":"placeholder","value":""},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 2;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Testo Formattato"},{"name":"placeholder","value":""},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]',
|
||||||
|
validators = '{"isRequired":false,"minLength":null,"maxLength":null,"custom":null}'
|
||||||
|
WHERE id = 3;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Numero"},{"name":"placeholder","value":0},{"name":"step","value":0},{"name":"isRequestedAmount","value":false},{"name":"variable","value":[]},{"name":"formula","value":""},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 4;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Scelta Singola"},{"name":"options","value":[]},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 5;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Menu a Tendina"},{"name":"options","value":[]},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 6;
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Scelta Multipla"},{"name":"options","value":[]},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 7;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Casella di Spunta"},{"name":"isChecklistItem","value":false},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 8;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Data"},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]',
|
||||||
|
validators = '{"isRequired":false,"custom":null}'
|
||||||
|
WHERE id = 9;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Caricamento File"},{"name":"mime","value":[]},{"name":"isDelegation","value":false}]',
|
||||||
|
validators = '{"isRequired":false,"maxSize":100000,"custom":null}'
|
||||||
|
WHERE id = 10;
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Partita IVA"},{"name":"placeholder","value":""},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 11;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Codice Fiscale"},{"name":"placeholder","value":""},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 12;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"CAP"},{"name":"placeholder","value":""},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 13;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"IBAN"},{"name":"placeholder","value":""},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 14;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Campo Email"},{"name":"placeholder","value":"nome@esempio.it"},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 15;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Campo PEC"},{"name":"placeholder","value":"nome@pec.it"},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 16;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Indirizzo URL"},{"name":"placeholder","value":""},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 17;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Marca da bollo"},{"name":"placeholder","value":"Numero identificativo"},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 18;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Tabella"},{"name":"table_columns","value":{}},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]',
|
||||||
|
validators = '{"custom":"nonEmptyTables"}'
|
||||||
|
WHERE id = 20;
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Tabella"},{"name":"criteria_table_columns","value":{}},{"name":"variable","value":[]},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 21;
|
||||||
|
|
||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET settings = '[{"name":"label","value":"Casella di Spunta"},{"name":"isChecklistItem","value":true},{"name":"reportEnable","value":false},{"name":"reportHeader","value":""}]'
|
||||||
|
WHERE id = 22;
|
||||||
@@ -60,7 +60,8 @@ status.same.error=Status is already set.
|
|||||||
invalid.status.change.from.draft=Status cannot be changed to READY_TO_PUBLISH or PUBLISH from DRAFT.
|
invalid.status.change.from.draft=Status cannot be changed to READY_TO_PUBLISH or PUBLISH from DRAFT.
|
||||||
status.cannot.be.changed=Status cannot be changed.
|
status.cannot.be.changed=Status cannot be changed.
|
||||||
published.call.not.update=Published call cannot be updated.
|
published.call.not.update=Published call cannot be updated.
|
||||||
invalid.status.change.from.publish=Status cannot be changed to READY_TO_PUBLISH or DRAFT from PUBLISH.
|
invalid.status.change.from.publish=Status cannot be changed to READY_TO_PUBLISH from PUBLISH.
|
||||||
|
invalid.status.change.from.publish.to.draft=Status cannot be changed to DRAFT from PUBLISH as Applications are already created for this CALL.
|
||||||
validation.table.message=Data for field {0} is not present.
|
validation.table.message=Data for field {0} is not present.
|
||||||
|
|
||||||
|
|
||||||
@@ -398,3 +399,4 @@ error.invalid.limit=Limit should be between 1 and 3000.
|
|||||||
insufficient.score.msg = Insufficient score to pass to the technical and economic-financial evaluation
|
insufficient.score.msg = Insufficient score to pass to the technical and economic-financial evaluation
|
||||||
|
|
||||||
password.expired.for.login.to.odessa = Odessa login password has been expired.
|
password.expired.for.login.to.odessa = Odessa login password has been expired.
|
||||||
|
invalid.user=Invalid user.
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ status.same.error=Lo stato ? gi? impostato.
|
|||||||
invalid.status.change.from.draft=Lo stato non pu? essere cambiato in READY_TO_PUBLISH o PUBLISH da DRAFT.
|
invalid.status.change.from.draft=Lo stato non pu? essere cambiato in READY_TO_PUBLISH o PUBLISH da DRAFT.
|
||||||
status.cannot.be.changed=Lo stato non pu? essere cambiato.
|
status.cannot.be.changed=Lo stato non pu? essere cambiato.
|
||||||
published.call.not.update=Il bando pubblicato non pu? essere aggiornato.
|
published.call.not.update=Il bando pubblicato non pu? essere aggiornato.
|
||||||
invalid.status.change.from.publish=Lo stato non pu? essere modificato in READY_TO_PUBLISH o DRAFT da PUBLISH.
|
invalid.status.change.from.publish=Lo stato non pu? essere modificato in READY_TO_PUBLISH da PUBLISH.
|
||||||
|
invalid.status.change.from.publish.to.draft=Lo stato non pu essere modificato da PUBLISH a DRAFT poich sono gi state create applicazioni per questa CALL.
|
||||||
|
|
||||||
# Login-related messages
|
# Login-related messages
|
||||||
login.successfully=Accesso effettuato con successo.
|
login.successfully=Accesso effettuato con successo.
|
||||||
@@ -390,3 +390,4 @@ insufficient.score.msg = Punteggio non sufficiente per passaggio alla valutazion
|
|||||||
validation.table.message=I dati per il campo {0} non sono presenti.
|
validation.table.message=I dati per il campo {0} non sono presenti.
|
||||||
|
|
||||||
password.expired.for.login.to.odessa = La password di accesso a Odessa è scaduta
|
password.expired.for.login.to.odessa = La password di accesso a Odessa è scaduta
|
||||||
|
invalid.user=Utente non valido.
|
||||||
Reference in New Issue
Block a user