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);

View File

@@ -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;
}

View File

@@ -8,6 +8,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
import net.gepafin.tendermanagement.model.response.GetAllAmendmentResponseBean;
import java.util.List;
@@ -16,7 +17,7 @@ public interface ApplicationAmendmentRequestService {
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest);
void deleteApplicationAmendmentRequest(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);
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);
List<ApplicationAmendmentRequestResponse> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request,Long beneficiaryId);

View File

@@ -12,6 +12,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
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.ApplicationEvaluationRepository;
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
@@ -83,7 +84,7 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
}
@Override
public List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(HttpServletRequest request,Long userId) {
public List<GetAllAmendmentResponseBean> getAllApplicationAmendmentRequest(HttpServletRequest request, Long userId) {
return applicationAmendmentRequestDao.getAllApplicationAmendmentRequest(request,userId);
}

View File

@@ -14,6 +14,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBea
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
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.web.rest.api.errors.ErrorConstants;
import org.springframework.http.MediaType;
@@ -88,7 +89,7 @@ public interface ApplicationAmendmentRequestApi {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@GetMapping(value = "/user", produces = "application/json")
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getAllApplicationAmendmentRequest(HttpServletRequest request,
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",

View File

@@ -12,6 +12,7 @@ import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBea
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
import net.gepafin.tendermanagement.model.request.UserActionRequest;
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.service.ApplicationAmendmentRequestService;
import net.gepafin.tendermanagement.util.LoggingUtil;
@@ -85,14 +86,14 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
}
@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");
/** 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)
.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)
.body(new Response<>(applicationAmendmentRequestResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
}