Merge branch 'develop' of https://github.com/Kitzanos/GEPAFIN-BE into feature/GEPAFINBE-167
This commit is contained in:
@@ -6,7 +6,7 @@ public class AppointmentApiConstant {
|
||||
public static final String GET_NDG_BY_VAT_NUMBER = "/WSAnagrafica.getListaNdg";
|
||||
public static final String CREATE_VISURA = "/WSAnagrafica.createVisura";
|
||||
public static final String GET_VISURA_LIST = "/WSAnagrafica.getVisuraList";
|
||||
public static final String GET_APPOINTMENT_TEMPLATE = "/WSCrmConsulenza.getAppuntamentoTemplate?idAppuntamentoTemplate=7";
|
||||
public static final String GET_APPOINTMENT_TEMPLATE = "/WSCrmConsulenza.getAppuntamentoTemplate";
|
||||
public static final String CREATE_APPOINTMENT_FROM_TEMPLATE = "/WSCrmConsulenza.createAppointmentFromTemplate";
|
||||
public static final String UPLOAD_APOOINTMENT_DOCUMENT = "/WSDocumentDetail.createStream";
|
||||
|
||||
@@ -24,4 +24,18 @@ public class AppointmentApiConstant {
|
||||
public static final boolean IS_FROM_RATING = Boolean.FALSE;
|
||||
public static final boolean IS_ANAGRAFICA_LEGAME = Boolean.FALSE;
|
||||
|
||||
//Appointment creation request body fields
|
||||
public static final String MOTIVAZIONE = "motivazione";
|
||||
public static final String PRODOTTO = "prodotto";
|
||||
public static final String COD_ABI = "codAbi";
|
||||
public static final String COD_CAB = "codCab";
|
||||
public static final String ID_NOTA = "idNota";
|
||||
public static final String IMPORTO_AGEVOLATO = "importoAgevolato";
|
||||
public static final String IMPORTO_MEDIOLUNGO_TERMINE = "importoMedioLungoTermine";
|
||||
public static final String COD_TIPO_PRODOTTO = "codTipoProdotto";
|
||||
public static final String COD_CATEGORIA_PRODOTTO = "codCategoriaProdotto";
|
||||
public static final String COD_FORMATECNICA = "codFormaTecnica";
|
||||
public static final String COD_OPERAZIONE = "codOperazione";
|
||||
public static final String MOTIVAZIONE_ID = "id";
|
||||
public static final String PRODOTTO_CODE = "code";
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ public class GepafinConstant {
|
||||
public static final String DATA_STRING = "data";
|
||||
public static final String DOCUMENT_ATTACHMENT_ID_STRING = "documentAttachmentId";
|
||||
public static final String TEMP_FILE_PATH = "/tmp/";
|
||||
public static final String RICHIESTA_CLIENTE_STRING = "richiestaCliente";
|
||||
public static final String RICHIESTE_CLIENTE_STRING = "richiesteCliente";
|
||||
public static final String ID_STRING = "id";
|
||||
public static final String NULL_STRING = "null";
|
||||
public static final String NDG_STRING = "ndg";
|
||||
@@ -391,6 +391,16 @@ public class GepafinConstant {
|
||||
public static final String NON_EMPTY_TABLES="nonEmptyTables";
|
||||
public static final String VALIDATION_IN_TABLE = "validation.table.message";
|
||||
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";
|
||||
|
||||
|
||||
@@ -438,6 +448,26 @@ public class GepafinConstant {
|
||||
|
||||
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_NOT_CREATED = "appointment.not.created";
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@ package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.Join;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
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.model.request.*;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.model.util.SortBy;
|
||||
import net.gepafin.tendermanagement.repositories.*;
|
||||
import net.gepafin.tendermanagement.service.*;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
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.stereotype.Component;
|
||||
|
||||
@@ -37,6 +42,7 @@ import java.util.stream.Collectors;
|
||||
import static java.time.temporal.ChronoUnit.DAYS;
|
||||
import static net.gepafin.tendermanagement.util.Utils.log;
|
||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
|
||||
@Component
|
||||
public class ApplicationAmendmentRequestDao {
|
||||
@@ -119,6 +125,15 @@ public class ApplicationAmendmentRequestDao {
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private EvaluationFormRepository evaluationFormRepository;
|
||||
|
||||
@Autowired
|
||||
private ApplicationEvaluationFormFieldRepository applicationEvaluationFormFieldRepository;
|
||||
|
||||
@Autowired
|
||||
private ApplicationEvaluationFormRepository applicationEvaluationFormRepository;
|
||||
|
||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(Long applicationEvaluationId) {
|
||||
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
||||
@@ -132,16 +147,10 @@ public class ApplicationAmendmentRequestDao {
|
||||
if(file != null){
|
||||
evaluationFileRequests=Utils.convertJsonStringToList(file,FieldRequest.class);
|
||||
}
|
||||
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));
|
||||
if(applicationEvaluationEntity.getEvaluationVersion().equals(EvaluationVersionEnum.V1.getValue())) {
|
||||
checklistValidationForEvaluationV1(evaluationFileRequests, checkList, checklistRequests);
|
||||
} else if (applicationEvaluationEntity.getEvaluationVersion().equals(EvaluationVersionEnum.V2.getValue())) {
|
||||
validationCheckEvaluationV2(applicationEvaluationEntity, application);
|
||||
}
|
||||
// Set common application-level details
|
||||
String callName = application.getCall().getName();
|
||||
@@ -186,6 +195,47 @@ public class ApplicationAmendmentRequestDao {
|
||||
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) {
|
||||
List<AmendmentFormFieldResponse> formFieldResponses = new ArrayList<>();
|
||||
@@ -1214,4 +1264,118 @@ public class ApplicationAmendmentRequestDao {
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,8 +117,8 @@ public class ApplicationDao {
|
||||
@Autowired
|
||||
private AssignedApplicationsRepository assignedApplicationsRepository;
|
||||
|
||||
@Value("${default_System_Receiver_Email}")
|
||||
private String defaultSystemReceiverEmail;
|
||||
// @Value("${default_System_Receiver_Email}")
|
||||
// private String defaultSystemReceiverEmail;
|
||||
|
||||
@Value("${rinaldo_email}")
|
||||
private String rinaldoEmail;
|
||||
@@ -1538,6 +1538,22 @@ public class ApplicationDao {
|
||||
criteriaBuilder.upper(root.get(GepafinConstant.COMMENTS)),
|
||||
"%" + search.toUpperCase() + "%"
|
||||
);
|
||||
// Predicate protocolPredicate = criteriaBuilder.like(
|
||||
// criteriaBuilder.function(
|
||||
// "TO_CHAR",
|
||||
// String.class,
|
||||
// criteriaBuilder.function("CAST", String.class, root.get(GepafinConstant.PROTOCOL).get(GepafinConstant.PROTOCOL_NUMBER))
|
||||
// ),
|
||||
// "%" + search + "%"
|
||||
// );
|
||||
|
||||
Predicate callNamePredicate =criteriaBuilder.like(
|
||||
criteriaBuilder.upper(root.get(GepafinConstant.CALL).get(GepafinConstant.NAME)), // Adjust field name
|
||||
"%" + search.toUpperCase() + "%"
|
||||
);
|
||||
|
||||
// predicates.add(criteriaBuilder.or(protocolPredicate));
|
||||
predicates.add(criteriaBuilder.or(callNamePredicate));
|
||||
predicates.add(criteriaBuilder.or(titlePredicate));
|
||||
}
|
||||
|
||||
@@ -1720,5 +1736,11 @@ public class ApplicationDao {
|
||||
// Step 4: Evaluate the mathematical expression
|
||||
return Utils.evaluateExpression(expression);
|
||||
}
|
||||
|
||||
public ApplicationEntity validateApplicationWithCompany(Long id,Long companyId) {
|
||||
ApplicationEntity application=applicationRepository.findByIdAndCompanyIdAndIsDeletedFalse(id,companyId);
|
||||
if (application==null){
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.PERMISSION_DENIED));
|
||||
}
|
||||
return application;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,18 +17,19 @@ 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.Status;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.MessageFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
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.setIfUpdated;
|
||||
@@ -296,7 +297,7 @@ public class ApplicationEvaluationDao {
|
||||
response.setCreatedDate(entity.getCreatedDate());
|
||||
response.setUpdatedDate(entity.getUpdatedDate());
|
||||
response.setNumberOfCheck(entity.getAssignedApplicationsEntity().getApplication().getCall().getNumberOfCheck());
|
||||
response.setProductId(entity.getAssignedApplicationsEntity().getApplication().getCall().getProductId());
|
||||
response.setAppointmentTemplateId(entity.getAssignedApplicationsEntity().getApplication().getCall().getAppointmentTemplateId());
|
||||
|
||||
}
|
||||
|
||||
@@ -1157,7 +1158,7 @@ public class ApplicationEvaluationDao {
|
||||
LocalDateTime callEndDate = application.getCall().getEndDate();
|
||||
response.setCallEndDate(callEndDate);
|
||||
response.setNumberOfCheck(call.getNumberOfCheck());
|
||||
response.setProductId(call.getProductId());
|
||||
response.setAppointmentTemplateId(call.getAppointmentTemplateId());
|
||||
setCriteriaResponses(entity, application.getId(), response, evaluationCriterias);
|
||||
setChecklistResponses(entity, application.getId(), response, checklistEntities);
|
||||
setFileResponses(entity, application.getId(), response, applicationFormEntities);
|
||||
@@ -1968,7 +1969,9 @@ public class ApplicationEvaluationDao {
|
||||
//Handling Application Evaluation form
|
||||
EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
|
||||
validateFormFields(applicationEvaluationFormRequestBean,evaluationFormEntity);
|
||||
// formService.validateFormField(applicationRequestBean.getFormFields(),applicationEntity,formEntity);
|
||||
// ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationRepository.findByAssignedApplicationsId(assignedApplicationId);
|
||||
validateFormFieldCustom(applicationEvaluationFormRequestBean.getFormFields(),entity,evaluationFormEntity);
|
||||
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,entity);
|
||||
createOrUpdateMultipleFormFields(applicationEvaluationFormRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
|
||||
return processEvaluationForm(entity);
|
||||
@@ -2024,17 +2027,20 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
public List<ApplicationEvaluationFormFieldEntity> createOrUpdateMultipleFormFields(List<ApplicationFormFieldRequestBean> formFieldRequestBeans,
|
||||
ApplicationEvaluationFormEntity applicationEvaluationFormEntity, EvaluationFormEntity evaluationFormEntity) {
|
||||
FieldValidator fieldValidator = FieldValidator.create();
|
||||
|
||||
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());
|
||||
fieldValidator.validate();
|
||||
return applicationEvaluationFormFieldEntities;
|
||||
}
|
||||
|
||||
public ApplicationEvaluationFormFieldEntity createOrUpdateApplicationEvaluationFormField(ApplicationFormFieldRequestBean applicationFormFieldRequestBean,
|
||||
ApplicationEvaluationFormEntity applicationEvaluationFormEntity,
|
||||
List<ApplicationEvaluationFormFieldEntity> applicationEvaluationFormFieldEntities,
|
||||
EvaluationFormEntity evaluationFormEntity){
|
||||
EvaluationFormEntity evaluationFormEntity,FieldValidator fieldValidator){
|
||||
ApplicationEvaluationFormFieldEntity applicationEvaluationFormFieldEntity = new ApplicationEvaluationFormFieldEntity();
|
||||
validateFileUploadDocuments(applicationFormFieldRequestBean, evaluationFormEntity);
|
||||
VersionActionTypeEnum actionType = VersionActionTypeEnum.INSERT;
|
||||
@@ -2057,7 +2063,8 @@ public class ApplicationEvaluationDao {
|
||||
}
|
||||
}
|
||||
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) {
|
||||
applicationEvaluationFormFieldEntity.setFieldValue(Utils.convertObjectToJsonString(applicationFormFieldRequestBean.getFieldValue()));
|
||||
} else {
|
||||
@@ -2202,7 +2209,8 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
ApplicationEvaluationFormResponse response = objectMapper.convertValue(convertedResponse, ApplicationEvaluationFormResponse.class);
|
||||
EvaluationFormEntity evaluationFormEntity = evaluationFormRepository.findByCallIdAndIsDeletedFalse(evaluationEntity.getAssignedApplicationsEntity().getApplication().getCall().getId());
|
||||
|
||||
response.setNumberOfCheck(evaluationEntity.getAssignedApplicationsEntity().getApplication().getCall().getNumberOfCheck());
|
||||
response.setAppointmentTemplateId(evaluationEntity.getAssignedApplicationsEntity().getApplication().getApplicationEvaluationId());
|
||||
if (evaluationFormEntity != null) {
|
||||
response.setApplicationEvaluationFormResponse(convertEvaluationFormToResponse(evaluationFormEntity, evaluationEntity));
|
||||
}
|
||||
@@ -2266,5 +2274,150 @@ public class ApplicationEvaluationDao {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import com.amazonaws.services.s3.AmazonS3Client;
|
||||
import com.amazonaws.services.s3.model.GetObjectRequest;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import feign.FeignException;
|
||||
@@ -16,18 +17,14 @@ import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||
import net.gepafin.tendermanagement.entities.DocumentEntity;
|
||||
import net.gepafin.tendermanagement.entities.HubEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.request.AppointmentCreationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.AppointmentNdgRequest;
|
||||
import net.gepafin.tendermanagement.model.request.AppointmentVisuraListRequest;
|
||||
import net.gepafin.tendermanagement.model.request.AppointmentVisuraRequest;
|
||||
import net.gepafin.tendermanagement.model.request.CreateAppointmentRequest;
|
||||
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||
import net.gepafin.tendermanagement.model.request.UploadDocToExternalSystemRequest;
|
||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||
import net.gepafin.tendermanagement.model.response.AppointmentCreationResponse;
|
||||
@@ -63,7 +60,6 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -406,10 +402,15 @@ public class AppointmentDao {
|
||||
}
|
||||
// Handle non-OK response
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.ERROR_IN_GENERATING_NDG_TRY_AGAIN));
|
||||
} catch (FeignException.Forbidden forbiddenException) {
|
||||
logForbiddenError();
|
||||
// Regenerate the token and retry
|
||||
regenerateTokenAndSave(hub);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to authenticate user on Odessa : {}", e.getMessage(), e);
|
||||
throw new RuntimeException("Authentication failed on Odessa. try again", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private AppointmentLoginResponse retrieveNdgByVatNumber(String vatNumber, String authorizationToken, HubEntity hub, ApplicationEntity application) {
|
||||
@@ -626,7 +627,11 @@ public class AppointmentDao {
|
||||
|
||||
// Generate authorization token and fetch template data
|
||||
String authorizationToken = getBearerToken(hub);
|
||||
ResponseEntity<Object> response = appointmentApiService.getAppointmentTemplateForTemplateCreation(authorizationToken);
|
||||
Long appointmentTemplateId = application.getCall().getAppointmentTemplateId();
|
||||
if (appointmentTemplateId == null) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPOINTMENT_CANNOT_BE_CREATED));
|
||||
}
|
||||
ResponseEntity<Object> response = appointmentApiService.getAppointmentTemplateForTemplateCreation(authorizationToken, appointmentTemplateId);
|
||||
|
||||
if (response.getStatusCode() != HttpStatus.OK) {
|
||||
log.error("Failed to retrieve appointment template for appointment creation. Status: {}", response.getStatusCode());
|
||||
@@ -638,7 +643,7 @@ public class AppointmentDao {
|
||||
AppointmentCreationRequest templateRichiestaData = parseTemplateResponseData(responseDataForTemplate);
|
||||
|
||||
// Build the appointment request body
|
||||
AppointmentCreationRequest appointmentCreationRequest = buildAppointmentCreationRequest(applicationId, createAppointmentRequest, hub.getAreaCode(),
|
||||
AppointmentCreationRequest appointmentCreationRequest = buildAppointmentCreationRequest(applicationId, createAppointmentRequest, appointmentTemplateId,
|
||||
templateRichiestaData);
|
||||
String appointmentRequestBody = Utils.convertObjectToJson(appointmentCreationRequest);
|
||||
|
||||
@@ -646,16 +651,17 @@ public class AppointmentDao {
|
||||
ResponseEntity<Object> appointmentResponse = appointmentApiService.createAppointment(authorizationToken, context, appointmentRequestBody);
|
||||
String appointmentId = extractAppointmentIdFromResponse(appointmentResponse);
|
||||
|
||||
if (appointmentId != null) {
|
||||
// Update application with the appointment ID
|
||||
application.setAppointmentId(appointmentId);
|
||||
application.setStatus(ApplicationStatusTypeEnum.APPOINTMENT.getValue());
|
||||
applicationRepository.save(application);
|
||||
|
||||
// Log version history
|
||||
loggingUtil.addVersionHistory(
|
||||
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationData).newData(application).build());
|
||||
if (appointmentId == null) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPOINTMENT_NOT_CREATED));
|
||||
}
|
||||
// Update application with the appointment ID
|
||||
application.setAppointmentId(appointmentId);
|
||||
application.setStatus(ApplicationStatusTypeEnum.APPOINTMENT.getValue());
|
||||
applicationRepository.save(application);
|
||||
|
||||
// Log version history
|
||||
loggingUtil.addVersionHistory(
|
||||
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationData).newData(application).build());
|
||||
|
||||
appointmentCreationResponse.setAppointmentId(appointmentId);
|
||||
return appointmentCreationResponse;
|
||||
@@ -684,32 +690,64 @@ public class AppointmentDao {
|
||||
public AppointmentCreationRequest parseTemplateResponseData(String jsonResponse) {
|
||||
|
||||
try {
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode rootNode = objectMapper.readTree(jsonResponse);
|
||||
JsonNode richiestaClienteArray = rootNode.path(GepafinConstant.DATA_STRING).path(GepafinConstant.RICHIESTA_CLIENTE_STRING);
|
||||
JsonNode richiesteClienteArray = rootNode.path(GepafinConstant.DATA_STRING).path(GepafinConstant.RICHIESTE_CLIENTE_STRING);
|
||||
|
||||
// Initialize the result object
|
||||
AppointmentCreationRequest appointmentCreationRequest = new AppointmentCreationRequest();
|
||||
AppointmentCreationRequest.Input input = new AppointmentCreationRequest.Input();
|
||||
|
||||
// Map `richiestaCliente` array
|
||||
List<AppointmentCreationRequest.RichiestaCliente> richiestaClienteList = new ArrayList<>();
|
||||
if (richiestaClienteArray.isArray()) {
|
||||
for (JsonNode richiestaNode : richiestaClienteArray) {
|
||||
richiestaClienteList.add(objectMapper.treeToValue(richiestaNode, AppointmentCreationRequest.RichiestaCliente.class));
|
||||
}
|
||||
if (!richiesteClienteArray.isArray()) {
|
||||
log.warn("richiesteCliente array is missing or not an array.");
|
||||
return new AppointmentCreationRequest();
|
||||
}
|
||||
for (JsonNode richiestaNode : richiesteClienteArray) {
|
||||
if (richiestaNode.isNull())
|
||||
continue;
|
||||
|
||||
AppointmentCreationRequest.RichiestaCliente richiestaCliente = new AppointmentCreationRequest.RichiestaCliente();
|
||||
JsonNode prodottoNode = richiestaNode.path(AppointmentApiConstant.PRODOTTO);
|
||||
String prodottoCode = prodottoNode.path(AppointmentApiConstant.PRODOTTO_CODE).asText();
|
||||
|
||||
richiestaCliente.setCodProdotto(prodottoCode);
|
||||
richiestaCliente.setIdMotivazione(getIntValue(richiestaNode));
|
||||
richiestaCliente.setCodAbi(getTextValue(richiestaNode, AppointmentApiConstant.COD_ABI));
|
||||
richiestaCliente.setCodCab(getTextValue(richiestaNode, AppointmentApiConstant.COD_CAB));
|
||||
richiestaCliente.setIdNota(getTextValue(richiestaNode, AppointmentApiConstant.ID_NOTA));
|
||||
richiestaCliente.setImportoAgevolato(getTextValue(richiestaNode, AppointmentApiConstant.IMPORTO_AGEVOLATO));
|
||||
richiestaCliente.setImportoMedioLungoTermine(getTextValue(richiestaNode, AppointmentApiConstant.IMPORTO_MEDIOLUNGO_TERMINE));
|
||||
richiestaCliente.setCodTipoProdotto(getTextValue(richiestaNode, AppointmentApiConstant.COD_TIPO_PRODOTTO));
|
||||
richiestaCliente.setCodCategoriaProdotto(getTextValue(richiestaNode, AppointmentApiConstant.COD_CATEGORIA_PRODOTTO));
|
||||
richiestaCliente.setCodFormaTecnica(getTextValue(richiestaNode, AppointmentApiConstant.COD_FORMATECNICA));
|
||||
richiestaCliente.setCodOperazione(getTextValue(richiestaNode, AppointmentApiConstant.COD_OPERAZIONE));
|
||||
|
||||
richiestaClienteList.add(richiestaCliente);
|
||||
}
|
||||
|
||||
input.setRichiestaCliente(richiestaClienteList);
|
||||
appointmentCreationRequest.setInput(input);
|
||||
|
||||
return appointmentCreationRequest;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error parsing template response: {}", e.getMessage(), e);
|
||||
throw new IllegalStateException("Failed to parse template response", e);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("JSON processing error: {}", e.getMessage(), e);
|
||||
throw new IllegalStateException("Invalid JSON structure in template response", e);
|
||||
}
|
||||
}
|
||||
|
||||
public AppointmentCreationRequest buildAppointmentCreationRequest(Long applicationId, CreateAppointmentRequest createAppointmentRequest, String areaCode,
|
||||
private String getTextValue(JsonNode node, String fieldName) {
|
||||
|
||||
return node.path(fieldName).isTextual() ? node.path(fieldName).asText() : null;
|
||||
}
|
||||
|
||||
private int getIntValue(JsonNode node) {
|
||||
|
||||
return node.path(AppointmentApiConstant.MOTIVAZIONE).path(AppointmentApiConstant.MOTIVAZIONE_ID).asInt();
|
||||
}
|
||||
|
||||
public AppointmentCreationRequest buildAppointmentCreationRequest(Long applicationId, CreateAppointmentRequest createAppointmentRequest, Long areaCode,
|
||||
AppointmentCreationRequest templateRichiestaData) {
|
||||
|
||||
ApplicationEntity application = applicationService.validateApplication(applicationId);
|
||||
@@ -733,7 +771,8 @@ public class AppointmentDao {
|
||||
requestNota.setTitolo(nota.getTitolo());
|
||||
requestNota.setTesto(nota.getTesto());
|
||||
richiestaCliente.setNota(requestNota);
|
||||
|
||||
richiestaCliente.setDurataMesiFinanziamento(createAppointmentRequest.getDurataMesiFinanziamento());
|
||||
richiestaCliente.setImportoBreveTermine(createAppointmentRequest.getImportoBreveTermine());
|
||||
richiestaClienteList.add(richiestaCliente);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
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 net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
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.model.request.ApplicationEvaluationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||
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.ApplicationRepository;
|
||||
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
||||
@@ -26,17 +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.Status;
|
||||
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.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.gepafin.tendermanagement.util.Utils.log;
|
||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
|
||||
@Component
|
||||
public class AssignedApplicationsDao {
|
||||
@@ -201,7 +211,9 @@ public class AssignedApplicationsDao {
|
||||
assignedApplicationsResponse.setEvaluationEndDate(applicationEvaluationEntity.get().getEndDate());
|
||||
}
|
||||
assignedApplicationsResponse.setNumberOfCheck(application.getCall().getNumberOfCheck());
|
||||
assignedApplicationsResponse.setProductId(application.getCall().getProductId());
|
||||
assignedApplicationsResponse.setAppointmentTemplateId(application.getCall().getAppointmentTemplateId());
|
||||
assignedApplicationsResponse.setNdg(application.getNdg());
|
||||
assignedApplicationsResponse.setAppointmentId(application.getAppointmentId());
|
||||
return assignedApplicationsResponse;
|
||||
}
|
||||
|
||||
@@ -288,6 +300,118 @@ public class AssignedApplicationsDao {
|
||||
log.info("Assigned application fetched successfully: {}", 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) {
|
||||
|
||||
AssignedApplicationsEntity assignedApplication = validateAssignedApplication(assignedApplicationId);
|
||||
|
||||
@@ -202,7 +202,7 @@ public class CallDao {
|
||||
callEntity.setEndTime(DateTimeUtil.parseTime(createCallRequest.getEndTime()));
|
||||
callEntity.setHub(userEntity.getHub());
|
||||
callEntity.setNumberOfCheck(createCallRequest.getNumberOfCheck());
|
||||
callEntity.setProductId(createCallRequest.getProductId());
|
||||
callEntity.setAppointmentTemplateId(createCallRequest.getAppointmentTemplateId());
|
||||
callEntity = callRepository.save(callEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "Create Call" operation. **/
|
||||
@@ -610,7 +610,7 @@ public class CallDao {
|
||||
setIfUpdated(callEntity::getConfidi, callEntity::setConfidi, updateCallRequest.getConfidi());
|
||||
setIfUpdated(callEntity::getEvaluationVersion, callEntity::setEvaluationVersion, updateCallRequest.getEvaluationVersion().getValue());
|
||||
setIfUpdated(callEntity::getNumberOfCheck, callEntity::setNumberOfCheck, updateCallRequest.getNumberOfCheck());
|
||||
setIfUpdated(callEntity::getProductId, callEntity::setProductId, updateCallRequest.getProductId());
|
||||
setIfUpdated(callEntity::getAppointmentTemplateId, callEntity::setAppointmentTemplateId, updateCallRequest.getAppointmentTemplateId());
|
||||
callEntity = callRepository.save(callEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for the "update call step 1" operation **/
|
||||
@@ -718,7 +718,7 @@ public class CallDao {
|
||||
callDetailsResponseBean.setCreatedDate(callEntity.getCreatedDate());
|
||||
callDetailsResponseBean.setUpdatedDate(callEntity.getUpdatedDate());
|
||||
callDetailsResponseBean.setNumberOfCheck(callEntity.getNumberOfCheck());
|
||||
callDetailsResponseBean.setProductId(callEntity.getProductId());
|
||||
callDetailsResponseBean.setAppointmentTemplateId(callEntity.getAppointmentTemplateId());
|
||||
return callDetailsResponseBean;
|
||||
}
|
||||
|
||||
@@ -743,7 +743,7 @@ public class CallDao {
|
||||
createCallResponseBean.setAimedTo(amiedTo);
|
||||
createCallResponseBean.setCheckList(checkList);
|
||||
createCallResponseBean.setNumberOfCheck(callEntity.getNumberOfCheck());
|
||||
createCallResponseBean.setProductId(callEntity.getProductId());
|
||||
createCallResponseBean.setAppointmentTemplateId(callEntity.getAppointmentTemplateId());
|
||||
return createCallResponseBean;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,10 +122,40 @@ public class CompanyDao {
|
||||
userWithCompanyEntity.setPec(companyRequest.getPec());
|
||||
userWithCompanyEntity.setContactName(companyRequest.getContactName());
|
||||
userWithCompanyEntity.setContactEmail(companyRequest.getContactEmail());
|
||||
userWithCompanyEntity.setJson(Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) );
|
||||
UserWithCompanyEntity userWithCompany = userWithCompanyRepository.save(userWithCompanyEntity);
|
||||
/** This code is responsible for adding a version history log for the "adding user with company" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(userWithCompany).build());
|
||||
if (StringUtils.isEmpty(companyEntity.getJson())) {
|
||||
companyEntity.setJson(Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()));
|
||||
Map<String, Object> vatCheckResponse = companyRequest.getVatCheckResponse();
|
||||
Map<String, Object> data = (Map<String, Object>) vatCheckResponse.get("data");
|
||||
if (data != null) {
|
||||
if (data.containsKey("dettaglio")) {
|
||||
Map<String, Object> dettaglio = (Map<String, Object>) data.get("dettaglio");
|
||||
if (dettaglio != null) {
|
||||
if (dettaglio.containsKey("codice_ateco")) {
|
||||
Object codiceAtecoObj = dettaglio.get("codice_ateco");
|
||||
String codiceAteco = (codiceAtecoObj != null) ? codiceAtecoObj.toString() : null;
|
||||
|
||||
if (codiceAteco != null) {
|
||||
companyEntity.setCodiceAteco(codiceAteco);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companyEntity = companyRepository.save(companyEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for "updating company json field" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder()
|
||||
.request(request)
|
||||
.actionType(VersionActionTypeEnum.INSERT)
|
||||
.oldData(null)
|
||||
.newData(companyEntity)
|
||||
.build());
|
||||
}
|
||||
|
||||
return userWithCompany;
|
||||
}
|
||||
|
||||
@@ -143,6 +173,7 @@ public class CompanyDao {
|
||||
entity.setNumberOfEmployees(request.getNumberOfEmployees());
|
||||
entity.setAnnualRevenue(request.getAnnualRevenue());
|
||||
entity.setHub(userEntity.getHub());
|
||||
entity.setJson(Utils.convertMapIntoJsonString(request.getVatCheckResponse()));
|
||||
if (request.getVatCheckResponse() != null) {
|
||||
Map<String, Object> vatCheckResponse = request.getVatCheckResponse();
|
||||
Map<String, Object> data = (Map<String, Object>) vatCheckResponse.get("data");
|
||||
@@ -226,10 +257,10 @@ public class CompanyDao {
|
||||
UserWithCompanyEntity userWithCompanyEntity = getUserWithCompany(userEntity.getId(), companyId);
|
||||
//cloned entity for old data
|
||||
UserWithCompanyEntity oldUserWithCompanyData = Utils.getClonedEntityForData(userWithCompanyEntity);
|
||||
if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
|
||||
String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null;
|
||||
setIfUpdated(userWithCompanyEntity::getJson, userWithCompanyEntity::setJson, responseJson);
|
||||
}
|
||||
// if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
|
||||
// String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null;
|
||||
// setIfUpdated(companyEntity::getJson, companyEntity::setJson, responseJson);
|
||||
// }
|
||||
setIfUpdated(userWithCompanyEntity::getPec, userWithCompanyEntity::setPec, companyRequest.getPec());
|
||||
setIfUpdated(userWithCompanyEntity::getEmail, userWithCompanyEntity::setEmail, companyRequest.getEmail());
|
||||
setIfUpdated(userWithCompanyEntity::getContactName, userWithCompanyEntity::setContactName, companyRequest.getContactName());
|
||||
|
||||
@@ -248,7 +248,7 @@ public class FlowFormDao {
|
||||
//
|
||||
// return applicationFormEntities.isEmpty() ? null : applicationFormEntities.get(0).getForm().getId();
|
||||
// }
|
||||
public NextOrPreviousFormResponse getNextOrPreviousForm(ApplicationEntity applicationEntity, Long formId,
|
||||
public NextOrPreviousFormResponse getNextOrPreviousForm(ApplicationEntity applicationEntity,Long companyId, Long formId,
|
||||
FormActionEnum action) {
|
||||
Long calculatedFormId = null;
|
||||
FormEntity formEntity = null;
|
||||
|
||||
@@ -415,8 +415,8 @@ public class FormDao {
|
||||
}
|
||||
FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class);
|
||||
validator
|
||||
.minLength(value, fieldValidatorBean.getMinLength(), fieldLabel) // Only applies if minLength is not null
|
||||
.maxLength(value, fieldValidatorBean.getMaxLength(), fieldLabel) // Only applies if maxLength is not null
|
||||
.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
|
||||
if (fieldValidatorBean.getCustom() != null && fieldValidatorBean.getCustom().equals(GepafinConstant.IS_PIVA)) {
|
||||
@@ -429,28 +429,34 @@ public class FormDao {
|
||||
validator.validate();
|
||||
}
|
||||
|
||||
private void checkObjectData(String fieldId, Object fieldValue, Map<String, Object> formFieldMap) {
|
||||
if (fieldValue instanceof List<?>) {
|
||||
public void checkObjectData(String fieldId, Object fieldValue, Map<String, Object> 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) {
|
||||
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) {
|
||||
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))) {
|
||||
if (fieldValue != null) {
|
||||
formFieldMap.put(fieldId, fieldValue);
|
||||
}
|
||||
} else setFormFieldMap(fieldId, formFieldMap, fieldValue);
|
||||
}
|
||||
else setFormFieldMap(fieldId, formFieldMap, fieldValue);
|
||||
}
|
||||
private void setFormFieldMap(String fieldId, Map<String, Object> formFieldMap, Object value) {
|
||||
if (value instanceof String) {
|
||||
if(value !=null && Boolean.FALSE.equals(StringUtils.isEmpty((String)value))) {
|
||||
public void setFormFieldMap(String fieldId, Map<String, Object> formFieldMap, Object value) {
|
||||
if(value !=null){
|
||||
String fieldValue= String.valueOf(value);
|
||||
if(Boolean.FALSE.equals(StringUtils.isEmpty(fieldValue))) {
|
||||
formFieldMap.put(fieldId, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.Expression;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
@@ -426,4 +427,47 @@ public class NotificationDao {
|
||||
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 {
|
||||
// Create a PdfPTable with dynamic column count based on stateFieldMap size
|
||||
Map<String, String> stateFieldMap = new HashMap<>();
|
||||
Map<String, Boolean> stateFieldBoolean = new HashMap<>();
|
||||
Map<String, Boolean> formulaEnabledMap = new HashMap<>();
|
||||
Map<String, String> formulaTypeMap = new HashMap<>();
|
||||
Map<String, String> fieldTypeMap = new HashMap<>();
|
||||
Map<String, String> totalMap = new HashMap<>();
|
||||
Map<String, String> stateFieldMap = new LinkedHashMap<>();
|
||||
Map<String, Boolean> stateFieldBoolean = new LinkedHashMap<>();
|
||||
Map<String, Boolean> formulaEnabledMap = new LinkedHashMap<>();
|
||||
Map<String, String> formulaTypeMap = new LinkedHashMap<>();
|
||||
Map<String, String> fieldTypeMap = new LinkedHashMap<>();
|
||||
Map<String, String> totalMap = new LinkedHashMap<>();
|
||||
Font lightGrayFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(110, 110, 110)); // Light gray
|
||||
|
||||
|
||||
|
||||
@@ -2,15 +2,18 @@ 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 net.gepafin.tendermanagement.entities.RoleActionContextEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserActionEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.*;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.model.response.ActionContextLabelResponse;
|
||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.UserActionResponseBean;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationPageableRequestBean;
|
||||
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.RoleActionContextRepository;
|
||||
import net.gepafin.tendermanagement.repositories.UserActionsRepository;
|
||||
@@ -23,9 +26,12 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
|
||||
@Component
|
||||
public class UserActionDao {
|
||||
|
||||
@@ -41,16 +47,14 @@ public class UserActionDao {
|
||||
@Autowired
|
||||
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 applicationsProcessed = assignedApplicationsRepository.countAssignedApplicationsByUserId(userEntity.getId());
|
||||
|
||||
List<UserActionEntity> userActions = getFilterUserActions(userEntity.getId(),timeFilter,actionContext);
|
||||
|
||||
return createSummaryPageResponse(userEntity,numberOfLoginAttempts,applicationsProcessed,userActions);
|
||||
return createSummaryPageResponse(userEntity,numberOfLoginAttempts,applicationsProcessed);
|
||||
}
|
||||
|
||||
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();
|
||||
response.setRole(user.getRoleEntity().getRoleName());
|
||||
response.setLastLogin(user.getLastLogin());
|
||||
@@ -59,9 +63,6 @@ public class UserActionDao {
|
||||
response.setEmail(user.getEmail());
|
||||
response.setNumberOfLoginAttempts(numberOfLoginAttempts);
|
||||
response.setApplicationsProcessed(applicationsProcessed);
|
||||
|
||||
List<UserActionResponseBean> userAction = convertEntityToResponse(userActions);
|
||||
response.setUserActions(userAction);
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -137,6 +138,7 @@ public class UserActionDao {
|
||||
responseBean.setResponse(action.getResponse());
|
||||
responseBean.setCreatedDate(action.getCreatedDate());
|
||||
responseBean.setUpdatedDate(action.getUpdatedDate());
|
||||
responseBean.setMethodType(action.getMethodType());
|
||||
return responseBean;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
@@ -157,4 +159,138 @@ public class UserActionDao {
|
||||
return responseBean;
|
||||
}).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;
|
||||
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
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.response.*;
|
||||
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.UserRepository;
|
||||
import net.gepafin.tendermanagement.service.HubService;
|
||||
@@ -29,8 +33,13 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,6 +47,7 @@ import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
|
||||
@Component
|
||||
public class UserDao {
|
||||
@@ -597,11 +607,157 @@ public class UserDao {
|
||||
log.info("Total users found with role ID {}: {}", roleIds, userResponseBeans.size());
|
||||
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){
|
||||
log.info("Updating user by beneficiary with ID: {}", userId);
|
||||
UserEntity userEntity = validator.validateUserId(request, userId);
|
||||
|
||||
|
||||
UserEntity oldUserEntity = Utils.getClonedEntityForData(userEntity);
|
||||
log.info("Current user details: {}", userEntity);
|
||||
log.info("New user details: {}", userReq);
|
||||
@@ -647,9 +803,4 @@ public class UserDao {
|
||||
return convertUserEntityToUserResponse(userEntity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class CallEntity extends BaseEntity {
|
||||
@Column(name = "NUMBER_OF_CHECK")
|
||||
private Long numberOfCheck;
|
||||
|
||||
@Column(name = "PRODUCT_ID")
|
||||
private Long productId;
|
||||
@Column(name = "APPOINTMENT_TEMPLATE_ID")
|
||||
private Long appointmentTemplateId;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,4 +59,7 @@ public class CompanyEntity extends BaseEntity{
|
||||
|
||||
@Column(name = "CODICE_ATECO")
|
||||
private String codiceAteco;
|
||||
|
||||
@Column(name = "JSON")
|
||||
private String json;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,6 @@ public class UserWithCompanyEntity extends BaseEntity{
|
||||
@Column(name = "EMAIL")
|
||||
private String email;
|
||||
|
||||
@Column(name = "JSON")
|
||||
private String json;
|
||||
|
||||
@Column(name = "IS_DELETED")
|
||||
private Boolean isDeleted = false;
|
||||
|
||||
|
||||
@@ -207,6 +207,10 @@ public enum UserActionContextEnum {
|
||||
DELETE_DOCUMENT_CATEGORY("DELETE_DOCUMENT_CATEGORY"),
|
||||
UPDATE_DOCUMENT_CATEGORY("UPDATE_DOCUMENT_CATEGORY"),
|
||||
COMPANY_DOCUMENT_EXPIRATION_SCHEDULER("COMPANY_DOCUMENT_EXPIRATION_SCHEDULER");
|
||||
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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public class AppointmentCreationRequest {
|
||||
|
||||
@Data
|
||||
public static class Input {
|
||||
private String id;
|
||||
private Long id;
|
||||
private String ndg;
|
||||
private List<RichiestaCliente> richiestaCliente;
|
||||
}
|
||||
@@ -20,8 +20,8 @@ public class AppointmentCreationRequest {
|
||||
public static class RichiestaCliente {
|
||||
private String codAbi;
|
||||
private String codCab;
|
||||
private Integer durataMesiFinanziamento;
|
||||
private Integer idMotivazione;
|
||||
private int durataMesiFinanziamento;
|
||||
private int idMotivazione;
|
||||
private String idNota;
|
||||
private String importoAgevolato;
|
||||
private Double importoBreveTermine;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class CreateCallRequestStep1 {
|
||||
|
||||
private Long numberOfCheck;
|
||||
|
||||
private Long productId;
|
||||
private Long appointmentTemplateId;
|
||||
|
||||
private List<LookUpDataReq> aimedTo;
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ public class FieldValidatorBean {
|
||||
|
||||
private Long maxLength;
|
||||
|
||||
private Long min;
|
||||
|
||||
private Long max;
|
||||
|
||||
private String pattern;
|
||||
|
||||
private String custom;
|
||||
|
||||
@@ -2,7 +2,6 @@ package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -43,7 +42,7 @@ public class UpdateCallRequestStep1 {
|
||||
|
||||
private Long numberOfCheck;
|
||||
|
||||
private Long productId;
|
||||
private Long appointmentTemplateId;
|
||||
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class ApplicationEvaluationFormResponse {
|
||||
private LocalDateTime dateAccepted;
|
||||
private LocalDateTime dateRejected;
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
private BigDecimal numberOfCheck;
|
||||
private BigDecimal productId;
|
||||
private Long numberOfCheck;
|
||||
private Long appointmentTemplateId;
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ApplicationEvaluationResponse {
|
||||
private LocalDateTime dateAccepted;
|
||||
private LocalDateTime dateRejected;
|
||||
private Long numberOfCheck;
|
||||
private Long productId;
|
||||
private Long appointmentTemplateId;
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||
import net.gepafin.tendermanagement.model.BaseBean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@@ -25,9 +24,10 @@ public class AssignedApplicationsResponse extends BaseBean {
|
||||
private String companyName;
|
||||
private LocalDateTime evaluationEndDate;
|
||||
private Long numberOfCheck;
|
||||
private Long productId;
|
||||
private Long appointmentTemplateId;
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
|
||||
private String ndg;
|
||||
private String appointmentId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class CallDetailsResponseBean {
|
||||
|
||||
private Long numberOfCheck;
|
||||
|
||||
private Long productId;
|
||||
private Long appointmentTemplateId;
|
||||
|
||||
private EvaluationVersionEnum evaluationVersion;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class CallResponse {
|
||||
|
||||
private Long numberOfCheck;
|
||||
|
||||
private Long productId;
|
||||
private Long appointmentTemplateId;
|
||||
|
||||
@JsonSerialize(using = DynamicLocalTimeSerializer.class)
|
||||
private LocalTime startTime;
|
||||
|
||||
@@ -14,5 +14,4 @@ public class SummaryPageResponseBean {
|
||||
private LocalDateTime registrationDate;
|
||||
private Long numberOfLoginAttempts;
|
||||
private Long applicationsProcessed;
|
||||
private List<UserActionResponseBean> userActions;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface ApplicationEvaluationFormFieldRepository extends JpaRepository<ApplicationEvaluationFormFieldEntity,Long> {
|
||||
@@ -15,4 +16,23 @@ public interface ApplicationEvaluationFormFieldRepository extends JpaRepository<
|
||||
"AND f.isDeleted = false")
|
||||
List<ApplicationEvaluationFormFieldEntity> findByApplicationEvaluationFormId(
|
||||
@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);
|
||||
}
|
||||
|
||||
@@ -162,4 +162,6 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
||||
List<ApplicationEntity> findByUserIdAndUserWithCompany_IdAndCall_IdAndIsDeletedFalseAndStatusNot(
|
||||
Long userId, Long userWithCompanyId, Long callId, String status
|
||||
);
|
||||
|
||||
ApplicationEntity findByIdAndCompanyIdAndIsDeletedFalse(Long id,Long companyId);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
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.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -10,7 +11,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface UserRepository extends JpaRepository<UserEntity, Long> {
|
||||
public interface UserRepository extends JpaRepository<UserEntity, Long>, JpaSpecificationExecutor<UserEntity> {
|
||||
|
||||
UserEntity findByBeneficiaryId(Long beneficiaryId);
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||
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.ApplicationAmendmentRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
||||
|
||||
import java.util.List;
|
||||
@@ -27,4 +29,5 @@ public interface ApplicationAmendmentRequestService {
|
||||
public ApplicationAmendmentRequestResponse updateApplicationAmendmentStatus(HttpServletRequest request, Long applicationAmendmentId, ApplicationAmendmentRequestEnum status);
|
||||
|
||||
void sendReminderEmail(HttpServletRequest request,Long amendmentId);
|
||||
PageableResponseBean<List<ApplicationAmendmentRequestResponse>> getApplicationAmendmentByPaginnation(HttpServletRequest request, Long userId, ApplicationAmendmentPaginationRequestBean amendmentPaginationRequestBean);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public interface ApplicationService {
|
||||
|
||||
public ApplicationResponse createApplication(HttpServletRequest request, Long companyId, ApplicationRequest applicationRequest, Long callId);
|
||||
|
||||
public NextOrPreviousFormResponse getNextOrPreviousForm(HttpServletRequest request, Long applicationId, Long formId, FormActionEnum action);
|
||||
public NextOrPreviousFormResponse getNextOrPreviousForm(HttpServletRequest request, Long applicationId,Long companyId, Long formId, FormActionEnum action);
|
||||
|
||||
public ApplicationResponse updateApplicationStatus(HttpServletRequest request, Long applicationId, ApplicationStatusTypeEnum status);
|
||||
|
||||
@@ -45,4 +45,5 @@ public interface ApplicationService {
|
||||
|
||||
PageableResponseBean<List<ApplicationResponse>> getAllApplicationByPagination(HttpServletRequest request, Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean);
|
||||
|
||||
public ApplicationEntity validateApplicationWithCompany(Long applicationId,Long companyId);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@ package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationPageableRequestBean;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,5 +23,6 @@ public interface AssignedApplicationsService {
|
||||
AssignedApplicationsResponse updateAssignedApplication(HttpServletRequest request, Long id, UpdateAssignedApplicationRequest assignedApplicationsRequest);
|
||||
AssignedApplicationsResponse getAssignedApplicationById(HttpServletRequest request, Long id);
|
||||
AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId);
|
||||
PageableResponseBean<List<AssignedApplicationsResponse>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean);
|
||||
AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ import net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||
import net.gepafin.tendermanagement.model.request.NotificationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,4 +27,7 @@ public interface NotificationService {
|
||||
public List<NotificationResponse> getNotificationsByCompanyIdAndUserId(Long userId, Long companyId, List<NotificationEnum> statuses);
|
||||
|
||||
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 net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
||||
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.PageableResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.UserActionResponseBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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 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 net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||
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.UserResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.JWTToken;
|
||||
@@ -47,6 +48,7 @@ public interface UserService {
|
||||
public UserEntity getUserEntityById(Long userId);
|
||||
List<UserResponseBean> getAllUsers(HttpServletRequest request, List<Long> roleIds);
|
||||
|
||||
PageableResponseBean<List<UserResponseBean>> getUserByPagination(HttpServletRequest request, UserPaginationRequestBean userPaginationRequestBean);
|
||||
UserResponseBean updateUserDetails(HttpServletRequest request, Long userId, UpdateUserReqForBeneficiary userReq);
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -31,7 +32,7 @@ public interface AppointmentApiService {
|
||||
ResponseEntity<Object> getVisuraList(@RequestBody String visuraRequest, @RequestHeader("Authorization") String token);
|
||||
|
||||
@GetMapping(value = AppointmentApiConstant.GET_APPOINTMENT_TEMPLATE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Object> getAppointmentTemplateForTemplateCreation(@RequestHeader("Authorization") String token);
|
||||
ResponseEntity<Object> getAppointmentTemplateForTemplateCreation(@RequestHeader("Authorization") String token, @RequestParam("idAppuntamentoTemplate") Long templateId);
|
||||
|
||||
@PostMapping(value = AppointmentApiConstant.CREATE_APPOINTMENT_FROM_TEMPLATE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Object> createAppointment(@RequestHeader("Authorization") String token, @RequestHeader("context") String context, String appointmentCreationRequest);
|
||||
|
||||
@@ -8,10 +8,12 @@ import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
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.ApplicationAmendmentRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
||||
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.repositories.ApplicationAmendmentRequestRepository;
|
||||
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
||||
@@ -149,4 +151,10 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ForbiddenAccessException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -72,13 +73,24 @@ public class ApplicationServiceImpl implements ApplicationService {
|
||||
validator.validateUserWithCall(userEntity, callId);
|
||||
return applicationDao.createApplicationByCallId(companyEntity, applicationRequest, callId, userEntity);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NextOrPreviousFormResponse getNextOrPreviousForm(HttpServletRequest request, Long applicationId, Long formId,
|
||||
FormActionEnum action) {
|
||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
||||
return flowFormDao.getNextOrPreviousForm(applicationEntity, formId, action);
|
||||
public NextOrPreviousFormResponse getNextOrPreviousForm(HttpServletRequest request, Long applicationId, Long companyId, Long formId,
|
||||
FormActionEnum action) {
|
||||
if (companyId !=null) {
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
}
|
||||
ApplicationEntity applicationEntity =null;
|
||||
if(validator.checkIsBeneficiary()){
|
||||
if(companyId==null){
|
||||
throw new ForbiddenAccessException(Status.FORBIDDEN,Translator.toLocale(GepafinConstant.COMPANY_ID_MANDATORY));
|
||||
}
|
||||
applicationEntity = validateApplicationWithCompany(applicationId, companyId);
|
||||
|
||||
}else {
|
||||
applicationEntity=validateApplication(applicationId);
|
||||
}
|
||||
return flowFormDao.getNextOrPreviousForm(applicationEntity, companyId, formId, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,4 +147,9 @@ public class ApplicationServiceImpl implements ApplicationService {
|
||||
return applicationDao.getAllApplicationByPagination(userEntity,callId,companyId,applicationPageableRequestBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApplicationEntity validateApplicationWithCompany(Long applicationId,Long companyId) {
|
||||
return applicationDao.validateApplicationWithCompany(applicationId,companyId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.AssignedApplicationsDao;
|
||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationPageableRequestBean;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -62,6 +64,13 @@ public class AssignedApplicationsServiceImpl implements AssignedApplicationsServ
|
||||
public AssignedApplicationsEntity validateAssignedApplication(Long 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
|
||||
public AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status) {
|
||||
return assignedApplicationsDao.updateAssignedApplicationStatus(request, assignedApplicationId, status);
|
||||
|
||||
@@ -74,4 +74,9 @@ public class NotificationServiceImpl implements NotificationService {
|
||||
UserEntity userEntity = validator.validateUser(request);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,9 @@ public class PecEmailService implements EmailService {
|
||||
@Value("${isMailSendingEnabled}")
|
||||
private String isEmailSendingEnabled;
|
||||
|
||||
@Value("${isPecServiceEnabled}")
|
||||
private String isPecServiceEnabled;
|
||||
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
@@ -55,23 +58,27 @@ public class PecEmailService implements EmailService {
|
||||
emailLogRequest.setSendStatus(StatusTypeEnum.SUCCESS.getValue());
|
||||
emailLogRequest.setRecipientEmails(Utils.listToCommaSeparatedString(emailRequest.getRecipient()));
|
||||
try {
|
||||
Unirest.setTimeouts(0, 0);
|
||||
response2 = Unirest.post(url)
|
||||
.header("Authorization", "Bearer " + authToken)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(Utils.convertObjectToJson(emailRequest)) // Serialize the emailRequest object to JSON
|
||||
.asString();
|
||||
if (Boolean.TRUE.equals(Boolean.parseBoolean(isPecServiceEnabled))) {
|
||||
Unirest.setTimeouts(0, 0);
|
||||
response2 = Unirest.post(url)
|
||||
.header("Authorization", "Bearer " + authToken)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(Utils.convertObjectToJson(emailRequest)) // Serialize the emailRequest object to JSON
|
||||
.asString();
|
||||
}
|
||||
}catch(Exception e) {
|
||||
emailLogRequest.setSendStatus(StatusTypeEnum.FAILED.getValue());
|
||||
emailLogRequest.setEmailServiceType(EmailServiceTypeEnum.PEC_SERVICE);
|
||||
emailLogRequest.setErrorMessage(e.getMessage());
|
||||
EmailLogEntity emailLogEntity= emailLogDao.createEmailLog(emailLogRequest);
|
||||
emailLogDao.createEmailLog(emailLogRequest);
|
||||
throw new RuntimeException("Failed to send email via PEC: " + response2.getStatus());
|
||||
}
|
||||
emailLogRequest.setEmailServiceResponse(response2.getBody());
|
||||
if(response2 != null) {
|
||||
emailLogRequest.setEmailServiceResponse(response2.getBody());
|
||||
}
|
||||
}
|
||||
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.enums.TimePeriodEnum;
|
||||
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.PageableResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.UserActionResponseBean;
|
||||
import net.gepafin.tendermanagement.service.UserActionService;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -25,9 +28,9 @@ public class UserActionServiceImpl implements UserActionService {
|
||||
|
||||
|
||||
@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);
|
||||
return userActionDao.getUserAction(request,user,timeFilter,actionContext);
|
||||
return userActionDao.getUserAction(request,user);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,4 +38,10 @@ public class UserActionServiceImpl implements UserActionService {
|
||||
UserEntity user = validator.validateUserId(request, userId);
|
||||
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.enums.UserStatusEnum;
|
||||
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.UserResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.JWTToken;
|
||||
@@ -131,6 +132,11 @@ public class UserServiceImpl implements UserService {
|
||||
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
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public UserResponseBean updateUserDetails(HttpServletRequest request, Long userId, UpdateUserReqForBeneficiary userReq) {
|
||||
|
||||
@@ -59,16 +59,56 @@ public class FieldValidator {
|
||||
throw new ValidationException(Status.VALIDATION_ERROR, errors, Translator.toLocale(GepafinConstant.VALIDATION_MESSAGE));
|
||||
}
|
||||
}
|
||||
public FieldValidator minLength(String value, Long minLength, String fieldLabel) {
|
||||
if (minLength != null && value != null && value.length() < minLength) {
|
||||
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_MIN_LENGTH), fieldLabel, minLength));
|
||||
}
|
||||
public FieldValidator minLength(String value, Long minLength, String fieldLabel,Long min,ContentResponseBean contentResponseBean) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldValidator maxLength(String value, Long maxLength, String fieldLabel) {
|
||||
if (maxLength != null && value != null && value.length() > maxLength) {
|
||||
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_MAX_LENGTH), fieldLabel, maxLength));
|
||||
public FieldValidator maxLength(String value, Long maxLength, String fieldLabel, Long max, ContentResponseBean contentResponseBean) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -160,19 +200,19 @@ public class FieldValidator {
|
||||
|
||||
|
||||
public FieldValidator validateCustomTableValidation(String value, String customRule, String fieldId, ContentResponseBean contentResponseBean) {
|
||||
if (customRule == null || value == null) {
|
||||
if (customRule == null ) {
|
||||
return this; // No custom rule to validate
|
||||
}
|
||||
|
||||
switch (customRule) {
|
||||
|
||||
case GepafinConstant.NON_EMPTY_TABLES:
|
||||
try {
|
||||
checkTableValidation(value, fieldId, contentResponseBean, errors);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
break;
|
||||
try {
|
||||
checkTableValidation(value, fieldId, contentResponseBean, errors);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return this;
|
||||
@@ -186,14 +226,15 @@ public class FieldValidator {
|
||||
.findFirst() // Get the first matching result
|
||||
.orElse(null); // Default to null if no match
|
||||
|
||||
|
||||
if (tableType!=null){
|
||||
try {
|
||||
try {
|
||||
Object object = PdfUtils.extractRows(value);;
|
||||
value= Utils.convertToString(object);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
contentResponseBean.getSettings().stream()
|
||||
.filter(setting -> "table_columns".equals(setting.getName()) || GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName())) // Check for "table_columns"
|
||||
|
||||
@@ -61,7 +61,7 @@ public class UserActionAspect {
|
||||
handleSuccessResponse((ResponseEntity<?>) result, storedUserActionId == null ? userActionId : storedUserActionId);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("Exception occurred: ", ex);
|
||||
// log.error("Exception occurred: ", ex);
|
||||
handleError(ex, getUserActionIdFromRequest(request));
|
||||
throw ex;
|
||||
} finally {
|
||||
|
||||
@@ -785,5 +785,7 @@ public class Utils {
|
||||
|
||||
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 net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
||||
import net.gepafin.tendermanagement.model.request.*;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||
@@ -78,7 +78,7 @@ public interface ApplicationAmendmentRequestApi {
|
||||
@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);
|
||||
|
||||
@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 = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@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 = "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 = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@@ -191,4 +191,17 @@ public interface ApplicationAmendmentRequestApi {
|
||||
@Parameter( required = true)
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ public interface ApplicationApi {
|
||||
@GetMapping(value = "/{applicationId}/form/next-previous", produces = "application/json")
|
||||
ResponseEntity<Response<NextOrPreviousFormResponse>> getNextOrPreviousForm(HttpServletRequest request,
|
||||
@Parameter(description = "The applicaltion id", required = true) @PathVariable("applicationId") Long applicationId,
|
||||
@Parameter(description = "The company id", required = false) @RequestParam(value = "companyId",required = false) Long companyId,
|
||||
@Parameter(description = "The form id", required = false) @RequestParam(value = "formId", required = false) Long formId,
|
||||
@RequestParam(value = "action", required = false) FormActionEnum action);
|
||||
|
||||
|
||||
@@ -6,12 +6,14 @@ 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.AssignedApplicationPageableRequestBean;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||
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.web.rest.api.errors.ErrorConstants;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -58,7 +60,7 @@ public interface AssignedApplicationsApi {
|
||||
ResponseEntity<Response<Void>> deleteAssignedApplication(HttpServletRequest request,
|
||||
@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 = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@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);
|
||||
|
||||
|
||||
@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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public interface NotificationApi {
|
||||
ResponseEntity<Response<Void>> deleteNotification(HttpServletRequest request,
|
||||
@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 = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@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")
|
||||
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 net.gepafin.tendermanagement.enums.TimePeriodEnum;
|
||||
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.PageableResponseBean;
|
||||
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.web.rest.api.errors.ErrorConstants;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserActionApi {
|
||||
@Operation(summary = "Api to get user action",
|
||||
@Operation(summary = "Api to get user summary ",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@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 = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "/user/{userId}", produces = { "application/json" })
|
||||
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);
|
||||
ResponseEntity<Response<SummaryPageResponseBean>> getUserAction(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId);
|
||||
|
||||
@Operation(summary = "Api to get action context label",
|
||||
responses = {
|
||||
@@ -46,4 +45,18 @@ public interface UserActionApi {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@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);
|
||||
|
||||
@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 net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||
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.UserResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.JWTToken;
|
||||
@@ -225,7 +227,7 @@ public interface UserApi {
|
||||
ResponseEntity<Response<UserSamlResponse>> validateNewUserToken(HttpServletRequest request,
|
||||
@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 = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@@ -244,6 +246,20 @@ public interface UserApi {
|
||||
@ResponseBody
|
||||
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",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
|
||||
@@ -36,7 +36,7 @@ public class GlobalExceptionHandler {
|
||||
@ResponseBody
|
||||
public Response<Object> handleCustomValidationException(final CustomValidationException ex) {
|
||||
log.error(ex.getMessage());
|
||||
log.error(ex.getLocalizedMessage(), ex);
|
||||
// log.error(ex.getLocalizedMessage(), ex);
|
||||
return new Response<>(null, ex.getStatus(), ex.getMessage());
|
||||
}
|
||||
|
||||
@@ -45,14 +45,14 @@ public class GlobalExceptionHandler {
|
||||
@ResponseBody
|
||||
public Response<Object> handleValidationException(final ValidationException ex) {
|
||||
log.error(ex.getMessage());
|
||||
log.error(ex.getLocalizedMessage(), ex);
|
||||
// log.error(ex.getLocalizedMessage(), ex);
|
||||
return new Response<>(ex.getErrors(), ex.getStatus(), ex.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(ResourceNotFoundException.class)
|
||||
public ResponseEntity<Response<Void>> handleResourceNotFoundException(ResourceNotFoundException ex) {
|
||||
log.error(ex.getMessage());
|
||||
log.error(ex.getLocalizedMessage(), ex);
|
||||
// log.error(ex.getLocalizedMessage(), ex);
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(new Response<>(null, ex.getStatus(), ex.getMessage()));
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class GlobalExceptionHandler {
|
||||
@ResponseBody
|
||||
public Response<Object> handleInvalidTokenException(final Throwable ex) {
|
||||
log.error(ex.getMessage());
|
||||
log.error(ex.getLocalizedMessage(), ex);
|
||||
// log.error(ex.getLocalizedMessage(), ex);
|
||||
return new Response<>(ex.getMessage(), Status.UNAUTHORIZED, Translator.toLocale("invalid_signature"));
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class GlobalExceptionHandler {
|
||||
@ResponseBody
|
||||
public Response<Object> unauthorizedAccessException(final Throwable ex) {
|
||||
log.error(ex.getMessage());
|
||||
log.error(ex.getLocalizedMessage(), ex);
|
||||
// log.error(ex.getLocalizedMessage(), ex);
|
||||
return new Response<>(null, Status.UNAUTHORIZED, ex.getMessage());
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class GlobalExceptionHandler {
|
||||
@ResponseBody
|
||||
public Response<Object> handleUnAuthorizedException(final Throwable ex) {
|
||||
log.error(ex.getMessage());
|
||||
log.error(ex.getLocalizedMessage(), ex);
|
||||
// log.error(ex.getLocalizedMessage(), ex);
|
||||
return new Response<>(null, Status.VALIDATION_ERROR, Translator.toLocale("invalid_login"));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,9 @@ import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
||||
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.request.*;
|
||||
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.util.Response;
|
||||
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)));
|
||||
}
|
||||
|
||||
@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)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -116,13 +116,13 @@ public class ApplicationApiController implements ApplicationApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<NextOrPreviousFormResponse>> getNextOrPreviousForm(HttpServletRequest request, Long applicationId,
|
||||
public ResponseEntity<Response<NextOrPreviousFormResponse>> getNextOrPreviousForm(HttpServletRequest request, Long applicationId,Long companyId,
|
||||
Long formId, FormActionEnum action) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "get next or previous form" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_NEXT_PREVIOUS_FORM).build());
|
||||
|
||||
NextOrPreviousFormResponse data = applicationService.getNextOrPreviousForm(request, applicationId, formId, action);
|
||||
NextOrPreviousFormResponse data = applicationService.getNextOrPreviousForm(request, applicationId,companyId, formId, action);
|
||||
log.info("Get Next Or Previous Form ");
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(data, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_SUCCESS_MSG)));
|
||||
|
||||
@@ -8,11 +8,14 @@ import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
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.UpdateAssignedApplicationRequest;
|
||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||
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.service.AssignedApplicationsService;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
@@ -93,6 +96,15 @@ public class AssignedApplicationsController implements AssignedApplicationsApi {
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "update assigned application status" operation. **/
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
@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.UserActionContextEnum;
|
||||
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.response.ActionContextLabelResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||
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.service.UserActionService;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
@@ -33,12 +36,12 @@ public class UserActionApiController implements UserActionApi {
|
||||
private LoggingUtil loggingUtil;
|
||||
|
||||
@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. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||
.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)
|
||||
.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)
|
||||
.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.UserStatusEnum;
|
||||
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.UserResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.JWTToken;
|
||||
@@ -249,6 +250,15 @@ public class UserApiController implements UserApi {
|
||||
}
|
||||
|
||||
@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,
|
||||
@PathVariable("userId") Long userId,
|
||||
@Valid @RequestBody UpdateUserReqForBeneficiary userReq) {
|
||||
|
||||
@@ -10,7 +10,8 @@ spring.h2.console.enabled=true
|
||||
isVatCheckGloballyDisabled = false
|
||||
|
||||
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
|
||||
rinaldo_email=rinaldo.bonazzo@bflows.net
|
||||
carlo_email=test@test.test
|
||||
|
||||
@@ -9,7 +9,8 @@ spring.jpa.show-sql=true
|
||||
base-url=http://localhost:8080
|
||||
|
||||
isMailSendingEnabled = false
|
||||
default_System_Receiver_Email=test@test.test
|
||||
isPecServiceEnabled = false
|
||||
#default_System_Receiver_Email=test@test.test
|
||||
gepafin_email=test@test.test
|
||||
rinaldo_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
|
||||
|
||||
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
|
||||
rinaldo_email=rinaldo.bonazzo@bflows.net
|
||||
carlo_email=carlo.mancosu@bflows.net
|
||||
|
||||
@@ -7,7 +7,8 @@ spring.datasource.password=sa
|
||||
spring.h2.console.enabled=true
|
||||
base-url=http://localhost:8080
|
||||
isMailSendingEnabled = false
|
||||
default_System_Receiver_Email=test@test.test
|
||||
isPecServiceEnabled = false
|
||||
#default_System_Receiver_Email=test@test.test
|
||||
gepafin_email=test@test.test
|
||||
rinaldo_email=test@test.test
|
||||
carlo_email=test@test.test
|
||||
|
||||
@@ -2380,6 +2380,17 @@
|
||||
path="db/dump/update_system_email_template_application_rejected_04_02_2025.sql"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="14-02-2025_PK_124000" author="Piyush Kag">
|
||||
|
||||
<addColumn tableName="COMPANY">
|
||||
<column name="JSON" type="TEXT"/>
|
||||
</addColumn>
|
||||
<sqlFile dbms="postgresql"
|
||||
path="db/dump/insert_json_column_in_company_data_06_02_2025.sql"/>
|
||||
<dropColumn tableName="USER_WITH_COMPANY" columnName="JSON"/>
|
||||
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="06-02-2025_NK_155519" author="Nisha Kashyap">
|
||||
<addColumn tableName="call">
|
||||
<column name="number_of_check" type="numeric"></column>
|
||||
@@ -2514,6 +2525,10 @@
|
||||
<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 id="17-02-2025_PK_025237" author="Piyush Kag">
|
||||
<renameColumn tableName="call"
|
||||
oldColumnName="product_id"
|
||||
newColumnName="appointment_template_id"/>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
UPDATE COMPANY C
|
||||
SET JSON = (
|
||||
SELECT U.JSON
|
||||
FROM USER_WITH_COMPANY U
|
||||
WHERE U.COMPANY_ID = C.ID
|
||||
AND U.JSON IS NOT NULL
|
||||
AND U.JSON <> ''
|
||||
ORDER BY U.ID ASC
|
||||
LIMIT 1
|
||||
)
|
||||
WHERE EXISTS (
|
||||
SELECT 1 FROM USER_WITH_COMPANY U
|
||||
WHERE U.COMPANY_ID = C.ID
|
||||
AND U.JSON IS NOT NULL
|
||||
AND U.JSON <> ''
|
||||
);
|
||||
@@ -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.not_null=Field {0} must not be null.
|
||||
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.
|
||||
flow.not.found=Flow not found.
|
||||
@@ -385,3 +390,7 @@ 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.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.not_null=Il campo {0} non deve essere nullo.
|
||||
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
|
||||
flow.not.found=Flow not found.
|
||||
validation.message=Messaggi di convalida.
|
||||
@@ -376,3 +381,6 @@ category.cannot.be.deleted = La categoria non può essere eliminata perché è a
|
||||
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
|
||||
validation.failed.checklist=Convalida fallita per la checklist.
|
||||
|
||||
Reference in New Issue
Block a user