Resolved conflicts
This commit is contained in:
@@ -237,6 +237,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";
|
||||||
@@ -386,6 +387,25 @@ 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 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";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -592,7 +592,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));
|
||||||
}
|
}
|
||||||
@@ -604,7 +604,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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1178,6 +1178,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);
|
||||||
|
|||||||
@@ -234,6 +234,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 +403,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 +414,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 =
|
||||||
@@ -497,27 +499,24 @@ 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();
|
|
||||||
if(fieldValue!=null) {
|
Object fieldValue = applicationFormFieldRequestBean.getFieldValue();
|
||||||
if (fieldValue instanceof String) {
|
if(fieldValue!=null) {
|
||||||
try {
|
try {
|
||||||
BigDecimal amountRequested = new BigDecimal((String) fieldValue);
|
BigDecimal amountRequested = new BigDecimal(fieldValue.toString());
|
||||||
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;
|
||||||
@@ -670,7 +669,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)
|
||||||
@@ -1263,9 +1262,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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -116,6 +115,30 @@ public class ApplicationEvaluationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private HubService hubService;
|
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;
|
||||||
|
|
||||||
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();
|
||||||
@@ -142,6 +165,7 @@ public class ApplicationEvaluationDao {
|
|||||||
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(30)));
|
||||||
|
entity.setEvaluationVersion(application.getEvaluationVersion());
|
||||||
entity.setStatus(ApplicationEvaluationStatusTypeEnum.OPEN.getValue());
|
entity.setStatus(ApplicationEvaluationStatusTypeEnum.OPEN.getValue());
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
@@ -263,6 +287,7 @@ 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());
|
||||||
@@ -612,6 +637,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);
|
||||||
@@ -634,16 +660,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 =
|
||||||
@@ -653,25 +696,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
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1095,6 +1140,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()));
|
||||||
@@ -1895,5 +1941,265 @@ 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 ApplicationEvaluationResponseBean createApplicationEvaluation(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long evaluationFormId, Long evaluationId){
|
||||||
|
EvaluationFormEntity evaluationFormEntity = evaluationFormService.validateEvaluationForm(evaluationFormId);
|
||||||
|
validateFormFields(applicationRequestBean,evaluationFormEntity);
|
||||||
|
ApplicationEvaluationEntity applicationEvaluationEntity = validateApplicationEvaluation(evaluationId);
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = getApplicationEvaluationFormOrCreate(evaluationFormEntity,applicationEvaluationEntity);
|
||||||
|
createOrUpdateMultipleFormFields(applicationRequestBean.getFormFields(), applicationEvaluationFormEntity, evaluationFormEntity);
|
||||||
|
return getEvaluationById(applicationEvaluationEntity.getId(),evaluationFormEntity.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
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(ApplicationRequestBean 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationEvaluationResponseBean getEvaluationById(Long evaluationId, Long evaluationFormId){
|
||||||
|
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(evaluationId);
|
||||||
|
|
||||||
|
ApplicationEvaluationFormEntity applicationEvaluationFormEntity = applicationEvaluationFormRepository.findByEvaluationIdAndEvaluationFormId(applicationEvaluationEntity.getId(),evaluationFormId);
|
||||||
|
List<ApplicationEvaluationFormFieldEntity> applicationEvaluationFormFieldEntities = applicationEvaluationFormFieldRepository.findByApplicationEvaluationFormId(applicationEvaluationFormEntity.getId());
|
||||||
|
List<ApplicationEvaluationFormFieldReponseBean> evaluationFormFieldResponseBeans = createEvaluationFormFieldResponse(applicationEvaluationFormFieldEntities, applicationEvaluationFormEntity);
|
||||||
|
ApplicationEvaluationResponseBean applicationEvaluationResponseBean = convertApplicationEvaluationEntityToApplicationEvaluationResponseBean(applicationEvaluationEntity);
|
||||||
|
applicationEvaluationResponseBean.setFormFields(evaluationFormFieldResponseBeans);
|
||||||
|
|
||||||
|
return applicationEvaluationResponseBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 ApplicationEvaluationResponseBean convertApplicationEvaluationEntityToApplicationEvaluationResponseBean(ApplicationEvaluationEntity entity){
|
||||||
|
ApplicationEvaluationResponseBean response = new ApplicationEvaluationResponseBean();
|
||||||
|
response.setId(entity.getId());
|
||||||
|
response.setApplicationId(entity.getApplicationId());
|
||||||
|
response.setEvaluationId(entity.getId());
|
||||||
|
response.setNote(entity.getNote());
|
||||||
|
response.setEvaluationVersion(EvaluationVersionEnum.valueOf(entity.getEvaluationVersion()));
|
||||||
|
response.setCreatedDate(entity.getCreatedDate());
|
||||||
|
response.setUpdatedDate(entity.getUpdatedDate());
|
||||||
|
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){
|
||||||
|
ApplicationEvaluationFormResponse response = new ApplicationEvaluationFormResponse();
|
||||||
|
response.setApplicationId(evaluationEntity.getApplicationId());
|
||||||
|
response.setNote(evaluationEntity.getNote());
|
||||||
|
response.setStatus(evaluationEntity.getStatus());
|
||||||
|
response.setEvaluationVersion(EvaluationVersionEnum.valueOf(evaluationEntity.getEvaluationVersion()));
|
||||||
|
response.setAssignedApplicationId(evaluationEntity.getAssignedApplicationsEntity().getId());
|
||||||
|
|
||||||
|
EvaluationFormEntity evaluationFormEntity = evaluationFormRepository.findByCallIdAndIsDeletedFalse(evaluationEntity.getAssignedApplicationsEntity().getApplication().getCall().getId());
|
||||||
|
|
||||||
|
if (evaluationFormEntity != null) {
|
||||||
|
response.setEvaluationFormId(evaluationFormEntity.getId());
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,19 +4,13 @@ import jakarta.persistence.criteria.Predicate;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
|
import net.gepafin.tendermanagement.enums.*;
|
||||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.FaqEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
|
||||||
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
|
|
||||||
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
|
||||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
|
||||||
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
import net.gepafin.tendermanagement.model.request.UpdateAssignedApplicationRequest;
|
||||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationEvaluationRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||||
@@ -37,6 +31,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
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;
|
||||||
|
|
||||||
@@ -80,8 +75,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);
|
||||||
|
|
||||||
@@ -107,15 +107,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()));
|
||||||
@@ -174,6 +196,7 @@ 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());
|
||||||
}
|
}
|
||||||
@@ -196,7 +219,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));
|
||||||
@@ -204,18 +227,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))
|
||||||
@@ -257,5 +286,14 @@ public class AssignedApplicationsDao {
|
|||||||
log.info("Assigned application fetched successfully: {}", response);
|
log.info("Assigned application fetched successfully: {}", response);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
@@ -362,6 +366,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 +606,7 @@ 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());
|
||||||
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 +697,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());
|
||||||
@@ -811,7 +818,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 +1071,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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ import java.util.*;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@@ -45,8 +49,6 @@ public class DashboardDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
private ApplicationEvaluationRepository applicationEvaluationRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserActionsRepository userActionsRepository;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
|
private ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
|
||||||
|
|
||||||
@@ -246,14 +248,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) {
|
||||||
@@ -349,6 +352,56 @@ public class DashboardDao {
|
|||||||
responseBean.setAverageResponseDays(BigDecimal.ZERO);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private PreInstructorWidgetResponseBean initializeDashboardPreInstructorResponseBean() {
|
private PreInstructorWidgetResponseBean initializeDashboardPreInstructorResponseBean() {
|
||||||
return PreInstructorWidgetResponseBean.builder()
|
return PreInstructorWidgetResponseBean.builder()
|
||||||
@@ -372,7 +425,6 @@ public class DashboardDao {
|
|||||||
}
|
}
|
||||||
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(UserEntity userEntity) {
|
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(UserEntity userEntity) {
|
||||||
PreInstructorWidgetResponseBean preInstructorWidgetResponseBean = initializeDashboardPreInstructorResponseBean();
|
PreInstructorWidgetResponseBean preInstructorWidgetResponseBean = initializeDashboardPreInstructorResponseBean();
|
||||||
|
|
||||||
Long hubId = userEntity.getHub().getId();
|
Long hubId = userEntity.getHub().getId();
|
||||||
List<Long> applicationIds = getApplicationIdsForUserOrHub(userEntity, hubId);
|
List<Long> applicationIds = getApplicationIdsForUserOrHub(userEntity, hubId);
|
||||||
setPreInstructorWidgets(applicationIds, preInstructorWidgetResponseBean,hubId);
|
setPreInstructorWidgets(applicationIds, preInstructorWidgetResponseBean,hubId);
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,13 +55,13 @@ public class FormDao {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CallRepository callRepository;
|
private CallRepository callRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Validator validator;
|
private Validator validator;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CriteriaFormFieldRepository criteriaFormFieldRepository;
|
private CriteriaFormFieldRepository criteriaFormFieldRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EvaluationCriteriaService evaluationCriteriaService;
|
private EvaluationCriteriaService evaluationCriteriaService;
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ public class FormDao {
|
|||||||
validateAndSaveCriteriaFormField(callEntity, formEntity, formRequest.getContent());
|
validateAndSaveCriteriaFormField(callEntity, formEntity, formRequest.getContent());
|
||||||
return convertFormEntityToFormResponseBean(formEntity);
|
return convertFormEntityToFormResponseBean(formEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateAndSaveCriteriaFormField(CallEntity callEntity, FormEntity formEntity,
|
private void validateAndSaveCriteriaFormField(CallEntity callEntity, FormEntity formEntity,
|
||||||
List<ContentRequestBean> contentResponseBeans) {
|
List<ContentRequestBean> contentResponseBeans) {
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ public class FormDao {
|
|||||||
|
|
||||||
/** This code is responsible for adding a version history log for the "creating criteria form field" operation. **/
|
/** This code is responsible for adding a version history log for the "creating criteria form field" operation. **/
|
||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(criteriaFormField).build());
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(criteriaFormField).build());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateForm(FormRequest formRequest){
|
public void validateForm(FormRequest formRequest){
|
||||||
@@ -397,9 +397,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 +408,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 +428,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,12 +451,13 @@ 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());
|
||||||
}
|
}
|
||||||
|
|
||||||
FormResponseBean formResponseBean = convertFormEntityToFormResponseBean(formEntity);
|
FormResponseBean formResponseBean = convertFormEntityToFormResponseBean(formEntity);
|
||||||
FieldValidator validator = FieldValidator.create();
|
FieldValidator validator = FieldValidator.create();
|
||||||
formResponseBean.getContent().forEach(contentResponseBean -> {
|
formResponseBean.getContent().forEach(contentResponseBean -> {
|
||||||
@@ -461,14 +465,27 @@ 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);
|
||||||
});
|
});
|
||||||
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;
|
||||||
|
|
||||||
|
|||||||
@@ -208,6 +208,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);
|
||||||
|
|||||||
@@ -340,7 +340,8 @@ 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;
|
||||||
|
String fieldValue = value != null ? value.toString() : "";
|
||||||
if(Boolean.TRUE.equals(Utils.isItalianFormattedAmount(fieldValue)) ){
|
if(Boolean.TRUE.equals(Utils.isItalianFormattedAmount(fieldValue)) ){
|
||||||
fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue));
|
fieldValue= String.valueOf(Utils.convertToItalianFormat(fieldValue));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -67,5 +67,8 @@ 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,8 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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"),
|
||||||
@@ -92,6 +97,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 +111,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"),
|
||||||
@@ -139,6 +147,7 @@ public enum UserActionContextEnum {
|
|||||||
GET_APPLICATION_DETAILS("GET_APPLICATION_DETAILS"),
|
GET_APPLICATION_DETAILS("GET_APPLICATION_DETAILS"),
|
||||||
GET_AMENDMENT_DETAILS("GET_AMENDMENT_DETAILS"),
|
GET_AMENDMENT_DETAILS("GET_AMENDMENT_DETAILS"),
|
||||||
GET_DASHBOARD_WIDGET_FOR_PRE_INSTRUCTOR("GET_DASHBOARD_WIDGET_FOR_PRE_INSTRUCTOR"),
|
GET_DASHBOARD_WIDGET_FOR_PRE_INSTRUCTOR("GET_DASHBOARD_WIDGET_FOR_PRE_INSTRUCTOR"),
|
||||||
|
GET_APPLICATION_DETAILS_FOR_EVALUATION("GET_APPLICATION_DETAILS_FOR_EVALUATION"),
|
||||||
|
|
||||||
/** Evaluation criteria action context **/
|
/** Evaluation criteria action context **/
|
||||||
GET_EVALUATION_CRITERIA("GET_EVALUATION_CRITERIA"),
|
GET_EVALUATION_CRITERIA("GET_EVALUATION_CRITERIA"),
|
||||||
@@ -173,6 +182,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");
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
@@ -41,4 +42,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,6 @@ public class UpdateCallRequestStep1 {
|
|||||||
|
|
||||||
private List<FaqReq> faq;
|
private List<FaqReq> faq;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,18 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationEvaluationFormResponse {
|
||||||
|
|
||||||
|
private Long evaluationFormId;
|
||||||
|
private Long applicationId;
|
||||||
|
private Long assignedApplicationId;
|
||||||
|
private String note;
|
||||||
|
private String status;
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
private ApplicationEvaluationFormResponseBean applicationEvaluationFormResponse;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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,6 @@ public class ApplicationEvaluationResponse {
|
|||||||
private BigDecimal amountAccepted;
|
private BigDecimal amountAccepted;
|
||||||
private LocalDateTime dateAccepted;
|
private LocalDateTime dateAccepted;
|
||||||
private LocalDateTime dateRejected;
|
private LocalDateTime dateRejected;
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.BaseBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApplicationEvaluationResponseBean extends BaseBean {
|
||||||
|
private Long applicationId;
|
||||||
|
private Long evaluationId;
|
||||||
|
private String note;
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
private List<ApplicationEvaluationFormFieldReponseBean> formFields;
|
||||||
|
}
|
||||||
@@ -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.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,6 +2,7 @@ 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.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -22,6 +23,7 @@ public class AssignedApplicationsResponse extends BaseBean {
|
|||||||
private LocalDateTime callEndDate;
|
private LocalDateTime callEndDate;
|
||||||
private String companyName;
|
private String companyName;
|
||||||
private LocalDateTime evaluationEndDate;
|
private LocalDateTime evaluationEndDate;
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,6 @@ public class CallDetailsResponseBean {
|
|||||||
private LocalDateTime updatedDate;
|
private LocalDateTime updatedDate;
|
||||||
|
|
||||||
private Long preferredCallId;
|
private Long preferredCallId;
|
||||||
|
|
||||||
|
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
|
||||||
@@ -74,6 +75,8 @@ public class CallResponse {
|
|||||||
private String currentStep;
|
private String currentStep;
|
||||||
|
|
||||||
private Long preferredCallId;
|
private Long preferredCallId;
|
||||||
|
|
||||||
|
private EvaluationVersionEnum evaluationVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -59,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);
|
||||||
|
|
||||||
@@ -72,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);
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -32,7 +32,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 +55,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
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,5 +43,46 @@ public interface AssignedApplicationsRepository extends JpaRepository<AssignedAp
|
|||||||
|
|
||||||
@Query("SELECT COUNT(a) FROM AssignedApplicationsEntity a WHERE a.application.id IN :applicationIds AND a.status = :status AND a.isDeleted = false")
|
@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);
|
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);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
|||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -16,7 +17,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,11 @@ 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.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 +23,8 @@ public interface ApplicationEvaluationService {
|
|||||||
|
|
||||||
ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId);
|
ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId);
|
||||||
|
|
||||||
|
ApplicationEvaluationResponseBean createApplicationEvaluation(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long evaluationId, Long evaluationFormId);
|
||||||
|
|
||||||
|
ApplicationEvaluationFormResponse getApplicationEvaluationForm(HttpServletRequest request, Long applicationId, Long assignedApplicationId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,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.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;
|
||||||
@@ -15,8 +17,9 @@ 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);
|
||||||
|
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);
|
||||||
|
|
||||||
@@ -36,5 +34,7 @@ public interface CallService {
|
|||||||
byte[] downloadCallDocumentsAsZip(HttpServletRequest request, Long callId);
|
byte[] downloadCallDocumentsAsZip(HttpServletRequest request, Long callId);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ 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.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||||
|
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.SuperAdminWidgetResponseBean;
|
||||||
|
|
||||||
public interface DashboardService {
|
public interface DashboardService {
|
||||||
|
|
||||||
@@ -11,4 +16,6 @@ public interface DashboardService {
|
|||||||
public ApplicationWidgetResponseBean getApplicationDetails(HttpServletRequest request);
|
public ApplicationWidgetResponseBean getApplicationDetails(HttpServletRequest request);
|
||||||
public AmendmentWidgetResponseBean getAmendmentDetails(HttpServletRequest request);
|
public AmendmentWidgetResponseBean getAmendmentDetails(HttpServletRequest request);
|
||||||
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request);
|
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request);
|
||||||
|
public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(HttpServletRequest request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
|
|||||||
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
|
||||||
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.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;
|
||||||
@@ -83,8 +84,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,20 @@ 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.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.ApplicationEvaluationFormResponse;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponseBean;
|
||||||
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 +39,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 +86,18 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
|||||||
return applicationEvaluationDao.validateApplicationEvaluationByApplicationId(applicationId);
|
return applicationEvaluationDao.validateApplicationEvaluationByApplicationId(applicationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApplicationEvaluationResponseBean createApplicationEvaluation(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long evaluationId, Long evaluationFormId) {
|
||||||
|
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(evaluationId);
|
||||||
|
validator.validatePreInstructor(request, applicationEvaluationEntity.getUserId());
|
||||||
|
return applicationEvaluationDao.createApplicationEvaluation(request,applicationRequestBean,evaluationFormId,evaluationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public ApplicationEvaluationFormResponse getApplicationEvaluationForm(HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||||
|
validator.validateUser(request);
|
||||||
|
return applicationEvaluationDao.getApplicationEvaluationForm(request,applicationId,assignedApplicationId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import net.gepafin.tendermanagement.dao.AssignedApplicationsDao;
|
import net.gepafin.tendermanagement.dao.AssignedApplicationsDao;
|
||||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
|
import net.gepafin.tendermanagement.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;
|
||||||
@@ -40,8 +42,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
|
||||||
@@ -60,5 +62,8 @@ public class AssignedApplicationsServiceImpl implements AssignedApplicationsServ
|
|||||||
public AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId) {
|
public AssignedApplicationsEntity validateAssignedApplication(Long assignedApplicationId) {
|
||||||
return assignedApplicationsDao.validateAssignedApplication(assignedApplicationId);
|
return assignedApplicationsDao.validateAssignedApplication(assignedApplicationId);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ 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.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||||
|
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.SuperAdminWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.service.DashboardService;
|
import net.gepafin.tendermanagement.service.DashboardService;
|
||||||
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;
|
||||||
@@ -46,5 +51,10 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request) {
|
public PreInstructorWidgetResponseBean getDashboardWidgetForPreInstructor(HttpServletRequest request) {
|
||||||
UserEntity userEntity=validator.validateUser(request);
|
UserEntity userEntity=validator.validateUser(request);
|
||||||
return dashboardDao.getDashboardWidgetForPreInstructor(userEntity);
|
return dashboardDao.getDashboardWidgetForPreInstructor(userEntity);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AssignedApplicationWidgetResponseBean getApplicationDetailsForEvaluation(HttpServletRequest request) {
|
||||||
|
UserEntity userEntity = validator.validateUser(request);
|
||||||
|
return dashboardDao.getApplicationDetailsForEvaluation(userEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,17 +1,20 @@
|
|||||||
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.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
|
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.model.request.ContentRequestBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.ContentResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.SettingResponseBean;
|
||||||
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.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@@ -75,7 +78,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 +134,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 +146,70 @@ public class FieldValidator {
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void checkTableValidation(String value, String fieldId, ContentResponseBean contentResponseBean, List<String> errors) {
|
||||||
|
Map<String, Boolean> stateFieldMap= new HashMap<>();
|
||||||
|
|
||||||
|
contentResponseBean.getSettings().stream()
|
||||||
|
.filter(setting -> "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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} 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 +221,16 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -407,6 +407,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
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ 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.ApplicationResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||||
|
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,11 @@ 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.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 +47,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 +59,35 @@ 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 = "/{id}/form",
|
||||||
|
produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<ApplicationEvaluationResponseBean>> createApplicationEvaluation(HttpServletRequest request,
|
||||||
|
@Valid @RequestBody ApplicationRequestBean applicationRequestBean,
|
||||||
|
@Parameter(description = "The evaluation id", required = true) @PathVariable(value = "id", required = true) Long id,
|
||||||
|
@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 = "", 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);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ 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.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.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;
|
||||||
@@ -66,7 +69,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 = {
|
||||||
@@ -96,7 +100,20 @@ public interface AssignedApplicationsApi {
|
|||||||
@GetMapping(value = "/{id}", produces = "application/json")
|
@GetMapping(value = "/{id}", produces = "application/json")
|
||||||
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ 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.*;
|
||||||
|
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||||
|
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.SuperAdminWidgetResponseBean;
|
||||||
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;
|
||||||
@@ -73,17 +78,36 @@ public interface DashboardApi {
|
|||||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
||||||
ResponseEntity<Response<AmendmentWidgetResponseBean>> getAmendmentDetails(HttpServletRequest request);
|
ResponseEntity<Response<AmendmentWidgetResponseBean>> getAmendmentDetails(HttpServletRequest request);
|
||||||
|
|
||||||
@Operation(summary = "Api to get dashboard widget for pre instructor",
|
|
||||||
responses = {
|
@Operation(summary = "Api to get Application details for Evaluation",
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
responses = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@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 = "/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 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",
|
@GetMapping(value = "/instructor/amendment",
|
||||||
produces = { "application/json" })
|
produces = { "application/json" })
|
||||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
||||||
ResponseEntity<Response<PreInstructorWidgetResponseBean>> getDashboardWidgetForPreInstructor(HttpServletRequest request);
|
ResponseEntity<Response<PreInstructorWidgetResponseBean>> getDashboardWidgetForPreInstructor(HttpServletRequest request);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,6 +12,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.request.UserActionRequest;
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||||
|
import net.gepafin.tendermanagement.model.response.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;
|
||||||
@@ -85,14 +86,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,14 @@ 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.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.request.UserActionRequest;
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
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 +84,29 @@ 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<ApplicationEvaluationResponseBean>> createApplicationEvaluation(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long evaluationId, 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());
|
||||||
|
|
||||||
|
ApplicationEvaluationResponseBean applicationEvaluationResponseBean = applicationEvaluationService.createApplicationEvaluation(request, applicationRequestBean, evaluationId, 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)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ 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.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.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
import net.gepafin.tendermanagement.service.AssignedApplicationsService;
|
||||||
@@ -56,12 +59,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)));
|
||||||
}
|
}
|
||||||
@@ -89,6 +92,18 @@ public class AssignedApplicationsController implements AssignedApplicationsApi {
|
|||||||
.body(new Response<>(application, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_ASSIGNED_APPLICATION_SUCCESS_MSG)));
|
.body(new Response<>(application, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_ASSIGNED_APPLICATION_SUCCESS_MSG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,11 @@ import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
|||||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
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.AssignedApplicationWidgetResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.BeneficiaryWidgetResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.SuperAdminWidgetResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.service.DashboardService;
|
import net.gepafin.tendermanagement.service.DashboardService;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
@@ -79,4 +84,15 @@ public class DashboardApiController implements DashboardApi {
|
|||||||
return ResponseEntity.status(HttpStatus.CREATED)
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
.body(new Response<>(widgetResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY)));
|
.body(new Response<>(widgetResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
|
public ResponseEntity<Response<AssignedApplicationWidgetResponseBean>> getApplicationDetailsForEvaluation(HttpServletRequest request) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Get Application Details for Evaluation" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_APPLICATION_DETAILS_FOR_EVALUATION).build());
|
||||||
|
|
||||||
|
AssignedApplicationWidgetResponseBean widgetResponseBean= dashboardService.getApplicationDetailsForEvaluation(request);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(widgetResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
|
import net.gepafin.tendermanagement.model.request.EvaluationFormRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
|
import net.gepafin.tendermanagement.model.response.EvaluationFormResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
|
import net.gepafin.tendermanagement.service.EvaluationFormService;
|
||||||
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.EvaluationFormApi;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("${openapi.gepafin.base-path:/v1/evaluationForm}")
|
||||||
|
public class EvaluationFormApiController implements EvaluationFormApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EvaluationFormService evaluationFormService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<EvaluationFormResponseBean>> createEvaluationForm(HttpServletRequest request, Long callId, EvaluationFormRequest evaluationFormRequest) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Create Evaluation form" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT).actionContext(UserActionContextEnum.CREATE_EVALUATION_FORM).build());
|
||||||
|
|
||||||
|
EvaluationFormResponseBean evaluationFormResponseBean = evaluationFormService.createEvaluationForm(request,callId, evaluationFormRequest);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(evaluationFormResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_CREATED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<EvaluationFormResponseBean>> updateEvaluationForm(HttpServletRequest request, Long evaluationFormId, EvaluationFormRequest evaluationFormRequest) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Update Evaluation form" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.UPDATE_EVALUATION_FORM).build());
|
||||||
|
|
||||||
|
EvaluationFormResponseBean evaluationFormResponseBean = evaluationFormService.updateEvaluationForm(request, evaluationFormId, evaluationFormRequest);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(evaluationFormResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_UPDATED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<EvaluationFormResponseBean>> getEvaluationFormById(HttpServletRequest request, Long evaluationFormId) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Get Evaluation form by id" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_EVALUATION_FORM).build());
|
||||||
|
|
||||||
|
EvaluationFormResponseBean evaluationFormResponseBean= evaluationFormService.getEvaluationFormById(request,evaluationFormId);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(evaluationFormResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_FETCHED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<Void>> deleteEvaluationForm(HttpServletRequest request, Long evaluationFormId) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "delete Evaluation form" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.DELETE).actionContext(UserActionContextEnum.DELETE_EVALUATION_FORM).build());
|
||||||
|
|
||||||
|
evaluationFormService.deleteEvaluationForm(request,evaluationFormId);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_DELETED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<EvaluationFormResponseBean>> getEvaluationFormByCallId(HttpServletRequest request, Long callId) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Get Evaluation forms by call id" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_EVALUATION_FORM).build());
|
||||||
|
|
||||||
|
EvaluationFormResponseBean evaluationFormResponseBean= evaluationFormService.getEvaluationFormByCallId(request,callId);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(evaluationFormResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FORM_FETCHED_SUCCESSFULLY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2253,5 +2253,126 @@
|
|||||||
<where>unique_uuid = 'p4lk3bcx1RStqTaIVVbXs'</where>
|
<where>unique_uuid = 'p4lk3bcx1RStqTaIVVbXs'</where>
|
||||||
</update>
|
</update>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
<changeSet id="23-01-2025_RK_195215" author="Rajesh Khore">
|
||||||
|
<createTable tableName="evaluation_form">
|
||||||
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
|
<constraints nullable="false" primaryKey="true" primaryKeyName="evaluation_form_pkey"/>
|
||||||
|
</column>
|
||||||
|
<column name="label" type="VARCHAR(255)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="call_id" type="INTEGER">
|
||||||
|
<constraints nullable="false" foreignKeyName="fk_call_form" references="call(id)"/>
|
||||||
|
</column>
|
||||||
|
<column name="content" type="TEXT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
|
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
|
||||||
|
<changeSet id="24-01-2025_PK_192615" author="Rajesh Khore">
|
||||||
|
<addColumn tableName="call">
|
||||||
|
<column name="evaluation_version" type="VARCHAR(255)" defaultValue="V1">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
|
|
||||||
|
<sqlFile dbms="postgresql"
|
||||||
|
path="db/dump/updated_form_field_data_24-01-2025.sql"/>
|
||||||
|
|
||||||
|
<addColumn tableName="application">
|
||||||
|
<column name="evaluation_version" type="VARCHAR(255)" defaultValue="V1">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="24-01-2025_RK_194615" author="Rajesh Khore">
|
||||||
|
<addColumn tableName="application">
|
||||||
|
<column name="application_evaluation_id" type="INTEGER"> </column>
|
||||||
|
</addColumn>
|
||||||
|
|
||||||
|
<!-- Updating the new column with data from 'application_evaluation' -->
|
||||||
|
<update tableName="application">
|
||||||
|
<column name="application_evaluation_id" valueComputed="(SELECT ae.id FROM application_evaluation ae WHERE ae.application_id = application.id)"/>
|
||||||
|
<where>EXISTS (SELECT 1 FROM application_evaluation ae WHERE ae.application_id = application.id)</where>
|
||||||
|
</update>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="27-01-2025_RK_130515" author="Rajesh Khore">
|
||||||
|
<createTable tableName="application_evaluation_form">
|
||||||
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
|
<constraints nullable="false" primaryKey="true" primaryKeyName="application_evaluation_form_pkey"/>
|
||||||
|
</column>
|
||||||
|
<column name="application_id" type="BIGINT">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="evaluation_id" type="INTEGER">
|
||||||
|
<constraints nullable="false" foreignKeyName="fk_application_evaluation_form_application_evaluation"
|
||||||
|
references="application_evaluation(id)"/>
|
||||||
|
</column>
|
||||||
|
<column name="evaluation_form_id" type="INTEGER">
|
||||||
|
<constraints nullable="false" foreignKeyName="fk_application_evaluation_form_evaluation_form"
|
||||||
|
references="evaluation_form(id)"/>
|
||||||
|
</column>
|
||||||
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="27-01-2025_RK_131020" author="Rajesh Khore">
|
||||||
|
<createTable tableName="application_evaluation_form_field">
|
||||||
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
|
<constraints nullable="false" primaryKey="true" primaryKeyName="application_evaluation_form_field_pkey"/>
|
||||||
|
</column>
|
||||||
|
<column name="application_evaluation_form_id" type="INTEGER">
|
||||||
|
<constraints nullable="false" foreignKeyName="fk_application_evaluation_form_application_evaluation_form_field"
|
||||||
|
references="application_evaluation_form(id)"/>
|
||||||
|
</column>
|
||||||
|
<column name="field_id" type="VARCHAR(255)">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="field_value" type="VARCHAR(255)">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="30-01-2025_RK_113515" author="Rajesh Khore">
|
||||||
|
<modifyDataType
|
||||||
|
tableName="application_evaluation_form_field"
|
||||||
|
columnName="field_value"
|
||||||
|
newDataType="TEXT"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="03-01-2025_PK_124115" author="Rajesh Khore">
|
||||||
|
<addColumn tableName="application_evaluation">
|
||||||
|
<column name="evaluation_version" type="VARCHAR(255)" defaultValue="V1">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
UPDATE FORM_FIELD
|
||||||
|
SET SETTINGS = '[{"name": "label", "value": "Numero"}, {"name": "placeholder", "value": 0}, {"name": "step", "value": 0}, {"name": "isRequestedAmount", "value": false}, {"name": "variable", "value": []}, {"name": "formula", "value": ""}]'
|
||||||
|
WHERE ID = 4;
|
||||||
|
|
||||||
|
INSERT INTO FORM_FIELD (ID, SORT_ORDER, NAME, LABEL, DESCRIPTION, SETTINGS, VALIDATORS, CREATED_DATE, UPDATED_DATE)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
21,
|
||||||
|
21,
|
||||||
|
'criteria_table',
|
||||||
|
'Tabella di criteri',
|
||||||
|
'Tabella di criteri',
|
||||||
|
'[{"name": "label", "value": "Tabella"}, {"name": "criteria_table_columns", "value": {}}, {"name": "variable", "value": []}]',
|
||||||
|
'{"custom": "nonEmptyTables"}',
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
@@ -61,6 +61,7 @@ invalid.status.change.from.draft=Status cannot be changed to READY_TO_PUBLISH or
|
|||||||
status.cannot.be.changed=Status cannot be changed.
|
status.cannot.be.changed=Status cannot be changed.
|
||||||
published.call.not.update=Published call cannot be updated.
|
published.call.not.update=Published call cannot be updated.
|
||||||
invalid.status.change.from.publish=Status cannot be changed to READY_TO_PUBLISH or DRAFT from PUBLISH.
|
invalid.status.change.from.publish=Status cannot be changed to READY_TO_PUBLISH or DRAFT from PUBLISH.
|
||||||
|
validation.table.message=Data for field {0} is not present.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -266,6 +267,7 @@ evaluationCriteria.invalid=This evaluation criterion does not belong to the curr
|
|||||||
assigned.application.not.found.with.id=Assigned application with this application ID not found
|
assigned.application.not.found.with.id=Assigned application with this application ID not found
|
||||||
either.application.or.assigned.application.id.required=Either applicationId or assignedApplicationId is required.
|
either.application.or.assigned.application.id.required=Either applicationId or assignedApplicationId is required.
|
||||||
evaluation.already.exists=An application evaluation already exists for this application ID.
|
evaluation.already.exists=An application evaluation already exists for this application ID.
|
||||||
|
application.evaluation.form.get.success = Application Evaluation Form Fetched Successfully.
|
||||||
|
|
||||||
# Hub Messages
|
# Hub Messages
|
||||||
hub_create_success=Hub created successfully
|
hub_create_success=Hub created successfully
|
||||||
@@ -351,3 +353,19 @@ user.action.fetched.successfully = User action details fetched successfully.
|
|||||||
action.context.labels.fetched.successfully = Action Context Labels Fetched Successfully.
|
action.context.labels.fetched.successfully = Action Context Labels Fetched Successfully.
|
||||||
amount.accepted.required=Amount accepted is required while approving the application.
|
amount.accepted.required=Amount accepted is required while approving the application.
|
||||||
call.expired=Call has been expired.
|
call.expired=Call has been expired.
|
||||||
|
amount.request.should.greated.then.zero=Requested amount should not be empty and should be greater than zero.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
evaluation.form.created.successfully=Evaluation form created successfully.
|
||||||
|
evaluation.form.updated.successfully=Evaluation form updated successfully.
|
||||||
|
evaluation.form.deleted.successfully=Evaluation form deleted successfully.
|
||||||
|
evaluation.form.fetched.successfully=Evaluation form fetched successfully.
|
||||||
|
evaluation.form.not.found=Evaluation form not found.
|
||||||
|
|
||||||
|
either.applicationId.or.assignedApplicationId.must.be.provided=Either applicationId or assignedApplicationId must be provided.
|
||||||
|
assigned.application.status.updated.successfully=Assigned application status updated successfully.
|
||||||
|
|
||||||
|
validation.required.requested.amount=The Requested Amount configuration should be mandatory.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ application.evaluation.status.updated.successfully=Stato della valutazione dell'
|
|||||||
assigned.application.not.found.with.id=Applicazione assegnata con questo ID dell'applicazione non trovata
|
assigned.application.not.found.with.id=Applicazione assegnata con questo ID dell'applicazione non trovata
|
||||||
either.application.or.assigned.application.id.required=? richiesto almeno uno tra applicationId o assignedApplicationId.
|
either.application.or.assigned.application.id.required=? richiesto almeno uno tra applicationId o assignedApplicationId.
|
||||||
evaluation.already.exists=Una valutazione dell'applicazione esiste gi? per questo ID applicazione.
|
evaluation.already.exists=Una valutazione dell'applicazione esiste gi? per questo ID applicazione.
|
||||||
|
application.evaluation.form.get.success =Modulo di valutazione della domanda recuperato correttamente.code
|
||||||
|
|
||||||
application.assigned.success.msg =Domanda assegnata con successo
|
application.assigned.success.msg =Domanda assegnata con successo
|
||||||
application.already.assigned.msg =La domanda ? gi? assegnata
|
application.already.assigned.msg =La domanda ? gi? assegnata
|
||||||
@@ -341,4 +342,22 @@ user.with.company.not.found = Utente con azienda non trovato per utente o aziend
|
|||||||
user.action.fetched.successfully = Dettagli sull'azione dell'utente recuperati correttamente.
|
user.action.fetched.successfully = Dettagli sull'azione dell'utente recuperati correttamente.
|
||||||
action.context.labels.fetched.successfully = Etichette del contesto dell'azione recuperate correttamente.
|
action.context.labels.fetched.successfully = Etichette del contesto dell'azione recuperate correttamente.
|
||||||
amount.accepted.required=L'importo accettato <20> obbligatorio durante l'approvazione della domanda.
|
amount.accepted.required=L'importo accettato <20> obbligatorio durante l'approvazione della domanda.
|
||||||
call.expired=La chiamata è scaduta.
|
call.expired=La chiamata <EFBFBD> scaduta.
|
||||||
|
amount.request.should.greated.then.zero=L'importo richiesto non deve essere vuoto e deve essere maggiore di zero.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
evaluation.form.created.successfully=Modulo di valutazione creato con successo.
|
||||||
|
evaluation.form.updated.successfully=Modulo di valutazione aggiornato con successo.
|
||||||
|
evaluation.form.deleted.successfully=Modulo di valutazione eliminato con successo.
|
||||||
|
evaluation.form.fetched.successfully=Modulo di valutazione recuperato con successo.
|
||||||
|
evaluation.form.not.found=Modulo di valutazione non trovato.
|
||||||
|
|
||||||
|
either.applicationId.or.assignedApplicationId.must.be.provided = "<22> necessario fornire applicationId o assegnatoApplicationId."
|
||||||
|
|
||||||
|
assigned.application.status.updated.successfully=Stato dell'applicazione assegnata aggiornato con successo.
|
||||||
|
|
||||||
|
validation.required.requested.amount=La configurazione dell'importo richiesto <20> obbligatoria.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user