Resolved conflicts
This commit is contained in:
@@ -391,6 +391,16 @@ public class GepafinConstant {
|
|||||||
public static final String NON_EMPTY_TABLES="nonEmptyTables";
|
public static final String NON_EMPTY_TABLES="nonEmptyTables";
|
||||||
public static final String VALIDATION_IN_TABLE = "validation.table.message";
|
public static final String VALIDATION_IN_TABLE = "validation.table.message";
|
||||||
public static final String CALL_EXPIRED="call.expired";
|
public static final String CALL_EXPIRED="call.expired";
|
||||||
|
public static final String PROTOCOL="protocol";
|
||||||
|
public static final String PROTOCOL_NUMBER="protocolNumber";
|
||||||
|
public static final String NOTE="note";
|
||||||
|
public static final String INTERNAL_NOTE="internalNote";
|
||||||
|
public static final String ACTION_TYPE="actionType";
|
||||||
|
public static final String ACTION_CONTEXT="actionContext";
|
||||||
|
public static final String METHOD_TYPE="methodType";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero";
|
public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero";
|
||||||
|
|
||||||
|
|
||||||
@@ -424,6 +434,34 @@ public class GepafinConstant {
|
|||||||
public static final String FORMULA_AMOUNT_NOT_MATCHED="formula.amount.not.matches.requested.amount";
|
public static final String FORMULA_AMOUNT_NOT_MATCHED="formula.amount.not.matches.requested.amount";
|
||||||
public static final String CRITERIA_TABLE_COLUMNS="criteria_table_columns";
|
public static final String CRITERIA_TABLE_COLUMNS="criteria_table_columns";
|
||||||
|
|
||||||
|
public static final String COMPANY_DOCUMENT_NOT_FOUND = "company.document.not.found";
|
||||||
|
public static final String COMPANY_DOCUMENT_UPDATED_SUCCESSFULLY = "company.document.updated.successfully";
|
||||||
|
public static final String COMPANY_DOCUMENT_COPIED_SUCCESSFULLY = "company.document.copied.successfully";
|
||||||
|
public static final String COMPANY_DOCUMENT_FETCHED_SUCCESSFULLY = "company.document.fetched.successfully";
|
||||||
|
|
||||||
|
public static final String DOCUMENT_CATEGORY_CREATE_SUCCESS = "document.category.success";
|
||||||
|
public static final String DOCUMENT_CATEGORY_GET_SUCCESS = "document.category.get.success";
|
||||||
|
public static final String DOCUMENT_CATEGORY_NOT_FOUND = "document.category.not.found";
|
||||||
|
public static final String DOCUMENT_CATEGORY_DELETE_SUCCESS = "document.category.delete.success";
|
||||||
|
public static final String DOCUMENT_CATEGORY_UPDATE_SUCCESS = "document.category.update.success";
|
||||||
|
public static final String ERROR_MOVING_FILE_TO_DELETED_FOLDER = "error.moving.file.to.deleted.folder";
|
||||||
|
|
||||||
|
public static final String CATEGORY_CANNOT_BE_DELETED = "category.cannot.be.deleted";
|
||||||
|
public static final String INVALID_EXPIRATION_DATE = "invalid.expiration.date";
|
||||||
|
public static final String LABEL="label";
|
||||||
|
public static final String FORMULA="formula";
|
||||||
|
public static final String VARIABLE="variable";
|
||||||
|
public static final String TOTAL="total";
|
||||||
|
public static final String NUMBER_INPUT="numberinput";
|
||||||
|
public static final String CHECK_BOXES="checkboxes";
|
||||||
|
public static final String VALIDATION_FIELD_MAX = "validation.field.max_value";
|
||||||
|
public static final String VALIDATION_FIELD_MIN = "validation.field.min_value";
|
||||||
|
public static final String VALIDATION_FIELD_MAX_CHECK_BOX = "validation.field.max.checkbox";
|
||||||
|
public static final String VALIDATION_FIELD_MIN_CHECK_BOX = "validation.field.min.checkbox";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static final String APPOINTMENT_CANNOT_BE_CREATED = "appointment.cannot.be.created";
|
public static final String APPOINTMENT_CANNOT_BE_CREATED = "appointment.cannot.be.created";
|
||||||
public static final String APPOINTMENT_NOT_CREATED = "appointment.not.created";
|
public static final String APPOINTMENT_NOT_CREATED = "appointment.not.created";
|
||||||
|
|
||||||
@@ -431,14 +469,21 @@ public class GepafinConstant {
|
|||||||
public static final String CALL_ID="callId";
|
public static final String CALL_ID="callId";
|
||||||
public static final String CALL_END_DATE="callEndDate";
|
public static final String CALL_END_DATE="callEndDate";
|
||||||
public static final String END_DATE="endDate";
|
public static final String END_DATE="endDate";
|
||||||
public static final String PROTOCOL="protocol";
|
|
||||||
public static final String PROTOCOL_NUMBER="protocolNumber";
|
|
||||||
public static final String MODIFIED_DATE="modifiedDate";
|
public static final String MODIFIED_DATE="modifiedDate";
|
||||||
public static final String CALL_END_TIME="callEndTime";
|
public static final String CALL_END_TIME="callEndTime";
|
||||||
public static final String END_TIME="endTime";
|
public static final String END_TIME="endTime";
|
||||||
public static final String UPDATED_DATE="updatedDate";
|
public static final String UPDATED_DATE="updatedDate";
|
||||||
|
|
||||||
|
public static final String SWITCH="switch";
|
||||||
|
public static final String IS_CHECK_LIST_ITEM="isChecklistItem";
|
||||||
|
public static final String VALIDATION_FAILED_FOR_CHECKLIST="validation.failed.checklist";
|
||||||
|
public static final String PEC_SERVICE_URL="https://ws.pecmassiva.com";
|
||||||
|
public static final String PEC_SERVICE_SEND_MAIL="/send";
|
||||||
|
public static final String PEC_SERVICE_INBOX_MAIL="/quota/inbox";
|
||||||
|
public static final String USAGE="usage";
|
||||||
|
public static final String LIMIT="limit";
|
||||||
|
public static final String DATA="data";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package net.gepafin.tendermanagement.dao;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Join;
|
import jakarta.persistence.criteria.Join;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.persistence.criteria.Root;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
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;
|
||||||
@@ -12,6 +14,7 @@ import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity.SystemEm
|
|||||||
import net.gepafin.tendermanagement.enums.*;
|
import net.gepafin.tendermanagement.enums.*;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
|
import net.gepafin.tendermanagement.model.util.SortBy;
|
||||||
import net.gepafin.tendermanagement.repositories.*;
|
import net.gepafin.tendermanagement.repositories.*;
|
||||||
import net.gepafin.tendermanagement.service.*;
|
import net.gepafin.tendermanagement.service.*;
|
||||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||||
@@ -25,6 +28,8 @@ import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -37,6 +42,7 @@ import java.util.stream.Collectors;
|
|||||||
import static java.time.temporal.ChronoUnit.DAYS;
|
import static java.time.temporal.ChronoUnit.DAYS;
|
||||||
import static net.gepafin.tendermanagement.util.Utils.log;
|
import static net.gepafin.tendermanagement.util.Utils.log;
|
||||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class ApplicationAmendmentRequestDao {
|
public class ApplicationAmendmentRequestDao {
|
||||||
@@ -119,6 +125,15 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserRepository userRepository;
|
private UserRepository userRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EvaluationFormRepository evaluationFormRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationEvaluationFormFieldRepository applicationEvaluationFormFieldRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationEvaluationFormRepository applicationEvaluationFormRepository;
|
||||||
|
|
||||||
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);
|
||||||
@@ -132,16 +147,10 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
if(file != null){
|
if(file != null){
|
||||||
evaluationFileRequests=Utils.convertJsonStringToList(file,FieldRequest.class);
|
evaluationFileRequests=Utils.convertJsonStringToList(file,FieldRequest.class);
|
||||||
}
|
}
|
||||||
Boolean allValid = evaluationFileRequests.stream()
|
if(applicationEvaluationEntity.getEvaluationVersion().equals(EvaluationVersionEnum.V1.getValue())) {
|
||||||
.anyMatch(fieldRequest -> fieldRequest.getValid() == null);
|
checklistValidationForEvaluationV1(evaluationFileRequests, checkList, checklistRequests);
|
||||||
if(checkList != null) {
|
} else if (applicationEvaluationEntity.getEvaluationVersion().equals(EvaluationVersionEnum.V2.getValue())) {
|
||||||
checklistRequests=Utils.convertJsonStringToList(checkList,ChecklistRequest.class);
|
validationCheckEvaluationV2(applicationEvaluationEntity, application);
|
||||||
}
|
|
||||||
boolean resultCheckList = checklistRequests.stream()
|
|
||||||
.anyMatch(checklistRequest -> Boolean.TRUE.equals(checklistRequest.getValid())) ? false : true;
|
|
||||||
|
|
||||||
if(Boolean.TRUE.equals(allValid) || Boolean.TRUE.equals(resultCheckList)){
|
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.All_DOCUMENT_CHECKED_AND_ONE_CHECKLIST_CHECKED));
|
|
||||||
}
|
}
|
||||||
// Set common application-level details
|
// Set common application-level details
|
||||||
String callName = application.getCall().getName();
|
String callName = application.getCall().getName();
|
||||||
@@ -186,6 +195,47 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validationCheckEvaluationV2(ApplicationEvaluationEntity applicationEvaluationEntity, ApplicationEntity application) {
|
||||||
|
Long callId= applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication().getCall().getId();
|
||||||
|
EvaluationFormEntity evaluationFormEntity=evaluationFormRepository.findByCallIdAndIsDeletedFalse(callId);
|
||||||
|
Long numberOfCheck= application.getCall().getNumberOfCheck();
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationForm=applicationEvaluationFormRepository.findByApplicationEvaluation_IdAndIsDeletedFalse(applicationEvaluationEntity.getId());
|
||||||
|
List<ContentResponseBean> contentResponseBeans=Utils.convertJsonStringToList(evaluationFormEntity.getContent(),ContentResponseBean.class);
|
||||||
|
int count = 0;
|
||||||
|
for (ContentResponseBean content : contentResponseBeans) {
|
||||||
|
if (GepafinConstant.SWITCH.equals(content.getName()) && content.getSettings().stream()
|
||||||
|
.anyMatch(setting -> GepafinConstant.IS_CHECK_LIST_ITEM.equals(setting.getName()))) {
|
||||||
|
|
||||||
|
ApplicationEvaluationFormFieldEntity field = applicationEvaluationFormFieldRepository
|
||||||
|
.findByFieldIdAndApplicationEvaluationFormId(content.getId(), applicationEvaluationForm.getId());
|
||||||
|
|
||||||
|
if (field != null && Utils.isValidBoolean(field.getFieldValue())) {
|
||||||
|
Boolean fieldValueAsBoolean = Boolean.parseBoolean(field.getFieldValue());
|
||||||
|
|
||||||
|
if (Boolean.FALSE.equals(fieldValueAsBoolean)) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR,GepafinConstant.VALIDATION_FAILED_FOR_CHECKLIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (++count >= numberOfCheck) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void checklistValidationForEvaluationV1(List<FieldRequest> evaluationFileRequests, String checkList, List<ChecklistRequest> checklistRequests) {
|
||||||
|
Boolean allValid = evaluationFileRequests.stream()
|
||||||
|
.anyMatch(fieldRequest -> fieldRequest.getValid() == null);
|
||||||
|
if(checkList != null) {
|
||||||
|
checklistRequests =Utils.convertJsonStringToList(checkList,ChecklistRequest.class);
|
||||||
|
}
|
||||||
|
boolean resultCheckList = checklistRequests.stream()
|
||||||
|
.anyMatch(checklistRequest -> Boolean.TRUE.equals(checklistRequest.getValid())) ? false : true;
|
||||||
|
|
||||||
|
if(Boolean.TRUE.equals(allValid) || Boolean.TRUE.equals(resultCheckList)){
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.All_DOCUMENT_CHECKED_AND_ONE_CHECKLIST_CHECKED));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<AmendmentFormFieldResponse> getIdAndLabelFromResult(List<Map<String, Object>> result) {
|
public List<AmendmentFormFieldResponse> getIdAndLabelFromResult(List<Map<String, Object>> result) {
|
||||||
List<AmendmentFormFieldResponse> formFieldResponses = new ArrayList<>();
|
List<AmendmentFormFieldResponse> formFieldResponses = new ArrayList<>();
|
||||||
@@ -1214,4 +1264,118 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
documentService.deleteFile(documentId);
|
documentService.deleteFile(documentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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())) {
|
||||||
|
predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("application").get("userId").in(userId));
|
||||||
|
}
|
||||||
|
if (Boolean.FALSE.equals(validator.checkIsBeneficiary())) {
|
||||||
|
predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("userId").in(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
return predicates;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,8 +118,8 @@ public class ApplicationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AssignedApplicationsRepository assignedApplicationsRepository;
|
private AssignedApplicationsRepository assignedApplicationsRepository;
|
||||||
|
|
||||||
@Value("${default_System_Receiver_Email}")
|
// @Value("${default_System_Receiver_Email}")
|
||||||
private String defaultSystemReceiverEmail;
|
// private String defaultSystemReceiverEmail;
|
||||||
|
|
||||||
@Value("${rinaldo_email}")
|
@Value("${rinaldo_email}")
|
||||||
private String rinaldoEmail;
|
private String rinaldoEmail;
|
||||||
@@ -1543,6 +1543,22 @@ public class ApplicationDao {
|
|||||||
criteriaBuilder.upper(root.get(GepafinConstant.COMMENTS)),
|
criteriaBuilder.upper(root.get(GepafinConstant.COMMENTS)),
|
||||||
"%" + search.toUpperCase() + "%"
|
"%" + 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));
|
predicates.add(criteriaBuilder.or(titlePredicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationExceptio
|
|||||||
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.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -28,6 +29,7 @@ import java.time.temporal.ChronoUnit;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static net.gepafin.tendermanagement.util.Utils.log;
|
import static net.gepafin.tendermanagement.util.Utils.log;
|
||||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||||
@@ -1967,7 +1969,9 @@ public class ApplicationEvaluationDao {
|
|||||||
//Handling Application Evaluation form
|
//Handling Application Evaluation form
|
||||||
EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
|
EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
|
||||||
validateFormFields(applicationEvaluationFormRequestBean,evaluationFormEntity);
|
validateFormFields(applicationEvaluationFormRequestBean,evaluationFormEntity);
|
||||||
|
// formService.validateFormField(applicationRequestBean.getFormFields(),applicationEntity,formEntity);
|
||||||
// ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationRepository.findByAssignedApplicationsId(assignedApplicationId);
|
// ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationRepository.findByAssignedApplicationsId(assignedApplicationId);
|
||||||
|
validateFormFieldCustom(applicationEvaluationFormRequestBean.getFormFields(),entity,evaluationFormEntity);
|
||||||
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,entity);
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,entity);
|
||||||
createOrUpdateMultipleFormFields(applicationEvaluationFormRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
|
createOrUpdateMultipleFormFields(applicationEvaluationFormRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
|
||||||
return processEvaluationForm(entity);
|
return processEvaluationForm(entity);
|
||||||
@@ -2023,17 +2027,20 @@ public class ApplicationEvaluationDao {
|
|||||||
|
|
||||||
public List<ApplicationEvaluationFormFieldEntity> createOrUpdateMultipleFormFields(List<ApplicationFormFieldRequestBean> formFieldRequestBeans,
|
public List<ApplicationEvaluationFormFieldEntity> createOrUpdateMultipleFormFields(List<ApplicationFormFieldRequestBean> formFieldRequestBeans,
|
||||||
ApplicationEvaluationFormEntity applicationEvaluationFormEntity, EvaluationFormEntity evaluationFormEntity) {
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity, EvaluationFormEntity evaluationFormEntity) {
|
||||||
|
FieldValidator fieldValidator = FieldValidator.create();
|
||||||
|
|
||||||
List<ApplicationEvaluationFormFieldEntity> existingFields = applicationEvaluationFormFieldRepository.findByApplicationEvaluationFormId(applicationEvaluationFormEntity.getId());
|
List<ApplicationEvaluationFormFieldEntity> existingFields = applicationEvaluationFormFieldRepository.findByApplicationEvaluationFormId(applicationEvaluationFormEntity.getId());
|
||||||
|
|
||||||
return formFieldRequestBeans.stream().map(requestBean -> createOrUpdateApplicationEvaluationFormField(requestBean, applicationEvaluationFormEntity, existingFields, evaluationFormEntity))
|
List<ApplicationEvaluationFormFieldEntity> applicationEvaluationFormFieldEntities= formFieldRequestBeans.stream().map(requestBean -> createOrUpdateApplicationEvaluationFormField(requestBean, applicationEvaluationFormEntity, existingFields, evaluationFormEntity,fieldValidator))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
fieldValidator.validate();
|
||||||
|
return applicationEvaluationFormFieldEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationEvaluationFormFieldEntity createOrUpdateApplicationEvaluationFormField(ApplicationFormFieldRequestBean applicationFormFieldRequestBean,
|
public ApplicationEvaluationFormFieldEntity createOrUpdateApplicationEvaluationFormField(ApplicationFormFieldRequestBean applicationFormFieldRequestBean,
|
||||||
ApplicationEvaluationFormEntity applicationEvaluationFormEntity,
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity,
|
||||||
List<ApplicationEvaluationFormFieldEntity> applicationEvaluationFormFieldEntities,
|
List<ApplicationEvaluationFormFieldEntity> applicationEvaluationFormFieldEntities,
|
||||||
EvaluationFormEntity evaluationFormEntity){
|
EvaluationFormEntity evaluationFormEntity,FieldValidator fieldValidator){
|
||||||
ApplicationEvaluationFormFieldEntity applicationEvaluationFormFieldEntity = new ApplicationEvaluationFormFieldEntity();
|
ApplicationEvaluationFormFieldEntity applicationEvaluationFormFieldEntity = new ApplicationEvaluationFormFieldEntity();
|
||||||
validateFileUploadDocuments(applicationFormFieldRequestBean, evaluationFormEntity);
|
validateFileUploadDocuments(applicationFormFieldRequestBean, evaluationFormEntity);
|
||||||
VersionActionTypeEnum actionType = VersionActionTypeEnum.INSERT;
|
VersionActionTypeEnum actionType = VersionActionTypeEnum.INSERT;
|
||||||
@@ -2056,7 +2063,8 @@ public class ApplicationEvaluationDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Utils.setIfUpdated(applicationEvaluationFormFieldEntity::getFieldId, applicationEvaluationFormFieldEntity::setFieldId, applicationFormFieldRequestBean.getFieldId());
|
Utils.setIfUpdated(applicationEvaluationFormFieldEntity::getFieldId, applicationEvaluationFormFieldEntity::setFieldId, applicationFormFieldRequestBean.getFieldId());
|
||||||
|
List<ContentResponseBean> contentBeans = Utils.convertJsonStringToList(evaluationFormEntity.getContent(), ContentResponseBean.class);
|
||||||
|
calculationProcessForFormula(applicationEvaluationFormEntity,contentBeans,applicationFormFieldRequestBean,fieldValidator);
|
||||||
if (applicationFormFieldRequestBean.getFieldValue() != null) {
|
if (applicationFormFieldRequestBean.getFieldValue() != null) {
|
||||||
applicationEvaluationFormFieldEntity.setFieldValue(Utils.convertObjectToJsonString(applicationFormFieldRequestBean.getFieldValue()));
|
applicationEvaluationFormFieldEntity.setFieldValue(Utils.convertObjectToJsonString(applicationFormFieldRequestBean.getFieldValue()));
|
||||||
} else {
|
} else {
|
||||||
@@ -2266,5 +2274,150 @@ public class ApplicationEvaluationDao {
|
|||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void calculationProcessForFormula(ApplicationEvaluationFormEntity applicationFormEntity, List<ContentResponseBean> contentResponseBeans, ApplicationFormFieldRequestBean applicationFormFieldRequestBean,FieldValidator fieldValidator) {
|
||||||
|
List<String> formulaValue = new ArrayList<>();
|
||||||
|
String formulaValueOpt=null;
|
||||||
|
String label=null;
|
||||||
|
for (ContentResponseBean contentResponseBean:contentResponseBeans){
|
||||||
|
if(contentResponseBean.getId().equals(applicationFormFieldRequestBean.getFieldId())){
|
||||||
|
for (SettingResponseBean settingResponseBean:contentResponseBean.getSettings()){
|
||||||
|
if (settingResponseBean.getName().equals(GepafinConstant.LABEL)){
|
||||||
|
label= String.valueOf(settingResponseBean.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settingResponseBean.getName().equals(GepafinConstant.FORMULA)){
|
||||||
|
String value= (String) settingResponseBean.getValue();
|
||||||
|
formulaValueOpt=value;
|
||||||
|
formulaValue=Utils.extractValues(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, String> mappedFormulaValue = new HashMap<>();
|
||||||
|
Object fieldValue = applicationFormFieldRequestBean.getFieldValue();
|
||||||
|
if (formulaValueOpt != null && fieldValue==null) {
|
||||||
|
fieldValue=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ContentResponseBean contentResponseBean : contentResponseBeans) {
|
||||||
|
String contentId = contentResponseBean.getId();
|
||||||
|
|
||||||
|
// Extract variable values once per contentResponseBean to avoid repeated stream operations
|
||||||
|
Set<String> variableValues = contentResponseBean.getSettings().stream()
|
||||||
|
.filter(setting -> GepafinConstant.VARIABLE.equals(setting.getName()))
|
||||||
|
.flatMap(setting -> {
|
||||||
|
Object value = setting.getValue(); // Get the raw value
|
||||||
|
if (value instanceof String) {
|
||||||
|
return Stream.of((String) value); // Handle single String case
|
||||||
|
} else if (value instanceof List) {
|
||||||
|
return ((List<?>) value).stream()
|
||||||
|
.filter(item -> item instanceof String) // Ensure it's a String
|
||||||
|
.map(item -> (String) item); // Convert to String
|
||||||
|
} else {
|
||||||
|
return Stream.empty(); // Ignore unexpected types
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toSet()); // Collect into a Set for uniqueness
|
||||||
|
|
||||||
|
for (String formula : formulaValue) {
|
||||||
|
if (variableValues.contains(formula)) { // O(1) lookup instead of O(n)
|
||||||
|
mappedFormulaValue.put(formula, contentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, String> updatedMappedFormulaValue = new HashMap<>();
|
||||||
|
|
||||||
|
for (Map.Entry<String, String> entry : mappedFormulaValue.entrySet()) {
|
||||||
|
String variable = entry.getKey();
|
||||||
|
String contentId = entry.getValue();
|
||||||
|
|
||||||
|
// Repository call using contentId
|
||||||
|
Optional<ApplicationEvaluationFormFieldEntity> optionalEntity = applicationEvaluationFormFieldRepository.findByApplicationEvaluationFormIdAndFieldIdAndIsDeletedFalse(applicationFormEntity.getId(),contentId);
|
||||||
|
// If entity is found, extract fieldValue and fieldId
|
||||||
|
optionalEntity.ifPresent(entity -> {
|
||||||
|
String entityFieldValue = entity.getFieldValue(); // Assuming getter method exists
|
||||||
|
String fieldId = entity.getFieldId(); // Assuming getter method exists
|
||||||
|
String tableType = contentResponseBeans.stream()
|
||||||
|
.filter(content -> content.getId().equals(fieldId)) // Match Content ID with fieldId
|
||||||
|
.flatMap(content -> content.getSettings().stream()) // Extract settings
|
||||||
|
.filter(setting -> GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName())) // Match name
|
||||||
|
.map(setting -> setting.getName()) // Return the name of the setting
|
||||||
|
.findFirst() // Get the first match
|
||||||
|
.orElse(null); // Default to null if no match
|
||||||
|
|
||||||
|
if(tableType!=null){
|
||||||
|
JSONObject jsonObject = new JSONObject(entityFieldValue);
|
||||||
|
|
||||||
|
// Extract the value of total
|
||||||
|
entityFieldValue = jsonObject.getString(GepafinConstant.TOTAL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
updatedMappedFormulaValue.put(fieldId, entityFieldValue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(formulaValueOpt==null || formulaValueOpt.isEmpty()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double finalValue = applicationDao.evaluateFormula(formulaValueOpt, mappedFormulaValue, updatedMappedFormulaValue);
|
||||||
|
|
||||||
|
fieldValidator.formulaValidation(fieldValue, finalValue, label);
|
||||||
|
}
|
||||||
|
public void validateFormFieldCustom(List<ApplicationFormFieldRequestBean> applicationFormFieldRequestList, ApplicationEvaluationEntity applicationEvaluationEntity, EvaluationFormEntity evaluationFormEntity) {
|
||||||
|
Map<String, Object> formFieldMap = new LinkedHashMap<String, Object>();
|
||||||
|
for(ApplicationFormFieldRequestBean applicationFormFieldRequestBean:applicationFormFieldRequestList) {
|
||||||
|
if(applicationFormFieldRequestBean.getFieldValue()==null )
|
||||||
|
continue;
|
||||||
|
if (applicationFormFieldRequestBean.getFieldValue() != null ) {
|
||||||
|
Object fieldValue = applicationFormFieldRequestBean.getFieldValue();
|
||||||
|
// formDao.checkObjectData(applicationFormFieldRequestBean.getFieldId(), fieldValue, formFieldMap);
|
||||||
|
if (fieldValue instanceof List<?>) {
|
||||||
|
List<?> list = (List<?>) fieldValue;
|
||||||
|
|
||||||
|
// Only map if the list is not empty and contains Strings
|
||||||
|
if (!list.isEmpty() && list.get(0) instanceof String) {
|
||||||
|
for (Object value : list) {
|
||||||
|
formDao.setFormFieldMap(applicationFormFieldRequestBean.getFieldId(), formFieldMap, value);
|
||||||
|
}
|
||||||
|
}else if (list.stream().allMatch(item -> item instanceof Map<?, ?> map &&
|
||||||
|
map.keySet().stream().allMatch(String.class::isInstance))) {
|
||||||
|
if (fieldValue != null) {
|
||||||
|
formFieldMap.put(applicationFormFieldRequestBean.getFieldId(), fieldValue);
|
||||||
|
}
|
||||||
|
} else formDao.setFormFieldMap(applicationFormFieldRequestBean.getFieldId(), formFieldMap, fieldValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
formDao.setFormFieldMap(applicationFormFieldRequestBean.getFieldId(), formFieldMap, fieldValue);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
EvaluationFormResponseBean evaluationFormResponseBean = evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity);
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationForm=applicationEvaluationFormRepository.findByEvaluationIdAndEvaluationFormId(applicationEvaluationEntity.getId(),evaluationFormEntity.getId());
|
||||||
|
Boolean isApplicationFormExist= getApplicationEvaluationFormExist(applicationEvaluationForm);
|
||||||
|
FieldValidator validator = FieldValidator.create();
|
||||||
|
evaluationFormResponseBean.getContent().forEach(contentResponseBean -> {
|
||||||
|
String fieldId = contentResponseBean.getId();
|
||||||
|
String fieldLabel=contentResponseBean.getLabel();
|
||||||
|
Object object=formFieldMap.get(fieldId);
|
||||||
|
String value =Utils.convertToStringForFormFieldValue(object);
|
||||||
|
if(value == null && isApplicationFormExist) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class);
|
||||||
|
validator
|
||||||
|
.minLength(value, fieldValidatorBean.getMinLength(), fieldLabel,fieldValidatorBean.getMin(),contentResponseBean) // Only applies if minLength is not null
|
||||||
|
.maxLength(value, fieldValidatorBean.getMaxLength(), fieldLabel,fieldValidatorBean.getMax(),contentResponseBean) // Only applies if maxLength is not null
|
||||||
|
.matchesPattern(value, fieldValidatorBean.getPattern(), fieldLabel) // Only applies if pattern is present
|
||||||
|
.validateCustom(value, fieldValidatorBean.getCustom(), fieldLabel,contentResponseBean); // Add the custom validation here
|
||||||
|
});
|
||||||
|
validator.validate();
|
||||||
|
}
|
||||||
|
private Boolean getApplicationEvaluationFormExist(ApplicationEvaluationFormEntity applicationEvaluationFormEntity) {
|
||||||
|
if(applicationEvaluationFormEntity !=null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,24 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.persistence.criteria.Root;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
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.*;
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
|
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.*;
|
import net.gepafin.tendermanagement.enums.*;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
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.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
|
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;
|
||||||
@@ -25,16 +33,20 @@ import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationExceptio
|
|||||||
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;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static net.gepafin.tendermanagement.util.Utils.log;
|
import static net.gepafin.tendermanagement.util.Utils.log;
|
||||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AssignedApplicationsDao {
|
public class AssignedApplicationsDao {
|
||||||
@@ -288,6 +300,118 @@ 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) {
|
||||||
|
Integer pageNo = null;
|
||||||
|
Integer pageLimit = null;
|
||||||
|
if (assignedApplicationPageableRequestBean.getGlobalFilters() != null) {
|
||||||
|
pageNo = assignedApplicationPageableRequestBean.getGlobalFilters().getPage();
|
||||||
|
pageLimit = assignedApplicationPageableRequestBean.getGlobalFilters().getLimit();
|
||||||
|
}
|
||||||
|
if (pageLimit == null || pageLimit <= 0) {
|
||||||
|
pageLimit = GepafinConstant.DEFAULT_PAGE_LIMIT;
|
||||||
|
}
|
||||||
|
if (pageNo == null || pageNo <= 0) {
|
||||||
|
pageNo = GepafinConstant.DEFAULT_PAGE;
|
||||||
|
}
|
||||||
|
Specification<AssignedApplicationsEntity> spec = searchByPagination( assignedApplicationPageableRequestBean, user,userId);
|
||||||
|
Page<AssignedApplicationsEntity> entityPage = assignedApplicationsRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||||
|
// Prepare the response
|
||||||
|
|
||||||
|
|
||||||
|
List<AssignedApplicationsResponse> assignedApplicationsResponses = entityPage.getContent().stream()
|
||||||
|
.map(application -> {
|
||||||
|
AssignedApplicationsResponse response = convertEntityToResponse(application);
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PageableResponseBean<List<AssignedApplicationsResponse>> pageableResponseBean = new PageableResponseBean<>();
|
||||||
|
pageableResponseBean.setBody(assignedApplicationsResponses);
|
||||||
|
pageableResponseBean.setCurrentPage(entityPage.getNumber() + 1);
|
||||||
|
pageableResponseBean.setTotalPages(entityPage.getTotalPages());
|
||||||
|
pageableResponseBean.setTotalRecords(entityPage.getTotalElements());
|
||||||
|
pageableResponseBean.setPageSize(entityPage.getSize());
|
||||||
|
|
||||||
|
return pageableResponseBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Specification<AssignedApplicationsEntity> searchByPagination(AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean, UserEntity userEntity,Long userId) {
|
||||||
|
return (root, query, criteriaBuilder) -> {
|
||||||
|
|
||||||
|
List<Predicate> predicates = getPredicates(assignedApplicationPageableRequestBean, criteriaBuilder, root, userEntity,userId);
|
||||||
|
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
||||||
|
|
||||||
|
if (assignedApplicationPageableRequestBean.getGlobalFilters() != null
|
||||||
|
&& assignedApplicationPageableRequestBean.getGlobalFilters().getSortBy() != null &&
|
||||||
|
assignedApplicationPageableRequestBean.getGlobalFilters().getSortBy().getColumnName() != null && Boolean.FALSE.equals(
|
||||||
|
isEmpty(assignedApplicationPageableRequestBean.getGlobalFilters().getSortBy().getColumnName()))) {
|
||||||
|
sortBy.setColumnName(assignedApplicationPageableRequestBean.getGlobalFilters().getSortBy().getColumnName());
|
||||||
|
sortBy.setSortDesc(true);
|
||||||
|
if (assignedApplicationPageableRequestBean.getGlobalFilters().getSortBy().getSortDesc() != null) {
|
||||||
|
sortBy.setSortDesc(assignedApplicationPageableRequestBean.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(AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean,
|
||||||
|
CriteriaBuilder criteriaBuilder, Root<AssignedApplicationsEntity> root, UserEntity userEntity,Long userId) {
|
||||||
|
|
||||||
|
Integer year = null;
|
||||||
|
String search = null;
|
||||||
|
if (assignedApplicationPageableRequestBean.getGlobalFilters() != null) {
|
||||||
|
year = assignedApplicationPageableRequestBean.getGlobalFilters().getYear();
|
||||||
|
search = assignedApplicationPageableRequestBean.getGlobalFilters().getSearch();
|
||||||
|
}
|
||||||
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
|
||||||
|
Boolean isBeneficiary = validator.checkIsBeneficiary();
|
||||||
|
if (userId!=null) {
|
||||||
|
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_ID), userId));
|
||||||
|
}
|
||||||
|
if (year != null && year > 0) {
|
||||||
|
int filterYear = assignedApplicationPageableRequestBean.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.NOTE)),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(titlePredicate));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by `status` (if status list is provided)
|
||||||
|
if (assignedApplicationPageableRequestBean.getStatus() != null && !assignedApplicationPageableRequestBean.getStatus().isEmpty()) {
|
||||||
|
List<String> statusValues = assignedApplicationPageableRequestBean.getStatus().stream()
|
||||||
|
.map(AssignedApplicationEnum::name) // Convert enum to string
|
||||||
|
.toList();
|
||||||
|
predicates.add(root.get(GepafinConstant.STATUS).in(statusValues));
|
||||||
|
}
|
||||||
|
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return predicates;
|
||||||
|
|
||||||
|
}
|
||||||
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);
|
||||||
|
|||||||
@@ -0,0 +1,334 @@
|
|||||||
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import com.amazonaws.services.s3.AmazonS3Client;
|
||||||
|
import com.amazonaws.services.s3.model.CopyObjectRequest;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
|
import net.gepafin.tendermanagement.enums.*;
|
||||||
|
import net.gepafin.tendermanagement.model.request.CompanyDocumentRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentCategoryResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.CompanyDocumentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.UploadFileOnAmazonS3Response;
|
||||||
|
import net.gepafin.tendermanagement.repositories.CompanyDocumentRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.DocumentRepository;
|
||||||
|
import net.gepafin.tendermanagement.service.AmazonS3Service;
|
||||||
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
|
import net.gepafin.tendermanagement.service.impl.AmazonS3ServiceImpl;
|
||||||
|
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.ResourceNotFoundException;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CompanyDocumentDao {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private S3PathConfig s3ConfigBean;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmazonS3Service amazonS3Service;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyDocumentRepository companyDocumentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DocumentCategoryDao categoryDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
@Value("${aws.s3.bucket.name}")
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmazonS3Client s3Client;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DocumentRepository documentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallDao callDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationService applicationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmazonS3ServiceImpl amazonS3ServiceImpl;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Validator validator;
|
||||||
|
|
||||||
|
public List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, Long userId, List<MultipartFile> files, Long companyId, Long documentCategoryId, CompanyDocumentTypeEnum companyDocumentSourceTypeEnum, LocalDateTime expirationDate){
|
||||||
|
DocumentCategoryEntity categoryEntity = categoryDao.validateCategory(documentCategoryId);
|
||||||
|
validator.validateUserWithCompany(request,companyId);
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userId,companyId);
|
||||||
|
|
||||||
|
LocalDateTime currentDate = LocalDateTime.now();
|
||||||
|
if (expirationDate.isBefore(currentDate)) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_EXPIRATION_DATE));
|
||||||
|
}
|
||||||
|
List<CompanyDocumentEntity> companyDocumentEntities = new ArrayList<>();
|
||||||
|
for (MultipartFile file : files){
|
||||||
|
UploadFileOnAmazonS3Response uploadFileOnAmazonS3Response = uploadFileOnAmazonS3(file, companyDocumentSourceTypeEnum, companyId);
|
||||||
|
if (uploadFileOnAmazonS3Response != null) {
|
||||||
|
CompanyDocumentEntity companyDocumentEntity = new CompanyDocumentEntity();
|
||||||
|
companyDocumentEntity.setFileName(uploadFileOnAmazonS3Response.getFileName());
|
||||||
|
companyDocumentEntity.setCompanyId(companyId);
|
||||||
|
companyDocumentEntity.setType(companyDocumentSourceTypeEnum.getValue());
|
||||||
|
companyDocumentEntity.setFilePath(uploadFileOnAmazonS3Response.getFilePath());
|
||||||
|
companyDocumentEntity.setIsDeleted(false);
|
||||||
|
companyDocumentEntity.setUploadedBy(userId);
|
||||||
|
if (expirationDate.isBefore(currentDate.plusDays(7))) {
|
||||||
|
companyDocumentEntity.setStatus(CompanyDocumentStatusEnum.DUE.getValue());
|
||||||
|
} else {
|
||||||
|
companyDocumentEntity.setStatus(CompanyDocumentStatusEnum.VALID.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
companyDocumentEntity.setCategoryEntity(categoryEntity);
|
||||||
|
companyDocumentEntity.setUserWithCompany(userWithCompanyEntity);
|
||||||
|
companyDocumentEntity.setExpirationDate(expirationDate);
|
||||||
|
companyDocumentEntities.add(companyDocumentEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
companyDocumentRepository.saveAll(companyDocumentEntities);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Upload company document" operation. **/
|
||||||
|
|
||||||
|
companyDocumentEntities.forEach(entity -> loggingUtil.addVersionHistory(
|
||||||
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(entity).build()));
|
||||||
|
|
||||||
|
return companyDocumentEntities.stream()
|
||||||
|
.map(this::convertToCompanyDocumentResponseBean)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private UploadFileOnAmazonS3Response uploadFileOnAmazonS3(MultipartFile file, CompanyDocumentTypeEnum type, Long companyId) {
|
||||||
|
try {
|
||||||
|
String s3Path = generateS3PathForCompany(type,companyId);
|
||||||
|
log.info("Generated S3 path {}", s3Path);
|
||||||
|
return amazonS3Service.uploadFileOnAmazonS3(s3Path, file);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.UPLOAD_ERROR_S3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String generateS3PathForCompany(CompanyDocumentTypeEnum typeOfDocument, Long companyId) {
|
||||||
|
try {
|
||||||
|
return s3ConfigBean.generateCompanyDocumentPath(typeOfDocument, companyId);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompanyDocumentEntity validateCompanyDocument(Long id) {
|
||||||
|
return companyDocumentRepository.findByIdAndNotDeleted(id).orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||||
|
Translator.toLocale(GepafinConstant.COMPANY_DOCUMENT_NOT_FOUND)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompanyDocumentResponseBean convertToCompanyDocumentResponseBean(CompanyDocumentEntity entity) {
|
||||||
|
CompanyDocumentResponseBean responseBean = new CompanyDocumentResponseBean();
|
||||||
|
DocumentCategoryEntity categoryEntity = entity.getCategoryEntity();
|
||||||
|
DocumentCategoryResponse responseCategory = categoryDao.convertToResponseBean(categoryEntity);
|
||||||
|
responseBean.setId(entity.getId());
|
||||||
|
responseBean.setName(entity.getFileName());
|
||||||
|
responseBean.setType(CompanyDocumentTypeEnum.valueOf(entity.getType()));
|
||||||
|
responseBean.setFilePath(entity.getFilePath());
|
||||||
|
responseBean.setCompanyId(entity.getCompanyId());
|
||||||
|
responseBean.setExpirationDate(entity.getExpirationDate());
|
||||||
|
responseBean.setStatus(entity.getStatus());
|
||||||
|
responseBean.setUploadedBy(entity.getUploadedBy());
|
||||||
|
responseBean.setCategory(responseCategory);
|
||||||
|
responseBean.setUserWithCompanyId(entity.getUserWithCompany().getId());
|
||||||
|
responseBean.setCreatedDate(entity.getCreatedDate());
|
||||||
|
responseBean.setUpdatedDate(entity.getUpdatedDate());
|
||||||
|
return responseBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompanyDocumentResponseBean updateCompanyDocument(HttpServletRequest request,Long companyDocumentId, CompanyDocumentRequest companyDocumentRequest){
|
||||||
|
|
||||||
|
CompanyDocumentEntity companyDocumentEntity = validateCompanyDocument(companyDocumentId);
|
||||||
|
validator.validateUserWithCompany(request,companyDocumentEntity.getCompanyId());
|
||||||
|
CompanyDocumentEntity oldCompanyDocumentData = Utils.getClonedEntityForData(companyDocumentEntity);
|
||||||
|
LocalDateTime currentDate = LocalDateTime.now();
|
||||||
|
if (companyDocumentRequest.getExpirationDate() != null) {
|
||||||
|
if (companyDocumentRequest.getExpirationDate().isBefore(currentDate)) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.INVALID_EXPIRATION_DATE));
|
||||||
|
}
|
||||||
|
companyDocumentEntity.setExpirationDate(companyDocumentRequest.getExpirationDate());
|
||||||
|
if (companyDocumentRequest.getExpirationDate().isBefore(currentDate.plusDays(7))) {
|
||||||
|
companyDocumentEntity.setStatus(CompanyDocumentStatusEnum.DUE.getValue());
|
||||||
|
} else {
|
||||||
|
companyDocumentEntity.setStatus(CompanyDocumentStatusEnum.VALID.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (companyDocumentRequest.getCategoryId() != null && companyDocumentRequest.getCategoryId() >0) {
|
||||||
|
DocumentCategoryEntity categoryEntity = categoryDao.validateCategory(companyDocumentRequest.getCategoryId());
|
||||||
|
setIfUpdated(companyDocumentEntity::getCategoryEntity, companyDocumentEntity::setCategoryEntity, categoryEntity);
|
||||||
|
}
|
||||||
|
companyDocumentRepository.save(companyDocumentEntity);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "updating company document" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(
|
||||||
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCompanyDocumentData).newData(companyDocumentEntity).build());
|
||||||
|
|
||||||
|
return convertToCompanyDocumentResponseBean(companyDocumentEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompanyDocumentResponseBean getCompanyDocument(UserEntity user ,Long companyDocumentId) {
|
||||||
|
CompanyDocumentEntity companyDocumentEntity = validateCompanyDocument(companyDocumentId);
|
||||||
|
validator.validateUserWithCompany(request,companyDocumentEntity.getCompanyId());
|
||||||
|
return convertToCompanyDocumentResponseBean(companyDocumentEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteCompanyFile(Long companyDocumentId){
|
||||||
|
CompanyDocumentEntity companyDocumentEntity = validateCompanyDocument(companyDocumentId);
|
||||||
|
deleteCompanyFileFromS3(companyDocumentEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteCompanyFileFromS3(CompanyDocumentEntity companyDocumentEntity){
|
||||||
|
|
||||||
|
try {
|
||||||
|
CompanyDocumentEntity oldCompanyDocumentEntity = Utils.getClonedEntityForData(companyDocumentEntity);
|
||||||
|
validator.validateUserWithCompany(request,companyDocumentEntity.getCompanyId());
|
||||||
|
String oldCompanyDocumentPath = companyDocumentEntity.getFilePath();
|
||||||
|
String newS3Path = s3ConfigBean.generateCompanyDocumentPathForOther(CompanyDocSourceTypeEnum.valueOf("DELETED_" + companyDocumentEntity.getType().toUpperCase()), companyDocumentEntity.getCompanyId());
|
||||||
|
UploadFileOnAmazonS3Response response = amazonS3Service.moveFile(companyDocumentEntity.getFileName(), oldCompanyDocumentPath, newS3Path);
|
||||||
|
companyDocumentEntity.setFileName(response.getFileName());
|
||||||
|
companyDocumentEntity.setFilePath(response.getFilePath());
|
||||||
|
companyDocumentEntity.setIsDeleted(true);
|
||||||
|
companyDocumentRepository.save(companyDocumentEntity);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Soft delete document" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(
|
||||||
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldCompanyDocumentEntity).newData(companyDocumentEntity).build());
|
||||||
|
log.info("File for company document ID {} successfully moved to deleted folder.", companyDocumentEntity.getId());
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
log.error("Error moving file for company document ID {} to deleted folder: {}", companyDocumentEntity.getId(), e.getMessage());
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.ERROR_MOVING_FILE_TO_DELETED_FOLDER));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserActionContextEnum getUserActionContextEnum(CompanyDocumentTypeEnum type){
|
||||||
|
UserActionContextEnum userActionContext = null;
|
||||||
|
if (type.equals(CompanyDocumentTypeEnum.COMPANY_DOCUMENT)){
|
||||||
|
userActionContext = UserActionContextEnum.UPLOAD_COMPANY_DOCUMENT;
|
||||||
|
}
|
||||||
|
else if(type.equals(CompanyDocumentTypeEnum.PERSONAL_DOCUMENT)){
|
||||||
|
userActionContext = UserActionContextEnum.UPLOAD_COMPANY_PERSONAL_DOCUMENT;
|
||||||
|
}
|
||||||
|
return userActionContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocumentResponseBean validateAndDuplicateCompanyDocument(HttpServletRequest request , Long userId ,Long companyDocumentId , Long applicationId , DocumentTypeEnum documentTypeEnum){
|
||||||
|
ApplicationEntity applicationEntity = applicationService.validateApplication(applicationId);
|
||||||
|
CompanyDocumentEntity companyDocumentEntity = validateCompanyDocument(companyDocumentId);
|
||||||
|
validator.validateUserWithCompany(request,companyDocumentEntity.getCompanyId());
|
||||||
|
|
||||||
|
String oldS3Path = companyDocumentEntity.getFilePath();
|
||||||
|
String newS3Path = s3ConfigBean.generateDocumentPath(DocumentSourceTypeEnum.APPLICATION,applicationEntity.getCall().getId(),applicationId,0L);
|
||||||
|
|
||||||
|
log.info("Original Paths - oldPath: {}, newPath: {}", oldS3Path, newS3Path);
|
||||||
|
|
||||||
|
oldS3Path = amazonS3ServiceImpl.decodeS3Key(amazonS3ServiceImpl.cleanOldPath(oldS3Path));
|
||||||
|
newS3Path = amazonS3ServiceImpl.cleanNewPath(oldS3Path, newS3Path);
|
||||||
|
log.info("Moving file from {} to {} in bucket {}", oldS3Path, newS3Path, bucketName);
|
||||||
|
|
||||||
|
CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, oldS3Path, bucketName, newS3Path);
|
||||||
|
s3Client.copyObject(copyRequest);
|
||||||
|
log.info("File copied successfully from {} to {}", oldS3Path, newS3Path);
|
||||||
|
|
||||||
|
DocumentEntity entity = new DocumentEntity();
|
||||||
|
entity.setFilePath(newS3Path);
|
||||||
|
entity.setFileName(companyDocumentEntity.getFileName());
|
||||||
|
entity.setSource(DocumentSourceTypeEnum.APPLICATION.getValue());
|
||||||
|
entity.setType(documentTypeEnum.getValue());
|
||||||
|
entity.setSourceId(applicationId);
|
||||||
|
entity.setUploadedBy(userId);
|
||||||
|
|
||||||
|
documentRepository.save(entity);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "inserting data" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(
|
||||||
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(entity).build());
|
||||||
|
|
||||||
|
DocumentResponseBean responseBean = callDao.convertToDocumentResponseBean(entity);
|
||||||
|
return responseBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CompanyDocumentResponseBean> getAllCompanyDocument(UserEntity user , Long companyId, CompanyDocumentTypeEnum typeEnum){
|
||||||
|
validator.validateUserWithCompany(request, companyId);
|
||||||
|
companyService.validateCompany(companyId);
|
||||||
|
|
||||||
|
Specification<CompanyDocumentEntity> spec = filterCompanyDocuments(companyId, user.getId(), typeEnum);
|
||||||
|
|
||||||
|
List<CompanyDocumentEntity> companyDocumentEntities = companyDocumentRepository.findAll(spec);
|
||||||
|
return companyDocumentEntities.stream()
|
||||||
|
.map(this::convertToCompanyDocumentResponseBean)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Specification<CompanyDocumentEntity> filterCompanyDocuments(Long companyId, Long userId, CompanyDocumentTypeEnum typeEnum) {
|
||||||
|
return (root, query, builder) -> {
|
||||||
|
Predicate predicate = builder.equal(root.get("companyId"), companyId);
|
||||||
|
|
||||||
|
if (typeEnum != null) {
|
||||||
|
if (typeEnum == CompanyDocumentTypeEnum.COMPANY_DOCUMENT) {
|
||||||
|
// Case 1: Fetch only COMPANY_DOCUMENT type documents for the given company
|
||||||
|
predicate = builder.and(predicate, builder.equal(root.get("type"), CompanyDocumentTypeEnum.COMPANY_DOCUMENT.getValue()));
|
||||||
|
|
||||||
|
} else if (typeEnum == CompanyDocumentTypeEnum.PERSONAL_DOCUMENT) {
|
||||||
|
// Case 2: Fetch only PERSONAL_DOCUMENT type documents for the logged-in user
|
||||||
|
predicate = builder.and(
|
||||||
|
predicate,
|
||||||
|
builder.equal(root.get("type"), CompanyDocumentTypeEnum.PERSONAL_DOCUMENT.getValue()),
|
||||||
|
builder.equal(root.get("userWithCompany").get("userId"), userId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Case 3: If typeEnum is null, fetch all documents for the company and personal documents for the user
|
||||||
|
Predicate companyPredicate = builder.equal(root.get("companyId"), companyId);
|
||||||
|
Predicate personalPredicate = builder.and(
|
||||||
|
builder.equal(root.get("type"), CompanyDocumentTypeEnum.PERSONAL_DOCUMENT.getValue()),
|
||||||
|
builder.equal(root.get("userWithCompany").get("userId"), userId)
|
||||||
|
);
|
||||||
|
predicate = builder.and(predicate, builder.or(companyPredicate, personalPredicate));
|
||||||
|
|
||||||
|
return predicate;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import com.amazonaws.services.dynamodbv2.xspec.S;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
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;
|
||||||
@@ -16,6 +17,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationExceptio
|
|||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ForbiddenAccessException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ForbiddenAccessException;
|
||||||
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;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -62,14 +64,36 @@ public class DashboardDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private Validator validator;
|
private Validator validator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PecDao pecDao;
|
||||||
|
|
||||||
|
@Value("${default.hub.uuid}")
|
||||||
|
private String defaultHubUuid;
|
||||||
|
|
||||||
public SuperAdminWidgetResponseBean getDashboardWidget(UserEntity requestedUserEntity) {
|
public SuperAdminWidgetResponseBean getDashboardWidget(UserEntity requestedUserEntity) {
|
||||||
SuperAdminWidgetResponseBean widgetResponseBean = new SuperAdminWidgetResponseBean();
|
SuperAdminWidgetResponseBean widgetResponseBean = new SuperAdminWidgetResponseBean();
|
||||||
widgetResponseBean.setWidget1(createWidget1(requestedUserEntity));
|
widgetResponseBean.setWidget1(createWidget1(requestedUserEntity));
|
||||||
Map<String, Object> widgetBars = getStatistics(requestedUserEntity);
|
Map<String, Object> widgetBars = getStatistics(requestedUserEntity);
|
||||||
widgetResponseBean.setWidgetBars(widgetBars);
|
widgetResponseBean.setWidgetBars(widgetBars);
|
||||||
|
if(requestedUserEntity.getHub().getUniqueUuid().equals(defaultHubUuid)) {
|
||||||
|
getEmailUsageForGepafin(requestedUserEntity, widgetResponseBean);
|
||||||
|
}
|
||||||
return widgetResponseBean;
|
return widgetResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getEmailUsageForGepafin(UserEntity requestedUserEntity, SuperAdminWidgetResponseBean widgetResponseBean) {
|
||||||
|
Map<String,Object> emailData=pecDao.getUsageDetails(requestedUserEntity.getHub().getId());
|
||||||
|
Map<String,Object> data= (Map<String, Object>) emailData.get(GepafinConstant.DATA);
|
||||||
|
Object usage=data.get(GepafinConstant.USAGE);
|
||||||
|
Object limit=data.get(GepafinConstant.LIMIT);
|
||||||
|
if(usage!=null) {
|
||||||
|
widgetResponseBean.setPecUsage(String.valueOf(usage));
|
||||||
|
}
|
||||||
|
if (limit!=null) {
|
||||||
|
widgetResponseBean.setPecLimit(String.valueOf(limit));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Widget1 createWidget1(UserEntity requestedUserEntity) {
|
private Widget1 createWidget1(UserEntity requestedUserEntity) {
|
||||||
Widget1 widget1 = initializeWidget1();
|
Widget1 widget1 = initializeWidget1();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jdk.jfr.Category;
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.entities.DocumentCategoryEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.CompanyDocumentEntity;
|
||||||
|
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.DocumentCategoryRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentCategoryResponse;
|
||||||
|
import net.gepafin.tendermanagement.repositories.DocumentCategoryRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.CompanyDocumentRepository;
|
||||||
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
|
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.Status;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class DocumentCategoryDao {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DocumentCategoryRepository categoryRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyDocumentRepository companyDocumentRepository;
|
||||||
|
|
||||||
|
public DocumentCategoryResponse createDocumentCategory(HttpServletRequest request, DocumentCategoryRequest categoryRequest){
|
||||||
|
|
||||||
|
DocumentCategoryEntity entity = createCategoryEntity(new DocumentCategoryEntity(),categoryRequest);
|
||||||
|
categoryRepository.save(entity);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Create Company Document Category" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(entity).build());
|
||||||
|
|
||||||
|
return convertToResponseBean(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocumentCategoryEntity createCategoryEntity(DocumentCategoryEntity entity, DocumentCategoryRequest companyDocumentCategoryRequest){
|
||||||
|
entity.setCategoryName(companyDocumentCategoryRequest.getCategoryName());
|
||||||
|
entity.setDescription(companyDocumentCategoryRequest.getDescription());
|
||||||
|
entity.setIsDeleted(false);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocumentCategoryResponse convertToResponseBean(DocumentCategoryEntity entity){
|
||||||
|
DocumentCategoryResponse response = new DocumentCategoryResponse();
|
||||||
|
response.setId(entity.getId());
|
||||||
|
response.setCategoryName(entity.getCategoryName());
|
||||||
|
response.setDescription(entity.getDescription());
|
||||||
|
response.setCreatedDate(entity.getCreatedDate());
|
||||||
|
response.setUpdatedDate(entity.getUpdatedDate());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocumentCategoryResponse getDocumentCategoryById(HttpServletRequest request, Long id){
|
||||||
|
return convertToResponseBean(validateCategory(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocumentCategoryEntity validateCategory(Long id) {
|
||||||
|
return categoryRepository.findById(id)
|
||||||
|
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||||
|
Translator.toLocale(GepafinConstant.DOCUMENT_CATEGORY_NOT_FOUND)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteDocumentCategory(HttpServletRequest request,Long id) {
|
||||||
|
DocumentCategoryEntity entity = validateCategory(id);
|
||||||
|
|
||||||
|
List<CompanyDocumentEntity> companyDocumentEntities = companyDocumentRepository.findByCategoryEntityId(id);
|
||||||
|
if (!companyDocumentEntities.isEmpty()){
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.CATEGORY_CANNOT_BE_DELETED));
|
||||||
|
}
|
||||||
|
DocumentCategoryEntity oldCategoryEntity = Utils.getClonedEntityForData(entity);
|
||||||
|
entity.setIsDeleted(true);
|
||||||
|
categoryRepository.save(entity);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "soft delete category" operation **/
|
||||||
|
loggingUtil.addVersionHistory(
|
||||||
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldCategoryEntity).newData(entity).build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocumentCategoryResponse updateDocumentCategory(HttpServletRequest request, Long id , DocumentCategoryRequest categoryRequest){
|
||||||
|
DocumentCategoryEntity entity = validateCategory(id);
|
||||||
|
DocumentCategoryEntity oldCategoryEntity = Utils.getClonedEntityForData(entity);
|
||||||
|
DocumentCategoryEntity newCategoryEntity = updateCategoryEntity(entity, categoryRequest);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Update Category" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCategoryEntity).newData(newCategoryEntity).build());
|
||||||
|
return convertToResponseBean(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DocumentCategoryEntity updateCategoryEntity(DocumentCategoryEntity entity , DocumentCategoryRequest categoryRequest){
|
||||||
|
setIfUpdated(entity::getCategoryName, entity::setCategoryName, categoryRequest.getCategoryName());
|
||||||
|
setIfUpdated(entity::getDescription, entity::setDescription, categoryRequest.getDescription());
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DocumentCategoryResponse> getAllDocumentCategory(){
|
||||||
|
List<DocumentCategoryEntity> documentCategoryEntityList = categoryRepository.findAll();
|
||||||
|
return documentCategoryEntityList.stream()
|
||||||
|
.map(this::convertToResponseBean)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -316,7 +316,7 @@ public class DocumentDao {
|
|||||||
log.info("File for document ID {} successfully moved to deleted folder.", documentEntity.getId());
|
log.info("File for document ID {} successfully moved to deleted folder.", documentEntity.getId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error moving file for document ID {} to deleted folder: {}", documentEntity.getId(), e.getMessage());
|
log.error("Error moving file for document ID {} to deleted folder: {}", documentEntity.getId(), e.getMessage());
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR, "Error occurred while moving file to deleted folder.");
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.ERROR_MOVING_FILE_TO_DELETED_FOLDER));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -415,8 +415,8 @@ public class FormDao {
|
|||||||
}
|
}
|
||||||
FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class);
|
FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class);
|
||||||
validator
|
validator
|
||||||
.minLength(value, fieldValidatorBean.getMinLength(), fieldLabel) // Only applies if minLength is not null
|
.minLength(value, fieldValidatorBean.getMinLength(), fieldLabel,fieldValidatorBean.getMin(),contentResponseBean) // Only applies if minLength is not null
|
||||||
.maxLength(value, fieldValidatorBean.getMaxLength(), fieldLabel) // Only applies if maxLength is not null
|
.maxLength(value, fieldValidatorBean.getMaxLength(), fieldLabel,fieldValidatorBean.getMax(),contentResponseBean) // Only applies if maxLength is not null
|
||||||
.matchesPattern(value, fieldValidatorBean.getPattern(), fieldLabel) // Only applies if pattern is present
|
.matchesPattern(value, fieldValidatorBean.getPattern(), fieldLabel) // Only applies if pattern is present
|
||||||
.validateCustom(value, fieldValidatorBean.getCustom(), fieldLabel,contentResponseBean); // Add the custom validation here
|
.validateCustom(value, fieldValidatorBean.getCustom(), fieldLabel,contentResponseBean); // Add the custom validation here
|
||||||
if (fieldValidatorBean.getCustom() != null && fieldValidatorBean.getCustom().equals(GepafinConstant.IS_PIVA)) {
|
if (fieldValidatorBean.getCustom() != null && fieldValidatorBean.getCustom().equals(GepafinConstant.IS_PIVA)) {
|
||||||
@@ -429,26 +429,32 @@ public class FormDao {
|
|||||||
validator.validate();
|
validator.validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkObjectData(String fieldId, Object fieldValue, Map<String, Object> formFieldMap) {
|
public void checkObjectData(String fieldId, Object fieldValue, Map<String, Object> formFieldMap) {
|
||||||
if (fieldValue instanceof List<?>) {
|
if (fieldValue instanceof List<?>) {
|
||||||
List<?> list = (List<?>) fieldValue;
|
List<?> list = (List<?>) fieldValue;
|
||||||
|
|
||||||
// Only map if the list is not empty and contains Strings
|
// Only map if the list is not empty and contains Strings
|
||||||
if (!list.isEmpty() && list.get(0) instanceof String) {
|
if (list.stream().allMatch(item -> item instanceof String)) {
|
||||||
|
formFieldMap.put(fieldId, list);
|
||||||
|
}
|
||||||
|
else if (!list.isEmpty() && list.get(0) instanceof String) {
|
||||||
for (Object value : list) {
|
for (Object value : list) {
|
||||||
setFormFieldMap(fieldId, formFieldMap, value);
|
setFormFieldMap(fieldId, formFieldMap, value);
|
||||||
}
|
}
|
||||||
}else if (list.stream().allMatch(item -> item instanceof Map<?, ?> map &&
|
}
|
||||||
|
else if (list.stream().allMatch(item -> item instanceof Map<?, ?> map &&
|
||||||
map.keySet().stream().allMatch(String.class::isInstance))) {
|
map.keySet().stream().allMatch(String.class::isInstance))) {
|
||||||
if (fieldValue != null) {
|
if (fieldValue != null) {
|
||||||
formFieldMap.put(fieldId, fieldValue);
|
formFieldMap.put(fieldId, fieldValue);
|
||||||
}
|
}
|
||||||
} else setFormFieldMap(fieldId, formFieldMap, fieldValue);
|
} else setFormFieldMap(fieldId, formFieldMap, fieldValue);
|
||||||
}
|
}
|
||||||
|
else setFormFieldMap(fieldId, formFieldMap, fieldValue);
|
||||||
}
|
}
|
||||||
private void setFormFieldMap(String fieldId, Map<String, Object> formFieldMap, Object value) {
|
public void setFormFieldMap(String fieldId, Map<String, Object> formFieldMap, Object value) {
|
||||||
if (value instanceof String) {
|
if(value !=null){
|
||||||
if(value !=null && Boolean.FALSE.equals(StringUtils.isEmpty((String)value))) {
|
String fieldValue= String.valueOf(value);
|
||||||
|
if(Boolean.FALSE.equals(StringUtils.isEmpty(fieldValue))) {
|
||||||
formFieldMap.put(fieldId, value);
|
formFieldMap.put(fieldId, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,11 @@ import jakarta.persistence.criteria.CriteriaBuilder;
|
|||||||
import jakarta.persistence.criteria.Expression;
|
import jakarta.persistence.criteria.Expression;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
import jakarta.persistence.criteria.Root;
|
import jakarta.persistence.criteria.Root;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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.ApplicationEntity;
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.NotificationEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.NotificationTypeEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
|
|
||||||
import net.gepafin.tendermanagement.enums.NotificationEnum;
|
import net.gepafin.tendermanagement.enums.NotificationEnum;
|
||||||
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
|
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||||
@@ -27,6 +23,7 @@ import net.gepafin.tendermanagement.repositories.NotificationTypeRepository;
|
|||||||
import net.gepafin.tendermanagement.repositories.UserRepository;
|
import net.gepafin.tendermanagement.repositories.UserRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
@@ -80,6 +77,9 @@ public class NotificationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserDao userDao;
|
private UserDao userDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
public NotificationResponse sendNotification(NotificationReq notificationReq) {
|
public NotificationResponse sendNotification(NotificationReq notificationReq) {
|
||||||
|
|
||||||
// Ensure userId is properly set in notificationReq if not already
|
// Ensure userId is properly set in notificationReq if not already
|
||||||
@@ -414,4 +414,60 @@ public class NotificationDao {
|
|||||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_ID), userId));
|
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_ID), userId));
|
||||||
return predicates;
|
return predicates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendNotificationToBeneficiaryForDocumentExpiration(CompanyDocumentEntity companyDocumentEntity, NotificationTypeEnum notificationTypeEnum) {
|
||||||
|
|
||||||
|
CompanyEntity companyEntity = companyService.validateCompany(companyDocumentEntity.getCompanyId());
|
||||||
|
Map<String, String> placeHolders = new HashMap<>();
|
||||||
|
placeHolders.put("{{file_name}}", companyDocumentEntity.getFileName());
|
||||||
|
placeHolders.put("{{company_name}}", companyEntity.getCompanyName());
|
||||||
|
placeHolders.put("{{expiration_date}}", companyDocumentEntity.getExpirationDate().toString());
|
||||||
|
NotificationReq notificationReq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders, companyDocumentEntity.getUserWithCompany().getUserId(), companyDocumentEntity.getUserWithCompany(),
|
||||||
|
listOf(companyDocumentEntity.getCompanyId()));
|
||||||
|
sendNotification(notificationReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PageableResponseBean<List<NotificationResponse>> getNotificationsByUserIdAndCompanyIdByPagination(Long userId, Long companyId, NotificationRequestBean notificationRequestBean) {
|
||||||
|
UserWithCompanyEntity userWithCompany;
|
||||||
|
if (companyId != null) {
|
||||||
|
userWithCompany = companyDao.validateUserWithCompny(userId, companyId);
|
||||||
|
}else {
|
||||||
|
userWithCompany=null;
|
||||||
|
}
|
||||||
|
Integer pageNo = null;
|
||||||
|
Integer pageLimit = null;
|
||||||
|
if (notificationRequestBean.getGlobalFilters() != null) {
|
||||||
|
pageNo = notificationRequestBean.getGlobalFilters().getPage();
|
||||||
|
pageLimit = notificationRequestBean.getGlobalFilters().getLimit();
|
||||||
|
}
|
||||||
|
if (pageLimit == null || pageLimit <= 0) {
|
||||||
|
pageLimit = GepafinConstant.DEFAULT_PAGE_LIMIT;
|
||||||
|
}
|
||||||
|
if (pageNo == null || pageNo <= 0) {
|
||||||
|
pageNo = GepafinConstant.DEFAULT_PAGE;
|
||||||
|
}
|
||||||
|
Specification<NotificationEntity> spec = search(userId, notificationRequestBean);
|
||||||
|
if(userWithCompany!=null){
|
||||||
|
spec = spec.and((root, query, criteriaBuilder) ->
|
||||||
|
criteriaBuilder.equal(root.get("userWithCompany").get("id"), userWithCompany.getId()));
|
||||||
|
}
|
||||||
|
Page<NotificationEntity> entityPage = notificationRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||||
|
// Prepare the response
|
||||||
|
List<NotificationResponse> notificationResponses = entityPage.getContent().stream()
|
||||||
|
.map(notification -> {
|
||||||
|
NotificationResponse response = convertNotificationEntityToNotificationResponse(notification);
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
PageableResponseBean<List<NotificationResponse>> pageableResponseBean = new PageableResponseBean<>();
|
||||||
|
pageableResponseBean.setBody(notificationResponses);
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,12 +285,12 @@ public class PdfDao {
|
|||||||
|
|
||||||
private Document createPdfTable(List<Map<String, Object>> extractedData, Document document, ContentResponseBean contentResponseBean) throws DocumentException {
|
private Document createPdfTable(List<Map<String, Object>> extractedData, Document document, ContentResponseBean contentResponseBean) throws DocumentException {
|
||||||
// Create a PdfPTable with dynamic column count based on stateFieldMap size
|
// Create a PdfPTable with dynamic column count based on stateFieldMap size
|
||||||
Map<String, String> stateFieldMap = new HashMap<>();
|
Map<String, String> stateFieldMap = new LinkedHashMap<>();
|
||||||
Map<String, Boolean> stateFieldBoolean = new HashMap<>();
|
Map<String, Boolean> stateFieldBoolean = new LinkedHashMap<>();
|
||||||
Map<String, Boolean> formulaEnabledMap = new HashMap<>();
|
Map<String, Boolean> formulaEnabledMap = new LinkedHashMap<>();
|
||||||
Map<String, String> formulaTypeMap = new HashMap<>();
|
Map<String, String> formulaTypeMap = new LinkedHashMap<>();
|
||||||
Map<String, String> fieldTypeMap = new HashMap<>();
|
Map<String, String> fieldTypeMap = new LinkedHashMap<>();
|
||||||
Map<String, String> totalMap = new HashMap<>();
|
Map<String, String> totalMap = new LinkedHashMap<>();
|
||||||
Font lightGrayFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(110, 110, 110)); // Light gray
|
Font lightGrayFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(110, 110, 110)); // Light gray
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
59
src/main/java/net/gepafin/tendermanagement/dao/PecDao.java
Normal file
59
src/main/java/net/gepafin/tendermanagement/dao/PecDao.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import feign.FeignException;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.model.request.EmailConfig;
|
||||||
|
import net.gepafin.tendermanagement.service.feignClient.PecFeignService;
|
||||||
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class PecDao {
|
||||||
|
|
||||||
|
public final Logger log = LoggerFactory.getLogger(PecDao.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PecFeignService pecFeignService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmailNotificationDao emailNotificationDao;
|
||||||
|
|
||||||
|
|
||||||
|
public Map<String, Object> getUsageDetails(Long hubId) {
|
||||||
|
EmailConfig emailConfig = emailNotificationDao.retrieveEmailConfig(hubId);
|
||||||
|
|
||||||
|
Map<String, Object> responseBody = new HashMap<>();
|
||||||
|
try {
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.set(GepafinConstant.AUTHORIZATION, "Bearer " + emailConfig.getAuthToken());
|
||||||
|
headers.set("x-username", emailConfig.getUsername());
|
||||||
|
headers.set("x-password", emailConfig.getPassword());
|
||||||
|
headers.add(org.apache.http.HttpHeaders.USER_AGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0");
|
||||||
|
|
||||||
|
URI baseUrl = URI.create(GepafinConstant.PEC_SERVICE_URL+GepafinConstant.PEC_SERVICE_INBOX_MAIL);
|
||||||
|
ResponseEntity<Object> response = pecFeignService.getUsageDetails(baseUrl,headers);
|
||||||
|
|
||||||
|
|
||||||
|
if (response.getStatusCode() == HttpStatus.OK && response.hasBody()) {
|
||||||
|
log.info("Successfully fetched usage and limit");
|
||||||
|
responseBody = (Map<String, Object>) response.getBody();
|
||||||
|
}
|
||||||
|
} catch (FeignException ex) {
|
||||||
|
}
|
||||||
|
return responseBody;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.entities.S3ConfigEntity;
|
import net.gepafin.tendermanagement.entities.S3ConfigEntity;
|
||||||
|
import net.gepafin.tendermanagement.enums.CompanyDocSourceTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.CompanyDocumentTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||||
import net.gepafin.tendermanagement.repositories.S3ConfigRepository;
|
import net.gepafin.tendermanagement.repositories.S3ConfigRepository;
|
||||||
@@ -49,4 +51,29 @@ public class S3PathConfig {
|
|||||||
public String getBucketNameForCallAppType(DocumentSourceTypeEnum type){
|
public String getBucketNameForCallAppType(DocumentSourceTypeEnum type){
|
||||||
return s3ConfigRepository.getBucketNameByType(type);
|
return s3ConfigRepository.getBucketNameByType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String generateCompanyDocumentPath(CompanyDocumentTypeEnum type, Long companyId) {
|
||||||
|
S3ConfigEntity config = getCompanyDocumentPath(type);
|
||||||
|
return config.getParentFolder() + "/" + buildCompanyDocumentS3Path(config.getPath(), companyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildCompanyDocumentS3Path(String pathTemplate, Long companyId) {
|
||||||
|
return pathTemplate
|
||||||
|
.replace("{company_id}", companyId != null && companyId != 0L ? "company_" + companyId : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private S3ConfigEntity getCompanyDocumentPath(CompanyDocumentTypeEnum type) {
|
||||||
|
return s3ConfigRepository.getPathByType(type.name()).orElseThrow(() -> new IllegalArgumentException("No path configuration found for type: " + type));
|
||||||
|
}
|
||||||
|
|
||||||
|
private S3ConfigEntity getCompanyDocumentPathForOther(CompanyDocSourceTypeEnum type) {
|
||||||
|
|
||||||
|
return s3ConfigRepository.getPathByType(type.name()).orElseThrow(() -> new IllegalArgumentException("No path configuration found for type: " + type));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String generateCompanyDocumentPathForOther(CompanyDocSourceTypeEnum type, Long companyId) {
|
||||||
|
|
||||||
|
S3ConfigEntity config = getCompanyDocumentPathForOther(type);
|
||||||
|
return config.getParentFolder() + "/" + buildCompanyDocumentS3Path(config.getPath(),companyId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,18 @@ package net.gepafin.tendermanagement.dao;
|
|||||||
|
|
||||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
import jakarta.persistence.criteria.Predicate;
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.persistence.criteria.Root;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.entities.RoleActionContextEntity;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.entities.UserActionEntity;
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
import net.gepafin.tendermanagement.model.response.ActionContextLabelResponse;
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
import net.gepafin.tendermanagement.model.request.ApplicationPageableRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.response.UserActionResponseBean;
|
import net.gepafin.tendermanagement.model.request.UserActionPaginationRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
|
import net.gepafin.tendermanagement.model.util.SortBy;
|
||||||
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.RoleActionContextRepository;
|
import net.gepafin.tendermanagement.repositories.RoleActionContextRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.UserActionsRepository;
|
import net.gepafin.tendermanagement.repositories.UserActionsRepository;
|
||||||
@@ -23,9 +26,12 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class UserActionDao {
|
public class UserActionDao {
|
||||||
|
|
||||||
@@ -41,16 +47,14 @@ public class UserActionDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RoleActionContextRepository roleActionContextRepository;
|
private RoleActionContextRepository roleActionContextRepository;
|
||||||
|
|
||||||
public SummaryPageResponseBean getUserAction(HttpServletRequest request, UserEntity userEntity, TimePeriodEnum timeFilter, List<UserActionContextEnum> actionContext){
|
public SummaryPageResponseBean getUserAction(HttpServletRequest request, UserEntity userEntity){
|
||||||
Long numberOfLoginAttempts = userActionsRepository.countUserLoginAttempts(userEntity.getId());
|
Long numberOfLoginAttempts = userActionsRepository.countUserLoginAttempts(userEntity.getId());
|
||||||
Long applicationsProcessed = assignedApplicationsRepository.countAssignedApplicationsByUserId(userEntity.getId());
|
Long applicationsProcessed = assignedApplicationsRepository.countAssignedApplicationsByUserId(userEntity.getId());
|
||||||
|
|
||||||
List<UserActionEntity> userActions = getFilterUserActions(userEntity.getId(),timeFilter,actionContext);
|
return createSummaryPageResponse(userEntity,numberOfLoginAttempts,applicationsProcessed);
|
||||||
|
|
||||||
return createSummaryPageResponse(userEntity,numberOfLoginAttempts,applicationsProcessed,userActions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SummaryPageResponseBean createSummaryPageResponse(UserEntity user, Long numberOfLoginAttempts, Long applicationsProcessed, List<UserActionEntity> userActions){
|
public SummaryPageResponseBean createSummaryPageResponse(UserEntity user, Long numberOfLoginAttempts, Long applicationsProcessed){
|
||||||
SummaryPageResponseBean response = new SummaryPageResponseBean();
|
SummaryPageResponseBean response = new SummaryPageResponseBean();
|
||||||
response.setRole(user.getRoleEntity().getRoleName());
|
response.setRole(user.getRoleEntity().getRoleName());
|
||||||
response.setLastLogin(user.getLastLogin());
|
response.setLastLogin(user.getLastLogin());
|
||||||
@@ -59,9 +63,6 @@ public class UserActionDao {
|
|||||||
response.setEmail(user.getEmail());
|
response.setEmail(user.getEmail());
|
||||||
response.setNumberOfLoginAttempts(numberOfLoginAttempts);
|
response.setNumberOfLoginAttempts(numberOfLoginAttempts);
|
||||||
response.setApplicationsProcessed(applicationsProcessed);
|
response.setApplicationsProcessed(applicationsProcessed);
|
||||||
|
|
||||||
List<UserActionResponseBean> userAction = convertEntityToResponse(userActions);
|
|
||||||
response.setUserActions(userAction);
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +138,7 @@ public class UserActionDao {
|
|||||||
responseBean.setResponse(action.getResponse());
|
responseBean.setResponse(action.getResponse());
|
||||||
responseBean.setCreatedDate(action.getCreatedDate());
|
responseBean.setCreatedDate(action.getCreatedDate());
|
||||||
responseBean.setUpdatedDate(action.getUpdatedDate());
|
responseBean.setUpdatedDate(action.getUpdatedDate());
|
||||||
|
responseBean.setMethodType(action.getMethodType());
|
||||||
return responseBean;
|
return responseBean;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@@ -157,4 +159,138 @@ public class UserActionDao {
|
|||||||
return responseBean;
|
return responseBean;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
public PageableResponseBean<List<UserActionResponseBean>> getUserActionByPagination(UserEntity user, UserActionPaginationRequest userActionPaginationRequest) {
|
||||||
|
Integer pageNo = null;
|
||||||
|
Integer pageLimit = null;
|
||||||
|
if (userActionPaginationRequest.getGlobalFilters() != null) {
|
||||||
|
pageNo = userActionPaginationRequest.getGlobalFilters().getPage();
|
||||||
|
pageLimit = userActionPaginationRequest.getGlobalFilters().getLimit();
|
||||||
|
}
|
||||||
|
if (pageLimit == null || pageLimit <= 0) {
|
||||||
|
pageLimit = GepafinConstant.DEFAULT_PAGE_LIMIT;
|
||||||
|
}
|
||||||
|
if (pageNo == null || pageNo <= 0) {
|
||||||
|
pageNo = GepafinConstant.DEFAULT_PAGE;
|
||||||
|
}
|
||||||
|
Specification<UserActionEntity> spec = search(userActionPaginationRequest,user);
|
||||||
|
Page<UserActionEntity> entityPage = userActionsRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||||
|
// Prepare the response
|
||||||
|
Long numberOfLoginAttempts = userActionsRepository.countUserLoginAttempts(user.getId());
|
||||||
|
Long applicationsProcessed = assignedApplicationsRepository.countAssignedApplicationsByUserId(user.getId());
|
||||||
|
|
||||||
|
|
||||||
|
List<UserActionResponseBean> userActionResponseBeans = convertEntityToResponse(entityPage.stream().toList());
|
||||||
|
|
||||||
|
|
||||||
|
PageableResponseBean<List<UserActionResponseBean>> pageableResponseBean = new PageableResponseBean<>();
|
||||||
|
pageableResponseBean.setBody(userActionResponseBeans);
|
||||||
|
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<UserActionEntity> search(UserActionPaginationRequest userActionPaginationRequest,UserEntity userEntity) {
|
||||||
|
return (root, query, criteriaBuilder) -> {
|
||||||
|
|
||||||
|
List<Predicate> predicates = getPredicates(userActionPaginationRequest, criteriaBuilder, root,userEntity);
|
||||||
|
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
||||||
|
|
||||||
|
if (userActionPaginationRequest .getGlobalFilters() != null
|
||||||
|
&& userActionPaginationRequest.getGlobalFilters().getSortBy() != null &&
|
||||||
|
userActionPaginationRequest.getGlobalFilters().getSortBy().getColumnName() != null && Boolean.FALSE.equals(
|
||||||
|
isEmpty(userActionPaginationRequest.getGlobalFilters().getSortBy().getColumnName()))) {
|
||||||
|
sortBy.setColumnName(userActionPaginationRequest.getGlobalFilters().getSortBy().getColumnName());
|
||||||
|
sortBy.setSortDesc(true);
|
||||||
|
if (userActionPaginationRequest.getGlobalFilters().getSortBy().getSortDesc() != null) {
|
||||||
|
sortBy.setSortDesc(userActionPaginationRequest.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(UserActionPaginationRequest userActionPaginationRequest,
|
||||||
|
CriteriaBuilder criteriaBuilder, Root<UserActionEntity> root,UserEntity userEntity) {
|
||||||
|
|
||||||
|
Integer year = null;
|
||||||
|
String search = null;
|
||||||
|
if (userActionPaginationRequest.getGlobalFilters() != null) {
|
||||||
|
year = userActionPaginationRequest.getGlobalFilters().getYear();
|
||||||
|
search = userActionPaginationRequest.getGlobalFilters().getSearch();
|
||||||
|
}
|
||||||
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
|
||||||
|
if (year != null && year > 0) {
|
||||||
|
int filterYear = userActionPaginationRequest.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 actionType = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get(GepafinConstant.ACTION_TYPE)),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(actionType));
|
||||||
|
Predicate actionContext = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get(GepafinConstant.ACTION_CONTEXT)),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(actionContext));
|
||||||
|
Predicate methodType = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get(GepafinConstant.METHOD_TYPE)),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(methodType));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by `status` (if status list is provided)
|
||||||
|
if (userActionPaginationRequest.getActionContext() != null && !userActionPaginationRequest.getActionContext().isEmpty()) {
|
||||||
|
List<String> statusValues = userActionPaginationRequest.getActionContext().stream()
|
||||||
|
.map(UserActionContextEnum::name) // Convert enum to string
|
||||||
|
.toList();
|
||||||
|
predicates.add(root.get("actionContext").in(statusValues));
|
||||||
|
}
|
||||||
|
if (userActionPaginationRequest.getActionType() != null && !userActionPaginationRequest.getActionType().isEmpty()) {
|
||||||
|
List<String> statusValues = userActionPaginationRequest.getActionType().stream()
|
||||||
|
.map(UserActionLogsEnum::name) // Convert enum to string
|
||||||
|
.toList();
|
||||||
|
predicates.add(root.get("actionType").in(statusValues));
|
||||||
|
}
|
||||||
|
|
||||||
|
TimePeriodEnum timeRange= userActionPaginationRequest.getTimeFilter();
|
||||||
|
if (timeRange != null) {
|
||||||
|
LocalDateTime startDate = null;
|
||||||
|
LocalDateTime endDate = LocalDateTime.now();
|
||||||
|
|
||||||
|
switch (timeRange) {
|
||||||
|
case LAST_WEEK -> startDate = endDate.minusWeeks(1);
|
||||||
|
case LAST_QUARTER -> startDate = endDate.minusMonths(3);
|
||||||
|
case LAST_SEMESTER -> startDate = endDate.minusMonths(6);
|
||||||
|
case LAST_YEAR -> startDate = endDate.minusYears(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startDate != null) {
|
||||||
|
predicates.add(criteriaBuilder.between(root.get(GepafinConstant.CREATED_DATE), startDate, endDate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_ID), userEntity.getId()));
|
||||||
|
|
||||||
|
return predicates;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.persistence.criteria.Root;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import net.gepafin.tendermanagement.config.SamlSuccessHandler;
|
import net.gepafin.tendermanagement.config.SamlSuccessHandler;
|
||||||
@@ -10,6 +13,7 @@ import net.gepafin.tendermanagement.enums.*;
|
|||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.model.util.JWTToken;
|
import net.gepafin.tendermanagement.model.util.JWTToken;
|
||||||
|
import net.gepafin.tendermanagement.model.util.SortBy;
|
||||||
import net.gepafin.tendermanagement.repositories.BeneficiaryRepository;
|
import net.gepafin.tendermanagement.repositories.BeneficiaryRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.UserRepository;
|
import net.gepafin.tendermanagement.repositories.UserRepository;
|
||||||
import net.gepafin.tendermanagement.service.HubService;
|
import net.gepafin.tendermanagement.service.HubService;
|
||||||
@@ -29,8 +33,13 @@ 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;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -38,6 +47,7 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class UserDao {
|
public class UserDao {
|
||||||
@@ -597,6 +607,152 @@ public class UserDao {
|
|||||||
log.info("Total users found with role ID {}: {}", roleIds, userResponseBeans.size());
|
log.info("Total users found with role ID {}: {}", roleIds, userResponseBeans.size());
|
||||||
return userResponseBeans;
|
return userResponseBeans;
|
||||||
}
|
}
|
||||||
|
public PageableResponseBean<List<UserResponseBean>> getUserByPagination(UserPaginationRequestBean userPaginationRequestBean,UserEntity userEntity) {
|
||||||
|
Integer pageNo = null;
|
||||||
|
Integer pageLimit = null;
|
||||||
|
if (userPaginationRequestBean.getGlobalFilters() != null) {
|
||||||
|
pageNo = userPaginationRequestBean.getGlobalFilters().getPage();
|
||||||
|
pageLimit = userPaginationRequestBean.getGlobalFilters().getLimit();
|
||||||
|
}
|
||||||
|
if (pageLimit == null || pageLimit <= 0) {
|
||||||
|
pageLimit = GepafinConstant.DEFAULT_PAGE_LIMIT;
|
||||||
|
}
|
||||||
|
if (pageNo == null || pageNo <= 0) {
|
||||||
|
pageNo = GepafinConstant.DEFAULT_PAGE;
|
||||||
|
}
|
||||||
|
Specification<UserEntity> spec = search(userPaginationRequestBean,userEntity);
|
||||||
|
Page<UserEntity> entityPage = userRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||||
|
|
||||||
|
List<UserResponseBean> applicationResponses = entityPage.getContent().stream()
|
||||||
|
.map(user -> {
|
||||||
|
UserResponseBean response = convertUserEntityToUserResponse(user);
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
PageableResponseBean<List<UserResponseBean>> 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<UserEntity> search(UserPaginationRequestBean userPaginationRequestBean,UserEntity userEntity) {
|
||||||
|
return (root, query, criteriaBuilder) -> {
|
||||||
|
|
||||||
|
List<Predicate> predicates = getPredicates(userPaginationRequestBean, criteriaBuilder, root,userEntity);
|
||||||
|
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
||||||
|
|
||||||
|
if (userPaginationRequestBean .getGlobalFilters() != null
|
||||||
|
&& userPaginationRequestBean.getGlobalFilters().getSortBy() != null &&
|
||||||
|
userPaginationRequestBean.getGlobalFilters().getSortBy().getColumnName() != null && Boolean.FALSE.equals(
|
||||||
|
isEmpty(userPaginationRequestBean.getGlobalFilters().getSortBy().getColumnName()))) {
|
||||||
|
sortBy.setColumnName(userPaginationRequestBean.getGlobalFilters().getSortBy().getColumnName());
|
||||||
|
sortBy.setSortDesc(true);
|
||||||
|
if (userPaginationRequestBean.getGlobalFilters().getSortBy().getSortDesc() != null) {
|
||||||
|
sortBy.setSortDesc(userPaginationRequestBean.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(UserPaginationRequestBean userPaginationRequestBean,
|
||||||
|
CriteriaBuilder criteriaBuilder, Root<UserEntity> root,UserEntity user) {
|
||||||
|
|
||||||
|
Integer year = null;
|
||||||
|
String search = null;
|
||||||
|
if (userPaginationRequestBean.getGlobalFilters() != null) {
|
||||||
|
year = userPaginationRequestBean.getGlobalFilters().getYear();
|
||||||
|
search = userPaginationRequestBean.getGlobalFilters().getSearch();
|
||||||
|
}
|
||||||
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
|
||||||
|
if (year != null && year > 0) {
|
||||||
|
int filterYear = userPaginationRequestBean.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 predicate = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get("firstName")),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(predicate));
|
||||||
|
Predicate predicate1 = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get("lastName")),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(predicate1));
|
||||||
|
|
||||||
|
Predicate predicate2 = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get("phoneNumber")),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(predicate2));
|
||||||
|
|
||||||
|
Predicate predicate3 = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get("organization")),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(predicate3));
|
||||||
|
|
||||||
|
Predicate predicate4 = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get("address")),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(predicate4));
|
||||||
|
|
||||||
|
Predicate predicate5 = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get("city")),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(predicate5));
|
||||||
|
|
||||||
|
Predicate predicate6 = criteriaBuilder.like(
|
||||||
|
criteriaBuilder.upper(root.get("country")),
|
||||||
|
"%" + search.toUpperCase() + "%"
|
||||||
|
);
|
||||||
|
predicates.add(criteriaBuilder.or(predicate6));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by `status` (if status list is provided)
|
||||||
|
if (userPaginationRequestBean.getStatus() != null && !userPaginationRequestBean.getStatus().isEmpty()) {
|
||||||
|
List<String> statusValues = userPaginationRequestBean.getStatus().stream()
|
||||||
|
.map(UserStatusEnum::name) // Convert enum to string
|
||||||
|
.toList();
|
||||||
|
predicates.add(root.get(GepafinConstant.STATUS).in(statusValues));
|
||||||
|
}
|
||||||
|
if (userPaginationRequestBean.getRole() != null && !userPaginationRequestBean.getRole().isEmpty()) {
|
||||||
|
List<String> roleValues = userPaginationRequestBean.getRole().stream()
|
||||||
|
.map(RoleStatusEnum::name) // Convert enum to string
|
||||||
|
.toList();
|
||||||
|
predicates.add(root.get("roleEntity").get("roleType").in(roleValues));
|
||||||
|
}
|
||||||
|
predicates.add(root.get(GepafinConstant.HUB).get("id").in(user.getHub().getId()));
|
||||||
|
|
||||||
|
return predicates;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public UserResponseBean updateUserDetails(HttpServletRequest request , Long userId, UpdateUserReqForBeneficiary userReq){
|
public UserResponseBean updateUserDetails(HttpServletRequest request , Long userId, UpdateUserReqForBeneficiary userReq){
|
||||||
log.info("Updating user by beneficiary with ID: {}", userId);
|
log.info("Updating user by beneficiary with ID: {}", userId);
|
||||||
@@ -647,9 +803,4 @@ public class UserDao {
|
|||||||
return convertUserEntityToUserResponse(userEntity);
|
return convertUserEntityToUserResponse(userEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "COMPANY_DOCUMENT")
|
||||||
|
@Data
|
||||||
|
public class CompanyDocumentEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@Column(name = "FILE_NAME")
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
@Column(name = "FILE_PATH")
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
@Column(name="TYPE")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Column(name="COMPANY_ID")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@Column(name ="IS_DELETED")
|
||||||
|
private Boolean isDeleted = false;
|
||||||
|
|
||||||
|
@Column(name="UPLOADED_BY")
|
||||||
|
private Long uploadedBy;
|
||||||
|
|
||||||
|
@Column(name = "EXPIRATION_DATE")
|
||||||
|
private LocalDateTime expirationDate;
|
||||||
|
|
||||||
|
@Column(name ="STATUS")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "USER_WITH_COMPANY_ID")
|
||||||
|
private UserWithCompanyEntity userWithCompany;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "DOCUMENT_CATEGORY_ID")
|
||||||
|
private DocumentCategoryEntity categoryEntity;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "document_category")
|
||||||
|
@Data
|
||||||
|
public class DocumentCategoryEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@Column(name = "CATEGORY_NAME")
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
@Column(name = "DESCRIPTION")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Column(name ="IS_DELETED")
|
||||||
|
private Boolean isDeleted = false;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.gepafin.tendermanagement.enums;
|
||||||
|
|
||||||
|
|
||||||
|
public enum CompanyDocSourceTypeEnum {
|
||||||
|
|
||||||
|
DELETED_PERSONAL_DOCUMENT("DELETED_PERSONAL_DOCUMENT"),
|
||||||
|
DELETED_COMPANY_DOCUMENT("DELETED_COMPANY_DOCUMENT");
|
||||||
|
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
CompanyDocSourceTypeEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package net.gepafin.tendermanagement.enums;
|
||||||
|
|
||||||
|
public enum CompanyDocumentStatusEnum {
|
||||||
|
VALID("VALID"),
|
||||||
|
DUE("DUE"),
|
||||||
|
EXPIRED("EXPIRED");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
CompanyDocumentStatusEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package net.gepafin.tendermanagement.enums;
|
||||||
|
|
||||||
|
public enum CompanyDocumentTypeEnum {
|
||||||
|
COMPANY_DOCUMENT("COMPANY_DOCUMENT"),
|
||||||
|
PERSONAL_DOCUMENT("PERSONAL_DOCUMENT");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
CompanyDocumentTypeEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,8 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
|||||||
public enum ExpirationTypeEnum {
|
public enum ExpirationTypeEnum {
|
||||||
|
|
||||||
AMENDMENT("AMENDMENT"),
|
AMENDMENT("AMENDMENT"),
|
||||||
EVALUATION("EVALUATION");
|
EVALUATION("EVALUATION"),
|
||||||
|
COMPANY_DOCUMENT("COMPANY_DOCUMENT");
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public enum NotificationTypeEnum {
|
|||||||
EVALUATION_CREATION("EVALUATION_CREATION"),
|
EVALUATION_CREATION("EVALUATION_CREATION"),
|
||||||
EVALUATION_EXPIRED("EVALUATION_EXPIRED"),
|
EVALUATION_EXPIRED("EVALUATION_EXPIRED"),
|
||||||
AMENDMENT_EXPIRATION_REMINDER("AMENDMENT_EXPIRATION_REMINDER"),
|
AMENDMENT_EXPIRATION_REMINDER("AMENDMENT_EXPIRATION_REMINDER"),
|
||||||
EVALUATION_EXPIRATION_REMINDER("EVALUATION_EXPIRATION_REMINDER");
|
EVALUATION_EXPIRATION_REMINDER("EVALUATION_EXPIRATION_REMINDER"),
|
||||||
|
COMPANY_DOCUMENT_EXPIRATION_REMINDER("COMPANY_DOCUMENT_EXPIRATION_REMINDER");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,27 @@ public enum UserActionContextEnum {
|
|||||||
|
|
||||||
|
|
||||||
GET_USER_ACTION("GET_USER_ACTION"),
|
GET_USER_ACTION("GET_USER_ACTION"),
|
||||||
GET_ACTION_CONTEXT_LABELS("GET_ACTION_CONTEXT_LABELS");
|
GET_ACTION_CONTEXT_LABELS("GET_ACTION_CONTEXT_LABELS"),
|
||||||
|
|
||||||
|
GET_COMPANY_DOCUMENT("GET_COMPANY_DOCUMENT"),
|
||||||
|
DELETE_COMPANY_DOCUMENT("DELETE_COMPANY_DOCUMENT"),
|
||||||
|
UPLOAD_COMPANY_DOCUMENT("UPLOAD_COMPANY_DOCUMENT"),
|
||||||
|
UPLOAD_COMPANY_PERSONAL_DOCUMENT("UPLOAD_COMPANY_PERSONAL_DOCUMENT"),
|
||||||
|
GET_ALL_COMPANY_DOCUMENT("GET_ALL_COMPANY_DOCUMENT"),
|
||||||
|
UPDATE_COMPANY_DOCUMENT("UPDATE_COMPANY_DOCUMENT"),
|
||||||
|
DUPLICATE_COMPANY_DOCUMENT("DUPLICATE_COMPANY_DOCUMENT"),
|
||||||
|
|
||||||
|
CREATE_DOCUMENT_CATEGORY("CREATE_DOCUMENT_CATEGORY"),
|
||||||
|
GET_DOCUMENT_CATEGORY("GET_DOCUMENT_CATEGORY"),
|
||||||
|
DELETE_DOCUMENT_CATEGORY("DELETE_DOCUMENT_CATEGORY"),
|
||||||
|
UPDATE_DOCUMENT_CATEGORY("UPDATE_DOCUMENT_CATEGORY"),
|
||||||
|
COMPANY_DOCUMENT_EXPIRATION_SCHEDULER("COMPANY_DOCUMENT_EXPIRATION_SCHEDULER"),
|
||||||
|
GET_ALL_DOCUMENT_CATEGORY("GET_ALL_DOCUMENT_CATEGORY"),
|
||||||
|
|
||||||
|
GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION("GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION"),
|
||||||
|
GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION("GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION"),
|
||||||
|
GET_ALL_USER_ACTION_BY_PAGINATION("GET_ALL_USER_ACTION_BY_PAGINATION"),
|
||||||
|
GET_ALL_USER_BY_PAGINATION("GET_ALL_USER_BY_PAGINATION");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationAmendmentPaginationRequestBean {
|
||||||
|
|
||||||
|
private GlobalFilters globalFilters;
|
||||||
|
|
||||||
|
private List<ApplicationAmendmentRequestEnum> status;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AssignedApplicationPageableRequestBean {
|
||||||
|
|
||||||
|
|
||||||
|
private GlobalFilters globalFilters;
|
||||||
|
|
||||||
|
private List<AssignedApplicationEnum> status;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CompanyDocumentRequest {
|
||||||
|
private Long categoryId;
|
||||||
|
private LocalDateTime expirationDate;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DocumentCategoryRequest {
|
||||||
|
private String categoryName;
|
||||||
|
private String description;
|
||||||
|
}
|
||||||
@@ -11,6 +11,10 @@ public class FieldValidatorBean {
|
|||||||
|
|
||||||
private Long maxLength;
|
private Long maxLength;
|
||||||
|
|
||||||
|
private Long min;
|
||||||
|
|
||||||
|
private Long max;
|
||||||
|
|
||||||
private String pattern;
|
private String pattern;
|
||||||
|
|
||||||
private String custom;
|
private String custom;
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserActionPaginationRequest {
|
||||||
|
|
||||||
|
private GlobalFilters globalFilters;
|
||||||
|
|
||||||
|
private TimePeriodEnum timeFilter;
|
||||||
|
|
||||||
|
private List<UserActionContextEnum> actionContext;
|
||||||
|
|
||||||
|
private List<UserActionLogsEnum> actionType;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserPaginationRequestBean {
|
||||||
|
|
||||||
|
private GlobalFilters globalFilters;
|
||||||
|
|
||||||
|
private List<UserStatusEnum> status;
|
||||||
|
|
||||||
|
private List<RoleStatusEnum> role;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.CompanyDocumentTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.BaseBean;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CompanyDocumentResponseBean extends BaseBean {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
private CompanyDocumentTypeEnum type;
|
||||||
|
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private LocalDateTime expirationDate;
|
||||||
|
|
||||||
|
private Long uploadedBy;
|
||||||
|
|
||||||
|
private Long userWithCompanyId;
|
||||||
|
|
||||||
|
private DocumentCategoryResponse category;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.model.BaseBean;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DocumentCategoryResponse extends BaseBean {
|
||||||
|
private String categoryName;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,5 +14,4 @@ public class SummaryPageResponseBean {
|
|||||||
private LocalDateTime registrationDate;
|
private LocalDateTime registrationDate;
|
||||||
private Long numberOfLoginAttempts;
|
private Long numberOfLoginAttempts;
|
||||||
private Long applicationsProcessed;
|
private Long applicationsProcessed;
|
||||||
private List<UserActionResponseBean> userActions;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.gepafin.tendermanagement.model.response;
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.gepafin.tendermanagement.entities.UserActionEntity;
|
import net.gepafin.tendermanagement.entities.UserActionEntity;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -12,6 +13,12 @@ public class SuperAdminWidgetResponseBean {
|
|||||||
|
|
||||||
private Widget1 widget1;
|
private Widget1 widget1;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
private String pecUsage;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
private String pecLimit;
|
||||||
|
|
||||||
private Map<String, Object> widgetBars;
|
private Map<String, Object> widgetBars;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.springframework.data.repository.query.Param;
|
|||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface ApplicationEvaluationFormFieldRepository extends JpaRepository<ApplicationEvaluationFormFieldEntity,Long> {
|
public interface ApplicationEvaluationFormFieldRepository extends JpaRepository<ApplicationEvaluationFormFieldEntity,Long> {
|
||||||
@@ -15,4 +16,23 @@ public interface ApplicationEvaluationFormFieldRepository extends JpaRepository<
|
|||||||
"AND f.isDeleted = false")
|
"AND f.isDeleted = false")
|
||||||
List<ApplicationEvaluationFormFieldEntity> findByApplicationEvaluationFormId(
|
List<ApplicationEvaluationFormFieldEntity> findByApplicationEvaluationFormId(
|
||||||
@Param("applicationEvaluationFormId") Long applicationEvaluationFormId);
|
@Param("applicationEvaluationFormId") Long applicationEvaluationFormId);
|
||||||
|
|
||||||
|
Optional<ApplicationEvaluationFormFieldEntity> findByApplicationEvaluationFormIdAndFieldIdAndIsDeletedFalse(Long applicationEvaluationFormId, String fieldId);
|
||||||
|
|
||||||
|
@Query("SELECT f FROM ApplicationEvaluationFormFieldEntity f " +
|
||||||
|
"WHERE f.applicationEvaluationForm.id = :applicationEvaluationFormId " +
|
||||||
|
"AND f.fieldId IN :fieldIds " +
|
||||||
|
"AND f.isDeleted = false")
|
||||||
|
List<ApplicationEvaluationFormFieldEntity> findByApplicationEvaluationFormIdAndFieldIds(
|
||||||
|
@Param("applicationEvaluationFormId") Long applicationEvaluationFormId,
|
||||||
|
@Param("fieldIds") List<String> fieldIds);
|
||||||
|
|
||||||
|
|
||||||
|
@Query("SELECT f FROM ApplicationEvaluationFormFieldEntity f " +
|
||||||
|
"WHERE f.applicationEvaluationForm.id = :applicationEvaluationFormId " +
|
||||||
|
"AND f.fieldId = :fieldId " +
|
||||||
|
"AND f.isDeleted = false")
|
||||||
|
ApplicationEvaluationFormFieldEntity findByFieldIdAndApplicationEvaluationFormId(
|
||||||
|
@Param("fieldId") String fieldId,
|
||||||
|
@Param("applicationEvaluationFormId") Long applicationEvaluationFormId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import feign.Param;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.CompanyDocumentEntity;
|
||||||
|
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.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface CompanyDocumentRepository extends JpaRepository<CompanyDocumentEntity,Long>, JpaSpecificationExecutor<CompanyDocumentEntity> {
|
||||||
|
|
||||||
|
@Query("SELECT c FROM CompanyDocumentEntity c WHERE c.id = :id AND c.isDeleted = false")
|
||||||
|
Optional<CompanyDocumentEntity> findByIdAndNotDeleted(@Param("id") Long id);
|
||||||
|
|
||||||
|
@Query("SELECT d FROM CompanyDocumentEntity d " +
|
||||||
|
"WHERE d.isDeleted = false " +
|
||||||
|
"AND d.expirationDate BETWEEN :startTime AND :endTime")
|
||||||
|
List<CompanyDocumentEntity> findExpiringBetween(LocalDateTime startTime, LocalDateTime endTime);
|
||||||
|
|
||||||
|
@Query("SELECT c FROM CompanyDocumentEntity c " +
|
||||||
|
"WHERE c.isDeleted = false " +
|
||||||
|
"AND c.expirationDate < :now")
|
||||||
|
List<CompanyDocumentEntity> findByExpirationDateBeforeAndIsDeletedFalse(LocalDateTime now);
|
||||||
|
|
||||||
|
@Query("SELECT c FROM CompanyDocumentEntity c " +
|
||||||
|
"WHERE c.companyId = :companyId " +
|
||||||
|
"AND c.isDeleted = false")
|
||||||
|
List<CompanyDocumentEntity> findByCompanyId(Long companyId);
|
||||||
|
|
||||||
|
List<CompanyDocumentEntity> findByCategoryEntityId(Long categoryId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.DocumentCategoryEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface DocumentCategoryRepository extends JpaRepository<DocumentCategoryEntity,Long> {
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.repositories;
|
|||||||
|
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
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.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@@ -10,7 +11,7 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface UserRepository extends JpaRepository<UserEntity, Long> {
|
public interface UserRepository extends JpaRepository<UserEntity, Long>, JpaSpecificationExecutor<UserEntity> {
|
||||||
|
|
||||||
UserEntity findByBeneficiaryId(Long beneficiaryId);
|
UserEntity findByBeneficiaryId(Long beneficiaryId);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package net.gepafin.tendermanagement.scheduler;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.dao.NotificationDao;
|
||||||
|
import net.gepafin.tendermanagement.entities.CompanyDocumentEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.ExpirationConfigEntity;
|
||||||
|
import net.gepafin.tendermanagement.enums.*;
|
||||||
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
|
import net.gepafin.tendermanagement.repositories.CompanyDocumentRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.ExpirationConfigRepository;
|
||||||
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class CompanyDocumentExpirationScheduler {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyDocumentRepository companyDocumentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NotificationDao notificationDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExpirationConfigRepository expirationConfigRepository;
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(ExpirationScheduler.class);
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0 4 * * ?")
|
||||||
|
public void processDocumentExpiration(){
|
||||||
|
log.info("Starting the Document Expiration scheduler...");
|
||||||
|
|
||||||
|
try {
|
||||||
|
Utils.setHttpServletRequestForScheduler();
|
||||||
|
|
||||||
|
// Logging user action for the scheduler operation
|
||||||
|
loggingUtil.logUserActionWithoutToken(
|
||||||
|
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.SCHEDULER)
|
||||||
|
.actionContext(UserActionContextEnum.COMPANY_DOCUMENT_EXPIRATION_SCHEDULER).build());
|
||||||
|
|
||||||
|
|
||||||
|
log.info("Starting processing expiration notifications for document");
|
||||||
|
processExpirationReminder(ExpirationTypeEnum.COMPANY_DOCUMENT);
|
||||||
|
updateExpiredDocuments();
|
||||||
|
|
||||||
|
log.info("Expiration scheduler completed successfully.");
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
log.error("An error occurred during the Notification Expiration Scheduler of Document: {}", e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processExpirationReminder(ExpirationTypeEnum typeEnum){
|
||||||
|
List<ExpirationConfigEntity> configEntities = expirationConfigRepository.findByTypeAndIsDeletedFalse(typeEnum.getValue());
|
||||||
|
|
||||||
|
for (ExpirationConfigEntity config : configEntities){
|
||||||
|
Long daysBefore = config.getIntervalDays();
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
LocalDateTime startDate = now.plusDays(daysBefore).withHour(0).withMinute(0).withSecond(0).withNano(2);
|
||||||
|
LocalDateTime endDate = startDate.plusDays(1).minusNanos(2);
|
||||||
|
|
||||||
|
processDocumentExpiration(startDate, endDate, daysBefore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processDocumentExpiration(LocalDateTime startDate, LocalDateTime endDate, Long daysBefore){
|
||||||
|
List<CompanyDocumentEntity> expiringDocuments = companyDocumentRepository.findExpiringBetween(startDate, endDate);
|
||||||
|
|
||||||
|
for (CompanyDocumentEntity document : expiringDocuments) {
|
||||||
|
notificationDao.sendNotificationToBeneficiaryForDocumentExpiration(document, NotificationTypeEnum.COMPANY_DOCUMENT_EXPIRATION_REMINDER);
|
||||||
|
updateDocumentStatus(document, CompanyDocumentStatusEnum.DUE.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void updateDocumentStatus(CompanyDocumentEntity companyDocument,String status) {
|
||||||
|
CompanyDocumentEntity oldCompanyDocumentEntity = Utils.getClonedEntityForData(companyDocument);
|
||||||
|
companyDocument.setStatus(status);
|
||||||
|
companyDocumentRepository.save(companyDocument);
|
||||||
|
|
||||||
|
// Logging version history for the update operation
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request)
|
||||||
|
.actionType(VersionActionTypeEnum.UPDATE).oldData(oldCompanyDocumentEntity)
|
||||||
|
.newData(companyDocument).build());
|
||||||
|
|
||||||
|
log.info("Updated document status for document: {}", companyDocument.getFileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void updateExpiredDocuments() {
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
List<CompanyDocumentEntity> expiredDocuments = companyDocumentRepository.findByExpirationDateBeforeAndIsDeletedFalse(now);
|
||||||
|
|
||||||
|
for (CompanyDocumentEntity document : expiredDocuments) {
|
||||||
|
updateDocumentStatus(document, CompanyDocumentStatusEnum.EXPIRED.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,10 +4,12 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||||
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.ApplicationAmendmentPaginationRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
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.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -27,4 +29,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ package net.gepafin.tendermanagement.service;
|
|||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.AssignedApplicationPageableRequestBean;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
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.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -21,5 +23,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);
|
||||||
AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status);
|
AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package net.gepafin.tendermanagement.service;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.enums.CompanyDocumentTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.CompanyDocumentRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.CompanyDocumentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CompanyDocumentService {
|
||||||
|
List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, List<MultipartFile> files, Long companyId, Long documentCategoryId, CompanyDocumentTypeEnum documentSourceTypeEnum, LocalDateTime expirationDate);
|
||||||
|
|
||||||
|
CompanyDocumentResponseBean updateCompanyDocument(HttpServletRequest httpServletRequest, Long companyDocumentId, CompanyDocumentRequest companyDocumentRequest);
|
||||||
|
|
||||||
|
CompanyDocumentResponseBean getCompanyDocument(HttpServletRequest request, Long companyDocumentId);
|
||||||
|
|
||||||
|
void deleteCompanyFile(HttpServletRequest request,Long companyDocumentId);
|
||||||
|
|
||||||
|
DocumentResponseBean validateAndDuplicateCompanyDocument(HttpServletRequest request, Long companyDocumentId, Long applicationId, DocumentTypeEnum typeEnum);
|
||||||
|
|
||||||
|
List<CompanyDocumentResponseBean> getAllCompanyDocument(HttpServletRequest request ,Long companyId , CompanyDocumentTypeEnum typeEnum);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package net.gepafin.tendermanagement.service;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.DocumentCategoryRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentCategoryResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DocumentCategoryService {
|
||||||
|
|
||||||
|
DocumentCategoryResponse createDocumentCategory(HttpServletRequest request, DocumentCategoryRequest categoryRequest);
|
||||||
|
DocumentCategoryResponse getDocumentCategoryById(HttpServletRequest request, Long id);
|
||||||
|
void deleteDocumentCategory(HttpServletRequest request,Long id);
|
||||||
|
DocumentCategoryResponse updateDocumentCategory(HttpServletRequest request, Long id, DocumentCategoryRequest categoryRequest);
|
||||||
|
List<DocumentCategoryResponse> getAllDocumentCategory(HttpServletRequest request);
|
||||||
|
}
|
||||||
@@ -7,7 +7,9 @@ import net.gepafin.tendermanagement.model.request.NotificationReq;
|
|||||||
import net.gepafin.tendermanagement.model.request.NotificationRequestBean;
|
import net.gepafin.tendermanagement.model.request.NotificationRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -25,4 +27,7 @@ public interface NotificationService {
|
|||||||
public List<NotificationResponse> getNotificationsByCompanyIdAndUserId(Long userId, Long companyId, List<NotificationEnum> statuses);
|
public List<NotificationResponse> getNotificationsByCompanyIdAndUserId(Long userId, Long companyId, List<NotificationEnum> statuses);
|
||||||
|
|
||||||
PageableResponseBean<List<NotificationResponse>> getAllNotification(HttpServletRequest request,Long userId, NotificationRequestBean notificationRequestBean);
|
PageableResponseBean<List<NotificationResponse>> getAllNotification(HttpServletRequest request,Long userId, NotificationRequestBean notificationRequestBean);
|
||||||
|
|
||||||
|
PageableResponseBean<List<NotificationResponse>> getNotificationsByUserIdAndCompanyIdByPagination(HttpServletRequest request, Long userId, Long companyId, NotificationRequestBean notificationRequestBean);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,19 @@ package net.gepafin.tendermanagement.service;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.UserActionPaginationRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ActionContextLabelResponse;
|
import net.gepafin.tendermanagement.model.response.ActionContextLabelResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.UserActionResponseBean;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface UserActionService {
|
public interface UserActionService {
|
||||||
public SummaryPageResponseBean getUserAction(HttpServletRequest request, Long userId, TimePeriodEnum timeFilter, List<UserActionContextEnum> actionContext);
|
public SummaryPageResponseBean getUserAction(HttpServletRequest request, Long userId);
|
||||||
|
|
||||||
public List<ActionContextLabelResponse> getActionContextLabels(HttpServletRequest request, Long userId);
|
public List<ActionContextLabelResponse> getActionContextLabels(HttpServletRequest request, Long userId);
|
||||||
|
|
||||||
|
public PageableResponseBean<List<UserActionResponseBean>> getUserActionByPagination(HttpServletRequest request, Long userId, UserActionPaginationRequest userActionPaginationRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.UserSamlResponse;
|
import net.gepafin.tendermanagement.model.response.UserSamlResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.JWTToken;
|
import net.gepafin.tendermanagement.model.util.JWTToken;
|
||||||
@@ -47,6 +48,7 @@ public interface UserService {
|
|||||||
public UserEntity getUserEntityById(Long userId);
|
public UserEntity getUserEntityById(Long userId);
|
||||||
List<UserResponseBean> getAllUsers(HttpServletRequest request, List<Long> roleIds);
|
List<UserResponseBean> getAllUsers(HttpServletRequest request, List<Long> roleIds);
|
||||||
|
|
||||||
|
PageableResponseBean<List<UserResponseBean>> getUserByPagination(HttpServletRequest request, UserPaginationRequestBean userPaginationRequestBean);
|
||||||
UserResponseBean updateUserDetails(HttpServletRequest request, Long userId, UpdateUserReqForBeneficiary userReq);
|
UserResponseBean updateUserDetails(HttpServletRequest request, Long userId, UpdateUserReqForBeneficiary userReq);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.RequestHeader;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
|
||||||
|
@FeignClient(value = "pec-service" ,url = GepafinConstant.PEC_SERVICE_URL)
|
||||||
|
public interface PecFeignService {
|
||||||
|
|
||||||
|
@GetMapping(GepafinConstant.PEC_SERVICE_INBOX_MAIL)
|
||||||
|
ResponseEntity<Object> getUsageDetails(URI uri,@RequestHeader HttpHeaders headers
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -153,7 +153,7 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String decodeS3Key(String key) {
|
public String decodeS3Key(String key) {
|
||||||
return URLDecoder.decode(key, StandardCharsets.UTF_8);
|
return URLDecoder.decode(key, StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,11 +186,11 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String cleanNewPath(String oldPath, String newPath) {
|
public String cleanNewPath(String oldPath, String newPath) {
|
||||||
return newPath + "/" + oldPath.substring(oldPath.lastIndexOf("/") + 1);
|
return newPath + "/" + oldPath.substring(oldPath.lastIndexOf("/") + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String cleanOldPath(String oldPath) {
|
public String cleanOldPath(String oldPath) {
|
||||||
return oldPath.replace(s3Url, "");
|
return oldPath.replace(s3Url, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,10 +8,12 @@ import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
|||||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentPaginationRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
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.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;
|
||||||
@@ -149,4 +151,10 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
|
|||||||
applicationAmendmentRequestDao.sendReminderEmail(amendmentId);
|
applicationAmendmentRequestDao.sendReminderEmail(amendmentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageableResponseBean<List<ApplicationAmendmentRequestResponse>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean) {
|
||||||
|
UserEntity user=validator.validateUser(request);
|
||||||
|
return applicationAmendmentRequestDao.getApplicationAmendmentByPaginnation(userId,amendmentPaginationRequestBean);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,13 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import net.gepafin.tendermanagement.dao.AssignedApplicationsDao;
|
import net.gepafin.tendermanagement.dao.AssignedApplicationsDao;
|
||||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.AssignedApplicationPageableRequestBean;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
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.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
||||||
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;
|
||||||
@@ -62,6 +64,13 @@ public class AssignedApplicationsServiceImpl implements AssignedApplicationsServ
|
|||||||
public AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId) {
|
public AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId) {
|
||||||
return assignedApplicationsDao.validateAssignedApplication(assignedApplicationId);
|
return assignedApplicationsDao.validateAssignedApplication(assignedApplicationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageableResponseBean<List<AssignedApplicationsResponse>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean) {
|
||||||
|
UserEntity user=validator.validateUser(request);
|
||||||
|
return assignedApplicationsDao.getAllAssignedApplicationsByPagination(user,assignedApplicationPageableRequestBean,userId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status) {
|
public AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status) {
|
||||||
return assignedApplicationsDao.updateAssignedApplicationStatus(request, assignedApplicationId, status);
|
return assignedApplicationsDao.updateAssignedApplicationStatus(request, assignedApplicationId, status);
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package net.gepafin.tendermanagement.service.impl;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.dao.CompanyDocumentDao;
|
||||||
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
|
import net.gepafin.tendermanagement.enums.CompanyDocumentTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.CompanyDocumentRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.CompanyDocumentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.service.CompanyDocumentService;
|
||||||
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CompanyDocumentServiceImpl implements CompanyDocumentService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Validator validator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyDocumentDao companyDocumentDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, List<MultipartFile> files, Long companyId, Long documentCategoryId , CompanyDocumentTypeEnum documentSourceTypeEnum, LocalDateTime expirationDate) {
|
||||||
|
Map<String, Object> userInfo = validator.getUserInfoFromToken(request);
|
||||||
|
Long userId = validator.getUserId(userInfo);
|
||||||
|
return companyDocumentDao.uploadFileForCompany(request,userId,files,companyId,documentCategoryId,documentSourceTypeEnum,expirationDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanyDocumentResponseBean updateCompanyDocument(HttpServletRequest request, Long companyDocumentId, CompanyDocumentRequest companyDocumentRequest) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
return companyDocumentDao.updateCompanyDocument(request,companyDocumentId, companyDocumentRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanyDocumentResponseBean getCompanyDocument(HttpServletRequest request, Long companyDocumentId) {
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
return companyDocumentDao.getCompanyDocument(user , companyDocumentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteCompanyFile(HttpServletRequest request,Long companyDocumentId) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
companyDocumentDao.deleteCompanyFile(companyDocumentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DocumentResponseBean validateAndDuplicateCompanyDocument(HttpServletRequest request, Long companyDocumentId, Long applicationId, DocumentTypeEnum typeEnum) {
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
return companyDocumentDao.validateAndDuplicateCompanyDocument(request, user.getId(), companyDocumentId,applicationId,typeEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CompanyDocumentResponseBean> getAllCompanyDocument(HttpServletRequest request, Long companyId, CompanyDocumentTypeEnum typeEnum) {
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
return companyDocumentDao.getAllCompanyDocument(user,companyId,typeEnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package net.gepafin.tendermanagement.service.impl;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.dao.DocumentCategoryDao;
|
||||||
|
import net.gepafin.tendermanagement.model.request.DocumentCategoryRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentCategoryResponse;
|
||||||
|
import net.gepafin.tendermanagement.service.DocumentCategoryService;
|
||||||
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DocumentCategoryServiceImpl implements DocumentCategoryService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DocumentCategoryDao categoryDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Validator validator;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public DocumentCategoryResponse createDocumentCategory(HttpServletRequest request, DocumentCategoryRequest categoryRequest) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
return categoryDao.createDocumentCategory(request,categoryRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public DocumentCategoryResponse getDocumentCategoryById(HttpServletRequest request, Long id) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
return categoryDao.getDocumentCategoryById(request,id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteDocumentCategory(HttpServletRequest request, Long id) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
categoryDao.deleteDocumentCategory(request,id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public DocumentCategoryResponse updateDocumentCategory(HttpServletRequest request, Long id, DocumentCategoryRequest categoryRequest) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
return categoryDao.updateDocumentCategory(request,id,categoryRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DocumentCategoryResponse> getAllDocumentCategory(HttpServletRequest request) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
return categoryDao.getAllDocumentCategory();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -74,4 +74,9 @@ public class NotificationServiceImpl implements NotificationService {
|
|||||||
UserEntity userEntity = validator.validateUser(request);
|
UserEntity userEntity = validator.validateUser(request);
|
||||||
return notificationDao.getAllNotification(userId,notificationRequestBean);
|
return notificationDao.getAllNotification(userId,notificationRequestBean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageableResponseBean<List<NotificationResponse>> getNotificationsByUserIdAndCompanyIdByPagination(HttpServletRequest request, Long userId, Long companyId, NotificationRequestBean notificationRequestBean) {
|
||||||
|
return notificationDao.getNotificationsByUserIdAndCompanyIdByPagination(userId,companyId,notificationRequestBean);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.service.impl;
|
|||||||
import com.mashape.unirest.http.HttpResponse;
|
import com.mashape.unirest.http.HttpResponse;
|
||||||
import com.mashape.unirest.http.Unirest;
|
import com.mashape.unirest.http.Unirest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.dao.EmailLogDao;
|
import net.gepafin.tendermanagement.dao.EmailLogDao;
|
||||||
import net.gepafin.tendermanagement.entities.EmailLogEntity;
|
import net.gepafin.tendermanagement.entities.EmailLogEntity;
|
||||||
import net.gepafin.tendermanagement.enums.EmailServiceTypeEnum;
|
import net.gepafin.tendermanagement.enums.EmailServiceTypeEnum;
|
||||||
@@ -13,6 +14,7 @@ import net.gepafin.tendermanagement.model.request.PecEmailRequest;
|
|||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
|
|
||||||
|
import org.opensaml.xmlsec.signature.G;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -26,6 +28,9 @@ public class PecEmailService implements EmailService {
|
|||||||
@Value("${isMailSendingEnabled}")
|
@Value("${isMailSendingEnabled}")
|
||||||
private String isEmailSendingEnabled;
|
private String isEmailSendingEnabled;
|
||||||
|
|
||||||
|
@Value("${isPecServiceEnabled}")
|
||||||
|
private String isPecServiceEnabled;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Validator validator;
|
private Validator validator;
|
||||||
|
|
||||||
@@ -46,7 +51,7 @@ public class PecEmailService implements EmailService {
|
|||||||
emailRequest.setUsername(emailConfig.getUsername());
|
emailRequest.setUsername(emailConfig.getUsername());
|
||||||
emailRequest.setPassword(emailConfig.getPassword());
|
emailRequest.setPassword(emailConfig.getPassword());
|
||||||
emailRequest.setRecipient(recipientEmails);
|
emailRequest.setRecipient(recipientEmails);
|
||||||
String url=emailConfig.getUrl();
|
String url=emailConfig.getUrl()+ GepafinConstant.PEC_SERVICE_SEND_MAIL;
|
||||||
String authToken = emailConfig.getAuthToken();
|
String authToken = emailConfig.getAuthToken();
|
||||||
HttpResponse<String> response2=null;
|
HttpResponse<String> response2=null;
|
||||||
if (Boolean.FALSE.equals(validator.isTestProfileActivated())) {
|
if (Boolean.FALSE.equals(validator.isTestProfileActivated())) {
|
||||||
@@ -55,23 +60,27 @@ public class PecEmailService implements EmailService {
|
|||||||
emailLogRequest.setSendStatus(StatusTypeEnum.SUCCESS.getValue());
|
emailLogRequest.setSendStatus(StatusTypeEnum.SUCCESS.getValue());
|
||||||
emailLogRequest.setRecipientEmails(Utils.listToCommaSeparatedString(emailRequest.getRecipient()));
|
emailLogRequest.setRecipientEmails(Utils.listToCommaSeparatedString(emailRequest.getRecipient()));
|
||||||
try {
|
try {
|
||||||
|
if (Boolean.TRUE.equals(Boolean.parseBoolean(isPecServiceEnabled))) {
|
||||||
Unirest.setTimeouts(0, 0);
|
Unirest.setTimeouts(0, 0);
|
||||||
response2 = Unirest.post(url)
|
response2 = Unirest.post(url)
|
||||||
.header("Authorization", "Bearer " + authToken)
|
.header("Authorization", "Bearer " + authToken)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.body(Utils.convertObjectToJson(emailRequest)) // Serialize the emailRequest object to JSON
|
.body(Utils.convertObjectToJson(emailRequest)) // Serialize the emailRequest object to JSON
|
||||||
.asString();
|
.asString();
|
||||||
|
}
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
emailLogRequest.setSendStatus(StatusTypeEnum.FAILED.getValue());
|
emailLogRequest.setSendStatus(StatusTypeEnum.FAILED.getValue());
|
||||||
emailLogRequest.setEmailServiceType(EmailServiceTypeEnum.PEC_SERVICE);
|
emailLogRequest.setEmailServiceType(EmailServiceTypeEnum.PEC_SERVICE);
|
||||||
emailLogRequest.setErrorMessage(e.getMessage());
|
emailLogRequest.setErrorMessage(e.getMessage());
|
||||||
EmailLogEntity emailLogEntity= emailLogDao.createEmailLog(emailLogRequest);
|
emailLogDao.createEmailLog(emailLogRequest);
|
||||||
throw new RuntimeException("Failed to send email via PEC: " + response2.getStatus());
|
throw new RuntimeException("Failed to send email via PEC: " + response2.getStatus());
|
||||||
}
|
}
|
||||||
|
if(response2 != null) {
|
||||||
emailLogRequest.setEmailServiceResponse(response2.getBody());
|
emailLogRequest.setEmailServiceResponse(response2.getBody());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
emailLogRequest.setEmailServiceType(EmailServiceTypeEnum.PEC_SERVICE);
|
emailLogRequest.setEmailServiceType(EmailServiceTypeEnum.PEC_SERVICE);
|
||||||
EmailLogEntity emailLogEntity= emailLogDao.createEmailLog(emailLogRequest);
|
emailLogDao.createEmailLog(emailLogRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,11 @@ import net.gepafin.tendermanagement.dao.UserActionDao;
|
|||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.UserActionPaginationRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ActionContextLabelResponse;
|
import net.gepafin.tendermanagement.model.response.ActionContextLabelResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.UserActionResponseBean;
|
||||||
import net.gepafin.tendermanagement.service.UserActionService;
|
import net.gepafin.tendermanagement.service.UserActionService;
|
||||||
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;
|
||||||
@@ -25,9 +28,9 @@ public class UserActionServiceImpl implements UserActionService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SummaryPageResponseBean getUserAction(HttpServletRequest request, Long userId, TimePeriodEnum timeFilter, List<UserActionContextEnum> actionContext) {
|
public SummaryPageResponseBean getUserAction(HttpServletRequest request, Long userId) {
|
||||||
UserEntity user = validator.validateUserId(request, userId);
|
UserEntity user = validator.validateUserId(request, userId);
|
||||||
return userActionDao.getUserAction(request,user,timeFilter,actionContext);
|
return userActionDao.getUserAction(request,user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -35,4 +38,10 @@ public class UserActionServiceImpl implements UserActionService {
|
|||||||
UserEntity user = validator.validateUserId(request, userId);
|
UserEntity user = validator.validateUserId(request, userId);
|
||||||
return userActionDao.getActionContextLabels(request,user);
|
return userActionDao.getActionContextLabels(request,user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageableResponseBean<List<UserActionResponseBean>> getUserActionByPagination(HttpServletRequest request, Long userId, UserActionPaginationRequest userActionPaginationRequest) {
|
||||||
|
UserEntity user = validator.validateUserId(request, userId);
|
||||||
|
return userActionDao.getUserActionByPagination(user,userActionPaginationRequest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import net.gepafin.tendermanagement.model.request.UpdateUserReq;
|
|||||||
import net.gepafin.tendermanagement.model.request.UserReq;
|
import net.gepafin.tendermanagement.model.request.UserReq;
|
||||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.UserSamlResponse;
|
import net.gepafin.tendermanagement.model.response.UserSamlResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.JWTToken;
|
import net.gepafin.tendermanagement.model.util.JWTToken;
|
||||||
@@ -131,6 +132,11 @@ public class UserServiceImpl implements UserService {
|
|||||||
return userDao.getAllUsers(user, roleIds);
|
return userDao.getAllUsers(user, roleIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageableResponseBean<List<UserResponseBean>> getUserByPagination(HttpServletRequest request, UserPaginationRequestBean userPaginationRequestBean) {
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
return userDao.getUserByPagination(userPaginationRequestBean, user);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public UserResponseBean updateUserDetails(HttpServletRequest request, Long userId, UpdateUserReqForBeneficiary userReq) {
|
public UserResponseBean updateUserDetails(HttpServletRequest request, Long userId, UpdateUserReqForBeneficiary userReq) {
|
||||||
|
|||||||
@@ -59,17 +59,57 @@ public class FieldValidator {
|
|||||||
throw new ValidationException(Status.VALIDATION_ERROR, errors, Translator.toLocale(GepafinConstant.VALIDATION_MESSAGE));
|
throw new ValidationException(Status.VALIDATION_ERROR, errors, Translator.toLocale(GepafinConstant.VALIDATION_MESSAGE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public FieldValidator minLength(String value, Long minLength, String fieldLabel) {
|
public FieldValidator minLength(String value, Long minLength, String fieldLabel,Long min,ContentResponseBean contentResponseBean) {
|
||||||
if (minLength != null && value != null && value.length() < minLength) {
|
if (value != null) {
|
||||||
|
if(min!=null) {
|
||||||
|
if(contentResponseBean.getName().equals(GepafinConstant.NUMBER_INPUT)) {
|
||||||
|
long numericValue = Long.parseLong(value); // Convert String to Long
|
||||||
|
if (numericValue < min) {
|
||||||
|
errors.add(MessageFormat.format(
|
||||||
|
Translator.toLocale(GepafinConstant.VALIDATION_FIELD_MIN), fieldLabel, min));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(contentResponseBean.getName().equals(GepafinConstant.CHECK_BOXES)){
|
||||||
|
List<String> check = Utils.convertJsonStringToList(value,String.class);
|
||||||
|
if (check== null || check.size() < min) {
|
||||||
|
errors.add(MessageFormat.format(
|
||||||
|
Translator.toLocale(GepafinConstant.VALIDATION_FIELD_MIN_CHECK_BOX), fieldLabel, min));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(minLength!=null) {
|
||||||
|
if (value.length() < minLength) {
|
||||||
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_MIN_LENGTH), fieldLabel, minLength));
|
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_MIN_LENGTH), fieldLabel, minLength));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FieldValidator maxLength(String value, Long maxLength, String fieldLabel) {
|
public FieldValidator maxLength(String value, Long maxLength, String fieldLabel, Long max, ContentResponseBean contentResponseBean) {
|
||||||
if (maxLength != null && value != null && value.length() > maxLength) {
|
if (value != null) {
|
||||||
|
if (max != null) {
|
||||||
|
if(contentResponseBean.getName().equals(GepafinConstant.NUMBER_INPUT)) {
|
||||||
|
long numericValue = Long.parseLong(value); // Convert String to Long
|
||||||
|
if (numericValue > max) {
|
||||||
|
errors.add(MessageFormat.format(
|
||||||
|
Translator.toLocale(GepafinConstant.VALIDATION_FIELD_MAX), fieldLabel, max));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(contentResponseBean.getName().equals(GepafinConstant.CHECK_BOXES)){
|
||||||
|
List<String> check = Utils.convertJsonStringToList(value,String.class);
|
||||||
|
if (check== null || check.size() > max) {
|
||||||
|
errors.add(MessageFormat.format(
|
||||||
|
Translator.toLocale(GepafinConstant.VALIDATION_FIELD_MAX_CHECK_BOX), fieldLabel, max));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (maxLength != null) {
|
||||||
|
if (value.length() > maxLength) {
|
||||||
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_MAX_LENGTH), fieldLabel, maxLength));
|
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_MAX_LENGTH), fieldLabel, maxLength));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +208,6 @@ public class FieldValidator {
|
|||||||
|
|
||||||
case GepafinConstant.NON_EMPTY_TABLES:
|
case GepafinConstant.NON_EMPTY_TABLES:
|
||||||
try {
|
try {
|
||||||
|
|
||||||
checkTableValidation(value, fieldId, contentResponseBean, errors);
|
checkTableValidation(value, fieldId, contentResponseBean, errors);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|||||||
@@ -785,5 +785,7 @@ public class Utils {
|
|||||||
|
|
||||||
return input.matches("-?\\d+(\\.\\d+)?");
|
return input.matches("-?\\d+(\\.\\d+)?");
|
||||||
}
|
}
|
||||||
|
public static boolean isValidBoolean(String value) {
|
||||||
|
return "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,11 +9,11 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import jakarta.validation.Valid;
|
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.ApplicationAmendmentRequest;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
|
||||||
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.ApplicationResponse;
|
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.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;
|
||||||
@@ -78,7 +78,7 @@ public interface ApplicationAmendmentRequestApi {
|
|||||||
@GetMapping(value = "", produces = "application/json")
|
@GetMapping(value = "", produces = "application/json")
|
||||||
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> getApplicationAmendmentRequestById(HttpServletRequest request,@Parameter(description = "The application amendment id", required = true) @RequestParam(value = "id", required = true) Long id);
|
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> getApplicationAmendmentRequestById(HttpServletRequest request,@Parameter(description = "The application amendment id", required = true) @RequestParam(value = "id", required = true) Long id);
|
||||||
|
|
||||||
@Operation(summary = "Api to get all applications amendment request by preInstructor user Id",
|
@Operation(summary = "Api to get all applications amendment request by preInstructor user Id (deprecated)",
|
||||||
responses = {
|
responses = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@@ -107,7 +107,7 @@ public interface ApplicationAmendmentRequestApi {
|
|||||||
@Parameter(description = "The Application Amendment id", required = true) @PathVariable("id") Long id,
|
@Parameter(description = "The Application Amendment id", required = true) @PathVariable("id") Long id,
|
||||||
@Parameter(description = "Assigned Application request object", required = true) @Valid @RequestBody ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
@Parameter(description = "Assigned Application request object", required = true) @Valid @RequestBody ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
||||||
|
|
||||||
@Operation(summary = "Api to get all applications amendment request by beneficary user Id",
|
@Operation(summary = "Api to get all applications amendment request by beneficary user Id (deprecated)",
|
||||||
responses = {
|
responses = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@@ -191,4 +191,17 @@ public interface ApplicationAmendmentRequestApi {
|
|||||||
@Parameter( required = true)
|
@Parameter( required = true)
|
||||||
@PathVariable(value = "amendmentId") Long amendmentId);
|
@PathVariable(value = "amendmentId") Long amendmentId);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get all application amendment by pagination",
|
||||||
|
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) })) })
|
||||||
|
@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,
|
||||||
|
@RequestBody ApplicationAmendmentPaginationRequestBean userActionPaginationRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ 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.AssignedApplicationPageableRequestBean;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
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.ApplicationResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||||
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.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;
|
||||||
@@ -58,7 +60,7 @@ public interface AssignedApplicationsApi {
|
|||||||
ResponseEntity<Response<Void>> deleteAssignedApplication(HttpServletRequest request,
|
ResponseEntity<Response<Void>> deleteAssignedApplication(HttpServletRequest request,
|
||||||
@Parameter(description = "The assigned application id", required = true) @PathVariable("id") Long id);
|
@Parameter(description = "The assigned application id", required = true) @PathVariable("id") Long id);
|
||||||
|
|
||||||
@Operation(summary = "Api to get all assigned applications",
|
@Operation(summary = "Api to get all assigned applications (deprecated) ",
|
||||||
responses = {
|
responses = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@@ -116,5 +118,18 @@ public interface AssignedApplicationsApi {
|
|||||||
@Parameter(description = "status", required = true)@RequestParam(value = "status", required = true) AssignedApplicationEnum status);
|
@Parameter(description = "status", required = true)@RequestParam(value = "status", required = true) AssignedApplicationEnum status);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get all assigned applications by pagination",
|
||||||
|
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) })) })
|
||||||
|
@PostMapping(value = "/pagination", produces = "application/json")
|
||||||
|
ResponseEntity<Response<PageableResponseBean<List<AssignedApplicationsResponse>>>> getAllAssignedApplicationsByPagination(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The User ID", required = false) @RequestParam(value = "userId",required = false) Long userId, @RequestBody AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import net.gepafin.tendermanagement.enums.CompanyDocumentTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.CompanyDocumentRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.FormRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.CompanyDocumentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Validated
|
||||||
|
public interface CompanyDocumentApi {
|
||||||
|
@Operation(summary = "Api to upload a file for company",
|
||||||
|
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) }))})
|
||||||
|
@PostMapping(value = "/company/{companyId}/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
|
default ResponseEntity<Response<List<CompanyDocumentResponseBean>>> uploadFileForCompany(HttpServletRequest httpServletRequest,
|
||||||
|
@Parameter(description = "Company Id", required = true) @PathVariable("companyId") Long companyId,
|
||||||
|
@Parameter(description = "The Document Category id", required = true) @RequestParam(value = "documentCategoryId", required = false) Long documentCategoryId,
|
||||||
|
@RequestParam("documentType") CompanyDocumentTypeEnum documentTypeEnum,
|
||||||
|
@RequestParam("expirationDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime expirationDate,
|
||||||
|
@RequestParam("file") List<MultipartFile> files) {
|
||||||
|
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "Api to update company document",
|
||||||
|
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) }))})
|
||||||
|
@PutMapping(value = "/{id}",produces = "application/json")
|
||||||
|
default ResponseEntity<Response<CompanyDocumentResponseBean>> updateCompanyDocument(HttpServletRequest httpServletRequest, @Parameter(description = "Company Document Id", required = true) @PathVariable("id") Long companyDocumentId,@Valid @RequestBody CompanyDocumentRequest companyDocumentRequest) {
|
||||||
|
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "API to get company document by 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) }))
|
||||||
|
})
|
||||||
|
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
ResponseEntity<Response<CompanyDocumentResponseBean>> getCompanyDocumentById(HttpServletRequest request,
|
||||||
|
@Parameter(description = "Company Document Id", required = true)
|
||||||
|
@PathVariable("id") Long id);
|
||||||
|
|
||||||
|
@Operation(summary = "API to delete a file by company document id",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "File deleted successfully"),
|
||||||
|
@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) }))
|
||||||
|
})
|
||||||
|
@DeleteMapping(value = "")
|
||||||
|
default ResponseEntity<Response<Void>> deleteCompanyFile(HttpServletRequest httpServletRequest,
|
||||||
|
@RequestParam( "id") Long id) {
|
||||||
|
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to copy a company document",
|
||||||
|
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) }))})
|
||||||
|
@PutMapping(value = "/{id}/document/upload", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
default ResponseEntity<Response<DocumentResponseBean>> validateAndDuplicateCompanyDocument (HttpServletRequest httpServletRequest, @Parameter(description = "Company Document Id", required = true) @PathVariable("id") Long companyDocumentId,
|
||||||
|
@Parameter(description = "Application Id", required = true) @RequestParam Long applicationId,
|
||||||
|
@RequestParam("documentType") DocumentTypeEnum documentTypeEnum) {
|
||||||
|
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "API to get all company documents",
|
||||||
|
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) }))
|
||||||
|
})
|
||||||
|
@GetMapping(value = "/company/{companyId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
ResponseEntity<Response<List<CompanyDocumentResponseBean>>> getAllCompanyDocuments(HttpServletRequest request,
|
||||||
|
@Parameter(description = "Company Id", required = true)
|
||||||
|
@PathVariable("companyId") Long companyId , @RequestParam(value = "documentType", required = false) CompanyDocumentTypeEnum documentTypeEnum);
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@ public interface DashboardApi {
|
|||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@GetMapping(value = "",
|
@GetMapping(value = "",
|
||||||
produces = { "application/json" })
|
produces = { "application/json" })
|
||||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')")
|
||||||
ResponseEntity<Response<SuperAdminWidgetResponseBean>> getDashboardWidgetForSuperAdmin(HttpServletRequest request);
|
ResponseEntity<Response<SuperAdminWidgetResponseBean>> getDashboardWidgetForSuperAdmin(HttpServletRequest request);
|
||||||
|
|
||||||
@Operation(summary = "Api to get dashboard widget for beneficiary",
|
@Operation(summary = "Api to get dashboard widget for beneficiary",
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import net.gepafin.tendermanagement.model.request.DocumentCategoryRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentCategoryResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Validated
|
||||||
|
public interface DocumentCategoryApi {
|
||||||
|
|
||||||
|
@Operation(summary = "Api to create document category", 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) }))
|
||||||
|
})
|
||||||
|
@PostMapping(value = "", produces = "application/json")
|
||||||
|
ResponseEntity<Response<DocumentCategoryResponse>> createDocumentCategory(HttpServletRequest request,
|
||||||
|
@Parameter(description = "Company Document Category request object", required = true)
|
||||||
|
@Valid @RequestBody DocumentCategoryRequest categoryRequest);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get document category by 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 = "/{id}", produces = "application/json")
|
||||||
|
ResponseEntity<Response<DocumentCategoryResponse>> getDocumentCategoryById(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The document category id", required = true)
|
||||||
|
@PathVariable("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to delete a document category", 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) }))
|
||||||
|
})
|
||||||
|
@DeleteMapping(value = "/{id}")
|
||||||
|
ResponseEntity<Response<Void>> deleteDocumentCategory(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The document category id", required = true)
|
||||||
|
@PathVariable("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "API to update a document category", 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) }))
|
||||||
|
})
|
||||||
|
@PutMapping(value = "/{id}", produces = "application/json")
|
||||||
|
ResponseEntity<Response<DocumentCategoryResponse>> updateDocumentCategory(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The document category id", required = true)
|
||||||
|
@PathVariable("id") Long id,
|
||||||
|
@Parameter(description = "Category request object", required = true)
|
||||||
|
@Valid @RequestBody DocumentCategoryRequest categoryRequest);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get all document category",
|
||||||
|
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 = "", produces = "application/json")
|
||||||
|
ResponseEntity<Response<List<DocumentCategoryResponse>>> getAllDocumentCategory(HttpServletRequest request);
|
||||||
|
}
|
||||||
@@ -87,7 +87,7 @@ public interface NotificationApi {
|
|||||||
ResponseEntity<Response<Void>> deleteNotification(HttpServletRequest request,
|
ResponseEntity<Response<Void>> deleteNotification(HttpServletRequest request,
|
||||||
@Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id);
|
@Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id);
|
||||||
|
|
||||||
@Operation(summary = "API to get notifications by user ID and company ID", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
@Operation(summary = "API to get notifications by user ID and company ID (deprecated) ", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@@ -110,6 +110,22 @@ public interface NotificationApi {
|
|||||||
@PostMapping(value = "/user/{userId}/pagination", consumes = "application/json", produces = "application/json")
|
@PostMapping(value = "/user/{userId}/pagination", consumes = "application/json", produces = "application/json")
|
||||||
ResponseEntity<Response<PageableResponseBean<List<NotificationResponse>>>> getAllNotification(HttpServletRequest request,@Parameter(description = "The user id", required = true) @PathVariable(value = "userId") Long userId, @RequestBody NotificationRequestBean notificationRequestBean);
|
ResponseEntity<Response<PageableResponseBean<List<NotificationResponse>>>> getAllNotification(HttpServletRequest request,@Parameter(description = "The user id", required = true) @PathVariable(value = "userId") Long userId, @RequestBody NotificationRequestBean notificationRequestBean);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "API to get notifications by user ID and company ID by pagination", 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) })) })
|
||||||
|
@PostMapping(value = "/user/{userId}/company/{companyId}/pagination", produces = "application/json")
|
||||||
|
ResponseEntity<Response<PageableResponseBean<List<NotificationResponse>>>> getNotificationsByUserIdAndCompanyIdByPagination(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The user id", required = true) @PathVariable(value = "userId") Long userId,
|
||||||
|
@Parameter(description = "The company ID", required = true) @PathVariable(value = "companyId") Long companyId,
|
||||||
|
@RequestBody NotificationRequestBean notificationRequestBean);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,20 +8,21 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.UserActionPaginationRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ActionContextLabelResponse;
|
import net.gepafin.tendermanagement.model.response.ActionContextLabelResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.UserActionResponseBean;
|
||||||
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;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface UserActionApi {
|
public interface UserActionApi {
|
||||||
@Operation(summary = "Api to get user action",
|
@Operation(summary = "Api to get user summary ",
|
||||||
responses = {
|
responses = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@@ -31,9 +32,7 @@ public interface UserActionApi {
|
|||||||
@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) })) })
|
||||||
@GetMapping(value = "/user/{userId}", produces = { "application/json" })
|
@GetMapping(value = "/user/{userId}", produces = { "application/json" })
|
||||||
ResponseEntity<Response<SummaryPageResponseBean>> getUserAction(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId,
|
ResponseEntity<Response<SummaryPageResponseBean>> getUserAction(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId);
|
||||||
@Parameter(description = "Time Filter") @RequestParam(value = "timeFilter", required = false) TimePeriodEnum timeFilter,
|
|
||||||
@Parameter(description = "Action Context") @RequestParam(value = "actionContext", required = false) List<UserActionContextEnum> actionContext);
|
|
||||||
|
|
||||||
@Operation(summary = "Api to get action context label",
|
@Operation(summary = "Api to get action context label",
|
||||||
responses = {
|
responses = {
|
||||||
@@ -46,4 +45,18 @@ public interface UserActionApi {
|
|||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@GetMapping(value = "/user/{userId}/action-context", produces = { "application/json" })
|
@GetMapping(value = "/user/{userId}/action-context", produces = { "application/json" })
|
||||||
ResponseEntity<Response<List<ActionContextLabelResponse>>> getActionContextLabels(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId);
|
ResponseEntity<Response<List<ActionContextLabelResponse>>> getActionContextLabels(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get all user action by pagination",
|
||||||
|
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) })) })
|
||||||
|
@PostMapping(value = "/user/{userId}/pagination", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<PageableResponseBean<List<UserActionResponseBean>>>> getUserActionByPaginnation(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId,
|
||||||
|
@RequestBody UserActionPaginationRequest userActionPaginationRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.UserSamlResponse;
|
import net.gepafin.tendermanagement.model.response.UserSamlResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.JWTToken;
|
import net.gepafin.tendermanagement.model.util.JWTToken;
|
||||||
@@ -225,7 +227,7 @@ public interface UserApi {
|
|||||||
ResponseEntity<Response<UserSamlResponse>> validateNewUserToken(HttpServletRequest request,
|
ResponseEntity<Response<UserSamlResponse>> validateNewUserToken(HttpServletRequest request,
|
||||||
@Parameter(description = "The spid token", required = true) @PathVariable("token") String token);
|
@Parameter(description = "The spid token", required = true) @PathVariable("token") String token);
|
||||||
|
|
||||||
@Operation(summary = "Api to get all users",
|
@Operation(summary = "Api to get all users (deprecated)",
|
||||||
responses = {
|
responses = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@@ -244,6 +246,20 @@ public interface UserApi {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
void returnNoFavicon();
|
void returnNoFavicon();
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get all user by pagination",
|
||||||
|
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) })) })
|
||||||
|
@PostMapping(value = "/pagination", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<PageableResponseBean<List<UserResponseBean>>>> getUserByPagination(HttpServletRequest request,
|
||||||
|
@RequestBody UserPaginationRequestBean userPaginationRequestBean);
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "Api to update user",
|
@Operation(summary = "Api to update user",
|
||||||
responses = {
|
responses = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
|||||||
@@ -7,11 +7,9 @@ import net.gepafin.tendermanagement.constants.GepafinConstant;
|
|||||||
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||||
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.ApplicationAmendmentRequest;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
|
||||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
|
||||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||||
|
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;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
||||||
@@ -188,4 +186,15 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
|
|||||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.REMINDER_EMAIL_SENT_SUCCESS_MSG)));
|
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.REMINDER_EMAIL_SENT_SUCCESS_MSG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<PageableResponseBean<List<ApplicationAmendmentRequestResponse>>>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean) {
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
|
.actionContext(UserActionContextEnum.GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION).build());
|
||||||
|
|
||||||
|
PageableResponseBean<List<ApplicationAmendmentRequestResponse>> listPageableResponseBean=applicationAmendmentRequestService.getApplicationAmendmentByPaginnation(request,userId,amendmentPaginationRequestBean);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(listPageableResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_DATA_FOR_AMENDMENT_SUCCESS_MSG)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,14 @@ import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
|||||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||||
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.AssignedApplicationPageableRequestBean;
|
||||||
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.ApplicationResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
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;
|
||||||
@@ -93,6 +96,15 @@ public class AssignedApplicationsController implements AssignedApplicationsApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public ResponseEntity<Response<PageableResponseBean<List<AssignedApplicationsResponse>>>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean) {
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
|
.actionContext(UserActionContextEnum.GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION).build());
|
||||||
|
|
||||||
|
PageableResponseBean<List<AssignedApplicationsResponse>> 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)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public ResponseEntity<Response<AssignedApplicationsResponse>> updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status) {
|
public ResponseEntity<Response<AssignedApplicationsResponse>> updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status) {
|
||||||
|
|
||||||
/** This code is responsible for creating user action logs for the "update assigned application status" operation. **/
|
/** This code is responsible for creating user action logs for the "update assigned application status" operation. **/
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.dao.CompanyDocumentDao;
|
||||||
|
import net.gepafin.tendermanagement.enums.*;
|
||||||
|
import net.gepafin.tendermanagement.model.request.CompanyDocumentRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.CompanyDocumentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
|
import net.gepafin.tendermanagement.service.CompanyDocumentService;
|
||||||
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.CompanyDocumentApi;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("${openapi.gepafin.base-path:/v1/companyDocument}")
|
||||||
|
@Slf4j
|
||||||
|
public class CompanyDocumentApiControlller implements CompanyDocumentApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyDocumentService companyDocumentService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyDocumentDao companyDocumentDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<List<CompanyDocumentResponseBean>>> uploadFileForCompany(HttpServletRequest request, Long companyId, Long documentCategoryId, CompanyDocumentTypeEnum companyDocumentSourceTypeEnum, LocalDateTime expirationDate,
|
||||||
|
List<MultipartFile> files) {
|
||||||
|
try {
|
||||||
|
UserActionContextEnum userActionContext = companyDocumentDao.getUserActionContextEnum(companyDocumentSourceTypeEnum);
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "upload document for company" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPLOAD).actionContext(userActionContext).build());
|
||||||
|
|
||||||
|
List<CompanyDocumentResponseBean> responseBeans = companyDocumentService.uploadFileForCompany(request,files, companyId, documentCategoryId ,companyDocumentSourceTypeEnum,expirationDate);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<List<CompanyDocumentResponseBean>>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.FILES_UPLOADED_MSG)));
|
||||||
|
} catch (CustomValidationException ex) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<CompanyDocumentResponseBean>> updateCompanyDocument(HttpServletRequest httpServletRequest, Long companyDocumentId, CompanyDocumentRequest companyDocumentRequest) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "update company document" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(httpServletRequest).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.UPDATE_COMPANY_DOCUMENT).build());
|
||||||
|
|
||||||
|
CompanyDocumentResponseBean responseBeans = companyDocumentService.updateCompanyDocument(httpServletRequest, companyDocumentId, companyDocumentRequest);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<CompanyDocumentResponseBean>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_DOCUMENT_UPDATED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<CompanyDocumentResponseBean>> getCompanyDocumentById(HttpServletRequest request, Long id) {
|
||||||
|
/** This code is responsible for creating user action logs for the "Get Company Document" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_COMPANY_DOCUMENT).build());
|
||||||
|
|
||||||
|
CompanyDocumentResponseBean companyDocumentResponseBean = companyDocumentService.getCompanyDocument(request, id);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<CompanyDocumentResponseBean>(companyDocumentResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_DOCUMENT_FETCHED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<Void>> deleteCompanyFile(HttpServletRequest request, Long companyDocumentId) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "delete company document" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.DELETE).actionContext(UserActionContextEnum.DELETE_COMPANY_DOCUMENT).build());
|
||||||
|
|
||||||
|
companyDocumentService.deleteCompanyFile(request,companyDocumentId);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<Void>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.FILE_DELETED_SUCCESSFULLY_MSG)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<DocumentResponseBean>> validateAndDuplicateCompanyDocument(HttpServletRequest httpServletRequest, Long companyDocumentId , Long applicationId,DocumentTypeEnum typeEnum) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "duplicate company document" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(httpServletRequest).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.DUPLICATE_COMPANY_DOCUMENT).build());
|
||||||
|
|
||||||
|
DocumentResponseBean responseBeans = companyDocumentService.validateAndDuplicateCompanyDocument(httpServletRequest, companyDocumentId,applicationId,typeEnum);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<DocumentResponseBean>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_DOCUMENT_COPIED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<List<CompanyDocumentResponseBean>>> getAllCompanyDocuments(HttpServletRequest request, Long companyId, CompanyDocumentTypeEnum typeEnum) {
|
||||||
|
log.info("Get All Company Document");
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "get all Company Document" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
|
.actionContext(UserActionContextEnum.GET_ALL_COMPANY_DOCUMENT).build());
|
||||||
|
|
||||||
|
List<CompanyDocumentResponseBean> companyDocumentResponseBeans = companyDocumentService.getAllCompanyDocument(request,companyId,typeEnum);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(companyDocumentResponseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_DOCUMENT_FETCHED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.DocumentCategoryRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.DocumentCategoryResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
|
import net.gepafin.tendermanagement.service.DocumentCategoryService;
|
||||||
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.DocumentCategoryApi;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("${openapi.gepafin.base-path:/v1/documentCategory}")
|
||||||
|
@Log4j2
|
||||||
|
public class DocumentCategoryApiController implements DocumentCategoryApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LoggingUtil loggingUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DocumentCategoryService categoryService;
|
||||||
|
|
||||||
|
public ResponseEntity<Response<DocumentCategoryResponse>> createDocumentCategory(HttpServletRequest request, @Valid DocumentCategoryRequest categoryRequest){
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Create Document category" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT)
|
||||||
|
.actionContext(UserActionContextEnum.CREATE_DOCUMENT_CATEGORY).build());
|
||||||
|
|
||||||
|
DocumentCategoryResponse categoryResponse = categoryService.createDocumentCategory(request,categoryRequest);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(categoryResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.DOCUMENT_CATEGORY_CREATE_SUCCESS)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<DocumentCategoryResponse>> getDocumentCategoryById(HttpServletRequest request, Long id) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "get document category by id" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
|
.actionContext(UserActionContextEnum.GET_DOCUMENT_CATEGORY).build());
|
||||||
|
|
||||||
|
DocumentCategoryResponse categoryResponse = categoryService.getDocumentCategoryById(request,id);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(categoryResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.DOCUMENT_CATEGORY_GET_SUCCESS)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<Void>> deleteDocumentCategory(HttpServletRequest request, Long id) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Delete category" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.DELETE).actionContext(UserActionContextEnum.DELETE_DOCUMENT_CATEGORY).build());
|
||||||
|
|
||||||
|
categoryService.deleteDocumentCategory(request,id);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.DOCUMENT_CATEGORY_DELETE_SUCCESS)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<DocumentCategoryResponse>> updateDocumentCategory(HttpServletRequest request, Long id, DocumentCategoryRequest categoryRequest) {
|
||||||
|
|
||||||
|
/** This code is responsible for "Updating Category details" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE)
|
||||||
|
.actionContext(UserActionContextEnum.UPDATE_DOCUMENT_CATEGORY).build());
|
||||||
|
|
||||||
|
DocumentCategoryResponse categoryResponse = categoryService.updateDocumentCategory(request,id, categoryRequest);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(categoryResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.DOCUMENT_CATEGORY_UPDATE_SUCCESS)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<List<DocumentCategoryResponse>>> getAllDocumentCategory(HttpServletRequest request) {
|
||||||
|
log.info("Get All Document Category");
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "get all document category" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
|
.actionContext(UserActionContextEnum.GET_ALL_DOCUMENT_CATEGORY).build());
|
||||||
|
|
||||||
|
List<DocumentCategoryResponse> documentCategoryResponseList = categoryService.getAllDocumentCategory(request);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(documentCategoryResponseList, Status.SUCCESS, Translator.toLocale(GepafinConstant.DOCUMENT_CATEGORY_GET_SUCCESS)));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,4 +92,11 @@ public class NotificationApiController implements NotificationApi {
|
|||||||
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(notificationResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_FETCHED_SUCCESSFULLY)));
|
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(notificationResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_FETCHED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<PageableResponseBean<List<NotificationResponse>>>> getNotificationsByUserIdAndCompanyIdByPagination(HttpServletRequest request, Long userId, Long companyId, NotificationRequestBean notificationRequestBean) {
|
||||||
|
PageableResponseBean<List<NotificationResponse>> notificationResponses=notificationService.getNotificationsByUserIdAndCompanyIdByPagination(request, userId,companyId,notificationRequestBean);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(notificationResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_FETCHED_SUCCESSFULLY)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,9 +6,12 @@ import net.gepafin.tendermanagement.constants.GepafinConstant;
|
|||||||
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
||||||
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.UserActionPaginationRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ActionContextLabelResponse;
|
import net.gepafin.tendermanagement.model.response.ActionContextLabelResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.UserActionResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.service.UserActionService;
|
import net.gepafin.tendermanagement.service.UserActionService;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
@@ -33,12 +36,12 @@ public class UserActionApiController implements UserActionApi {
|
|||||||
private LoggingUtil loggingUtil;
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<SummaryPageResponseBean>> getUserAction(HttpServletRequest request, Long userId, TimePeriodEnum timeFilter, List<UserActionContextEnum> actionContext) {
|
public ResponseEntity<Response<SummaryPageResponseBean>> getUserAction(HttpServletRequest request, Long userId) {
|
||||||
|
|
||||||
/** This code is responsible for creating user action logs for the "get user action" operation. **/
|
/** This code is responsible for creating user action logs for the "get user action" operation. **/
|
||||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
.actionContext(UserActionContextEnum.GET_USER_ACTION).build());
|
.actionContext(UserActionContextEnum.GET_USER_ACTION).build());
|
||||||
SummaryPageResponseBean userActionResponse= userActionService.getUserAction(request,userId,timeFilter,actionContext);
|
SummaryPageResponseBean userActionResponse= userActionService.getUserAction(request,userId);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(userActionResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.USER_ACTION_FETCHED_SUCCESSFULLY)));
|
.body(new Response<>(userActionResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.USER_ACTION_FETCHED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
@@ -54,5 +57,16 @@ public class UserActionApiController implements UserActionApi {
|
|||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(actionContextResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.ACTION_CONTEXT_LABELS_FETCHED_SUCCESSFULLY)));
|
.body(new Response<>(actionContextResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.ACTION_CONTEXT_LABELS_FETCHED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<PageableResponseBean<List<UserActionResponseBean>>>> getUserActionByPaginnation(HttpServletRequest request, Long userId, UserActionPaginationRequest userActionPaginationRequest) {
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
|
.actionContext(UserActionContextEnum.GET_ALL_USER_ACTION_BY_PAGINATION).build());
|
||||||
|
|
||||||
|
PageableResponseBean<List<UserActionResponseBean>> userActionResponse= userActionService.getUserActionByPagination(request,userId,userActionPaginationRequest);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(userActionResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.USER_ACTION_FETCHED_SUCCESSFULLY)));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
|||||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.UserSamlResponse;
|
import net.gepafin.tendermanagement.model.response.UserSamlResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.JWTToken;
|
import net.gepafin.tendermanagement.model.util.JWTToken;
|
||||||
@@ -249,6 +250,15 @@ public class UserApiController implements UserApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public ResponseEntity<Response<PageableResponseBean<List<UserResponseBean>>>> getUserByPagination(HttpServletRequest request, UserPaginationRequestBean userPaginationRequestBean) {
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
|
.actionContext(UserActionContextEnum.GET_ALL_USER_BY_PAGINATION).build());
|
||||||
|
|
||||||
|
PageableResponseBean<List<UserResponseBean>> users = userService.getUserByPagination(request, userPaginationRequestBean);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(users, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_USERS_SUCCESS_MSG)));
|
||||||
|
|
||||||
|
}
|
||||||
public ResponseEntity<Response<UserResponseBean>> updateUserDetails(HttpServletRequest request,
|
public ResponseEntity<Response<UserResponseBean>> updateUserDetails(HttpServletRequest request,
|
||||||
@PathVariable("userId") Long userId,
|
@PathVariable("userId") Long userId,
|
||||||
@Valid @RequestBody UpdateUserReqForBeneficiary userReq) {
|
@Valid @RequestBody UpdateUserReqForBeneficiary userReq) {
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ spring.h2.console.enabled=true
|
|||||||
isVatCheckGloballyDisabled = false
|
isVatCheckGloballyDisabled = false
|
||||||
|
|
||||||
isMailSendingEnabled = true
|
isMailSendingEnabled = true
|
||||||
default_System_Receiver_Email=antonio.manca@bflows.net
|
isPecServiceEnabled = false
|
||||||
|
#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
|
carlo_email=test@test.test
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ spring.jpa.show-sql=true
|
|||||||
base-url=http://localhost:8080
|
base-url=http://localhost:8080
|
||||||
|
|
||||||
isMailSendingEnabled = false
|
isMailSendingEnabled = false
|
||||||
default_System_Receiver_Email=test@test.test
|
isPecServiceEnabled = false
|
||||||
|
#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
|
carlo_email=test@test.test
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ spid.ipd.base.url=https://login.regione.umbria.it
|
|||||||
active.profile.folder=production
|
active.profile.folder=production
|
||||||
|
|
||||||
isMailSendingEnabled = true
|
isMailSendingEnabled = true
|
||||||
default_System_Receiver_Email=m.gaudino@gepafin.it,f.marinelli@gepafin.it
|
isPecServiceEnabled = true
|
||||||
|
#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
|
carlo_email=carlo.mancosu@bflows.net
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ spring.datasource.password=sa
|
|||||||
spring.h2.console.enabled=true
|
spring.h2.console.enabled=true
|
||||||
base-url=http://localhost:8080
|
base-url=http://localhost:8080
|
||||||
isMailSendingEnabled = false
|
isMailSendingEnabled = false
|
||||||
default_System_Receiver_Email=test@test.test
|
isPecServiceEnabled = false
|
||||||
|
#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
|
carlo_email=test@test.test
|
||||||
|
|||||||
@@ -2429,10 +2429,112 @@
|
|||||||
<modifyDataType tableName="call" columnName="product_id" newDataType="INTEGER"/>
|
<modifyDataType tableName="call" columnName="product_id" newDataType="INTEGER"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="24-02-2025_RK_192024" author="Rajesh Khore">
|
||||||
|
<createTable tableName="document_category">
|
||||||
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
|
<constraints primaryKey="true" primaryKeyName="document_category_pkey" nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="CATEGORY_NAME" type="VARCHAR(255)"/>
|
||||||
|
<column name="DESCRIPTION" type="TEXT"/>
|
||||||
|
<column name="IS_DELETED" type="BOOLEAN" defaultValue="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="24-02-2025_RK_190220" author="Rajesh Khore">
|
||||||
|
<createTable tableName="company_document">
|
||||||
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
|
<constraints primaryKey="true" primaryKeyName="company_document_pkey" nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="file_name" type="VARCHAR(255)"/>
|
||||||
|
<column name="file_path" type="TEXT"/>
|
||||||
|
<column name="type" type="VARCHAR(255)"/>
|
||||||
|
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false"/>
|
||||||
|
<column name="uploaded_by" type="INTEGER"/>
|
||||||
|
<column name="expiration_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="status" type="VARCHAR(255)"/>
|
||||||
|
<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>
|
||||||
|
<column name="USER_WITH_COMPANY_ID" type="INTEGER">
|
||||||
|
<constraints foreignKeyName="fk_USER_WITH_COMPANY_COMPANY_DOCUMENT" references="user_with_company(id)" nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="COMPANY_ID" type="INTEGER">
|
||||||
|
<constraints nullable="true" foreignKeyName="fk_COMPANY_COMPANY_DOCUMENT" references="company(id)"/>
|
||||||
|
</column>
|
||||||
|
<column name="DOCUMENT_CATEGORY_ID" type="INTEGER">
|
||||||
|
<constraints nullable="true" foreignKeyName="fk_DOCUMENT_CATEGORY_COMPANY_DOCUMENT" references="document_category(id)"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="24-02-2025_RK_020220" author="Rajesh Khore">
|
||||||
|
<insert tableName="s3_path_configuration">
|
||||||
|
<column name="type" value="COMPANY_DOCUMENT"/>
|
||||||
|
<column name="path" value="company/{company_id}"/>
|
||||||
|
<column name="bucket_name" value="mementoresources"/>
|
||||||
|
<column name="created_date" value="2025-02-20 03:00:00"/>
|
||||||
|
<column name="updated_date" value="2025-02-20 03:00:00"/>
|
||||||
|
<column name="parent_folder" value="gepafin/local"/>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert tableName="s3_path_configuration">
|
||||||
|
<column name="type" value="DELETED_PERSONAL_DOCUMENT"/>
|
||||||
|
<column name="path" value="company/{company_id}/deleted"/>
|
||||||
|
<column name="bucket_name" value="mementoresources"/>
|
||||||
|
<column name="created_date" value="2025-02-20 03:00:00"/>
|
||||||
|
<column name="updated_date" value="2025-02-20 03:00:00"/>
|
||||||
|
<column name="parent_folder" value="gepafin/local"/>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert tableName="s3_path_configuration">
|
||||||
|
<column name="type" value="PERSONAL_DOCUMENT"/>
|
||||||
|
<column name="path" value="company/{company_id}"/>
|
||||||
|
<column name="bucket_name" value="mementoresources"/>
|
||||||
|
<column name="created_date" value="2025-02-20 03:00:00"/>
|
||||||
|
<column name="updated_date" value="2025-02-20 03:00:00"/>
|
||||||
|
<column name="parent_folder" value="gepafin/local"/>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert tableName="s3_path_configuration">
|
||||||
|
<column name="type" value="DELETED_COMPANY_DOCUMENT"/>
|
||||||
|
<column name="path" value="company/{company_id}/deleted"/>
|
||||||
|
<column name="bucket_name" value="mementoresources"/>
|
||||||
|
<column name="created_date" value="2025-02-20 03:00:00"/>
|
||||||
|
<column name="updated_date" value="2025-02-20 03:00:00"/>
|
||||||
|
<column name="parent_folder" value="gepafin/local"/>
|
||||||
|
</insert>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="24-02-2025_RK_125215" author="Rajesh Khore">
|
||||||
|
<sqlFile dbms="postgresql"
|
||||||
|
path="db/dump/updated_expiration_scheduler_data_24_02_2025.sql"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="24-02-2025_RK_125145" author="Rajesh Khore">
|
||||||
|
<sqlFile dbms="postgresql"
|
||||||
|
path="db/dump/updated_json_template_for_notification_24_02_2025.sql"/>
|
||||||
|
</changeSet>
|
||||||
<changeSet id="17-02-2025_PK_025237" author="Piyush Kag">
|
<changeSet id="17-02-2025_PK_025237" author="Piyush Kag">
|
||||||
<renameColumn tableName="call"
|
<renameColumn tableName="call"
|
||||||
oldColumnName="product_id"
|
oldColumnName="product_id"
|
||||||
newColumnName="appointment_template_id"/>
|
newColumnName="appointment_template_id"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="26-02-2025_NK_180530" author="Nisha Kashyap">
|
||||||
|
<sqlFile dbms="postgresql"
|
||||||
|
path="db/dump/updated_hub_data_for_email_service_config_25-02-2025.sql"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
INSERT INTO expiration_config (interval_days, type, created_date, updated_date)
|
||||||
|
VALUES
|
||||||
|
(7, 'COMPANY_DOCUMENT', '2025-02-24T11:00:51', '2025-02-24T11:00:51');
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
UPDATE hub
|
||||||
|
SET email_service_type = 'PEC_SERVICE',
|
||||||
|
email_service_config = 'JkFbBfuVvq7VWwp5LcWIi+hAa1RJ1ekI0jq3w7gLTXETZiTaN8zC4OBWD53x8FtbfFTh3L/5805CIYTH1BQGa3X9q16q9SDzMy7DKHdmJzOnLKhn74C5akoXKaeXUCGnzp0cSk2c01FV6lwefC29IshijFSumCHtVlgWNeZigBzmWK+M7NS+EXf4goIMzguL5bHpYXfoQunQozeY1SpOoxf4XZfd/MNPeVOA/ZNHDGU='
|
||||||
|
WHERE UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs';
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
INSERT INTO notification_type (notification_name,title, json_template,created_date,updated_date,is_deleted) VALUES
|
||||||
|
('COMPANY_DOCUMENT_EXPIRATION_REMINDER','Il documento sta per scadere','Il documento "{{file_name}}" per lazienda "{{company_name}}" scadrà il {{expiration_date}}. Assicurati di rinnovarlo o sostituirlo prima della scadenza.','2025-02-24T10:16:26.472Z','2025-02-24T10:16:26.472Z','false');
|
||||||
@@ -166,6 +166,11 @@ validation.field.max_length=Field {0} must be no more than {1} characters long.
|
|||||||
validation.field.pattern=Field {0} does not match the required pattern.
|
validation.field.pattern=Field {0} does not match the required pattern.
|
||||||
validation.field.not_null=Field {0} must not be null.
|
validation.field.not_null=Field {0} must not be null.
|
||||||
validation.field.not_empty=Field {0} must not be empty.
|
validation.field.not_empty=Field {0} must not be empty.
|
||||||
|
validation.field.max_value=Field {0} must be no more than {1}.
|
||||||
|
validation.field.min_value=Field {0} must be greater than {1}.
|
||||||
|
validation.field.min.checkbox=Field {0} should be checked for atleast {1}.
|
||||||
|
validation.field.max.checkbox=Field {0} should have only {1} checked.
|
||||||
|
|
||||||
|
|
||||||
current.form.incomplete=Current form is not filled.
|
current.form.incomplete=Current form is not filled.
|
||||||
flow.not.found=Flow not found.
|
flow.not.found=Flow not found.
|
||||||
@@ -371,5 +376,21 @@ validation.required.requested.amount=The Requested Amount configuration should b
|
|||||||
company.id.not.null=Company ID cannot be null.
|
company.id.not.null=Company ID cannot be null.
|
||||||
formula.amount.not.matches.requested.amount= The {0} does not matches to calculated amount.
|
formula.amount.not.matches.requested.amount= The {0} does not matches to calculated amount.
|
||||||
|
|
||||||
|
document.category.update.success = Document Category updated successfully.
|
||||||
|
document.category.delete.success = Document Category deleted successfully.
|
||||||
|
document.category.get.success = Document Category fetched successfully.
|
||||||
|
document.category.success = Document Category created successfully.
|
||||||
|
document.category.not.found = Document Category not found.
|
||||||
|
error.moving.file.to.deleted.folder = Error occurred while moving company file to deleted folder.
|
||||||
|
|
||||||
|
company.document.fetched.successfully = Company Document fetched successfully.
|
||||||
|
company.document.updated.successfully = Company Document Updated successfully.
|
||||||
|
category.cannot.be.deleted = Category cannot be deleted as it is associated with company documents.
|
||||||
|
company.document.copied.successfully = Company Document Copied successfully.
|
||||||
|
invalid.expiration.date = Invalid Expiration Date
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
appointment.cannot.be.created = Appointment cannot be created because call doesn't have the template id.
|
appointment.cannot.be.created = Appointment cannot be created because call doesn't have the template id.
|
||||||
appointment.not.created = Appointment not created please try again.
|
appointment.not.created = Appointment not created please try again.
|
||||||
|
validation.failed.checklist=Validation failed for checklist.
|
||||||
|
|||||||
@@ -160,6 +160,11 @@ validation.field.max_length=Il campo {0} deve essere lungo al massimo {1} caratt
|
|||||||
validation.field.pattern=Il campo {0} non corrisponde al modello richiesto.
|
validation.field.pattern=Il campo {0} non corrisponde al modello richiesto.
|
||||||
validation.field.not_null=Il campo {0} non deve essere nullo.
|
validation.field.not_null=Il campo {0} non deve essere nullo.
|
||||||
validation.field.not_empty=Il campo {0} non deve essere vuoto.
|
validation.field.not_empty=Il campo {0} non deve essere vuoto.
|
||||||
|
validation.field.max_value=Il campo {0} non deve essere pi<70> grande di {1}.
|
||||||
|
validation.field.min_value=Il campo {0} deve essere maggiore di {1}.
|
||||||
|
validation.field.min.checkbox=Il campo {0} dovrebbe essere controllato almeno per {1}.
|
||||||
|
validation.field.max.checkbox=Il campo {0} dovrebbe avere solo {1} selezionato.
|
||||||
|
|
||||||
current.form.incomplete=il modulo corrente non ? compilato
|
current.form.incomplete=il modulo corrente non ? compilato
|
||||||
flow.not.found=Flow not found.
|
flow.not.found=Flow not found.
|
||||||
validation.message=Messaggi di convalida.
|
validation.message=Messaggi di convalida.
|
||||||
@@ -362,5 +367,20 @@ validation.required.requested.amount=La configurazione dell'importo richiesto
|
|||||||
company.id.not.null=L'ID dell'azienda non pu? essere nullo.
|
company.id.not.null=L'ID dell'azienda non pu? essere nullo.
|
||||||
formula.amount.not.matches.requested.amount=Il {0} non corrisponde all'importo calcolato.
|
formula.amount.not.matches.requested.amount=Il {0} non corrisponde all'importo calcolato.
|
||||||
|
|
||||||
appointment.cannot.be.created = Impossibile creare l'appuntamento perché la chiamata non ha l'ID del modello di appuntamento.
|
document.category.update.success = Categoria documento aggiornata correttamente.
|
||||||
|
document.category.delete.success = Categoria documento eliminata correttamente.
|
||||||
|
document.category.not.found = Categoria documento non trovata.
|
||||||
|
document.category.get.success = Categoria del documento recuperata correttamente.
|
||||||
|
document.category.success =Categoria documento creata correttamente.
|
||||||
|
company.document.copied.successfully = Documento aziendale copiato correttamente.
|
||||||
|
error.moving.file.to.deleted.folder = Si è verificato un errore durante lo spostamento del file aziendale nella cartella eliminata.ss
|
||||||
|
|
||||||
|
company.document.fetched.successfully = Documento aziendale recuperato con successo.
|
||||||
|
company.document.updated.successfully = Documento aziendale aggiornato con successo.
|
||||||
|
category.cannot.be.deleted = La categoria non può essere eliminata perché è associata a documenti aziendali.
|
||||||
|
invalid.expiration.date = Data di scadenza non valida
|
||||||
|
|
||||||
|
|
||||||
|
appointment.cannot.be.created = Impossibile creare l'appuntamento perch<63> la chiamata non ha l'ID del modello di appuntamento.
|
||||||
appointment.not.created = Appuntamento non creato, riprova
|
appointment.not.created = Appuntamento non creato, riprova
|
||||||
|
validation.failed.checklist=Convalida fallita per la checklist.
|
||||||
|
|||||||
Reference in New Issue
Block a user