Updated code

This commit is contained in:
Piyush
2025-01-28 19:24:39 +05:30
parent b274cd672b
commit 19d7bf5e26
6 changed files with 73 additions and 8 deletions

View File

@@ -592,7 +592,7 @@ public class ApplicationAmendmentRequestDao {
return response;
}
public List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId) {
public List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId) {
if (validator.checkIsPreInstructor() && userId == null) {
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.USER_ID_NOT_NULL_MSG));
}
@@ -604,7 +604,7 @@ public class ApplicationAmendmentRequestDao {
applicationAmendmentRequestRepository.findAll(spec);
return applicationAmendmentRequestEntities.stream()
.map(entity -> convertEntityToResponse(entity, false))
.map(this::initializeGetAllBasicResponse)
.collect(Collectors.toList());
}
@@ -1178,6 +1178,37 @@ public class ApplicationAmendmentRequestDao {
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) {
documentService.deleteFile(documentId);