Added value of emailSendResponse in get Evaluation API

This commit is contained in:
Piyush
2025-05-14 14:52:27 +05:30
parent d1dcc5cf7b
commit 16f1b55356
6 changed files with 70 additions and 11 deletions

View File

@@ -314,7 +314,6 @@ public class ApplicationEvaluationDao {
response.setUpdatedDate(entity.getUpdatedDate()); response.setUpdatedDate(entity.getUpdatedDate());
response.setNumberOfCheck(entity.getAssignedApplicationsEntity().getApplication().getCall().getNumberOfCheck()); response.setNumberOfCheck(entity.getAssignedApplicationsEntity().getApplication().getCall().getNumberOfCheck());
response.setAppointmentTemplateId(entity.getAssignedApplicationsEntity().getApplication().getCall().getAppointmentTemplateId()); response.setAppointmentTemplateId(entity.getAssignedApplicationsEntity().getApplication().getCall().getAppointmentTemplateId());
} }
@@ -1093,7 +1092,7 @@ public class ApplicationEvaluationDao {
} }
validator.validatePreInstructor(request, assignedApplications.getUserId()); validator.validatePreInstructor(request, assignedApplications.getUserId());
} }
public ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(HttpServletRequest request, UserEntity user, Long applicationID, Long assignedApplicationID) { public ApplicationEvaluationResponseBean getApplicationEvaluationByApplicationId(HttpServletRequest request, UserEntity user, Long applicationID, Long assignedApplicationID) {
Long applicationId; Long applicationId;
Long assignedApplicationId; Long assignedApplicationId;
validatePreinstructor(request, applicationID, assignedApplicationID); validatePreinstructor(request, applicationID, assignedApplicationID);
@@ -1127,10 +1126,17 @@ public class ApplicationEvaluationDao {
} else { } else {
entityOptional = applicationEvaluationRepository.findFirstByIsDeletedFalseOrderByCreatedDateDesc(); entityOptional = applicationEvaluationRepository.findFirstByIsDeletedFalseOrderByCreatedDateDesc();
} }
return entityOptional.map(this::convertToResponse)
.orElseGet(() -> { if (entityOptional.isEmpty()) {
return getEvaluationResponseByApplicationid(user, applicationId, assignedApplicationId); return null;
}); }
ApplicationEvaluationEntity entity = entityOptional.get();
ApplicationEvaluationResponse response = convertToResponse(entity);
ApplicationEvaluationResponseBean targetResponse = Utils.convertSourceObjectToDestinationObject(response, ApplicationEvaluationResponseBean.class);
if (targetResponse != null && entity.getEmailSendResponse() != null) {
targetResponse.setEmailSendResponse(entity.getEmailSendResponse());
}
return targetResponse;
} }
private List<EvaluationDocumentRequest> prepareEvaluationDocumentBeanList(ApplicationEvaluationEntity entity) { private List<EvaluationDocumentRequest> prepareEvaluationDocumentBeanList(ApplicationEvaluationEntity entity) {
List<EvaluationDocumentRequest> docRequest = new ArrayList<>(); List<EvaluationDocumentRequest> docRequest = new ArrayList<>();

View File

@@ -0,0 +1,52 @@
package net.gepafin.tendermanagement.model.response;
import lombok.Data;
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.EvaluationVersionEnum;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class ApplicationEvaluationResponseBean {
private Long id;
private Long applicationId;
private ApplicationStatusTypeEnum applicationStatus;
private Long assignedApplicationId;
private String note;
private ApplicationEvaluationStatusTypeEnum status;
private Long minScore;
private List<CriteriaResponse> criteria;
private List<ChecklistResponse> checklist;
private List<FieldResponse> files;
private List<EvaluationDocumentResponse> evaluationDocument;
private List<AmendmentDocumentResponseBean> amendmentDetails;
private LocalDateTime createdDate;
private LocalDateTime updatedDate;
private String beneficiary;
private Long assignedUserId;
private String assignedUserName;
private Long protocolNumber;
private String callName;
private String motivation;
private LocalDateTime submissionDate;
private LocalDateTime evaluationEndDate;
private LocalDateTime callEndDate;
private String companyName;
private LocalDateTime assignedAt;
private String ndg;
private String appointmentId;
private BigDecimal amountRequested;
private BigDecimal amountAccepted;
private LocalDateTime dateAccepted;
private LocalDateTime dateRejected;
private Long numberOfCheck;
private Long appointmentTemplateId;
private EvaluationVersionEnum evaluationVersion;
private String companyVatNumber;
private String companyCodiceAteco;
private List<EmailSendResponse> emailSendResponse;
}

View File

@@ -19,7 +19,7 @@ public interface ApplicationEvaluationService {
void deleteApplicationEvaluation(HttpServletRequest request,Long id); void deleteApplicationEvaluation(HttpServletRequest request,Long id);
ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(HttpServletRequest request,Long applicationId,Long assignedApplicationId); ApplicationEvaluationResponseBean getApplicationEvaluationByApplicationId(HttpServletRequest request,Long applicationId,Long assignedApplicationId);
ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId); ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId);
ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId); ApplicationEvaluationEntity validateApplicationEvaluationByApplicationId(Long applicationId);

View File

@@ -11,6 +11,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationEvaluationFormReque
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest; import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationFormResponse; 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.model.response.ApplicationEvaluationVersionResponse; import net.gepafin.tendermanagement.model.response.ApplicationEvaluationVersionResponse;
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository; import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
import net.gepafin.tendermanagement.service.ApplicationEvaluationService; import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
@@ -56,7 +57,7 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public ApplicationEvaluationResponse getApplicationEvaluationByApplicationId( public ApplicationEvaluationResponseBean getApplicationEvaluationByApplicationId(
HttpServletRequest request, Long applicationId, Long assignedApplicationId) { HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
UserEntity preInstructor = validator.validateUser(request); UserEntity preInstructor = validator.validateUser(request);
return applicationEvaluationDao.getApplicationEvaluationByApplicationId( return applicationEvaluationDao.getApplicationEvaluationByApplicationId(

View File

@@ -44,7 +44,7 @@ public interface ApplicationEvaluationApi {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })) @ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) }))
}) })
@GetMapping(value = "/application", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/application", produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId( ResponseEntity<Response<ApplicationEvaluationResponseBean>> getApplicationEvaluationByApplicationId(
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);

View File

@@ -51,7 +51,7 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
@Override @Override
public ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId( public ResponseEntity<Response<ApplicationEvaluationResponseBean>> getApplicationEvaluationByApplicationId(
HttpServletRequest request, Long applicationId, Long assignedApplicationId) { HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
@@ -59,7 +59,7 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_APPLICATION_EVALUATION).build()); loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_APPLICATION_EVALUATION).build());
ApplicationEvaluationResponse response = null; ApplicationEvaluationResponseBean response = null;
response = applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId,assignedApplicationId); response = applicationEvaluationService.getApplicationEvaluationByApplicationId(request, applicationId,assignedApplicationId);
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FETCHED_SUCCESSFULLY))); .body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_FETCHED_SUCCESSFULLY)));