Resolved conflicts

This commit is contained in:
nisha
2024-10-12 16:08:03 +05:30
32 changed files with 517 additions and 18 deletions

View File

@@ -6,6 +6,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -21,6 +22,8 @@ import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
import net.gepafin.tendermanagement.model.response.ApplicationGetResponseBean;
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
import net.gepafin.tendermanagement.model.response.ApplicationResponseBean;
import net.gepafin.tendermanagement.model.response.ApplicationSignedDocumentResponse;
import net.gepafin.tendermanagement.model.response.CompanyDelegationResponse;
import net.gepafin.tendermanagement.model.response.NextOrPreviousFormResponse;
import net.gepafin.tendermanagement.model.util.Response;
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
@@ -148,5 +151,41 @@ public interface ApplicationApi {
@Parameter(description = "The application id", required = true)
@PathVariable(value = "applicationId", required = true) Long applicationId);
@Operation(summary = "Api to upload signed document (only p7m file format is supported)", 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 = "{applicationId}/signedDocument/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
ResponseEntity<Response<ApplicationSignedDocumentResponse>> uploadSignedDocument(HttpServletRequest request,
@Parameter(description = "The applicationId id", required = true) @PathVariable("applicationId") Long applicationId,
@Parameter(description = "The signed document", required = true) @RequestParam("file") MultipartFile file);
@Operation(summary = "Api to get signed document", 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 = "{applicationId}/signedDocument", produces = "application/json")
ResponseEntity<Response<ApplicationSignedDocumentResponse>> getSignedDocument(HttpServletRequest request,
@Parameter(description = "The applicationId id", required = true) @PathVariable("applicationId") Long applicationId);
@Operation(summary = "Api to delete signed document", 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 = "{applicationId}/signedDocument", produces = "application/json")
ResponseEntity<Response<Void>> deleteSignedDocument(HttpServletRequest request,
@Parameter(description = "The applicationId id", required = true) @PathVariable("applicationId") Long applicationId);
}

View File

@@ -134,4 +134,19 @@ public interface CallApi {
public ResponseEntity<Response<CallResponse>> updateCallStatus(HttpServletRequest request,
@Parameter(description = "The call id", required = true) @PathVariable("callId") Long callId,
@Parameter(description = "status", required = true)@RequestParam(value = "status", required = true) CallStatusEnum status);
@Operation(summary = "Api to download call documents as a ZIP file",
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 = "/{callId}/documents/zip")
ResponseEntity<byte[]> downloadCallDocumentsAsZip(HttpServletRequest httpServletRequest,
@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId);
}

View File

@@ -218,6 +218,12 @@ public interface UserApi {
produces = { "application/json" })
ResponseEntity<Response<UserSamlResponse>> validateNewUserToken(HttpServletRequest request,
@Parameter(description = "The spid token", required = true) @PathVariable("token") String token);
@RequestMapping("favicon.ico")
@ResponseBody
void returnNoFavicon();

View File

@@ -10,6 +10,8 @@ import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
import net.gepafin.tendermanagement.model.response.ApplicationGetResponseBean;
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
import net.gepafin.tendermanagement.model.response.ApplicationResponseBean;
import net.gepafin.tendermanagement.model.response.ApplicationSignedDocumentResponse;
import net.gepafin.tendermanagement.model.response.CompanyDelegationResponse;
import net.gepafin.tendermanagement.model.response.NextOrPreviousFormResponse;
import net.gepafin.tendermanagement.model.util.Response;
import net.gepafin.tendermanagement.service.ApplicationService;
@@ -24,6 +26,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.slf4j.Logger;
import java.util.List;
@@ -112,4 +115,33 @@ public class ApplicationApiController implements ApplicationApi {
.contentType(MediaType.APPLICATION_PDF)
.body(pdfBytes);
}
}
}
@Override
public ResponseEntity<Response<ApplicationSignedDocumentResponse>> uploadSignedDocument(HttpServletRequest request,
Long applicationId, MultipartFile file) {
log.info("upload signed document applicationId: {}", applicationId);
ApplicationSignedDocumentResponse response = applicationService.uploadSignedDocument(request, applicationId, file);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.SIGNED_DOCUMENT_FILE_UPLOAD_SUCCESS)));
}
@Override
public ResponseEntity<Response<ApplicationSignedDocumentResponse>> getSignedDocument(HttpServletRequest request,
Long applicationId) {
ApplicationSignedDocumentResponse response = applicationService.getSignedDocument(request, applicationId);
log.info("get signed document applicationId: {}", applicationId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_SIGNED_DOCUMENT_FILE_SUCCESS)));
}
@Override
public ResponseEntity<Response<Void>> deleteSignedDocument(HttpServletRequest request,
Long applicationId) {
applicationService.deleteSignedDocument(request, applicationId);
log.info("delete signed document applicationId: {}", applicationId);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.DELETE_SIGNED_DOCUMENT_FILE_SUCCESS)));
}
}

View File

@@ -4,7 +4,9 @@ import java.util.List;
import net.gepafin.tendermanagement.enums.CallStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -84,4 +86,22 @@ public class CallApiController implements CallApi {
CallResponse updateCall = callService.updateCallStatus(request, callId, status);
return ResponseEntity.ok(new Response<>(updateCall, Status.SUCCESS, Translator.toLocale(GepafinConstant.UPDATE_CALL_STATUS_SUCCESS_MSG)));
}
@Override
public ResponseEntity<byte[]> downloadCallDocumentsAsZip(HttpServletRequest request, Long callId) {
byte[] zipFile = callService.downloadCallDocumentsAsZip(callId);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", "documents.zip");
if (zipFile == null || zipFile.length == 0) {
String notFoundMessage = Translator.toLocale(GepafinConstant.CALL_DOCUMENTS_NOT_FOUND_MSG);
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(notFoundMessage.getBytes());
}
return new ResponseEntity<>(zipFile, headers, HttpStatus.OK);
}
}

View File

@@ -140,4 +140,10 @@ public class UserApiController implements UserApi {
return ResponseEntity.ok(new Response<>(data, Status.SUCCESS, Translator.toLocale(GepafinConstant.TOKEN_VALIDATE_SUCCESS_MSE)));
}
@Override
public void returnNoFavicon() {
// Do nothing
}
}