Resolved conflicts
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -245,6 +245,12 @@
|
|||||||
<artifactId>reactor-netty</artifactId>
|
<artifactId>reactor-netty</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.objecthunter</groupId>
|
||||||
|
<artifactId>exp4j</artifactId>
|
||||||
|
<version>0.4.8</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ public class GepafinConstant {
|
|||||||
public static final String APPLICATION_UPDATED_SUCCESS_MSG = "application.updated.success";
|
public static final String APPLICATION_UPDATED_SUCCESS_MSG = "application.updated.success";
|
||||||
public static final String DELETE_APPLICATION_SUCCESS_MSG = "application.deleted.success";
|
public static final String DELETE_APPLICATION_SUCCESS_MSG = "application.deleted.success";
|
||||||
public static final String GET_APPLICATION_SUCCESS_MSG = "application.get.success";
|
public static final String GET_APPLICATION_SUCCESS_MSG = "application.get.success";
|
||||||
|
public static final String GET_APPLICATION_EVALUATION_VERSION_SUCCESS_MSG = "application.evaluation.version.get.success";
|
||||||
public static final String APPLICATION_NOT_FOUND_MSG = "application.not.found";
|
public static final String APPLICATION_NOT_FOUND_MSG = "application.not.found";
|
||||||
public static final String APPLICATION_FORM_FIELD_NOT_FOUND = "application.form.field.not.found";
|
public static final String APPLICATION_FORM_FIELD_NOT_FOUND = "application.form.field.not.found";
|
||||||
public static final String FORM_ID_DOES_NOT_MACTHES = "Form.not.matches.to.call.initial.form";
|
public static final String FORM_ID_DOES_NOT_MACTHES = "Form.not.matches.to.call.initial.form";
|
||||||
@@ -179,27 +180,27 @@ public class GepafinConstant {
|
|||||||
public static final String UNAUTHORIZED = "UNAUTHORIZED";
|
public static final String UNAUTHORIZED = "UNAUTHORIZED";
|
||||||
public static final String COMPANY_ID_MANDATORY = "company.id.mandatory";
|
public static final String COMPANY_ID_MANDATORY = "company.id.mandatory";
|
||||||
public static final String USER_ALREADY_CONNECTED_TO_COMPANY = "user.already.connected.to.company";
|
public static final String USER_ALREADY_CONNECTED_TO_COMPANY = "user.already.connected.to.company";
|
||||||
public static final String YYYY_MM_DD_DASH = "yyyy-MM-dd";
|
public static final String YYYY_MM_DD_DASH = "yyyy-MM-dd";
|
||||||
public static final String YYYY_MM_DD_SLASH = "yyyy/MM/dd";
|
public static final String YYYY_MM_DD_SLASH = "yyyy/MM/dd";
|
||||||
public static final String DELEGATION_TEMPLATE = "DELEGATION_TEMPLATE";
|
public static final String DELEGATION_TEMPLATE = "DELEGATION_TEMPLATE";
|
||||||
public static final String VALIDATION_ERROR_MISSING_FIRSTNAME = "validation.error.missing.firstName";
|
public static final String VALIDATION_ERROR_MISSING_FIRSTNAME = "validation.error.missing.firstName";
|
||||||
public static final String VALIDATION_ERROR_MISSING_LASTNAME = "validation.error.missing.lastName";
|
public static final String VALIDATION_ERROR_MISSING_LASTNAME = "validation.error.missing.lastName";
|
||||||
public static final String VALIDATION_ERROR_MISSING_CODICEFISCALE = "validation.error.missing.codiceFiscale";
|
public static final String VALIDATION_ERROR_MISSING_CODICEFISCALE = "validation.error.missing.codiceFiscale";
|
||||||
public static final String DELEGATION_FILE_UPLOAD_SUCCESS = "delegation.file.upload.success";
|
public static final String DELEGATION_FILE_UPLOAD_SUCCESS = "delegation.file.upload.success";
|
||||||
public static final String DELEGATION_FETCH_SUCCESS = "delegation.fetch.success";
|
public static final String DELEGATION_FETCH_SUCCESS = "delegation.fetch.success";
|
||||||
public static final String DELEGATION_TEMPLATE_GENERATION_ERROR = "delegation.template.generation.error";
|
public static final String DELEGATION_TEMPLATE_GENERATION_ERROR = "delegation.template.generation.error";
|
||||||
public static final String VALIDATION_ERROR_FILE_EMPTY = "validation.error.file.empty";
|
public static final String VALIDATION_ERROR_FILE_EMPTY = "validation.error.file.empty";
|
||||||
public static final String VALIDATION_ERROR_FILE_INVALIDTYPE = "validation.error.file.invalidType";
|
public static final String VALIDATION_ERROR_FILE_INVALIDTYPE = "validation.error.file.invalidType";
|
||||||
public static final String UPLOAD_ERROR_S3 = "upload.error.s3";
|
public static final String UPLOAD_ERROR_S3 = "upload.error.s3";
|
||||||
|
|
||||||
public static final String CALL_NOT_STARTED_YET = "call.not.started.yet";
|
public static final String CALL_NOT_STARTED_YET = "call.not.started.yet";
|
||||||
public static final String CALL_ALREADY_ENDED = "call.already.ended";
|
public static final String CALL_ALREADY_ENDED = "call.already.ended";
|
||||||
public static final String APPLICATION_STATUS_UPDATED_SUCCESSFULLY = "application.status.updated.successfully";
|
public static final String APPLICATION_STATUS_UPDATED_SUCCESSFULLY = "application.status.updated.successfully";
|
||||||
public static final String APPLICATION_ALREADY_IN_PREVIOUS_STATUS = "application.already.in.provided.status";
|
public static final String APPLICATION_ALREADY_IN_PREVIOUS_STATUS = "application.already.in.provided.status";
|
||||||
public static final String DELEGATION_NOT_FOUND = "delegation.not.found";
|
public static final String DELEGATION_NOT_FOUND = "delegation.not.found";
|
||||||
public static final String USER_COMPANY_RELATION_NOT_FOUND = "user.company.relation.not.found";
|
public static final String USER_COMPANY_RELATION_NOT_FOUND = "user.company.relation.not.found";
|
||||||
public static final String DELEGATION_DELETE_SUCCESS = "delegation.delete.success";
|
public static final String DELEGATION_DELETE_SUCCESS = "delegation.delete.success";
|
||||||
public static final String HH_MM_SS = "HH:mm:ss";
|
public static final String HH_MM_SS = "HH:mm:ss";
|
||||||
|
|
||||||
public static final String USER_NOT_AUTHORIZED_TO_CREATE_APPLICATION = "user.not.authorized.create.application";
|
public static final String USER_NOT_AUTHORIZED_TO_CREATE_APPLICATION = "user.not.authorized.create.application";
|
||||||
public static final String APPLICATION_SUBMITTED_CANNOT_CHANGE = "application.submitted.cannot.change";
|
public static final String APPLICATION_SUBMITTED_CANNOT_CHANGE = "application.submitted.cannot.change";
|
||||||
@@ -217,11 +218,11 @@ public class GepafinConstant {
|
|||||||
public static final String USER_ID_AND_BENEFICIARY_ID_ERROR = "userId.and.beneficiaryId.error";
|
public static final String USER_ID_AND_BENEFICIARY_ID_ERROR = "userId.and.beneficiaryId.error";
|
||||||
public static final String EITHER_USER_OR_BENEFICIARY_ID_REQUIRED = "either.user.or.beneficiary.id.required";
|
public static final String EITHER_USER_OR_BENEFICIARY_ID_REQUIRED = "either.user.or.beneficiary.id.required";
|
||||||
public static final String USER_NOT_FOUND_WITH_BENEFICIARYID_MSG = "User.not.found.with.the.given.beneficiaryID";
|
public static final String USER_NOT_FOUND_WITH_BENEFICIARYID_MSG = "User.not.found.with.the.given.beneficiaryID";
|
||||||
public static final String PERMISSION_DENIED = "permission.denied";
|
public static final String PERMISSION_DENIED = "permission.denied";
|
||||||
public static final String SIGNED_DOCUMENT_FILE_UPLOAD_SUCCESS = "signed.document.file.upload.success";
|
public static final String SIGNED_DOCUMENT_FILE_UPLOAD_SUCCESS = "signed.document.file.upload.success";
|
||||||
public static final String GET_SIGNED_DOCUMENT_FILE_SUCCESS = "get.signed.document.file.success";
|
public static final String GET_SIGNED_DOCUMENT_FILE_SUCCESS = "get.signed.document.file.success";
|
||||||
public static final String APPLICATION_SIGNED_DOCUMENT_NOT_FOUND = "application.signed.document.not.found";
|
public static final String APPLICATION_SIGNED_DOCUMENT_NOT_FOUND = "application.signed.document.not.found";
|
||||||
public static final String DELETE_SIGNED_DOCUMENT_FILE_SUCCESS = "delete.signed.document.file.success";
|
public static final String DELETE_SIGNED_DOCUMENT_FILE_SUCCESS = "delete.signed.document.file.success";
|
||||||
public static final String DD_MM_YYYY = "dd/MM/yyyy";
|
public static final String DD_MM_YYYY = "dd/MM/yyyy";
|
||||||
|
|
||||||
public static final String DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY="dashboard.widget.fetched.successfully";
|
public static final String DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY="dashboard.widget.fetched.successfully";
|
||||||
@@ -237,6 +238,7 @@ public class GepafinConstant {
|
|||||||
public static final String EVALUATION_UPDATED_SUCCESSFULLY = "evaluation.updated.successfully";
|
public static final String EVALUATION_UPDATED_SUCCESSFULLY = "evaluation.updated.successfully";
|
||||||
public static final String EVALUATION_FETCHED_SUCCESSFULLY = "evaluation.fetched.successfully";
|
public static final String EVALUATION_FETCHED_SUCCESSFULLY = "evaluation.fetched.successfully";
|
||||||
public static final String EVALUATION_DELETED_SUCCESSFULLY = "evaluation.deleted.successfully";
|
public static final String EVALUATION_DELETED_SUCCESSFULLY = "evaluation.deleted.successfully";
|
||||||
|
public static final String GET_APPLICATION_EVALUATION_FORM_SUCCESS_MSG = "application.evaluation.form.get.success";
|
||||||
public static final String EVALUATIONS_FETCHED_SUCCESSFULLY = "evaluations.fetched.successfully";
|
public static final String EVALUATIONS_FETCHED_SUCCESSFULLY = "evaluations.fetched.successfully";
|
||||||
public static final String APPLICATION_EVALUATION_NOT_FOUND = "application.evaluation.not.found";
|
public static final String APPLICATION_EVALUATION_NOT_FOUND = "application.evaluation.not.found";
|
||||||
public static final String APPLICATION_EVALUATION_STATUS_UPDATED_SUCCESSFULLY = "application.evaluation.status.updated.successfully";
|
public static final String APPLICATION_EVALUATION_STATUS_UPDATED_SUCCESSFULLY = "application.evaluation.status.updated.successfully";
|
||||||
@@ -256,9 +258,9 @@ public class GepafinConstant {
|
|||||||
public static final String HUB_GET_ALL_SUCCESS = "hub_get_all_success";
|
public static final String HUB_GET_ALL_SUCCESS = "hub_get_all_success";
|
||||||
public static final String HUB_DELETE_SUCCESS = "hub_delete_success";
|
public static final String HUB_DELETE_SUCCESS = "hub_delete_success";
|
||||||
public static final String HUB_NOT_FOUND = "hub_not_found";
|
public static final String HUB_NOT_FOUND = "hub_not_found";
|
||||||
public static final String EVALUATIONCRITERIA_INVALID = "evaluationCriteria.invalid";
|
public static final String EVALUATIONCRITERIA_INVALID = "evaluationCriteria.invalid";
|
||||||
public static final String APPLICATION_NOT_IN_DRAFT_STATUS="application.not.in.draft.status";
|
public static final String APPLICATION_NOT_IN_DRAFT_STATUS="application.not.in.draft.status";
|
||||||
public static final String GET_ERROR_S3 = "get.error.s3";
|
public static final String GET_ERROR_S3 = "get.error.s3";
|
||||||
public static final String BENEFICIARY_EMAIL_NOT_FOUND_MSG = "beneficiary.email.not.found.msg";
|
public static final String BENEFICIARY_EMAIL_NOT_FOUND_MSG = "beneficiary.email.not.found.msg";
|
||||||
public static final String ADDED_S3_PATH_STRUCTURE ="added.s3.path.structure";
|
public static final String ADDED_S3_PATH_STRUCTURE ="added.s3.path.structure";
|
||||||
public static final String S3_PATH_STRUCTURE_BY_TYPE ="fetched.s3.path.structure.by.type.successfully";
|
public static final String S3_PATH_STRUCTURE_BY_TYPE ="fetched.s3.path.structure.by.type.successfully";
|
||||||
@@ -386,6 +388,8 @@ public class GepafinConstant {
|
|||||||
public static final String COUNT="count";
|
public static final String COUNT="count";
|
||||||
public static final String APPLICATION_PER_CALL="applicationPerCall";
|
public static final String APPLICATION_PER_CALL="applicationPerCall";
|
||||||
public static final String APPLICATION_PER_STATUS="applicationPerStatus";
|
public static final String APPLICATION_PER_STATUS="applicationPerStatus";
|
||||||
|
public static final String 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 CALL_EXPIRED="call.expired";
|
||||||
public static final String PROTOCOL="protocol";
|
public static final String PROTOCOL="protocol";
|
||||||
public static final String PROTOCOL_NUMBER="protocolNumber";
|
public static final String PROTOCOL_NUMBER="protocolNumber";
|
||||||
@@ -397,5 +401,40 @@ public class GepafinConstant {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final String EVALUATION_FORM_CREATED_SUCCESSFULLY = "evaluation.form.created.successfully";
|
||||||
|
public static final String EVALUATION_FORM_UPDATED_SUCCESSFULLY = "evaluation.form.updated.successfully";
|
||||||
|
public static final String EVALUATION_FORM_DELETED_SUCCESSFULLY = "evaluation.form.deleted.successfully";
|
||||||
|
public static final String EVALUATION_FORM_FETCHED_SUCCESSFULLY = "evaluation.form.fetched.successfully";
|
||||||
|
|
||||||
|
public static final String EVALUATION_FORM_NOT_FOUND = "evaluation.form.not.found";
|
||||||
|
|
||||||
|
public static final String EVALUATION_V2_STEP_2 = "EVALUATION_V2_STEP_2";
|
||||||
|
|
||||||
|
public static final String EITHER_APPLICATION_ID_OR_ASSIGNED_APPLICATION_ID_MUST_BE_PROVIDED = "either.applicationId.or.assignedApplicationId.must.be.provided";
|
||||||
|
public static final String ASSIGNED_APPLICATION_STATUS_UPDATED_SUCCESSFULLY = "assigned.application.status.updated.successfully";
|
||||||
|
|
||||||
|
public static final String REQUIRED_REQUESTED_AMOUNT_MSG = "validation.required.requested.amount";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String REQUESTED_VS_APPROVED_AMOUNTS="requestedVsApprovedAmount";
|
||||||
|
public static final String MONTH="month";
|
||||||
|
public static final String TOTAL_REQUESTED="totalRequested";
|
||||||
|
public static final String TOTAL_APPROVED="totalApproved";
|
||||||
|
|
||||||
|
public static final String NUMBER_OF_APPLICATION="numberOfApplication";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String COMPANY_ID_NOT_NULL_MSG = "company.id.not.null";
|
||||||
|
public static final String USER_WITH_COMPANY="userWithCompany";
|
||||||
|
|
||||||
|
public static final String FORMULA_AMOUNT_NOT_MATCHED="formula.amount.not.matches.requested.amount";
|
||||||
|
public static final String CRITERIA_TABLE_COLUMNS="criteria_table_columns";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -598,7 +598,7 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId) {
|
public List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId) {
|
||||||
if (validator.checkIsPreInstructor() && userId == null) {
|
if (validator.checkIsPreInstructor() && userId == null) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.USER_ID_NOT_NULL_MSG));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.USER_ID_NOT_NULL_MSG));
|
||||||
}
|
}
|
||||||
@@ -610,7 +610,7 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
applicationAmendmentRequestRepository.findAll(spec);
|
applicationAmendmentRequestRepository.findAll(spec);
|
||||||
|
|
||||||
return applicationAmendmentRequestEntities.stream()
|
return applicationAmendmentRequestEntities.stream()
|
||||||
.map(entity -> convertEntityToResponse(entity, false))
|
.map(this::initializeGetAllBasicResponse)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -996,7 +996,7 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
}
|
}
|
||||||
setIfUpdated(existingApplicationAmendment::getInternalNote, existingApplicationAmendment::setInternalNote, closeAmendmentRequest.getInternalNote());
|
setIfUpdated(existingApplicationAmendment::getInternalNote, existingApplicationAmendment::setInternalNote, closeAmendmentRequest.getInternalNote());
|
||||||
setIfUpdated(existingApplicationAmendment::getStatus, existingApplicationAmendment::setStatus, ApplicationAmendmentRequestEnum.CLOSE.getValue());
|
setIfUpdated(existingApplicationAmendment::getStatus, existingApplicationAmendment::setStatus, ApplicationAmendmentRequestEnum.CLOSE.getValue());
|
||||||
|
existingApplicationAmendment.setClosingDate(LocalDateTime.now());
|
||||||
ApplicationAmendmentRequestEntity updatedApplicationAmendment = saveApplicationAmendmentRequestEntity(existingApplicationAmendment, oldApplicationAmendmentEntity,
|
ApplicationAmendmentRequestEntity updatedApplicationAmendment = saveApplicationAmendmentRequestEntity(existingApplicationAmendment, oldApplicationAmendmentEntity,
|
||||||
VersionActionTypeEnum.UPDATE);
|
VersionActionTypeEnum.UPDATE);
|
||||||
ApplicationAmendmentRequestResponse response = convertEntityToResponse(updatedApplicationAmendment,false);
|
ApplicationAmendmentRequestResponse response = convertEntityToResponse(updatedApplicationAmendment,false);
|
||||||
@@ -1089,7 +1089,7 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
List<ApplicationAmendmentRequestResponse> response = new ArrayList<>();
|
List<ApplicationAmendmentRequestResponse> response = new ArrayList<>();
|
||||||
if (applicationAmendmentRequestEntity != null) {
|
if (applicationAmendmentRequestEntity != null) {
|
||||||
response = applicationAmendmentRequestEntity.stream()
|
response = applicationAmendmentRequestEntity.stream()
|
||||||
.map(entity -> convertEntityToResponse(entity, false))
|
.map(entity -> convertEntityToResponse(entity, true))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
@@ -1184,6 +1184,37 @@ public class ApplicationAmendmentRequestDao {
|
|||||||
return applicationEvaluation;
|
return applicationEvaluation;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private GetAllAmendmentResponseBean initializeGetAllBasicResponse(ApplicationAmendmentRequestEntity entity) {
|
||||||
|
GetAllAmendmentResponseBean response = new GetAllAmendmentResponseBean();
|
||||||
|
ApplicationEntity applicationEntity = entity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication();
|
||||||
|
response.setId(entity.getId());
|
||||||
|
response.setApplicationId(entity.getApplicationId());
|
||||||
|
response.setApplicationEvaluationId(entity.getApplicationEvaluationEntity().getId());
|
||||||
|
response.setNote(entity.getNote());
|
||||||
|
response.setStatus(ApplicationAmendmentRequestEnum.valueOf(entity.getStatus()));
|
||||||
|
response.setResponseDays(entity.getResponseDays());
|
||||||
|
response.setInternalNote(entity.getInternalNote());
|
||||||
|
|
||||||
|
LocalDateTime startDate = entity.getStartDate();
|
||||||
|
response.setStartDate(startDate);
|
||||||
|
response.setExpirationDate(entity.getEndDate());
|
||||||
|
response.setEvaluationEndDate(entity.getApplicationEvaluationEntity().getEndDate());
|
||||||
|
response.setIsSendEmail(entity.getIsEmail());
|
||||||
|
response.setIsSendNotification(entity.getIsNotification());
|
||||||
|
|
||||||
|
ApplicationEntity application = applicationService.validateApplication(entity.getApplicationId());
|
||||||
|
response.setCallEmail(application.getCall().getEmail());
|
||||||
|
response.setCallName(application.getCall().getName());
|
||||||
|
|
||||||
|
UserEntity userEntity = userService.validateUser(application.getUserId());
|
||||||
|
response.setBeneficiaryName(buildBeneficiaryName(userEntity));
|
||||||
|
CompanyEntity company = companyService.validateCompany(application.getCompanyId());
|
||||||
|
response.setCompanyName(company.getCompanyName());
|
||||||
|
Long protocolNumber = entity.getProtocol() != null ? entity.getProtocol().getProtocolNumber() : null;
|
||||||
|
response.setProtocolNumber(protocolNumber);
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
private void softDeleteDocument(Long documentId) {
|
private void softDeleteDocument(Long documentId) {
|
||||||
documentService.deleteFile(documentId);
|
documentService.deleteFile(documentId);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundExceptio
|
|||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
|
||||||
import org.h2.util.IOUtils;
|
import org.h2.util.IOUtils;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -49,11 +50,16 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
@@ -183,6 +189,7 @@ public class ApplicationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
||||||
|
|
||||||
|
|
||||||
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
||||||
FormEntity formEntity = formService.validateForm(formId);
|
FormEntity formEntity = formService.validateForm(formId);
|
||||||
// callService.validatePublishedCall(formEntity.getCall().getId());
|
// callService.validatePublishedCall(formEntity.getCall().getId());
|
||||||
@@ -234,6 +241,7 @@ public class ApplicationDao {
|
|||||||
entity.setUserWithCompany(userWithCompany);
|
entity.setUserWithCompany(userWithCompany);
|
||||||
entity.setIsDeleted(false);
|
entity.setIsDeleted(false);
|
||||||
entity.setStatus(ApplicationStatusTypeEnum.DRAFT.getValue());
|
entity.setStatus(ApplicationStatusTypeEnum.DRAFT.getValue());
|
||||||
|
entity.setEvaluationVersion(call.getEvaluationVersion());
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,7 +410,7 @@ public class ApplicationDao {
|
|||||||
ApplicationResponse responseBean = new ApplicationResponse();
|
ApplicationResponse responseBean = new ApplicationResponse();
|
||||||
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId());
|
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId());
|
||||||
Long totalFormSteps = flowFormDao.calculateTotalSteps(flowEdgesList);
|
Long totalFormSteps = flowFormDao.calculateTotalSteps(flowEdgesList);
|
||||||
Long completedSteps= Long.valueOf(flowFormDao.getCompletedSteps(applicationEntity));
|
Long completedSteps= Long.valueOf(flowFormDao.getCompletedSteps(applicationEntity, false));
|
||||||
Integer progress = calculateProgress(totalFormSteps, completedSteps);
|
Integer progress = calculateProgress(totalFormSteps, completedSteps);
|
||||||
responseBean.setId(applicationEntity.getId());
|
responseBean.setId(applicationEntity.getId());
|
||||||
responseBean.setProgress(progress);
|
responseBean.setProgress(progress);
|
||||||
@@ -413,6 +421,7 @@ public class ApplicationDao {
|
|||||||
responseBean.setCallId(applicationEntity.getCall().getId());
|
responseBean.setCallId(applicationEntity.getCall().getId());
|
||||||
responseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
responseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
||||||
responseBean.setStatus(applicationEntity.getStatus());
|
responseBean.setStatus(applicationEntity.getStatus());
|
||||||
|
responseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(applicationEntity.getCall().getEvaluationVersion()));
|
||||||
responseBean.setComments(applicationEntity.getComments());
|
responseBean.setComments(applicationEntity.getComments());
|
||||||
responseBean.setCompanyId(applicationEntity.getCompanyId());
|
responseBean.setCompanyId(applicationEntity.getCompanyId());
|
||||||
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
|
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
|
||||||
@@ -480,15 +489,18 @@ public class ApplicationDao {
|
|||||||
|
|
||||||
public List<ApplicationFormFieldEntity> createOrUpdateMultipleFormFields(List<ApplicationFormFieldRequestBean> formFieldResponseBeans,
|
public List<ApplicationFormFieldEntity> createOrUpdateMultipleFormFields(List<ApplicationFormFieldRequestBean> formFieldResponseBeans,
|
||||||
ApplicationFormEntity applicationFormEntity, FormEntity formEntity) {
|
ApplicationFormEntity applicationFormEntity, FormEntity formEntity) {
|
||||||
|
FieldValidator fieldValidator = FieldValidator.create();
|
||||||
|
|
||||||
List<ApplicationFormFieldEntity> existingFields = applicationFormFieldRepository.findByApplicationFormId(applicationFormEntity.getId());
|
List<ApplicationFormFieldEntity> existingFields = applicationFormFieldRepository.findByApplicationFormId(applicationFormEntity.getId());
|
||||||
|
|
||||||
return formFieldResponseBeans.stream().map(requestBean -> createOrUpdateApplicationFormField(requestBean, applicationFormEntity, existingFields, formEntity))
|
List<ApplicationFormFieldEntity> applicationFormFieldEntities=formFieldResponseBeans.stream().map(requestBean -> createOrUpdateApplicationFormField(requestBean, applicationFormEntity, existingFields, formEntity,fieldValidator))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
fieldValidator.validate();
|
||||||
|
return applicationFormFieldEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationFormFieldEntity createOrUpdateApplicationFormField(ApplicationFormFieldRequestBean applicationFormFieldRequestBean,
|
public ApplicationFormFieldEntity createOrUpdateApplicationFormField(ApplicationFormFieldRequestBean applicationFormFieldRequestBean,
|
||||||
ApplicationFormEntity applicationFormEntity, List<ApplicationFormFieldEntity> applicationFormFieldEntities, FormEntity formEntity) {
|
ApplicationFormEntity applicationFormEntity, List<ApplicationFormFieldEntity> applicationFormFieldEntities, FormEntity formEntity,FieldValidator fieldValidator) {
|
||||||
|
|
||||||
ApplicationFormFieldEntity applicationFormFieldEntity = new ApplicationFormFieldEntity();
|
ApplicationFormFieldEntity applicationFormFieldEntity = new ApplicationFormFieldEntity();
|
||||||
|
|
||||||
@@ -497,27 +509,23 @@ public class ApplicationDao {
|
|||||||
VersionActionTypeEnum actionType = VersionActionTypeEnum.INSERT;
|
VersionActionTypeEnum actionType = VersionActionTypeEnum.INSERT;
|
||||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
|
|
||||||
contentResponseBeans.stream()
|
contentResponseBeans.stream()
|
||||||
.filter(content -> "numberinput".equals(content.getName()))
|
.filter(content -> "numberinput".equals(content.getName()) && content.getId().toString().equals(applicationFormFieldRequestBean.getFieldId()))
|
||||||
.map(ContentResponseBean::getSettings)
|
.map(ContentResponseBean::getSettings)
|
||||||
.flatMap(List::stream)
|
.flatMap(List::stream)
|
||||||
.filter(setting -> "isRequestedAmount".equals(setting.getName()) && Boolean.TRUE.equals(setting.getValue()))
|
.filter(setting -> "isRequestedAmount".equals(setting.getName()) && Boolean.TRUE.equals(setting.getValue()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.ifPresent(setting -> {
|
.ifPresent(setting -> {
|
||||||
Object fieldValue = applicationFormFieldRequestBean.getFieldValue();
|
Object fieldValue = applicationFormFieldRequestBean.getFieldValue();
|
||||||
if(fieldValue!=null) {
|
if(fieldValue!=null) {
|
||||||
if (fieldValue instanceof String) {
|
try {
|
||||||
try {
|
BigDecimal amountRequested = new BigDecimal(fieldValue.toString());
|
||||||
BigDecimal amountRequested = new BigDecimal((String) fieldValue);
|
applicationFormEntity.getApplication().setAmountRequested(amountRequested);
|
||||||
applicationFormEntity.getApplication().setAmountRequested(amountRequested);
|
} catch (NumberFormatException e) {
|
||||||
} catch (NumberFormatException e) {
|
throw new IllegalArgumentException("Field value is not a valid number: " + fieldValue, e);
|
||||||
throw new IllegalArgumentException("Field value is not a valid number: " + fieldValue, e);
|
}
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
throw new IllegalArgumentException("Field value is not a String: " + fieldValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
ApplicationFormFieldEntity oldApplicationFormFieldData = null;
|
ApplicationFormFieldEntity oldApplicationFormFieldData = null;
|
||||||
@@ -539,6 +547,7 @@ public class ApplicationDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
calculationProcessForFormula(applicationFormEntity,contentResponseBeans,applicationFormFieldRequestBean,fieldValidator);
|
||||||
Utils.setIfUpdated(applicationFormFieldEntity::getFieldId, applicationFormFieldEntity::setFieldId, applicationFormFieldRequestBean.getFieldId());
|
Utils.setIfUpdated(applicationFormFieldEntity::getFieldId, applicationFormFieldEntity::setFieldId, applicationFormFieldRequestBean.getFieldId());
|
||||||
|
|
||||||
if (applicationFormFieldRequestBean.getFieldValue() != null) {
|
if (applicationFormFieldRequestBean.getFieldValue() != null) {
|
||||||
@@ -561,7 +570,6 @@ public class ApplicationDao {
|
|||||||
VersionHistoryRequest.builder().request(request).actionType(actionType).oldData(oldApplicationFormFieldData).newData(applicationFormField).build());
|
VersionHistoryRequest.builder().request(request).actionType(actionType).oldData(oldApplicationFormFieldData).newData(applicationFormField).build());
|
||||||
|
|
||||||
log.info("Version history logged for action: {}, Field ID: {}", actionType, applicationFormFieldEntity.getFieldId());
|
log.info("Version history logged for action: {}, Field ID: {}", actionType, applicationFormFieldEntity.getFieldId());
|
||||||
|
|
||||||
return applicationFormField;
|
return applicationFormField;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,7 +678,7 @@ public class ApplicationDao {
|
|||||||
return documentIds;
|
return documentIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Long> validateDocumentIds(String documentId) {
|
public List<Long> validateDocumentIds(String documentId) {
|
||||||
if (documentId != null && !documentId.isEmpty()) {
|
if (documentId != null && !documentId.isEmpty()) {
|
||||||
return Arrays.stream(documentId.split(","))
|
return Arrays.stream(documentId.split(","))
|
||||||
.map(Long::parseLong)
|
.map(Long::parseLong)
|
||||||
@@ -879,6 +887,10 @@ public class ApplicationDao {
|
|||||||
checkCallEndDate(call);
|
checkCallEndDate(call);
|
||||||
// call = callService.validatePublishedCall(call.getId());
|
// call = callService.validatePublishedCall(call.getId());
|
||||||
// checkIfApplicationExists(call, userWithCompanyEntity, userEntity);
|
// checkIfApplicationExists(call, userWithCompanyEntity, userEntity);
|
||||||
|
HubEntity hubEntity = hubService.valdateHub(call.getHub().getId());
|
||||||
|
if(hubEntity.getUniqueUuid().equals(defaultHubUuid)){
|
||||||
|
checkIfApplicationExists(call, userWithCompanyEntity, userEntity);
|
||||||
|
}
|
||||||
ApplicationEntity applicationEntity = createApplicationEntity(userEntity, call, userWithCompanyEntity);
|
ApplicationEntity applicationEntity = createApplicationEntity(userEntity, call, userWithCompanyEntity);
|
||||||
applicationEntity.setComments(applicationRequest.getComments());
|
applicationEntity.setComments(applicationRequest.getComments());
|
||||||
applicationEntity = saveApplicationEntity(applicationEntity);
|
applicationEntity = saveApplicationEntity(applicationEntity);
|
||||||
@@ -891,6 +903,18 @@ public class ApplicationDao {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
public void checkIfApplicationExists(CallEntity call, UserWithCompanyEntity userWithCompanyEntity, UserEntity userEntity){
|
||||||
|
|
||||||
|
List<ApplicationEntity> applications = applicationRepository.findByUserIdAndUserWithCompany_IdAndCall_IdAndIsDeletedFalseAndStatusNot(
|
||||||
|
userEntity.getId(), userWithCompanyEntity.getId(), call.getId(), ApplicationStatusTypeEnum.REJECTED.name()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!applications.isEmpty()) {
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_ALREADY_EXISTS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public ApplicationResponse updateApplicationStatus(HttpServletRequest request, Long applicationId, ApplicationStatusTypeEnum status) {
|
public ApplicationResponse updateApplicationStatus(HttpServletRequest request, Long applicationId, ApplicationStatusTypeEnum status) {
|
||||||
|
|
||||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||||
@@ -1108,15 +1132,28 @@ public class ApplicationDao {
|
|||||||
// mailUtil.sendByMailGun(subject, body, List.of(defaultSystemReceiverEmail), null);
|
// mailUtil.sendByMailGun(subject, body, List.of(defaultSystemReceiverEmail), null);
|
||||||
// mailUtil.sendByMailGun(subject, body, List.of(gepafinEmail), null);
|
// mailUtil.sendByMailGun(subject, body, List.of(gepafinEmail), null);
|
||||||
// mailUtil.sendByMailGun(subject, body, List.of(rinaldoEmail), null);
|
// mailUtil.sendByMailGun(subject, body, List.of(rinaldoEmail), null);
|
||||||
if(validator.isProductionProfileActivated()) {
|
// if(Boolean.TRUE.equals(hub.getUniqueUuid().equals(defaultHubUuid))) {
|
||||||
emailLogRequest.setRecipientEmails(carloEmail);
|
// if (validator.isProductionProfileActivated()) {
|
||||||
// mailUtil.sendByMailGun(subject, body, List.of(carloEmail), null);
|
// emailLogRequest.setRecipientEmails(carloEmail);
|
||||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(carloEmail),emailLogRequest);
|
//// mailUtil.sendByMailGun(subject, body, List.of(carloEmail), null);
|
||||||
}
|
// emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(carloEmail),emailLogRequest);
|
||||||
|
// }
|
||||||
|
// List<String> listDefaultSystemReceiverEmail = Arrays.stream(defaultSystemReceiverEmail.split(","))
|
||||||
|
// .map(String::trim)
|
||||||
|
// .filter(email -> !email.isEmpty())
|
||||||
|
// .toList();
|
||||||
|
//
|
||||||
|
// emailLogRequest.setRecipientEmails(defaultSystemReceiverEmail);
|
||||||
|
// emailNotificationDao.sendMail(hub.getId(), subject, body, listDefaultSystemReceiverEmail, emailLogRequest);
|
||||||
|
// }
|
||||||
|
|
||||||
|
List<String> hubEmails = Arrays.stream(hub.getEmail().split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.filter(email -> !email.isEmpty())
|
||||||
|
.toList();
|
||||||
|
|
||||||
emailLogRequest.setRecipientEmails(hub.getEmail());
|
emailLogRequest.setRecipientEmails(hub.getEmail());
|
||||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(hub.getEmail()),emailLogRequest);
|
emailNotificationDao.sendMail(hub.getId(), subject, body,hubEmails,emailLogRequest);
|
||||||
emailLogRequest.setRecipientEmails(defaultSystemReceiverEmail);
|
|
||||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(defaultSystemReceiverEmail),emailLogRequest);
|
|
||||||
emailLogRequest.setRecipientEmails(rinaldoEmail);
|
emailLogRequest.setRecipientEmails(rinaldoEmail);
|
||||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(rinaldoEmail),emailLogRequest);
|
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(rinaldoEmail),emailLogRequest);
|
||||||
}
|
}
|
||||||
@@ -1263,9 +1300,12 @@ public class ApplicationDao {
|
|||||||
if (Boolean.FALSE.equals(ApplicationStatusTypeEnum.DRAFT.getValue().equals(applicationEntity.getStatus()))) {
|
if (Boolean.FALSE.equals(ApplicationStatusTypeEnum.DRAFT.getValue().equals(applicationEntity.getStatus()))) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
|
||||||
}
|
}
|
||||||
|
if (applicationEntity.getAmountRequested() == null || applicationEntity.getAmountRequested().compareTo(BigDecimal.ZERO) <= 0 ) {
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO));
|
||||||
|
}
|
||||||
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId());
|
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId());
|
||||||
Long totalSteps = flowFormDao.calculateTotalSteps(flowEdgesList);
|
Long totalSteps = flowFormDao.calculateTotalSteps(flowEdgesList);
|
||||||
Integer completedSteps = flowFormDao.getCompletedSteps(applicationEntity);
|
Integer completedSteps = flowFormDao.getCompletedSteps(applicationEntity, true);
|
||||||
if (totalSteps.intValue() != completedSteps) {
|
if (totalSteps.intValue() != completedSteps) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_IS_INCOMPLETE_MSG));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_IS_INCOMPLETE_MSG));
|
||||||
}
|
}
|
||||||
@@ -1402,6 +1442,9 @@ public class ApplicationDao {
|
|||||||
public PageableResponseBean<List<ApplicationResponse>> getAllApplicationByPagination(UserEntity userEntity, Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean) {
|
public PageableResponseBean<List<ApplicationResponse>> getAllApplicationByPagination(UserEntity userEntity, Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean) {
|
||||||
Integer pageNo = null;
|
Integer pageNo = null;
|
||||||
Integer pageLimit = null;
|
Integer pageLimit = null;
|
||||||
|
|
||||||
|
UserWithCompanyEntity userWithCompany= userWithCompanyRepository.findByUserIdAndCompanyIdAndIsDeletedFalse(userEntity.getId(), companyId).orElse(null);
|
||||||
|
|
||||||
if (applicationPageableRequestBean.getGlobalFilters() != null) {
|
if (applicationPageableRequestBean.getGlobalFilters() != null) {
|
||||||
pageNo = applicationPageableRequestBean.getGlobalFilters().getPage();
|
pageNo = applicationPageableRequestBean.getGlobalFilters().getPage();
|
||||||
pageLimit = applicationPageableRequestBean.getGlobalFilters().getLimit();
|
pageLimit = applicationPageableRequestBean.getGlobalFilters().getLimit();
|
||||||
@@ -1412,7 +1455,7 @@ public class ApplicationDao {
|
|||||||
if (pageNo == null || pageNo <= 0) {
|
if (pageNo == null || pageNo <= 0) {
|
||||||
pageNo = GepafinConstant.DEFAULT_PAGE;
|
pageNo = GepafinConstant.DEFAULT_PAGE;
|
||||||
}
|
}
|
||||||
Specification<ApplicationEntity> spec = search(callId, companyId, applicationPageableRequestBean, userEntity);
|
Specification<ApplicationEntity> spec = search(callId,companyId, userWithCompany.getId(), applicationPageableRequestBean, userEntity);
|
||||||
Page<ApplicationEntity> entityPage = applicationRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
Page<ApplicationEntity> entityPage = applicationRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||||
// Prepare the response
|
// Prepare the response
|
||||||
|
|
||||||
@@ -1435,10 +1478,10 @@ public class ApplicationDao {
|
|||||||
return pageableResponseBean;
|
return pageableResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Specification<ApplicationEntity> search(Long callId, Long companyId, ApplicationPageableRequestBean applicationPageableRequestBean, UserEntity userEntity) {
|
public Specification<ApplicationEntity> search(Long callId, Long companyId, Long userWithCompanyId, ApplicationPageableRequestBean applicationPageableRequestBean, UserEntity userEntity) {
|
||||||
return (root, query, criteriaBuilder) -> {
|
return (root, query, criteriaBuilder) -> {
|
||||||
|
|
||||||
List<Predicate> predicates = getPredicates(applicationPageableRequestBean, criteriaBuilder, root, callId, companyId, userEntity);
|
List<Predicate> predicates = getPredicates(applicationPageableRequestBean, criteriaBuilder, root, callId,companyId, userWithCompanyId, userEntity);
|
||||||
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
||||||
|
|
||||||
if (applicationPageableRequestBean.getGlobalFilters() != null
|
if (applicationPageableRequestBean.getGlobalFilters() != null
|
||||||
@@ -1462,13 +1505,15 @@ public class ApplicationDao {
|
|||||||
|
|
||||||
|
|
||||||
private List<Predicate> getPredicates(ApplicationPageableRequestBean applicationPageableRequestBean,
|
private List<Predicate> getPredicates(ApplicationPageableRequestBean applicationPageableRequestBean,
|
||||||
CriteriaBuilder criteriaBuilder, Root<ApplicationEntity> root, Long callId, Long companyId, UserEntity userEntity) {
|
CriteriaBuilder criteriaBuilder, Root<ApplicationEntity> root, Long callId,Long companyId, Long userWithCompanyId, UserEntity userEntity) {
|
||||||
|
|
||||||
Integer year = null;
|
Integer year = null;
|
||||||
String search = null;
|
String search = null;
|
||||||
|
Integer daysRange = null;
|
||||||
if (applicationPageableRequestBean.getGlobalFilters() != null) {
|
if (applicationPageableRequestBean.getGlobalFilters() != null) {
|
||||||
year = applicationPageableRequestBean.getGlobalFilters().getYear();
|
year = applicationPageableRequestBean.getGlobalFilters().getYear();
|
||||||
search = applicationPageableRequestBean.getGlobalFilters().getSearch();
|
search = applicationPageableRequestBean.getGlobalFilters().getSearch();
|
||||||
|
daysRange = applicationPageableRequestBean.getDaysRange();
|
||||||
}
|
}
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
|
||||||
@@ -1526,16 +1571,24 @@ public class ApplicationDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Optional companyId filter
|
// Optional companyId filter
|
||||||
|
if (userWithCompanyId != null) {
|
||||||
|
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_WITH_COMPANY).get(GepafinConstant.ID), userWithCompanyId));
|
||||||
|
}
|
||||||
if (companyId != null) {
|
if (companyId != null) {
|
||||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.COMPANY_ID), companyId));
|
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.COMPANY_ID), companyId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (daysRange != null && daysRange >= 0) {
|
||||||
|
LocalDateTime today = LocalDateTime.now();
|
||||||
|
LocalDateTime pastDate = today.minusDays(daysRange);
|
||||||
|
predicates.add(criteriaBuilder.between(root.get(GepafinConstant.CREATED_DATE), pastDate, today));
|
||||||
|
}
|
||||||
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
||||||
|
|
||||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.HUB_ID), userEntity.getHub().getId()));
|
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.HUB_ID), userEntity.getHub().getId()));
|
||||||
|
|
||||||
|
|
||||||
return predicates;
|
return predicates;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void checkCallEndDate(CallEntity call) {
|
public void checkCallEndDate(CallEntity call) {
|
||||||
LocalDateTime now = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
|
LocalDateTime now = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
|
||||||
@@ -1553,5 +1606,135 @@ public class ApplicationDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void calculationProcessForFormula(ApplicationFormEntity 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("label")){
|
||||||
|
label= String.valueOf(settingResponseBean.getValue());
|
||||||
|
}
|
||||||
|
if(settingResponseBean.getName().equals("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 -> "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<ApplicationFormFieldEntity> optionalEntity = applicationFormFieldRepository.findByApplicationFormIdAndFieldId(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 -> "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("total");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
updatedMappedFormulaValue.put(fieldId, entityFieldValue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(formulaValueOpt==null || formulaValueOpt.isEmpty()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double finalValue = evaluateFormula(formulaValueOpt, mappedFormulaValue, updatedMappedFormulaValue);
|
||||||
|
|
||||||
|
fieldValidator.formulaValidation(fieldValue, finalValue, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static double evaluateFormula(String formula, Map<String, String> mappedFormulaValue, Map<String, String> updatedMappedFormulaValue) {
|
||||||
|
// Step 1: Extract all placeholders (variables) like {rest}, {another_var}, etc.
|
||||||
|
Pattern pattern = Pattern.compile("\\{(.*?)\\}");
|
||||||
|
Matcher matcher = pattern.matcher(formula);
|
||||||
|
List<String> variables = new ArrayList<>();
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
variables.add(matcher.group(1)); // Extract variable names inside the curly braces
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: Replace placeholders with corresponding fieldValue
|
||||||
|
Map<String, Double> variableValues = new HashMap<>();
|
||||||
|
|
||||||
|
for (String variable : variables) {
|
||||||
|
String fieldId = mappedFormulaValue.get(variable);
|
||||||
|
if (fieldId != null && updatedMappedFormulaValue.containsKey(fieldId)) {
|
||||||
|
String fieldValueStr = updatedMappedFormulaValue.get(fieldId);
|
||||||
|
try {
|
||||||
|
double fieldValue = Double.parseDouble(fieldValueStr); // Assuming fieldValue is numeric
|
||||||
|
variableValues.put(variable, fieldValue);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// Handle invalid number format gracefully (e.g., log an error or default to 0)
|
||||||
|
variableValues.put(variable, 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3: Replace variables in the formula with their corresponding values
|
||||||
|
String expression = formula;
|
||||||
|
for (String variable : variables) {
|
||||||
|
Double value = variableValues.get(variable);
|
||||||
|
if (value != null) {
|
||||||
|
// Replace {variable} with its corresponding value in the formula
|
||||||
|
expression = expression.replace("{" + variable + "}", String.valueOf(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 4: Evaluate the mathematical expression
|
||||||
|
return Utils.evaluateExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,7 @@ import net.gepafin.tendermanagement.model.request.*;
|
|||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.repositories.*;
|
import net.gepafin.tendermanagement.repositories.*;
|
||||||
import net.gepafin.tendermanagement.service.*;
|
import net.gepafin.tendermanagement.service.*;
|
||||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
import net.gepafin.tendermanagement.util.*;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
@@ -25,6 +22,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.text.MessageFormat;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
@@ -32,6 +30,7 @@ import java.util.*;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static net.gepafin.tendermanagement.util.Utils.log;
|
||||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@@ -113,12 +112,49 @@ public class ApplicationEvaluationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationAmendmentRequestDao applicationAmendmentRequestDao;
|
private ApplicationAmendmentRequestDao applicationAmendmentRequestDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HubService hubService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EvaluationFormService evaluationFormService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EvaluationFormDao evaluationFormDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationEvaluationFormRepository applicationEvaluationFormRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationEvaluationFormFieldRepository applicationEvaluationFormFieldRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationDao applicationDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationEvaluationService applicationEvaluationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallDao callDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EvaluationFormRepository evaluationFormRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
|
||||||
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||||
|
|
||||||
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
|
||||||
|
|
||||||
AssignedApplicationsEntity assignedApplications = assignedApplicationsService.validateAssignedApplication(assignedApplciationId);
|
AssignedApplicationsEntity assignedApplications = assignedApplicationsService.validateAssignedApplication(assignedApplciationId);
|
||||||
ApplicationEntity application = applicationService.validateApplication(assignedApplications.getApplication().getId());
|
ApplicationEntity application = applicationService.validateApplication(assignedApplications.getApplication().getId());
|
||||||
|
|
||||||
|
Long hubId = application.getHubId();
|
||||||
|
HubEntity hub = hubService.valdateHub(hubId);
|
||||||
|
|
||||||
|
Long initialDays = (hub != null) ? hub.getEvaluationExpirationDays() : 30L;
|
||||||
|
|
||||||
entity.setApplicationId(application.getId());
|
entity.setApplicationId(application.getId());
|
||||||
entity.setAssignedApplicationsEntity(assignedApplications);
|
entity.setAssignedApplicationsEntity(assignedApplications);
|
||||||
entity.setUserId(user.getId());
|
entity.setUserId(user.getId());
|
||||||
@@ -128,11 +164,12 @@ public class ApplicationEvaluationDao {
|
|||||||
entity.setNote(req.getNote());
|
entity.setNote(req.getNote());
|
||||||
entity.setMotivation(req.getMotivation());
|
entity.setMotivation(req.getMotivation());
|
||||||
entity.setIsDeleted(false);
|
entity.setIsDeleted(false);
|
||||||
entity.setInitialDays(30L);
|
entity.setInitialDays(initialDays);
|
||||||
entity.setRemainingDays(30L);
|
entity.setRemainingDays(initialDays);
|
||||||
entity.setSuspendedDays(0L);
|
entity.setSuspendedDays(0L);
|
||||||
entity.setStartDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
entity.setStartDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
entity.setEndDate(DateTimeUtil.DateServerToUTC(application.getSubmissionDate().plusDays(30)));
|
entity.setEndDate(DateTimeUtil.DateServerToUTC(application.getSubmissionDate().plusDays(initialDays)));
|
||||||
|
entity.setEvaluationVersion(application.getEvaluationVersion());
|
||||||
entity.setStatus(ApplicationEvaluationStatusTypeEnum.OPEN.getValue());
|
entity.setStatus(ApplicationEvaluationStatusTypeEnum.OPEN.getValue());
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
@@ -254,9 +291,13 @@ public class ApplicationEvaluationDao {
|
|||||||
response.setNote(entity.getNote());
|
response.setNote(entity.getNote());
|
||||||
response.setMotivation(entity.getMotivation());
|
response.setMotivation(entity.getMotivation());
|
||||||
response.setStatus(ApplicationEvaluationStatusTypeEnum.valueOf(entity.getStatus()));
|
response.setStatus(ApplicationEvaluationStatusTypeEnum.valueOf(entity.getStatus()));
|
||||||
|
response.setEvaluationVersion(EvaluationVersionEnum.valueOf(entity.getEvaluationVersion()));
|
||||||
response.setEvaluationEndDate(entity.getEndDate());
|
response.setEvaluationEndDate(entity.getEndDate());
|
||||||
response.setCreatedDate(entity.getCreatedDate());
|
response.setCreatedDate(entity.getCreatedDate());
|
||||||
response.setUpdatedDate(entity.getUpdatedDate());
|
response.setUpdatedDate(entity.getUpdatedDate());
|
||||||
|
response.setNumberOfCheck(entity.getAssignedApplicationsEntity().getApplication().getCall().getNumberOfCheck());
|
||||||
|
response.setProductId(entity.getAssignedApplicationsEntity().getApplication().getCall().getProductId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -603,6 +644,7 @@ public class ApplicationEvaluationDao {
|
|||||||
ApplicationEvaluationEntity oldApplicationEvaluation = null;
|
ApplicationEvaluationEntity oldApplicationEvaluation = null;
|
||||||
ApplicationEntity application = applicationService.validateApplication(assignedApplications.get().getApplication().getId());
|
ApplicationEntity application = applicationService.validateApplication(assignedApplications.get().getApplication().getId());
|
||||||
VersionActionTypeEnum actionType = VersionActionTypeEnum.INSERT;
|
VersionActionTypeEnum actionType = VersionActionTypeEnum.INSERT;
|
||||||
|
validateApplicationEvaluationRequest(req, application);
|
||||||
if (existingEntityOptional.isPresent()) {
|
if (existingEntityOptional.isPresent()) {
|
||||||
entity = existingEntityOptional.get();
|
entity = existingEntityOptional.get();
|
||||||
oldApplicationEvaluation = Utils.getClonedEntityForData(entity);
|
oldApplicationEvaluation = Utils.getClonedEntityForData(entity);
|
||||||
@@ -625,16 +667,33 @@ public class ApplicationEvaluationDao {
|
|||||||
application.setAmountAccepted(req.getAmountAccepted());
|
application.setAmountAccepted(req.getAmountAccepted());
|
||||||
}
|
}
|
||||||
actionType = VersionActionTypeEnum.UPDATE;
|
actionType = VersionActionTypeEnum.UPDATE;
|
||||||
|
|
||||||
|
entity = applicationEvaluationRepository.save(entity);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId);
|
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId);
|
||||||
entity = convertToEntity(user, req, assignedApplicationId);
|
entity = convertToEntity(user, req, assignedApplicationId);
|
||||||
actionType = VersionActionTypeEnum.INSERT;
|
actionType = VersionActionTypeEnum.INSERT;
|
||||||
|
|
||||||
|
entity = applicationEvaluationRepository.save(entity);
|
||||||
|
|
||||||
|
ApplicationEntity oldApplication = Utils.getClonedEntityForData(application);
|
||||||
|
|
||||||
|
application.setApplicationEvaluationId(entity.getId());
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Update Application" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(actionType).oldData(oldApplication).newData(application).build());
|
||||||
|
|
||||||
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_CREATION);
|
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_CREATION);
|
||||||
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_CREATION);
|
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_CREATION);
|
||||||
notificationDao.sendNotificationToInstructor(placeHolders,entity,NotificationTypeEnum.EVALUATION_CREATION);
|
notificationDao.sendNotificationToInstructor(placeHolders,entity,NotificationTypeEnum.EVALUATION_CREATION);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Update Application Evaluation" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(actionType).oldData(oldApplicationEvaluation).newData(entity).build());
|
||||||
|
|
||||||
ApplicationStatusForEvaluation status = req.getApplicationStatus();
|
ApplicationStatusForEvaluation status = req.getApplicationStatus();
|
||||||
// Fetch all amendment request entities associated with the evaluation ID
|
// Fetch all amendment request entities associated with the evaluation ID
|
||||||
List<ApplicationAmendmentRequestEntity> applicationAmendmentRequestEntities =
|
List<ApplicationAmendmentRequestEntity> applicationAmendmentRequestEntities =
|
||||||
@@ -644,25 +703,27 @@ public class ApplicationEvaluationDao {
|
|||||||
}
|
}
|
||||||
// Fetch amendment details from the request
|
// Fetch amendment details from the request
|
||||||
if(req.getAmendmentDetails()!=null) {
|
if(req.getAmendmentDetails()!=null) {
|
||||||
List<AmendmentDetailsRequest> amendmentDetailsRequests = req.getAmendmentDetails();
|
List<AmendmentDetailsRequest> amendmentDetailsRequests = req.getAmendmentDetails();
|
||||||
|
|
||||||
updateAmendmentDocumentsAndFormFields(applicationAmendmentRequestEntities, amendmentDetailsRequests);
|
updateAmendmentDocumentsAndFormFields(applicationAmendmentRequestEntities, amendmentDetailsRequests);
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationEvaluationEntity savedEntity = applicationEvaluationRepository.save(entity);
|
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for the "Update Application Evaluation" operation. **/
|
|
||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(actionType).oldData(oldApplicationEvaluation).newData(entity).build());
|
|
||||||
|
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplications.get();
|
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplications.get();
|
||||||
return updateApplicationEvaluationStatus(application, assignedApplicationsEntity, status);
|
return updateApplicationEvaluationStatus(application, assignedApplicationsEntity, status);
|
||||||
} else {
|
} else {
|
||||||
return convertToResponse(savedEntity);
|
return convertToResponse(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAmendmentDocumentsAndFormFields(List<ApplicationAmendmentRequestEntity> applicationAmendmentRequestEntities, List<AmendmentDetailsRequest> amendmentFormFields) {
|
private void validateApplicationEvaluationRequest(ApplicationEvaluationRequest req, ApplicationEntity application) {
|
||||||
|
if(EvaluationVersionEnum.V2.getValue().equals(application.getEvaluationVersion())) {
|
||||||
|
req.setChecklist(null);
|
||||||
|
req.setCriteria(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateAmendmentDocumentsAndFormFields(List<ApplicationAmendmentRequestEntity> applicationAmendmentRequestEntities, List<AmendmentDetailsRequest> amendmentFormFields) {
|
||||||
// Iterate through amendment request entities
|
// Iterate through amendment request entities
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1086,6 +1147,7 @@ public class ApplicationEvaluationDao {
|
|||||||
List<ApplicationFormEntity> applicationFormEntities = applicationFormRepository.findByApplicationId(applicationId);
|
List<ApplicationFormEntity> applicationFormEntities = applicationFormRepository.findByApplicationId(applicationId);
|
||||||
response.setApplicationId(application.getId());
|
response.setApplicationId(application.getId());
|
||||||
response.setAssignedApplicationId(assignedApplications.getId());
|
response.setAssignedApplicationId(assignedApplications.getId());
|
||||||
|
response.setEvaluationVersion(EvaluationVersionEnum.valueOf(application.getEvaluationVersion()));
|
||||||
response.setNote(null);
|
response.setNote(null);
|
||||||
response.setMotivation(null);
|
response.setMotivation(null);
|
||||||
response.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(application.getStatus()));
|
response.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(application.getStatus()));
|
||||||
@@ -1094,6 +1156,8 @@ public class ApplicationEvaluationDao {
|
|||||||
response.setEvaluationEndDate(entity.getEndDate());
|
response.setEvaluationEndDate(entity.getEndDate());
|
||||||
LocalDateTime callEndDate = application.getCall().getEndDate();
|
LocalDateTime callEndDate = application.getCall().getEndDate();
|
||||||
response.setCallEndDate(callEndDate);
|
response.setCallEndDate(callEndDate);
|
||||||
|
response.setNumberOfCheck(call.getNumberOfCheck());
|
||||||
|
response.setProductId(call.getProductId());
|
||||||
setCriteriaResponses(entity, application.getId(), response, evaluationCriterias);
|
setCriteriaResponses(entity, application.getId(), response, evaluationCriterias);
|
||||||
setChecklistResponses(entity, application.getId(), response, checklistEntities);
|
setChecklistResponses(entity, application.getId(), response, checklistEntities);
|
||||||
setFileResponses(entity, application.getId(), response, applicationFormEntities);
|
setFileResponses(entity, application.getId(), response, applicationFormEntities);
|
||||||
@@ -1886,5 +1950,321 @@ public class ApplicationEvaluationDao {
|
|||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluation).newData(savedEntity).build());
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluation).newData(savedEntity).build());
|
||||||
return convertToResponse(savedEntity);
|
return convertToResponse(savedEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ApplicationEvaluationFormResponse createApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationFormRequestBean applicationEvaluationFormRequestBean, Long evaluationFormId, Long assignedApplicationId){
|
||||||
|
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId);
|
||||||
|
ApplicationEntity application = applicationService.validateApplication(assignedApplicationsEntity.getApplication().getId());
|
||||||
|
|
||||||
|
// Convert FormRequestBean to ApplicationEvaluationRequest
|
||||||
|
ApplicationEvaluationRequest req = convertToApplicationEvaluationRequest(applicationEvaluationFormRequestBean);
|
||||||
|
|
||||||
|
// Call the existing method to create or update evaluation
|
||||||
|
ApplicationEvaluationResponse evaluationResponse = createOrUpdateApplicationEvaluation(user, req, assignedApplicationId);
|
||||||
|
|
||||||
|
ApplicationEvaluationEntity entity = applicationEvaluationService.validateApplicationEvaluation(evaluationResponse.getId());
|
||||||
|
|
||||||
|
//Handling Application Evaluation form
|
||||||
|
EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
|
||||||
|
validateFormFields(applicationEvaluationFormRequestBean,evaluationFormEntity);
|
||||||
|
// ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationRepository.findByAssignedApplicationsId(assignedApplicationId);
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,entity);
|
||||||
|
createOrUpdateMultipleFormFields(applicationEvaluationFormRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
|
||||||
|
return processEvaluationForm(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplicationEvaluationFormEntity getApplicationEvaluationFormOrCreate(EvaluationFormEntity evaluationFormEntity, ApplicationEvaluationEntity applicationEvaluationEntity) {
|
||||||
|
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = applicationEvaluationFormRepository.findByEvaluationIdAndEvaluationFormId(applicationEvaluationEntity.getId(), evaluationFormEntity.getId());
|
||||||
|
ApplicationEvaluationFormEntity oldApplicationEvaluationFormEntity = Utils.getClonedEntityForData(applicationEvaluationFormEntity);
|
||||||
|
if (applicationEvaluationFormEntity == null) {
|
||||||
|
applicationEvaluationFormEntity = createApplicationEvaluationFormEntity(applicationEvaluationEntity, evaluationFormEntity);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Create application evalaution form" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(
|
||||||
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(oldApplicationEvaluationFormEntity).newData(applicationEvaluationFormEntity)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
return applicationEvaluationFormEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationEvaluationFormEntity createApplicationEvaluationFormEntity(ApplicationEvaluationEntity applicationEvaluationEntity, EvaluationFormEntity evaluationFormEntity) {
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = new ApplicationEvaluationFormEntity();
|
||||||
|
applicationEvaluationFormEntity.setApplicationId(applicationEvaluationEntity.getApplicationId());
|
||||||
|
applicationEvaluationFormEntity.setEvaluationForm(evaluationFormEntity);
|
||||||
|
applicationEvaluationFormEntity.setApplicationEvaluation(applicationEvaluationEntity);
|
||||||
|
applicationEvaluationFormEntity.setIsDeleted(false);
|
||||||
|
return saveApplicationEvaluationFormEntity(applicationEvaluationFormEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void validateFormFields(ApplicationEvaluationFormRequestBean request, EvaluationFormEntity evaluationFormEntity) {
|
||||||
|
|
||||||
|
List<ContentResponseBean> contentResponseBeans=evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity).getContent();
|
||||||
|
|
||||||
|
List<ApplicationFormFieldRequestBean> requestFields = request.getFormFields();
|
||||||
|
|
||||||
|
Map<String, String> contentMap = contentResponseBeans.stream()
|
||||||
|
.collect(Collectors.toMap(ContentResponseBean::getId, ContentResponseBean::getLabel)); // Change getLabel() if needed
|
||||||
|
FieldValidator validator = FieldValidator.create();
|
||||||
|
for (ApplicationFormFieldRequestBean requestField : requestFields) {
|
||||||
|
String fieldId = requestField.getFieldId();
|
||||||
|
|
||||||
|
if (!contentMap.containsKey(fieldId)) {
|
||||||
|
validator.addError(MessageFormat.format(Translator.toLocale(GepafinConstant.FIELD_ID_NOT_FOUND), fieldId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
validator.validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationEvaluationFormEntity saveApplicationEvaluationFormEntity(ApplicationEvaluationFormEntity applicationEvaluationFormEntity) {
|
||||||
|
return applicationEvaluationFormRepository.save(applicationEvaluationFormEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ApplicationEvaluationFormFieldEntity> createOrUpdateMultipleFormFields(List<ApplicationFormFieldRequestBean> formFieldRequestBeans,
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity, EvaluationFormEntity evaluationFormEntity) {
|
||||||
|
|
||||||
|
List<ApplicationEvaluationFormFieldEntity> existingFields = applicationEvaluationFormFieldRepository.findByApplicationEvaluationFormId(applicationEvaluationFormEntity.getId());
|
||||||
|
|
||||||
|
return formFieldRequestBeans.stream().map(requestBean -> createOrUpdateApplicationEvaluationFormField(requestBean, applicationEvaluationFormEntity, existingFields, evaluationFormEntity))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationEvaluationFormFieldEntity createOrUpdateApplicationEvaluationFormField(ApplicationFormFieldRequestBean applicationFormFieldRequestBean,
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity,
|
||||||
|
List<ApplicationEvaluationFormFieldEntity> applicationEvaluationFormFieldEntities,
|
||||||
|
EvaluationFormEntity evaluationFormEntity){
|
||||||
|
ApplicationEvaluationFormFieldEntity applicationEvaluationFormFieldEntity = new ApplicationEvaluationFormFieldEntity();
|
||||||
|
validateFileUploadDocuments(applicationFormFieldRequestBean, evaluationFormEntity);
|
||||||
|
VersionActionTypeEnum actionType = VersionActionTypeEnum.INSERT;
|
||||||
|
ApplicationEvaluationFormFieldEntity oldApplicationEvaluationFormFieldData = null;
|
||||||
|
if (applicationEvaluationFormFieldEntities == null || applicationEvaluationFormFieldEntities.isEmpty()) {
|
||||||
|
applicationEvaluationFormFieldEntity = new ApplicationEvaluationFormFieldEntity();
|
||||||
|
applicationEvaluationFormFieldEntity.setApplicationEvaluationForm(applicationEvaluationFormEntity);
|
||||||
|
applicationEvaluationFormFieldEntity.setIsDeleted(false);
|
||||||
|
}else{
|
||||||
|
for (ApplicationEvaluationFormFieldEntity existingFieldEntity : applicationEvaluationFormFieldEntities) {
|
||||||
|
if (existingFieldEntity.getFieldId().equals(applicationFormFieldRequestBean.getFieldId())) {
|
||||||
|
applicationEvaluationFormFieldEntity = existingFieldEntity;
|
||||||
|
oldApplicationEvaluationFormFieldData = Utils.getClonedEntityForData(existingFieldEntity);
|
||||||
|
actionType = VersionActionTypeEnum.UPDATE;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
applicationEvaluationFormFieldEntity.setApplicationEvaluationForm(applicationEvaluationFormEntity);
|
||||||
|
applicationEvaluationFormFieldEntity.setIsDeleted(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Utils.setIfUpdated(applicationEvaluationFormFieldEntity::getFieldId, applicationEvaluationFormFieldEntity::setFieldId, applicationFormFieldRequestBean.getFieldId());
|
||||||
|
|
||||||
|
if (applicationFormFieldRequestBean.getFieldValue() != null) {
|
||||||
|
applicationEvaluationFormFieldEntity.setFieldValue(Utils.convertObjectToJsonString(applicationFormFieldRequestBean.getFieldValue()));
|
||||||
|
} else {
|
||||||
|
applicationEvaluationFormFieldEntity.setFieldValue(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationEvaluationFormFieldEntity savedEvaluationFormFieldEntity = applicationEvaluationFormFieldRepository.save(applicationEvaluationFormFieldEntity);
|
||||||
|
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(actionType).oldData(oldApplicationEvaluationFormFieldData).newData(savedEvaluationFormFieldEntity).build());
|
||||||
|
|
||||||
|
log.info("Version history logged for action: {}, Field ID: {}", actionType, applicationEvaluationFormFieldEntity.getFieldId());
|
||||||
|
|
||||||
|
return savedEvaluationFormFieldEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Long> validateFileUploadDocuments(ApplicationFormFieldRequestBean applicationFormFieldRequestBean, EvaluationFormEntity evaluationFormEntity) {
|
||||||
|
List<Long> documentIds=null;
|
||||||
|
|
||||||
|
List<ContentResponseBean> contentResponseBeans=evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity).getContent();
|
||||||
|
for (ContentResponseBean contentResponseBean:contentResponseBeans){
|
||||||
|
if(Boolean.TRUE.equals(contentResponseBean.getName().equals("fileupload"))) {
|
||||||
|
if (contentResponseBean.getId().equals(applicationFormFieldRequestBean.getFieldId())) {
|
||||||
|
Object fieldValueObject = applicationFormFieldRequestBean.getFieldValue();
|
||||||
|
if (fieldValueObject instanceof String) {
|
||||||
|
// Safely cast the object to a string
|
||||||
|
String documentId = (String) fieldValueObject;
|
||||||
|
// Now you can use documentId as needed
|
||||||
|
documentIds = applicationDao.validateDocumentIds(documentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return documentIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<ApplicationEvaluationFormFieldReponseBean> createEvaluationFormFieldResponse(
|
||||||
|
List<ApplicationEvaluationFormFieldEntity> evaluationFormFieldEntities,
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity){
|
||||||
|
List<ApplicationEvaluationFormFieldReponseBean> evaluationFormFieldResponseBeans = new ArrayList<>();
|
||||||
|
List<ContentResponseBean> contentResponseBeans =evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(applicationEvaluationFormEntity.getEvaluationForm()).getContent();
|
||||||
|
|
||||||
|
for (ApplicationEvaluationFormFieldEntity applicationEvaluationFormFieldEntity : evaluationFormFieldEntities) {
|
||||||
|
|
||||||
|
Optional<ContentResponseBean> fileUploadContent = contentResponseBeans.stream()
|
||||||
|
.filter(contentResponseBean -> "fileupload".equals(contentResponseBean.getName()) &&
|
||||||
|
contentResponseBean.getId().equals(applicationEvaluationFormFieldEntity.getFieldId()))
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
List<DocumentResponseBean> documentResponseBeans = new ArrayList<>();
|
||||||
|
if (fileUploadContent.isPresent()) {
|
||||||
|
String documentId = applicationEvaluationFormFieldEntity.getFieldValue();
|
||||||
|
if (documentId != null && !documentId.isEmpty()) {
|
||||||
|
documentResponseBeans = Arrays.stream(documentId.split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.map(Long::parseLong)
|
||||||
|
.map(docId -> {
|
||||||
|
DocumentEntity documentEntity = documentService.validateDocument(docId);
|
||||||
|
// if (Boolean.FALSE.equals(DocumentSourceTypeEnum.APPLICATION.getValue().equals(documentEntity.getSource()))) {
|
||||||
|
// throw new CustomValidationException(Status.NOT_FOUND,Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND));
|
||||||
|
// }
|
||||||
|
return documentEntity;
|
||||||
|
})
|
||||||
|
.map(callDao::convertToDocumentResponseBean)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ApplicationEvaluationFormFieldReponseBean responseBean = convertToEvaluationFormFieldResponseBean(
|
||||||
|
applicationEvaluationFormFieldEntity, applicationEvaluationFormEntity.getId());
|
||||||
|
if (!documentResponseBeans.isEmpty()) {
|
||||||
|
responseBean.setFieldValue(documentResponseBeans);
|
||||||
|
}
|
||||||
|
evaluationFormFieldResponseBeans.add(responseBean);
|
||||||
|
}
|
||||||
|
return evaluationFormFieldResponseBeans;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplicationEvaluationFormFieldReponseBean convertToEvaluationFormFieldResponseBean(ApplicationEvaluationFormFieldEntity entity,Long applicationEvaluationFormId){
|
||||||
|
ApplicationEvaluationFormFieldReponseBean applicationEvaluationFormFieldReponseBean = new ApplicationEvaluationFormFieldReponseBean();
|
||||||
|
applicationEvaluationFormFieldReponseBean.setApplicationEvaluationFormId(applicationEvaluationFormId);
|
||||||
|
applicationEvaluationFormFieldReponseBean.setFieldId(entity.getFieldId());
|
||||||
|
if(entity.getFieldValue() != null) {
|
||||||
|
applicationEvaluationFormFieldReponseBean.setFieldValue(Utils.getFieldValueAsObject(entity.getFieldValue()));
|
||||||
|
}
|
||||||
|
applicationEvaluationFormFieldReponseBean.setId(entity.getId());
|
||||||
|
applicationEvaluationFormFieldReponseBean.setCreatedDate(entity.getCreatedDate());
|
||||||
|
applicationEvaluationFormFieldReponseBean.setUpdatedDate(entity.getUpdatedDate());
|
||||||
|
return applicationEvaluationFormFieldReponseBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplicationEvaluationFormResponse convertToApplicationEvaluationResponseBean(ApplicationEvaluationResponse applicationEvaluationResponse){
|
||||||
|
ApplicationEvaluationFormResponse response = new ApplicationEvaluationFormResponse();
|
||||||
|
response.setId(applicationEvaluationResponse.getId());
|
||||||
|
response.setApplicationId(applicationEvaluationResponse.getApplicationId());
|
||||||
|
response.setNote(applicationEvaluationResponse.getNote());
|
||||||
|
response.setEvaluationVersion(applicationEvaluationResponse.getEvaluationVersion());
|
||||||
|
response.setCreatedDate(applicationEvaluationResponse.getCreatedDate());
|
||||||
|
response.setUpdatedDate(applicationEvaluationResponse.getUpdatedDate());
|
||||||
|
response.setApplicationStatus(applicationEvaluationResponse.getApplicationStatus());
|
||||||
|
response.setAssignedApplicationId(applicationEvaluationResponse.getAssignedApplicationId());
|
||||||
|
response.setMinScore(applicationEvaluationResponse.getMinScore());
|
||||||
|
response.setStatus(applicationEvaluationResponse.getStatus());
|
||||||
|
response.setFiles(applicationEvaluationResponse.getFiles());
|
||||||
|
response.setEvaluationDocument(applicationEvaluationResponse.getEvaluationDocument());
|
||||||
|
response.setAmendmentDetails(applicationEvaluationResponse.getAmendmentDetails());
|
||||||
|
response.setBeneficiary(applicationEvaluationResponse.getBeneficiary());
|
||||||
|
response.setAssignedUserId(applicationEvaluationResponse.getAssignedUserId());
|
||||||
|
response.setAssignedUserName(applicationEvaluationResponse.getAssignedUserName());
|
||||||
|
response.setProtocolNumber(applicationEvaluationResponse.getProtocolNumber());
|
||||||
|
response.setCallName(applicationEvaluationResponse.getCallName());
|
||||||
|
response.setMotivation(applicationEvaluationResponse.getMotivation());
|
||||||
|
response.setSubmissionDate(applicationEvaluationResponse.getSubmissionDate());
|
||||||
|
response.setEvaluationEndDate(applicationEvaluationResponse.getEvaluationEndDate());
|
||||||
|
response.setCallEndDate(applicationEvaluationResponse.getCallEndDate());
|
||||||
|
response.setCompanyName(applicationEvaluationResponse.getCompanyName());
|
||||||
|
response.setAssignedAt(applicationEvaluationResponse.getAssignedAt());
|
||||||
|
response.setNdg(applicationEvaluationResponse.getNdg());
|
||||||
|
response.setAppointmentId(applicationEvaluationResponse.getAppointmentId());
|
||||||
|
response.setAmountRequested(applicationEvaluationResponse.getAmountRequested());
|
||||||
|
response.setAmountAccepted(applicationEvaluationResponse.getAmountAccepted());
|
||||||
|
response.setDateAccepted(applicationEvaluationResponse.getDateAccepted());
|
||||||
|
response.setDateRejected(applicationEvaluationResponse.getDateRejected());
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationEvaluationFormResponse getApplicationEvaluationForm(HttpServletRequest request, Long applicationId, Long assignedApplicationId ){
|
||||||
|
|
||||||
|
if (applicationId == null && assignedApplicationId == null) {
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.EITHER_APPLICATION_ID_OR_ASSIGNED_APPLICATION_ID_MUST_BE_PROVIDED));
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationEvaluationEntity evaluationEntity = applicationEvaluationRepository.findByApplicationIdAndAssignedApplicationId(applicationId, assignedApplicationId);
|
||||||
|
|
||||||
|
return (evaluationEntity != null) ? processEvaluationForm(evaluationEntity) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplicationEvaluationFormResponse processEvaluationForm(ApplicationEvaluationEntity evaluationEntity){
|
||||||
|
|
||||||
|
Object convertedResponse = convertToResponse(evaluationEntity);
|
||||||
|
|
||||||
|
ApplicationEvaluationFormResponse response = objectMapper.convertValue(convertedResponse, ApplicationEvaluationFormResponse.class);
|
||||||
|
EvaluationFormEntity evaluationFormEntity = evaluationFormRepository.findByCallIdAndIsDeletedFalse(evaluationEntity.getAssignedApplicationsEntity().getApplication().getCall().getId());
|
||||||
|
|
||||||
|
if (evaluationFormEntity != null) {
|
||||||
|
response.setApplicationEvaluationFormResponse(convertEvaluationFormToResponse(evaluationFormEntity, evaluationEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplicationEvaluationFormResponseBean convertEvaluationFormToResponse(EvaluationFormEntity evaluationForm, ApplicationEvaluationEntity applicationEvaluationEntity) {
|
||||||
|
ApplicationEvaluationFormResponseBean applicationEvaluationFormResponseBean = createEvaluationFormResponse(evaluationForm);
|
||||||
|
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = applicationEvaluationFormRepository.findByEvaluationIdAndEvaluationFormId(applicationEvaluationEntity.getId(), evaluationForm.getId());
|
||||||
|
|
||||||
|
if(applicationEvaluationFormEntity!=null) {
|
||||||
|
List<ApplicationEvaluationFormFieldEntity> applicationEvaluationFormFieldEntities = applicationEvaluationFormFieldRepository.findByApplicationEvaluationFormId(applicationEvaluationFormEntity.getId());
|
||||||
|
List<ApplicationEvaluationFormFieldReponseBean> evaluationFormFieldResponseBeans = createEvaluationFormFieldResponse(applicationEvaluationFormFieldEntities, applicationEvaluationFormEntity);
|
||||||
|
applicationEvaluationFormResponseBean.setFormFields(evaluationFormFieldResponseBeans);
|
||||||
|
}
|
||||||
|
|
||||||
|
return applicationEvaluationFormResponseBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplicationEvaluationFormResponseBean createEvaluationFormResponse(EvaluationFormEntity evaluationFormEntity) {
|
||||||
|
ApplicationEvaluationFormResponseBean evaluationFormResponseBean = new ApplicationEvaluationFormResponseBean();
|
||||||
|
evaluationFormResponseBean.setId(evaluationFormEntity.getId());
|
||||||
|
evaluationFormResponseBean.setLabel(evaluationFormEntity.getLabel());
|
||||||
|
evaluationFormResponseBean.setCallId(evaluationFormEntity.getCall().getId());
|
||||||
|
evaluationFormResponseBean.setContent(evaluationFormDao.convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity).getContent());
|
||||||
|
return evaluationFormResponseBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId){
|
||||||
|
|
||||||
|
log.info("Fetching application evaluation version with ID: {}", applicationId);
|
||||||
|
|
||||||
|
ApplicationEntity applicationEntity = applicationService.validateApplication(applicationId);
|
||||||
|
return buildApplicationEvaluationVersionResponse(applicationEntity);
|
||||||
|
|
||||||
|
}
|
||||||
|
private ApplicationEvaluationVersionResponse buildApplicationEvaluationVersionResponse(ApplicationEntity applicationEntity) {
|
||||||
|
ApplicationEvaluationVersionResponse response = new ApplicationEvaluationVersionResponse();
|
||||||
|
response.setApplicationId(applicationEntity.getId());
|
||||||
|
response.setCallId(applicationEntity.getCall().getId());
|
||||||
|
response.setCompanyId(applicationEntity.getCompanyId());
|
||||||
|
response.setEvaluationVersion(EvaluationVersionEnum.valueOf(applicationEntity.getEvaluationVersion()));
|
||||||
|
response.setEvaluationId(applicationEntity.getApplicationEvaluationId());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApplicationEvaluationRequest convertToApplicationEvaluationRequest(ApplicationEvaluationFormRequestBean formRequestBean) {
|
||||||
|
ApplicationEvaluationRequest request = new ApplicationEvaluationRequest();
|
||||||
|
request.setFiles(formRequestBean.getFiles());
|
||||||
|
request.setEvaluationDocument(formRequestBean.getEvaluationDocument());
|
||||||
|
request.setAmendmentDetails(formRequestBean.getAmendmentDetails());
|
||||||
|
request.setNote(formRequestBean.getNote());
|
||||||
|
request.setApplicationStatus(formRequestBean.getApplicationStatus());
|
||||||
|
request.setMotivation(formRequestBean.getMotivation());
|
||||||
|
request.setAmountAccepted(formRequestBean.getAmountAccepted());
|
||||||
|
|
||||||
|
request.setCriteria(null);
|
||||||
|
request.setChecklist(null);
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
|||||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
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.ApplicationResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
@@ -37,6 +42,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -81,8 +87,13 @@ public class AssignedApplicationsDao {
|
|||||||
log.info("Assigning application to pre-Instructor with details: {}", applicationId, userId);
|
log.info("Assigning application to pre-Instructor with details: {}", applicationId, userId);
|
||||||
|
|
||||||
AssignedApplicationsEntity assignedApplications = assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationId).orElse(null);
|
AssignedApplicationsEntity assignedApplications = assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationId).orElse(null);
|
||||||
if (assignedApplications != null) {
|
if (assignedApplications != null && assignedApplications.getUserId().equals(userId)) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_ALREADY_ASSIGNED));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_ALREADY_ASSIGNED));
|
||||||
|
} else if(assignedApplications != null) {
|
||||||
|
assignedApplications = reassignApplication(userId, assignedByUser, assignedApplications);
|
||||||
|
AssignedApplicationsResponse assignApplicationToInstructorResponse = convertEntityToResponse(assignedApplications);
|
||||||
|
log.info("Application re-assigned succesfully {}", assignApplicationToInstructorResponse);
|
||||||
|
return assignApplicationToInstructorResponse;
|
||||||
}
|
}
|
||||||
ApplicationEntity application = applicationService.validateApplication(applicationId);
|
ApplicationEntity application = applicationService.validateApplication(applicationId);
|
||||||
|
|
||||||
@@ -108,15 +119,37 @@ public class AssignedApplicationsDao {
|
|||||||
return assignApplicationToInstructorResponse;
|
return assignApplicationToInstructorResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AssignedApplicationsEntity reassignApplication(Long userId, UserEntity assignedByUser,
|
||||||
|
AssignedApplicationsEntity assignedApplication) {
|
||||||
|
|
||||||
|
AssignedApplicationsEntity oldAssignedApplicationEntity = Utils.getClonedEntityForData(assignedApplication);
|
||||||
|
|
||||||
|
setIfUpdated(assignedApplication::getAssignedBy, assignedApplication::setAssignedBy, assignedByUser.getId());
|
||||||
|
setIfUpdated(assignedApplication::getUserId, assignedApplication::setUserId, userId);
|
||||||
|
assignedApplication.setAssignedAt(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
|
assignedApplication.setStatus(AssignedApplicationEnum.AWAITING.getValue());
|
||||||
|
Optional<ApplicationEvaluationEntity> entityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplication.getId());
|
||||||
|
if(entityOptional.isPresent()) {
|
||||||
|
ApplicationEvaluationEntity oldApplicationEvaluationEntity = Utils.getClonedEntityForData(entityOptional.get());
|
||||||
|
setIfUpdated(entityOptional.get()::getUserId, entityOptional.get()::setUserId, userId);
|
||||||
|
applicationEvaluationRepository.save(entityOptional.get());
|
||||||
|
/** This code is responsible for adding a version history log for the "Create Application" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationEvaluationEntity).newData(entityOptional.get()).build());
|
||||||
|
|
||||||
|
};
|
||||||
|
assignedApplication = assignedApplicationsRepository.save(assignedApplication);
|
||||||
|
/** This code is responsible for adding a version history log for the "Create Application" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldAssignedApplicationEntity).newData(assignedApplication).build());
|
||||||
|
|
||||||
|
return assignedApplication;
|
||||||
|
}
|
||||||
|
|
||||||
public AssignedApplicationsEntity createAssignmentEntity(ApplicationEntity application, Long userId, UserEntity assignedByUser, AssignedApplicationsRequest assignedApplicationsRequest) {
|
public AssignedApplicationsEntity createAssignmentEntity(ApplicationEntity application, Long userId, UserEntity assignedByUser, AssignedApplicationsRequest assignedApplicationsRequest) {
|
||||||
AssignedApplicationsEntity assignApplication = new AssignedApplicationsEntity();
|
AssignedApplicationsEntity assignApplication = new AssignedApplicationsEntity();
|
||||||
assignApplication.setApplication(application);
|
assignApplication.setApplication(application);
|
||||||
assignApplication.setAssignedBy(assignedByUser.getId());
|
assignApplication.setAssignedBy(assignedByUser.getId());
|
||||||
assignApplication.setUserId(userId);
|
assignApplication.setUserId(userId);
|
||||||
assignApplication.setStatus(AssignedApplicationEnum.OPEN.getValue());
|
assignApplication.setStatus(AssignedApplicationEnum.AWAITING.getValue());
|
||||||
if (assignedApplicationsRequest.getStatus() != null) {
|
|
||||||
assignApplication.setStatus(assignedApplicationsRequest.getStatus().getValue());
|
|
||||||
}
|
|
||||||
assignApplication.setNote(assignedApplicationsRequest.getNote());
|
assignApplication.setNote(assignedApplicationsRequest.getNote());
|
||||||
assignApplication.setIsDeleted(false);
|
assignApplication.setIsDeleted(false);
|
||||||
assignApplication.setAssignedAt(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
assignApplication.setAssignedAt(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
@@ -175,9 +208,12 @@ public class AssignedApplicationsDao {
|
|||||||
assignedApplicationsResponse.setSubmissionDate(submissionDate);
|
assignedApplicationsResponse.setSubmissionDate(submissionDate);
|
||||||
assignedApplicationsResponse.setCallEndDate(callEndDate);
|
assignedApplicationsResponse.setCallEndDate(callEndDate);
|
||||||
assignedApplicationsResponse.setCallStartDate(callStartDate);
|
assignedApplicationsResponse.setCallStartDate(callStartDate);
|
||||||
|
assignedApplicationsResponse.setEvaluationVersion(EvaluationVersionEnum.valueOf(application.getCall().getEvaluationVersion()));
|
||||||
if(applicationEvaluationEntity.isPresent()){
|
if(applicationEvaluationEntity.isPresent()){
|
||||||
assignedApplicationsResponse.setEvaluationEndDate(applicationEvaluationEntity.get().getEndDate());
|
assignedApplicationsResponse.setEvaluationEndDate(applicationEvaluationEntity.get().getEndDate());
|
||||||
}
|
}
|
||||||
|
assignedApplicationsResponse.setNumberOfCheck(application.getCall().getNumberOfCheck());
|
||||||
|
assignedApplicationsResponse.setProductId(application.getCall().getProductId());
|
||||||
return assignedApplicationsResponse;
|
return assignedApplicationsResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +233,7 @@ public class AssignedApplicationsDao {
|
|||||||
log.info("Assigned Application deleted with ID: {}", id);
|
log.info("Assigned Application deleted with ID: {}", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AssignedApplicationsResponse> getAllAssignedApplications(HttpServletRequest request, Long userId) {
|
public List<AssignedApplicationsResponse> getAllAssignedApplications(HttpServletRequest request, Long userId,List<AssignedApplicationEnum> statusList) {
|
||||||
UserEntity user = validator.validateUser(request);
|
UserEntity user = validator.validateUser(request);
|
||||||
if(validator.checkIsPreInstructor() && userId == null) {
|
if(validator.checkIsPreInstructor() && userId == null) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.USER_ID_NOT_NULL_MSG));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.USER_ID_NOT_NULL_MSG));
|
||||||
@@ -205,18 +241,24 @@ public class AssignedApplicationsDao {
|
|||||||
if(userId != null) {
|
if(userId != null) {
|
||||||
validator.validatePreInstructor(request, userId);
|
validator.validatePreInstructor(request, userId);
|
||||||
}
|
}
|
||||||
Specification<AssignedApplicationsEntity> spec = search(user.getHub().getId() ,userId);
|
Specification<AssignedApplicationsEntity> spec = search(user.getHub().getId() ,userId,statusList);
|
||||||
List<AssignedApplicationsEntity> assignedApplicationsEntityList = assignedApplicationsRepository.findAll(spec);
|
List<AssignedApplicationsEntity> assignedApplicationsEntityList = assignedApplicationsRepository.findAll(spec);
|
||||||
return assignedApplicationsEntityList.stream()
|
return assignedApplicationsEntityList.stream()
|
||||||
.map(entity -> convertEntityToResponse(entity))
|
.map(entity -> convertEntityToResponse(entity))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
private Specification<AssignedApplicationsEntity> search(Long hubId, Long userId) {
|
private Specification<AssignedApplicationsEntity> search(Long hubId, Long userId,List<AssignedApplicationEnum> statusList) {
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
Predicate predicate = builder.isFalse(root.get("isDeleted"));
|
Predicate predicate = builder.isFalse(root.get("isDeleted"));
|
||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
predicate = builder.and(predicate, builder.equal(root.get("userId"), userId));
|
predicate = builder.and(predicate, builder.equal(root.get("userId"), userId));
|
||||||
}
|
}
|
||||||
|
if (statusList != null && !statusList.isEmpty()) {
|
||||||
|
List<String> statusNames = statusList.stream()
|
||||||
|
.map(Enum::name)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
predicate = builder.and(predicate, root.get("status").in(statusNames));
|
||||||
|
}
|
||||||
query.orderBy(
|
query.orderBy(
|
||||||
builder.desc(builder.isNotNull(root.get(GepafinConstant.ASSIGNED_AT))),
|
builder.desc(builder.isNotNull(root.get(GepafinConstant.ASSIGNED_AT))),
|
||||||
builder.desc(root.get(GepafinConstant.ASSIGNED_AT))
|
builder.desc(root.get(GepafinConstant.ASSIGNED_AT))
|
||||||
@@ -370,5 +412,14 @@ public class AssignedApplicationsDao {
|
|||||||
return predicates;
|
return predicates;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status) {
|
||||||
|
|
||||||
|
AssignedApplicationsEntity assignedApplication = validateAssignedApplication(assignedApplicationId);
|
||||||
|
validator.validatePreInstructor(request, assignedApplication.getUserId());
|
||||||
|
|
||||||
|
AssignedApplicationsEntity oldAssignedApplicationEntity = Utils.getClonedEntityForData(assignedApplication);
|
||||||
|
assignedApplication.setStatus(status.getValue());
|
||||||
|
AssignedApplicationsEntity updatedAssignment = saveAssignedApplication(assignedApplication, oldAssignedApplicationEntity, VersionActionTypeEnum.UPDATE);
|
||||||
|
return convertEntityToResponse(updatedAssignment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,9 @@ public class CallDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private NotificationTypeRepository notificationTypeRepository;
|
private NotificationTypeRepository notificationTypeRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EvaluationFormDao evalualtionFormDao;
|
||||||
|
|
||||||
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, UserEntity userEntity) {
|
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, UserEntity userEntity) {
|
||||||
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
||||||
CallEntity callEntity = convertToCallEntity(createCallRequest, userEntity);
|
CallEntity callEntity = convertToCallEntity(createCallRequest, userEntity);
|
||||||
@@ -178,6 +181,7 @@ public class CallDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
callEntity.setStatus(CallStatusEnum.DRAFT.getValue());
|
callEntity.setStatus(CallStatusEnum.DRAFT.getValue());
|
||||||
|
callEntity.setEvaluationVersion(createCallRequest.getEvaluationVersion().getValue());
|
||||||
callEntity.setAmountMax(createCallRequest.getAmountMax());
|
callEntity.setAmountMax(createCallRequest.getAmountMax());
|
||||||
callEntity.setAmount(createCallRequest.getAmount());
|
callEntity.setAmount(createCallRequest.getAmount());
|
||||||
callEntity.setConfidi(false);
|
callEntity.setConfidi(false);
|
||||||
@@ -197,6 +201,8 @@ public class CallDao {
|
|||||||
callEntity.setStartTime(DateTimeUtil.parseTime(createCallRequest.getStartTime()));
|
callEntity.setStartTime(DateTimeUtil.parseTime(createCallRequest.getStartTime()));
|
||||||
callEntity.setEndTime(DateTimeUtil.parseTime(createCallRequest.getEndTime()));
|
callEntity.setEndTime(DateTimeUtil.parseTime(createCallRequest.getEndTime()));
|
||||||
callEntity.setHub(userEntity.getHub());
|
callEntity.setHub(userEntity.getHub());
|
||||||
|
callEntity.setNumberOfCheck(createCallRequest.getNumberOfCheck());
|
||||||
|
callEntity.setProductId(createCallRequest.getProductId());
|
||||||
callEntity = callRepository.save(callEntity);
|
callEntity = callRepository.save(callEntity);
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for the "Create Call" operation. **/
|
/** This code is responsible for adding a version history log for the "Create Call" operation. **/
|
||||||
@@ -362,6 +368,7 @@ public class CallDao {
|
|||||||
createCallResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
createCallResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
||||||
createCallResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
createCallResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
||||||
createCallResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
createCallResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
||||||
|
createCallResponseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(callEntity.getEvaluationVersion()));
|
||||||
createCallResponseBean.setRegionId(callEntity.getRegion().getId());
|
createCallResponseBean.setRegionId(callEntity.getRegion().getId());
|
||||||
createCallResponseBean.setAmount(callEntity.getAmount());
|
createCallResponseBean.setAmount(callEntity.getAmount());
|
||||||
createCallResponseBean.setAmountMax(callEntity.getAmountMax());
|
createCallResponseBean.setAmountMax(callEntity.getAmountMax());
|
||||||
@@ -601,6 +608,9 @@ public class CallDao {
|
|||||||
setIfUpdated(callEntity::getStartTime, callEntity::setStartTime, DateTimeUtil.parseTime(updateCallRequest.getStartTime()));
|
setIfUpdated(callEntity::getStartTime, callEntity::setStartTime, DateTimeUtil.parseTime(updateCallRequest.getStartTime()));
|
||||||
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
|
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
|
||||||
setIfUpdated(callEntity::getConfidi, callEntity::setConfidi, updateCallRequest.getConfidi());
|
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());
|
||||||
callEntity = callRepository.save(callEntity);
|
callEntity = callRepository.save(callEntity);
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for the "update call step 1" operation **/
|
/** This code is responsible for adding a version history log for the "update call step 1" operation **/
|
||||||
@@ -691,6 +701,7 @@ public class CallDao {
|
|||||||
callDetailsResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
callDetailsResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
||||||
callDetailsResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
callDetailsResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
||||||
callDetailsResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
callDetailsResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
||||||
|
callDetailsResponseBean.setEvaluationVersion(EvaluationVersionEnum.valueOf(callEntity.getEvaluationVersion()));
|
||||||
callDetailsResponseBean.setRegionId(callEntity.getRegion().getId());
|
callDetailsResponseBean.setRegionId(callEntity.getRegion().getId());
|
||||||
callDetailsResponseBean.setAmount(callEntity.getAmount());
|
callDetailsResponseBean.setAmount(callEntity.getAmount());
|
||||||
callDetailsResponseBean.setAmountMax(callEntity.getAmountMax());
|
callDetailsResponseBean.setAmountMax(callEntity.getAmountMax());
|
||||||
@@ -706,7 +717,8 @@ public class CallDao {
|
|||||||
callDetailsResponseBean.setPhoneNumber(callEntity.getPhoneNumber());
|
callDetailsResponseBean.setPhoneNumber(callEntity.getPhoneNumber());
|
||||||
callDetailsResponseBean.setCreatedDate(callEntity.getCreatedDate());
|
callDetailsResponseBean.setCreatedDate(callEntity.getCreatedDate());
|
||||||
callDetailsResponseBean.setUpdatedDate(callEntity.getUpdatedDate());
|
callDetailsResponseBean.setUpdatedDate(callEntity.getUpdatedDate());
|
||||||
|
callDetailsResponseBean.setNumberOfCheck(callEntity.getNumberOfCheck());
|
||||||
|
callDetailsResponseBean.setProductId(callEntity.getProductId());
|
||||||
return callDetailsResponseBean;
|
return callDetailsResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -730,6 +742,8 @@ public class CallDao {
|
|||||||
createCallResponseBean.setFaq(faqService.getFaqByCallId(callEntity.getId()));
|
createCallResponseBean.setFaq(faqService.getFaqByCallId(callEntity.getId()));
|
||||||
createCallResponseBean.setAimedTo(amiedTo);
|
createCallResponseBean.setAimedTo(amiedTo);
|
||||||
createCallResponseBean.setCheckList(checkList);
|
createCallResponseBean.setCheckList(checkList);
|
||||||
|
createCallResponseBean.setNumberOfCheck(callEntity.getNumberOfCheck());
|
||||||
|
createCallResponseBean.setProductId(callEntity.getProductId());
|
||||||
return createCallResponseBean;
|
return createCallResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -811,7 +825,8 @@ public class CallDao {
|
|||||||
CallResponse callResponseBean = getCallResponseBean(callEntity);
|
CallResponse callResponseBean = getCallResponseBean(callEntity);
|
||||||
FlowResponseBean flowResponseBean = flowDao.getFlowByCallId(callEntity.getId());
|
FlowResponseBean flowResponseBean = flowDao.getFlowByCallId(callEntity.getId());
|
||||||
List<FormResponseBean> formResponseBean = formDao.getFormsByCallId(callEntity);
|
List<FormResponseBean> formResponseBean = formDao.getFormsByCallId(callEntity);
|
||||||
CallValidatorServiceImpl.validateResponse(callResponseBean,flowResponseBean,formResponseBean);
|
EvaluationFormResponseBean evaluationFormResponseBean = evalualtionFormDao.getEvaluationFormByCallId(callEntity);
|
||||||
|
CallValidatorServiceImpl.validateResponse(callResponseBean,flowResponseBean,formResponseBean,evaluationFormResponseBean);
|
||||||
callEntity.setStatus(CallStatusEnum.READY_TO_PUBLISH.getValue());
|
callEntity.setStatus(CallStatusEnum.READY_TO_PUBLISH.getValue());
|
||||||
callEntity = callRepository.save(callEntity);
|
callEntity = callRepository.save(callEntity);
|
||||||
|
|
||||||
@@ -1063,4 +1078,15 @@ public class CallDao {
|
|||||||
return predicates;
|
return predicates;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CallResponse createCallStep2EvaluationV2(CallEntity callEntity, CreateCallRequestStep2EvaluationV2 createCallRequest, UserEntity user) {
|
||||||
|
|
||||||
|
convertToDocumentEntities(createCallRequest.getDocs(), callEntity.getId(), DocumentTypeEnum.DOCUMENT);
|
||||||
|
|
||||||
|
convertToDocumentEntities(createCallRequest.getImages(), callEntity.getId(), DocumentTypeEnum.IMAGES);
|
||||||
|
|
||||||
|
CallResponse createCallResponseBean = getCallResponseBean(callEntity);
|
||||||
|
createCallResponseBean.setCurrentStep(GepafinConstant.EVALUATION_V2_STEP_2);
|
||||||
|
return createCallResponseBean;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,10 +122,40 @@ public class CompanyDao {
|
|||||||
userWithCompanyEntity.setPec(companyRequest.getPec());
|
userWithCompanyEntity.setPec(companyRequest.getPec());
|
||||||
userWithCompanyEntity.setContactName(companyRequest.getContactName());
|
userWithCompanyEntity.setContactName(companyRequest.getContactName());
|
||||||
userWithCompanyEntity.setContactEmail(companyRequest.getContactEmail());
|
userWithCompanyEntity.setContactEmail(companyRequest.getContactEmail());
|
||||||
userWithCompanyEntity.setJson(Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) );
|
|
||||||
UserWithCompanyEntity userWithCompany = userWithCompanyRepository.save(userWithCompanyEntity);
|
UserWithCompanyEntity userWithCompany = userWithCompanyRepository.save(userWithCompanyEntity);
|
||||||
/** This code is responsible for adding a version history log for the "adding user with company" operation. **/
|
/** 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());
|
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;
|
return userWithCompany;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,6 +173,7 @@ public class CompanyDao {
|
|||||||
entity.setNumberOfEmployees(request.getNumberOfEmployees());
|
entity.setNumberOfEmployees(request.getNumberOfEmployees());
|
||||||
entity.setAnnualRevenue(request.getAnnualRevenue());
|
entity.setAnnualRevenue(request.getAnnualRevenue());
|
||||||
entity.setHub(userEntity.getHub());
|
entity.setHub(userEntity.getHub());
|
||||||
|
entity.setJson(Utils.convertMapIntoJsonString(request.getVatCheckResponse()));
|
||||||
if (request.getVatCheckResponse() != null) {
|
if (request.getVatCheckResponse() != null) {
|
||||||
Map<String, Object> vatCheckResponse = request.getVatCheckResponse();
|
Map<String, Object> vatCheckResponse = request.getVatCheckResponse();
|
||||||
Map<String, Object> data = (Map<String, Object>) vatCheckResponse.get("data");
|
Map<String, Object> data = (Map<String, Object>) vatCheckResponse.get("data");
|
||||||
@@ -226,12 +257,12 @@ public class CompanyDao {
|
|||||||
UserWithCompanyEntity userWithCompanyEntity = getUserWithCompany(userEntity.getId(), companyId);
|
UserWithCompanyEntity userWithCompanyEntity = getUserWithCompany(userEntity.getId(), companyId);
|
||||||
//cloned entity for old data
|
//cloned entity for old data
|
||||||
UserWithCompanyEntity oldUserWithCompanyData = Utils.getClonedEntityForData(userWithCompanyEntity);
|
UserWithCompanyEntity oldUserWithCompanyData = Utils.getClonedEntityForData(userWithCompanyEntity);
|
||||||
if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
|
// if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
|
||||||
String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null;
|
// String responseJson = companyRequest.getVatCheckResponse() != null ? Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()) : null;
|
||||||
setIfUpdated(userWithCompanyEntity::getJson, userWithCompanyEntity::setJson, responseJson);
|
// setIfUpdated(companyEntity::getJson, companyEntity::setJson, responseJson);
|
||||||
}
|
// }
|
||||||
setIfUpdated(userWithCompanyEntity::getPec, userWithCompanyEntity::setPec, userWithCompanyEntity.getPec());
|
setIfUpdated(userWithCompanyEntity::getPec, userWithCompanyEntity::setPec, companyRequest.getPec());
|
||||||
setIfUpdated(userWithCompanyEntity::getEmail, userWithCompanyEntity::setEmail, userWithCompanyEntity.getEmail());
|
setIfUpdated(userWithCompanyEntity::getEmail, userWithCompanyEntity::setEmail, companyRequest.getEmail());
|
||||||
setIfUpdated(userWithCompanyEntity::getContactName, userWithCompanyEntity::setContactName, companyRequest.getContactName());
|
setIfUpdated(userWithCompanyEntity::getContactName, userWithCompanyEntity::setContactName, companyRequest.getContactName());
|
||||||
setIfUpdated(userWithCompanyEntity::getContactEmail, userWithCompanyEntity::setContactEmail, companyRequest.getContactEmail());
|
setIfUpdated(userWithCompanyEntity::getContactEmail, userWithCompanyEntity::setContactEmail, companyRequest.getContactEmail());
|
||||||
setIfUpdated(userWithCompanyEntity::getIsLegalRepresentant, userWithCompanyEntity::setIsLegalRepresentant, companyRequest.getIsLegalRepresentant());
|
setIfUpdated(userWithCompanyEntity::getIsLegalRepresentant, userWithCompanyEntity::setIsLegalRepresentant, companyRequest.getIsLegalRepresentant());
|
||||||
|
|||||||
@@ -1,35 +1,33 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserActionEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
|
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
|
||||||
import net.gepafin.tendermanagement.entities.*;
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.*;
|
||||||
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
|
||||||
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
|
||||||
import net.gepafin.tendermanagement.model.response.Widget1;
|
|
||||||
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
|
||||||
import net.gepafin.tendermanagement.repositories.*;
|
import net.gepafin.tendermanagement.repositories.*;
|
||||||
import net.gepafin.tendermanagement.service.CompanyService;
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@@ -57,13 +55,18 @@ public class DashboardDao {
|
|||||||
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserActionsRepository userActionsRepository;
|
private ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AssignedApplicationsRepository assignedApplicationsRepository;
|
||||||
|
@Autowired
|
||||||
|
private Validator validator;
|
||||||
|
|
||||||
public SuperAdminWidgetResponseBean getDashboardWidget(UserEntity requestedUserEntity) {
|
public SuperAdminWidgetResponseBean getDashboardWidget(UserEntity requestedUserEntity) {
|
||||||
SuperAdminWidgetResponseBean widgetResponseBean = new SuperAdminWidgetResponseBean();
|
SuperAdminWidgetResponseBean widgetResponseBean = new SuperAdminWidgetResponseBean();
|
||||||
widgetResponseBean.setWidget1(createWidget1(requestedUserEntity));
|
widgetResponseBean.setWidget1(createWidget1(requestedUserEntity));
|
||||||
Map<String, Object> widgetBars =getStatistics(requestedUserEntity);
|
Map<String, Object> widgetBars = getStatistics(requestedUserEntity);
|
||||||
widgetResponseBean.setWidgetBars(widgetBars);
|
widgetResponseBean.setWidgetBars(widgetBars);
|
||||||
return widgetResponseBean;
|
return widgetResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,8 +79,8 @@ public class DashboardDao {
|
|||||||
setSubmittedApplications(widget1, requestedUserEntity);
|
setSubmittedApplications(widget1, requestedUserEntity);
|
||||||
setDraftApplications(widget1, requestedUserEntity);
|
setDraftApplications(widget1, requestedUserEntity);
|
||||||
setNumberOfCompanies(widget1, requestedUserEntity);
|
setNumberOfCompanies(widget1, requestedUserEntity);
|
||||||
setAmountRequested(widget1,requestedUserEntity);
|
setAmountRequested(widget1, requestedUserEntity);
|
||||||
setAmountAccepted(widget1,requestedUserEntity);
|
setAmountAccepted(widget1, requestedUserEntity);
|
||||||
return widget1;
|
return widget1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +198,8 @@ public class DashboardDao {
|
|||||||
|
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
// public Page<UserActionEntity> getUserAction(UserEntity requestedUserEntity){
|
|
||||||
|
// public Page<UserActionEntity> getUserAction(UserEntity requestedUserEntity){
|
||||||
// Pageable pageable = PageRequest.of(0, 20); // Get the first 20 records
|
// Pageable pageable = PageRequest.of(0, 20); // Get the first 20 records
|
||||||
// List<String> roles=List.of(RoleStatusEnum.ROLE_PRE_INSTRUCTOR.getValue(),RoleStatusEnum.ROLE_GEPAFIN_OPERATOR.getValue(),RoleStatusEnum.ROLE_INSTRUCTOR_MANAGER.getValue());
|
// List<String> roles=List.of(RoleStatusEnum.ROLE_PRE_INSTRUCTOR.getValue(),RoleStatusEnum.ROLE_GEPAFIN_OPERATOR.getValue(),RoleStatusEnum.ROLE_INSTRUCTOR_MANAGER.getValue());
|
||||||
// Page<UserActionEntity> userActionEntities=userActionsRepository.findActionsByRoleNamesAndHubId(roles,requestedUserEntity.getHub().getId(),pageable);
|
// Page<UserActionEntity> userActionEntities=userActionsRepository.findActionsByRoleNamesAndHubId(roles,requestedUserEntity.getHub().getId(),pageable);
|
||||||
@@ -250,14 +254,15 @@ public class DashboardDao {
|
|||||||
|
|
||||||
if (Boolean.FALSE.equals(applicationIds.isEmpty())) {
|
if (Boolean.FALSE.equals(applicationIds.isEmpty())) {
|
||||||
BigDecimal averageTime = applicationEvaluationRepository.findAverageEvaluationTimeByApplicationIds(applicationIds);
|
BigDecimal averageTime = applicationEvaluationRepository.findAverageEvaluationTimeByApplicationIds(applicationIds);
|
||||||
responseBean.setEvaluationAverageTime(averageTime != null ? averageTime : BigDecimal.ZERO);
|
responseBean.setEvaluationAverageTime(averageTime != null ? averageTime.setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
LocalDate twoDaysLater = LocalDate.now().plusDays(2);
|
LocalDate twoDaysLater = LocalDate.now().plusDays(2);
|
||||||
|
List<String> statusList = Arrays.asList(ApplicationEvaluationStatusTypeEnum.OPEN.getValue(), ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue());
|
||||||
Long dueApplications = applicationEvaluationRepository.countDueApplicationsBetween(
|
Long dueApplications = applicationEvaluationRepository.countDueApplicationsBetween(
|
||||||
applicationIds,
|
applicationIds,
|
||||||
LocalDate.now(),
|
LocalDate.now(),
|
||||||
twoDaysLater
|
twoDaysLater,
|
||||||
|
statusList
|
||||||
);
|
);
|
||||||
|
|
||||||
if (dueApplications != null) {
|
if (dueApplications != null) {
|
||||||
@@ -265,5 +270,351 @@ public class DashboardDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AmendmentWidgetResponseBean initializeAmendmentResponseBean() {
|
||||||
|
return AmendmentWidgetResponseBean.builder()
|
||||||
|
.totalAmendments(0L)
|
||||||
|
.waitingForResponseAmendments(0L)
|
||||||
|
.responseReceivedAmendments(0L)
|
||||||
|
.averageResponseDays(BigDecimal.ZERO)
|
||||||
|
.expiringRequestsIn48Hours(0L)
|
||||||
|
.expiredAmendments(0L)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AmendmentWidgetResponseBean getAmendmentDetails(UserEntity userEntity) {
|
||||||
|
AmendmentWidgetResponseBean amendmentWidgetResponseBean = initializeAmendmentResponseBean();
|
||||||
|
|
||||||
|
Long hubId = userEntity.getHub().getId();
|
||||||
|
List<Long> applicationIds = getApplicationIdsForUserOrHub(userEntity, hubId, null);
|
||||||
|
setAmendmentCounts(applicationIds, amendmentWidgetResponseBean, hubId);
|
||||||
|
calculateExpiringRequestsIn48Hours(applicationIds, amendmentWidgetResponseBean, hubId);
|
||||||
|
calculateAverageResponseDays(applicationIds, amendmentWidgetResponseBean, hubId);
|
||||||
|
return amendmentWidgetResponseBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Long> getApplicationIdsForUserOrHub(UserEntity userEntity, Long hubId, Long userId) {
|
||||||
|
if (userId != null) {
|
||||||
|
return assignedApplicationsRepository.findApplicationIdsByUserIdAndIsDeletedFalse(userId);
|
||||||
|
} else if (validator.checkIsPreInstructor()) {
|
||||||
|
return assignedApplicationsRepository.findApplicationIdsByUserIdAndIsDeletedFalse(userEntity.getId());
|
||||||
|
} else {
|
||||||
|
return applicationRepository.findApplicationIdsByHubId(hubId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setAmendmentCounts(List<Long> applicationIds, AmendmentWidgetResponseBean responseBean, Long hubId) {
|
||||||
|
|
||||||
|
Long totalAmendment = applicationAmendmentRequestRepository.countAmendmentsByApplicationIds(applicationIds);
|
||||||
|
if (totalAmendment != null) {
|
||||||
|
responseBean.setTotalAmendments(totalAmendment);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long awaitingAmendments = applicationAmendmentRequestRepository.countAmendmentsByApplicationIdsAndStatus(
|
||||||
|
applicationIds, ApplicationAmendmentRequestEnum.AWAITING.getValue());
|
||||||
|
if (awaitingAmendments != null) {
|
||||||
|
responseBean.setWaitingForResponseAmendments(awaitingAmendments);
|
||||||
|
}
|
||||||
|
Long responseRecievedAmendments = applicationAmendmentRequestRepository.countAmendmentsByApplicationIdsAndStatus(
|
||||||
|
applicationIds, ApplicationAmendmentRequestEnum.RESPONSE_RECEIVED.getValue());
|
||||||
|
if (responseRecievedAmendments != null) {
|
||||||
|
responseBean.setResponseReceivedAmendments(responseRecievedAmendments);
|
||||||
|
}
|
||||||
|
Long expiredAmendments = applicationAmendmentRequestRepository.countAmendmentsByApplicationIdsAndStatus(
|
||||||
|
applicationIds, ApplicationAmendmentRequestEnum.EXPIRED.getValue());
|
||||||
|
if (expiredAmendments != null) {
|
||||||
|
responseBean.setExpiredAmendments(expiredAmendments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calculateExpiringRequestsIn48Hours(List<Long> applicationIds, AmendmentWidgetResponseBean responseBean, Long hubId) {
|
||||||
|
|
||||||
|
// Define the statuses to filter
|
||||||
|
List<String> statuses = List.of(
|
||||||
|
ApplicationAmendmentRequestEnum.AWAITING.getValue(),
|
||||||
|
ApplicationAmendmentRequestEnum.RESPONSE_RECEIVED.getValue()
|
||||||
|
);
|
||||||
|
|
||||||
|
LocalDateTime twoDaysLater = LocalDateTime.now().plusDays(2);
|
||||||
|
|
||||||
|
Long expiringRequestsIn48Hours = applicationAmendmentRequestRepository.countExpiringRequestsIn48Hours(
|
||||||
|
applicationIds,
|
||||||
|
statuses,
|
||||||
|
LocalDateTime.now(),
|
||||||
|
twoDaysLater
|
||||||
|
);
|
||||||
|
|
||||||
|
if (expiringRequestsIn48Hours != null) {
|
||||||
|
responseBean.setExpiringRequestsIn48Hours(expiringRequestsIn48Hours);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calculateAverageResponseDays(List<Long> applicationIds, AmendmentWidgetResponseBean responseBean, Long hubId) {
|
||||||
|
|
||||||
|
if (!applicationIds.isEmpty()) {
|
||||||
|
BigDecimal averageResponseDays = applicationAmendmentRequestRepository
|
||||||
|
.findAverageResponseDaysByApplicationIdsAndStatus(
|
||||||
|
applicationIds,
|
||||||
|
ApplicationAmendmentRequestEnum.CLOSE.getValue()
|
||||||
|
);
|
||||||
|
|
||||||
|
responseBean.setAverageResponseDays(averageResponseDays);
|
||||||
|
} else {
|
||||||
|
responseBean.setAverageResponseDays(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(UserEntity userEntity) {
|
||||||
|
Long userId = userEntity.getId();
|
||||||
|
Long hubId = userEntity.getHub().getId();
|
||||||
|
|
||||||
|
Object[] results;
|
||||||
|
List<Long> applicationIds;
|
||||||
|
if (validator.checkIsPreInstructor()) {
|
||||||
|
results = assignedApplicationsRepository.countAssignedApplicationsWithStatus(userId, hubId);
|
||||||
|
applicationIds = assignedApplicationsRepository.findApplicationIdsByUserIdAndHubIdAndIsDeletedFalse(userId, hubId);
|
||||||
|
} else {
|
||||||
|
results = assignedApplicationsRepository.countAssignedApplicationsForHub(hubId);
|
||||||
|
applicationIds = assignedApplicationsRepository.findApplicationIdsByHubId(hubId);
|
||||||
|
}
|
||||||
|
AssignedApplicationWidgetResponseBean response = convertToResponse(results);
|
||||||
|
calculateEvaluationAvgTimeForAssignedApplication(response, applicationIds);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calculateEvaluationAvgTimeForAssignedApplication(AssignedApplicationWidgetResponseBean response, List<Long> applicationIds) {
|
||||||
|
if (applicationIds == null || applicationIds.isEmpty()) {
|
||||||
|
response.setAverageEvaluationDays(BigDecimal.ZERO);
|
||||||
|
response.setNumberOfApplicationExpiringIn48Hours(0L);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal averageTime = applicationEvaluationRepository.findAverageEvaluationTimeByApplicationIds(applicationIds);
|
||||||
|
response.setAverageEvaluationDays(averageTime != null ? averageTime.setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
|
||||||
|
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
LocalDate twoDaysLater = today.plusDays(2);
|
||||||
|
List<String> statusList = Arrays.asList(ApplicationEvaluationStatusTypeEnum.OPEN.getValue(), ApplicationEvaluationStatusTypeEnum.SOCCORSO.getValue());
|
||||||
|
Long dueApplications = applicationEvaluationRepository.countDueApplicationsBetween(
|
||||||
|
applicationIds, today, twoDaysLater, statusList
|
||||||
|
);
|
||||||
|
response.setNumberOfApplicationExpiringIn48Hours(dueApplications != null ? dueApplications : 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AssignedApplicationWidgetResponseBean convertToResponse(Object[] results) {
|
||||||
|
AssignedApplicationWidgetResponseBean response = new AssignedApplicationWidgetResponseBean();
|
||||||
|
|
||||||
|
Object[] data = (Object[]) results[0];
|
||||||
|
|
||||||
|
response.setNumberOfAssignedApplication(data[0] instanceof Number ? ((Number) data[0]).longValue() : 0L);
|
||||||
|
response.setNumberOfApplicationInAmendmentState(data[1] instanceof Number ? ((Number) data[1]).longValue() : 0L);
|
||||||
|
response.setNumberOfApplicationInOpenState(data[2] instanceof Number ? ((Number) data[2]).longValue() : 0L);
|
||||||
|
response.setNumberOfApplicationInCloseState(data[3] instanceof Number ? ((Number) data[3]).longValue() : 0L);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getStatusList() {
|
||||||
|
return List.of(
|
||||||
|
ApplicationStatusTypeEnum.SUBMIT.getValue(),
|
||||||
|
ApplicationStatusTypeEnum.EVALUATION.getValue(),
|
||||||
|
ApplicationStatusTypeEnum.APPROVED.getValue(),
|
||||||
|
ApplicationStatusTypeEnum.REJECTED.getValue(),
|
||||||
|
ApplicationStatusTypeEnum.SOCCORSO.getValue(),
|
||||||
|
ApplicationStatusTypeEnum.APPOINTMENT.getValue(),
|
||||||
|
ApplicationStatusTypeEnum.NDG.getValue(),
|
||||||
|
ApplicationStatusTypeEnum.ADMISSIBLE.getValue()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeneficiaryStatisticsResponseBean getStatisticsPageForBeneficiary(UserEntity userEntity, CompanyEntity company) {
|
||||||
|
BeneficiaryStatisticsResponseBean widgetResponseBean = initializeBeneficiaryStatisticsBean();
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity = companyService.getUserWithCompany(userEntity.getId(), company.getId());
|
||||||
|
Long hubId = userEntity.getHub().getId();
|
||||||
|
List<String> statusList = getStatusList();
|
||||||
|
Long submittedApplication = applicationRepository.countSubmittedApplicationsByHubIdAndUserId(hubId, userEntity.getId(), userWithCompanyEntity.getId(), statusList);
|
||||||
|
Long approvedApplication = getApplicationCountByStatus(hubId, userEntity.getId(), userWithCompanyEntity.getId(), ApplicationStatusTypeEnum.APPROVED);
|
||||||
|
BigDecimal successRate = getSuccessRate(hubId, userEntity.getId(), userWithCompanyEntity.getId());
|
||||||
|
BigDecimal totalAmountRequested = applicationRepository.sumAmountRequestedByHubIdAndUserId(hubId, userEntity.getId(), userWithCompanyEntity.getId());
|
||||||
|
|
||||||
|
updateApplicationWidget(widgetResponseBean.getApplicationWidget(), submittedApplication, approvedApplication, successRate, totalAmountRequested);
|
||||||
|
|
||||||
|
Map<String, Object> widgetBars = getApplicationStatistics(userEntity, userWithCompanyEntity.getId());
|
||||||
|
widgetResponseBean.setApplicationWidgetBars(widgetBars);
|
||||||
|
return widgetResponseBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BeneficiaryStatisticsResponseBean initializeBeneficiaryStatisticsBean() {
|
||||||
|
return BeneficiaryStatisticsResponseBean.builder()
|
||||||
|
.applicationWidget(ApplicationWidget.builder()
|
||||||
|
.submittedApplication(0L)
|
||||||
|
.approvedApplication(0L)
|
||||||
|
.successRate(BigDecimal.ZERO)
|
||||||
|
.totalAmountFinanced(BigDecimal.ZERO)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Long getApplicationCountByStatus(Long hubId, Long userId, Long userWithCompanyId, ApplicationStatusTypeEnum status) {
|
||||||
|
return applicationRepository.countSubmittedApplicationsByHubIdAndUserIdAndStatus(hubId, userId, userWithCompanyId, status.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal getSuccessRate(Long hubId, Long userId, Long userWithCompanyId) {
|
||||||
|
return applicationRepository.findSuccessRateByHubIdAndUserIdAndUserWithCompanyId(hubId, userId, userWithCompanyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateApplicationWidget(ApplicationWidget applicationWidget, Long submittedApplication, Long approvedApplication, BigDecimal successRate, BigDecimal totalAmountRequested) {
|
||||||
|
applicationWidget.setSubmittedApplication(submittedApplication != null ? submittedApplication : 0L);
|
||||||
|
applicationWidget.setApprovedApplication(approvedApplication != null ? approvedApplication : 0L);
|
||||||
|
applicationWidget.setSuccessRate(successRate != null ? successRate : BigDecimal.ZERO);
|
||||||
|
applicationWidget.setTotalAmountFinanced(totalAmountRequested != null ? totalAmountRequested : BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getApplicationStatistics(UserEntity requestedUser, Long userWithCompanyId) {
|
||||||
|
Map<String, Object> stats = new HashMap<>();
|
||||||
|
|
||||||
|
Map<String, Long> statusData = new HashMap<>();
|
||||||
|
for (ApplicationStatusTypeEnum status : ApplicationStatusTypeEnum.values()) {
|
||||||
|
statusData.put(status.name(), 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get applications per status
|
||||||
|
List<Object[]> applicationsByStatus = applicationRepository.findApplicationsByStatusAndUserIdAndUserWithCompanyId(
|
||||||
|
requestedUser.getHub().getId(),
|
||||||
|
requestedUser.getId(),
|
||||||
|
userWithCompanyId
|
||||||
|
);
|
||||||
|
|
||||||
|
applicationsByStatus.forEach(result -> {
|
||||||
|
String status = (String) result[0];
|
||||||
|
Long count = (Long) result[1];
|
||||||
|
statusData.put(status, count);
|
||||||
|
});
|
||||||
|
|
||||||
|
List<Map<String, Object>> statusList = statusData.entrySet().stream().map(entry -> {
|
||||||
|
Map<String, Object> statusMap = new HashMap<>();
|
||||||
|
statusMap.put(GepafinConstant.STATUS, entry.getKey());
|
||||||
|
statusMap.put(GepafinConstant.NUMBER_OF_APPLICATION, entry.getValue());
|
||||||
|
return statusMap;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
stats.put(GepafinConstant.APPLICATION_PER_STATUS, statusList);
|
||||||
|
|
||||||
|
|
||||||
|
// Requested VS Approved Amounts
|
||||||
|
List<Object[]> requestedVsApprovedAmounts = applicationRepository.findRequestedVsApprovedAmountsPerMonth(
|
||||||
|
requestedUser.getHub().getId(),
|
||||||
|
requestedUser.getId(),
|
||||||
|
userWithCompanyId
|
||||||
|
);
|
||||||
|
|
||||||
|
stats.put(GepafinConstant.REQUESTED_VS_APPROVED_AMOUNTS, requestedVsApprovedAmounts.stream().map(result -> {
|
||||||
|
Map<String, Object> data = new HashMap<>();
|
||||||
|
data.put(GepafinConstant.MONTH, result[0]);
|
||||||
|
data.put(GepafinConstant.TOTAL_REQUESTED, result[1]!= null ? result[1] : 0L);
|
||||||
|
data.put(GepafinConstant.TOTAL_APPROVED, result[2] != null ? result[2] : 0L);
|
||||||
|
return data;
|
||||||
|
}).toList());
|
||||||
|
return stats;
|
||||||
|
}
|
||||||
|
private PreInstructorWidgetResponseBean initializeDashboardPreInstructorResponseBean() {
|
||||||
|
return PreInstructorWidgetResponseBean.builder()
|
||||||
|
.assignedApplication(ApplicationToConsider.builder()
|
||||||
|
.totalAssignedApplication(0L)
|
||||||
|
.additionalApplicationPercentage(BigDecimal.ZERO)
|
||||||
|
.build())
|
||||||
|
.evaluatedApplication(EvaluatedApplication.builder()
|
||||||
|
.evaluatedApplication(0L)
|
||||||
|
.dailyAverage(BigDecimal.ZERO)
|
||||||
|
.build())
|
||||||
|
.averageEvaluationDays(AverageEvaluationTime.builder()
|
||||||
|
.averageEvlauationDaysRating(BigDecimal.ZERO)
|
||||||
|
.timeDifferenceFromAverage(BigDecimal.ZERO)
|
||||||
|
.build())
|
||||||
|
.amendmentInProgress(RescueInstructorInProgress.builder()
|
||||||
|
.totalAmendmentInProgress(0L)
|
||||||
|
.expiringToday(0L)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request, Long userId) {
|
||||||
|
UserEntity userEntity = validator.validateUser(request);
|
||||||
|
if (validator.checkIsPreInstructor() && userId == null) {
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.USER_ID_NOT_NULL_MSG));
|
||||||
|
}
|
||||||
|
if (userId != null) {
|
||||||
|
validator.validatePreInstructor(request, userId);
|
||||||
|
if (validator.checkIsInstructorManager() && !userEntity.getId().equals(userId)) {
|
||||||
|
throw new ForbiddenAccessException(Status.FORBIDDEN,
|
||||||
|
Translator.toLocale(GepafinConstant.PERMISSION_DENIED));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PreInstructorWidgetResponseBean preInstructorWidgetResponseBean = initializeDashboardPreInstructorResponseBean();
|
||||||
|
Long hubId = userEntity.getHub().getId();
|
||||||
|
List<Long> applicationIds = getApplicationIdsForUserOrHub(userEntity, hubId,userId);
|
||||||
|
setPreInstructorWidgets(applicationIds, preInstructorWidgetResponseBean,hubId);
|
||||||
|
calculateAverageEvaluationTime(applicationIds, preInstructorWidgetResponseBean, hubId);
|
||||||
|
return preInstructorWidgetResponseBean;
|
||||||
|
}
|
||||||
|
private void setPreInstructorWidgets(List<Long> applicationIds, PreInstructorWidgetResponseBean responseBean,Long hubId) {
|
||||||
|
List<String> assignedApplicationStatus = Arrays.asList(AssignedApplicationEnum.AWAITING.getValue(), AssignedApplicationEnum.OPEN.getValue());
|
||||||
|
Long totalAssignedApplications = assignedApplicationsRepository.countAssignedApplicationsByApplicationIds(applicationIds,assignedApplicationStatus);
|
||||||
|
if (totalAssignedApplications != null) {
|
||||||
|
responseBean.getAssignedApplication().setTotalAssignedApplication(totalAssignedApplications);
|
||||||
|
}
|
||||||
|
LocalDateTime yesterday = LocalDateTime.now().minusDays(1);
|
||||||
|
|
||||||
|
Long newApplicationsAddedYesterday = assignedApplicationsRepository.countApplicationsAddedYesterdayForHub(applicationIds, hubId, yesterday,assignedApplicationStatus);
|
||||||
|
if (newApplicationsAddedYesterday != null && totalAssignedApplications != null && totalAssignedApplications > 0) {
|
||||||
|
BigDecimal percentageAdded = BigDecimal.valueOf(newApplicationsAddedYesterday)
|
||||||
|
.divide(BigDecimal.valueOf(totalAssignedApplications), 4, RoundingMode.HALF_UP)
|
||||||
|
.multiply(BigDecimal.valueOf(100));
|
||||||
|
responseBean.getAssignedApplication().setAdditionalApplicationPercentage(percentageAdded.setScale(2, RoundingMode.HALF_UP));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> statuses = Arrays.asList(ApplicationStatusTypeEnum.APPROVED.getValue(), ApplicationStatusTypeEnum.REJECTED.getValue());
|
||||||
|
LocalDateTime sevenDaysAgo = LocalDateTime.now().minusDays(7);
|
||||||
|
Long evaluatedApplication = assignedApplicationsRepository.countEvaluatedApplicationsInLast7Days(applicationIds, statuses, sevenDaysAgo);
|
||||||
|
if (evaluatedApplication != null) {
|
||||||
|
responseBean.getEvaluatedApplication().setEvaluatedApplication(evaluatedApplication);
|
||||||
|
|
||||||
|
BigDecimal dailyAverage = assignedApplicationsRepository.countDailyAverageEvaluatedApplicationsInLast7Days(applicationIds, statuses, sevenDaysAgo);
|
||||||
|
if (dailyAverage != null) {
|
||||||
|
responseBean.getEvaluatedApplication().setDailyAverage(dailyAverage.setScale(2, RoundingMode.HALF_UP)); // Rounded to 2 decimal places
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<String> amendmentStatus =Arrays.asList( ApplicationAmendmentRequestEnum.AWAITING.getValue(), ApplicationAmendmentRequestEnum.RESPONSE_RECEIVED.getValue());
|
||||||
|
Long rescueInstructorsInProgress = applicationAmendmentRequestRepository.countAmendmentsByApplicationIds(applicationIds,amendmentStatus);
|
||||||
|
if (rescueInstructorsInProgress != null) {
|
||||||
|
responseBean.getAmendmentInProgress().setTotalAmendmentInProgress(rescueInstructorsInProgress);
|
||||||
|
}
|
||||||
|
calculateExpiringRescueInstructorsToday(applicationIds,responseBean);
|
||||||
|
|
||||||
|
}
|
||||||
|
private void calculateExpiringRescueInstructorsToday(List<Long> applicationIds, PreInstructorWidgetResponseBean responseBean) {
|
||||||
|
List<String> statuses =Arrays.asList( ApplicationAmendmentRequestEnum.AWAITING.getValue(), ApplicationAmendmentRequestEnum.RESPONSE_RECEIVED.getValue());
|
||||||
|
|
||||||
|
LocalDateTime startOfDay = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||||
|
|
||||||
|
LocalDateTime endOfDay = startOfDay.plusDays(1).minusNanos(1);
|
||||||
|
|
||||||
|
Long expiringToday = applicationAmendmentRequestRepository.countAmendmentsExpiringToday(applicationIds, statuses, startOfDay, endOfDay);
|
||||||
|
|
||||||
|
if (expiringToday != null) {
|
||||||
|
responseBean.getAmendmentInProgress().setExpiringToday(expiringToday);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calculateAverageEvaluationTime(List<Long> applicationIds, PreInstructorWidgetResponseBean responseBean, Long hubId) {
|
||||||
|
|
||||||
|
if (Boolean.FALSE.equals(applicationIds.isEmpty())) {
|
||||||
|
BigDecimal averageTime = applicationEvaluationRepository.findAverageEvaluationTimeByApplicationIds(applicationIds);
|
||||||
|
responseBean.getAverageEvaluationDays().setAverageEvlauationDaysRating(
|
||||||
|
averageTime != null ? averageTime.setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP)
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// BigDecimal timeDifference = applicationEvaluationRepository.findTimeDifferenceFromAverage(applicationIds);
|
||||||
|
// responseBean.getAverageEvaluationTime().setTimeDifferenceFromAverage(timeDifference != null ? timeDifference : BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ public class EmailNotificationDao {
|
|||||||
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString());
|
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString());
|
||||||
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(applicationEntity.getProtocol().getCreatedDate()));
|
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(applicationEntity.getProtocol().getCreatedDate()));
|
||||||
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationEntity.getProtocol().getTime(), GepafinConstant.HH_MM_SS));
|
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationEntity.getProtocol().getTime(), GepafinConstant.HH_MM_SS));
|
||||||
bodyPlaceholders.put("{{form_text}}", applicationEvaluationEntity.getNote());
|
bodyPlaceholders.put("{{form_text}}", applicationEvaluationEntity.getMotivation());
|
||||||
|
|
||||||
sendEmail(applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_TEMPLATE, bodyPlaceholders, null,null);
|
sendEmail(applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.INADMISSIBILITY_TEMPLATE, bodyPlaceholders, null,null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,170 @@
|
|||||||
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
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.VersionActionTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ContentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.repositories.*;
|
||||||
|
import net.gepafin.tendermanagement.service.EvaluationCriteriaService;
|
||||||
|
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||||
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class EvaluationFormDao {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EvaluationFormRepository evaluationFormRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallDao callDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VatCheckDao vatCheckDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallRepository callRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Validator validator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CriteriaFormFieldRepository criteriaFormFieldRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EvaluationCriteriaService evaluationCriteriaService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
public EvaluationFormEntity saveEvaluationFormEntity(EvaluationFormEntity evaluationFormEntity){
|
||||||
|
evaluationFormEntity= evaluationFormRepository.save(evaluationFormEntity);
|
||||||
|
return evaluationFormEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EvaluationFormEntity convertEvaluationFormRequestToEvaluationFormEntity(CallEntity callEntity, EvaluationFormRequest formRequest) {
|
||||||
|
|
||||||
|
EvaluationFormEntity evaluationFormEntity = new EvaluationFormEntity();
|
||||||
|
evaluationFormEntity.setCall(callEntity);
|
||||||
|
evaluationFormEntity.setLabel(formRequest.getLabel());
|
||||||
|
evaluationFormEntity.setContent(setContentResponseBean(formRequest.getContent()));
|
||||||
|
evaluationFormEntity.setIsDeleted(false);
|
||||||
|
evaluationFormEntity = saveEvaluationFormEntity(evaluationFormEntity);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Create form" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(evaluationFormEntity).build());
|
||||||
|
|
||||||
|
return evaluationFormEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EvaluationFormResponseBean convertEvaluationFormEntityToEvaluationFormResponseBean(EvaluationFormEntity formEntity) {
|
||||||
|
EvaluationFormResponseBean evaluationFormResponseBean =new EvaluationFormResponseBean();
|
||||||
|
evaluationFormResponseBean.setId(formEntity.getId());
|
||||||
|
evaluationFormResponseBean.setContent(setContent(formEntity));
|
||||||
|
evaluationFormResponseBean.setLabel(formEntity.getLabel());
|
||||||
|
evaluationFormResponseBean.setCallId(formEntity.getCall().getId());
|
||||||
|
evaluationFormResponseBean.setCallStatus(formEntity.getCall().getStatus());
|
||||||
|
return evaluationFormResponseBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ContentResponseBean> setContent(EvaluationFormEntity formEntity) {
|
||||||
|
List<ContentResponseBean> contentList = Utils.convertJsonStringToList(formEntity.getContent(),
|
||||||
|
ContentResponseBean.class);
|
||||||
|
return contentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EvaluationFormResponseBean createEvaluationForm(CallEntity callEntity, EvaluationFormRequest formRequest) {
|
||||||
|
|
||||||
|
validateEvaluationForm(formRequest);
|
||||||
|
EvaluationFormEntity formEntity = convertEvaluationFormRequestToEvaluationFormEntity(callEntity, formRequest);
|
||||||
|
return convertEvaluationFormEntityToEvaluationFormResponseBean(formEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void validateEvaluationForm(EvaluationFormRequest formRequest){
|
||||||
|
if(formRequest.getContent()==null || formRequest.getLabel()==null ){
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.REQUIRED_PARAMETER_NOT_FOUND_FOR_FORM));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public EvaluationFormResponseBean updateEvaluationForm(UserEntity user, Long formId, EvaluationFormRequest formRequest) {
|
||||||
|
EvaluationFormEntity evaluationFormEntity = validateForm(formId);
|
||||||
|
//cloned for old form data
|
||||||
|
EvaluationFormEntity oldFormData = Utils.getClonedEntityForData(evaluationFormEntity);
|
||||||
|
|
||||||
|
Utils.setIfUpdated(evaluationFormEntity::getLabel, evaluationFormEntity::setLabel, formRequest.getLabel());
|
||||||
|
Utils.setIfUpdated(evaluationFormEntity::getContent, evaluationFormEntity::setContent, setContentResponseBean(formRequest.getContent()));
|
||||||
|
evaluationFormEntity.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
|
evaluationFormEntity = saveEvaluationFormEntity(evaluationFormEntity);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Update form data" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldFormData).newData(evaluationFormEntity).build());
|
||||||
|
return convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public EvaluationFormEntity validateForm(Long formId) {
|
||||||
|
EvaluationFormEntity evaluationFormEntity = evaluationFormRepository.findByIdAndIsDeletedFalse(formId);
|
||||||
|
if (evaluationFormEntity == null) {
|
||||||
|
throw new ResourceNotFoundException(
|
||||||
|
Status.NOT_FOUND,
|
||||||
|
Translator.toLocale(GepafinConstant.EVALUATION_FORM_NOT_FOUND)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return evaluationFormEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public EvaluationFormResponseBean getEvaluationFormById(UserEntity user, Long formId) {
|
||||||
|
EvaluationFormEntity evaluationFormEntity = validateForm(formId);
|
||||||
|
validator.validateUserWithCall(user, evaluationFormEntity.getCall().getId());
|
||||||
|
return convertEvaluationFormEntityToEvaluationFormResponseBean(evaluationFormEntity);
|
||||||
|
}
|
||||||
|
public void deleteEvaluationForm(UserEntity user, Long formId){
|
||||||
|
EvaluationFormEntity evaluationFormEntity = validateForm(formId);
|
||||||
|
EvaluationFormEntity clonedData = Utils.getClonedEntityForData(evaluationFormEntity);
|
||||||
|
validator.validateUserWithCall(user, evaluationFormEntity.getCall().getId());
|
||||||
|
evaluationFormEntity.setIsDeleted(Boolean.TRUE);
|
||||||
|
evaluationFormEntity = saveEvaluationFormEntity(evaluationFormEntity);
|
||||||
|
/** This code is responsible for adding a version history log for the "soft deleting evaluation from field" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(clonedData).newData(evaluationFormEntity).build());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public EvaluationFormResponseBean getEvaluationFormByCallId(CallEntity callEntity) {
|
||||||
|
if (callEntity == null) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
|
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND));
|
||||||
|
}
|
||||||
|
|
||||||
|
EvaluationFormEntity formEntity = evaluationFormRepository
|
||||||
|
.findByCallIdAndIsDeletedFalse(callEntity.getId());
|
||||||
|
if(formEntity!=null)
|
||||||
|
return convertEvaluationFormEntityToEvaluationFormResponseBean(formEntity);
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String setContentResponseBean(List<ContentRequestBean> contentRequestBeans){
|
||||||
|
String stringContentRequest = Utils.convertListToJsonString(contentRequestBeans);
|
||||||
|
List<ContentRequestBean> cloneContentRequestBeans = Utils.convertJsonStringToList(stringContentRequest, ContentRequestBean.class);
|
||||||
|
cloneContentRequestBeans.forEach(data->data.setCriteria(null));
|
||||||
|
return Utils.convertListToJsonString(cloneContentRequestBeans);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -305,7 +305,7 @@ public class FlowFormDao {
|
|||||||
Long totalFormSteps = calculateTotalSteps(flowEdgesList);
|
Long totalFormSteps = calculateTotalSteps(flowEdgesList);
|
||||||
Long currentStep = calculateCurrentStep(flowEdgesList, formEntity);
|
Long currentStep = calculateCurrentStep(flowEdgesList, formEntity);
|
||||||
nextOrPreviousFormResponse.setTotalFormSteps(totalFormSteps);
|
nextOrPreviousFormResponse.setTotalFormSteps(totalFormSteps);
|
||||||
completedSteps = getCompletedSteps(applicationEntity);
|
completedSteps = getCompletedSteps(applicationEntity, false);
|
||||||
nextOrPreviousFormResponse.setCompletedSteps(Long.valueOf(completedSteps));
|
nextOrPreviousFormResponse.setCompletedSteps(Long.valueOf(completedSteps));
|
||||||
nextOrPreviousFormResponse.setCurrentStep(currentStep);
|
nextOrPreviousFormResponse.setCurrentStep(currentStep);
|
||||||
if(applicationEntity.getProtocol() != null) {
|
if(applicationEntity.getProtocol() != null) {
|
||||||
@@ -318,13 +318,13 @@ public class FlowFormDao {
|
|||||||
return nextOrPreviousFormResponse;
|
return nextOrPreviousFormResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCompletedSteps(ApplicationEntity applicationEntity) {
|
public Integer getCompletedSteps(ApplicationEntity applicationEntity, Boolean isSendValidationError) {
|
||||||
Integer completedSteps=0;
|
Integer completedSteps=0;
|
||||||
List<ApplicationFormEntity> applicationFormList = applicationFormRepository.findByApplicationId(applicationEntity.getId());
|
List<ApplicationFormEntity> applicationFormList = applicationFormRepository.findByApplicationId(applicationEntity.getId());
|
||||||
List<ApplicationFormFieldEntity> applicationFormFieldEntities=new ArrayList<>();
|
List<ApplicationFormFieldEntity> applicationFormFieldEntities=new ArrayList<>();
|
||||||
for (ApplicationFormEntity applicationFormEntity:applicationFormList){
|
for (ApplicationFormEntity applicationFormEntity:applicationFormList){
|
||||||
applicationFormFieldEntities=applicationFormFieldRepository.findByApplicationFormId(applicationFormEntity.getId());
|
applicationFormFieldEntities=applicationFormFieldRepository.findByApplicationFormId(applicationFormEntity.getId());
|
||||||
Boolean isCompleted=formDao.validateCompletedSteps(applicationFormFieldEntities, applicationEntity, applicationFormEntity.getForm());
|
Boolean isCompleted=formDao.validateCompletedSteps(applicationFormFieldEntities, applicationEntity, applicationFormEntity.getForm(), isSendValidationError);
|
||||||
if(Boolean.TRUE.equals(isCompleted)){
|
if(Boolean.TRUE.equals(isCompleted)){
|
||||||
completedSteps++;
|
completedSteps++;
|
||||||
}
|
}
|
||||||
@@ -361,7 +361,7 @@ public class FlowFormDao {
|
|||||||
FormEntity currentFormEntity = applicationFormList.get(applicationFormList.size() - 1).getForm();
|
FormEntity currentFormEntity = applicationFormList.get(applicationFormList.size() - 1).getForm();
|
||||||
|
|
||||||
for (ApplicationFormEntity applicationFormEntity : applicationFormList) {
|
for (ApplicationFormEntity applicationFormEntity : applicationFormList) {
|
||||||
Boolean isCompleted = formDao.validateCompletedSteps(applicationFormFieldRepository.findByApplicationFormId(applicationFormEntity.getId()), applicationEntity, applicationFormEntity.getForm());
|
Boolean isCompleted = formDao.validateCompletedSteps(applicationFormFieldRepository.findByApplicationFormId(applicationFormEntity.getId()), applicationEntity, applicationFormEntity.getForm(), false);
|
||||||
if (Boolean.FALSE.equals(isCompleted)) {
|
if (Boolean.FALSE.equals(isCompleted)) {
|
||||||
return applicationFormEntity.getForm().getId();
|
return applicationFormEntity.getForm().getId();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.entities.*;
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.response.ContentResponseBean;
|
import net.gepafin.tendermanagement.model.response.ContentResponseBean;
|
||||||
@@ -35,6 +38,8 @@ import java.util.stream.Collectors;
|
|||||||
@Component
|
@Component
|
||||||
public class FormDao {
|
public class FormDao {
|
||||||
|
|
||||||
|
private final Logger log = LoggerFactory.getLogger(FormDao.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FormRepository formRepository;
|
private FormRepository formRepository;
|
||||||
|
|
||||||
@@ -118,6 +123,10 @@ public class FormDao {
|
|||||||
//cloned entity for old call data.
|
//cloned entity for old call data.
|
||||||
CallEntity oldCallData = Utils.getClonedEntityForData(callEntity);
|
CallEntity oldCallData = Utils.getClonedEntityForData(callEntity);
|
||||||
|
|
||||||
|
if(callEntity.getStatus().equals(CallStatusEnum.PUBLISH.getValue())) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
|
Translator.toLocale(GepafinConstant.PUBLISHED_CALL_NOT_UPDATE));
|
||||||
|
}
|
||||||
List<FlowDataEntity> flowDataEntities = flowDataRepository.findByCallId(callEntity.getId());
|
List<FlowDataEntity> flowDataEntities = flowDataRepository.findByCallId(callEntity.getId());
|
||||||
List<FlowEdgesEntity> flowEdgesEntities = flowEdgesRepository.findByCallId(callEntity.getId());
|
List<FlowEdgesEntity> flowEdgesEntities = flowEdgesRepository.findByCallId(callEntity.getId());
|
||||||
if (Boolean.FALSE.equals(flowDataEntities.isEmpty() || flowDataEntities == null) || Boolean.FALSE.equals(flowEdgesEntities.isEmpty() || flowEdgesEntities == null)) {
|
if (Boolean.FALSE.equals(flowDataEntities.isEmpty() || flowDataEntities == null) || Boolean.FALSE.equals(flowEdgesEntities.isEmpty() || flowEdgesEntities == null)) {
|
||||||
@@ -198,8 +207,9 @@ public class FormDao {
|
|||||||
String formFieldId,Long evaluationCriteriaId) {
|
String formFieldId,Long evaluationCriteriaId) {
|
||||||
EvaluationCriteriaEntity evaluationCriteria = evaluationCriteriaService.validateEvaluationCriteria(evaluationCriteriaId);
|
EvaluationCriteriaEntity evaluationCriteria = evaluationCriteriaService.validateEvaluationCriteria(evaluationCriteriaId);
|
||||||
if (Boolean.FALSE.equals(evaluationCriteria.getCall().getId().equals(callEntity.getId()))) {
|
if (Boolean.FALSE.equals(evaluationCriteria.getCall().getId().equals(callEntity.getId()))) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
log.info("This evaluation criterion does not belong to the current call. Expected Call ID = {}, Found Call ID = {}",
|
||||||
Translator.toLocale(GepafinConstant.EVALUATIONCRITERIA_INVALID));
|
callEntity.getId(), evaluationCriteria.getCall().getId());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
CriteriaFormFieldEntity criteriaFormField = new CriteriaFormFieldEntity();
|
CriteriaFormFieldEntity criteriaFormField = new CriteriaFormFieldEntity();
|
||||||
criteriaFormField.setCallId(callEntity.getId());
|
criteriaFormField.setCallId(callEntity.getId());
|
||||||
@@ -397,9 +407,9 @@ public class FormDao {
|
|||||||
FieldValidator validator = FieldValidator.create();
|
FieldValidator validator = FieldValidator.create();
|
||||||
formResponseBean.getContent().forEach(contentResponseBean -> {
|
formResponseBean.getContent().forEach(contentResponseBean -> {
|
||||||
String fieldId = contentResponseBean.getId();
|
String fieldId = contentResponseBean.getId();
|
||||||
String value = (String) formFieldMap.get(fieldId);
|
|
||||||
String fieldLabel=contentResponseBean.getLabel();
|
String fieldLabel=contentResponseBean.getLabel();
|
||||||
|
Object object=formFieldMap.get(fieldId);
|
||||||
|
String value =Utils.convertToStringForFormFieldValue(object);
|
||||||
if(value == null && isApplicationFormExist) {
|
if(value == null && isApplicationFormExist) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -408,7 +418,7 @@ public class FormDao {
|
|||||||
.minLength(value, fieldValidatorBean.getMinLength(), fieldLabel) // Only applies if minLength is not null
|
.minLength(value, fieldValidatorBean.getMinLength(), fieldLabel) // Only applies if minLength is not null
|
||||||
.maxLength(value, fieldValidatorBean.getMaxLength(), fieldLabel) // Only applies if maxLength is not null
|
.maxLength(value, fieldValidatorBean.getMaxLength(), fieldLabel) // Only applies if maxLength is not null
|
||||||
.matchesPattern(value, fieldValidatorBean.getPattern(), fieldLabel) // Only applies if pattern is present
|
.matchesPattern(value, fieldValidatorBean.getPattern(), fieldLabel) // Only applies if pattern is present
|
||||||
.validateCustom(value, fieldValidatorBean.getCustom(), fieldLabel); // Add the custom validation here
|
.validateCustom(value, fieldValidatorBean.getCustom(), fieldLabel,contentResponseBean); // Add the custom validation here
|
||||||
if (fieldValidatorBean.getCustom() != null && fieldValidatorBean.getCustom().equals(GepafinConstant.IS_PIVA)) {
|
if (fieldValidatorBean.getCustom() != null && fieldValidatorBean.getCustom().equals(GepafinConstant.IS_PIVA)) {
|
||||||
String error = validateVatNumber(value, fieldValidatorBean.getCustom(), fieldLabel);
|
String error = validateVatNumber(value, fieldValidatorBean.getCustom(), fieldLabel);
|
||||||
if(error != null) {
|
if(error != null) {
|
||||||
@@ -428,11 +438,14 @@ public class FormDao {
|
|||||||
for (Object value : list) {
|
for (Object value : list) {
|
||||||
setFormFieldMap(fieldId, formFieldMap, value);
|
setFormFieldMap(fieldId, formFieldMap, value);
|
||||||
}
|
}
|
||||||
}
|
}else if (list.stream().allMatch(item -> item instanceof Map<?, ?> map &&
|
||||||
|
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) {
|
private void setFormFieldMap(String fieldId, Map<String, Object> formFieldMap, Object value) {
|
||||||
if (value instanceof String) {
|
if (value instanceof String) {
|
||||||
if(value !=null && Boolean.FALSE.equals(StringUtils.isEmpty((String)value))) {
|
if(value !=null && Boolean.FALSE.equals(StringUtils.isEmpty((String)value))) {
|
||||||
@@ -448,7 +461,8 @@ public class FormDao {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean validateCompletedSteps(List<ApplicationFormFieldEntity> applicationFormFieldEntityList, ApplicationEntity applicationEntity, FormEntity formEntity) {
|
public Boolean validateCompletedSteps(List<ApplicationFormFieldEntity> applicationFormFieldEntityList, ApplicationEntity applicationEntity, FormEntity formEntity,
|
||||||
|
Boolean isSendValidationError) {
|
||||||
Map<String, Object> formFieldMap = new LinkedHashMap<String, Object>();
|
Map<String, Object> formFieldMap = new LinkedHashMap<String, Object>();
|
||||||
for(ApplicationFormFieldEntity applicationFormFieldEntity:applicationFormFieldEntityList) {
|
for(ApplicationFormFieldEntity applicationFormFieldEntity:applicationFormFieldEntityList) {
|
||||||
formFieldMap.put(applicationFormFieldEntity.getFieldId(),applicationFormFieldEntity.getFieldValue());
|
formFieldMap.put(applicationFormFieldEntity.getFieldId(),applicationFormFieldEntity.getFieldValue());
|
||||||
@@ -461,14 +475,29 @@ public class FormDao {
|
|||||||
String value = (String) formFieldMap.get(fieldId);
|
String value = (String) formFieldMap.get(fieldId);
|
||||||
|
|
||||||
FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class);
|
FieldValidatorBean fieldValidatorBean = Utils.convertSourceObjectToDestinationObject(contentResponseBean.getValidators(), FieldValidatorBean.class);
|
||||||
validator
|
String fieldValue = getFieldValue(contentResponseBean);
|
||||||
.isRequired(value,fieldValidatorBean.getIsRequired(),fieldId);
|
|
||||||
|
validator.isRequired(value, fieldValidatorBean.getIsRequired(), fieldValue)
|
||||||
|
.validateCustomTableValidation(value,fieldValidatorBean.getCustom(),fieldValue,contentResponseBean);
|
||||||
});
|
});
|
||||||
if (validator.hasErrors()) {
|
if (Boolean.TRUE.equals(isSendValidationError)) {
|
||||||
return false; // Validation failed, return false
|
validator.validate();
|
||||||
}
|
}
|
||||||
return true;
|
return !validator.hasErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getFieldValue(ContentResponseBean contentResponseBean) {
|
||||||
|
// Use Optional with pattern matching for type checks
|
||||||
|
return contentResponseBean.getSettings().stream().filter(setting -> "label".equals(setting.getName()) && setting.getValue() != null)
|
||||||
|
.map(setting -> {
|
||||||
|
if (setting.getValue() instanceof String value) {
|
||||||
|
return value.trim();
|
||||||
|
} else {
|
||||||
|
return String.valueOf(setting.getValue()).trim();
|
||||||
|
}
|
||||||
|
}).filter(value -> !value.isEmpty()).findFirst().orElse(contentResponseBean.getId());
|
||||||
|
}
|
||||||
|
|
||||||
public String validateVatNumber(String value,String customRule,String fieldId){
|
public String validateVatNumber(String value,String customRule,String fieldId){
|
||||||
String error=null;
|
String error=null;
|
||||||
|
|
||||||
|
|||||||
@@ -209,6 +209,20 @@ public class NotificationDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendNotificationToInstructorManager(Map<String, String> placeHolders, ApplicationEvaluationEntity applicationEvaluationEntity, NotificationTypeEnum notificationTypeEnum) {
|
||||||
|
|
||||||
|
List<UserEntity> userEntities=userRepository.findByRoleEntity_RoleTypeAndHubId(RoleStatusEnum.ROLE_INSTRUCTOR_MANAGER.getValue(),applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication().getHubId());
|
||||||
|
for (UserEntity user:userEntities) {
|
||||||
|
Long instructorId=user.getId();
|
||||||
|
ApplicationEntity application = applicationService.validateApplication(applicationEvaluationEntity.getApplicationId());
|
||||||
|
if (instructorId != null) {
|
||||||
|
NotificationReq notificationreq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders, instructorId, application.getUserWithCompany(),
|
||||||
|
null);
|
||||||
|
sendNotification(notificationreq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<Long> getAllCompanyIdsForUser(Long userId) {
|
public List<Long> getAllCompanyIdsForUser(Long userId) {
|
||||||
|
|
||||||
return userWithCompanyRepository.findActiveCompanyIdsByUserId(userId);
|
return userWithCompanyRepository.findActiveCompanyIdsByUserId(userId);
|
||||||
|
|||||||
@@ -152,6 +152,31 @@ public class PdfDao {
|
|||||||
// Create value cell with rounded corners
|
// Create value cell with rounded corners
|
||||||
PdfPTable valueTable = new PdfPTable(1);
|
PdfPTable valueTable = new PdfPTable(1);
|
||||||
valueTable.setWidthPercentage(100);
|
valueTable.setWidthPercentage(100);
|
||||||
|
|
||||||
|
|
||||||
|
Object finalValue = value;
|
||||||
|
List<Object> criteriaObject = (List<Object>) contentResponseBean.getSettings().stream()
|
||||||
|
.filter(setting -> GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName()))
|
||||||
|
.findFirst()
|
||||||
|
.map(setting -> {
|
||||||
|
try {
|
||||||
|
// Assuming setting.getValue() contains the JSON string or object
|
||||||
|
return PdfUtils.extractRows(finalValue);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Error extracting rows from setting value", e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
|
||||||
|
// Update value if criteriaObject is not null
|
||||||
|
if (criteriaObject != null) {
|
||||||
|
value = criteriaObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Update value if criteriaObject is not null
|
||||||
|
|
||||||
if (value instanceof List<?>) {
|
if (value instanceof List<?>) {
|
||||||
// Further check if the list contains Strings
|
// Further check if the list contains Strings
|
||||||
List<?> list = (List<?>) value;
|
List<?> list = (List<?>) value;
|
||||||
@@ -181,11 +206,10 @@ public class PdfDao {
|
|||||||
document.add(valueTable);
|
document.add(valueTable);
|
||||||
}
|
}
|
||||||
else if (!list.isEmpty() && list.get(0) instanceof Map<?, ?>) {
|
else if (!list.isEmpty() && list.get(0) instanceof Map<?, ?>) {
|
||||||
Object object = value;
|
Object object = value;
|
||||||
String stringvalue = Utils.convertToString(object);
|
String stringvalue = Utils.convertToString(object);
|
||||||
List<Map<String, Object>> fieldValueList = Utils.convertJsonStringIntoJsonList(stringvalue);
|
List<Map<String, Object>> fieldValueList = Utils.convertJsonStringIntoJsonList(stringvalue);
|
||||||
|
document = createPdfTable(fieldValueList, document, contentResponseBean);
|
||||||
document = createPdfTable(fieldValueList, document, contentResponseBean);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -231,27 +255,29 @@ public class PdfDao {
|
|||||||
document.add(valueTable);
|
document.add(valueTable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String fieldValue1= (String) value;
|
if (value instanceof String) {
|
||||||
if(Utils.isValidDateString(fieldValue1)){
|
String fieldValue1 = (String) value;
|
||||||
fieldValue1=Utils.formatDateString(String.valueOf(value));
|
if (Utils.isValidDateString(fieldValue1)) {
|
||||||
}
|
fieldValue1 = Utils.formatDateString(String.valueOf(value));
|
||||||
if(Boolean.TRUE.equals(Utils.isItalianFormattedAmount(fieldValue)) ){
|
}
|
||||||
fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue));
|
if(contentResponseBean.getName().equals("numberinput") && Boolean.TRUE.equals(Utils.isNumeric(fieldValue))){
|
||||||
}
|
fieldValue1=Utils.convertToItalianFormat(fieldValue);
|
||||||
|
}
|
||||||
// PdfPCell valueCell = new PdfPCell(new Phrase(fieldValue1, valueFont));
|
// PdfPCell valueCell = new PdfPCell(new Phrase(fieldValue1, valueFont));
|
||||||
PdfPCell valueCell = PdfUtils.htmlToPdfPCell(fieldValue1, valueFont);
|
PdfPCell valueCell = PdfUtils.htmlToPdfPCell(fieldValue1, valueFont);
|
||||||
valueCell.setMinimumHeight(30f); // Set a fixed height for the cell
|
valueCell.setMinimumHeight(30f); // Set a fixed height for the cell
|
||||||
valueCell.setPaddingLeft(10f); // Adjust left padding as needed
|
valueCell.setPaddingLeft(10f); // Adjust left padding as needed
|
||||||
valueCell.setPaddingTop(0f); // Remove padding from top to allow vertical centering
|
valueCell.setPaddingTop(0f); // Remove padding from top to allow vertical centering
|
||||||
valueCell.setPaddingBottom(6f);
|
valueCell.setPaddingBottom(6f);
|
||||||
valueCell.setPaddingLeft(leftMargin); // Increase left margin for value
|
valueCell.setPaddingLeft(leftMargin); // Increase left margin for value
|
||||||
valueCell.setBorder(Rectangle.NO_BORDER); // Remove border for value cell
|
valueCell.setBorder(Rectangle.NO_BORDER); // Remove border for value cell
|
||||||
valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
valueCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||||
valueCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
valueCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||||
valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners
|
valueCell.setCellEvent(new RoundedCorners()); // Apply rounded corners
|
||||||
valueTable.addCell(valueCell);
|
valueTable.addCell(valueCell);
|
||||||
document.add(valueTable);
|
document.add(valueTable);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
document.add(new Paragraph("\n")); // Add line break after each value
|
document.add(new Paragraph("\n")); // Add line break after each value
|
||||||
@@ -264,11 +290,12 @@ public class PdfDao {
|
|||||||
Map<String, Boolean> formulaEnabledMap = new HashMap<>();
|
Map<String, Boolean> formulaEnabledMap = new HashMap<>();
|
||||||
Map<String, String> formulaTypeMap = new HashMap<>();
|
Map<String, String> formulaTypeMap = new HashMap<>();
|
||||||
Map<String, String> fieldTypeMap = new HashMap<>();
|
Map<String, String> fieldTypeMap = new HashMap<>();
|
||||||
|
Map<String, String> totalMap = new HashMap<>();
|
||||||
Font lightGrayFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(110, 110, 110)); // Light gray
|
Font lightGrayFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(110, 110, 110)); // Light gray
|
||||||
|
|
||||||
|
|
||||||
contentResponseBean.getSettings().stream()
|
contentResponseBean.getSettings().stream()
|
||||||
.filter(setting -> "table_columns".equals(setting.getName())) // Check for "table_columns"
|
.filter(setting -> "table_columns".equals(setting.getName()) || "criteria_table_columns".equals(setting.getName())) // Check for "table_columns"
|
||||||
.map(SettingResponseBean::getValue)
|
.map(SettingResponseBean::getValue)
|
||||||
.filter(Objects::nonNull) // Ensure value is not null
|
.filter(Objects::nonNull) // Ensure value is not null
|
||||||
.filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map
|
.filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map
|
||||||
@@ -283,7 +310,7 @@ public class PdfDao {
|
|||||||
Boolean isFormulaEnabled = (Boolean) fieldData.get("enableFormula");
|
Boolean isFormulaEnabled = (Boolean) fieldData.get("enableFormula");
|
||||||
String formulaType = (String) fieldData.get("lastRowFormula");
|
String formulaType = (String) fieldData.get("lastRowFormula");
|
||||||
String fieldType = (String) fieldData.get("fieldtype"); // Get the field type (e.g., numeric)
|
String fieldType = (String) fieldData.get("fieldtype"); // Get the field type (e.g., numeric)
|
||||||
|
String total= (String) fieldData.get("lastRowText");
|
||||||
if (fieldName != null && fieldDataValue != null) {
|
if (fieldName != null && fieldDataValue != null) {
|
||||||
stateFieldMap.put(fieldName, fieldDataValue);
|
stateFieldMap.put(fieldName, fieldDataValue);
|
||||||
}
|
}
|
||||||
@@ -297,6 +324,9 @@ public class PdfDao {
|
|||||||
if (fieldType != null) {
|
if (fieldType != null) {
|
||||||
fieldTypeMap.put(fieldName, fieldType); // Store the fieldType in the map
|
fieldTypeMap.put(fieldName, fieldType); // Store the fieldType in the map
|
||||||
}
|
}
|
||||||
|
if(total!=null){
|
||||||
|
totalMap.put(fieldName,total);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
PdfPTable table = new PdfPTable(stateFieldMap.size()); // Number of columns equals the number of map entries
|
PdfPTable table = new PdfPTable(stateFieldMap.size()); // Number of columns equals the number of map entries
|
||||||
@@ -340,13 +370,17 @@ public class PdfDao {
|
|||||||
for (String key : orderedKeys) {
|
for (String key : orderedKeys) {
|
||||||
if (stateFieldMap.containsKey(key)) { // Only add data cell if key is in stateFieldMap
|
if (stateFieldMap.containsKey(key)) { // Only add data cell if key is in stateFieldMap
|
||||||
Object value = row.getOrDefault(key, ""); // Fetch value or use empty string if key not present
|
Object value = row.getOrDefault(key, ""); // Fetch value or use empty string if key not present
|
||||||
String fieldValue= (String) value;
|
// String fieldValue= (String) value;
|
||||||
if(Boolean.TRUE.equals(Utils.isItalianFormattedAmount(fieldValue)) ){
|
String fieldValue = value != null ? value.toString() : "";
|
||||||
fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue));
|
// if(Boolean.TRUE.equals(Utils.isItalianFormattedAmount(fieldValue)) ){
|
||||||
}
|
//// fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue));
|
||||||
|
// }
|
||||||
if (Boolean.TRUE.equals(formulaEnabledMap.get(key)) && Boolean.TRUE.equals(GepafinConstant.NUMERIC.equalsIgnoreCase(fieldTypeMap.get(key)))) {
|
if (Boolean.TRUE.equals(formulaEnabledMap.get(key)) && Boolean.TRUE.equals(GepafinConstant.NUMERIC.equalsIgnoreCase(fieldTypeMap.get(key)))) {
|
||||||
calculateValue(key, fieldValue, formulaTypeMap, columnSums);
|
calculateValue(key, fieldValue, formulaTypeMap, columnSums);
|
||||||
}
|
}
|
||||||
|
if(Boolean.TRUE.equals(Utils.isNumeric(fieldValue))){
|
||||||
|
fieldValue=Utils.convertToItalianFormat(fieldValue);
|
||||||
|
}
|
||||||
|
|
||||||
PdfPCell dataCell = PdfUtils.htmlToPdfPCell(fieldValue != null ? fieldValue : "", textFont);
|
PdfPCell dataCell = PdfUtils.htmlToPdfPCell(fieldValue != null ? fieldValue : "", textFont);
|
||||||
dataCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for the cell
|
dataCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for the cell
|
||||||
@@ -396,14 +430,19 @@ public class PdfDao {
|
|||||||
table.addCell(emptyCell);
|
table.addCell(emptyCell);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PdfPCell emptyCell = new PdfPCell(new Phrase(""));
|
String total=null;
|
||||||
|
if (totalMap.containsKey(key)) {
|
||||||
|
total=totalMap.getOrDefault(key, "");
|
||||||
|
}
|
||||||
|
PdfPCell emptyCell = new PdfPCell(new Phrase(total,lightGrayFont));
|
||||||
|
emptyCell.setPaddingTop(8f);
|
||||||
|
emptyCell.setPaddingLeft(8f);
|
||||||
emptyCell.setBackgroundColor(new BaseColor(239, 243, 248));
|
emptyCell.setBackgroundColor(new BaseColor(239, 243, 248));
|
||||||
table.addCell(emptyCell);
|
table.addCell(emptyCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add the last table to the document
|
// Add the last table to the document
|
||||||
document.add(table);
|
document.add(table);
|
||||||
|
|
||||||
@@ -414,7 +453,7 @@ public class PdfDao {
|
|||||||
try {
|
try {
|
||||||
if (Boolean.FALSE.equals(StringUtils.isEmpty(fieldValue))) {
|
if (Boolean.FALSE.equals(StringUtils.isEmpty(fieldValue))) {
|
||||||
// Use Locale.ITALY to parse the number with the Italian format (comma as decimal separator)
|
// Use Locale.ITALY to parse the number with the Italian format (comma as decimal separator)
|
||||||
NumberFormat format = NumberFormat.getInstance(Locale.ITALY);
|
NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
|
||||||
Number number = format.parse(fieldValue); // Parse the fieldValue as a number
|
Number number = format.parse(fieldValue); // Parse the fieldValue as a number
|
||||||
double numericValue = number.doubleValue(); // Convert the parsed number to double
|
double numericValue = number.doubleValue(); // Convert the parsed number to double
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ public class SystemEmailTemplatesDao {
|
|||||||
public SystemEmailTemplateResponse retrieveTemplate(SystemEmailTemplatesEntityTypeEnum type, HubEntity hub, Locale language) {
|
public SystemEmailTemplateResponse retrieveTemplate(SystemEmailTemplatesEntityTypeEnum type, HubEntity hub, Locale language) {
|
||||||
SystemEmailTemplatesEntity dbSystemEmailTemplatesEntity = null;
|
SystemEmailTemplatesEntity dbSystemEmailTemplatesEntity = null;
|
||||||
if(hub != null){
|
if(hub != null){
|
||||||
// dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
|
dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
|
||||||
// .findByTypeAndCallId(type.getValue(), call.getId());
|
.findByTypeAndHubEntityId(type.getValue(), hub.getId());
|
||||||
}
|
}
|
||||||
if(dbSystemEmailTemplatesEntity == null) {
|
if(dbSystemEmailTemplatesEntity == null){
|
||||||
dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
|
dbSystemEmailTemplatesEntity = systemEmailTemplatesRespository
|
||||||
.findByType(type.getValue());
|
.findByType(type.getValue());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import net.gepafin.tendermanagement.util.LoggingUtil;
|
|||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.ForbiddenAccessException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
|
||||||
@@ -622,7 +623,6 @@ public class UserDao {
|
|||||||
Specification<UserEntity> spec = search(userPaginationRequestBean,userEntity);
|
Specification<UserEntity> spec = search(userPaginationRequestBean,userEntity);
|
||||||
Page<UserEntity> entityPage = userRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
Page<UserEntity> entityPage = userRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||||
|
|
||||||
|
|
||||||
List<UserResponseBean> applicationResponses = entityPage.getContent().stream()
|
List<UserResponseBean> applicationResponses = entityPage.getContent().stream()
|
||||||
.map(user -> {
|
.map(user -> {
|
||||||
UserResponseBean response = convertUserEntityToUserResponse(user);
|
UserResponseBean response = convertUserEntityToUserResponse(user);
|
||||||
@@ -753,4 +753,54 @@ public class UserDao {
|
|||||||
return predicates;
|
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);
|
||||||
|
|
||||||
|
HubEntity hubEntity = hubService.valdateHub(userEntity.getHub().getId());
|
||||||
|
String beneficiaryRoleType = RoleStatusEnum.ROLE_BENEFICIARY.getValue();
|
||||||
|
|
||||||
|
if (validator.checkIsBeneficiary()) {
|
||||||
|
// Validate if the new email already exists for another beneficiary in the same hub
|
||||||
|
boolean emailExistsForBeneficiary = userRepository.existsByEmailIgnoreCaseForBeneficiaries(
|
||||||
|
userReq.getEmail(), hubEntity.getUniqueUuid(), beneficiaryRoleType);
|
||||||
|
|
||||||
|
if (emailExistsForBeneficiary) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
|
Translator.toLocale(GepafinConstant.EMAIL_ALREADY_EXISTS));
|
||||||
|
}
|
||||||
|
|
||||||
|
setIfUpdated(userEntity::getEmail,userEntity::setEmail,userReq.getEmail()); // Only update email if role is beneficiary
|
||||||
|
}
|
||||||
|
|
||||||
|
BeneficiaryEntity oldBeneficiaryEntity = null;
|
||||||
|
|
||||||
|
if(userEntity.getBeneficiary()!=null) {
|
||||||
|
oldBeneficiaryEntity = Utils.getClonedEntityForData(userEntity.getBeneficiary());
|
||||||
|
setIfUpdated(userEntity.getBeneficiary()::getFirstName, userEntity.getBeneficiary()::setFirstName, userReq.getFirstName());
|
||||||
|
setIfUpdated(userEntity.getBeneficiary()::getLastName, userEntity.getBeneficiary()::setLastName, userReq.getLastName());
|
||||||
|
setIfUpdated(userEntity.getBeneficiary()::getOrganization, userEntity.getBeneficiary()::setOrganization, userReq.getOrganization());
|
||||||
|
setIfUpdated(userEntity.getBeneficiary()::getAddress, userEntity.getBeneficiary()::setAddress, userReq.getAddress());
|
||||||
|
setIfUpdated(userEntity.getBeneficiary()::getPhoneNumber, userEntity.getBeneficiary()::setPhoneNumber, userReq.getPhoneNumber());
|
||||||
|
setIfUpdated(userEntity.getBeneficiary()::getDateOfBirth, userEntity.getBeneficiary()::setDateOfBirth, userReq.getDateOfBirth());
|
||||||
|
setIfUpdated(userEntity.getBeneficiary()::getCity, userEntity.getBeneficiary()::setCity, userReq.getCity());
|
||||||
|
setIfUpdated(userEntity.getBeneficiary()::getCountry, userEntity.getBeneficiary()::setCountry, userReq.getCountry());
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Update beneficiary details " operation **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(oldBeneficiaryEntity).newData(userEntity.getBeneficiary()).build());
|
||||||
|
}
|
||||||
|
|
||||||
|
userEntity = userRepository.save(userEntity);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Update user details by beneficiary" operation **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(oldUserEntity).newData(userEntity).build());
|
||||||
|
|
||||||
|
return convertUserEntityToUserResponse(userEntity);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,4 +53,7 @@ public class ApplicationAmendmentRequestEntity extends BaseEntity {
|
|||||||
@Column(name = "amendment_document")
|
@Column(name = "amendment_document")
|
||||||
private String amendmentDocument;
|
private String amendmentDocument;
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "CLOSING_DATE")
|
||||||
|
private LocalDateTime closingDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,4 +68,10 @@ public class ApplicationEntity extends BaseEntity {
|
|||||||
@Column(name="DATE_REJECTED")
|
@Column(name="DATE_REJECTED")
|
||||||
private LocalDateTime dateRejected;
|
private LocalDateTime dateRejected;
|
||||||
|
|
||||||
|
@Column(name = "evaluationVersion")
|
||||||
|
private String evaluationVersion;
|
||||||
|
|
||||||
|
@Column(name = "APPLICATION_EVALUATION_ID")
|
||||||
|
private Long applicationEvaluationId;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -68,4 +68,7 @@ public class ApplicationEvaluationEntity extends BaseEntity{
|
|||||||
@Column(name = "ACTIVE_DAYS")
|
@Column(name = "ACTIVE_DAYS")
|
||||||
private Long activeDays;
|
private Long activeDays;
|
||||||
|
|
||||||
|
@Column(name = "evaluationVersion")
|
||||||
|
private String evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Table(name = "APPLICATION_EVALUATION_FORM")
|
||||||
|
public class ApplicationEvaluationFormEntity extends BaseEntity{
|
||||||
|
private Long applicationId;
|
||||||
|
|
||||||
|
@Column(name="IS_DELETED")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "EVALUATION_ID")
|
||||||
|
private ApplicationEvaluationEntity applicationEvaluation;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "EVALUATION_FORM_ID")
|
||||||
|
private EvaluationFormEntity evaluationForm;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@Table(name = "APPLICATION_EVALUATION_FORM_FIELD")
|
||||||
|
public class ApplicationEvaluationFormFieldEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "APPLICATION_EVALUATION_FORM_ID")
|
||||||
|
private ApplicationEvaluationFormEntity applicationEvaluationForm;
|
||||||
|
|
||||||
|
@Column(name = "FIELD_ID")
|
||||||
|
private String fieldId;
|
||||||
|
|
||||||
|
@Column(name = "FIELD_VALUE")
|
||||||
|
private String fieldValue;
|
||||||
|
|
||||||
|
@Column(name="IS_DELETED")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -88,5 +88,14 @@ public class CallEntity extends BaseEntity {
|
|||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "HUB_ID")
|
@JoinColumn(name = "HUB_ID")
|
||||||
private HubEntity hub;
|
private HubEntity hub;
|
||||||
|
|
||||||
|
@Column(name = "evaluationVersion")
|
||||||
|
private String evaluationVersion;
|
||||||
|
|
||||||
|
@Column(name = "NUMBER_OF_CHECK")
|
||||||
|
private Long numberOfCheck;
|
||||||
|
|
||||||
|
@Column(name = "PRODUCT_ID")
|
||||||
|
private Long productId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,4 +59,7 @@ public class CompanyEntity extends BaseEntity{
|
|||||||
|
|
||||||
@Column(name = "CODICE_ATECO")
|
@Column(name = "CODICE_ATECO")
|
||||||
private String codiceAteco;
|
private String codiceAteco;
|
||||||
|
|
||||||
|
@Column(name = "JSON")
|
||||||
|
private String json;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
@Entity
|
||||||
|
@Table(name = "EVALUATION_FORM")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class EvaluationFormEntity extends BaseEntity{
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "LABEL")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "CALL_ID")
|
||||||
|
private CallEntity call;
|
||||||
|
|
||||||
|
@Column(name = "CONTENT")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@Column(name="IS_DELETED")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
}
|
||||||
@@ -63,4 +63,7 @@ public class HubEntity extends BaseEntity{
|
|||||||
|
|
||||||
@Column(name = "AREA_CODE")
|
@Column(name = "AREA_CODE")
|
||||||
private String areaCode;
|
private String areaCode;
|
||||||
|
|
||||||
|
@Column(name = "EVALUATION_EXPIRATION_DAYS")
|
||||||
|
private Long evaluationExpirationDays;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ public class SystemEmailTemplatesEntity extends BaseEntity {
|
|||||||
@Column(name = "email_scenario")
|
@Column(name = "email_scenario")
|
||||||
private String emailScenario;
|
private String emailScenario;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "HUB_ID")
|
||||||
|
private HubEntity hubEntity;
|
||||||
|
|
||||||
|
|
||||||
public enum SystemEmailTemplatesEntityTypeEnum {
|
public enum SystemEmailTemplatesEntityTypeEnum {
|
||||||
|
|
||||||
APPLICATION_SUBMISSION_TO_USER_AND_COMPANY("APPLICATION_SUBMISSION_TO_USER_AND_COMPANY"),
|
APPLICATION_SUBMISSION_TO_USER_AND_COMPANY("APPLICATION_SUBMISSION_TO_USER_AND_COMPANY"),
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ public class UserWithCompanyEntity extends BaseEntity{
|
|||||||
@Column(name = "EMAIL")
|
@Column(name = "EMAIL")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@Column(name = "JSON")
|
|
||||||
private String json;
|
|
||||||
|
|
||||||
@Column(name = "IS_DELETED")
|
@Column(name = "IS_DELETED")
|
||||||
private Boolean isDeleted = false;
|
private Boolean isDeleted = false;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
|||||||
public enum AssignedApplicationEnum {
|
public enum AssignedApplicationEnum {
|
||||||
OPEN ("OPEN"),
|
OPEN ("OPEN"),
|
||||||
SOCCORSO("SOCCORSO"),
|
SOCCORSO("SOCCORSO"),
|
||||||
|
|
||||||
|
AWAITING("AWAITING"),
|
||||||
|
|
||||||
CLOSE("CLOSE");
|
CLOSE("CLOSE");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package net.gepafin.tendermanagement.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public enum EvaluationVersionEnum {
|
||||||
|
V1("V1"),
|
||||||
|
V2("V2");
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
EvaluationVersionEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public static EvaluationVersionEnum fromValue(String value) {
|
||||||
|
for (EvaluationVersionEnum b : EvaluationVersionEnum.values()) {
|
||||||
|
if (b.value.equals(value)) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||||
|
}
|
||||||
|
public static List<String> getStatusValues() {
|
||||||
|
return Arrays.stream(EvaluationVersionEnum.values())
|
||||||
|
.map(EvaluationVersionEnum::getValue)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -13,6 +13,11 @@ public enum UserActionContextEnum {
|
|||||||
GET_CALL("GET_CALL"),
|
GET_CALL("GET_CALL"),
|
||||||
DOWNLOAD_CALL_DOCUMENT("DOWNLOAD_CALL_DOCUMENT"),
|
DOWNLOAD_CALL_DOCUMENT("DOWNLOAD_CALL_DOCUMENT"),
|
||||||
|
|
||||||
|
|
||||||
|
/** Evaluation V2 call action context **/
|
||||||
|
EVALUATION_V2_CREATE_UPDATE_CALL_STEP_2("EVALUATION_V2_CREATE_UPDATE_CALL_STEP_2"),
|
||||||
|
|
||||||
|
|
||||||
/** user action context **/
|
/** user action context **/
|
||||||
CREATE_USER("CREATE_USER"),
|
CREATE_USER("CREATE_USER"),
|
||||||
USER_LOGIN("USER_LOGIN"),
|
USER_LOGIN("USER_LOGIN"),
|
||||||
@@ -30,6 +35,7 @@ public enum UserActionContextEnum {
|
|||||||
/** application action context **/
|
/** application action context **/
|
||||||
GET_APPLICATION("GET_APPLICATION"),
|
GET_APPLICATION("GET_APPLICATION"),
|
||||||
CREATE_UPDATE_APPLICATION_FORM("CREATE_UPDATE_APPLICATION_FORM"),
|
CREATE_UPDATE_APPLICATION_FORM("CREATE_UPDATE_APPLICATION_FORM"),
|
||||||
|
GET_APPLICATION_EVALUATION_VERSION("GET_APPLICATION_EVALUATION_VERSION"),
|
||||||
CREATE_APPLICATION("CREATE_APPLICATION"),
|
CREATE_APPLICATION("CREATE_APPLICATION"),
|
||||||
DELETE_APPLICATION("DELETE_APPLICATION"),
|
DELETE_APPLICATION("DELETE_APPLICATION"),
|
||||||
GET_ALL_APPLICATION("GET_ALL_APPLICATION"),
|
GET_ALL_APPLICATION("GET_ALL_APPLICATION"),
|
||||||
@@ -92,6 +98,8 @@ public enum UserActionContextEnum {
|
|||||||
CREATE_UPDATE_APPLICATION_EVALUATION("CREATE_UPDATE_APPLICATION_EVALUATION"),
|
CREATE_UPDATE_APPLICATION_EVALUATION("CREATE_UPDATE_APPLICATION_EVALUATION"),
|
||||||
GET_APPLICATION_EVALUATION("GET_APPLICATION_EVALUATION"),
|
GET_APPLICATION_EVALUATION("GET_APPLICATION_EVALUATION"),
|
||||||
DELETE_APPLICATION_EVALUATION("DELETE_APPLICATION_EVALUATION"),
|
DELETE_APPLICATION_EVALUATION("DELETE_APPLICATION_EVALUATION"),
|
||||||
|
CREATE_UPDATE_APPLICATION_EVALUATION_FORM("CREATE_UPDATE_APPLICATION_EVALUATION_FORM"),
|
||||||
|
GET_APPLICATION_EVALUATION_FORM("GET_APPLICATION_EVALUATION_FORM"),
|
||||||
|
|
||||||
/** Beneficiary Preferred Call action context **/
|
/** Beneficiary Preferred Call action context **/
|
||||||
CREATE_BENEFICIARY_PREFERRED_CALL("CREATE_BENEFICIARY_PREFERRED_CALL"),
|
CREATE_BENEFICIARY_PREFERRED_CALL("CREATE_BENEFICIARY_PREFERRED_CALL"),
|
||||||
@@ -104,6 +112,7 @@ public enum UserActionContextEnum {
|
|||||||
DELETE_ASSIGNED_APPLICATION("DELETE_ASSIGNED_APPLICATION"),
|
DELETE_ASSIGNED_APPLICATION("DELETE_ASSIGNED_APPLICATION"),
|
||||||
GET_ASSIGNED_APPLICATION("GET_ASSIGNED_APPLICATION"),
|
GET_ASSIGNED_APPLICATION("GET_ASSIGNED_APPLICATION"),
|
||||||
UPDATE_ASSIGNED_APPLICATION_DETAILS("UPDATE_ASSIGNED_APPLICATION_DETAILS"),
|
UPDATE_ASSIGNED_APPLICATION_DETAILS("UPDATE_ASSIGNED_APPLICATION_DETAILS"),
|
||||||
|
UPDATE_ASSIGNED_APPLICATION_STATUS("UPDATE_ASSIGNED_APPLICATION_STATUS"),
|
||||||
|
|
||||||
/** Assigned form field context **/
|
/** Assigned form field context **/
|
||||||
CREATE_FORM_FIELD("CREATE_FORM_FIELD"),
|
CREATE_FORM_FIELD("CREATE_FORM_FIELD"),
|
||||||
@@ -137,6 +146,10 @@ public enum UserActionContextEnum {
|
|||||||
GET_DASHBOARD_WIDGET_FOR_SUPER_ADMIN("GET_DASHBOARD_WIDGET_FOR_SUPER_ADMIN"),
|
GET_DASHBOARD_WIDGET_FOR_SUPER_ADMIN("GET_DASHBOARD_WIDGET_FOR_SUPER_ADMIN"),
|
||||||
GET_DASHBOARD_WIDGET_FOR_BENEFICIARY("GET_DASHBOARD_WIDGET_FOR_BENEFICIARY"),
|
GET_DASHBOARD_WIDGET_FOR_BENEFICIARY("GET_DASHBOARD_WIDGET_FOR_BENEFICIARY"),
|
||||||
GET_APPLICATION_DETAILS("GET_APPLICATION_DETAILS"),
|
GET_APPLICATION_DETAILS("GET_APPLICATION_DETAILS"),
|
||||||
|
GET_AMENDMENT_DETAILS("GET_AMENDMENT_DETAILS"),
|
||||||
|
GET_DASHBOARD_WIDGET_FOR_PRE_INSTRUCTOR("GET_DASHBOARD_WIDGET_FOR_PRE_INSTRUCTOR"),
|
||||||
|
GET_APPLICATION_DETAILS_FOR_EVALUATION("GET_APPLICATION_DETAILS_FOR_EVALUATION"),
|
||||||
|
GET_STATISTICS_PAGE_FOR_BENEFICIARY("GET_STATISTICS_PAGE_FOR_BENEFICIARY"),
|
||||||
|
|
||||||
/** Evaluation criteria action context **/
|
/** Evaluation criteria action context **/
|
||||||
GET_EVALUATION_CRITERIA("GET_EVALUATION_CRITERIA"),
|
GET_EVALUATION_CRITERIA("GET_EVALUATION_CRITERIA"),
|
||||||
@@ -171,6 +184,13 @@ public enum UserActionContextEnum {
|
|||||||
GET_ALL_APPLICATION_BY_PAGINATION("GET_ALL_APPLICATION_BY_PAGINATION"),
|
GET_ALL_APPLICATION_BY_PAGINATION("GET_ALL_APPLICATION_BY_PAGINATION"),
|
||||||
|
|
||||||
|
|
||||||
|
/** Evaluation form action context **/
|
||||||
|
GET_EVALUATION_FORM("GET_EVALUATION_FORM"),
|
||||||
|
CREATE_EVALUATION_FORM("CREATE_EVALUATION_FORM"),
|
||||||
|
UPDATE_EVALUATION_FORM("UPDATE_EVALUATION_FORM"),
|
||||||
|
DELETE_EVALUATION_FORM("DELETE_EVALUATION_FORM"),
|
||||||
|
|
||||||
|
|
||||||
GET_USER_ACTION("GET_USER_ACTION"),
|
GET_USER_ACTION("GET_USER_ACTION"),
|
||||||
GET_ACTION_CONTEXT_LABELS("GET_ACTION_CONTEXT_LABELS"),
|
GET_ACTION_CONTEXT_LABELS("GET_ACTION_CONTEXT_LABELS"),
|
||||||
GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION("GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION"),
|
GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION("GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION"),
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.ApplicationStatusForEvaluation;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationEvaluationFormRequestBean {
|
||||||
|
private List<FieldRequest> files;
|
||||||
|
private List<EvaluationDocumentRequest> evaluationDocument;
|
||||||
|
private List<AmendmentDetailsRequest> amendmentDetails;
|
||||||
|
private String note;
|
||||||
|
private ApplicationStatusForEvaluation applicationStatus;
|
||||||
|
private List<ApplicationFormFieldRequestBean> formFields;
|
||||||
|
private String motivation;
|
||||||
|
private BigDecimal amountAccepted;
|
||||||
|
}
|
||||||
@@ -10,5 +10,7 @@ public class ApplicationPageableRequestBean {
|
|||||||
|
|
||||||
private GlobalFilters globalFilters;
|
private GlobalFilters globalFilters;
|
||||||
|
|
||||||
|
private Integer daysRange;
|
||||||
|
|
||||||
private List<ApplicationStatusTypeEnum> status;
|
private List<ApplicationStatusTypeEnum> status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,4 @@ import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
|||||||
@Data
|
@Data
|
||||||
public class AssignedApplicationsRequest {
|
public class AssignedApplicationsRequest {
|
||||||
private String note;
|
private String note;
|
||||||
private AssignedApplicationEnum status;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CreateCallRequestStep1 {
|
public class CreateCallRequestStep1 {
|
||||||
@@ -23,6 +24,10 @@ public class CreateCallRequestStep1 {
|
|||||||
|
|
||||||
private BigDecimal amountMax;
|
private BigDecimal amountMax;
|
||||||
|
|
||||||
|
private Long numberOfCheck;
|
||||||
|
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
private List<LookUpDataReq> aimedTo;
|
private List<LookUpDataReq> aimedTo;
|
||||||
|
|
||||||
private String documentationRequested;
|
private String documentationRequested;
|
||||||
@@ -41,4 +46,5 @@ public class CreateCallRequestStep1 {
|
|||||||
|
|
||||||
private List<FaqReq> faq;
|
private List<FaqReq> faq;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CreateCallRequestStep2EvaluationV2 {
|
||||||
|
|
||||||
|
private List<DocumentReq> docs;
|
||||||
|
|
||||||
|
private List<DocumentReq> images;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EvaluationFormRequest {
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private List<ContentRequestBean> content;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import java.time.LocalTime;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class UpdateCallRequestStep1 {
|
public class UpdateCallRequestStep1 {
|
||||||
@@ -40,4 +41,10 @@ public class UpdateCallRequestStep1 {
|
|||||||
|
|
||||||
private List<FaqReq> faq;
|
private List<FaqReq> faq;
|
||||||
|
|
||||||
|
private Long numberOfCheck;
|
||||||
|
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UpdateUserReqForBeneficiary {
|
||||||
|
private String firstName;
|
||||||
|
private String lastName;
|
||||||
|
private String email;
|
||||||
|
private String phoneNumber;
|
||||||
|
private String organization;
|
||||||
|
private String address;
|
||||||
|
private String city;
|
||||||
|
private String country;
|
||||||
|
private LocalDateTime dateOfBirth;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
public class AmendmentWidgetResponseBean {
|
||||||
|
|
||||||
|
private Long totalAmendments;
|
||||||
|
|
||||||
|
private Long waitingForResponseAmendments;
|
||||||
|
|
||||||
|
private Long responseReceivedAmendments;
|
||||||
|
|
||||||
|
private BigDecimal averageResponseDays;
|
||||||
|
|
||||||
|
private Long expiringRequestsIn48Hours;
|
||||||
|
|
||||||
|
private Long expiredAmendments;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.model.BaseBean;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationEvaluationFormFieldReponseBean extends BaseBean {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long applicationEvaluationFormId;
|
||||||
|
|
||||||
|
private String fieldId;
|
||||||
|
|
||||||
|
private Object fieldValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationEvaluationFormResponse {
|
||||||
|
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private Long applicationId;
|
||||||
|
private ApplicationStatusTypeEnum applicationStatus;
|
||||||
|
private Long assignedApplicationId;
|
||||||
|
private String note;
|
||||||
|
private ApplicationEvaluationStatusTypeEnum status;
|
||||||
|
private Long minScore;
|
||||||
|
private ApplicationEvaluationFormResponseBean applicationEvaluationFormResponse;
|
||||||
|
private List<FieldResponse> files;
|
||||||
|
private List<EvaluationDocumentResponse> evaluationDocument;
|
||||||
|
private List<AmendmentDocumentResponseBean> amendmentDetails;
|
||||||
|
private LocalDateTime createdDate;
|
||||||
|
private LocalDateTime updatedDate;
|
||||||
|
private String beneficiary;
|
||||||
|
private Long assignedUserId;
|
||||||
|
private String assignedUserName;
|
||||||
|
private Long protocolNumber;
|
||||||
|
private String callName;
|
||||||
|
private String motivation;
|
||||||
|
private LocalDateTime submissionDate;
|
||||||
|
private LocalDateTime evaluationEndDate;
|
||||||
|
private LocalDateTime callEndDate;
|
||||||
|
private String companyName;
|
||||||
|
private LocalDateTime assignedAt;
|
||||||
|
private String ndg;
|
||||||
|
private String appointmentId;
|
||||||
|
private BigDecimal amountRequested;
|
||||||
|
private BigDecimal amountAccepted;
|
||||||
|
private LocalDateTime dateAccepted;
|
||||||
|
private LocalDateTime dateRejected;
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
private BigDecimal numberOfCheck;
|
||||||
|
private BigDecimal productId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationEvaluationFormResponseBean {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private Long callId;
|
||||||
|
|
||||||
|
private List<ContentResponseBean> content;
|
||||||
|
|
||||||
|
private List<ApplicationEvaluationFormFieldReponseBean> formFields;
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.model.response;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -43,4 +44,8 @@ public class ApplicationEvaluationResponse {
|
|||||||
private BigDecimal amountAccepted;
|
private BigDecimal amountAccepted;
|
||||||
private LocalDateTime dateAccepted;
|
private LocalDateTime dateAccepted;
|
||||||
private LocalDateTime dateRejected;
|
private LocalDateTime dateRejected;
|
||||||
|
private Long numberOfCheck;
|
||||||
|
private Long productId;
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationEvaluationVersionResponse {
|
||||||
|
private Long callId;
|
||||||
|
private Long companyId;
|
||||||
|
private Long applicationId;
|
||||||
|
private Long evaluationId;
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.gepafin.tendermanagement.model.response;
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationFormFieldResponseBean;
|
import net.gepafin.tendermanagement.model.response.ApplicationFormFieldResponseBean;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -49,4 +50,6 @@ public class ApplicationResponse{
|
|||||||
|
|
||||||
private LocalDateTime dateRejected;
|
private LocalDateTime dateRejected;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
public class ApplicationToConsider {
|
||||||
|
|
||||||
|
public Long totalAssignedApplication;
|
||||||
|
|
||||||
|
private BigDecimal additionalApplicationPercentage;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class ApplicationWidget {
|
||||||
|
|
||||||
|
private Long submittedApplication;
|
||||||
|
|
||||||
|
private BigDecimal successRate;
|
||||||
|
|
||||||
|
private Long approvedApplication;
|
||||||
|
|
||||||
|
private BigDecimal totalAmountFinanced;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AssignedApplicationWidgetResponseBean {
|
||||||
|
private Long numberOfAssignedApplication;
|
||||||
|
private Long numberOfApplicationInAmendmentState;
|
||||||
|
private Long numberOfApplicationInCloseState;
|
||||||
|
private Long numberOfApplicationInOpenState;
|
||||||
|
private Long numberOfApplicationExpiringIn48Hours;
|
||||||
|
private BigDecimal averageEvaluationDays;
|
||||||
|
}
|
||||||
@@ -2,8 +2,10 @@ package net.gepafin.tendermanagement.model.response;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
import net.gepafin.tendermanagement.model.BaseBean;
|
import net.gepafin.tendermanagement.model.BaseBean;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -22,6 +24,9 @@ public class AssignedApplicationsResponse extends BaseBean {
|
|||||||
private LocalDateTime callEndDate;
|
private LocalDateTime callEndDate;
|
||||||
private String companyName;
|
private String companyName;
|
||||||
private LocalDateTime evaluationEndDate;
|
private LocalDateTime evaluationEndDate;
|
||||||
|
private Long numberOfCheck;
|
||||||
|
private Long productId;
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
public class AverageEvaluationTime {
|
||||||
|
|
||||||
|
private BigDecimal averageEvlauationDaysRating;
|
||||||
|
|
||||||
|
private BigDecimal timeDifferenceFromAverage;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class BeneficiaryStatisticsResponseBean {
|
||||||
|
|
||||||
|
|
||||||
|
private ApplicationWidget applicationWidget;
|
||||||
|
|
||||||
|
private Map<String, Object> applicationWidgetBars;
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.model.response;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -55,4 +56,10 @@ public class CallDetailsResponseBean {
|
|||||||
private LocalDateTime updatedDate;
|
private LocalDateTime updatedDate;
|
||||||
|
|
||||||
private Long preferredCallId;
|
private Long preferredCallId;
|
||||||
|
|
||||||
|
private Long numberOfCheck;
|
||||||
|
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
import net.gepafin.tendermanagement.util.DynamicLocalTimeSerializer;
|
import net.gepafin.tendermanagement.util.DynamicLocalTimeSerializer;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -49,6 +50,10 @@ public class CallResponse {
|
|||||||
|
|
||||||
private String phoneNumber;
|
private String phoneNumber;
|
||||||
|
|
||||||
|
private Long numberOfCheck;
|
||||||
|
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
@JsonSerialize(using = DynamicLocalTimeSerializer.class)
|
@JsonSerialize(using = DynamicLocalTimeSerializer.class)
|
||||||
private LocalTime startTime;
|
private LocalTime startTime;
|
||||||
|
|
||||||
@@ -74,6 +79,8 @@ public class CallResponse {
|
|||||||
private String currentStep;
|
private String currentStep;
|
||||||
|
|
||||||
private Long preferredCallId;
|
private Long preferredCallId;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
public class EvaluatedApplication {
|
||||||
|
|
||||||
|
public Long evaluatedApplication;
|
||||||
|
|
||||||
|
private BigDecimal dailyAverage;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EvaluationFormResponseBean {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String callStatus;
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private Long callId;
|
||||||
|
|
||||||
|
private List<ContentResponseBean> content;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GetAllAmendmentResponseBean {
|
||||||
|
private Long id;
|
||||||
|
private String callEmail;
|
||||||
|
private String note;
|
||||||
|
private Long responseDays;
|
||||||
|
private LocalDateTime startDate;
|
||||||
|
private Boolean isSendNotification;
|
||||||
|
private Boolean isSendEmail;
|
||||||
|
private Long protocolNumber;
|
||||||
|
private String callName;
|
||||||
|
private String beneficiaryName;
|
||||||
|
private String companyName;
|
||||||
|
private String amendmentNotes;
|
||||||
|
private Long applicationId;
|
||||||
|
private Long applicationEvaluationId;
|
||||||
|
private LocalDateTime evaluationEndDate;
|
||||||
|
private LocalDateTime expirationDate;
|
||||||
|
private String internalNote;
|
||||||
|
private ApplicationAmendmentRequestEnum status;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
public class PreInstructorWidgetResponseBean {
|
||||||
|
|
||||||
|
private ApplicationToConsider assignedApplication;
|
||||||
|
|
||||||
|
private EvaluatedApplication evaluatedApplication;
|
||||||
|
|
||||||
|
private AverageEvaluationTime averageEvaluationDays;
|
||||||
|
|
||||||
|
private RescueInstructorInProgress amendmentInProgress;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
public class RescueInstructorInProgress {
|
||||||
|
|
||||||
|
private Long totalAmendmentInProgress;
|
||||||
|
|
||||||
|
private Long expiringToday;
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -57,7 +59,7 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
|
|||||||
|
|
||||||
@Query("SELECT a FROM ApplicationAmendmentRequestEntity a " +
|
@Query("SELECT a FROM ApplicationAmendmentRequestEntity a " +
|
||||||
"WHERE a.isDeleted = false " +
|
"WHERE a.isDeleted = false " +
|
||||||
"AND a.status <> 'CLOSE' " +
|
"AND a.status NOT IN('CLOSE','EXPIRED') " +
|
||||||
"AND a.endDate < :currentTime")
|
"AND a.endDate < :currentTime")
|
||||||
List<ApplicationAmendmentRequestEntity> findAmendmentsDueForExpiration(LocalDateTime currentTime);
|
List<ApplicationAmendmentRequestEntity> findAmendmentsDueForExpiration(LocalDateTime currentTime);
|
||||||
|
|
||||||
@@ -70,7 +72,7 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
|
|||||||
"AND NOT EXISTS ( " +
|
"AND NOT EXISTS ( " +
|
||||||
" SELECT 1 FROM ApplicationAmendmentRequestEntity activeAmendment" +
|
" SELECT 1 FROM ApplicationAmendmentRequestEntity activeAmendment" +
|
||||||
" WHERE activeAmendment.applicationEvaluationEntity.id = a.applicationEvaluationEntity.id " +
|
" WHERE activeAmendment.applicationEvaluationEntity.id = a.applicationEvaluationEntity.id " +
|
||||||
" AND activeAmendment.status <> 'CLOSE' " +
|
" AND activeAmendment.status NOT IN('CLOSE','EXPIRED') " +
|
||||||
" AND activeAmendment.isDeleted = false) ")
|
" AND activeAmendment.isDeleted = false) ")
|
||||||
Set<ApplicationEvaluationEntity> findEvaluationsWithoutActiveAmendmentsByIds(@Param("applicationEvaluationIds") Set<Long> applicationEvaluationIds);
|
Set<ApplicationEvaluationEntity> findEvaluationsWithoutActiveAmendmentsByIds(@Param("applicationEvaluationIds") Set<Long> applicationEvaluationIds);
|
||||||
|
|
||||||
@@ -80,4 +82,72 @@ public interface ApplicationAmendmentRequestRepository extends JpaRepository<App
|
|||||||
"AND a.endDate BETWEEN :startTime AND :endTime")
|
"AND a.endDate BETWEEN :startTime AND :endTime")
|
||||||
List<ApplicationAmendmentRequestEntity> findExpiringBetween(LocalDateTime startTime, LocalDateTime endTime);
|
List<ApplicationAmendmentRequestEntity> findExpiringBetween(LocalDateTime startTime, LocalDateTime endTime);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(a) FROM ApplicationAmendmentRequestEntity a WHERE a.applicationId IN :applicationIds AND a.isDeleted = false")
|
||||||
|
Long countAmendmentsByApplicationIds(@Param("applicationIds") List<Long> applicationIds);
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(a) FROM ApplicationAmendmentRequestEntity a WHERE a.applicationId IN :applicationIds AND a.status = :status AND a.isDeleted = false")
|
||||||
|
Long countAmendmentsByApplicationIdsAndStatus(@Param("applicationIds") List<Long> applicationIds, @Param("status") String status);
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT e
|
||||||
|
FROM ApplicationAmendmentRequestEntity e
|
||||||
|
WHERE e.applicationId IN :applicationIds
|
||||||
|
AND e.status IN :statuses
|
||||||
|
AND e.isDeleted = false
|
||||||
|
""")
|
||||||
|
List<ApplicationAmendmentRequestEntity> findAllByApplicationIdsAndStatuses(
|
||||||
|
@Param("applicationIds") List<Long> applicationIds,
|
||||||
|
@Param("statuses") List<String> statuses
|
||||||
|
);
|
||||||
|
List<ApplicationAmendmentRequestEntity> findAllByApplicationIdInAndStatusAndIsDeletedFalse(List<Long> applicationIds, String status);
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT COALESCE(AVG(TIMESTAMPDIFF(DAY, a.startDate, a.closingDate)), 0)
|
||||||
|
FROM ApplicationAmendmentRequestEntity a
|
||||||
|
WHERE a.applicationId IN :applicationIds
|
||||||
|
AND a.status = :status
|
||||||
|
AND a.isDeleted = false
|
||||||
|
AND a.closingDate IS NOT NULL
|
||||||
|
""")
|
||||||
|
BigDecimal findAverageResponseDaysByApplicationIdsAndStatus(
|
||||||
|
@Param("applicationIds") List<Long> applicationIds,
|
||||||
|
@Param("status") String status
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(value = """
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM {h-schema}application_amendment_request e
|
||||||
|
WHERE e.application_id IN :applicationIds
|
||||||
|
AND e.status IN :statuses
|
||||||
|
AND e.start_date + INTERVAL '1 DAY' * e.response_days <= :endDate
|
||||||
|
AND e.start_date + INTERVAL '1 DAY' * e.response_days >= :startDate
|
||||||
|
AND e.is_deleted = false
|
||||||
|
""", nativeQuery = true)
|
||||||
|
Long countExpiringRequestsIn48Hours(
|
||||||
|
@Param("applicationIds") List<Long> applicationIds,
|
||||||
|
@Param("statuses") List<String> statuses,
|
||||||
|
@Param("startDate") LocalDateTime startDate,
|
||||||
|
@Param("endDate") LocalDateTime endDate
|
||||||
|
);
|
||||||
|
@Query(value = """
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM {h-schema}application_amendment_request e
|
||||||
|
WHERE e.application_id IN :applicationIds
|
||||||
|
AND e.status IN :statuses
|
||||||
|
AND e.start_date + INTERVAL '1 DAY' * e.response_days >= :startOfDay
|
||||||
|
AND e.start_date + INTERVAL '1 DAY' * e.response_days < :endOfDay
|
||||||
|
AND e.is_deleted = false
|
||||||
|
""", nativeQuery = true)
|
||||||
|
Long countAmendmentsExpiringToday(
|
||||||
|
@Param("applicationIds") List<Long> applicationIds,
|
||||||
|
@Param("statuses") List<String> statuses,
|
||||||
|
@Param("startOfDay") LocalDateTime startOfDay,
|
||||||
|
@Param("endOfDay") LocalDateTime endOfDay
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(a) FROM ApplicationAmendmentRequestEntity a WHERE a.applicationId IN :applicationIds AND a.status IN :statuses AND a.isDeleted = false")
|
||||||
|
Long countAmendmentsByApplicationIds(@Param("applicationIds") List<Long> applicationIds, @Param("statuses") List<String> statuses);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationEvaluationFormFieldEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface ApplicationEvaluationFormFieldRepository extends JpaRepository<ApplicationEvaluationFormFieldEntity,Long> {
|
||||||
|
@Query("SELECT f FROM ApplicationEvaluationFormFieldEntity f " +
|
||||||
|
"WHERE f.applicationEvaluationForm.id = :applicationEvaluationFormId " +
|
||||||
|
"AND f.isDeleted = false")
|
||||||
|
List<ApplicationEvaluationFormFieldEntity> findByApplicationEvaluationFormId(
|
||||||
|
@Param("applicationEvaluationFormId") Long applicationEvaluationFormId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationEvaluationFormEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface ApplicationEvaluationFormRepository extends JpaRepository<ApplicationEvaluationFormEntity,Long> {
|
||||||
|
|
||||||
|
@Query("SELECT a FROM ApplicationEvaluationFormEntity a " +
|
||||||
|
"WHERE a.applicationEvaluation.id = :evaluationId " +
|
||||||
|
"AND a.evaluationForm.id = :evaluationFormId " +
|
||||||
|
"AND a.isDeleted = false")
|
||||||
|
ApplicationEvaluationFormEntity findByEvaluationIdAndEvaluationFormId(
|
||||||
|
@Param("evaluationId") Long evaluationId,
|
||||||
|
@Param("evaluationFormId") Long evaluationFormId);
|
||||||
|
|
||||||
|
ApplicationEvaluationFormEntity findByApplicationEvaluation_IdAndIsDeletedFalse(Long evaluationId);
|
||||||
|
}
|
||||||
@@ -21,6 +21,9 @@ public interface ApplicationEvaluationRepository extends JpaRepository<Applicati
|
|||||||
Optional<ApplicationEvaluationEntity> findByIdAndIsDeletedFalse(Long id);
|
Optional<ApplicationEvaluationEntity> findByIdAndIsDeletedFalse(Long id);
|
||||||
Optional<ApplicationEvaluationEntity> findByAssignedApplicationsEntity_IdAndIsDeletedFalse(Long assignedApplicationId);
|
Optional<ApplicationEvaluationEntity> findByAssignedApplicationsEntity_IdAndIsDeletedFalse(Long assignedApplicationId);
|
||||||
|
|
||||||
|
@Query("SELECT ae FROM ApplicationEvaluationEntity ae WHERE ae.assignedApplicationsEntity.id = :assignedApplicationId AND ae.isDeleted = false")
|
||||||
|
ApplicationEvaluationEntity findByAssignedApplicationsId(Long assignedApplicationId);
|
||||||
|
|
||||||
Optional<ApplicationEvaluationEntity> findByApplicationIdAndAssignedApplicationsEntity_IdAndIsDeletedFalse(Long applicationId, Long assignedApplicationId);
|
Optional<ApplicationEvaluationEntity> findByApplicationIdAndAssignedApplicationsEntity_IdAndIsDeletedFalse(Long applicationId, Long assignedApplicationId);
|
||||||
|
|
||||||
Optional<ApplicationEvaluationEntity> findFirstByIsDeletedFalseOrderByCreatedDateDesc();
|
Optional<ApplicationEvaluationEntity> findFirstByIsDeletedFalseOrderByCreatedDateDesc();
|
||||||
@@ -32,7 +35,7 @@ public interface ApplicationEvaluationRepository extends JpaRepository<Applicati
|
|||||||
"WHERE aar.id = :evaluationId AND aar.isDeleted = false)")
|
"WHERE aar.id = :evaluationId AND aar.isDeleted = false)")
|
||||||
ApplicationEntity findApplicationByEvaluationId(Long evaluationId);
|
ApplicationEntity findApplicationByEvaluationId(Long evaluationId);
|
||||||
|
|
||||||
@Query("SELECT a FROM ApplicationEvaluationEntity a WHERE a.isDeleted = false AND a.endDate < :currentDate")
|
@Query("SELECT a FROM ApplicationEvaluationEntity a WHERE a.isDeleted = false AND a.status = 'OPEN' AND a.endDate < :currentDate")
|
||||||
List<ApplicationEvaluationEntity> findAllByIsDeletedFalseAndEndDateBefore(@Param("currentDate") LocalDateTime currentDate);
|
List<ApplicationEvaluationEntity> findAllByIsDeletedFalseAndEndDateBefore(@Param("currentDate") LocalDateTime currentDate);
|
||||||
|
|
||||||
@Query("SELECT a FROM ApplicationEvaluationEntity a " +
|
@Query("SELECT a FROM ApplicationEvaluationEntity a " +
|
||||||
@@ -55,11 +58,22 @@ public interface ApplicationEvaluationRepository extends JpaRepository<Applicati
|
|||||||
WHERE e.applicationId IN :applicationIds
|
WHERE e.applicationId IN :applicationIds
|
||||||
AND FUNCTION('DATE', e.endDate) BETWEEN :startDate AND :endDate
|
AND FUNCTION('DATE', e.endDate) BETWEEN :startDate AND :endDate
|
||||||
AND e.isDeleted = false
|
AND e.isDeleted = false
|
||||||
|
AND e.status IN :statusList
|
||||||
""")
|
""")
|
||||||
Long countDueApplicationsBetween(
|
Long countDueApplicationsBetween(
|
||||||
@Param("applicationIds") List<Long> applicationIds,
|
@Param("applicationIds") List<Long> applicationIds,
|
||||||
@Param("startDate") LocalDate startDate,
|
@Param("startDate") LocalDate startDate,
|
||||||
@Param("endDate") LocalDate endDate
|
@Param("endDate") LocalDate endDate,
|
||||||
|
@Param("statusList") List<String> statusList
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query("SELECT ae FROM ApplicationEvaluationEntity ae " +
|
||||||
|
"WHERE ae.isDeleted = false " +
|
||||||
|
"AND (:applicationId IS NULL OR ae.applicationId = :applicationId) " +
|
||||||
|
"AND (:assignedApplicationId IS NULL OR ae.assignedApplicationsEntity.id = :assignedApplicationId)")
|
||||||
|
ApplicationEvaluationEntity findByApplicationIdAndAssignedApplicationId(
|
||||||
|
@Param("applicationId") Long applicationId,
|
||||||
|
@Param("assignedApplicationId") Long assignedApplicationId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import org.springframework.data.repository.query.Param;
|
|||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -92,5 +94,72 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
|||||||
@Query("SELECT a.id FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.isDeleted = false")
|
@Query("SELECT a.id FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.isDeleted = false")
|
||||||
List<Long> findApplicationIdsByHubId(@Param("hubId") Long hubId);
|
List<Long> findApplicationIdsByHubId(@Param("hubId") Long hubId);
|
||||||
|
|
||||||
|
@Query("SELECT CASE WHEN COUNT(CASE WHEN a.submissionDate IS NOT NULL THEN 1 ELSE NULL END) > 0 THEN " +
|
||||||
|
"CAST((SUM(CASE WHEN a.status = 'APPROVED' THEN 1 ELSE 0 END) * 100.0) / " +
|
||||||
|
"COUNT(CASE WHEN a.submissionDate IS NOT NULL THEN 1 ELSE NULL END) AS BigDecimal) " +
|
||||||
|
"ELSE CAST(0 AS BigDecimal) END " +
|
||||||
|
"FROM ApplicationEntity a " +
|
||||||
|
"WHERE a.hubId = :hubId AND a.userId = :userId AND a.userWithCompany.id = :userWithCompanyId " +
|
||||||
|
"AND a.isDeleted = false")
|
||||||
|
BigDecimal findSuccessRateByHubIdAndUserIdAndUserWithCompanyId(
|
||||||
|
@Param("hubId") Long hubId,
|
||||||
|
@Param("userId") Long userId,
|
||||||
|
@Param("userWithCompanyId") Long userWithCompanyId);
|
||||||
|
|
||||||
|
|
||||||
|
@Query("SELECT a.status, COUNT(a.id) FROM ApplicationEntity a WHERE a.isDeleted = false AND a.userId = :userId AND a.userWithCompany.id = :userWithCompanyId AND a.call.hub.id = :hubId GROUP BY a.status")
|
||||||
|
List<Object[]> findApplicationsByStatusAndUserIdAndUserWithCompanyId(@Param("hubId") Long hubId,
|
||||||
|
@Param("userId") Long userId,
|
||||||
|
@Param("userWithCompanyId") Long userWithCompanyId);
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT TO_CHAR(a.submissionDate, 'Mon') AS month,
|
||||||
|
SUM(a.amountRequested) AS totalRequested,
|
||||||
|
SUM(a.amountAccepted) AS totalApproved
|
||||||
|
FROM ApplicationEntity a
|
||||||
|
WHERE a.isDeleted = false
|
||||||
|
AND a.status = 'APPROVED'
|
||||||
|
AND a.call.hub.id = :hubId
|
||||||
|
AND a.userId = :userId
|
||||||
|
AND a.userWithCompany.id = :userWithCompanyId
|
||||||
|
GROUP BY TO_CHAR(a.submissionDate, 'Mon'), EXTRACT(YEAR FROM a.submissionDate), EXTRACT(MONTH FROM a.submissionDate)
|
||||||
|
ORDER BY EXTRACT(YEAR FROM a.submissionDate), EXTRACT(MONTH FROM a.submissionDate)
|
||||||
|
""")
|
||||||
|
List<Object[]> findRequestedVsApprovedAmountsPerMonth(
|
||||||
|
@Param("hubId") Long hubId,
|
||||||
|
@Param("userId") Long userId,
|
||||||
|
@Param("userWithCompanyId") Long userWithCompanyId
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(a) FROM ApplicationEntity a " +
|
||||||
|
"WHERE a.hubId = :hubId " +
|
||||||
|
"AND a.userId = :userId " +
|
||||||
|
"AND a.userWithCompany.id = :userWithCompanyId " +
|
||||||
|
"AND a.isDeleted = false " +
|
||||||
|
"AND a.status IN :statusList " +
|
||||||
|
"AND a.submissionDate IS NOT NULL")
|
||||||
|
Long countSubmittedApplicationsByHubIdAndUserId(
|
||||||
|
@Param("hubId") Long hubId,
|
||||||
|
@Param("userId") Long userId,
|
||||||
|
@Param("userWithCompanyId") Long userWithCompanyId,
|
||||||
|
@Param("statusList") List<String> statusList
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(a) FROM ApplicationEntity a " +
|
||||||
|
"WHERE a.hubId = :hubId " +
|
||||||
|
"AND a.userId = :userId " +
|
||||||
|
"AND a.userWithCompany.id = :userWithCompanyId " +
|
||||||
|
"AND a.status = :status " +
|
||||||
|
"AND a.isDeleted = false")
|
||||||
|
Long countSubmittedApplicationsByHubIdAndUserIdAndStatus(
|
||||||
|
@Param("hubId") Long hubId,
|
||||||
|
@Param("userId") Long userId,
|
||||||
|
@Param("userWithCompanyId") Long userWithCompanyId,
|
||||||
|
@Param("status") String status);
|
||||||
|
@Query("SELECT SUM(a.amountAccepted) FROM ApplicationEntity a WHERE a.hubId = :hubId AND a.userId = :userId AND a.status = 'APPROVED' AND a.userWithCompany.id = :userWithCompanyId AND a.isDeleted = false")
|
||||||
|
BigDecimal sumAmountRequestedByHubIdAndUserId(@Param("hubId") Long hubId, @Param("userId") Long userId, @Param("userWithCompanyId") Long userWithCompanyId);
|
||||||
|
|
||||||
|
List<ApplicationEntity> findByUserIdAndUserWithCompany_IdAndCall_IdAndIsDeletedFalseAndStatusNot(
|
||||||
|
Long userId, Long userWithCompanyId, Long callId, String status
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import org.springframework.data.jpa.repository.Query;
|
|||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -22,4 +24,90 @@ public interface AssignedApplicationsRepository extends JpaRepository<AssignedAp
|
|||||||
|
|
||||||
@Query("SELECT COUNT(aa) FROM AssignedApplicationsEntity aa WHERE aa.isDeleted = false AND aa.userId = :userId AND aa.status <> 'CLOSE'")
|
@Query("SELECT COUNT(aa) FROM AssignedApplicationsEntity aa WHERE aa.isDeleted = false AND aa.userId = :userId AND aa.status <> 'CLOSE'")
|
||||||
Long countAssignedApplicationsByUserId(@Param("userId") Long userId);
|
Long countAssignedApplicationsByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
@Query("SELECT aa.application.id FROM AssignedApplicationsEntity aa WHERE aa.isDeleted = false AND aa.userId = :userId")
|
||||||
|
List<Long> findApplicationIdsByUserIdAndIsDeletedFalse(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(a) FROM AssignedApplicationsEntity a WHERE a.application.id IN :applicationIds AND a.status IN :statuses AND a.isDeleted = false")
|
||||||
|
Long countAssignedApplicationsByApplicationIds(@Param("applicationIds") List<Long> applicationIds, @Param("statuses") List<String> statuses);
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT COUNT(aa)
|
||||||
|
FROM AssignedApplicationsEntity aa
|
||||||
|
JOIN aa.application a
|
||||||
|
WHERE a.hubId = :hubId
|
||||||
|
AND a.isDeleted = false
|
||||||
|
AND aa.status IN :statuses
|
||||||
|
AND aa.createdDate >= :yesterday
|
||||||
|
AND aa.isDeleted = false
|
||||||
|
AND (:applicationIds IS NULL OR aa.application.id IN :applicationIds)
|
||||||
|
""")
|
||||||
|
Long countApplicationsAddedYesterdayForHub(@Param("applicationIds") List<Long> applicationIds, @Param("hubId") Long hubId, @Param("yesterday") LocalDateTime yesterday, @Param("statuses") List<String> statuses);
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(a) FROM AssignedApplicationsEntity a WHERE a.application.id IN :applicationIds AND a.status = :status AND a.isDeleted = false")
|
||||||
|
Long countApplicationsByIdsAndStatus(@Param("applicationIds") List<Long> applicationIds, @Param("status") String status);
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT
|
||||||
|
COALESCE(COUNT(a.id), 0) AS totalAssigned,
|
||||||
|
COALESCE(SUM(CASE WHEN a.status = 'SOCCORSO' THEN 1 ELSE 0 END), 0) AS amendmentCount,
|
||||||
|
COALESCE(SUM(CASE WHEN a.status = 'OPEN' THEN 1 ELSE 0 END), 0) AS openCount,
|
||||||
|
COALESCE(SUM(CASE WHEN a.status = 'CLOSE' THEN 1 ELSE 0 END), 0) AS closeCount
|
||||||
|
FROM AssignedApplicationsEntity a
|
||||||
|
JOIN a.application app
|
||||||
|
WHERE a.isDeleted = false
|
||||||
|
AND a.userId = :userId
|
||||||
|
AND app.isDeleted = false
|
||||||
|
AND app.hubId = :hubId
|
||||||
|
""")
|
||||||
|
Object[] countAssignedApplicationsWithStatus(
|
||||||
|
@Param("userId") Long userId,
|
||||||
|
@Param("hubId") Long hubId
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT
|
||||||
|
COALESCE(COUNT(a.id), 0) AS totalAssigned,
|
||||||
|
COALESCE(SUM(CASE WHEN a.status = 'SOCCORSO' THEN 1 ELSE 0 END), 0) AS amendmentCount,
|
||||||
|
COALESCE(SUM(CASE WHEN a.status = 'OPEN' THEN 1 ELSE 0 END), 0) AS openCount,
|
||||||
|
COALESCE(SUM(CASE WHEN a.status = 'CLOSE' THEN 1 ELSE 0 END), 0) AS closeCount
|
||||||
|
FROM AssignedApplicationsEntity a
|
||||||
|
JOIN a.application app
|
||||||
|
WHERE a.isDeleted = false
|
||||||
|
AND app.isDeleted = false
|
||||||
|
AND app.hubId = :hubId
|
||||||
|
""")
|
||||||
|
Object[] countAssignedApplicationsForHub(@Param("hubId") Long hubId);
|
||||||
|
|
||||||
|
@Query("SELECT aa.application.id FROM AssignedApplicationsEntity aa " +
|
||||||
|
"WHERE aa.userId = :userId AND aa.application.hubId = :hubId AND aa.isDeleted = false")
|
||||||
|
List<Long> findApplicationIdsByUserIdAndHubIdAndIsDeletedFalse(@Param("userId") Long userId, @Param("hubId") Long hubId);
|
||||||
|
|
||||||
|
@Query("SELECT aa.application.id FROM AssignedApplicationsEntity aa " +
|
||||||
|
"WHERE aa.application.hubId = :hubId AND aa.isDeleted = false")
|
||||||
|
List<Long> findApplicationIdsByHubId(@Param("hubId") Long hubId);
|
||||||
|
@Query(" SELECT COUNT(aa) FROM AssignedApplicationsEntity aa " +
|
||||||
|
"JOIN aa.application a " +
|
||||||
|
"WHERE a.status IN :statuses " +
|
||||||
|
"AND a.isDeleted = false " +
|
||||||
|
"AND a.updatedDate >= :sevenDaysAgo " +
|
||||||
|
"AND aa.status = 'CLOSE'" +
|
||||||
|
"AND aa.isDeleted = false " +
|
||||||
|
" AND (:applicationIds IS NULL OR aa.application.id IN :applicationIds) ")
|
||||||
|
Long countEvaluatedApplicationsInLast7Days(@Param("applicationIds") List<Long> applicationIds,
|
||||||
|
@Param("statuses") List<String> statuses,
|
||||||
|
@Param("sevenDaysAgo") LocalDateTime sevenDaysAgo);
|
||||||
|
@Query("SELECT (COUNT(a) / 7.0) FROM AssignedApplicationsEntity aa " +
|
||||||
|
"JOIN aa.application a " +
|
||||||
|
"WHERE a.status IN :statuses " +
|
||||||
|
"AND a.isDeleted = false " +
|
||||||
|
"AND a.updatedDate >= :sevenDaysAgo " +
|
||||||
|
"AND aa.status = 'CLOSE'" +
|
||||||
|
"AND aa.isDeleted = false " +
|
||||||
|
"AND (:applicationIds IS NULL OR aa.application.id IN :applicationIds)")
|
||||||
|
BigDecimal countDailyAverageEvaluatedApplicationsInLast7Days(@Param("applicationIds") List<Long> applicationIds,
|
||||||
|
@Param("statuses") List<String> statuses,
|
||||||
|
@Param("sevenDaysAgo") LocalDateTime sevenDaysAgo);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.EvaluationFormEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
@Repository
|
||||||
|
public interface EvaluationFormRepository extends JpaRepository<EvaluationFormEntity,Long> {
|
||||||
|
|
||||||
|
EvaluationFormEntity findByCallIdAndIsDeletedFalse(Long callId);
|
||||||
|
EvaluationFormEntity findByIdAndIsDeletedFalse(Long formId);
|
||||||
|
List<EvaluationFormEntity> findByIdInAndIsDeletedFalse(List<Long> evaluationFormId);
|
||||||
|
}
|
||||||
@@ -14,4 +14,7 @@ public interface SystemEmailTemplatesRespository extends JpaRepository<SystemEma
|
|||||||
@Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.isDeleted =false and s.system = true")
|
@Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.isDeleted =false and s.system = true")
|
||||||
SystemEmailTemplatesEntity findByType(@Param("type") String type);
|
SystemEmailTemplatesEntity findByType(@Param("type") String type);
|
||||||
|
|
||||||
|
@Query("select s from SystemEmailTemplatesEntity s where s.type=:type and s.hubEntity.id=:hubId and s.isDeleted =false and s.system = false")
|
||||||
|
SystemEmailTemplatesEntity findByTypeAndHubEntityId(@Param("type") String type, @Param("hubId") Long hubId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class ApplicationEvaluationScheduler {
|
|||||||
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_EXPIRED);
|
Map<String, String> placeHolders = notificationDao.sendNotificationToBeneficiary(application, NotificationTypeEnum.EVALUATION_EXPIRED);
|
||||||
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_EXPIRED);
|
notificationDao.sendNotificationToSuperUser(application,placeHolders,NotificationTypeEnum.EVALUATION_EXPIRED);
|
||||||
notificationDao.sendNotificationToInstructor(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED);
|
notificationDao.sendNotificationToInstructor(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED);
|
||||||
|
notificationDao.sendNotificationToInstructorManager(placeHolders,evaluation,NotificationTypeEnum.EVALUATION_EXPIRED);
|
||||||
|
|
||||||
// Logging version history for the update operation
|
// Logging version history for the update operation
|
||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(httpServletRequest)
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(httpServletRequest)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBea
|
|||||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ public interface ApplicationAmendmentRequestService {
|
|||||||
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest);
|
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest);
|
||||||
void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id);
|
void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id);
|
||||||
ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
|
ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
|
||||||
List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(HttpServletRequest request,Long userId);
|
List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId);
|
||||||
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
||||||
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);
|
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);
|
||||||
List<ApplicationAmendmentRequestResponse> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request,Long beneficiaryId);
|
List<ApplicationAmendmentRequestResponse> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request,Long beneficiaryId);
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ package net.gepafin.tendermanagement.service;
|
|||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||||
|
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
|
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -21,4 +24,10 @@ public interface ApplicationEvaluationService {
|
|||||||
|
|
||||||
ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId);
|
ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId);
|
||||||
|
|
||||||
|
ApplicationEvaluationFormResponse createApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationFormRequestBean applicationEvaluationFormRequestBean, Long evaluationId, Long evaluationFormId);
|
||||||
|
|
||||||
|
ApplicationEvaluationFormResponse getApplicationEvaluationForm(HttpServletRequest request, Long applicationId, Long assignedApplicationId);
|
||||||
|
|
||||||
|
ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package net.gepafin.tendermanagement.service;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationPageableRequestBean;
|
import net.gepafin.tendermanagement.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.AssignedApplicationsRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
@@ -17,9 +19,10 @@ public interface AssignedApplicationsService {
|
|||||||
|
|
||||||
void deleteApplication(HttpServletRequest request, Long id);
|
void deleteApplication(HttpServletRequest request, Long id);
|
||||||
|
|
||||||
List<AssignedApplicationsResponse> getAllAssignedApplications(HttpServletRequest request, Long userId);
|
List<AssignedApplicationsResponse> getAllAssignedApplications(HttpServletRequest request, Long userId,List<AssignedApplicationEnum> statusList);
|
||||||
AssignedApplicationsResponse updateAssignedApplication(HttpServletRequest request, Long id, UpdateAssignedApplicationRequest assignedApplicationsRequest);
|
AssignedApplicationsResponse updateAssignedApplication(HttpServletRequest request, Long id, UpdateAssignedApplicationRequest assignedApplicationsRequest);
|
||||||
AssignedApplicationsResponse getAssignedApplicationById(HttpServletRequest request, Long id);
|
AssignedApplicationsResponse getAssignedApplicationById(HttpServletRequest request, Long id);
|
||||||
AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId);
|
AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId);
|
||||||
PageableResponseBean<List<AssignedApplicationsResponse>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean);
|
PageableResponseBean<List<AssignedApplicationsResponse>> getAllAssignedApplicationsByPagination(HttpServletRequest request, Long userId, AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean);
|
||||||
|
AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,17 +5,15 @@ import java.util.List;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.CallPageableRequestBean;
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep1;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep2;
|
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateCallRequestStep1;
|
|
||||||
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
|
|
||||||
public interface CallService {
|
public interface CallService {
|
||||||
|
|
||||||
CallResponse createCallStep1(HttpServletRequest request, CreateCallRequestStep1 createCallRequest);
|
CallResponse createCallStep1(HttpServletRequest request, CreateCallRequestStep1 createCallRequest );
|
||||||
|
|
||||||
CallResponse createCallStep2(HttpServletRequest request, Long callId, CreateCallRequestStep2 createCallRequest);
|
CallResponse createCallStep2(HttpServletRequest request, Long callId, CreateCallRequestStep2 createCallRequest);
|
||||||
|
|
||||||
@@ -37,4 +35,6 @@ public interface CallService {
|
|||||||
|
|
||||||
PageableResponseBean<List<CallDetailsResponseBean>> getAllCallsByPagination(HttpServletRequest request, Long companyId , Boolean onlyPreferredCall,CallPageableRequestBean callPageableRequestBean);
|
PageableResponseBean<List<CallDetailsResponseBean>> getAllCallsByPagination(HttpServletRequest request, Long companyId , Boolean onlyPreferredCall,CallPageableRequestBean callPageableRequestBean);
|
||||||
|
|
||||||
|
CallResponse createCallStep2EvaluationV2(HttpServletRequest request, Long callId, CreateCallRequestStep2EvaluationV2 createCallRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package net.gepafin.tendermanagement.service;
|
package net.gepafin.tendermanagement.service;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
||||||
|
|
||||||
@@ -11,4 +14,10 @@ public interface DashboardService {
|
|||||||
|
|
||||||
public BeneficiaryWidgetResponseBean getDashboardWidgetForBeneficiary(HttpServletRequest request, Long companyId);
|
public BeneficiaryWidgetResponseBean getDashboardWidgetForBeneficiary(HttpServletRequest request, Long companyId);
|
||||||
public ApplicationWidgetResponseBean getApplicationDetails(HttpServletRequest request);
|
public ApplicationWidgetResponseBean getApplicationDetails(HttpServletRequest request);
|
||||||
|
public AmendmentWidgetResponseBean getAmendmentDetails(HttpServletRequest request);
|
||||||
|
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request,Long userId);
|
||||||
|
public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(HttpServletRequest request);
|
||||||
|
|
||||||
|
public BeneficiaryStatisticsResponseBean getStatisticsPageForBeneficiary(HttpServletRequest request,Long companyId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package net.gepafin.tendermanagement.service;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.EvaluationFormEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.FormEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.ApplicationFormFieldRequestBean;
|
||||||
|
import net.gepafin.tendermanagement.model.request.EvaluationFormRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface EvaluationFormService {
|
||||||
|
|
||||||
|
public EvaluationFormResponseBean createEvaluationForm(HttpServletRequest request, Long callId, EvaluationFormRequest formRequest);
|
||||||
|
|
||||||
|
public EvaluationFormResponseBean updateEvaluationForm(HttpServletRequest request, Long evaluationFormId, EvaluationFormRequest formRequest);
|
||||||
|
|
||||||
|
public EvaluationFormResponseBean getEvaluationFormById(HttpServletRequest request, Long evaluationFormId);
|
||||||
|
|
||||||
|
public void deleteEvaluationForm(HttpServletRequest request, Long evaluationFormId);
|
||||||
|
|
||||||
|
public EvaluationFormEntity validateEvaluationForm(Long id);
|
||||||
|
|
||||||
|
public EvaluationFormResponseBean getEvaluationFormByCallId(HttpServletRequest request, Long callId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -49,4 +49,6 @@ public interface UserService {
|
|||||||
List<UserResponseBean> getAllUsers(HttpServletRequest request, List<Long> roleIds);
|
List<UserResponseBean> getAllUsers(HttpServletRequest request, List<Long> roleIds);
|
||||||
|
|
||||||
PageableResponseBean<List<UserResponseBean>> getUserByPagination(HttpServletRequest request, UserPaginationRequestBean userPaginationRequestBean);
|
PageableResponseBean<List<UserResponseBean>> getUserByPagination(HttpServletRequest request, UserPaginationRequestBean userPaginationRequestBean);
|
||||||
|
UserResponseBean updateUserDetails(HttpServletRequest request, Long userId, UpdateUserReqForBeneficiary userReq);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBea
|
|||||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
||||||
@@ -85,8 +86,7 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(HttpServletRequest request,Long userId) {
|
public List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId) {
|
||||||
UserEntity user = validator.validatePreInstructor(request, userId);
|
|
||||||
return applicationAmendmentRequestDao.getAllApplicationAmendmentRequest(request,userId);
|
return applicationAmendmentRequestDao.getAllApplicationAmendmentRequest(request,userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,18 @@ package net.gepafin.tendermanagement.service.impl;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.dao.ApplicationEvaluationDao;
|
import net.gepafin.tendermanagement.dao.ApplicationEvaluationDao;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
||||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
|
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationFormResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationVersionResponse;
|
||||||
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
|
import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
|
||||||
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -34,6 +37,9 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEvaluationService applicationEvaluationService;
|
private ApplicationEvaluationService applicationEvaluationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationService applicationService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(
|
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(
|
||||||
@@ -78,4 +84,27 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
|||||||
return applicationEvaluationDao.validateApplicationEvaluationByApplicationId(applicationId);
|
return applicationEvaluationDao.validateApplicationEvaluationByApplicationId(applicationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ApplicationEvaluationFormResponse createApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationFormRequestBean applicationEvaluationFormRequestBean, Long assignedApplicationId, Long evaluationFormId) {
|
||||||
|
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplicationsService.validateAssignedApplication(assignedApplicationId);
|
||||||
|
validator.validatePreInstructor(request, assignedApplicationsEntity.getUserId());
|
||||||
|
return applicationEvaluationDao.createApplicationEvaluation(request,applicationEvaluationFormRequestBean,evaluationFormId,assignedApplicationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public ApplicationEvaluationFormResponse getApplicationEvaluationForm(HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
return applicationEvaluationDao.getApplicationEvaluationForm(request,applicationId,assignedApplicationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApplicationEvaluationVersionResponse getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
return applicationEvaluationDao.getApplicationEvaluationVersion(request,applicationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import net.gepafin.tendermanagement.dao.AssignedApplicationsDao;
|
|||||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationPageableRequestBean;
|
import net.gepafin.tendermanagement.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.AssignedApplicationsRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
@@ -42,8 +44,8 @@ public class AssignedApplicationsServiceImpl implements AssignedApplicationsServ
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<AssignedApplicationsResponse> getAllAssignedApplications(HttpServletRequest request, Long userId) {
|
public List<AssignedApplicationsResponse> getAllAssignedApplications(HttpServletRequest request, Long userId,List<AssignedApplicationEnum> statusList) {
|
||||||
return assignedApplicationsDao.getAllAssignedApplications(request, userId);
|
return assignedApplicationsDao.getAllAssignedApplications(request, userId,statusList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,4 +71,8 @@ public class AssignedApplicationsServiceImpl implements AssignedApplicationsServ
|
|||||||
return assignedApplicationsDao.getAllAssignedApplicationsByPagination(user,assignedApplicationPageableRequestBean,userId);
|
return assignedApplicationsDao.getAllAssignedApplicationsByPagination(user,assignedApplicationPageableRequestBean,userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AssignedApplicationsResponse updateAssignedApplicationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedApplicationEnum status) {
|
||||||
|
return assignedApplicationsDao.updateAssignedApplicationStatus(request, assignedApplicationId, status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ import net.gepafin.tendermanagement.dao.CallDao;
|
|||||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.CallPageableRequestBean;
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep1;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep2;
|
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateCallRequestStep1;
|
|
||||||
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
@@ -110,5 +108,11 @@ public class CallServiceImpl implements CallService {
|
|||||||
UserEntity user = validator.validateUser(request);
|
UserEntity user = validator.validateUser(request);
|
||||||
return callDao.getAllCallsByPagination(request,user,companyId,onlyPreferredCall,callPageableRequestBean);
|
return callDao.getAllCallsByPagination(request,user,companyId,onlyPreferredCall,callPageableRequestBean);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public CallResponse createCallStep2EvaluationV2(HttpServletRequest request, Long callId, CreateCallRequestStep2EvaluationV2 createCallRequest) {
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
CallEntity call = validator.validateUserWithCall(user, callId);
|
||||||
|
return callDao.createCallStep2EvaluationV2(call, createCallRequest, user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,15 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
|
||||||
import net.gepafin.tendermanagement.util.FieldValidator;
|
import net.gepafin.tendermanagement.util.FieldValidator;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
|
||||||
public class CallValidatorServiceImpl {
|
public class CallValidatorServiceImpl {
|
||||||
public static void validateResponse(CallResponse response, FlowResponseBean flowResponse, List<FormResponseBean> formResponses) {
|
public static void validateResponse(CallResponse response, FlowResponseBean flowResponse, List<FormResponseBean> formResponses, EvaluationFormResponseBean evaluationFormResponseBean) {
|
||||||
// Validate CallResponse (existing logic)
|
// Validate CallResponse (existing logic)
|
||||||
FieldValidator data = FieldValidator.create()
|
FieldValidator data = FieldValidator.create()
|
||||||
.notNull(response.getId(), "id")
|
.notNull(response.getId(), "id")
|
||||||
@@ -28,31 +27,65 @@ public class CallValidatorServiceImpl {
|
|||||||
.notNull(response.getRegionId(), "regionId")
|
.notNull(response.getRegionId(), "regionId")
|
||||||
.notNull(response.getAmount(), "amount")
|
.notNull(response.getAmount(), "amount")
|
||||||
.notNull(response.getAmountMax(), "amountMax")
|
.notNull(response.getAmountMax(), "amountMax")
|
||||||
.notNull(response.getThreshold(), "threshold")
|
|
||||||
.notNull(response.getEmail(),"email")
|
.notNull(response.getEmail(),"email")
|
||||||
.notNull(response.getAmountMin(),"amountMin")
|
.notNull(response.getAmountMin(),"amountMin")
|
||||||
.notNull(response.getStartTime(),"startTime")
|
.notNull(response.getStartTime(),"startTime")
|
||||||
.notNull(response.getEndTime(),"endTime")
|
.notNull(response.getEndTime(),"endTime")
|
||||||
.notNull(response.getDocumentationRequested(), "documentationRequested")
|
.notNull(response.getDocumentationRequested(), "documentationRequested")
|
||||||
.notEmpty(response.getAimedTo(), "aimedTo")
|
.notEmpty(response.getAimedTo(), "aimedTo")
|
||||||
.notEmpty(response.getCriteria(), "criteria")
|
.notEmpty(response.getDocs(), "docs");
|
||||||
.notEmpty(response.getDocs(), "docs")
|
if (response.getEvaluationVersion() == EvaluationVersionEnum.V1) {
|
||||||
.notEmpty(response.getCheckList(), "checkList");
|
|
||||||
|
|
||||||
|
data = data.notEmpty(response.getCheckList(), "checkList")
|
||||||
|
.notEmpty(response.getCriteria(), "criteria")
|
||||||
|
.notNull(response.getThreshold(), "threshold");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.getEvaluationVersion() == EvaluationVersionEnum.V2 && evaluationFormResponseBean == null) {
|
||||||
|
data.addError(Translator.toLocale(GepafinConstant.EVALUATION_FORM_NOT_FOUND));
|
||||||
|
}
|
||||||
if (response.getDates().get(0) == null || response.getDates().get(1) == null
|
if (response.getDates().get(0) == null || response.getDates().get(1) == null
|
||||||
|| response.getDates().get(0).toLocalDate().isBefore(LocalDate.now())
|
|| response.getDates().get(0).toLocalDate().isBefore(LocalDate.now())
|
||||||
|| response.getDates().get(1).toLocalDate().isBefore(LocalDate.now())
|
|| response.getDates().get(1).toLocalDate().isBefore(LocalDate.now())
|
||||||
|| response.getDates().get(0).toLocalDate().isAfter(response.getDates().get(1).toLocalDate())) {
|
|| response.getDates().get(0).toLocalDate().isAfter(response.getDates().get(1).toLocalDate())) {
|
||||||
data = data.addError(Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
data = data.addError(Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
||||||
}
|
}
|
||||||
if (flowResponse == null || ((flowResponse.getFlowData() == null || flowResponse.getFlowData().isEmpty())
|
|
||||||
&& (flowResponse.getFlowEdges() == null || flowResponse.getFlowEdges().isEmpty()))) {
|
if (flowResponse == null || ((flowResponse.getFlowData() == null || flowResponse.getFlowData().isEmpty()))
|
||||||
|
&& (flowResponse.getFlowEdges() == null || flowResponse.getFlowEdges().isEmpty())) {
|
||||||
data.addError(Translator.toLocale(GepafinConstant.FLOW_NOT_FOUND));
|
data.addError(Translator.toLocale(GepafinConstant.FLOW_NOT_FOUND));
|
||||||
}
|
}
|
||||||
if (formResponses == null || formResponses.isEmpty()) {
|
if (formResponses == null || formResponses.isEmpty()) {
|
||||||
data.addError(Translator.toLocale(GepafinConstant.FORM_NOT_FOUND));
|
data.addError(Translator.toLocale(GepafinConstant.FORM_NOT_FOUND));
|
||||||
}
|
}
|
||||||
|
boolean isAmountRequestedValid = false;
|
||||||
|
if (formResponses != null && !formResponses.isEmpty()) {
|
||||||
|
outerloop:
|
||||||
|
for (FormResponseBean formResponse : formResponses) {
|
||||||
|
|
||||||
|
if (formResponse.getContent() != null && !formResponse.getContent().isEmpty()) {
|
||||||
|
for (ContentResponseBean content : formResponse.getContent()) {
|
||||||
|
if ("numberinput".equals(content.getName()) && content.getSettings() != null) {
|
||||||
|
for (SettingResponseBean setting : content.getSettings()) {
|
||||||
|
if ("isRequestedAmount".equals(setting.getName())) {
|
||||||
|
Object value = setting.getValue();
|
||||||
|
if (Boolean.TRUE.equals(value)) {
|
||||||
|
isAmountRequestedValid = true;
|
||||||
|
break outerloop;
|
||||||
|
} else if (value == null) {
|
||||||
|
data.addError(Translator.toLocale(GepafinConstant.REQUIRED_REQUESTED_AMOUNT_MSG));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isAmountRequestedValid) {
|
||||||
|
data.addError(Translator.toLocale(GepafinConstant.REQUIRED_REQUESTED_AMOUNT_MSG));
|
||||||
|
}
|
||||||
data.validate();
|
data.validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import net.gepafin.tendermanagement.dao.DashboardDao;
|
import net.gepafin.tendermanagement.dao.DashboardDao;
|
||||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.service.DashboardService;
|
import net.gepafin.tendermanagement.service.DashboardService;
|
||||||
@@ -39,4 +42,26 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
UserEntity userEntity=validator.validateUser(request);
|
UserEntity userEntity=validator.validateUser(request);
|
||||||
return dashboardDao.getApplicationDetails(userEntity);
|
return dashboardDao.getApplicationDetails(userEntity);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public AmendmentWidgetResponseBean getAmendmentDetails(HttpServletRequest request) {
|
||||||
|
UserEntity userEntity=validator.validateUser(request);
|
||||||
|
return dashboardDao.getAmendmentDetails(userEntity);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request,Long userId) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
return dashboardDao.getDashboardWidgetForPreInstructor(request,userId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(HttpServletRequest request) {
|
||||||
|
UserEntity userEntity = validator.validateUser(request);
|
||||||
|
return dashboardDao.getApplicationDetailsForEvaluation(userEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BeneficiaryStatisticsResponseBean getStatisticsPageForBeneficiary(HttpServletRequest request, Long companyId) {
|
||||||
|
UserEntity userEntity = validator.validateUser(request);
|
||||||
|
CompanyEntity company = validator.validateUserWithCompany(request, companyId);
|
||||||
|
return dashboardDao.getStatisticsPageForBeneficiary(userEntity,company);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package net.gepafin.tendermanagement.service.impl;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.dao.EvaluationFormDao;
|
||||||
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
|
import net.gepafin.tendermanagement.model.request.EvaluationFormRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.service.EvaluationFormService;
|
||||||
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class EvaluationFormServiceImpl implements EvaluationFormService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EvaluationFormDao evalauationFormDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Validator validator;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EvaluationFormResponseBean createEvaluationForm(HttpServletRequest request, Long callId, EvaluationFormRequest evaluationFormRequest) {
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
CallEntity call = validator.validateUserWithCall(user, callId);
|
||||||
|
return evalauationFormDao.createEvaluationForm(call,evaluationFormRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EvaluationFormResponseBean updateEvaluationForm(HttpServletRequest request, Long evaluationFormId, EvaluationFormRequest evaluationFormRequest) {
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
return evalauationFormDao.updateEvaluationForm(user, evaluationFormId,evaluationFormRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EvaluationFormResponseBean getEvaluationFormById(HttpServletRequest request, Long evaluationFormId) {
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
return evalauationFormDao.getEvaluationFormById(user, evaluationFormId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteEvaluationForm(HttpServletRequest request, Long evaluationFormId) {
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
evalauationFormDao.deleteEvaluationForm(user, evaluationFormId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EvaluationFormEntity validateEvaluationForm(Long id) {
|
||||||
|
return evalauationFormDao.validateForm(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EvaluationFormResponseBean getEvaluationFormByCallId(HttpServletRequest request, Long callId) {
|
||||||
|
UserEntity user = validator.validateUser(request);
|
||||||
|
CallEntity call = validator.validateUserWithCall(user, callId);
|
||||||
|
return evalauationFormDao.getEvaluationFormByCallId(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import net.gepafin.tendermanagement.util.Validator;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ public class FormServiceImpl implements FormService {
|
|||||||
private Validator validator;
|
private Validator validator;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public FormResponseBean createForm(HttpServletRequest request,Long callId, FormRequest formRequest) {
|
public FormResponseBean createForm(HttpServletRequest request,Long callId, FormRequest formRequest) {
|
||||||
UserEntity user = validator.validateUser(request);
|
UserEntity user = validator.validateUser(request);
|
||||||
CallEntity call = validator.validateUserWithCall(user, callId);
|
CallEntity call = validator.validateUserWithCall(user, callId);
|
||||||
@@ -34,18 +36,21 @@ public class FormServiceImpl implements FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public FormResponseBean updateForm(HttpServletRequest request, Long formId, FormRequest formRequest,Boolean forceDeleteFlow) {
|
public FormResponseBean updateForm(HttpServletRequest request, Long formId, FormRequest formRequest,Boolean forceDeleteFlow) {
|
||||||
UserEntity user = validator.validateUser(request);
|
UserEntity user = validator.validateUser(request);
|
||||||
return formDao.updateForm(user, formId,formRequest,forceDeleteFlow);
|
return formDao.updateForm(user, formId,formRequest,forceDeleteFlow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
public FormResponseBean getFormById(HttpServletRequest request, Long formId) {
|
public FormResponseBean getFormById(HttpServletRequest request, Long formId) {
|
||||||
UserEntity user = validator.validateUser(request);
|
UserEntity user = validator.validateUser(request);
|
||||||
return formDao.getFormEntityById(user, formId);
|
return formDao.getFormEntityById(user, formId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteForm(HttpServletRequest request, Long formId) {
|
public void deleteForm(HttpServletRequest request, Long formId) {
|
||||||
UserEntity user = validator.validateUser(request);
|
UserEntity user = validator.validateUser(request);
|
||||||
formDao.deleteFormById(user, formId);
|
formDao.deleteFormById(user, formId);
|
||||||
@@ -57,6 +62,7 @@ public class FormServiceImpl implements FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
public List<FormResponseBean> getFormsByCallId(HttpServletRequest request, Long callId) {
|
public List<FormResponseBean> getFormsByCallId(HttpServletRequest request, Long callId) {
|
||||||
UserEntity user = validator.validateUser(request);
|
UserEntity user = validator.validateUser(request);
|
||||||
CallEntity call = validator.validateUserWithCall(user, callId);
|
CallEntity call = validator.validateUserWithCall(user, callId);
|
||||||
|
|||||||
@@ -134,7 +134,12 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageableResponseBean<List<UserResponseBean>> getUserByPagination(HttpServletRequest request, UserPaginationRequestBean userPaginationRequestBean) {
|
public PageableResponseBean<List<UserResponseBean>> getUserByPagination(HttpServletRequest request, UserPaginationRequestBean userPaginationRequestBean) {
|
||||||
UserEntity user=validator.validateUser(request);
|
UserEntity user = validator.validateUser(request);
|
||||||
return userDao.getUserByPagination(userPaginationRequestBean,user);
|
return userDao.getUserByPagination(userPaginationRequestBean, user);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public UserResponseBean updateUserDetails(HttpServletRequest request, Long userId, UpdateUserReqForBeneficiary userReq) {
|
||||||
|
return userDao.updateUserDetails(request , userId, userReq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,30 @@
|
|||||||
package net.gepafin.tendermanagement.util;
|
package net.gepafin.tendermanagement.util;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.regex.Matcher;
|
||||||
import java.util.Map;
|
import java.util.regex.Pattern;
|
||||||
import java.util.Objects;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.dao.FormDao;
|
import net.gepafin.tendermanagement.dao.FormDao;
|
||||||
import net.gepafin.tendermanagement.dao.VatCheckDao;
|
import net.gepafin.tendermanagement.dao.VatCheckDao;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationFormEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationFormFieldEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.ApplicationFormFieldRequestBean;
|
||||||
|
import net.gepafin.tendermanagement.model.request.ContentRequestBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ContentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.SettingResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.repositories.ApplicationFormFieldRepository;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ValidationException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ValidationException;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@@ -75,7 +88,7 @@ public class FieldValidator {
|
|||||||
return value == null || value == 0L;
|
return value == null || value == 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FieldValidator validateCustom(String value, String customRule, String fieldId) {
|
public FieldValidator validateCustom(String value, String customRule, String fieldId, ContentResponseBean contentResponseBean) {
|
||||||
if (customRule == null || value == null) {
|
if (customRule == null || value == null) {
|
||||||
return this; // No custom rule to validate
|
return this; // No custom rule to validate
|
||||||
}
|
}
|
||||||
@@ -131,6 +144,10 @@ public class FieldValidator {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GepafinConstant.NON_EMPTY_TABLES:
|
||||||
|
// checkTableValidation(value, fieldId, contentResponseBean, errors);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// If the custom rule is unknown, just log or add an error (optional)
|
// If the custom rule is unknown, just log or add an error (optional)
|
||||||
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_CUSTOM), fieldId, customRule));
|
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_CUSTOM), fieldId, customRule));
|
||||||
@@ -139,6 +156,123 @@ public class FieldValidator {
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public FieldValidator validateCustomTableValidation(String value, String customRule, String fieldId, ContentResponseBean contentResponseBean) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void checkTableValidation(String value, String fieldId, ContentResponseBean contentResponseBean, List<String> errors) throws Exception {
|
||||||
|
Map<String, Boolean> stateFieldMap= new HashMap<>();
|
||||||
|
String tableType = contentResponseBean.getSettings().stream()
|
||||||
|
.filter(setting ->GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName())) // Check for "table_columns"
|
||||||
|
.map(SettingResponseBean::getName) // Extract the name
|
||||||
|
.findFirst() // Get the first matching result
|
||||||
|
.orElse(null); // Default to null if no match
|
||||||
|
|
||||||
|
|
||||||
|
if (tableType!=null){
|
||||||
|
try {
|
||||||
|
Object object = PdfUtils.extractRows(value);;
|
||||||
|
value= Utils.convertToString(object);
|
||||||
|
} 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"
|
||||||
|
.map(SettingResponseBean::getValue)
|
||||||
|
.filter(Objects::nonNull) // Ensure value is not null
|
||||||
|
.filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map
|
||||||
|
.map(settingValue -> (Map<String, Object>) settingValue) // Cast to Map
|
||||||
|
.map(valueMap -> (List<Map<String, Object>>) valueMap.get("stateFieldData")) // Extract stateFieldData list
|
||||||
|
.filter(Objects::nonNull) // Ensure stateFieldData is not null
|
||||||
|
.flatMap(List::stream) // Flatten the list of field data maps
|
||||||
|
.forEach(fieldData -> {
|
||||||
|
String fieldName = (String) fieldData.get("name"); // Get the name field
|
||||||
|
Boolean isPredefined = (Boolean) fieldData.get("predefined"); // Get the predefined field
|
||||||
|
|
||||||
|
if (fieldName != null && isPredefined != null) {
|
||||||
|
stateFieldMap.put(fieldName, isPredefined);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<Map<String, Object>> fieldValueList = Utils.convertJsonStringIntoJsonList(value);
|
||||||
|
|
||||||
|
if (fieldValueList == null || fieldValueList.isEmpty()) {
|
||||||
|
errors.add(MessageFormat.format(
|
||||||
|
Translator.toLocale(GepafinConstant.VALIDATION_IN_TABLE),
|
||||||
|
fieldId));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for (int rowIndex = 0; rowIndex < fieldValueList.size(); rowIndex++) {
|
||||||
|
// Map<String, Object> field = fieldValueList.get(rowIndex);
|
||||||
|
//
|
||||||
|
// boolean hasSingleNonNullPredefinedFalse = false;
|
||||||
|
//
|
||||||
|
// for (Map.Entry<String, Boolean> entry : stateFieldMap.entrySet()) {
|
||||||
|
// String stateKey = entry.getKey();
|
||||||
|
// Boolean isPredefinedFalse = Boolean.FALSE.equals(entry.getValue());
|
||||||
|
//
|
||||||
|
// if (isPredefinedFalse) {
|
||||||
|
// Object fieldValue = field.get(stateKey);
|
||||||
|
// if (fieldValue != null && !StringUtils.isEmpty(fieldValue.toString())) {
|
||||||
|
// hasSingleNonNullPredefinedFalse = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (!hasSingleNonNullPredefinedFalse) {
|
||||||
|
// errors.add(MessageFormat.format(
|
||||||
|
// Translator.toLocale(GepafinConstant.VALIDATION_IN_TABLE),
|
||||||
|
// fieldId));
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
boolean hasAtLeastOneNonEmptyPredefinedFalse = fieldValueList.stream()
|
||||||
|
.anyMatch(field -> stateFieldMap.entrySet().stream()
|
||||||
|
.filter(entry -> Boolean.FALSE.equals(entry.getValue())) // Check only predefined: false fields
|
||||||
|
.anyMatch(entry -> {
|
||||||
|
Object fieldValue = field.get(entry.getKey());
|
||||||
|
return fieldValue != null && !StringUtils.isEmpty(fieldValue.toString());
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!hasAtLeastOneNonEmptyPredefinedFalse) {
|
||||||
|
errors.add(MessageFormat.format(
|
||||||
|
Translator.toLocale(GepafinConstant.VALIDATION_IN_TABLE),
|
||||||
|
fieldId));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public FieldValidator isRequired(String value,Boolean isRequired, String fieldName) {
|
public FieldValidator isRequired(String value,Boolean isRequired, String fieldName) {
|
||||||
if (Boolean.TRUE.equals(isRequired)) { // Only check if isRequired is true
|
if (Boolean.TRUE.equals(isRequired)) { // Only check if isRequired is true
|
||||||
if (Objects.isNull(value) || value.isEmpty()) { // Check if value is null or empty
|
if (Objects.isNull(value) || value.isEmpty()) { // Check if value is null or empty
|
||||||
@@ -150,4 +284,28 @@ public class FieldValidator {
|
|||||||
public boolean hasErrors() {
|
public boolean hasErrors() {
|
||||||
return !errors.isEmpty();
|
return !errors.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ContentRequestBean getContentRequestBeanFromJson(String jsonString) throws JsonProcessingException {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
// Parse the JSON into a ContentRequestBean
|
||||||
|
ContentRequestBean contentRequestBean = objectMapper.readValue(jsonString, ContentRequestBean.class);
|
||||||
|
|
||||||
|
// Now contentRequestBean is populated with the data from the JSON
|
||||||
|
return contentRequestBean;
|
||||||
|
}
|
||||||
|
public FieldValidator formulaValidation(Object fieldValue, double finalValue, String label) {
|
||||||
|
if (fieldValue != null) {
|
||||||
|
try {
|
||||||
|
double fieldValueAsDouble = Double.parseDouble(fieldValue.toString()); // Convert fieldValue to double
|
||||||
|
if (Double.compare(finalValue, fieldValueAsDouble) != 0) { // Compare doubles safely
|
||||||
|
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.FORMULA_AMOUNT_NOT_MATCHED), label));
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST, "Invalid field value: " + fieldValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
package net.gepafin.tendermanagement.util;
|
package net.gepafin.tendermanagement.util;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.itextpdf.text.DocumentException;
|
import com.itextpdf.text.DocumentException;
|
||||||
import com.itextpdf.text.Element;
|
import com.itextpdf.text.Element;
|
||||||
import com.itextpdf.text.Font;
|
import com.itextpdf.text.Font;
|
||||||
@@ -60,6 +62,24 @@ public class PdfUtils {
|
|||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Object extractRows(Object content) throws Exception {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
JsonNode rootNode;
|
||||||
|
|
||||||
|
// Check if input is already a JSON tree (Object) or a String
|
||||||
|
if (content instanceof String) {
|
||||||
|
rootNode = objectMapper.readTree((String) content);
|
||||||
|
} else {
|
||||||
|
rootNode = objectMapper.valueToTree(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract "rows" dynamically
|
||||||
|
JsonNode rowsArray = rootNode.get("rows");
|
||||||
|
|
||||||
|
// Convert to a generic List
|
||||||
|
return objectMapper.convertValue(rowsArray, List.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class UserActionAspect {
|
|||||||
handleSuccessResponse((ResponseEntity<?>) result, storedUserActionId == null ? userActionId : storedUserActionId);
|
handleSuccessResponse((ResponseEntity<?>) result, storedUserActionId == null ? userActionId : storedUserActionId);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.error("Exception occurred: ", ex);
|
// log.error("Exception occurred: ", ex);
|
||||||
handleError(ex, getUserActionIdFromRequest(request));
|
handleError(ex, getUserActionIdFromRequest(request));
|
||||||
throw ex;
|
throw ex;
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -27,6 +28,8 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.model.request.GlobalFilters;
|
import net.gepafin.tendermanagement.model.request.GlobalFilters;
|
||||||
|
import net.objecthunter.exp4j.Expression;
|
||||||
|
import net.objecthunter.exp4j.ExpressionBuilder;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -54,6 +57,9 @@ import javax.crypto.Cipher;
|
|||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import javax.script.ScriptEngine;
|
||||||
|
import javax.script.ScriptEngineManager;
|
||||||
|
import javax.script.ScriptException;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||||
|
|
||||||
@@ -407,6 +413,29 @@ public class Utils {
|
|||||||
return input.toString();
|
return input.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String convertToStringForFormFieldValue(Object input) {
|
||||||
|
if (input == null) {
|
||||||
|
return null; // Return string "null" for null input
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input instanceof String) {
|
||||||
|
return (String) input; // Return the string directly if input is a string
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input instanceof Collection<?>) {
|
||||||
|
// Handle collections (List, Set, etc.)
|
||||||
|
return convertCollectionToString((Collection<?>) input);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input instanceof Map<?, ?>) {
|
||||||
|
// Handle maps
|
||||||
|
return convertMapToString((Map<?, ?>) input);
|
||||||
|
}
|
||||||
|
|
||||||
|
// For other types (like Integer, Boolean, etc.), use toString()
|
||||||
|
return input.toString();
|
||||||
|
}
|
||||||
|
|
||||||
private static String convertCollectionToString(Collection<?> collection) {
|
private static String convertCollectionToString(Collection<?> collection) {
|
||||||
try {
|
try {
|
||||||
return mapper.writeValueAsString(collection); // Convert the collection to a JSON string
|
return mapper.writeValueAsString(collection); // Convert the collection to a JSON string
|
||||||
@@ -730,6 +759,31 @@ public class Utils {
|
|||||||
private static Map<String, Object> defaultErrorResponse() {
|
private static Map<String, Object> defaultErrorResponse() {
|
||||||
return Collections.singletonMap("message", Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
return Collections.singletonMap("message", Translator.toLocale(GepafinConstant.INVALID_VATNUMBER));
|
||||||
}
|
}
|
||||||
|
public static List<String> extractValues(String input) {
|
||||||
|
List<String> extractedValues = new ArrayList<>();
|
||||||
|
Pattern pattern = Pattern.compile("\\{(.*?)\\}"); // Regex to match {value}
|
||||||
|
Matcher matcher = pattern.matcher(input);
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
extractedValues.add(matcher.group(1)); // Extract value inside {}
|
||||||
|
}
|
||||||
|
return extractedValues;
|
||||||
|
}
|
||||||
|
public static double evaluateExpression(String expression) {
|
||||||
|
try {
|
||||||
|
Expression exp = new ExpressionBuilder(expression).build();
|
||||||
|
return exp.evaluate();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return Double.NaN; // Return NaN if the expression is invalid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean isNumeric(String input) {
|
||||||
|
if (input == null || input.trim().isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return input.matches("-?\\d+(\\.\\d+)?");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -14,10 +14,12 @@ import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestRe
|
|||||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
import net.gepafin.tendermanagement.model.response.SummaryPageResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -85,9 +87,10 @@ public interface ApplicationAmendmentRequestApi {
|
|||||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@GetMapping(value = "/user/{id}", produces = "application/json")
|
@GetMapping(value = "/user", produces = "application/json")
|
||||||
ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getAllApplicationAmendmentRequest(HttpServletRequest request,
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
||||||
@Parameter(description = "The User ID", required = false) @PathVariable(value = "id",required = false) Long userId);
|
ResponseEntity<Response<List<GetAllAmendmentResponseBean>>> getAllApplicationAmendmentRequest(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The User ID", required = false) @RequestParam(value = "userId",required = false) Long userId);
|
||||||
|
|
||||||
@Operation(summary = "Api to update application amendment",
|
@Operation(summary = "Api to update application amendment",
|
||||||
responses = {
|
responses = {
|
||||||
|
|||||||
@@ -7,9 +7,12 @@ import io.swagger.v3.oas.annotations.media.ExampleObject;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
|
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -45,6 +48,7 @@ public interface ApplicationEvaluationApi {
|
|||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
|
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
|
||||||
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
|
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
|
||||||
|
|
||||||
@Operation(summary = "API to delete ApplicationEvaluation",
|
@Operation(summary = "API to delete ApplicationEvaluation",
|
||||||
responses = {
|
responses = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@@ -56,4 +60,49 @@ public interface ApplicationEvaluationApi {
|
|||||||
@Parameter( required = true) @PathVariable("id") Long id);
|
@Parameter( required = true) @PathVariable("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to create or update application evaluation form ( Evaluation V2 )",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@PutMapping(value = "/v2/assignedApplication/{id}",
|
||||||
|
produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<ApplicationEvaluationFormResponse>> createApplicationEvaluation(HttpServletRequest request,
|
||||||
|
@Valid @RequestBody ApplicationEvaluationFormRequestBean applicationEvaluationFormRequestBean,
|
||||||
|
@Parameter(description = "Assigned Application ID", required = true) @PathVariable(value = "id", required = true) Long assignedApplicationId,
|
||||||
|
@Parameter(description = "The evaluation form ID", required = true) @RequestParam("evaluationFormId") Long evaluationFormId);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get an application evaluation form (Evaluation V2)",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@GetMapping(value = "/v2", produces = "application/json")
|
||||||
|
ResponseEntity<Response<ApplicationEvaluationFormResponse>> getApplicationEvaluationForm(HttpServletRequest request,
|
||||||
|
@Parameter(required = false) @RequestParam(value = "applicationId", required = false) Long applicationId,
|
||||||
|
@Parameter( required = false) @RequestParam(value = "assignedApplicationId", required = false) Long assignedApplicationId);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get application evaluation version",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@GetMapping(value = "/application/{id}/version", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<ApplicationEvaluationVersionResponse>> getApplicationEvaluationVersion(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The application id", required = true) @PathVariable("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationPageableRequestBean;
|
import net.gepafin.tendermanagement.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.AssignedApplicationsRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
@@ -68,7 +71,8 @@ public interface AssignedApplicationsApi {
|
|||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@GetMapping(value = "", produces = "application/json")
|
@GetMapping(value = "", produces = "application/json")
|
||||||
ResponseEntity<Response<List<AssignedApplicationsResponse>>> getAllAssignedApplications(HttpServletRequest request,
|
ResponseEntity<Response<List<AssignedApplicationsResponse>>> getAllAssignedApplications(HttpServletRequest request,
|
||||||
@Parameter(description = "The User ID", required = false) @RequestParam(value = "userId",required = false) Long userId);
|
@Parameter(description = "The User ID", required = false) @RequestParam(value = "userId",required = false) Long userId,
|
||||||
|
@Parameter(description = "Assigned application statuses" ,required = false) @RequestParam(value = "statuses",required = false) List<AssignedApplicationEnum> statusList);
|
||||||
|
|
||||||
@Operation(summary = "Api to update assigned application",
|
@Operation(summary = "Api to update assigned application",
|
||||||
responses = {
|
responses = {
|
||||||
@@ -99,6 +103,20 @@ public interface AssignedApplicationsApi {
|
|||||||
ResponseEntity<Response<AssignedApplicationsResponse>> getAssignedApplicationById(HttpServletRequest request,
|
ResponseEntity<Response<AssignedApplicationsResponse>> getAssignedApplicationById(HttpServletRequest request,
|
||||||
@Parameter(description = "The assigned application id", required = true) @PathVariable(value = "id", required = true) Long id);
|
@Parameter(description = "The assigned application id", required = true) @PathVariable(value = "id", required = true) Long id);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to update assigned application status",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@PutMapping(value = "/{id}/status", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<AssignedApplicationsResponse>> updateAssignedApplicationStatus(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The assigned application id", required = true) @PathVariable("id") Long id,
|
||||||
|
@Parameter(description = "status", required = true)@RequestParam(value = "status", required = true) AssignedApplicationEnum status);
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "Api to get all assigned applications by pagination",
|
@Operation(summary = "Api to get all assigned applications by pagination",
|
||||||
responses = {
|
responses = {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ package net.gepafin.tendermanagement.web.rest.api;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.CallPageableRequestBean;
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -19,9 +20,6 @@ import io.swagger.v3.oas.annotations.media.ExampleObject;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep1;
|
|
||||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep2;
|
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateCallRequestStep1;
|
|
||||||
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
import net.gepafin.tendermanagement.model.response.CallDetailsResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
@@ -164,5 +162,20 @@ public interface CallApi {
|
|||||||
ResponseEntity<Response<PageableResponseBean<List<CallDetailsResponseBean>>>> getAllCallsByPagination(HttpServletRequest request,@RequestParam(value = "companyId", required = false) Long companyId , @RequestParam(value = "onlyPreferredCall", required = false, defaultValue = "false") Boolean onlyPreferredCall, @RequestBody CallPageableRequestBean callPageableRequestBean);
|
ResponseEntity<Response<PageableResponseBean<List<CallDetailsResponseBean>>>> getAllCallsByPagination(HttpServletRequest request,@RequestParam(value = "companyId", required = false) Long companyId , @RequestParam(value = "onlyPreferredCall", required = false, defaultValue = "false") Boolean onlyPreferredCall, @RequestBody CallPageableRequestBean callPageableRequestBean);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to update call step 2 (Evaluation V2)",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))
|
||||||
|
})
|
||||||
|
@PutMapping(value = "/step2-v2/{callId}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||||
|
public ResponseEntity<Response<CallResponse>> createCallStep2EvaluationV2(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The call id", required = true) @PathVariable("callId") Long callId,
|
||||||
|
@Parameter(description = "Call request object", required = true) @Valid @RequestBody CreateCallRequestStep2EvaluationV2 createCallRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import io.swagger.v3.oas.annotations.media.Content;
|
|||||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
@@ -17,6 +20,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
public interface DashboardApi {
|
public interface DashboardApi {
|
||||||
|
|
||||||
@@ -61,5 +65,65 @@ public interface DashboardApi {
|
|||||||
produces = { "application/json" })
|
produces = { "application/json" })
|
||||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')")
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')")
|
||||||
ResponseEntity<Response<ApplicationWidgetResponseBean>> getApplicationDetails(HttpServletRequest request);
|
ResponseEntity<Response<ApplicationWidgetResponseBean>> getApplicationDetails(HttpServletRequest request);
|
||||||
|
@Operation(summary = "Api to get Soccorso details",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@GetMapping(value = "/amendment",
|
||||||
|
produces = { "application/json" })
|
||||||
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
||||||
|
ResponseEntity<Response<AmendmentWidgetResponseBean>> getAmendmentDetails(HttpServletRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get Application details for Evaluation",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
|
||||||
|
@GetMapping(value = "/evaluation",
|
||||||
|
produces = { "application/json" })
|
||||||
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
||||||
|
ResponseEntity<Response<AssignedApplicationWidgetResponseBean>> getApplicationDetailsForEvaluation(HttpServletRequest request);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get Statistics page for beneficiary",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
|
||||||
|
@GetMapping(value = "/beneficiary/statistic/company/{companyId}",
|
||||||
|
produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<BeneficiaryStatisticsResponseBean>> getStatisticsPageForBeneficiary(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The company id", required = true) @PathVariable(value = "companyId", required = true) Long companyId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get dashboard widget for pre instructor",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@GetMapping(value = "/instructor/amendment",
|
||||||
|
produces = { "application/json" })
|
||||||
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
||||||
|
ResponseEntity<Response<PreInstructorWidgetResponseBean>> getDashboardWidgetForPreInstructor(HttpServletRequest request, @Parameter(description = "The User ID", required = false) @RequestParam(value = "userId",required = false) Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import net.gepafin.tendermanagement.model.request.EvaluationFormRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
||||||
|
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.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface EvaluationFormApi {
|
||||||
|
|
||||||
|
@Operation(summary = "Api to create Evaluation form (Evaluation V2)",
|
||||||
|
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 = "/call/{callId}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||||
|
public ResponseEntity<Response<EvaluationFormResponseBean>> createEvaluationForm(HttpServletRequest request, @Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId,
|
||||||
|
@Parameter(description = "evaluationForm request object", required = true)
|
||||||
|
@Valid @RequestBody EvaluationFormRequest evaluationFormRequest);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to update Evaluation form (Evaluation V2)",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@PutMapping(value = "/{evaluationFormId}",
|
||||||
|
produces = { "application/json" })
|
||||||
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||||
|
ResponseEntity<Response<EvaluationFormResponseBean>> updateEvaluationForm(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The Evaluation form ID", required = true) @PathVariable("evaluationFormId") Long evaluationFormId,
|
||||||
|
@Parameter(description = "Evaluation form request object", required = true) @Valid @RequestBody EvaluationFormRequest evaluationFormRequest);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get Evaluation form by id (Evaluation V2)",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@GetMapping(value = "/{evaluationFormId}",
|
||||||
|
produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<EvaluationFormResponseBean>> getEvaluationFormById(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The Evaluation form ID", required = true) @PathVariable("evaluationFormId") Long evaluationFormId);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to delete Evaluation form (Evaluation V2)",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@DeleteMapping(value = "/{evaluationFormId}")
|
||||||
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||||
|
ResponseEntity<Response<Void>> deleteEvaluationForm(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The Evaluation form ID", required = true) @PathVariable("evaluationFormId") Long evaluationFormId);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get Evaluation forms by callId (Evaluation V2)",
|
||||||
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@GetMapping(value = "/call/{callId}",
|
||||||
|
produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<EvaluationFormResponseBean>> getEvaluationFormByCallId(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -49,7 +49,7 @@ public interface UserApi {
|
|||||||
return new ResponseEntity<Response<JWTToken>>(HttpStatus.NOT_IMPLEMENTED);
|
return new ResponseEntity<Response<JWTToken>>(HttpStatus.NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "Api to update user",
|
@Operation(summary = "Api to update user (Only for super admin)",
|
||||||
responses = {
|
responses = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@@ -260,6 +260,26 @@ public interface UserApi {
|
|||||||
@RequestBody UserPaginationRequestBean userPaginationRequestBean);
|
@RequestBody UserPaginationRequestBean userPaginationRequestBean);
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "Api to update user",
|
||||||
|
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)}))})
|
||||||
|
@RequestMapping(value = "/{userId}/update-details",
|
||||||
|
produces = {"application/json"},
|
||||||
|
method = RequestMethod.PUT)
|
||||||
|
default ResponseEntity<Response<UserResponseBean>> updateUserDetails(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId,
|
||||||
|
@Parameter(description = "User request object", required = true) @Valid @RequestBody UpdateUserReqForBeneficiary userReq) {
|
||||||
|
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Response<Object> handleCustomValidationException(final CustomValidationException ex) {
|
public Response<Object> handleCustomValidationException(final CustomValidationException ex) {
|
||||||
log.error(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
log.error(ex.getLocalizedMessage(), ex);
|
// log.error(ex.getLocalizedMessage(), ex);
|
||||||
return new Response<>(null, ex.getStatus(), ex.getMessage());
|
return new Response<>(null, ex.getStatus(), ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,14 +45,14 @@ public class GlobalExceptionHandler {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Response<Object> handleValidationException(final ValidationException ex) {
|
public Response<Object> handleValidationException(final ValidationException ex) {
|
||||||
log.error(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
log.error(ex.getLocalizedMessage(), ex);
|
// log.error(ex.getLocalizedMessage(), ex);
|
||||||
return new Response<>(ex.getErrors(), ex.getStatus(), ex.getMessage());
|
return new Response<>(ex.getErrors(), ex.getStatus(), ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(ResourceNotFoundException.class)
|
@ExceptionHandler(ResourceNotFoundException.class)
|
||||||
public ResponseEntity<Response<Void>> handleResourceNotFoundException(ResourceNotFoundException ex) {
|
public ResponseEntity<Response<Void>> handleResourceNotFoundException(ResourceNotFoundException ex) {
|
||||||
log.error(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
log.error(ex.getLocalizedMessage(), ex);
|
// log.error(ex.getLocalizedMessage(), ex);
|
||||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||||
.body(new Response<>(null, ex.getStatus(), ex.getMessage()));
|
.body(new Response<>(null, ex.getStatus(), ex.getMessage()));
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Response<Object> handleInvalidTokenException(final Throwable ex) {
|
public Response<Object> handleInvalidTokenException(final Throwable ex) {
|
||||||
log.error(ex.getMessage());
|
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"));
|
return new Response<>(ex.getMessage(), Status.UNAUTHORIZED, Translator.toLocale("invalid_signature"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Response<Object> unauthorizedAccessException(final Throwable ex) {
|
public Response<Object> unauthorizedAccessException(final Throwable ex) {
|
||||||
log.error(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
log.error(ex.getLocalizedMessage(), ex);
|
// log.error(ex.getLocalizedMessage(), ex);
|
||||||
return new Response<>(null, Status.UNAUTHORIZED, ex.getMessage());
|
return new Response<>(null, Status.UNAUTHORIZED, ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Response<Object> handleUnAuthorizedException(final Throwable ex) {
|
public Response<Object> handleUnAuthorizedException(final Throwable ex) {
|
||||||
log.error(ex.getMessage());
|
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"));
|
return new Response<>(null, Status.VALIDATION_ERROR, Translator.toLocale("invalid_login"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
|||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
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.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
@@ -83,14 +84,14 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getAllApplicationAmendmentRequest(HttpServletRequest request,Long userId) {
|
public ResponseEntity<Response<List<GetAllAmendmentResponseBean>>> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId) {
|
||||||
log.info("Get All Applications Amendment Request");
|
log.info("Get All Applications Amendment Request");
|
||||||
|
|
||||||
/** This code is responsible for creating user action logs for the "get all application amendment by preInstructor user id" operation. **/
|
/** This code is responsible for creating user action logs for the "get all application amendment by preInstructor user id" operation. **/
|
||||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
.actionContext(UserActionContextEnum.GET_ALL_AMENDMENT_BY_PREINSTRUCTOR_USER_ID).build());
|
.actionContext(UserActionContextEnum.GET_ALL_AMENDMENT_BY_PREINSTRUCTOR_USER_ID).build());
|
||||||
|
|
||||||
List<ApplicationAmendmentRequestResponse> applicationAmendmentRequestResponses = applicationAmendmentRequestService.getAllApplicationAmendmentRequest(request,userId);
|
List<GetAllAmendmentResponseBean> applicationAmendmentRequestResponses = applicationAmendmentRequestService.getAllApplicationAmendmentRequest(request,userId);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(applicationAmendmentRequestResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
|
.body(new Response<>(applicationAmendmentRequestResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,11 @@ package net.gepafin.tendermanagement.web.rest.api.impl;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
import net.gepafin.tendermanagement.model.request.EvaluationDocumentRequest;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
|
||||||
import net.gepafin.tendermanagement.model.response.EvaluationDocumentResponse;
|
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
|
import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
@@ -83,4 +81,41 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
|||||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_DELETED_SUCCESSFULLY)));
|
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_DELETED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<ApplicationEvaluationFormResponse>> createApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationFormRequestBean applicationEvaluationFormRequestBean, Long assignedApplicationId, Long evaluationFormId) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Create or update application evaluation form" operation. **/
|
||||||
|
loggingUtil.logUserAction(
|
||||||
|
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.CREATE_UPDATE_APPLICATION_EVALUATION_FORM).build());
|
||||||
|
|
||||||
|
ApplicationEvaluationFormResponse applicationEvaluationResponseBean = applicationEvaluationService.createApplicationEvaluation(request, applicationEvaluationFormRequestBean, assignedApplicationId, evaluationFormId);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(applicationEvaluationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_CREATED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<ApplicationEvaluationFormResponse>> getApplicationEvaluationForm(HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "get application evaluation form" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_APPLICATION_EVALUATION_FORM).build());
|
||||||
|
|
||||||
|
ApplicationEvaluationFormResponse applicationEvaluationFormResponse = applicationEvaluationService.getApplicationEvaluationForm(request,applicationId,assignedApplicationId);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(applicationEvaluationFormResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_EVALUATION_FORM_SUCCESS_MSG)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<ApplicationEvaluationVersionResponse>> getApplicationEvaluationVersion(HttpServletRequest request, Long applicationId) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "get application evaluation version" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_APPLICATION_EVALUATION_VERSION).build());
|
||||||
|
|
||||||
|
ApplicationEvaluationVersionResponse applicationEvaluationVersionResponse = applicationEvaluationService.getApplicationEvaluationVersion(request,applicationId);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(applicationEvaluationVersionResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_EVALUATION_VERSION_SUCCESS_MSG)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,15 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationPageableRequestBean;
|
import net.gepafin.tendermanagement.model.request.AssignedApplicationPageableRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
import net.gepafin.tendermanagement.model.response.PageableResponseBean;
|
||||||
@@ -59,12 +62,12 @@ public class AssignedApplicationsController implements AssignedApplicationsApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<List<AssignedApplicationsResponse>>> getAllAssignedApplications(HttpServletRequest request, Long userId) {
|
public ResponseEntity<Response<List<AssignedApplicationsResponse>>> getAllAssignedApplications(HttpServletRequest request, Long userId,List<AssignedApplicationEnum> statusList) {
|
||||||
log.info("Get All Assigned Applications");
|
log.info("Get All Assigned Applications");
|
||||||
/** This code is responsible for creating user action logs for the "get Assigned Applications" operation. **/
|
/** This code is responsible for creating user action logs for the "get Assigned Applications" operation. **/
|
||||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
.actionContext(UserActionContextEnum.GET_ASSIGNED_APPLICATION).build());
|
.actionContext(UserActionContextEnum.GET_ASSIGNED_APPLICATION).build());
|
||||||
List<AssignedApplicationsResponse> applications = assignedApplicationsService.getAllAssignedApplications(request, userId);
|
List<AssignedApplicationsResponse> applications = assignedApplicationsService.getAllAssignedApplications(request, userId,statusList);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(applications, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_ASSIGNED_APPLICATION_SUCCESS_MSG)));
|
.body(new Response<>(applications, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_ASSIGNED_APPLICATION_SUCCESS_MSG)));
|
||||||
}
|
}
|
||||||
@@ -102,6 +105,17 @@ public class AssignedApplicationsController implements AssignedApplicationsApi {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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. **/
|
||||||
|
loggingUtil.logUserAction(
|
||||||
|
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.UPDATE_ASSIGNED_APPLICATION_STATUS).build());
|
||||||
|
|
||||||
|
AssignedApplicationsResponse applicationResponse = assignedApplicationsService.updateAssignedApplicationStatus(request, assignedApplicationId, status);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(applicationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_STATUS_UPDATED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.web.rest.api.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.*;
|
import net.gepafin.tendermanagement.model.request.*;
|
||||||
@@ -160,6 +161,17 @@ public class CallApiController implements CallApi {
|
|||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(callsByPagination, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));
|
.body(new Response<>(callsByPagination, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor=Exception.class)
|
||||||
|
public ResponseEntity<Response<CallResponse>> createCallStep2EvaluationV2(HttpServletRequest request, Long callId, CreateCallRequestStep2EvaluationV2 createCallRequest) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Create or update Call step 2 for Evaluation V2" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE)
|
||||||
|
.actionContext(UserActionContextEnum.EVALUATION_V2_CREATE_UPDATE_CALL_STEP_2).build());
|
||||||
|
|
||||||
|
CallResponse createCallStep2EvaluationV2 = callService.createCallStep2EvaluationV2(request, callId, createCallRequest);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(createCallStep2EvaluationV2, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_CREATED_SUCCESSFULLY_MSG)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user