Updated evaluation endpoint and created an endpoint for extending response days for amendment
This commit is contained in:
@@ -276,7 +276,7 @@ public class GepafinConstant {
|
||||
public static final String APPLICATION_AMENDMENT_NOT_FOUND_MSG = "application.amendment.not.found";
|
||||
public static final String GET_APPLICATION_AMENDMENT_SUCCESS_MSG = "application.amendment.get.success";
|
||||
public static final String APPLICATION_AMENDMENT_UPDATE_SUCCESSFULLY_MSG = "application.amendment.update.successfully";
|
||||
|
||||
public static final String RESPONSE_DAYS_EXTENDED_SUCCESS_MSG = "response.days.extended.success";
|
||||
public static final String COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS = "added.comment.to.amendment.request.success";
|
||||
public static final String COMMENT_NOT_FOUND = "comment.not.found";
|
||||
public static final String COMMENT_UPDATED_SUCCESS_MSG = "comment.updated.successfully";
|
||||
|
||||
@@ -200,7 +200,7 @@ public class ApplicationAmendmentRequestDao {
|
||||
.collect(Collectors.joining(","));
|
||||
applicationAmendmentRequestEntity.setFormFields(fieldIdsString);
|
||||
}
|
||||
UserEntity userEntity = userService.validateUser(applicationEvaluationId);
|
||||
UserEntity userEntity = userService.validateUser(applicationEvaluationEntity.getUserId());
|
||||
Long protocolNumber = protocolDao.getProtocolNumber(userEntity.getHub());
|
||||
ProtocolEntity protocolEntity = protocolDao.createProtocolEntity(
|
||||
applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication(), protocolNumber,
|
||||
@@ -422,4 +422,16 @@ public class ApplicationAmendmentRequestDao {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public ApplicationAmendmentRequestResponse extendResponseDays(Long id, Long newResponseDays) {
|
||||
ApplicationAmendmentRequestEntity request = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG)));
|
||||
|
||||
if (newResponseDays != null && newResponseDays > 0) {
|
||||
Long currentResponseDays = request.getResponseDays() != null ? request.getResponseDays() : 0L;
|
||||
request.setResponseDays(currentResponseDays + newResponseDays);
|
||||
applicationAmendmentRequestRepository.save(request);
|
||||
}
|
||||
return convertEntityToResponse(request);
|
||||
}
|
||||
}
|
||||
@@ -333,10 +333,18 @@ public class ApplicationEvaluationDao {
|
||||
}
|
||||
|
||||
|
||||
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
|
||||
Optional<ApplicationEvaluationEntity> existingEntityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplciationId);
|
||||
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(
|
||||
UserEntity user,
|
||||
ApplicationEvaluationRequest req,
|
||||
Long assignedApplicationId,
|
||||
AssignedEvaluationStatus status) {
|
||||
|
||||
Optional<ApplicationEvaluationEntity> existingEntityOptional =
|
||||
applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplicationId);
|
||||
ApplicationEvaluationEntity entity;
|
||||
Optional<AssignedApplicationsEntity> assignedApplications=assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplciationId);
|
||||
Optional<AssignedApplicationsEntity> assignedApplications =
|
||||
assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplicationId);
|
||||
|
||||
if (existingEntityOptional.isPresent()) {
|
||||
entity = existingEntityOptional.get();
|
||||
entity.setCriteria(Utils.convertObjectToJson(filterNonNullCriteria(processCriteria(entity, req))));
|
||||
@@ -345,12 +353,18 @@ public class ApplicationEvaluationDao {
|
||||
entity.setIsDeleted(false);
|
||||
setIfUpdated(entity::getNote, entity::setNote, req.getNote());
|
||||
} else {
|
||||
entity = convertToEntity(user, req, assignedApplciationId);
|
||||
entity = convertToEntity(user, req, assignedApplicationId);
|
||||
}
|
||||
|
||||
if (status != null) {
|
||||
ApplicationEntity application = applicationService.validateApplication(assignedApplications.get().getApplication().getId());
|
||||
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplications.get();
|
||||
return updateApplicationEvaluationStatus(application, assignedApplicationsEntity, status);
|
||||
} else {
|
||||
ApplicationEvaluationEntity savedEntity = applicationEvaluationRepository.save(entity);
|
||||
return convertToResponse(savedEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<ChecklistRequest> filterNonNullChecklist(List<ChecklistRequest> checklistRequests) {
|
||||
return checklistRequests.stream()
|
||||
|
||||
@@ -17,5 +17,5 @@ public interface ApplicationAmendmentRequestService {
|
||||
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
|
||||
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);
|
||||
List<ApplicationAmendmentRequestResponse> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request,Long beneficiaryId);
|
||||
|
||||
ApplicationAmendmentRequestResponse extendResponseDays(HttpServletRequest request, Long id, Long addedDays);
|
||||
}
|
||||
|
||||
@@ -11,12 +11,14 @@ import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse
|
||||
import java.util.List;
|
||||
|
||||
public interface ApplicationEvaluationService {
|
||||
ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationRequest applicationEvaluationRequest,Long assignedApplicationsId);
|
||||
ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(
|
||||
HttpServletRequest request,
|
||||
ApplicationEvaluationRequest applicationEvaluationRequest,
|
||||
Long assignedApplicationsId,
|
||||
AssignedEvaluationStatus status);
|
||||
|
||||
void deleteApplicationEvaluation(HttpServletRequest request,Long id);
|
||||
|
||||
ApplicationEvaluationResponse getApplicationEvaluationByApplicationId(HttpServletRequest request,Long applicationId,Long assignedApplicationId);
|
||||
ApplicationEvaluationResponse updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedEvaluationStatus status);
|
||||
|
||||
|
||||
ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,11 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
|
||||
return applicationAmendmentRequestDao.getAllAmendmentRequestByBeneficiaryId(beneficiaryId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAmendmentRequestResponse extendResponseDays(HttpServletRequest request, Long id, Long addedDays) {
|
||||
return applicationAmendmentRequestDao.extendResponseDays(id, addedDays);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -39,11 +39,21 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(HttpServletRequest request, ApplicationEvaluationRequest req,Long assignedApplicationsId) {
|
||||
AssignedApplicationsEntity assignedApplication = assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplicationsId).orElseThrow(()->
|
||||
new ResourceNotFoundException(Status.NOT_FOUND,Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_MSG)));
|
||||
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(
|
||||
HttpServletRequest request,
|
||||
ApplicationEvaluationRequest req,
|
||||
Long assignedApplicationsId,
|
||||
AssignedEvaluationStatus status) {
|
||||
|
||||
AssignedApplicationsEntity assignedApplication = assignedApplicationsRepository
|
||||
.findByIdAndIsDeletedFalse(assignedApplicationsId)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(
|
||||
Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_MSG)));
|
||||
|
||||
UserEntity user = validator.validatePreInstructor(request, assignedApplication.getUserId());
|
||||
return applicationEvaluationDao.createOrUpdateApplicationEvaluation(user,req,assignedApplication.getId());
|
||||
|
||||
return applicationEvaluationDao.createOrUpdateApplicationEvaluation(user, req, assignedApplication.getId(), status);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,8 +88,6 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteApplicationEvaluation(HttpServletRequest request,Long id) {
|
||||
@@ -87,16 +95,6 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
|
||||
applicationEvaluationDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApplicationEvaluationResponse updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedEvaluationStatus status) {
|
||||
AssignedApplicationsEntity assignedApplication = assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplicationId).orElseThrow(()->
|
||||
new ResourceNotFoundException(Status.NOT_FOUND,Translator.toLocale(GepafinConstant.ASSIGNED_APPLICATION_NOT_FOUND_MSG)));
|
||||
validator.validatePreInstructor(request,assignedApplication.getUserId());
|
||||
return applicationEvaluationDao.updateApplicationEvaluationStatus(assignedApplication.getApplication(),assignedApplication,status);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId) {
|
||||
return applicationEvaluationDao.validateApplicationEvaluation(applicationEvaluationId);
|
||||
|
||||
@@ -112,5 +112,20 @@ public interface ApplicationAmendmentRequestApi {
|
||||
@GetMapping(value = "/beneficiary/{id}", produces = "application/json")
|
||||
ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request,
|
||||
@Parameter(description = "Id", required = false) @PathVariable(value = "id",required = false) Long beneficiaryId);
|
||||
@Operation(summary = "Api to extend response days for an amendment request",
|
||||
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}/extendExpiration", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> extendResponseDays(
|
||||
HttpServletRequest request,
|
||||
@Parameter( required = true) @PathVariable("id") Long id,
|
||||
@Parameter( required = true) @RequestParam("extendedDays") Long extendedDays);
|
||||
|
||||
}
|
||||
|
||||
@@ -36,8 +36,9 @@ public interface ApplicationEvaluationApi {
|
||||
@PutMapping(value = "/{assignedApplicationsId}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<ApplicationEvaluationResponse>> createOrUpdateApplicationEvaluation(
|
||||
HttpServletRequest request,
|
||||
@Parameter(required = true) @PathVariable("assignedApplicationsId") Long assignedApplicationsId,
|
||||
@Parameter( required = true) @Valid @RequestBody ApplicationEvaluationRequest evaluationRequest);
|
||||
@Parameter(description = "Assigned Application ID", required = true) @PathVariable("assignedApplicationsId") Long assignedApplicationsId,
|
||||
@Parameter(description = "Application Evaluation Request Body", required = true) @Valid @RequestBody ApplicationEvaluationRequest evaluationRequest,
|
||||
@Parameter( required = false) @RequestParam(value = "status", required = false) AssignedEvaluationStatus status);
|
||||
|
||||
@Operation(summary = "API to get ApplicationEvaluation data for evaluation process",
|
||||
responses = {
|
||||
@@ -60,18 +61,5 @@ public interface ApplicationEvaluationApi {
|
||||
ResponseEntity<Response<Void>> deleteApplicationEvaluation(HttpServletRequest request,
|
||||
@Parameter( required = true) @PathVariable("id") Long id);
|
||||
|
||||
@Operation(summary = "Api to update application evaluation 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 = "/{assignedApplicationId}/status", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<ApplicationEvaluationResponse>> updateApplicationEvaluationStatus(HttpServletRequest request,
|
||||
@Parameter( required = true) @PathVariable("assignedApplicationId") Long assignedApplicationId,
|
||||
@Parameter(description = "status", required = true)@RequestParam(value = "status", required = true) AssignedEvaluationStatus status);
|
||||
|
||||
}
|
||||
|
||||
@@ -79,4 +79,17 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(applicationAmendmentRequestResponseList, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> extendResponseDays(
|
||||
HttpServletRequest request,
|
||||
Long id,
|
||||
Long addedDays) {
|
||||
|
||||
log.info("Extending response days for Amendment Request ID: {}", id);
|
||||
|
||||
ApplicationAmendmentRequestResponse response = applicationAmendmentRequestService.extendResponseDays(request, id, addedDays);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.RESPONSE_DAYS_EXTENDED_SUCCESS_MSG)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,13 +30,20 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
||||
private ApplicationEvaluationService applicationEvaluationService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> createOrUpdateApplicationEvaluation(HttpServletRequest request,
|
||||
Long assignedApplicationsId,ApplicationEvaluationRequest evaluationRequest) {
|
||||
ApplicationEvaluationResponse response = applicationEvaluationService.createOrUpdateApplicationEvaluation(request,evaluationRequest,assignedApplicationsId);
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> createOrUpdateApplicationEvaluation(
|
||||
HttpServletRequest request,
|
||||
Long assignedApplicationsId,
|
||||
ApplicationEvaluationRequest evaluationRequest,
|
||||
AssignedEvaluationStatus status) {
|
||||
|
||||
ApplicationEvaluationResponse response = applicationEvaluationService.createOrUpdateApplicationEvaluation(
|
||||
request, evaluationRequest, assignedApplicationsId, status);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_CREATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> getApplicationEvaluationByApplicationId(
|
||||
HttpServletRequest request, Long applicationId, Long assignedApplicationId) {
|
||||
@@ -56,10 +63,4 @@ public class ApplicationEvaluationApiController implements ApplicationEvaluation
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<ApplicationEvaluationResponse>> updateApplicationEvaluationStatus(HttpServletRequest request, Long assignedApplicationId, AssignedEvaluationStatus status) {
|
||||
ApplicationEvaluationResponse applicationEvaluationResponse = applicationEvaluationService.updateApplicationEvaluationStatus(request, assignedApplicationId,status);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(applicationEvaluationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_EVALUATION_STATUS_UPDATED_SUCCESSFULLY)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,6 +253,7 @@ get_login_attempt_se_msg=Login attempts fetched successfully.
|
||||
application.in.submit.status.cannot.delete.company=The company cannot be deleted because there are active applications in the SUBMITTED status.
|
||||
get.users.success.msg = Successfully fetched users.
|
||||
cannot.create.beneficiary.user = Creation of a Beneficiary user is not allowed. Please assign the appropriate role.
|
||||
|
||||
application.evaluation.not.found=Application Evaluation not found with ID: {0}
|
||||
evaluation.created.successfully = Application evaluation created successfully.
|
||||
evaluation.updated.successfully = Application evaluation updated successfully.
|
||||
@@ -292,6 +293,7 @@ create.application.data.amendment.msg = Application amendment submited succesful
|
||||
application.amendment.not.found = Application Amendment Request not found with the given ID.
|
||||
application.amendment.get.success = Application Amendment details fetched successfully with given ID.
|
||||
application.amendment.update.successfully = Application Amendment Updated Successfully.
|
||||
response.days.extended.success=Response days extended successfully.
|
||||
|
||||
added.comment.to.amendment.request.success = Application Amendment Comment Added Successfully.;
|
||||
comment.not.found = Comment Not Found.";
|
||||
|
||||
@@ -287,6 +287,7 @@ delete.application.amendment.success =Emendamento all'applicazione eliminato con
|
||||
application.amendment.not.found = Richiesta di modifica dell'applicazione non trovata con l'ID indicato.
|
||||
application.amendment.get.success = Dettagli della modifica dell'applicazione recuperati correttamente con l'ID fornito.
|
||||
application.amendment.update.successfully = Emendamento all'applicazione aggiornato con successo.
|
||||
response.days.extended.success=Giorni di risposta estesi con successo.
|
||||
|
||||
added.comment.to.amendment.request.success = Commento aggiunto con successo alla richiesta di emendamento.
|
||||
comment.not.found = Commento non trovato.
|
||||
|
||||
Reference in New Issue
Block a user