Done ticket GEPADINBE-6144
This commit is contained in:
@@ -33,7 +33,9 @@ import net.gepafin.tendermanagement.service.feignClient.AppointmentApiService;
|
|||||||
import net.gepafin.tendermanagement.service.impl.ApplicationEvaluationServiceImpl;
|
import net.gepafin.tendermanagement.service.impl.ApplicationEvaluationServiceImpl;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -141,6 +143,12 @@ public class AppointmentDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private NdganagRepository ndganagRepository;
|
private NdganagRepository ndganagRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationSignedDocumentRepository applicationSignedDocumentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Validator validator;
|
||||||
|
|
||||||
private final Map<Long, ScheduledExecutorService> executorMap = new ConcurrentHashMap<>();
|
private final Map<Long, ScheduledExecutorService> executorMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
@@ -1152,12 +1160,31 @@ public class AppointmentDao {
|
|||||||
return appointmentCreationRequest;
|
return appointmentCreationRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DocumentUploadResponse uploadDocumentToExternalSystem(Long documentId, UploadDocToExternalSystemRequest docToExternalSystemRequest) {
|
public DocumentUploadResponse uploadDocumentToExternalSystem(Long documentId,Boolean isSignedDocument, UploadDocToExternalSystemRequest docToExternalSystemRequest) {
|
||||||
log.info("Initiating upload to external system for documentId: {}", documentId);
|
log.info("Initiating upload to external system for documentId: {}", documentId);
|
||||||
// Check if the document is already being processed
|
// Check if the document is already being processed
|
||||||
DocumentEntity systemDoc = documentDao.validateDocument(documentId);
|
|
||||||
|
|
||||||
ApplicationEntity application = null;
|
ApplicationEntity application = null;
|
||||||
|
DocumentEntity systemDoc =null;
|
||||||
|
ApplicationSignedDocumentEntity applicationSignedDocument =null;
|
||||||
|
if(isSignedDocument!=null && Boolean.TRUE.equals(isSignedDocument)) {
|
||||||
|
|
||||||
|
//all flow in incomplete and testing for document for that unique id
|
||||||
|
applicationSignedDocument = applicationSignedDocumentRepository
|
||||||
|
.findByIdAndStatus(documentId, ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
||||||
|
if(applicationSignedDocument == null) {
|
||||||
|
log.warn("No active signed document found for id: {}", documentId);
|
||||||
|
throw new ResourceNotFoundException(Status.NOT_FOUND,
|
||||||
|
Translator.toLocale(GepafinConstant.APPLICATION_SIGNED_DOCUMENT_NOT_FOUND));
|
||||||
|
}
|
||||||
|
application=applicationDao.validateApplication(applicationSignedDocument.getApplication().getId());
|
||||||
|
// if (Boolean.TRUE.equals(validator.isProductionProfileActivated()) && application.getCall().getId().equals(23l)) {
|
||||||
|
// TO UPLOAD SIGNED DOCUMENT TO COMPANY DOCUMENT FOR SPECIFIC CALL 23 IN GEPAFIN
|
||||||
|
//// MultipartFile file=amazonS3Service.getFileFromS3Path();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
systemDoc = documentDao.validateDocument(documentId);
|
||||||
|
|
||||||
|
|
||||||
if (systemDoc != null) {
|
if (systemDoc != null) {
|
||||||
DocumentSourceTypeEnum sourceType = DocumentSourceTypeEnum.valueOf(systemDoc.getSource());
|
DocumentSourceTypeEnum sourceType = DocumentSourceTypeEnum.valueOf(systemDoc.getSource());
|
||||||
@@ -1183,6 +1210,7 @@ public class AppointmentDao {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Claims claims = tokenProvider.getClaimsFromToken(tokenProvider.extractTokenFromRequest(request));
|
Claims claims = tokenProvider.getClaimsFromToken(tokenProvider.extractTokenFromRequest(request));
|
||||||
Long hubId = Utils.extractHubIdFromPayload(claims.getSubject());
|
Long hubId = Utils.extractHubIdFromPayload(claims.getSubject());
|
||||||
@@ -1190,7 +1218,15 @@ public class AppointmentDao {
|
|||||||
// Authenticate the hub before proceeding
|
// Authenticate the hub before proceeding
|
||||||
HubEntity hub = hubRepository.findByHubId(hubId);
|
HubEntity hub = hubRepository.findByHubId(hubId);
|
||||||
authenticateAndSaveToken(hub, application);
|
authenticateAndSaveToken(hub, application);
|
||||||
if (systemDoc != null && systemDoc.getDocumentAttachmentId() != null) {
|
String documentAttachmentId=null;
|
||||||
|
if (applicationSignedDocument!=null){
|
||||||
|
documentAttachmentId=applicationSignedDocument.getDocumentAttachmentId();
|
||||||
|
}
|
||||||
|
if(systemDoc!=null) {
|
||||||
|
documentAttachmentId=systemDoc.getDocumentAttachmentId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (documentAttachmentId!=null) {
|
||||||
// If the documentAttachmentId is already set, return the response
|
// If the documentAttachmentId is already set, return the response
|
||||||
log.info("Document already uploaded with documentAttachmentId: {}", systemDoc.getDocumentAttachmentId());
|
log.info("Document already uploaded with documentAttachmentId: {}", systemDoc.getDocumentAttachmentId());
|
||||||
DocumentUploadResponse response = new DocumentUploadResponse();
|
DocumentUploadResponse response = new DocumentUploadResponse();
|
||||||
@@ -1215,7 +1251,7 @@ public class AppointmentDao {
|
|||||||
threadLocalHubId.set(hubId);
|
threadLocalHubId.set(hubId);
|
||||||
try {
|
try {
|
||||||
log.info("Starting async document upload for documentId: {}", documentId);
|
log.info("Starting async document upload for documentId: {}", documentId);
|
||||||
uploadDocumentToExternalSystemSync(documentId, docToExternalSystemRequest, finalApplication);
|
uploadDocumentToExternalSystemSync(documentId, docToExternalSystemRequest, finalApplication,isSignedDocument);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error in async document upload for documentId: {}", documentId, e);
|
log.error("Error in async document upload for documentId: {}", documentId, e);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -1231,10 +1267,21 @@ public class AppointmentDao {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uploadDocumentToExternalSystemSync(Long documentId, UploadDocToExternalSystemRequest docToExternalSystemRequest, ApplicationEntity application) {
|
private void uploadDocumentToExternalSystemSync(Long documentId, UploadDocToExternalSystemRequest docToExternalSystemRequest, ApplicationEntity application,Boolean isSignedDocument) {
|
||||||
log.info("Starting sync document upload for documentId: {}", documentId);
|
log.info("Starting sync document upload for documentId: {}", documentId);
|
||||||
// Synchronous upload logic
|
// Synchronous upload logic
|
||||||
DocumentEntity systemDoc = documentDao.validateDocument(documentId);
|
ApplicationSignedDocumentEntity applicationSignedDocument=null;
|
||||||
|
DocumentEntity systemDoc=null;
|
||||||
|
String oldUrl = null;
|
||||||
|
|
||||||
|
if(Boolean.TRUE.equals(isSignedDocument)){
|
||||||
|
applicationSignedDocument = applicationSignedDocumentRepository
|
||||||
|
.findByIdAndStatus(documentId, ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
||||||
|
oldUrl=applicationSignedDocument.getFilePath();
|
||||||
|
}else {
|
||||||
|
systemDoc = documentDao.validateDocument(documentId);
|
||||||
|
oldUrl=systemDoc.getFilePath();
|
||||||
|
}
|
||||||
|
|
||||||
Long hubId = threadLocalHubId.get();
|
Long hubId = threadLocalHubId.get();
|
||||||
HubEntity hub = hubRepository.findByHubId(hubId);
|
HubEntity hub = hubRepository.findByHubId(hubId);
|
||||||
@@ -1245,13 +1292,17 @@ public class AppointmentDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.info("Got Document in system: {}", systemDoc);
|
log.info("Got Document in system: {}", systemDoc);
|
||||||
String oldUrl = systemDoc.getFilePath();
|
|
||||||
String authorizationToken = getBearerToken(hub);
|
String authorizationToken = getBearerToken(hub);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File localFile = downloadFileFromS3(oldUrl);
|
File localFile = downloadFileFromS3(oldUrl);
|
||||||
MultipartFile multipartFile = convertFileToMultipartFile(localFile);
|
MultipartFile multipartFile = convertFileToMultipartFile(localFile);
|
||||||
|
|
||||||
|
// delete temp file
|
||||||
|
if (!localFile.delete()) {
|
||||||
|
log.warn("Failed to delete temp file: {}", localFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
UploadDocToExternalSystemRequest externalSystemRequest = new UploadDocToExternalSystemRequest();
|
UploadDocToExternalSystemRequest externalSystemRequest = new UploadDocToExternalSystemRequest();
|
||||||
externalSystemRequest.setInput(getUploadDocumentInput(docToExternalSystemRequest));
|
externalSystemRequest.setInput(getUploadDocumentInput(docToExternalSystemRequest));
|
||||||
|
|
||||||
@@ -1268,14 +1319,20 @@ public class AppointmentDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save the documentAttachmentId to the database
|
// Save the documentAttachmentId to the database
|
||||||
|
if(systemDoc!=null) {
|
||||||
systemDoc.setDocumentAttachmentId(parsedResponse.getDocumentAttachmentId());
|
systemDoc.setDocumentAttachmentId(parsedResponse.getDocumentAttachmentId());
|
||||||
documentRepository.save(systemDoc);
|
documentRepository.save(systemDoc);
|
||||||
|
}
|
||||||
|
if(applicationSignedDocument!=null){
|
||||||
|
applicationSignedDocument.setDocumentAttachmentId(parsedResponse.getDocumentAttachmentId());
|
||||||
|
applicationSignedDocumentRepository.save(applicationSignedDocument);
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Document uploaded successfully to external system: {}", parsedResponse);
|
log.info("Document uploaded successfully to external system: {}", parsedResponse);
|
||||||
} catch (FeignException.Forbidden forbiddenException) {
|
} catch (FeignException.Forbidden forbiddenException) {
|
||||||
log.error("403 Forbidden from external system during upload for documentId: {}. Retrying with new token...", documentId);
|
log.error("403 Forbidden from external system during upload for documentId: {}. Retrying with new token...", documentId);
|
||||||
regenerateTokenAndSave(hub, application);
|
regenerateTokenAndSave(hub, application);
|
||||||
uploadDocumentToExternalSystemSync(documentId, docToExternalSystemRequest, application);
|
uploadDocumentToExternalSystemSync(documentId, docToExternalSystemRequest, application,isSignedDocument);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception during document upload: {}", e.getMessage(), e);
|
log.error("Exception during document upload: {}", e.getMessage(), e);
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.EXTERNAL_DOCUMENT_UPLOAD_FAILURE_MSG));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.EXTERNAL_DOCUMENT_UPLOAD_FAILURE_MSG));
|
||||||
@@ -1305,13 +1362,21 @@ public class AppointmentDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private File downloadFileFromS3(String fileUrl) throws Exception {
|
private File downloadFileFromS3(String fileUrl) throws Exception {
|
||||||
|
|
||||||
String key = amazonS3Service.extractS3KeyFromUrl(fileUrl);
|
String key = amazonS3Service.extractS3KeyFromUrl(fileUrl);
|
||||||
String fileName = extractFileName(key);
|
String fileName = extractFileName(key);
|
||||||
String folderPath = key.substring(0, key.lastIndexOf("/"));
|
String folderPath = key.substring(0, key.lastIndexOf("/"));
|
||||||
File localFile = new File(GepafinConstant.TEMP_FILE_PATH + fileName);
|
// Use OS-independent temp folder
|
||||||
|
String tempFolder = System.getProperty("java.io.tmpdir");
|
||||||
|
|
||||||
try (InputStream s3Stream = amazonS3Service.getFile(folderPath, key); FileOutputStream outputStream = new FileOutputStream(localFile)) {
|
File tempDir = new File(tempFolder);
|
||||||
|
if (!tempDir.exists() && !tempDir.mkdirs()) {
|
||||||
|
throw new IOException("Failed to create temp folder: " + tempDir.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
File localFile = new File(tempDir, fileName);
|
||||||
|
|
||||||
|
try (InputStream s3Stream = amazonS3Service.getFile(folderPath, key);
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(localFile)) {
|
||||||
s3Stream.transferTo(outputStream);
|
s3Stream.transferTo(outputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1319,6 +1384,7 @@ public class AppointmentDao {
|
|||||||
return localFile;
|
return localFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String extractFileName(String filePath) {
|
private String extractFileName(String filePath) {
|
||||||
|
|
||||||
String[] parts = filePath.split("/");
|
String[] parts = filePath.split("/");
|
||||||
|
|||||||
@@ -91,11 +91,10 @@ public class CompanyDocumentDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AmazonS3 amazonS3;
|
private AmazonS3 amazonS3;
|
||||||
|
|
||||||
public List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, Long userId, List<MultipartFile> files, Long companyId, Long documentCategoryId, CompanyDocumentTypeEnum companyDocumentSourceTypeEnum, LocalDateTime expirationDate,String name){
|
public List<CompanyDocumentResponseBean> uploadFileForCompany(Long userId, List<MultipartFile> files, Long companyId, Long documentCategoryId, CompanyDocumentTypeEnum companyDocumentSourceTypeEnum, LocalDateTime expirationDate,String name){
|
||||||
|
|
||||||
log.info("Uploading files for company. userId={}, companyId={}, documentCategoryId={}", userId, companyId, documentCategoryId);
|
log.info("Uploading files for company. userId={}, companyId={}, documentCategoryId={}", userId, companyId, documentCategoryId);
|
||||||
DocumentCategoryEntity categoryEntity = categoryDao.validateCategory(documentCategoryId);
|
DocumentCategoryEntity categoryEntity = categoryDao.validateCategory(documentCategoryId);
|
||||||
validator.validateUserWithCompany(request,companyId);
|
|
||||||
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userId,companyId);
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userId,companyId);
|
||||||
|
|
||||||
LocalDateTime currentDate = LocalDateTime.now();
|
LocalDateTime currentDate = LocalDateTime.now();
|
||||||
|
|||||||
@@ -29,4 +29,7 @@ public class ApplicationSignedDocumentEntity extends BaseEntity {
|
|||||||
|
|
||||||
@Column(name="FILE_HASH")
|
@Column(name="FILE_HASH")
|
||||||
private String fileHash;
|
private String fileHash;
|
||||||
|
|
||||||
|
@Column(name="DOCUMENT_ATTACHMENT_ID")
|
||||||
|
private String documentAttachmentId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
package net.gepafin.tendermanagement.service;
|
package net.gepafin.tendermanagement.service;
|
||||||
|
import com.amazonaws.services.s3.AmazonS3;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public interface AppointmentService {
|
|||||||
|
|
||||||
AppointmentCreationResponse createAppointmentForApplication(HttpServletRequest request, Long applicationId, CreateAppointmentRequest createAppointmentRequest);
|
AppointmentCreationResponse createAppointmentForApplication(HttpServletRequest request, Long applicationId, CreateAppointmentRequest createAppointmentRequest);
|
||||||
|
|
||||||
DocumentUploadResponse uploadDocToExternalSystem(HttpServletRequest request, Long documentId, UploadDocToExternalSystemRequest docToExternalSystemRequest);
|
DocumentUploadResponse uploadDocToExternalSystem(HttpServletRequest request, Long documentId,Boolean isSignedDocument,UploadDocToExternalSystemRequest docToExternalSystemRequest);
|
||||||
|
|
||||||
NdgResponse getNdgByVatNumber(HttpServletRequest request,String vatNumber);
|
NdgResponse getNdgByVatNumber(HttpServletRequest request,String vatNumber);
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.mock.web.MockMultipartFile;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@@ -141,7 +142,12 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
|
|||||||
String originalFileName = org.springframework.util.StringUtils.cleanPath(file.getOriginalFilename());
|
String originalFileName = org.springframework.util.StringUtils.cleanPath(file.getOriginalFilename());
|
||||||
String firstNameContain = originalFileName.substring(0, originalFileName.lastIndexOf('.'));
|
String firstNameContain = originalFileName.substring(0, originalFileName.lastIndexOf('.'));
|
||||||
firstNameContain = Utils.replaceSpacesWithUnderscores(firstNameContain);
|
firstNameContain = Utils.replaceSpacesWithUnderscores(firstNameContain);
|
||||||
|
if(extension.equals("p7m")){
|
||||||
|
firstNameContain =Utils.randomKey(7)+"_"+firstNameContain;
|
||||||
|
|
||||||
|
}else {
|
||||||
firstNameContain += "_" + Utils.randomKey(7);
|
firstNameContain += "_" + Utils.randomKey(7);
|
||||||
|
}
|
||||||
String fileName = (firstNameContain + "." + extension);
|
String fileName = (firstNameContain + "." + extension);
|
||||||
try {
|
try {
|
||||||
String filepath = upload(fileName, s3Folder, file);
|
String filepath = upload(fileName, s3Folder, file);
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ public class AppointmentServiceImpl implements AppointmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentUploadResponse uploadDocToExternalSystem(HttpServletRequest request, Long documentId, UploadDocToExternalSystemRequest docToExternalSystemRequest) {
|
public DocumentUploadResponse uploadDocToExternalSystem(HttpServletRequest request, Long documentId,Boolean isSignedDocument, UploadDocToExternalSystemRequest docToExternalSystemRequest) {
|
||||||
|
|
||||||
return appointmentDao.uploadDocumentToExternalSystem(documentId, docToExternalSystemRequest);
|
return appointmentDao.uploadDocumentToExternalSystem(documentId,isSignedDocument, docToExternalSystemRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ public class CompanyDocumentServiceImpl implements CompanyDocumentService {
|
|||||||
Map<String, Object> userInfo = validator.getUserInfoFromToken(request);
|
Map<String, Object> userInfo = validator.getUserInfoFromToken(request);
|
||||||
Long userId = validator.getUserId(userInfo);
|
Long userId = validator.getUserId(userInfo);
|
||||||
files.forEach(Utils::validateFileType);
|
files.forEach(Utils::validateFileType);
|
||||||
return companyDocumentDao.uploadFileForCompany(request,userId,files,companyId,documentCategoryId,documentSourceTypeEnum,expirationDate,name);
|
validator.validateUserWithCompany(request,companyId);
|
||||||
|
return companyDocumentDao.uploadFileForCompany(userId,files,companyId,documentCategoryId,documentSourceTypeEnum,expirationDate,name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,10 +15,7 @@ import net.gepafin.tendermanagement.model.util.Response;
|
|||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
public interface AppointmentApi {
|
public interface AppointmentApi {
|
||||||
|
|
||||||
@@ -54,7 +51,7 @@ public interface AppointmentApi {
|
|||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@PostMapping(value = "/document/{documentId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = "/document/{documentId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
ResponseEntity<Response<DocumentUploadResponse>> uploadDocumentToExternalSystem(HttpServletRequest request,
|
ResponseEntity<Response<DocumentUploadResponse>> uploadDocumentToExternalSystem(HttpServletRequest request,
|
||||||
@Parameter(description = "The document id", required = true) @PathVariable(value = "documentId", required = true) Long documentId,
|
@Parameter(description = "The document id", required = true) @PathVariable(value = "documentId", required = true) Long documentId,@RequestParam(value = "isSignedDocument", required = false) Boolean isSignedDocument,
|
||||||
@RequestBody UploadDocToExternalSystemRequest docToExternalSystemRequest);
|
@RequestBody UploadDocToExternalSystemRequest docToExternalSystemRequest);
|
||||||
|
|
||||||
@Operation(summary = "API to get ndg by vatNumber", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
@Operation(summary = "API to get ndg by vatNumber", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
|||||||
@@ -65,14 +65,14 @@ public class AppointmentController implements AppointmentApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<DocumentUploadResponse>> uploadDocumentToExternalSystem(HttpServletRequest request, Long documentId,
|
public ResponseEntity<Response<DocumentUploadResponse>> uploadDocumentToExternalSystem(HttpServletRequest request, Long documentId,Boolean isSignedDocument,
|
||||||
UploadDocToExternalSystemRequest docToExternalSystemRequest) {
|
UploadDocToExternalSystemRequest docToExternalSystemRequest) {
|
||||||
|
|
||||||
/** This code is responsible for creating user action logs for the "Upload document to external system" operation. **/
|
/** This code is responsible for creating user action logs for the "Upload document to external system" operation. **/
|
||||||
loggingUtil.logUserAction(
|
loggingUtil.logUserAction(
|
||||||
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPLOAD).actionContext(UserActionContextEnum.UPLOAD_DOCUMENT_TO_EXTERNAL_SYSTEM).build());
|
UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPLOAD).actionContext(UserActionContextEnum.UPLOAD_DOCUMENT_TO_EXTERNAL_SYSTEM).build());
|
||||||
|
|
||||||
DocumentUploadResponse documentUploadResponse = appointmentService.uploadDocToExternalSystem(request, documentId, docToExternalSystemRequest);
|
DocumentUploadResponse documentUploadResponse = appointmentService.uploadDocToExternalSystem(request, documentId,isSignedDocument ,docToExternalSystemRequest);
|
||||||
|
|
||||||
String message = GepafinConstant.DOCUMENT_UPLOADED_SUCCESSFULLY_TO_EXTERNAL_SYSTEM;
|
String message = GepafinConstant.DOCUMENT_UPLOADED_SUCCESSFULLY_TO_EXTERNAL_SYSTEM;
|
||||||
if(documentUploadResponse == null) {
|
if(documentUploadResponse == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user