Merge pull request #254 from Kitzanos/feature/GEPAFINBE-194
GEPAFINBE-194 (Create View for Application)
This commit is contained in:
@@ -503,6 +503,8 @@ 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";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -129,8 +129,6 @@ public class ApplicationDao {
|
|||||||
@Value("${rinaldo_email}")
|
@Value("${rinaldo_email}")
|
||||||
private String rinaldoEmail;
|
private String rinaldoEmail;
|
||||||
|
|
||||||
@Value("${carlo_email}")
|
|
||||||
private String carloEmail;
|
|
||||||
|
|
||||||
@Value("${call.id}")
|
@Value("${call.id}")
|
||||||
private String callId;
|
private String callId;
|
||||||
@@ -195,6 +193,9 @@ public class ApplicationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationViewRepository applicationViewRepository;
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
@@ -1632,7 +1633,7 @@ public class ApplicationDao {
|
|||||||
MatchModeEnum matchMode = filterCriteria.getMatchMode();
|
MatchModeEnum matchMode = filterCriteria.getMatchMode();
|
||||||
|
|
||||||
if (value != null && matchMode != null) {
|
if (value != null && matchMode != null) {
|
||||||
Path<?> fieldPath = getFieldPath(root, fieldName);
|
Path<?> fieldPath = root.get(fieldName);
|
||||||
if (fieldPath != null) {
|
if (fieldPath != null) {
|
||||||
Utils.applyStringFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
|
Utils.applyStringFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
|
||||||
Utils.applyNumberFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
|
Utils.applyNumberFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
|
||||||
@@ -1646,21 +1647,21 @@ public class ApplicationDao {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private Path<?> getFieldPath(Root<?> root, String fieldName) {
|
// private Path<?> getFieldPath(Root<?> root, String fieldName) {
|
||||||
try {
|
// try {
|
||||||
return switch (fieldName) {
|
// return switch (fieldName) {
|
||||||
case GepafinConstant.CALL_ID -> root.get(GepafinConstant.CALL).get(GepafinConstant.ID);
|
//// case GepafinConstant.CALL_ID -> root.get(GepafinConstant.CALL).get(GepafinConstant.ID);
|
||||||
case GepafinConstant.CALL_TITLE -> root.get(GepafinConstant.CALL).get(GepafinConstant.NAME);
|
//// case GepafinConstant.CALL_TITLE -> root.get(GepafinConstant.CALL).get(GepafinConstant.NAME);
|
||||||
case GepafinConstant.CALL_END_DATE -> root.get(GepafinConstant.CALL).get(GepafinConstant.END_DATE);
|
//// case GepafinConstant.CALL_END_DATE -> root.get(GepafinConstant.CALL).get(GepafinConstant.END_DATE);
|
||||||
case GepafinConstant.CALL_END_TIME -> root.get(GepafinConstant.CALL).get(GepafinConstant.END_TIME);
|
//// case GepafinConstant.CALL_END_TIME -> root.get(GepafinConstant.CALL).get(GepafinConstant.END_TIME);
|
||||||
case GepafinConstant.MODIFIED_DATE -> root.get(GepafinConstant.CALL).get(GepafinConstant.UPDATED_DATE);
|
//// case GepafinConstant.MODIFIED_DATE -> root.get(GepafinConstant.CALL).get(GepafinConstant.UPDATED_DATE);
|
||||||
case GepafinConstant.PROTOCOL_NUMBER-> root.get(GepafinConstant.PROTOCOL).get(GepafinConstant.PROTOCOL_NUMBER);
|
//// case GepafinConstant.PROTOCOL_NUMBER-> root.get(GepafinConstant.PROTOCOL).get(GepafinConstant.PROTOCOL_NUMBER);
|
||||||
default -> root.get(fieldName);
|
// default -> root.get(fieldName);
|
||||||
};
|
// };
|
||||||
} catch (IllegalArgumentException e) {
|
// } catch (IllegalArgumentException e) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
public void checkCallEndDate(CallEntity call) {
|
public void checkCallEndDate(CallEntity call) {
|
||||||
@@ -1816,4 +1817,199 @@ public class ApplicationDao {
|
|||||||
}
|
}
|
||||||
return application;
|
return application;
|
||||||
}
|
}
|
||||||
|
public PageableResponseBean<List<ApplicationResponse>> getAllApplicationByPaginationByView(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<ApplicationView> spec = searchByView(callId,companyId, userWithCompanyId, applicationPageableRequestBean, userEntity);
|
||||||
|
Page<ApplicationView> entityPage = applicationViewRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||||
|
// Prepare the response
|
||||||
|
|
||||||
|
|
||||||
|
List<ApplicationResponse> applicationResponses = entityPage.getContent().stream()
|
||||||
|
.map(application -> {
|
||||||
|
ApplicationResponse response = getApplicationResponseByView(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<ApplicationView> searchByView(Long callId, Long companyId, Long userWithCompanyId, ApplicationPageableRequestBean applicationPageableRequestBean, UserEntity userEntity) {
|
||||||
|
return (root, query, criteriaBuilder) -> {
|
||||||
|
|
||||||
|
List<Predicate> predicates = getPredicatesByView(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> getPredicatesByView(ApplicationPageableRequestBean applicationPageableRequestBean,
|
||||||
|
CriteriaBuilder criteriaBuilder, Root<ApplicationView> 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_TITLE)), // 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_ID), callId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional companyId filter
|
||||||
|
if (userWithCompanyId != null) {
|
||||||
|
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_WITH_COMPANY_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 ApplicationResponse getApplicationResponseByView(ApplicationView applicationView) {
|
||||||
|
ApplicationResponse responseBean = new ApplicationResponse();
|
||||||
|
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findByCallId(applicationView.getCallId());
|
||||||
|
Long totalFormSteps = flowFormDao.calculateTotalSteps(flowEdgesList);
|
||||||
|
Long completedSteps= Long.valueOf(flowFormDao.getCompletedStepsByView(applicationView.getId(), false));
|
||||||
|
Integer progress = calculateProgress(totalFormSteps, completedSteps);
|
||||||
|
responseBean.setId(applicationView.getId());
|
||||||
|
responseBean.setProgress(progress);
|
||||||
|
responseBean.setCallTitle(applicationView.getCallTitle());
|
||||||
|
responseBean.setCallEndDate(applicationView.getCallEndDate());
|
||||||
|
responseBean.setCallEndTime(applicationView.getCallEndTime());
|
||||||
|
responseBean.setModifiedDate(applicationView.getModifiedDate());
|
||||||
|
responseBean.setCallId(applicationView.getCallId());
|
||||||
|
responseBean.setSubmissionDate(applicationView.getSubmissionDate());
|
||||||
|
responseBean.setStatus(applicationView.getStatus());
|
||||||
|
responseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(applicationView.getEvaluationVersion()));
|
||||||
|
responseBean.setComments(applicationView.getComments());
|
||||||
|
responseBean.setCompanyId(applicationView.getCompanyId());
|
||||||
|
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
|
||||||
|
assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationView.getId());
|
||||||
|
if(assignedApplicationsOptional.isPresent()){
|
||||||
|
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.setAmountAccepted(applicationView.getAmountAccepted());
|
||||||
|
responseBean.setAmountRequested(applicationView.getAmountRequested());
|
||||||
|
responseBean.setDateAccepted(applicationView.getDateAccepted());
|
||||||
|
responseBean.setDateRejected(applicationView.getDateRejected());
|
||||||
|
return responseBean;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -369,5 +369,17 @@ public class FlowFormDao {
|
|||||||
return getNextForm(currentFormEntity, applicationEntity);
|
return getNextForm(currentFormEntity, applicationEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getCompletedStepsByView(Long applicationId, Boolean isSendValidationError) {
|
||||||
|
Integer completedSteps=0;
|
||||||
|
List<ApplicationFormEntity> applicationFormList = applicationFormRepository.findByApplicationId(applicationId);
|
||||||
|
List<ApplicationFormFieldEntity> applicationFormFieldEntities=new ArrayList<>();
|
||||||
|
for (ApplicationFormEntity applicationFormEntity:applicationFormList){
|
||||||
|
applicationFormFieldEntities=applicationFormFieldRepository.findByApplicationFormId(applicationFormEntity.getId());
|
||||||
|
Boolean isCompleted=formDao.validateCompletedSteps(applicationFormFieldEntities, null, applicationFormEntity.getForm(), isSendValidationError);
|
||||||
|
if(Boolean.TRUE.equals(isCompleted)){
|
||||||
|
completedSteps++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return completedSteps;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.Immutable;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Immutable
|
||||||
|
@Table(name = "application_view")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@IdClass(ApplicationViewId.class)
|
||||||
|
public class ApplicationView implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "STATUS")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Column(name = "IS_DELETED")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
|
||||||
|
@Column(name = "USER_ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Column(name = "SUBMISSION_DATE")
|
||||||
|
private LocalDateTime submissionDate;
|
||||||
|
|
||||||
|
@Column(name ="COMMENTS")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@Column(name = "AMOUNT_REQUESTED")
|
||||||
|
private BigDecimal amountRequested;
|
||||||
|
|
||||||
|
@Column(name = "AMOUNT_ACCEPTED")
|
||||||
|
private BigDecimal amountAccepted;
|
||||||
|
|
||||||
|
@Column(name = "DATE_ACCEPTED")
|
||||||
|
private LocalDateTime dateAccepted;
|
||||||
|
|
||||||
|
@Column(name = "DATE_REJECTED")
|
||||||
|
private LocalDateTime dateRejected;
|
||||||
|
|
||||||
|
@Column(name = "EVALUATION_VERSION")
|
||||||
|
private String evaluationVersion;
|
||||||
|
|
||||||
|
@Column(name = "CALL_ID")
|
||||||
|
private Long callId;
|
||||||
|
|
||||||
|
@Column(name = "CALL_TITLE")
|
||||||
|
private String callTitle;
|
||||||
|
|
||||||
|
@Column(name = "CALL_END_DATE")
|
||||||
|
private LocalDateTime callEndDate;
|
||||||
|
|
||||||
|
@Column(name = "CALL_END_TIME")
|
||||||
|
private LocalTime callEndTime;
|
||||||
|
|
||||||
|
@Column(name = "MODIFIED_DATE")
|
||||||
|
private LocalDateTime modifiedDate;
|
||||||
|
|
||||||
|
@Column(name = "COMPANY_ID")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@Column(name = "USER_WITH_COMPANY_ID")
|
||||||
|
private Long userWithCompanyId;
|
||||||
|
|
||||||
|
@Column(name = "COMPANY_NAME")
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
@Column(name = "PROTOCOL_NUMBER")
|
||||||
|
private Long protocolNumber;
|
||||||
|
|
||||||
|
@Column(name = "ASSIGNED_USER_ID")
|
||||||
|
private Long assigned_user_id;
|
||||||
|
|
||||||
|
@Column(name = "ASSIGNED_USER_NAME")
|
||||||
|
private String assignedUserName;
|
||||||
|
|
||||||
|
@Column(name = "HUB_ID")
|
||||||
|
private Long hubId;
|
||||||
|
|
||||||
|
@Column(name = "CREATED_DATE")
|
||||||
|
private LocalDateTime createdDate;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationViewId {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public ApplicationViewId() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationViewId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationView;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
||||||
|
public interface ApplicationViewRepository extends JpaRepository<ApplicationView,Long> , JpaSpecificationExecutor<ApplicationView> {
|
||||||
|
}
|
||||||
@@ -144,7 +144,7 @@ public class ApplicationServiceImpl implements ApplicationService {
|
|||||||
if (companyId != null) {
|
if (companyId != null) {
|
||||||
validator.validateUserWithCompany(request, companyId);
|
validator.validateUserWithCompany(request, companyId);
|
||||||
}
|
}
|
||||||
return applicationDao.getAllApplicationByPagination(userEntity,callId,companyId,applicationPageableRequestBean);
|
return applicationDao.getAllApplicationByPaginationByView(userEntity,callId,companyId,applicationPageableRequestBean);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ isPecServiceEnabled = false
|
|||||||
#default_System_Receiver_Email=antonio.manca@bflows.net
|
#default_System_Receiver_Email=antonio.manca@bflows.net
|
||||||
gepafin_email=rinaldo.bonazzo@bflows.net
|
gepafin_email=rinaldo.bonazzo@bflows.net
|
||||||
rinaldo_email=rinaldo.bonazzo@bflows.net
|
rinaldo_email=rinaldo.bonazzo@bflows.net
|
||||||
carlo_email=test@test.test
|
|
||||||
default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
|
default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
|
||||||
|
|
||||||
#Login to Odessa, Appointment Creation, Upload document Configuration
|
#Login to Odessa, Appointment Creation, Upload document Configuration
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ isPecServiceEnabled = false
|
|||||||
#default_System_Receiver_Email=test@test.test
|
#default_System_Receiver_Email=test@test.test
|
||||||
gepafin_email=test@test.test
|
gepafin_email=test@test.test
|
||||||
rinaldo_email=test@test.test
|
rinaldo_email=test@test.test
|
||||||
carlo_email=test@test.test
|
|
||||||
default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
|
default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
|
||||||
|
|
||||||
appointment.base.url=https://demo.galileonetwork.it/gateway/rest
|
appointment.base.url=https://demo.galileonetwork.it/gateway/rest
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ isPecServiceEnabled = true
|
|||||||
#default_System_Receiver_Email=m.gaudino@gepafin.it,f.marinelli@gepafin.it
|
#default_System_Receiver_Email=m.gaudino@gepafin.it,f.marinelli@gepafin.it
|
||||||
gepafin_email=bandi@pec.gepafin.it
|
gepafin_email=bandi@pec.gepafin.it
|
||||||
rinaldo_email=rinaldo.bonazzo@bflows.net
|
rinaldo_email=rinaldo.bonazzo@bflows.net
|
||||||
carlo_email=carlo.mancosu@bflows.net
|
|
||||||
default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
|
default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
|
||||||
# TEST DEPLOY Configuration
|
# TEST DEPLOY Configuration
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ isPecServiceEnabled = false
|
|||||||
#default_System_Receiver_Email=test@test.test
|
#default_System_Receiver_Email=test@test.test
|
||||||
gepafin_email=test@test.test
|
gepafin_email=test@test.test
|
||||||
rinaldo_email=test@test.test
|
rinaldo_email=test@test.test
|
||||||
carlo_email=test@test.test
|
|
||||||
default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
|
default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
|
||||||
|
|
||||||
appointment.base.url=https://demo.galileonetwork.it/gateway/rest
|
appointment.base.url=https://demo.galileonetwork.it/gateway/rest
|
||||||
|
|||||||
@@ -2675,6 +2675,10 @@
|
|||||||
</insert>
|
</insert>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="25-03-2025_NK_160730" author="Nisha Kashyap">
|
||||||
|
<sqlFile dbms="postgresql"
|
||||||
|
path="db/dump/create_application_view.sql"/>
|
||||||
|
</changeSet>
|
||||||
<changeSet id="25-03-2025_PK_193115" author="Piyush Kag">
|
<changeSet id="25-03-2025_PK_193115" author="Piyush Kag">
|
||||||
<insert tableName="s3_path_configuration">
|
<insert tableName="s3_path_configuration">
|
||||||
<column name="type" value="DELETED_USER_SIGNED_DOCUMENT"/>
|
<column name="type" value="DELETED_USER_SIGNED_DOCUMENT"/>
|
||||||
|
|||||||
@@ -13,10 +13,13 @@
|
|||||||
BEGIN
|
BEGIN
|
||||||
-- Loop through all tables in the schema that have the 'updated_date' column
|
-- Loop through all tables in the schema that have the 'updated_date' column
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT table_name
|
SELECT c.table_name
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns c
|
||||||
WHERE column_name = 'updated_date'
|
JOIN information_schema.tables t
|
||||||
AND table_schema = 'gepafin_schema'
|
ON c.table_name = t.table_name AND c.table_schema = t.table_schema
|
||||||
|
WHERE c.column_name = 'updated_date'
|
||||||
|
AND c.table_schema = 'gepafin_schema'
|
||||||
|
AND t.table_type = 'BASE TABLE' -- Excludes views
|
||||||
)
|
)
|
||||||
LOOP
|
LOOP
|
||||||
EXECUTE format(
|
EXECUTE format(
|
||||||
@@ -30,10 +33,13 @@
|
|||||||
|
|
||||||
-- Loop through all tables in the schema that have the 'created_date' column
|
-- Loop through all tables in the schema that have the 'created_date' column
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT table_name
|
SELECT c.table_name
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns c
|
||||||
WHERE column_name = 'created_date'
|
JOIN information_schema.tables t
|
||||||
AND table_schema = 'gepafin_schema'
|
ON c.table_name = t.table_name AND c.table_schema = t.table_schema
|
||||||
|
WHERE c.column_name = 'created_date'
|
||||||
|
AND c.table_schema = 'gepafin_schema'
|
||||||
|
AND t.table_type = 'BASE TABLE' -- Excludes views
|
||||||
)
|
)
|
||||||
LOOP
|
LOOP
|
||||||
EXECUTE format(
|
EXECUTE format(
|
||||||
|
|||||||
81
src/main/resources/db/dump/create_application_view.sql
Normal file
81
src/main/resources/db/dump/create_application_view.sql
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
CREATE OR REPLACE VIEW application_view AS
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.status,
|
||||||
|
a.submission_date,
|
||||||
|
a.comments,
|
||||||
|
a.amount_requested,
|
||||||
|
a.amount_accepted,
|
||||||
|
a.date_accepted,
|
||||||
|
a.date_rejected,
|
||||||
|
a.is_deleted,
|
||||||
|
a.hub_id,
|
||||||
|
a.user_id,
|
||||||
|
a.evaluation_version AS evaluation_version,
|
||||||
|
a.updated_date AS modified_date,
|
||||||
|
a.created_date AS created_date,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Call Details
|
||||||
|
a.call_id AS call_id,
|
||||||
|
cl.name AS call_title,
|
||||||
|
cl.end_date AS call_end_date,
|
||||||
|
cl.end_time AS call_end_time,
|
||||||
|
|
||||||
|
-- Company Details
|
||||||
|
a.COMPANY_ID AS company_id,
|
||||||
|
c.company_name AS company_name,
|
||||||
|
|
||||||
|
-- Protocol Details
|
||||||
|
p.protocol_number AS protocol_number,
|
||||||
|
|
||||||
|
|
||||||
|
-- Assigned User Details from ASSIGNED_APPLICATION and GEPPAFIN_USER
|
||||||
|
COALESCE(aa.user_id, NULL) AS assigned_user_id,
|
||||||
|
COALESCE(
|
||||||
|
NULLIF(
|
||||||
|
TRIM(CONCAT(
|
||||||
|
COALESCE(u.first_name, ''), ' ',
|
||||||
|
COALESCE(u.last_name, '')
|
||||||
|
)),
|
||||||
|
''
|
||||||
|
),
|
||||||
|
''
|
||||||
|
) AS assigned_user_name,
|
||||||
|
|
||||||
|
-- User with Company Details (From Application's User)
|
||||||
|
COALESCE(uwc.id, NULL) AS user_with_company_id
|
||||||
|
|
||||||
|
|
||||||
|
FROM gepafin_schema.APPLICATION a
|
||||||
|
|
||||||
|
-- Join Call Entity
|
||||||
|
LEFT JOIN gepafin_schema.CALL cl
|
||||||
|
ON a.CALL_ID = cl.id
|
||||||
|
|
||||||
|
-- Join Company Entity (Ensuring it is not deleted)
|
||||||
|
LEFT JOIN gepafin_schema.COMPANY c
|
||||||
|
ON a.COMPANY_ID = c.id
|
||||||
|
|
||||||
|
-- Join Protocol Entity
|
||||||
|
LEFT JOIN gepafin_schema.PROTOCOL p
|
||||||
|
ON a.PROTOCOL_NUMBER = p.id
|
||||||
|
|
||||||
|
-- Join Assigned Application Entity (Ensuring it is not deleted)
|
||||||
|
LEFT JOIN gepafin_schema.assigned_applications aa
|
||||||
|
ON a.id = aa.APPLICATION_ID
|
||||||
|
AND (aa.IS_DELETED IS FALSE OR aa.IS_DELETED IS NULL)
|
||||||
|
|
||||||
|
-- Join User Entity (Get First & Last Name Combined)
|
||||||
|
LEFT JOIN gepafin_schema.GEPAFIN_USER u
|
||||||
|
ON aa.user_id = u.id
|
||||||
|
|
||||||
|
-- Get User With Company ID (From Application's User & Company)
|
||||||
|
LEFT JOIN gepafin_schema.USER_WITH_COMPANY uwc
|
||||||
|
ON a.user_id = uwc.user_id
|
||||||
|
AND a.COMPANY_ID = uwc.company_id
|
||||||
|
AND uwc.is_deleted = FALSE -- Ensuring the user is active
|
||||||
|
|
||||||
|
WHERE a.IS_DELETED IS FALSE OR a.IS_DELETED IS NULL;
|
||||||
Reference in New Issue
Block a user